Skip to content

Handle legacy splice command length - #10

Merged
rafaelcaricio merged 4 commits into
mainfrom
fix/issue-9-legacy-splice-command-length
Jun 26, 2026
Merged

rafaelcaricio merged 4 commits into
mainfrom
fix/issue-9-legacy-splice-command-length

Conversation

@rafaelcaricio

Copy link
Copy Markdown
Owner

Summary

  • handle legacy splice_command_length == 0xFFF by ignoring the length for known splice commands
  • remove derived wire length fields from the public SpliceInfoSection model while keeping splice_command_type
  • keep section, command, and descriptor lengths as parser/encoder internals and compute them during encoding
  • update CLI, README, examples, and tests for the cleaned API

Why

SCTE-35/2023r1 defines 0xFFF as a backwards-compatible sentinel for splice_command_length that downstream equipment should ignore. The parser previously treated it as a 4095-byte command length, which could push parsing past the actual command and fail before reading descriptors.

Validation

  • cargo fmt
  • cargo test --all-features

Fixes #9

@rafaelcaricio
rafaelcaricio requested a review from Copilot June 26, 2026 12:00
@rafaelcaricio rafaelcaricio changed the title [codex] Handle legacy splice command length Handle legacy splice command length Jun 26, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates SCTE-35 parsing/encoding to correctly handle the legacy splice_command_length == 0xFFF sentinel by ignoring the declared length for known commands, while also cleaning up the public API by removing derived wire-length fields from SpliceInfoSection and computing those lengths during encoding.

Changes:

  • Treat splice_command_length == 0xFFF as a legacy sentinel: skip strict command-length enforcement for known commands and reject unknown commands when the length is legacy.
  • Remove derived wire-length fields from the public SpliceInfoSection model, and update builder/CLI/tests/docs accordingly.
  • Tighten parsing validation by erroring when parsed command/descriptor data exceeds the declared lengths (when lengths are not legacy).

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/types.rs Removes derived length fields from SpliceInfoSection; adds SpliceCommand::command_type() helper.
src/parser.rs Implements legacy splice_command_length handling and stricter length validation for commands/descriptors.
src/commands.rs Adds legacy-length constant and rejects unknown commands when length is the legacy sentinel.
src/tests.rs Adds regression tests for legacy command length behavior and updates assertions to the new API.
src/main.rs Updates CLI text output to reflect removal of derived length fields; improves unknown command display.
src/encoding/round_trip_tests.rs Updates encoding tests for the cleaned SpliceInfoSection API (no public length fields).
src/encoding/commands.rs Minor cleanup of SpliceCommand::Unknown encoding branch.
src/builders/splice_info_section.rs Updates builder to stop populating removed length fields and derive splice_command_type from command.
src/builders/extensions.rs Routes command-type conversion through the new command_type() method.
src/builders/tests.rs Updates builder tests to stop asserting removed length fields.
README.md Updates docs/examples/JSON output to match the cleaned API and legacy length behavior.
examples/builder_demo.rs Updates example output to avoid removed length fields.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/types.rs Resolved
Comment thread src/tests.rs Resolved
Comment thread src/builders/splice_info_section.rs Resolved
@rafaelcaricio
rafaelcaricio marked this pull request as ready for review June 26, 2026 12:30
@rafaelcaricio
rafaelcaricio merged commit 21b3115 into main Jun 26, 2026
13 checks passed
@rafaelcaricio
rafaelcaricio deleted the fix/issue-9-legacy-splice-command-length branch June 26, 2026 13:02
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.

Handle legacy splice_command_length

2 participants