Add support for setting track numbers.

When adding tracks to the muxer the application can set the
track number.

Change-Id: Id4dbbfec5cd541b1354c03361a40a3d2d7f921b9
This commit is contained in:
Frank Galligan
2011-08-14 12:33:30 -04:00
parent a09f15f00e
commit 2d3461b4b3
3 changed files with 77 additions and 17 deletions

View File

@@ -335,8 +335,10 @@ class Tracks {
~Tracks();
// Adds a Track element to the Tracks object. |track| will be owned and
// deleted by the Tracks object. Returns true on success.
bool AddTrack(Track* track);
// deleted by the Tracks object. Returns true on success. |number| is the
// number to use for the track. |number| must be >= 0. If |number| == 0
// then the muxer will decide on the track number.
bool AddTrack(Track* track, int32 number);
// Returns the track by index. Returns NULL if there is no track match.
const Track* GetTrackByIndex(uint32 idx) const;
@@ -525,6 +527,8 @@ class Segment {
kFile = 0x2
};
const static uint64 kDefaultMaxClusterDuration = 30000000000ULL;
explicit Segment(IMkvWriter* writer);
virtual ~Segment();
@@ -532,6 +536,12 @@ class Segment {
// success, 0 on error.
uint64 AddAudioTrack(int32 sample_rate, int32 channels);
// Adds an audio track to the segment. Returns the number of the track on
// success, 0 on error. |number| is the number to use for the audio track.
// |number| must be >= 0. If |number| == 0 then the muxer will decide on
// the track number.
uint64 AddAudioTrack(int32 sample_rate, int32 channels, int32 number);
// Adds a frame to be output in the file. Returns true on success.
// Inputs:
// frame: Pointer to the data
@@ -550,6 +560,12 @@ class Segment {
// success, 0 on error.
uint64 AddVideoTrack(int32 width, int32 height);
// Adds a video track to the segment. Returns the number of the track on
// success, 0 on error. |number| is the number to use for the video track.
// |number| must be >= 0. If |number| == 0 then the muxer will decide on
// the track number.
uint64 AddVideoTrack(int32 width, int32 height, int32 number);
// Sets which track to use for the Cues element. Must have added the track
// before calling this function. Returns true on success. |track_number| is
// returned by the Add track functions.