Added packager version to WebM muxer.

Also fixed WebM unit tests to match.

Change-Id: Ia0825b13f074667bc2fb13c60f3a1a9c4e4bf67a
This commit is contained in:
Jacob Trimble 2016-01-04 12:27:54 -08:00
parent e0040a4910
commit db9460ca4e
5 changed files with 70 additions and 56 deletions

View File

@ -16,7 +16,7 @@ namespace {
const uint64_t kDuration = 1000; const uint64_t kDuration = 1000;
const uint8_t kBasicSupportDataInit[] = { const uint8_t kBasicSupportDataInit[] = {
// ID: EBML Header, Size: 31 // ID: EBML Header, Payload Size: 31
0x1a, 0x45, 0xdf, 0xa3, 0x9f, 0x1a, 0x45, 0xdf, 0xa3, 0x9f,
// EBMLVersion: 1 // EBMLVersion: 1
0x42, 0x86, 0x81, 0x01, 0x42, 0x86, 0x81, 0x01,
@ -32,9 +32,9 @@ const uint8_t kBasicSupportDataInit[] = {
0x42, 0x87, 0x81, 0x02, 0x42, 0x87, 0x81, 0x02,
// DocTypeReadVersion: 2 // DocTypeReadVersion: 2
0x42, 0x85, 0x81, 0x02, 0x42, 0x85, 0x81, 0x02,
// ID: Segment, Size: -1 // ID: Segment, Payload Size: Unknown
0x18, 0x53, 0x80, 0x67, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x18, 0x53, 0x80, 0x67, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
// ID: Void, Size: 87 // ID: Void, Payload Size: 87
0xec, 0xd7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xec, 0xd7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -43,21 +43,25 @@ const uint8_t kBasicSupportDataInit[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// ID: Info, size: 50 // ID: Info, Payload Size: 88
0x15, 0x49, 0xa9, 0x66, 0xb2, 0x15, 0x49, 0xa9, 0x66, 0xd8,
// TimecodeScale: 1000000 // TimecodeScale: 1000000
0x2a, 0xd7, 0xb1, 0x83, 0x0f, 0x42, 0x40, 0x2a, 0xd7, 0xb1, 0x83, 0x0f, 0x42, 0x40,
// Duration: float(5000) // Duration: float(0)
0x44, 0x89, 0x84, 0x3f, 0x80, 0x00, 0x00, 0x44, 0x89, 0x84, 0x3f, 0x80, 0x00, 0x00,
// MuxingApp: 'libwebm-0.2.1.0' // MuxingApp: 'libwebm-0.2.1.0'
0x4d, 0x80, 0x8f, 0x6c, 0x69, 0x62, 0x77, 0x65, 0x62, 0x6d, 0x2d, 0x30, 0x4d, 0x80, 0x8f, 0x6c, 0x69, 0x62, 0x77, 0x65, 0x62, 0x6d, 0x2d, 0x30,
0x2e, 0x32, 0x2e, 0x31, 0x2e, 0x30, 0x2e, 0x32, 0x2e, 0x31, 0x2e, 0x30,
// WritingApp: 'libwebm-0.2.1.0' // WritingApp: 'https://github.com/google/edash-packager version test'
0x57, 0x41, 0x8f, 0x6c, 0x69, 0x62, 0x77, 0x65, 0x62, 0x6d, 0x2d, 0x30, 0x57, 0x41, 0xb5,
0x2e, 0x32, 0x2e, 0x31, 0x2e, 0x30, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x67, 0x69, 0x74, 0x68,
// ID: Tracks, size: 41 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
0x65, 0x2f, 0x65, 0x64, 0x61, 0x73, 0x68, 0x2d, 0x70, 0x61, 0x63, 0x6b,
0x61, 0x67, 0x65, 0x72, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e,
0x20, 0x74, 0x65, 0x73, 0x74,
// ID: Tracks, Payload Size: 41
0x16, 0x54, 0xae, 0x6b, 0xa9, 0x16, 0x54, 0xae, 0x6b, 0xa9,
// ID: Track, size: 39 // ID: Track, Payload Size: 39
0xae, 0xa7, 0xae, 0xa7,
// TrackNumber: 1 // TrackNumber: 1
0xd7, 0x81, 0x01, 0xd7, 0x81, 0x01,
@ -69,7 +73,7 @@ const uint8_t kBasicSupportDataInit[] = {
0x86, 0x85, 0x56, 0x5f, 0x56, 0x50, 0x38, 0x86, 0x85, 0x56, 0x5f, 0x56, 0x50, 0x38,
// Language: 'en' // Language: 'en'
0x22, 0xb5, 0x9c, 0x82, 0x65, 0x6e, 0x22, 0xb5, 0x9c, 0x82, 0x65, 0x6e,
// ID: Video, Size: 14 // ID: Video, Payload Size: 14
0xe0, 0x8e, 0xe0, 0x8e,
// PixelWidth: 100 // PixelWidth: 100
0xb0, 0x81, 0x64, 0xb0, 0x81, 0x64,
@ -81,19 +85,19 @@ const uint8_t kBasicSupportDataInit[] = {
0x54, 0xba, 0x81, 0x64 0x54, 0xba, 0x81, 0x64
}; };
const uint8_t kBasicSupportDataSegment[] = { const uint8_t kBasicSupportDataSegment[] = {
// ID: Cluster, size: 58 // ID: Cluster, Payload Size: 58
0x1f, 0x43, 0xb6, 0x75, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x1f, 0x43, 0xb6, 0x75, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a,
// Timecode: 0 // Timecode: 0
0xe7, 0x81, 0x00, 0xe7, 0x81, 0x00,
// ID: SimpleBlock, Size: 9 // ID: SimpleBlock, Payload Size: 9
0xa3, 0x89, 0x81, 0x00, 0x00, 0x80, 0xde, 0xad, 0xbe, 0xef, 0x00, 0xa3, 0x89, 0x81, 0x00, 0x00, 0x80, 0xde, 0xad, 0xbe, 0xef, 0x00,
// ID: SimpleBlock, Size: 9 // ID: SimpleBlock, Payload Size: 9
0xa3, 0x89, 0x81, 0x03, 0xe8, 0x80, 0xde, 0xad, 0xbe, 0xef, 0x00, 0xa3, 0x89, 0x81, 0x03, 0xe8, 0x80, 0xde, 0xad, 0xbe, 0xef, 0x00,
// ID: SimpleBlock, Size: 9 // ID: SimpleBlock, Payload Size: 9
0xa3, 0x89, 0x81, 0x07, 0xd0, 0x80, 0xde, 0xad, 0xbe, 0xef, 0x00, 0xa3, 0x89, 0x81, 0x07, 0xd0, 0x80, 0xde, 0xad, 0xbe, 0xef, 0x00,
// ID: SimpleBlock, Size: 9 // ID: SimpleBlock, Payload Size: 9
0xa3, 0x89, 0x81, 0x0b, 0xb8, 0x80, 0xde, 0xad, 0xbe, 0xef, 0x00, 0xa3, 0x89, 0x81, 0x0b, 0xb8, 0x80, 0xde, 0xad, 0xbe, 0xef, 0x00,
// ID: SimpleBlock, Size: 9 // ID: SimpleBlock, Payload Size: 9
0xa3, 0x89, 0x81, 0x0f, 0xa0, 0x80, 0xde, 0xad, 0xbe, 0xef, 0x00 0xa3, 0x89, 0x81, 0x0f, 0xa0, 0x80, 0xde, 0xad, 0xbe, 0xef, 0x00
}; };

View File

@ -54,8 +54,13 @@ Status Segmenter::Initialize(scoped_ptr<MkvWriter> writer,
progress_target_ = info_->duration(); progress_target_ = info_->duration();
progress_listener_ = progress_listener; progress_listener_ = progress_listener;
const std::string version_string =
"https://github.com/google/edash-packager version " +
options().packager_version_string;
segment_info_.Init(); segment_info_.Init();
segment_info_.set_timecode_scale(kTimecodeScale); segment_info_.set_timecode_scale(kTimecodeScale);
segment_info_.set_writing_app(version_string.c_str());
if (options().single_segment) { if (options().single_segment) {
// Set an initial duration so the duration element is written; will be // Set an initial duration so the duration element is written; will be
// overwritten at the end. // overwritten at the end.

View File

@ -63,6 +63,7 @@ MuxerOptions SegmentTestBase::CreateMuxerOptions() const {
ret.single_segment = single_segment_; ret.single_segment = single_segment_;
ret.output_file_name = output_file_name_; ret.output_file_name = output_file_name_;
ret.segment_template = segment_template_; ret.segment_template = segment_template_;
ret.packager_version_string = "test";
ret.segment_duration = 30; // seconds ret.segment_duration = 30; // seconds
ret.fragment_duration = 30; // seconds ret.fragment_duration = 30; // seconds
ret.segment_sap_aligned = false; ret.segment_sap_aligned = false;

View File

@ -40,7 +40,7 @@ class SegmentTestBase : public ::testing::Test {
scoped_ptr<S> segmenter(new S(options)); scoped_ptr<S> segmenter(new S(options));
scoped_ptr<MkvWriter> writer(new MkvWriter()); scoped_ptr<MkvWriter> writer(new MkvWriter());
ASSERT_OK(writer->Open(this->output_file_name_)); ASSERT_OK(writer->Open(options.output_file_name));
ASSERT_OK(segmenter->Initialize(writer.Pass(), info, NULL, NULL, NULL)); ASSERT_OK(segmenter->Initialize(writer.Pass(), info, NULL, NULL, NULL));
*result = segmenter.Pass(); *result = segmenter.Pass();
} }

View File

@ -17,7 +17,7 @@ namespace {
const uint64_t kDuration = 1000; const uint64_t kDuration = 1000;
const uint8_t kBasicSupportData[] = { const uint8_t kBasicSupportData[] = {
// ID: EBML Header, Size: 31 // ID: EBML Header, Payload Size: 31
0x1a, 0x45, 0xdf, 0xa3, 0x9f, 0x1a, 0x45, 0xdf, 0xa3, 0x9f,
// EBMLVersion: 1 // EBMLVersion: 1
0x42, 0x86, 0x81, 0x01, 0x42, 0x86, 0x81, 0x01,
@ -33,30 +33,30 @@ const uint8_t kBasicSupportData[] = {
0x42, 0x87, 0x81, 0x02, 0x42, 0x87, 0x81, 0x02,
// DocTypeReadVersion: 2 // DocTypeReadVersion: 2
0x42, 0x85, 0x81, 0x02, 0x42, 0x85, 0x81, 0x02,
// ID: Segment, Size: 287 // ID: Segment, Payload Size: 316
0x18, 0x53, 0x80, 0x67, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x16, 0x18, 0x53, 0x80, 0x67, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x3c,
// ID: SeekHead, Size: 29 // ID: SeekHead, Payload Size: 30
0x11, 0x4d, 0x9b, 0x74, 0x9d, 0x11, 0x4d, 0x9b, 0x74, 0x9e,
// ID: Seek, Size: 11 // ID: Seek, Payload Size: 12
0x4d, 0xbb, 0x8b,
// SeekID: binary(4)
0x53, 0xab, 0x84, 0x1f, 0x43, 0xb6, 0x75,
// SeekPosition: 238
0x53, 0xac, 0x81, 0xee,
// ID: Seek, Size: 12
0x4d, 0xbb, 0x8c, 0x4d, 0xbb, 0x8c,
// SeekID: binary(4) // SeekID: binary(4) (Cluster)
0x53, 0xab, 0x84, 0x1f, 0x43, 0xb6, 0x75,
// SeekPosition: 276
0x53, 0xac, 0x82, 0x01, 0x14,
// ID: Seek, Payload Size: 12
0x4d, 0xbb, 0x8c,
// SeekID: binary(4) (Cues)
0x53, 0xab, 0x84, 0x1c, 0x53, 0xbb, 0x6b, 0x53, 0xab, 0x84, 0x1c, 0x53, 0xbb, 0x6b,
// SeekPosition: 174 // SeekPosition: 346
0x53, 0xac, 0x82, 0x01, 0x34, 0x53, 0xac, 0x82, 0x01, 0x5a,
// ID: Void, Size: 53 // ID: Void, Payload Size: 52
0xec, 0xb5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xec, 0xb4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// ID: Info, size: 50 // ID: Info, Payload Size: 88
0x15, 0x49, 0xa9, 0x66, 0xb2, 0x15, 0x49, 0xa9, 0x66, 0xd8,
// TimecodeScale: 1000000 // TimecodeScale: 1000000
0x2a, 0xd7, 0xb1, 0x83, 0x0f, 0x42, 0x40, 0x2a, 0xd7, 0xb1, 0x83, 0x0f, 0x42, 0x40,
// Duration: float(5000) // Duration: float(5000)
@ -64,12 +64,16 @@ const uint8_t kBasicSupportData[] = {
// MuxingApp: 'libwebm-0.2.1.0' // MuxingApp: 'libwebm-0.2.1.0'
0x4d, 0x80, 0x8f, 0x6c, 0x69, 0x62, 0x77, 0x65, 0x62, 0x6d, 0x2d, 0x30, 0x4d, 0x80, 0x8f, 0x6c, 0x69, 0x62, 0x77, 0x65, 0x62, 0x6d, 0x2d, 0x30,
0x2e, 0x32, 0x2e, 0x31, 0x2e, 0x30, 0x2e, 0x32, 0x2e, 0x31, 0x2e, 0x30,
// WritingApp: 'libwebm-0.2.1.0' // WritingApp: 'https://github.com/google/edash-packager version test'
0x57, 0x41, 0x8f, 0x6c, 0x69, 0x62, 0x77, 0x65, 0x62, 0x6d, 0x2d, 0x30, 0x57, 0x41, 0xb5,
0x2e, 0x32, 0x2e, 0x31, 0x2e, 0x30, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x67, 0x69, 0x74, 0x68,
// ID: Tracks, size: 41 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
0x65, 0x2f, 0x65, 0x64, 0x61, 0x73, 0x68, 0x2d, 0x70, 0x61, 0x63, 0x6b,
0x61, 0x67, 0x65, 0x72, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e,
0x20, 0x74, 0x65, 0x73, 0x74,
// ID: Tracks, Payload Size: 41
0x16, 0x54, 0xae, 0x6b, 0xa9, 0x16, 0x54, 0xae, 0x6b, 0xa9,
// ID: Track, size: 39 // ID: Track, Payload Size: 39
0xae, 0xa7, 0xae, 0xa7,
// TrackNumber: 1 // TrackNumber: 1
0xd7, 0x81, 0x01, 0xd7, 0x81, 0x01,
@ -81,7 +85,7 @@ const uint8_t kBasicSupportData[] = {
0x86, 0x85, 0x56, 0x5f, 0x56, 0x50, 0x38, 0x86, 0x85, 0x56, 0x5f, 0x56, 0x50, 0x38,
// Language: 'en' // Language: 'en'
0x22, 0xb5, 0x9c, 0x82, 0x65, 0x6e, 0x22, 0xb5, 0x9c, 0x82, 0x65, 0x6e,
// ID: Video, Size: 14 // ID: Video, Payload Size: 14
0xe0, 0x8e, 0xe0, 0x8e,
// PixelWidth: 100 // PixelWidth: 100
0xb0, 0x81, 0x64, 0xb0, 0x81, 0x64,
@ -91,32 +95,32 @@ const uint8_t kBasicSupportData[] = {
0x54, 0xb0, 0x81, 0x64, 0x54, 0xb0, 0x81, 0x64,
// DisplayHeight: 100 // DisplayHeight: 100
0x54, 0xba, 0x81, 0x64, 0x54, 0xba, 0x81, 0x64,
// ID: Cluster, size: 58 // ID: Cluster, Payload Size: 58
0x1f, 0x43, 0xb6, 0x75, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x1f, 0x43, 0xb6, 0x75, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a,
// Timecode: 0 // Timecode: 0
0xe7, 0x81, 0x00, 0xe7, 0x81, 0x00,
// ID: SimpleBlock, Size: 9 // ID: SimpleBlock, Payload Size: 9
0xa3, 0x89, 0x81, 0x00, 0x00, 0x80, 0xde, 0xad, 0xbe, 0xef, 0x00, 0xa3, 0x89, 0x81, 0x00, 0x00, 0x80, 0xde, 0xad, 0xbe, 0xef, 0x00,
// ID: SimpleBlock, Size: 9 // ID: SimpleBlock, Payload Size: 9
0xa3, 0x89, 0x81, 0x03, 0xe8, 0x80, 0xde, 0xad, 0xbe, 0xef, 0x00, 0xa3, 0x89, 0x81, 0x03, 0xe8, 0x80, 0xde, 0xad, 0xbe, 0xef, 0x00,
// ID: SimpleBlock, Size: 9 // ID: SimpleBlock, Payload Size: 9
0xa3, 0x89, 0x81, 0x07, 0xd0, 0x80, 0xde, 0xad, 0xbe, 0xef, 0x00, 0xa3, 0x89, 0x81, 0x07, 0xd0, 0x80, 0xde, 0xad, 0xbe, 0xef, 0x00,
// ID: SimpleBlock, Size: 9 // ID: SimpleBlock, Payload Size: 9
0xa3, 0x89, 0x81, 0x0b, 0xb8, 0x80, 0xde, 0xad, 0xbe, 0xef, 0x00, 0xa3, 0x89, 0x81, 0x0b, 0xb8, 0x80, 0xde, 0xad, 0xbe, 0xef, 0x00,
// ID: SimpleBlock, Size: 9 // ID: SimpleBlock, Payload Size: 9
0xa3, 0x89, 0x81, 0x0f, 0xa0, 0x80, 0xde, 0xad, 0xbe, 0xef, 0x00, 0xa3, 0x89, 0x81, 0x0f, 0xa0, 0x80, 0xde, 0xad, 0xbe, 0xef, 0x00,
// ID: Cues, Size: 13 // ID: Cues, Payload Size: 13
0x1c, 0x53, 0xbb, 0x6b, 0x8d, 0x1c, 0x53, 0xbb, 0x6b, 0x8d,
// ID: CuePoint, Size: 11 // ID: CuePoint, Payload Size: 11
0xbb, 0x8b, 0xbb, 0x8b,
// CueTime: 0 // CueTime: 0
0xb3, 0x81, 0x00, 0xb3, 0x81, 0x00,
// ID: CueTrackPositions, Size: 6 // ID: CueTrackPositions, Payload Size: 6
0xb7, 0x86, 0xb7, 0x86,
// CueTrack: 1 // CueTrack: 1
0xf7, 0x81, 0x01, 0xf7, 0x81, 0x01,
// CueClusterPosition: 190 // CueClusterPosition: 228
0xf1, 0x81, 0xbe 0xf1, 0x81, 0xe4
}; };
} // namespace } // namespace