diff --git a/Makefile b/Makefile
index 97c04384d..fdfdae6f4 100644
--- a/Makefile
+++ b/Makefile
@@ -396,8 +396,8 @@ go-lexicons:
&& echo 'func (t *MediaDefs_SourceTracks) UnmarshalCBOR(r io.Reader) error { return nil }' >> pkg/streamplace/cbor_gen.go \
&& echo 'func (t *MediaDefs_SourceClip) MarshalCBOR(w io.Writer) error { return nil }' >> pkg/streamplace/cbor_gen.go \
&& echo 'func (t *MediaDefs_SourceClip) UnmarshalCBOR(r io.Reader) error { return nil }' >> pkg/streamplace/cbor_gen.go \
- && echo 'func (t *MetadataVideo_Connection) MarshalCBOR(w io.Writer) error { return nil }' >> pkg/streamplace/cbor_gen.go \
- && echo 'func (t *MetadataVideo_Connection) UnmarshalCBOR(r io.Reader) error { return nil }' >> pkg/streamplace/cbor_gen.go \
+ && echo 'func (t *Video_Connection) MarshalCBOR(w io.Writer) error { return nil }' >> pkg/streamplace/cbor_gen.go \
+ && echo 'func (t *Video_Connection) UnmarshalCBOR(r io.Reader) error { return nil }' >> pkg/streamplace/cbor_gen.go \
&& sed -i.bak 's/\tlexutil\.RegisterType/\/\/\tlexutil.RegisterType/' $$(find ./pkg/streamplace -type f) \
&& go run golang.org/x/tools/cmd/goimports@latest -w $$(find ./pkg/streamplace ./pkg/gamesgamesgamesgames -type f) \
&& go run ./pkg/gen/gen_stubs.go \
diff --git a/js/docs/src/content/docs/lex-reference/media/place-stream-media-content.md b/js/docs/src/content/docs/lex-reference/media/place-stream-media-content.md
new file mode 100644
index 000000000..36b8482af
--- /dev/null
+++ b/js/docs/src/content/docs/lex-reference/media/place-stream-media-content.md
@@ -0,0 +1,67 @@
+---
+title: place.stream.media.content
+description: Reference for the place.stream.media.content lexicon
+---
+
+**Lexicon Version:** 1
+
+## Definitions
+
+
+
+### `main`
+
+**Type:** `record`
+
+Some media content: potentially video, audio, or subtitles. This record is intentionally minimal so that metadata can be altered without breaking strongRefs. For the stream's title and description and whatnot, check the `place.stream.video` with the tid matching this video.
+
+**Record Key:** `tid`
+
+**Record Properties:**
+
+| Name | Type | Req'd | Description | Constraints |
+| ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- | ------------------------------------------------------------------------------------------ | ------------------ |
+| `createdAt` | `string` | ✅ | Time this video was created. | Format: `datetime` |
+| `duration` | `integer` | ✅ | Total duration of the video in milliseconds. | |
+| `source` | Union of:
[`place.stream.media.defs#sourceTracks`](/lex-reference/place-stream-media-defs#sourcetracks)
[`place.stream.media.defs#sourceClip`](/lex-reference/place-stream-media-defs#sourceclip) | ✅ | The canonical source of this video, either some media tracks or a clip from another video. | |
+
+---
+
+## Lexicon Source
+
+```json
+{
+ "lexicon": 1,
+ "id": "place.stream.media.content",
+ "defs": {
+ "main": {
+ "type": "record",
+ "description": "Some media content: potentially video, audio, or subtitles. This record is intentionally minimal so that metadata can be altered without breaking strongRefs. For the stream's title and description and whatnot, check the `place.stream.video` with the tid matching this video.",
+ "key": "tid",
+ "record": {
+ "type": "object",
+ "required": ["createdAt", "source", "duration"],
+ "properties": {
+ "createdAt": {
+ "type": "string",
+ "format": "datetime",
+ "description": "Time this video was created."
+ },
+ "duration": {
+ "type": "integer",
+ "description": "Total duration of the video in milliseconds."
+ },
+ "source": {
+ "type": "union",
+ "refs": [
+ "place.stream.media.defs#sourceTracks",
+ "place.stream.media.defs#sourceClip"
+ ],
+ "description": "The canonical source of this video, either some media tracks or a clip from another video."
+ }
+ }
+ }
+ }
+ }
+}
+```
diff --git a/js/docs/src/content/docs/lex-reference/metadata/place-stream-metadata-video.md b/js/docs/src/content/docs/lex-reference/metadata/place-stream-metadata-video.md
deleted file mode 100644
index 5dd473f3f..000000000
--- a/js/docs/src/content/docs/lex-reference/metadata/place-stream-metadata-video.md
+++ /dev/null
@@ -1,135 +0,0 @@
----
-title: place.stream.metadata.video
-description: Reference for the place.stream.metadata.video lexicon
----
-
-**Lexicon Version:** 1
-
-## Definitions
-
-
-
-### `main`
-
-**Type:** `record`
-
-Metadata for a place.stream.video record. By convention the video and the metadata shall have the same tid.
-
-**Record Key:** `tid`
-
-**Record Properties:**
-
-| Name | Type | Req'd | Description | Constraints |
-| ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------- |
-| `title` | `string` | ✅ | Title of the video referenced by this record | Max Length: 1400
Max Graphemes: 140 |
-| `description` | `string` | ❌ | Description of this video | Max Length: 50000
Max Graphemes: 5000 |
-| `descriptionFacets` | Array of [`place.stream.richtext.facet`](/lex-reference/place-stream-richtext-facet) | ❌ | Annotations of text (mentions, URLs, etc) | |
-| `thumb` | `blob` | ❌ | Thumbnail image for the video. | Accept: `image/*`
Max Size: 1000000 bytes |
-| `connections` | Array of Union of:
[`#connection`](#connection) | ❌ | Free-form list of atproto records related in some way to this video | |
-| `contentPolicy` | [`place.stream.metadata.configuration`](/lex-reference/place-stream-metadata-configuration) | ❌ | copyright, distribution, and content warning data | |
-| `activity` | Union of:
[`place.stream.defs#activityGame`](/lex-reference/place-stream-defs#activitygame)
[`place.stream.defs#activityLabel`](/lex-reference/place-stream-defs#activitylabel) | ❌ | The game or activity in the video. | |
-| `tags` | Array of `string` | ❌ | Freeform tags for this stream. Each tag must be alphanumeric (a-z, A-Z, 0-9) plus colon. Tags with colons indicate a specific tag group (e.g. 'lang:en' indicates the stream's primary language). | Max Items: 10 |
-
----
-
-
-
-### `connection`
-
-**Type:** `object`
-
-**Properties:**
-
-| Name | Type | Req'd | Description | Constraints |
-| ----- | -------------------------------------------------------------------------------------------------------------------------------------- | ----- | ----------- | ----------- |
-| `ref` | [`com.atproto.repo.strongRef`](https://github.com/bluesky-social/atproto/tree/main/lexicons/com/atproto/repo/strongref.json#undefined) | ❌ | | |
-
----
-
-## Lexicon Source
-
-```json
-{
- "lexicon": 1,
- "id": "place.stream.metadata.video",
- "defs": {
- "main": {
- "type": "record",
- "description": "Metadata for a place.stream.video record. By convention the video and the metadata shall have the same tid.",
- "key": "tid",
- "record": {
- "required": ["title"],
- "type": "object",
- "properties": {
- "title": {
- "type": "string",
- "maxLength": 1400,
- "maxGraphemes": 140,
- "description": "Title of the video referenced by this record"
- },
- "description": {
- "type": "string",
- "maxLength": 50000,
- "maxGraphemes": 5000,
- "description": "Description of this video"
- },
- "descriptionFacets": {
- "type": "array",
- "description": "Annotations of text (mentions, URLs, etc)",
- "items": {
- "type": "ref",
- "ref": "place.stream.richtext.facet"
- }
- },
- "thumb": {
- "description": "Thumbnail image for the video.",
- "type": "blob",
- "accept": ["image/*"],
- "maxSize": 1000000
- },
- "connections": {
- "type": "array",
- "description": "Free-form list of atproto records related in some way to this video",
- "items": {
- "type": "union",
- "refs": ["#connection"]
- }
- },
- "contentPolicy": {
- "description": "copyright, distribution, and content warning data",
- "type": "ref",
- "ref": "place.stream.metadata.configuration"
- },
- "activity": {
- "type": "union",
- "description": "The game or activity in the video.",
- "refs": [
- "place.stream.defs#activityGame",
- "place.stream.defs#activityLabel"
- ]
- },
- "tags": {
- "type": "array",
- "description": "Freeform tags for this stream. Each tag must be alphanumeric (a-z, A-Z, 0-9) plus colon. Tags with colons indicate a specific tag group (e.g. 'lang:en' indicates the stream's primary language).",
- "maxLength": 10,
- "items": {
- "type": "string",
- "maxLength": 640,
- "maxGraphemes": 64
- }
- }
- }
- }
- },
- "connection": {
- "type": "object",
- "properties": {
- "ref": {
- "type": "ref",
- "ref": "com.atproto.repo.strongRef"
- }
- }
- }
- }
-}
-```
diff --git a/js/docs/src/content/docs/lex-reference/place-stream-video.md b/js/docs/src/content/docs/lex-reference/place-stream-video.md
index ab081f25d..e9acd8e71 100644
--- a/js/docs/src/content/docs/lex-reference/place-stream-video.md
+++ b/js/docs/src/content/docs/lex-reference/place-stream-video.md
@@ -13,17 +13,36 @@ description: Reference for the place.stream.video lexicon
**Type:** `record`
-Some media content: potentially video, audio, or subtitles. This record is intentionally minimal so that metadata can be altered without breaking strongRefs. For the stream's title and description and whatnot, check the `place.stream.metadata.video` with the tid matching this video.
+Metadata for a place.stream.video record. By convention the video and the metadata shall have the same tid.
**Record Key:** `tid`
**Record Properties:**
-| Name | Type | Req'd | Description | Constraints |
-| ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- | ------------------------------------------------------------------------------------------ | ------------------ |
-| `createdAt` | `string` | ✅ | Time this video was created. | Format: `datetime` |
-| `duration` | `integer` | ✅ | Total duration of the video in milliseconds. | |
-| `source` | Union of:
[`place.stream.media.defs#sourceTracks`](/lex-reference/place-stream-media-defs#sourcetracks)
[`place.stream.media.defs#sourceClip`](/lex-reference/place-stream-media-defs#sourceclip) | ✅ | The canonical source of this video, either some media tracks or a clip from another video. | |
+| Name | Type | Req'd | Description | Constraints |
+| ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------- |
+| `title` | `string` | ✅ | Title of the video referenced by this record | Max Length: 1400
Max Graphemes: 140 |
+| `description` | `string` | ❌ | Description of this video | Max Length: 50000
Max Graphemes: 5000 |
+| `descriptionFacets` | Array of [`place.stream.richtext.facet`](/lex-reference/place-stream-richtext-facet) | ❌ | Annotations of text (mentions, URLs, etc) | |
+| `thumb` | `blob` | ❌ | Thumbnail image for the video. | Accept: `image/*`
Max Size: 1000000 bytes |
+| `connections` | Array of Union of:
[`#connection`](#connection) | ❌ | Free-form list of atproto records related in some way to this video | |
+| `contentPolicy` | [`place.stream.metadata.configuration`](/lex-reference/place-stream-metadata-configuration) | ❌ | copyright, distribution, and content warning data | |
+| `activity` | Union of:
[`place.stream.defs#activityGame`](/lex-reference/place-stream-defs#activitygame)
[`place.stream.defs#activityLabel`](/lex-reference/place-stream-defs#activitylabel) | ❌ | The game or activity in the video. | |
+| `tags` | Array of `string` | ❌ | Freeform tags for this stream. Each tag must be alphanumeric (a-z, A-Z, 0-9) plus colon. Tags with colons indicate a specific tag group (e.g. 'lang:en' indicates the stream's primary language). | Max Items: 10 |
+
+---
+
+
+
+### `connection`
+
+**Type:** `object`
+
+**Properties:**
+
+| Name | Type | Req'd | Description | Constraints |
+| ----- | -------------------------------------------------------------------------------------------------------------------------------------- | ----- | ----------- | ----------- |
+| `ref` | [`com.atproto.repo.strongRef`](https://github.com/bluesky-social/atproto/tree/main/lexicons/com/atproto/repo/strongref.json#undefined) | ❌ | | |
---
@@ -36,31 +55,80 @@ Some media content: potentially video, audio, or subtitles. This record is inten
"defs": {
"main": {
"type": "record",
- "description": "Some media content: potentially video, audio, or subtitles. This record is intentionally minimal so that metadata can be altered without breaking strongRefs. For the stream's title and description and whatnot, check the `place.stream.metadata.video` with the tid matching this video.",
+ "description": "Metadata for a place.stream.video record. By convention the video and the metadata shall have the same tid.",
"key": "tid",
"record": {
+ "required": ["title"],
"type": "object",
- "required": ["createdAt", "source", "duration"],
"properties": {
- "createdAt": {
+ "title": {
"type": "string",
- "format": "datetime",
- "description": "Time this video was created."
+ "maxLength": 1400,
+ "maxGraphemes": 140,
+ "description": "Title of the video referenced by this record"
},
- "duration": {
- "type": "integer",
- "description": "Total duration of the video in milliseconds."
+ "description": {
+ "type": "string",
+ "maxLength": 50000,
+ "maxGraphemes": 5000,
+ "description": "Description of this video"
},
- "source": {
+ "descriptionFacets": {
+ "type": "array",
+ "description": "Annotations of text (mentions, URLs, etc)",
+ "items": {
+ "type": "ref",
+ "ref": "place.stream.richtext.facet"
+ }
+ },
+ "thumb": {
+ "description": "Thumbnail image for the video.",
+ "type": "blob",
+ "accept": ["image/*"],
+ "maxSize": 1000000
+ },
+ "connections": {
+ "type": "array",
+ "description": "Free-form list of atproto records related in some way to this video",
+ "items": {
+ "type": "union",
+ "refs": ["#connection"]
+ }
+ },
+ "contentPolicy": {
+ "description": "copyright, distribution, and content warning data",
+ "type": "ref",
+ "ref": "place.stream.metadata.configuration"
+ },
+ "activity": {
"type": "union",
+ "description": "The game or activity in the video.",
"refs": [
- "place.stream.media.defs#sourceTracks",
- "place.stream.media.defs#sourceClip"
- ],
- "description": "The canonical source of this video, either some media tracks or a clip from another video."
+ "place.stream.defs#activityGame",
+ "place.stream.defs#activityLabel"
+ ]
+ },
+ "tags": {
+ "type": "array",
+ "description": "Freeform tags for this stream. Each tag must be alphanumeric (a-z, A-Z, 0-9) plus colon. Tags with colons indicate a specific tag group (e.g. 'lang:en' indicates the stream's primary language).",
+ "maxLength": 10,
+ "items": {
+ "type": "string",
+ "maxLength": 640,
+ "maxGraphemes": 64
+ }
}
}
}
+ },
+ "connection": {
+ "type": "object",
+ "properties": {
+ "ref": {
+ "type": "ref",
+ "ref": "com.atproto.repo.strongRef"
+ }
+ }
}
}
}
diff --git a/lexicons/place/stream/media/content.json b/lexicons/place/stream/media/content.json
new file mode 100644
index 000000000..f900111fc
--- /dev/null
+++ b/lexicons/place/stream/media/content.json
@@ -0,0 +1,34 @@
+{
+ "lexicon": 1,
+ "id": "place.stream.media.content",
+ "defs": {
+ "main": {
+ "type": "record",
+ "description": "Some media content: potentially video, audio, or subtitles. This record is intentionally minimal so that metadata can be altered without breaking strongRefs. For the stream's title and description and whatnot, check the `place.stream.video` with the tid matching this video.",
+ "key": "tid",
+ "record": {
+ "type": "object",
+ "required": ["createdAt", "source", "duration"],
+ "properties": {
+ "createdAt": {
+ "type": "string",
+ "format": "datetime",
+ "description": "Time this video was created."
+ },
+ "duration": {
+ "type": "integer",
+ "description": "Total duration of the video in milliseconds."
+ },
+ "source": {
+ "type": "union",
+ "refs": [
+ "place.stream.media.defs#sourceTracks",
+ "place.stream.media.defs#sourceClip"
+ ],
+ "description": "The canonical source of this video, either some media tracks or a clip from another video."
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/lexicons/place/stream/metadata/video.json b/lexicons/place/stream/metadata/video.json
deleted file mode 100644
index e631b2e6c..000000000
--- a/lexicons/place/stream/metadata/video.json
+++ /dev/null
@@ -1,80 +0,0 @@
-{
- "lexicon": 1,
- "id": "place.stream.metadata.video",
- "defs": {
- "main": {
- "type": "record",
- "description": "Metadata for a place.stream.video record. By convention the video and the metadata shall have the same tid.",
- "key": "tid",
- "record": {
- "required": ["title"],
- "type": "object",
- "properties": {
- "title": {
- "type": "string",
- "maxLength": 1400,
- "maxGraphemes": 140,
- "description": "Title of the video referenced by this record"
- },
- "description": {
- "type": "string",
- "maxLength": 50000,
- "maxGraphemes": 5000,
- "description": "Description of this video"
- },
- "descriptionFacets": {
- "type": "array",
- "description": "Annotations of text (mentions, URLs, etc)",
- "items": { "type": "ref", "ref": "place.stream.richtext.facet" }
- },
- "thumb": {
- "description": "Thumbnail image for the video.",
- "type": "blob",
- "accept": ["image/*"],
- "maxSize": 1000000
- },
- "connections": {
- "type": "array",
- "description": "Free-form list of atproto records related in some way to this video",
- "items": {
- "type": "union",
- "refs": ["#connection"]
- }
- },
- "contentPolicy": {
- "description": "copyright, distribution, and content warning data",
- "type": "ref",
- "ref": "place.stream.metadata.configuration"
- },
- "activity": {
- "type": "union",
- "description": "The game or activity in the video.",
- "refs": [
- "place.stream.defs#activityGame",
- "place.stream.defs#activityLabel"
- ]
- },
- "tags": {
- "type": "array",
- "description": "Freeform tags for this stream. Each tag must be alphanumeric (a-z, A-Z, 0-9) plus colon. Tags with colons indicate a specific tag group (e.g. 'lang:en' indicates the stream's primary language).",
- "maxLength": 10,
- "items": {
- "type": "string",
- "maxLength": 640,
- "maxGraphemes": 64
- }
- }
- }
- }
- },
- "connection": {
- "type": "object",
- "properties": {
- "ref": {
- "type": "ref",
- "ref": "com.atproto.repo.strongRef"
- }
- }
- }
- }
-}
diff --git a/lexicons/place/stream/video.json b/lexicons/place/stream/video.json
index a28494617..9173ca930 100644
--- a/lexicons/place/stream/video.json
+++ b/lexicons/place/stream/video.json
@@ -4,31 +4,77 @@
"defs": {
"main": {
"type": "record",
- "description": "Some media content: potentially video, audio, or subtitles. This record is intentionally minimal so that metadata can be altered without breaking strongRefs. For the stream's title and description and whatnot, check the `place.stream.metadata.video` with the tid matching this video.",
+ "description": "Metadata for a place.stream.video record. By convention the video and the metadata shall have the same tid.",
"key": "tid",
"record": {
+ "required": ["title"],
"type": "object",
- "required": ["createdAt", "source", "duration"],
"properties": {
- "createdAt": {
+ "title": {
"type": "string",
- "format": "datetime",
- "description": "Time this video was created."
+ "maxLength": 1400,
+ "maxGraphemes": 140,
+ "description": "Title of the video referenced by this record"
},
- "duration": {
- "type": "integer",
- "description": "Total duration of the video in milliseconds."
+ "description": {
+ "type": "string",
+ "maxLength": 50000,
+ "maxGraphemes": 5000,
+ "description": "Description of this video"
+ },
+ "descriptionFacets": {
+ "type": "array",
+ "description": "Annotations of text (mentions, URLs, etc)",
+ "items": { "type": "ref", "ref": "place.stream.richtext.facet" }
+ },
+ "thumb": {
+ "description": "Thumbnail image for the video.",
+ "type": "blob",
+ "accept": ["image/*"],
+ "maxSize": 1000000
+ },
+ "connections": {
+ "type": "array",
+ "description": "Free-form list of atproto records related in some way to this video",
+ "items": {
+ "type": "union",
+ "refs": ["#connection"]
+ }
},
- "source": {
+ "contentPolicy": {
+ "description": "copyright, distribution, and content warning data",
+ "type": "ref",
+ "ref": "place.stream.metadata.configuration"
+ },
+ "activity": {
"type": "union",
+ "description": "The game or activity in the video.",
"refs": [
- "place.stream.media.defs#sourceTracks",
- "place.stream.media.defs#sourceClip"
- ],
- "description": "The canonical source of this video, either some media tracks or a clip from another video."
+ "place.stream.defs#activityGame",
+ "place.stream.defs#activityLabel"
+ ]
+ },
+ "tags": {
+ "type": "array",
+ "description": "Freeform tags for this stream. Each tag must be alphanumeric (a-z, A-Z, 0-9) plus colon. Tags with colons indicate a specific tag group (e.g. 'lang:en' indicates the stream's primary language).",
+ "maxLength": 10,
+ "items": {
+ "type": "string",
+ "maxLength": 640,
+ "maxGraphemes": 64
+ }
}
}
}
+ },
+ "connection": {
+ "type": "object",
+ "properties": {
+ "ref": {
+ "type": "ref",
+ "ref": "com.atproto.repo.strongRef"
+ }
+ }
}
}
}
diff --git a/pkg/gen/gen.go b/pkg/gen/gen.go
index 851956e59..cd6128a2e 100644
--- a/pkg/gen/gen.go
+++ b/pkg/gen/gen.go
@@ -49,9 +49,9 @@ func main() {
streamplace.MediaDefs_MuxlTrack{},
streamplace.MediaDefs_SourceTracks{},
streamplace.MediaDefs_SourceClip{},
- streamplace.MetadataVideo{},
- streamplace.MetadataVideo_Connection{},
+ streamplace.MediaContent{},
streamplace.MediaTrack_CommonMetadata{},
+ streamplace.Video_Connection{},
); err != nil {
panic(err)
}
diff --git a/pkg/streamplace/cbor_gen.go b/pkg/streamplace/cbor_gen.go
index bd295dc3f..9ae42f78f 100644
--- a/pkg/streamplace/cbor_gen.go
+++ b/pkg/streamplace/cbor_gen.go
@@ -8115,11 +8115,76 @@ func (t *Video) MarshalCBOR(w io.Writer) error {
}
cw := cbg.NewCborWriter(w)
+ fieldCount := 9
- if _, err := cw.Write([]byte{164}); err != nil {
+ if t.Activity == nil {
+ fieldCount--
+ }
+
+ if t.Connections == nil {
+ fieldCount--
+ }
+
+ if t.ContentPolicy == nil {
+ fieldCount--
+ }
+
+ if t.Description == nil {
+ fieldCount--
+ }
+
+ if t.DescriptionFacets == nil {
+ fieldCount--
+ }
+
+ if t.Tags == nil {
+ fieldCount--
+ }
+
+ if t.Thumb == nil {
+ fieldCount--
+ }
+
+ if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
return err
}
+ // t.Tags ([]string) (slice)
+ if t.Tags != nil {
+
+ if len("tags") > 1000000 {
+ return xerrors.Errorf("Value in field \"tags\" was too long")
+ }
+
+ if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("tags"))); err != nil {
+ return err
+ }
+ if _, err := cw.WriteString(string("tags")); err != nil {
+ return err
+ }
+
+ if len(t.Tags) > 8192 {
+ return xerrors.Errorf("Slice value in field t.Tags was too long")
+ }
+
+ if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Tags))); err != nil {
+ return err
+ }
+ for _, v := range t.Tags {
+ if len(v) > 1000000 {
+ return xerrors.Errorf("Value in field v was too long")
+ }
+
+ if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(v))); err != nil {
+ return err
+ }
+ if _, err := cw.WriteString(string(v)); err != nil {
+ return err
+ }
+
+ }
+ }
+
// t.LexiconTypeID (string) (string)
if len("$type") > 1000000 {
return xerrors.Errorf("Value in field \"$type\" was too long")
@@ -8139,65 +8204,174 @@ func (t *Video) MarshalCBOR(w io.Writer) error {
return err
}
- // t.Source (streamplace.Video_Source) (struct)
- if len("source") > 1000000 {
- return xerrors.Errorf("Value in field \"source\" was too long")
+ // t.Thumb (util.LexBlob) (struct)
+ if t.Thumb != nil {
+
+ if len("thumb") > 1000000 {
+ return xerrors.Errorf("Value in field \"thumb\" was too long")
+ }
+
+ if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("thumb"))); err != nil {
+ return err
+ }
+ if _, err := cw.WriteString(string("thumb")); err != nil {
+ return err
+ }
+
+ if err := t.Thumb.MarshalCBOR(cw); err != nil {
+ return err
+ }
}
- if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("source"))); err != nil {
- return err
+ // t.Title (string) (string)
+ if len("title") > 1000000 {
+ return xerrors.Errorf("Value in field \"title\" was too long")
}
- if _, err := cw.WriteString(string("source")); err != nil {
+
+ if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("title"))); err != nil {
return err
}
-
- if err := t.Source.MarshalCBOR(cw); err != nil {
+ if _, err := cw.WriteString(string("title")); err != nil {
return err
}
- // t.Duration (int64) (int64)
- if len("duration") > 1000000 {
- return xerrors.Errorf("Value in field \"duration\" was too long")
+ if len(t.Title) > 1000000 {
+ return xerrors.Errorf("Value in field t.Title was too long")
}
- if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("duration"))); err != nil {
+ if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Title))); err != nil {
return err
}
- if _, err := cw.WriteString(string("duration")); err != nil {
+ if _, err := cw.WriteString(string(t.Title)); err != nil {
return err
}
- if t.Duration >= 0 {
- if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Duration)); err != nil {
+ // t.Activity (streamplace.Video_Activity) (struct)
+ if t.Activity != nil {
+
+ if len("activity") > 1000000 {
+ return xerrors.Errorf("Value in field \"activity\" was too long")
+ }
+
+ if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("activity"))); err != nil {
return err
}
- } else {
- if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.Duration-1)); err != nil {
+ if _, err := cw.WriteString(string("activity")); err != nil {
return err
}
- }
- // t.CreatedAt (string) (string)
- if len("createdAt") > 1000000 {
- return xerrors.Errorf("Value in field \"createdAt\" was too long")
+ if err := t.Activity.MarshalCBOR(cw); err != nil {
+ return err
+ }
}
- if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil {
- return err
- }
- if _, err := cw.WriteString(string("createdAt")); err != nil {
- return err
+ // t.Connections ([]*streamplace.Video_Connections_Elem) (slice)
+ if t.Connections != nil {
+
+ if len("connections") > 1000000 {
+ return xerrors.Errorf("Value in field \"connections\" was too long")
+ }
+
+ if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("connections"))); err != nil {
+ return err
+ }
+ if _, err := cw.WriteString(string("connections")); err != nil {
+ return err
+ }
+
+ if len(t.Connections) > 8192 {
+ return xerrors.Errorf("Slice value in field t.Connections was too long")
+ }
+
+ if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Connections))); err != nil {
+ return err
+ }
+ for _, v := range t.Connections {
+ if err := v.MarshalCBOR(cw); err != nil {
+ return err
+ }
+
+ }
}
- if len(t.CreatedAt) > 1000000 {
- return xerrors.Errorf("Value in field t.CreatedAt was too long")
+ // t.Description (string) (string)
+ if t.Description != nil {
+
+ if len("description") > 1000000 {
+ return xerrors.Errorf("Value in field \"description\" was too long")
+ }
+
+ if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("description"))); err != nil {
+ return err
+ }
+ if _, err := cw.WriteString(string("description")); err != nil {
+ return err
+ }
+
+ if t.Description == nil {
+ if _, err := cw.Write(cbg.CborNull); err != nil {
+ return err
+ }
+ } else {
+ if len(*t.Description) > 1000000 {
+ return xerrors.Errorf("Value in field t.Description was too long")
+ }
+
+ if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Description))); err != nil {
+ return err
+ }
+ if _, err := cw.WriteString(string(*t.Description)); err != nil {
+ return err
+ }
+ }
}
- if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil {
- return err
+ // t.ContentPolicy (streamplace.MetadataConfiguration) (struct)
+ if t.ContentPolicy != nil {
+
+ if len("contentPolicy") > 1000000 {
+ return xerrors.Errorf("Value in field \"contentPolicy\" was too long")
+ }
+
+ if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("contentPolicy"))); err != nil {
+ return err
+ }
+ if _, err := cw.WriteString(string("contentPolicy")); err != nil {
+ return err
+ }
+
+ if err := t.ContentPolicy.MarshalCBOR(cw); err != nil {
+ return err
+ }
}
- if _, err := cw.WriteString(string(t.CreatedAt)); err != nil {
- return err
+
+ // t.DescriptionFacets ([]*streamplace.RichtextFacet) (slice)
+ if t.DescriptionFacets != nil {
+
+ if len("descriptionFacets") > 1000000 {
+ return xerrors.Errorf("Value in field \"descriptionFacets\" was too long")
+ }
+
+ if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("descriptionFacets"))); err != nil {
+ return err
+ }
+ if _, err := cw.WriteString(string("descriptionFacets")); err != nil {
+ return err
+ }
+
+ if len(t.DescriptionFacets) > 8192 {
+ return xerrors.Errorf("Slice value in field t.DescriptionFacets was too long")
+ }
+
+ if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.DescriptionFacets))); err != nil {
+ return err
+ }
+ for _, v := range t.DescriptionFacets {
+ if err := v.MarshalCBOR(cw); err != nil {
+ return err
+ }
+
+ }
}
return nil
}
@@ -8227,7 +8401,7 @@ func (t *Video) UnmarshalCBOR(r io.Reader) (err error) {
n := extra
- nameBuf := make([]byte, 9)
+ nameBuf := make([]byte, 17)
for i := uint64(0); i < n; i++ {
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
if err != nil {
@@ -8243,19 +8417,59 @@ func (t *Video) UnmarshalCBOR(r io.Reader) (err error) {
}
switch string(nameBuf[:nameLen]) {
- // t.LexiconTypeID (string) (string)
- case "$type":
+ // t.Tags ([]string) (slice)
+ case "tags":
- {
- sval, err := cbg.ReadStringWithMax(cr, 1000000)
- if err != nil {
- return err
- }
+ maj, extra, err = cr.ReadHeader()
+ if err != nil {
+ return err
+ }
- t.LexiconTypeID = string(sval)
+ if extra > 8192 {
+ return fmt.Errorf("t.Tags: array too large (%d)", extra)
}
- // t.Source (streamplace.Video_Source) (struct)
- case "source":
+
+ if maj != cbg.MajArray {
+ return fmt.Errorf("expected cbor array")
+ }
+
+ if extra > 0 {
+ t.Tags = make([]string, extra)
+ }
+
+ for i := 0; i < int(extra); i++ {
+ {
+ var maj byte
+ var extra uint64
+ var err error
+ _ = maj
+ _ = extra
+ _ = err
+
+ {
+ sval, err := cbg.ReadStringWithMax(cr, 1000000)
+ if err != nil {
+ return err
+ }
+
+ t.Tags[i] = string(sval)
+ }
+
+ }
+ }
+ // t.LexiconTypeID (string) (string)
+ case "$type":
+
+ {
+ sval, err := cbg.ReadStringWithMax(cr, 1000000)
+ if err != nil {
+ return err
+ }
+
+ t.LexiconTypeID = string(sval)
+ }
+ // t.Thumb (util.LexBlob) (struct)
+ case "thumb":
{
@@ -8267,49 +8481,182 @@ func (t *Video) UnmarshalCBOR(r io.Reader) (err error) {
if err := cr.UnreadByte(); err != nil {
return err
}
- t.Source = new(Video_Source)
- if err := t.Source.UnmarshalCBOR(cr); err != nil {
- return xerrors.Errorf("unmarshaling t.Source pointer: %w", err)
+ t.Thumb = new(util.LexBlob)
+ if err := t.Thumb.UnmarshalCBOR(cr); err != nil {
+ return xerrors.Errorf("unmarshaling t.Thumb pointer: %w", err)
}
}
}
- // t.Duration (int64) (int64)
- case "duration":
+ // t.Title (string) (string)
+ case "title":
+
{
- maj, extra, err := cr.ReadHeader()
+ sval, err := cbg.ReadStringWithMax(cr, 1000000)
if err != nil {
return err
}
- var extraI int64
- switch maj {
- case cbg.MajUnsignedInt:
- extraI = int64(extra)
- if extraI < 0 {
- return fmt.Errorf("int64 positive overflow")
+
+ t.Title = string(sval)
+ }
+ // t.Activity (streamplace.Video_Activity) (struct)
+ case "activity":
+
+ {
+
+ b, err := cr.ReadByte()
+ if err != nil {
+ return err
+ }
+ if b != cbg.CborNull[0] {
+ if err := cr.UnreadByte(); err != nil {
+ return err
}
- case cbg.MajNegativeInt:
- extraI = int64(extra)
- if extraI < 0 {
- return fmt.Errorf("int64 negative overflow")
+ t.Activity = new(Video_Activity)
+ if err := t.Activity.UnmarshalCBOR(cr); err != nil {
+ return xerrors.Errorf("unmarshaling t.Activity pointer: %w", err)
}
- extraI = -1 - extraI
- default:
- return fmt.Errorf("wrong type for int64 field: %d", maj)
}
- t.Duration = int64(extraI)
}
- // t.CreatedAt (string) (string)
- case "createdAt":
+ // t.Connections ([]*streamplace.Video_Connections_Elem) (slice)
+ case "connections":
+
+ maj, extra, err = cr.ReadHeader()
+ if err != nil {
+ return err
+ }
+
+ if extra > 8192 {
+ return fmt.Errorf("t.Connections: array too large (%d)", extra)
+ }
+
+ if maj != cbg.MajArray {
+ return fmt.Errorf("expected cbor array")
+ }
+
+ if extra > 0 {
+ t.Connections = make([]*Video_Connections_Elem, extra)
+ }
+
+ for i := 0; i < int(extra); i++ {
+ {
+ var maj byte
+ var extra uint64
+ var err error
+ _ = maj
+ _ = extra
+ _ = err
+
+ {
+
+ b, err := cr.ReadByte()
+ if err != nil {
+ return err
+ }
+ if b != cbg.CborNull[0] {
+ if err := cr.UnreadByte(); err != nil {
+ return err
+ }
+ t.Connections[i] = new(Video_Connections_Elem)
+ if err := t.Connections[i].UnmarshalCBOR(cr); err != nil {
+ return xerrors.Errorf("unmarshaling t.Connections[i] pointer: %w", err)
+ }
+ }
+
+ }
+
+ }
+ }
+ // t.Description (string) (string)
+ case "description":
{
- sval, err := cbg.ReadStringWithMax(cr, 1000000)
+ b, err := cr.ReadByte()
if err != nil {
return err
}
+ if b != cbg.CborNull[0] {
+ if err := cr.UnreadByte(); err != nil {
+ return err
+ }
- t.CreatedAt = string(sval)
+ sval, err := cbg.ReadStringWithMax(cr, 1000000)
+ if err != nil {
+ return err
+ }
+
+ t.Description = (*string)(&sval)
+ }
+ }
+ // t.ContentPolicy (streamplace.MetadataConfiguration) (struct)
+ case "contentPolicy":
+
+ {
+
+ b, err := cr.ReadByte()
+ if err != nil {
+ return err
+ }
+ if b != cbg.CborNull[0] {
+ if err := cr.UnreadByte(); err != nil {
+ return err
+ }
+ t.ContentPolicy = new(MetadataConfiguration)
+ if err := t.ContentPolicy.UnmarshalCBOR(cr); err != nil {
+ return xerrors.Errorf("unmarshaling t.ContentPolicy pointer: %w", err)
+ }
+ }
+
+ }
+ // t.DescriptionFacets ([]*streamplace.RichtextFacet) (slice)
+ case "descriptionFacets":
+
+ maj, extra, err = cr.ReadHeader()
+ if err != nil {
+ return err
+ }
+
+ if extra > 8192 {
+ return fmt.Errorf("t.DescriptionFacets: array too large (%d)", extra)
+ }
+
+ if maj != cbg.MajArray {
+ return fmt.Errorf("expected cbor array")
+ }
+
+ if extra > 0 {
+ t.DescriptionFacets = make([]*RichtextFacet, extra)
+ }
+
+ for i := 0; i < int(extra); i++ {
+ {
+ var maj byte
+ var extra uint64
+ var err error
+ _ = maj
+ _ = extra
+ _ = err
+
+ {
+
+ b, err := cr.ReadByte()
+ if err != nil {
+ return err
+ }
+ if b != cbg.CborNull[0] {
+ if err := cr.UnreadByte(); err != nil {
+ return err
+ }
+ t.DescriptionFacets[i] = new(RichtextFacet)
+ if err := t.DescriptionFacets[i].UnmarshalCBOR(cr); err != nil {
+ return xerrors.Errorf("unmarshaling t.DescriptionFacets[i] pointer: %w", err)
+ }
+ }
+
+ }
+
+ }
}
default:
@@ -9237,626 +9584,102 @@ func (t *MediaDefs_SourceClip) UnmarshalCBOR(r io.Reader) (err error) {
return nil
}
-func (t *MetadataVideo) MarshalCBOR(w io.Writer) error {
+func (t *MediaContent) MarshalCBOR(w io.Writer) error {
if t == nil {
_, err := w.Write(cbg.CborNull)
return err
}
cw := cbg.NewCborWriter(w)
- fieldCount := 9
-
- if t.Activity == nil {
- fieldCount--
- }
-
- if t.Connections == nil {
- fieldCount--
- }
-
- if t.ContentPolicy == nil {
- fieldCount--
- }
-
- if t.Description == nil {
- fieldCount--
- }
-
- if t.DescriptionFacets == nil {
- fieldCount--
- }
-
- if t.Tags == nil {
- fieldCount--
- }
-
- if t.Thumb == nil {
- fieldCount--
- }
- if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
+ if _, err := cw.Write([]byte{164}); err != nil {
return err
}
- // t.Tags ([]string) (slice)
- if t.Tags != nil {
-
- if len("tags") > 1000000 {
- return xerrors.Errorf("Value in field \"tags\" was too long")
- }
-
- if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("tags"))); err != nil {
- return err
- }
- if _, err := cw.WriteString(string("tags")); err != nil {
- return err
- }
-
- if len(t.Tags) > 8192 {
- return xerrors.Errorf("Slice value in field t.Tags was too long")
- }
-
- if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Tags))); err != nil {
- return err
- }
- for _, v := range t.Tags {
- if len(v) > 1000000 {
- return xerrors.Errorf("Value in field v was too long")
- }
-
- if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(v))); err != nil {
- return err
- }
- if _, err := cw.WriteString(string(v)); err != nil {
- return err
- }
-
- }
- }
-
// t.LexiconTypeID (string) (string)
if len("$type") > 1000000 {
- return xerrors.Errorf("Value in field \"$type\" was too long")
- }
-
- if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
- return err
- }
- if _, err := cw.WriteString(string("$type")); err != nil {
- return err
- }
-
- if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("place.stream.metadata.video"))); err != nil {
- return err
- }
- if _, err := cw.WriteString(string("place.stream.metadata.video")); err != nil {
- return err
- }
-
- // t.Thumb (util.LexBlob) (struct)
- if t.Thumb != nil {
-
- if len("thumb") > 1000000 {
- return xerrors.Errorf("Value in field \"thumb\" was too long")
- }
-
- if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("thumb"))); err != nil {
- return err
- }
- if _, err := cw.WriteString(string("thumb")); err != nil {
- return err
- }
-
- if err := t.Thumb.MarshalCBOR(cw); err != nil {
- return err
- }
- }
-
- // t.Title (string) (string)
- if len("title") > 1000000 {
- return xerrors.Errorf("Value in field \"title\" was too long")
- }
-
- if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("title"))); err != nil {
- return err
- }
- if _, err := cw.WriteString(string("title")); err != nil {
- return err
- }
-
- if len(t.Title) > 1000000 {
- return xerrors.Errorf("Value in field t.Title was too long")
- }
-
- if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Title))); err != nil {
- return err
- }
- if _, err := cw.WriteString(string(t.Title)); err != nil {
- return err
- }
-
- // t.Activity (streamplace.MetadataVideo_Activity) (struct)
- if t.Activity != nil {
-
- if len("activity") > 1000000 {
- return xerrors.Errorf("Value in field \"activity\" was too long")
- }
-
- if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("activity"))); err != nil {
- return err
- }
- if _, err := cw.WriteString(string("activity")); err != nil {
- return err
- }
-
- if err := t.Activity.MarshalCBOR(cw); err != nil {
- return err
- }
- }
-
- // t.Connections ([]*streamplace.MetadataVideo_Connections_Elem) (slice)
- if t.Connections != nil {
-
- if len("connections") > 1000000 {
- return xerrors.Errorf("Value in field \"connections\" was too long")
- }
-
- if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("connections"))); err != nil {
- return err
- }
- if _, err := cw.WriteString(string("connections")); err != nil {
- return err
- }
-
- if len(t.Connections) > 8192 {
- return xerrors.Errorf("Slice value in field t.Connections was too long")
- }
-
- if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Connections))); err != nil {
- return err
- }
- for _, v := range t.Connections {
- if err := v.MarshalCBOR(cw); err != nil {
- return err
- }
-
- }
- }
-
- // t.Description (string) (string)
- if t.Description != nil {
-
- if len("description") > 1000000 {
- return xerrors.Errorf("Value in field \"description\" was too long")
- }
-
- if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("description"))); err != nil {
- return err
- }
- if _, err := cw.WriteString(string("description")); err != nil {
- return err
- }
-
- if t.Description == nil {
- if _, err := cw.Write(cbg.CborNull); err != nil {
- return err
- }
- } else {
- if len(*t.Description) > 1000000 {
- return xerrors.Errorf("Value in field t.Description was too long")
- }
-
- if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Description))); err != nil {
- return err
- }
- if _, err := cw.WriteString(string(*t.Description)); err != nil {
- return err
- }
- }
- }
-
- // t.ContentPolicy (streamplace.MetadataConfiguration) (struct)
- if t.ContentPolicy != nil {
-
- if len("contentPolicy") > 1000000 {
- return xerrors.Errorf("Value in field \"contentPolicy\" was too long")
- }
-
- if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("contentPolicy"))); err != nil {
- return err
- }
- if _, err := cw.WriteString(string("contentPolicy")); err != nil {
- return err
- }
-
- if err := t.ContentPolicy.MarshalCBOR(cw); err != nil {
- return err
- }
- }
-
- // t.DescriptionFacets ([]*streamplace.RichtextFacet) (slice)
- if t.DescriptionFacets != nil {
-
- if len("descriptionFacets") > 1000000 {
- return xerrors.Errorf("Value in field \"descriptionFacets\" was too long")
- }
-
- if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("descriptionFacets"))); err != nil {
- return err
- }
- if _, err := cw.WriteString(string("descriptionFacets")); err != nil {
- return err
- }
-
- if len(t.DescriptionFacets) > 8192 {
- return xerrors.Errorf("Slice value in field t.DescriptionFacets was too long")
- }
-
- if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.DescriptionFacets))); err != nil {
- return err
- }
- for _, v := range t.DescriptionFacets {
- if err := v.MarshalCBOR(cw); err != nil {
- return err
- }
-
- }
- }
- return nil
-}
-
-func (t *MetadataVideo) UnmarshalCBOR(r io.Reader) (err error) {
- *t = MetadataVideo{}
-
- cr := cbg.NewCborReader(r)
-
- maj, extra, err := cr.ReadHeader()
- if err != nil {
- return err
- }
- defer func() {
- if err == io.EOF {
- err = io.ErrUnexpectedEOF
- }
- }()
-
- if maj != cbg.MajMap {
- return fmt.Errorf("cbor input should be of type map")
- }
-
- if extra > cbg.MaxLength {
- return fmt.Errorf("MetadataVideo: map struct too large (%d)", extra)
- }
-
- n := extra
-
- nameBuf := make([]byte, 17)
- for i := uint64(0); i < n; i++ {
- nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
- if err != nil {
- return err
- }
-
- if !ok {
- // Field doesn't exist on this type, so ignore it
- if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
- return err
- }
- continue
- }
-
- switch string(nameBuf[:nameLen]) {
- // t.Tags ([]string) (slice)
- case "tags":
-
- maj, extra, err = cr.ReadHeader()
- if err != nil {
- return err
- }
-
- if extra > 8192 {
- return fmt.Errorf("t.Tags: array too large (%d)", extra)
- }
-
- if maj != cbg.MajArray {
- return fmt.Errorf("expected cbor array")
- }
-
- if extra > 0 {
- t.Tags = make([]string, extra)
- }
-
- for i := 0; i < int(extra); i++ {
- {
- var maj byte
- var extra uint64
- var err error
- _ = maj
- _ = extra
- _ = err
-
- {
- sval, err := cbg.ReadStringWithMax(cr, 1000000)
- if err != nil {
- return err
- }
-
- t.Tags[i] = string(sval)
- }
-
- }
- }
- // t.LexiconTypeID (string) (string)
- case "$type":
-
- {
- sval, err := cbg.ReadStringWithMax(cr, 1000000)
- if err != nil {
- return err
- }
-
- t.LexiconTypeID = string(sval)
- }
- // t.Thumb (util.LexBlob) (struct)
- case "thumb":
-
- {
-
- b, err := cr.ReadByte()
- if err != nil {
- return err
- }
- if b != cbg.CborNull[0] {
- if err := cr.UnreadByte(); err != nil {
- return err
- }
- t.Thumb = new(util.LexBlob)
- if err := t.Thumb.UnmarshalCBOR(cr); err != nil {
- return xerrors.Errorf("unmarshaling t.Thumb pointer: %w", err)
- }
- }
-
- }
- // t.Title (string) (string)
- case "title":
-
- {
- sval, err := cbg.ReadStringWithMax(cr, 1000000)
- if err != nil {
- return err
- }
-
- t.Title = string(sval)
- }
- // t.Activity (streamplace.MetadataVideo_Activity) (struct)
- case "activity":
-
- {
-
- b, err := cr.ReadByte()
- if err != nil {
- return err
- }
- if b != cbg.CborNull[0] {
- if err := cr.UnreadByte(); err != nil {
- return err
- }
- t.Activity = new(MetadataVideo_Activity)
- if err := t.Activity.UnmarshalCBOR(cr); err != nil {
- return xerrors.Errorf("unmarshaling t.Activity pointer: %w", err)
- }
- }
-
- }
- // t.Connections ([]*streamplace.MetadataVideo_Connections_Elem) (slice)
- case "connections":
-
- maj, extra, err = cr.ReadHeader()
- if err != nil {
- return err
- }
-
- if extra > 8192 {
- return fmt.Errorf("t.Connections: array too large (%d)", extra)
- }
-
- if maj != cbg.MajArray {
- return fmt.Errorf("expected cbor array")
- }
-
- if extra > 0 {
- t.Connections = make([]*MetadataVideo_Connections_Elem, extra)
- }
-
- for i := 0; i < int(extra); i++ {
- {
- var maj byte
- var extra uint64
- var err error
- _ = maj
- _ = extra
- _ = err
-
- {
-
- b, err := cr.ReadByte()
- if err != nil {
- return err
- }
- if b != cbg.CborNull[0] {
- if err := cr.UnreadByte(); err != nil {
- return err
- }
- t.Connections[i] = new(MetadataVideo_Connections_Elem)
- if err := t.Connections[i].UnmarshalCBOR(cr); err != nil {
- return xerrors.Errorf("unmarshaling t.Connections[i] pointer: %w", err)
- }
- }
-
- }
-
- }
- }
- // t.Description (string) (string)
- case "description":
-
- {
- b, err := cr.ReadByte()
- if err != nil {
- return err
- }
- if b != cbg.CborNull[0] {
- if err := cr.UnreadByte(); err != nil {
- return err
- }
-
- sval, err := cbg.ReadStringWithMax(cr, 1000000)
- if err != nil {
- return err
- }
-
- t.Description = (*string)(&sval)
- }
- }
- // t.ContentPolicy (streamplace.MetadataConfiguration) (struct)
- case "contentPolicy":
-
- {
-
- b, err := cr.ReadByte()
- if err != nil {
- return err
- }
- if b != cbg.CborNull[0] {
- if err := cr.UnreadByte(); err != nil {
- return err
- }
- t.ContentPolicy = new(MetadataConfiguration)
- if err := t.ContentPolicy.UnmarshalCBOR(cr); err != nil {
- return xerrors.Errorf("unmarshaling t.ContentPolicy pointer: %w", err)
- }
- }
-
- }
- // t.DescriptionFacets ([]*streamplace.RichtextFacet) (slice)
- case "descriptionFacets":
-
- maj, extra, err = cr.ReadHeader()
- if err != nil {
- return err
- }
-
- if extra > 8192 {
- return fmt.Errorf("t.DescriptionFacets: array too large (%d)", extra)
- }
-
- if maj != cbg.MajArray {
- return fmt.Errorf("expected cbor array")
- }
-
- if extra > 0 {
- t.DescriptionFacets = make([]*RichtextFacet, extra)
- }
-
- for i := 0; i < int(extra); i++ {
- {
- var maj byte
- var extra uint64
- var err error
- _ = maj
- _ = extra
- _ = err
-
- {
-
- b, err := cr.ReadByte()
- if err != nil {
- return err
- }
- if b != cbg.CborNull[0] {
- if err := cr.UnreadByte(); err != nil {
- return err
- }
- t.DescriptionFacets[i] = new(RichtextFacet)
- if err := t.DescriptionFacets[i].UnmarshalCBOR(cr); err != nil {
- return xerrors.Errorf("unmarshaling t.DescriptionFacets[i] pointer: %w", err)
- }
- }
-
- }
-
- }
- }
-
- default:
- // Field doesn't exist on this type, so ignore it
- if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
- return err
- }
- }
+ return xerrors.Errorf("Value in field \"$type\" was too long")
}
- return nil
-}
-func (t *MetadataVideo_Connection) MarshalCBOR(w io.Writer) error {
- if t == nil {
- _, err := w.Write(cbg.CborNull)
+ if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
+ return err
+ }
+ if _, err := cw.WriteString(string("$type")); err != nil {
return err
}
- cw := cbg.NewCborWriter(w)
- fieldCount := 2
+ if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("place.stream.media.content"))); err != nil {
+ return err
+ }
+ if _, err := cw.WriteString(string("place.stream.media.content")); err != nil {
+ return err
+ }
- if t.Ref == nil {
- fieldCount--
+ // t.Source (streamplace.MediaContent_Source) (struct)
+ if len("source") > 1000000 {
+ return xerrors.Errorf("Value in field \"source\" was too long")
}
- if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
+ if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("source"))); err != nil {
+ return err
+ }
+ if _, err := cw.WriteString(string("source")); err != nil {
return err
}
- // t.Ref (atproto.RepoStrongRef) (struct)
- if t.Ref != nil {
+ if err := t.Source.MarshalCBOR(cw); err != nil {
+ return err
+ }
- if len("ref") > 1000000 {
- return xerrors.Errorf("Value in field \"ref\" was too long")
- }
+ // t.Duration (int64) (int64)
+ if len("duration") > 1000000 {
+ return xerrors.Errorf("Value in field \"duration\" was too long")
+ }
- if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("ref"))); err != nil {
- return err
- }
- if _, err := cw.WriteString(string("ref")); err != nil {
+ if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("duration"))); err != nil {
+ return err
+ }
+ if _, err := cw.WriteString(string("duration")); err != nil {
+ return err
+ }
+
+ if t.Duration >= 0 {
+ if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Duration)); err != nil {
return err
}
-
- if err := t.Ref.MarshalCBOR(cw); err != nil {
+ } else {
+ if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.Duration-1)); err != nil {
return err
}
}
- // t.LexiconTypeID (string) (string)
- if len("$type") > 1000000 {
- return xerrors.Errorf("Value in field \"$type\" was too long")
+ // t.CreatedAt (string) (string)
+ if len("createdAt") > 1000000 {
+ return xerrors.Errorf("Value in field \"createdAt\" was too long")
}
- if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
+ if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil {
return err
}
- if _, err := cw.WriteString(string("$type")); err != nil {
+ if _, err := cw.WriteString(string("createdAt")); err != nil {
return err
}
- if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("place.stream.metadata.video#connection"))); err != nil {
+ if len(t.CreatedAt) > 1000000 {
+ return xerrors.Errorf("Value in field t.CreatedAt was too long")
+ }
+
+ if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil {
return err
}
- if _, err := cw.WriteString(string("place.stream.metadata.video#connection")); err != nil {
+ if _, err := cw.WriteString(string(t.CreatedAt)); err != nil {
return err
}
return nil
}
-func (t *MetadataVideo_Connection) UnmarshalCBOR(r io.Reader) (err error) {
- *t = MetadataVideo_Connection{}
+func (t *MediaContent) UnmarshalCBOR(r io.Reader) (err error) {
+ *t = MediaContent{}
cr := cbg.NewCborReader(r)
@@ -9875,12 +9698,12 @@ func (t *MetadataVideo_Connection) UnmarshalCBOR(r io.Reader) (err error) {
}
if extra > cbg.MaxLength {
- return fmt.Errorf("MetadataVideo_Connection: map struct too large (%d)", extra)
+ return fmt.Errorf("MediaContent: map struct too large (%d)", extra)
}
n := extra
- nameBuf := make([]byte, 5)
+ nameBuf := make([]byte, 9)
for i := uint64(0); i < n; i++ {
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
if err != nil {
@@ -9896,8 +9719,19 @@ func (t *MetadataVideo_Connection) UnmarshalCBOR(r io.Reader) (err error) {
}
switch string(nameBuf[:nameLen]) {
- // t.Ref (atproto.RepoStrongRef) (struct)
- case "ref":
+ // t.LexiconTypeID (string) (string)
+ case "$type":
+
+ {
+ sval, err := cbg.ReadStringWithMax(cr, 1000000)
+ if err != nil {
+ return err
+ }
+
+ t.LexiconTypeID = string(sval)
+ }
+ // t.Source (streamplace.MediaContent_Source) (struct)
+ case "source":
{
@@ -9909,15 +9743,41 @@ func (t *MetadataVideo_Connection) UnmarshalCBOR(r io.Reader) (err error) {
if err := cr.UnreadByte(); err != nil {
return err
}
- t.Ref = new(atproto.RepoStrongRef)
- if err := t.Ref.UnmarshalCBOR(cr); err != nil {
- return xerrors.Errorf("unmarshaling t.Ref pointer: %w", err)
+ t.Source = new(MediaContent_Source)
+ if err := t.Source.UnmarshalCBOR(cr); err != nil {
+ return xerrors.Errorf("unmarshaling t.Source pointer: %w", err)
}
}
}
- // t.LexiconTypeID (string) (string)
- case "$type":
+ // t.Duration (int64) (int64)
+ case "duration":
+ {
+ maj, extra, err := cr.ReadHeader()
+ if err != nil {
+ return err
+ }
+ var extraI int64
+ switch maj {
+ case cbg.MajUnsignedInt:
+ extraI = int64(extra)
+ if extraI < 0 {
+ return fmt.Errorf("int64 positive overflow")
+ }
+ case cbg.MajNegativeInt:
+ extraI = int64(extra)
+ if extraI < 0 {
+ return fmt.Errorf("int64 negative overflow")
+ }
+ extraI = -1 - extraI
+ default:
+ return fmt.Errorf("wrong type for int64 field: %d", maj)
+ }
+
+ t.Duration = int64(extraI)
+ }
+ // t.CreatedAt (string) (string)
+ case "createdAt":
{
sval, err := cbg.ReadStringWithMax(cr, 1000000)
@@ -9925,7 +9785,7 @@ func (t *MetadataVideo_Connection) UnmarshalCBOR(r io.Reader) (err error) {
return err
}
- t.LexiconTypeID = string(sval)
+ t.CreatedAt = string(sval)
}
default:
@@ -10148,3 +10008,143 @@ func (t *MediaTrack_CommonMetadata) UnmarshalCBOR(r io.Reader) (err error) {
return nil
}
+func (t *Video_Connection) MarshalCBOR(w io.Writer) error {
+ if t == nil {
+ _, err := w.Write(cbg.CborNull)
+ return err
+ }
+
+ cw := cbg.NewCborWriter(w)
+ fieldCount := 2
+
+ if t.Ref == nil {
+ fieldCount--
+ }
+
+ if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
+ return err
+ }
+
+ // t.Ref (atproto.RepoStrongRef) (struct)
+ if t.Ref != nil {
+
+ if len("ref") > 1000000 {
+ return xerrors.Errorf("Value in field \"ref\" was too long")
+ }
+
+ if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("ref"))); err != nil {
+ return err
+ }
+ if _, err := cw.WriteString(string("ref")); err != nil {
+ return err
+ }
+
+ if err := t.Ref.MarshalCBOR(cw); err != nil {
+ return err
+ }
+ }
+
+ // t.LexiconTypeID (string) (string)
+ if len("$type") > 1000000 {
+ return xerrors.Errorf("Value in field \"$type\" was too long")
+ }
+
+ if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
+ return err
+ }
+ if _, err := cw.WriteString(string("$type")); err != nil {
+ return err
+ }
+
+ if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("place.stream.video#connection"))); err != nil {
+ return err
+ }
+ if _, err := cw.WriteString(string("place.stream.video#connection")); err != nil {
+ return err
+ }
+ return nil
+}
+
+func (t *Video_Connection) UnmarshalCBOR(r io.Reader) (err error) {
+ *t = Video_Connection{}
+
+ cr := cbg.NewCborReader(r)
+
+ maj, extra, err := cr.ReadHeader()
+ if err != nil {
+ return err
+ }
+ defer func() {
+ if err == io.EOF {
+ err = io.ErrUnexpectedEOF
+ }
+ }()
+
+ if maj != cbg.MajMap {
+ return fmt.Errorf("cbor input should be of type map")
+ }
+
+ if extra > cbg.MaxLength {
+ return fmt.Errorf("Video_Connection: map struct too large (%d)", extra)
+ }
+
+ n := extra
+
+ nameBuf := make([]byte, 5)
+ for i := uint64(0); i < n; i++ {
+ nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
+ if err != nil {
+ return err
+ }
+
+ if !ok {
+ // Field doesn't exist on this type, so ignore it
+ if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
+ return err
+ }
+ continue
+ }
+
+ switch string(nameBuf[:nameLen]) {
+ // t.Ref (atproto.RepoStrongRef) (struct)
+ case "ref":
+
+ {
+
+ b, err := cr.ReadByte()
+ if err != nil {
+ return err
+ }
+ if b != cbg.CborNull[0] {
+ if err := cr.UnreadByte(); err != nil {
+ return err
+ }
+ t.Ref = new(atproto.RepoStrongRef)
+ if err := t.Ref.UnmarshalCBOR(cr); err != nil {
+ return xerrors.Errorf("unmarshaling t.Ref pointer: %w", err)
+ }
+ }
+
+ }
+ // t.LexiconTypeID (string) (string)
+ case "$type":
+
+ {
+ sval, err := cbg.ReadStringWithMax(cr, 1000000)
+ if err != nil {
+ return err
+ }
+
+ t.LexiconTypeID = string(sval)
+ }
+
+ default:
+ // Field doesn't exist on this type, so ignore it
+ if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
+ return err
+ }
+ }
+ }
+
+ return nil
+}
diff --git a/pkg/streamplace/mediacontent.go b/pkg/streamplace/mediacontent.go
new file mode 100644
index 000000000..5dc15c51b
--- /dev/null
+++ b/pkg/streamplace/mediacontent.go
@@ -0,0 +1,98 @@
+// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
+
+// Lexicon schema: place.stream.media.content
+
+package streamplace
+
+import (
+ "bytes"
+ "encoding/json"
+ "fmt"
+ "io"
+
+ lexutil "github.com/bluesky-social/indigo/lex/util"
+ cbg "github.com/whyrusleeping/cbor-gen"
+)
+
+func init() {
+ lexutil.RegisterType("place.stream.media.content", &MediaContent{})
+}
+
+type MediaContent struct {
+ LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.media.content"`
+ // createdAt: Time this video was created.
+ CreatedAt string `json:"createdAt" cborgen:"createdAt"`
+ // duration: Total duration of the video in milliseconds.
+ Duration int64 `json:"duration" cborgen:"duration"`
+ // source: The canonical source of this video, either some media tracks or a clip from another video.
+ Source *MediaContent_Source `json:"source" cborgen:"source"`
+}
+
+// The canonical source of this video, either some media tracks or a clip from another video.
+type MediaContent_Source struct {
+ MediaDefs_SourceTracks *MediaDefs_SourceTracks
+ MediaDefs_SourceClip *MediaDefs_SourceClip
+}
+
+func (t *MediaContent_Source) MarshalJSON() ([]byte, error) {
+ if t.MediaDefs_SourceTracks != nil {
+ t.MediaDefs_SourceTracks.LexiconTypeID = "place.stream.media.defs#sourceTracks"
+ return json.Marshal(t.MediaDefs_SourceTracks)
+ }
+ if t.MediaDefs_SourceClip != nil {
+ t.MediaDefs_SourceClip.LexiconTypeID = "place.stream.media.defs#sourceClip"
+ return json.Marshal(t.MediaDefs_SourceClip)
+ }
+ return nil, fmt.Errorf("can not marshal empty union as JSON")
+}
+
+func (t *MediaContent_Source) UnmarshalJSON(b []byte) error {
+ typ, err := lexutil.TypeExtract(b)
+ if err != nil {
+ return err
+ }
+
+ switch typ {
+ case "place.stream.media.defs#sourceTracks":
+ t.MediaDefs_SourceTracks = new(MediaDefs_SourceTracks)
+ return json.Unmarshal(b, t.MediaDefs_SourceTracks)
+ case "place.stream.media.defs#sourceClip":
+ t.MediaDefs_SourceClip = new(MediaDefs_SourceClip)
+ return json.Unmarshal(b, t.MediaDefs_SourceClip)
+ default:
+ return nil
+ }
+}
+
+func (t *MediaContent_Source) MarshalCBOR(w io.Writer) error {
+
+ if t == nil {
+ _, err := w.Write(cbg.CborNull)
+ return err
+ }
+ if t.MediaDefs_SourceTracks != nil {
+ return t.MediaDefs_SourceTracks.MarshalCBOR(w)
+ }
+ if t.MediaDefs_SourceClip != nil {
+ return t.MediaDefs_SourceClip.MarshalCBOR(w)
+ }
+ return fmt.Errorf("can not marshal empty union as CBOR")
+}
+
+func (t *MediaContent_Source) UnmarshalCBOR(r io.Reader) error {
+ typ, b, err := lexutil.CborTypeExtractReader(r)
+ if err != nil {
+ return err
+ }
+
+ switch typ {
+ case "place.stream.media.defs#sourceTracks":
+ t.MediaDefs_SourceTracks = new(MediaDefs_SourceTracks)
+ return t.MediaDefs_SourceTracks.UnmarshalCBOR(bytes.NewReader(b))
+ case "place.stream.media.defs#sourceClip":
+ t.MediaDefs_SourceClip = new(MediaDefs_SourceClip)
+ return t.MediaDefs_SourceClip.UnmarshalCBOR(bytes.NewReader(b))
+ default:
+ return nil
+ }
+}
diff --git a/pkg/streamplace/metadatavideo.go b/pkg/streamplace/metadatavideo.go
deleted file mode 100644
index 875f96d5a..000000000
--- a/pkg/streamplace/metadatavideo.go
+++ /dev/null
@@ -1,169 +0,0 @@
-// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
-
-// Lexicon schema: place.stream.metadata.video
-
-package streamplace
-
-import (
- "bytes"
- "encoding/json"
- "fmt"
- "io"
-
- comatproto "github.com/bluesky-social/indigo/api/atproto"
- lexutil "github.com/bluesky-social/indigo/lex/util"
- cbg "github.com/whyrusleeping/cbor-gen"
-)
-
-func init() {
- lexutil.RegisterType("place.stream.metadata.video", &MetadataVideo{})
-}
-
-type MetadataVideo struct {
- LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.metadata.video"`
- // activity: The game or activity in the video.
- Activity *MetadataVideo_Activity `json:"activity,omitempty" cborgen:"activity,omitempty"`
- // connections: Free-form list of atproto records related in some way to this video
- Connections []*MetadataVideo_Connections_Elem `json:"connections,omitempty" cborgen:"connections,omitempty"`
- // contentPolicy: copyright, distribution, and content warning data
- ContentPolicy *MetadataConfiguration `json:"contentPolicy,omitempty" cborgen:"contentPolicy,omitempty"`
- // description: Description of this video
- Description *string `json:"description,omitempty" cborgen:"description,omitempty"`
- // descriptionFacets: Annotations of text (mentions, URLs, etc)
- DescriptionFacets []*RichtextFacet `json:"descriptionFacets,omitempty" cborgen:"descriptionFacets,omitempty"`
- // tags: Freeform tags for this stream. Each tag must be alphanumeric (a-z, A-Z, 0-9) plus colon. Tags with colons indicate a specific tag group (e.g. 'lang:en' indicates the stream's primary language).
- Tags []string `json:"tags,omitempty" cborgen:"tags,omitempty"`
- // thumb: Thumbnail image for the video.
- Thumb *lexutil.LexBlob `json:"thumb,omitempty" cborgen:"thumb,omitempty"`
- // title: Title of the video referenced by this record
- Title string `json:"title" cborgen:"title"`
-}
-
-// The game or activity in the video.
-type MetadataVideo_Activity struct {
- Defs_ActivityGame *Defs_ActivityGame
- Defs_ActivityLabel *Defs_ActivityLabel
-}
-
-func (t *MetadataVideo_Activity) MarshalJSON() ([]byte, error) {
- if t.Defs_ActivityGame != nil {
- t.Defs_ActivityGame.LexiconTypeID = "place.stream.defs#activityGame"
- return json.Marshal(t.Defs_ActivityGame)
- }
- if t.Defs_ActivityLabel != nil {
- t.Defs_ActivityLabel.LexiconTypeID = "place.stream.defs#activityLabel"
- return json.Marshal(t.Defs_ActivityLabel)
- }
- return nil, fmt.Errorf("can not marshal empty union as JSON")
-}
-
-func (t *MetadataVideo_Activity) UnmarshalJSON(b []byte) error {
- typ, err := lexutil.TypeExtract(b)
- if err != nil {
- return err
- }
-
- switch typ {
- case "place.stream.defs#activityGame":
- t.Defs_ActivityGame = new(Defs_ActivityGame)
- return json.Unmarshal(b, t.Defs_ActivityGame)
- case "place.stream.defs#activityLabel":
- t.Defs_ActivityLabel = new(Defs_ActivityLabel)
- return json.Unmarshal(b, t.Defs_ActivityLabel)
- default:
- return nil
- }
-}
-
-func (t *MetadataVideo_Activity) MarshalCBOR(w io.Writer) error {
-
- if t == nil {
- _, err := w.Write(cbg.CborNull)
- return err
- }
- if t.Defs_ActivityGame != nil {
- return t.Defs_ActivityGame.MarshalCBOR(w)
- }
- if t.Defs_ActivityLabel != nil {
- return t.Defs_ActivityLabel.MarshalCBOR(w)
- }
- return fmt.Errorf("can not marshal empty union as CBOR")
-}
-
-func (t *MetadataVideo_Activity) UnmarshalCBOR(r io.Reader) error {
- typ, b, err := lexutil.CborTypeExtractReader(r)
- if err != nil {
- return err
- }
-
- switch typ {
- case "place.stream.defs#activityGame":
- t.Defs_ActivityGame = new(Defs_ActivityGame)
- return t.Defs_ActivityGame.UnmarshalCBOR(bytes.NewReader(b))
- case "place.stream.defs#activityLabel":
- t.Defs_ActivityLabel = new(Defs_ActivityLabel)
- return t.Defs_ActivityLabel.UnmarshalCBOR(bytes.NewReader(b))
- default:
- return nil
- }
-}
-
-// MetadataVideo_Connection is a "connection" in the place.stream.metadata.video schema.
-type MetadataVideo_Connection struct {
- LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.metadata.video#connection"`
- Ref *comatproto.RepoStrongRef `json:"ref,omitempty" cborgen:"ref,omitempty"`
-}
-
-type MetadataVideo_Connections_Elem struct {
- MetadataVideo_Connection *MetadataVideo_Connection
-}
-
-func (t *MetadataVideo_Connections_Elem) MarshalJSON() ([]byte, error) {
- if t.MetadataVideo_Connection != nil {
- t.MetadataVideo_Connection.LexiconTypeID = "place.stream.metadata.video#connection"
- return json.Marshal(t.MetadataVideo_Connection)
- }
- return nil, fmt.Errorf("can not marshal empty union as JSON")
-}
-
-func (t *MetadataVideo_Connections_Elem) UnmarshalJSON(b []byte) error {
- typ, err := lexutil.TypeExtract(b)
- if err != nil {
- return err
- }
-
- switch typ {
- case "place.stream.metadata.video#connection":
- t.MetadataVideo_Connection = new(MetadataVideo_Connection)
- return json.Unmarshal(b, t.MetadataVideo_Connection)
- default:
- return nil
- }
-}
-
-func (t *MetadataVideo_Connections_Elem) MarshalCBOR(w io.Writer) error {
-
- if t == nil {
- _, err := w.Write(cbg.CborNull)
- return err
- }
- if t.MetadataVideo_Connection != nil {
- return t.MetadataVideo_Connection.MarshalCBOR(w)
- }
- return fmt.Errorf("can not marshal empty union as CBOR")
-}
-
-func (t *MetadataVideo_Connections_Elem) UnmarshalCBOR(r io.Reader) error {
- typ, b, err := lexutil.CborTypeExtractReader(r)
- if err != nil {
- return err
- }
-
- switch typ {
- case "place.stream.metadata.video#connection":
- t.MetadataVideo_Connection = new(MetadataVideo_Connection)
- return t.MetadataVideo_Connection.UnmarshalCBOR(bytes.NewReader(b))
- default:
- return nil
- }
-}
diff --git a/pkg/streamplace/streamvideo.go b/pkg/streamplace/streamvideo.go
index e4ba0a910..15ba3790a 100644
--- a/pkg/streamplace/streamvideo.go
+++ b/pkg/streamplace/streamvideo.go
@@ -10,6 +10,7 @@ import (
"fmt"
"io"
+ comatproto "github.com/bluesky-social/indigo/api/atproto"
lexutil "github.com/bluesky-social/indigo/lex/util"
cbg "github.com/whyrusleeping/cbor-gen"
)
@@ -20,78 +21,148 @@ func init() {
type Video struct {
LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.video"`
- // createdAt: Time this video was created.
- CreatedAt string `json:"createdAt" cborgen:"createdAt"`
- // duration: Total duration of the video in milliseconds.
- Duration int64 `json:"duration" cborgen:"duration"`
- // source: The canonical source of this video, either some media tracks or a clip from another video.
- Source *Video_Source `json:"source" cborgen:"source"`
+ // activity: The game or activity in the video.
+ Activity *Video_Activity `json:"activity,omitempty" cborgen:"activity,omitempty"`
+ // connections: Free-form list of atproto records related in some way to this video
+ Connections []*Video_Connections_Elem `json:"connections,omitempty" cborgen:"connections,omitempty"`
+ // contentPolicy: copyright, distribution, and content warning data
+ ContentPolicy *MetadataConfiguration `json:"contentPolicy,omitempty" cborgen:"contentPolicy,omitempty"`
+ // description: Description of this video
+ Description *string `json:"description,omitempty" cborgen:"description,omitempty"`
+ // descriptionFacets: Annotations of text (mentions, URLs, etc)
+ DescriptionFacets []*RichtextFacet `json:"descriptionFacets,omitempty" cborgen:"descriptionFacets,omitempty"`
+ // tags: Freeform tags for this stream. Each tag must be alphanumeric (a-z, A-Z, 0-9) plus colon. Tags with colons indicate a specific tag group (e.g. 'lang:en' indicates the stream's primary language).
+ Tags []string `json:"tags,omitempty" cborgen:"tags,omitempty"`
+ // thumb: Thumbnail image for the video.
+ Thumb *lexutil.LexBlob `json:"thumb,omitempty" cborgen:"thumb,omitempty"`
+ // title: Title of the video referenced by this record
+ Title string `json:"title" cborgen:"title"`
}
-// The canonical source of this video, either some media tracks or a clip from another video.
-type Video_Source struct {
- MediaDefs_SourceTracks *MediaDefs_SourceTracks
- MediaDefs_SourceClip *MediaDefs_SourceClip
+// The game or activity in the video.
+type Video_Activity struct {
+ Defs_ActivityGame *Defs_ActivityGame
+ Defs_ActivityLabel *Defs_ActivityLabel
}
-func (t *Video_Source) MarshalJSON() ([]byte, error) {
- if t.MediaDefs_SourceTracks != nil {
- t.MediaDefs_SourceTracks.LexiconTypeID = "place.stream.media.defs#sourceTracks"
- return json.Marshal(t.MediaDefs_SourceTracks)
+func (t *Video_Activity) MarshalJSON() ([]byte, error) {
+ if t.Defs_ActivityGame != nil {
+ t.Defs_ActivityGame.LexiconTypeID = "place.stream.defs#activityGame"
+ return json.Marshal(t.Defs_ActivityGame)
}
- if t.MediaDefs_SourceClip != nil {
- t.MediaDefs_SourceClip.LexiconTypeID = "place.stream.media.defs#sourceClip"
- return json.Marshal(t.MediaDefs_SourceClip)
+ if t.Defs_ActivityLabel != nil {
+ t.Defs_ActivityLabel.LexiconTypeID = "place.stream.defs#activityLabel"
+ return json.Marshal(t.Defs_ActivityLabel)
}
return nil, fmt.Errorf("can not marshal empty union as JSON")
}
-func (t *Video_Source) UnmarshalJSON(b []byte) error {
+func (t *Video_Activity) UnmarshalJSON(b []byte) error {
typ, err := lexutil.TypeExtract(b)
if err != nil {
return err
}
switch typ {
- case "place.stream.media.defs#sourceTracks":
- t.MediaDefs_SourceTracks = new(MediaDefs_SourceTracks)
- return json.Unmarshal(b, t.MediaDefs_SourceTracks)
- case "place.stream.media.defs#sourceClip":
- t.MediaDefs_SourceClip = new(MediaDefs_SourceClip)
- return json.Unmarshal(b, t.MediaDefs_SourceClip)
+ case "place.stream.defs#activityGame":
+ t.Defs_ActivityGame = new(Defs_ActivityGame)
+ return json.Unmarshal(b, t.Defs_ActivityGame)
+ case "place.stream.defs#activityLabel":
+ t.Defs_ActivityLabel = new(Defs_ActivityLabel)
+ return json.Unmarshal(b, t.Defs_ActivityLabel)
default:
return nil
}
}
-func (t *Video_Source) MarshalCBOR(w io.Writer) error {
+func (t *Video_Activity) MarshalCBOR(w io.Writer) error {
if t == nil {
_, err := w.Write(cbg.CborNull)
return err
}
- if t.MediaDefs_SourceTracks != nil {
- return t.MediaDefs_SourceTracks.MarshalCBOR(w)
+ if t.Defs_ActivityGame != nil {
+ return t.Defs_ActivityGame.MarshalCBOR(w)
}
- if t.MediaDefs_SourceClip != nil {
- return t.MediaDefs_SourceClip.MarshalCBOR(w)
+ if t.Defs_ActivityLabel != nil {
+ return t.Defs_ActivityLabel.MarshalCBOR(w)
}
return fmt.Errorf("can not marshal empty union as CBOR")
}
-func (t *Video_Source) UnmarshalCBOR(r io.Reader) error {
+func (t *Video_Activity) UnmarshalCBOR(r io.Reader) error {
typ, b, err := lexutil.CborTypeExtractReader(r)
if err != nil {
return err
}
switch typ {
- case "place.stream.media.defs#sourceTracks":
- t.MediaDefs_SourceTracks = new(MediaDefs_SourceTracks)
- return t.MediaDefs_SourceTracks.UnmarshalCBOR(bytes.NewReader(b))
- case "place.stream.media.defs#sourceClip":
- t.MediaDefs_SourceClip = new(MediaDefs_SourceClip)
- return t.MediaDefs_SourceClip.UnmarshalCBOR(bytes.NewReader(b))
+ case "place.stream.defs#activityGame":
+ t.Defs_ActivityGame = new(Defs_ActivityGame)
+ return t.Defs_ActivityGame.UnmarshalCBOR(bytes.NewReader(b))
+ case "place.stream.defs#activityLabel":
+ t.Defs_ActivityLabel = new(Defs_ActivityLabel)
+ return t.Defs_ActivityLabel.UnmarshalCBOR(bytes.NewReader(b))
+ default:
+ return nil
+ }
+}
+
+// Video_Connection is a "connection" in the place.stream.video schema.
+type Video_Connection struct {
+ LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.video#connection"`
+ Ref *comatproto.RepoStrongRef `json:"ref,omitempty" cborgen:"ref,omitempty"`
+}
+
+type Video_Connections_Elem struct {
+ Video_Connection *Video_Connection
+}
+
+func (t *Video_Connections_Elem) MarshalJSON() ([]byte, error) {
+ if t.Video_Connection != nil {
+ t.Video_Connection.LexiconTypeID = "place.stream.video#connection"
+ return json.Marshal(t.Video_Connection)
+ }
+ return nil, fmt.Errorf("can not marshal empty union as JSON")
+}
+
+func (t *Video_Connections_Elem) UnmarshalJSON(b []byte) error {
+ typ, err := lexutil.TypeExtract(b)
+ if err != nil {
+ return err
+ }
+
+ switch typ {
+ case "place.stream.video#connection":
+ t.Video_Connection = new(Video_Connection)
+ return json.Unmarshal(b, t.Video_Connection)
+ default:
+ return nil
+ }
+}
+
+func (t *Video_Connections_Elem) MarshalCBOR(w io.Writer) error {
+
+ if t == nil {
+ _, err := w.Write(cbg.CborNull)
+ return err
+ }
+ if t.Video_Connection != nil {
+ return t.Video_Connection.MarshalCBOR(w)
+ }
+ return fmt.Errorf("can not marshal empty union as CBOR")
+}
+
+func (t *Video_Connections_Elem) UnmarshalCBOR(r io.Reader) error {
+ typ, b, err := lexutil.CborTypeExtractReader(r)
+ if err != nil {
+ return err
+ }
+
+ switch typ {
+ case "place.stream.video#connection":
+ t.Video_Connection = new(Video_Connection)
+ return t.Video_Connection.UnmarshalCBOR(bytes.NewReader(b))
default:
return nil
}