Skip to content

SCTE-104 generation time_signal and segmentation_descriptor - #1169

Open
kierank wants to merge 5 commits into
Upipe:masterfrom
kierank:scte2
Open

SCTE-104 generation time_signal and segmentation_descriptor#1169
kierank wants to merge 5 commits into
Upipe:masterfrom
kierank:scte2

Conversation

@kierank

@kierank kierank commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Written by claude but working otherwise

kierank and others added 5 commits June 3, 2026 09:45
… adjustment

Three bugs in the splice insert handler:
- ubuf_block_alloc return value was not checked; fatal error now thrown on
  allocation failure instead of crashing on the subsequent block_write
- cr_dts_delay / (UCLOCK_FREQ/1000) could silently truncate to a wrong
  uint16_t pre_roll_time; clamped to UINT16_MAX with a warning
- break_duration had the same overflow; clamped likewise
- PTS adjustment unconditionally subtracted cr_dts_delay from pts_orig
  even when pts_orig == UINT64_MAX (no splice time present), and
  unconditionally set pts_prog without checking whether the clock
  attribute existed

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ands

The handler previously assumed all input was a splice insert command.
Introduce a command_type dispatch so null and time signal commands are
forwarded as SCTE104_OPID_SPLICE_NULL and SCTE104_OPID_TIME_SIGNAL
respectively, with pre_roll written into the TimeSignalRequestData
payload. Unknown command types are dropped with a warning instead of
silently producing a malformed splice message.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…criptor support

Scan SCTE-35 descriptors attached to the uref and emit corresponding
SCTE-104 operations after the main splice/time-signal op:

- Each segmentation descriptor (tag 0x02) becomes an
  INSERT_SEGMENTATION_DESCRIPTOR op. Three correctness fixes are
  included in this new code:
  * Cancel descriptors in the size pre-calculation loop were read with
    scte35_seg_desc_get_upid_length / has_sub_num without a cancel
    guard, producing a wrong message length; both loops now use
    cancel ? 0 : ... consistently.
  * scte35_seg_desc_get_duration was called unconditionally; it now
    checks scte35_seg_desc_has_duration first so that descriptors
    without a duration field write zero instead of reading from the
    wrong offset.
  * When delivery_not_restricted is set the adjacent restriction flags
    are reserved bits in SCTE-35 (all ones); the output now zeros those
    SCTE-104 fields instead of copying the reserved values.

- All remaining descriptors are bundled into a single
  INSERT_DESCRIPTOR op.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ubase_assert checks x == UBASE_ERR_NONE (i.e. x == 0), so passing a
boolean expression asserts on success rather than failure. Use plain
assert() instead.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@cmassiot
cmassiot requested a review from quarium June 15, 2026 12:39
@kierank
kierank marked this pull request as ready for review July 25, 2026 04:48
@kierank kierank changed the title RFC: SCTE-104 generation time_signal and segmentation_descriptor SCTE-104 generation time_signal and segmentation_descriptor Jul 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant