Skip to content

Apply all necessary TechSmith customizations to mp4v2#2

Open
dchengTSC wants to merge 7 commits into
mainfrom
techsmith/full-migration
Open

Apply all necessary TechSmith customizations to mp4v2#2
dchengTSC wants to merge 7 commits into
mainfrom
techsmith/full-migration

Conversation

@dchengTSC

Copy link
Copy Markdown
Collaborator

No description provided.

Add support for reading VP9 video tracks in MP4 files:
- Add MP4Vp09Atom class that properly parses the vp09 sample entry,
  including its child atoms (vpcC, btrt, colr, pasp)
- Register vp09 in the atom factory and as an expected stsd child

Add MP4GetTrackAtomData/MP4FreeTrackAtomData API:
- Allows reading the raw data of any track atom by path
- Useful for extracting codec configuration boxes (e.g. vpcC, avcC)
  that don't have dedicated accessor functions
- Memory is allocated by the library and freed via MP4FreeTrackAtomData
  to avoid CRT mismatch issues on Windows
Add support for creating and reading TSC2 video tracks in MP4 files:
- Add MP4Tsc2Atom class that defines the tsc2 sample entry structure
  (dataReferenceIndex, width, height, compressorName, esds child atom)
- Register tsc2 in the atom factory and as an expected stsd child
- Add MP4File::AddTSC2VideoTrack() method for creating TSC2 tracks
- Add MP4AddTSC2VideoTrack() public C API

TSC2 is TechSmith's proprietary screen capture codec used in TREC
(TechSmith Recording) container files which are MP4-based.
Add an optional callback parameter to MP4Read() that allows callers
to control which atoms are fully parsed during file reading. When
the callback returns false for a given atom type, the atom's
properties and children are skipped (the atom is still recorded in
the tree but its content is not read).

This is useful for error recovery: if a file fails to parse due to
a malformed atom (e.g. corrupted udta or text atoms), the caller
can retry with a callback that skips problematic atoms, allowing
the rest of the file structure to be read successfully.

API changes:
- Add MP4ShouldParseAtomCallback typedef in file.h
- MP4Read() gains an optional second parameter (default NULL)
- MP4File stores and exposes the callback via get/set methods
- MP4Atom::Read() checks the callback before parsing
Add MP4PNGAtom class for properly parsing 'png ' sample entry atoms
found in QuickTime MOV files that use PNG-encoded video frames.

Without this registration, PNG atoms are treated as unknown and their
width/height properties are not directly accessible (requiring
fallback to tkhd dimensions). With this change, the stsd.png .width
and stsd.png .height properties are properly parsed.

Changes:
- Add MP4PNGAtom class in atoms.h with standard video sample entry
  layout (dataReferenceIndex, width, height, compressorName)
- Register 'png ' in the atom factory
- Add as expected stsd child atom
- esds child is optional (unlike TSC2) since PNG MOVs may not have it
Add missing C API functions needed by consuming code:

MP4GetSampleFileOffset():
- Returns the byte offset within the file of a given sample
- The underlying MP4Track::GetSampleFileOffset() already existed but
  was protected; moved to public and added MP4File wrapper + C API
- Used by TRECBackupWriter and TRECMP4TrackReader

MP4FreeTrackName():
- Frees memory allocated by MP4GetTrackName()
- Needed on Windows where CRT heap mismatch between DLL and client
  can cause crashes if client calls free() directly
- Wrapper around MP4Free()
so we don't end up with library names like libmp4v2.2.dylib
@KMojek KMojek mentioned this pull request Jun 12, 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