Something went wrong. Try again.
This repository has no description
Something went wrong. Try again.
9.3 kB · 272 lines
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273// Code generated by glex; DO NOT EDIT.
// Lexicon schema: place.stream.media.track
package placestream
import ( "encoding/json" "fmt" "io"
glex "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" appbsky "stream.place/streamplace/pkg/appbsky" comatproto "stream.place/streamplace/pkg/comatproto")
func init() { glex.RegisterType("place.stream.media.track", &MediaTrack{})}
// A track for a video stream, either part of the source or a custom additional track. One of: video, audio, subtitles.type MediaTrack struct { LexiconTypeID string `json:"$type,omitempty"` Metadata *MediaTrack_Metadata `json:"metadata,omitempty"` // parentTrack: If this is a derived track like a transcode or a transcript, what was the parent track? ParentTrack *comatproto.RepoStrongRef `json:"parentTrack,omitempty"` Track MediaTrack_Track `json:"track"` // video: If this is a derived track like a transcode or a transcript, what was the source place.stream.video? Video *string `json:"video,omitempty"`}
// RecordTypeID implements glex.Record.func (t *MediaTrack) RecordTypeID() string { return "place.stream.media.track" }
// MarshalJSON stamps the $type field, like MarshalCBOR does. The value// receiver operates on a copy, so the record is never mutated and both// MediaTrack and *MediaTrack marshal with $type.func (t MediaTrack) MarshalJSON() ([]byte, error) { t.LexiconTypeID = "place.stream.media.track" type alias MediaTrack return json.Marshal((alias)(t))}
func (t *MediaTrack) MarshalCBOR(w io.Writer) error { if t == nil { _, err := w.Write(cbg.CborNull) return err } // stamp $type on a copy so marshal never mutates the record cp := *t cp.LexiconTypeID = "place.stream.media.track" return glex.MarshalCBOR(w, &cp)}
func (t *MediaTrack) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t)}
type MediaTrack_Metadata struct { MediaTrack_CommonMetadata *MediaTrack_CommonMetadata // Raw preserves a variant whose $type is not in this union's generated // set, so unrecognized variants still round-trip losslessly through // decode/re-encode. Nil when a known variant is set. Raw *glex.RawRecord}
// MarshalJSON emits the set variant, stamped with its $type, per the atproto// union wire format. The value receiver stamps a copy, so the variant is// never mutated and both MediaTrack_Metadata and *MediaTrack_Metadata marshal correctly.func (t MediaTrack_Metadata) MarshalJSON() ([]byte, error) { if t.MediaTrack_CommonMetadata != nil { cp := *t.MediaTrack_CommonMetadata cp.LexiconTypeID = "place.stream.media.track#commonMetadata" return json.Marshal(&cp) } if t.Raw != nil { if t.Raw.Encoding != "json" { return nil, fmt.Errorf("cannot marshal raw %s record as JSON in union MediaTrack_Metadata", t.Raw.Encoding) } return t.Raw.Bytes, nil } return nil, fmt.Errorf("cannot marshal empty union MediaTrack_Metadata as JSON")}
func (t *MediaTrack_Metadata) UnmarshalJSON(b []byte) error { typ, err := glex.TypeExtract(b) if err != nil { return err }
switch typ { case "place.stream.media.track#commonMetadata": t.MediaTrack_CommonMetadata = new(MediaTrack_CommonMetadata) return json.Unmarshal(b, t.MediaTrack_CommonMetadata) default: t.Raw = &glex.RawRecord{Type: typ, Encoding: "json", Bytes: append([]byte(nil), b...)} return nil }}
// MarshalCBOR implements drisl.Marshaler, emitting the set variant (stamped// with its $type) per the atproto union wire format. go-dasl invokes this// when the union appears inside another record, so nested unions serialize// correctly.func (t MediaTrack_Metadata) MarshalCBOR() ([]byte, error) { if t.MediaTrack_CommonMetadata != nil { cp := *t.MediaTrack_CommonMetadata cp.LexiconTypeID = "place.stream.media.track#commonMetadata" return glex.MarshalCBORBytes(&cp) } if t.Raw != nil { if t.Raw.Encoding != "cbor" { return nil, fmt.Errorf("cannot marshal raw %s record as CBOR in union MediaTrack_Metadata", t.Raw.Encoding) } return t.Raw.Bytes, nil } return nil, fmt.Errorf("cannot marshal empty union MediaTrack_Metadata as CBOR")}
func (t *MediaTrack_Metadata) UnmarshalCBOR(b []byte) error { typ, err := glex.CborTypeExtract(b) if err != nil { return err }
switch typ { case "place.stream.media.track#commonMetadata": t.MediaTrack_CommonMetadata = new(MediaTrack_CommonMetadata) return glex.UnmarshalCBORBytes(b, t.MediaTrack_CommonMetadata) default: t.Raw = &glex.RawRecord{Type: typ, Encoding: "cbor", Bytes: append([]byte(nil), b...)} return nil }}
type MediaTrack_Track struct { MediaDefs_MuxlTrack *MediaDefs_MuxlTrack // Raw preserves a variant whose $type is not in this union's generated // set, so unrecognized variants still round-trip losslessly through // decode/re-encode. Nil when a known variant is set. Raw *glex.RawRecord}
// MarshalJSON emits the set variant, stamped with its $type, per the atproto// union wire format. The value receiver stamps a copy, so the variant is// never mutated and both MediaTrack_Track and *MediaTrack_Track marshal correctly.func (t MediaTrack_Track) MarshalJSON() ([]byte, error) { if t.MediaDefs_MuxlTrack != nil { cp := *t.MediaDefs_MuxlTrack cp.LexiconTypeID = "place.stream.media.defs#muxlTrack" return json.Marshal(&cp) } if t.Raw != nil { if t.Raw.Encoding != "json" { return nil, fmt.Errorf("cannot marshal raw %s record as JSON in union MediaTrack_Track", t.Raw.Encoding) } return t.Raw.Bytes, nil } return nil, fmt.Errorf("cannot marshal empty union MediaTrack_Track as JSON")}
func (t *MediaTrack_Track) UnmarshalJSON(b []byte) error { typ, err := glex.TypeExtract(b) if err != nil { return err }
switch typ { case "place.stream.media.defs#muxlTrack": t.MediaDefs_MuxlTrack = new(MediaDefs_MuxlTrack) return json.Unmarshal(b, t.MediaDefs_MuxlTrack) default: t.Raw = &glex.RawRecord{Type: typ, Encoding: "json", Bytes: append([]byte(nil), b...)} return nil }}
// MarshalCBOR implements drisl.Marshaler, emitting the set variant (stamped// with its $type) per the atproto union wire format. go-dasl invokes this// when the union appears inside another record, so nested unions serialize// correctly.func (t MediaTrack_Track) MarshalCBOR() ([]byte, error) { if t.MediaDefs_MuxlTrack != nil { cp := *t.MediaDefs_MuxlTrack cp.LexiconTypeID = "place.stream.media.defs#muxlTrack" return glex.MarshalCBORBytes(&cp) } if t.Raw != nil { if t.Raw.Encoding != "cbor" { return nil, fmt.Errorf("cannot marshal raw %s record as CBOR in union MediaTrack_Track", t.Raw.Encoding) } return t.Raw.Bytes, nil } return nil, fmt.Errorf("cannot marshal empty union MediaTrack_Track as CBOR")}
func (t *MediaTrack_Track) UnmarshalCBOR(b []byte) error { typ, err := glex.CborTypeExtract(b) if err != nil { return err }
switch typ { case "place.stream.media.defs#muxlTrack": t.MediaDefs_MuxlTrack = new(MediaDefs_MuxlTrack) return glex.UnmarshalCBORBytes(b, t.MediaDefs_MuxlTrack) default: t.Raw = &glex.RawRecord{Type: typ, Encoding: "cbor", Bytes: append([]byte(nil), b...)} return nil }}
// MediaTrack_CommonMetadata is a "commonMetadata" in the place.stream.media.track schema.//// Metadata common to all media types. Contains subobjects for other media types.type MediaTrack_CommonMetadata struct { LexiconTypeID string `json:"$type,omitempty"` Audio *Segment_Audio `json:"audio,omitempty"` // durationMs: duration of this track in milliseconds DurationMs *int64 `json:"durationMs,omitempty"` // language: IETF BCP 47 language tag corresponding to the content of this track Language *string `json:"language,omitempty"` Video *Segment_Video `json:"video,omitempty"`}
// RecordTypeID implements glex.Record.func (t *MediaTrack_CommonMetadata) RecordTypeID() string { return "place.stream.media.track#commonMetadata"}
func (t *MediaTrack_CommonMetadata) MarshalCBOR(w io.Writer) error { if t == nil { _, err := w.Write(cbg.CborNull) return err } // stamp $type on a copy so marshal never mutates the record cp := *t cp.LexiconTypeID = "place.stream.media.track#commonMetadata" return glex.MarshalCBOR(w, &cp)}
func (t *MediaTrack_CommonMetadata) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t)}
// MediaTrack_TrackView is a "trackView" in the place.stream.media.track schema.type MediaTrack_TrackView struct { LexiconTypeID string `json:"$type,omitempty"` Author appbsky.ActorDefs_ProfileViewBasic `json:"author"` Cid string `json:"cid"` Record *glex.LexiconTypeDecoder `json:"record"` Uri string `json:"uri"`}
// RecordTypeID implements glex.Record.func (t *MediaTrack_TrackView) RecordTypeID() string { return "place.stream.media.track#trackView" }
func (t *MediaTrack_TrackView) MarshalCBOR(w io.Writer) error { if t == nil { _, err := w.Write(cbg.CborNull) return err } // stamp $type on a copy so marshal never mutates the record cp := *t cp.LexiconTypeID = "place.stream.media.track#trackView" return glex.MarshalCBOR(w, &cp)}
func (t *MediaTrack_TrackView) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t)}