Skip to content

implement track reference (tref) box#139

Merged
bradh merged 1 commit intokixelated:mainfrom
bradh:tref_2026-02-01
Feb 18, 2026
Merged

implement track reference (tref) box#139
bradh merged 1 commit intokixelated:mainfrom
bradh:tref_2026-02-01

Conversation

@bradh
Copy link
Copy Markdown
Collaborator

@bradh bradh commented Feb 1, 2026

From ISO/IEC 14496-12:2022 Section 8.3.3

Resolves #117

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 1, 2026

Walkthrough

Adds support for the tref (track reference) atom across the codebase. A new Tref variant is added to the public Any enum and a tref module is introduced, containing TrackReferenceTypeBox and Tref structs with encode/decode logic and tests. Trak is extended with pub tref: Option<Tref> and the atom nesting configuration is updated to include Tref. Several tests are refactored to replace explicit None initializations with ..Default::default() for struct construction.

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 69.23% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: implementing the track reference (tref) box, which aligns with the primary objective of the changeset.
Description check ✅ Passed The description references the ISO/IEC standard specification and resolves issue #117, which is directly related to implementing the tref box.
Linked Issues check ✅ Passed The PR implements the Track Reference Box (tref) per ISO/IEC 14496-12:2022 Section 8.3.3 as requested in issue #117, with new tref module and struct definitions.
Out of Scope Changes check ✅ Passed Changes to test files replacing explicit None fields with ..Default::default() are minor refactoring updates compatible with the new tref field addition to Trak.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@src/moov/trak/tref.rs`:
- Around line 27-37: The decode implementation for TrackReferenceTypeBox must
validate that the payload length is a multiple of 4 before decoding u32 track
IDs: inside fn decode (where Header::decode(buf)? is called and size is
computed) add a check that size % 4 == 0 and return Error::InvalidSize if not,
then compute num_entries = size / 4 and proceed to allocate track_ids and call
u32::decode(buf) for each entry; this prevents leftover bytes from being
misinterpreted as the next header and keeps the existing error type and
variables (track_ids, num_entries, Error::InvalidSize) intact.

Comment thread src/moov/trak/tref.rs
From ISO/IEC 14496-12:2022 Section 8.3.3
@bradh bradh merged commit bb0cc6f into kixelated:main Feb 18, 2026
1 check passed
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.

missing box - tref

1 participant