mkvmuxer: Add support for VP9 and Opus tracks.

Also make codec ID constants really constant.

Change-Id: I951d25e83ce507afb1ca475e2d5dbfe6402f3d61
This commit is contained in:
Tom Finegan 2014-01-09 14:56:15 -08:00
parent a6c71c1407
commit 5efd6e3c1d
3 changed files with 21 additions and 8 deletions

View File

@ -589,6 +589,10 @@ uint64 Track::PayloadSize() const {
size += EbmlElementSize(kMkvName, name_);
if (max_block_additional_id_)
size += EbmlElementSize(kMkvMaxBlockAdditionID, max_block_additional_id_);
if (codec_delay_)
size += EbmlElementSize(kMkvCodecDelay, codec_delay_);
if (seek_pre_roll_)
size += EbmlElementSize(kMkvSeekPreRoll, seek_pre_roll_);
if (content_encoding_entries_size_ > 0) {
uint64 content_encodings_size = 0;
@ -959,8 +963,11 @@ bool AudioTrack::Write(IMkvWriter* writer) const {
//
// Tracks Class
const char* const Tracks::kVp8CodecId = "V_VP8";
const char* const Tracks::kVorbisCodecId = "A_VORBIS";
const char Tracks::kOpusCodecId[] = "A_OPUS";
const char Tracks::kVorbisCodecId[] = "A_VORBIS";
const char Tracks::kVp8CodecId[] = "V_VP8";
const char Tracks::kVp9CodecId[] = "V_VP9";
Tracks::Tracks()
: track_entries_(NULL),

View File

@ -481,9 +481,11 @@ class Tracks {
kVideo = 0x1,
kAudio = 0x2
};
// Vorbis and VP8 coded id defined by the Matroska specs.
static const char* const kVorbisCodecId;
static const char* const kVp8CodecId;
// Opus, Vorbis, VP8, and VP9 codec ids defined by the Matroska specs.
static const char kOpusCodecId[];
static const char kVorbisCodecId[];
static const char kVp8CodecId[];
static const char kVp9CodecId[];
Tracks();
~Tracks();
@ -980,8 +982,8 @@ class Segment {
// track number.
Track* AddTrack(int32 number);
// 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.
// Adds a Vorbis 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);
@ -1059,7 +1061,7 @@ class Segment {
// frame: frame object
bool AddGenericFrame(const Frame* frame);
// Adds a video track to the segment. Returns the number of the track on
// Adds a VP8 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.

View File

@ -347,6 +347,8 @@ int main(int argc, char* argv[]) {
if (track_name)
video->set_name(track_name);
video->set_codec_id(pVideoTrack->GetCodecId());
if (display_width > 0)
video->set_display_width(display_width);
if (display_height > 0)
@ -385,6 +387,8 @@ int main(int argc, char* argv[]) {
if (track_name)
audio->set_name(track_name);
audio->set_codec_id(pAudioTrack->GetCodecId());
size_t private_size;
const unsigned char* const private_data =
pAudioTrack->GetCodecPrivate(private_size);