From e591bad3c4e7f808fb7e0fe8aca9476dd4e6d607 Mon Sep 17 00:00:00 2001 From: Eli Mallon Date: Mon, 12 Oct 2026 04:39:53 -0700 Subject: [PATCH] lexicons: label and group a segment's audio tracks place.stream.segment#audio gains optional alternateGroup and label. Tracks sharing a group are the same sound in different codecs; the lowest group is the full mix and higher ones are stems a viewer can mix in. Segments without them keep today's meaning. --- .../lex-reference/place-stream-segment.md | 23 +++++++++++++++---- lexicons/place/stream/segment.json | 13 ++++++++++- pkg/placestream/segment.go | 10 +++++--- 3 files changed, 37 insertions(+), 9 deletions(-) diff --git a/js/docs/src/content/docs/lex-reference/place-stream-segment.md b/js/docs/src/content/docs/lex-reference/place-stream-segment.md index 2bc958dad..1b7c0851b 100644 --- a/js/docs/src/content/docs/lex-reference/place-stream-segment.md +++ b/js/docs/src/content/docs/lex-reference/place-stream-segment.md @@ -43,11 +43,13 @@ Media file representing a segment of a livestream **Properties:** -| Name | Type | Req'd | Description | Constraints | -| ---------- | --------- | ----- | ----------- | ------------------- | -| `codec` | `string` | ✅ | | Enum: `opus`, `aac` | -| `rate` | `integer` | ✅ | | | -| `channels` | `integer` | ✅ | | | +| Name | Type | Req'd | Description | Constraints | +| ---------------- | --------- | ----- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- | +| `codec` | `string` | ✅ | | Enum: `opus`, `aac` | +| `rate` | `integer` | ✅ | | | +| `channels` | `integer` | ✅ | | | +| `alternateGroup` | `integer` | ❌ | Audio tracks sharing this value carry the same sound in different codecs. Tracks with different values are independent and play together: the lowest group is the full mix, and higher groups are stems a viewer can mix in. Absent when the stream doesn't distinguish its audio tracks. | Min: 1 | +| `label` | `string` | ❌ | The streamer's name for this audio track, such as "Music". | Max Length: 640
Max Graphemes: 64 | --- @@ -181,6 +183,17 @@ Media file representing a segment of a livestream }, "channels": { "type": "integer" + }, + "alternateGroup": { + "type": "integer", + "minimum": 1, + "description": "Audio tracks sharing this value carry the same sound in different codecs. Tracks with different values are independent and play together: the lowest group is the full mix, and higher groups are stems a viewer can mix in. Absent when the stream doesn't distinguish its audio tracks." + }, + "label": { + "type": "string", + "maxLength": 640, + "maxGraphemes": 64, + "description": "The streamer's name for this audio track, such as \"Music\"." } } }, diff --git a/lexicons/place/stream/segment.json b/lexicons/place/stream/segment.json index f55e8835b..aeb6cbc30 100644 --- a/lexicons/place/stream/segment.json +++ b/lexicons/place/stream/segment.json @@ -70,7 +70,18 @@ "properties": { "codec": { "type": "string", "enum": ["opus", "aac"] }, "rate": { "type": "integer" }, - "channels": { "type": "integer" } + "channels": { "type": "integer" }, + "alternateGroup": { + "type": "integer", + "minimum": 1, + "description": "Audio tracks sharing this value carry the same sound in different codecs. Tracks with different values are independent and play together: the lowest group is the full mix, and higher groups are stems a viewer can mix in. Absent when the stream doesn't distinguish its audio tracks." + }, + "label": { + "type": "string", + "maxLength": 640, + "maxGraphemes": 64, + "description": "The streamer's name for this audio track, such as \"Music\"." + } } }, "video": { diff --git a/pkg/placestream/segment.go b/pkg/placestream/segment.go index af0b2ba60..5ee51cdd8 100644 --- a/pkg/placestream/segment.go +++ b/pkg/placestream/segment.go @@ -67,9 +67,13 @@ func (t *Segment) UnmarshalCBOR(r io.Reader) error { // Segment_Audio is a "audio" in the place.stream.segment schema. type Segment_Audio struct { LexiconTypeID string `json:"$type,omitempty"` - Channels int64 `json:"channels"` - Codec string `json:"codec"` - Rate int64 `json:"rate"` + // alternateGroup: Audio tracks sharing this value carry the same sound in different codecs. Tracks with different values are independent and play together: the lowest group is the full mix, and higher groups are stems a viewer can mix in. Absent when the stream doesn't distinguish its audio tracks. + AlternateGroup *int64 `json:"alternateGroup,omitempty"` + Channels int64 `json:"channels"` + Codec string `json:"codec"` + // label: The streamer's name for this audio track, such as "Music". + Label *string `json:"label,omitempty"` + Rate int64 `json:"rate"` } // RecordTypeID implements glex.Record. -- 2.51.2