-
Notifications
You must be signed in to change notification settings - Fork 507
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add MPEG-H support #952
Add MPEG-H support #952
Changes from 6 commits
74b2860
33cd4ec
e448598
bd549ee
a75daef
13b4a65
1c8d381
a3e292f
ada3493
ff21436
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ | |
|
||
3Q GmbH <*@3qsdn.com> | ||
Alen Vrecko <[email protected]> | ||
Amazon Music <*@amazon.com> | ||
Anders Hasselqvist <[email protected]> | ||
Audible <*@audible.com> | ||
Chun-da Chen <[email protected]> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,4 +48,5 @@ Sanil Raut <[email protected]> | |
Sergio Ammirata <[email protected]> | ||
Thomas Inskip <[email protected]> | ||
Tim Lansen <[email protected]> | ||
Vincent Nguyen <[email protected]> | ||
Weiguo Shao <[email protected]> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,6 +87,9 @@ enum FourCC : uint32_t { | |
FOURCC_meco = 0x6d65636f, | ||
FOURCC_mehd = 0x6d656864, | ||
FOURCC_meta = 0x6d657461, | ||
FOURCC_mha1 = 0x6d686131, | ||
FOURCC_mhaC = 0x6d686143, | ||
FOURCC_mhm1 = 0x6d686d31, | ||
Comment on lines
+92
to
+94
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry for not noticing it earlier. I think it has to be moved after line 94 to follow alphabetical order. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Arranged to alphabetical order. |
||
FOURCC_mfhd = 0x6d666864, | ||
FOURCC_mfra = 0x6d667261, | ||
FOURCC_minf = 0x6d696e66, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,6 +54,8 @@ enum Codec { | |
kCodecOpus, | ||
kCodecVorbis, | ||
kCodecMP3, | ||
kCodecMha1, | ||
kCodecMhm1, | ||
Comment on lines
+57
to
+58
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you move them before kCodecAudioMaxPlusOne, i.e. before line 57? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
kCodecAudioMaxPlusOne, | ||
|
||
kCodecText = 300, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1709,6 +1709,29 @@ size_t ElementaryStreamDescriptor::ComputeSizeInternal() { | |
return HeaderSize() + es_descriptor.ComputeSize(); | ||
} | ||
|
||
MHAConfiguration::MHAConfiguration() = default; | ||
MHAConfiguration::~MHAConfiguration() = default; | ||
|
||
FourCC MHAConfiguration::BoxType() const { | ||
return FOURCC_mhaC; | ||
} | ||
|
||
bool MHAConfiguration::ReadWriteInternal(BoxBuffer* buffer) { | ||
RCHECK(ReadWriteHeaderInternal(buffer) && | ||
buffer->ReadWriteVector( | ||
&data, buffer->Reading() ? buffer->BytesLeft() : data.size())); | ||
RCHECK(data.size() > 1); | ||
mpeg_h_3da_profile_level_indication = data[1]; | ||
Comment on lines
+1723
to
+1724
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be inside an
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, that is better I think, though it does not really matter. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, I just left it alone. |
||
return true; | ||
} | ||
|
||
size_t MHAConfiguration::ComputeSizeInternal() { | ||
// This box is optional. Skip it if not initialized. | ||
if (data.empty()) | ||
return 0; | ||
return HeaderSize() + data.size(); | ||
} | ||
|
||
DTSSpecific::DTSSpecific() = default; | ||
DTSSpecific::~DTSSpecific() = default; | ||
; | ||
|
@@ -1922,6 +1945,7 @@ bool AudioSampleEntry::ReadWriteInternal(BoxBuffer* buffer) { | |
RCHECK(buffer->TryReadWriteChild(&dac4)); | ||
RCHECK(buffer->TryReadWriteChild(&dops)); | ||
RCHECK(buffer->TryReadWriteChild(&dfla)); | ||
RCHECK(buffer->TryReadWriteChild(&mhac)); | ||
|
||
// Somehow Edge does not support having sinf box before codec_configuration, | ||
// box, so just do it in the end of AudioSampleEntry. See | ||
|
@@ -1947,7 +1971,7 @@ size_t AudioSampleEntry::ComputeSizeInternal() { | |
sizeof(samplesize) + sizeof(samplerate) + sinf.ComputeSize() + | ||
esds.ComputeSize() + ddts.ComputeSize() + dac3.ComputeSize() + | ||
dec3.ComputeSize() + dops.ComputeSize() + dfla.ComputeSize() + | ||
dac4.ComputeSize() + | ||
dac4.ComputeSize() + mhac.ComputeSize() + | ||
// Reserved and predefined bytes. | ||
6 + 8 + // 6 + 8 bytes reserved. | ||
4; // 4 bytes predefined. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1222,6 +1222,36 @@ TEST_F(BoxDefinitionsTest, AC3SampleEntry) { | |
ASSERT_EQ(entry, entry_readback); | ||
} | ||
|
||
TEST_F(BoxDefinitionsTest, MHA1SampleEntry) { | ||
AudioSampleEntry entry; | ||
entry.format = FOURCC_mha1; | ||
entry.data_reference_index = 2; | ||
entry.channelcount = 5; | ||
entry.samplesize = 16; | ||
entry.samplerate = 44100; | ||
Fill(&entry.mhac); | ||
entry.Write(this->buffer_.get()); | ||
|
||
AudioSampleEntry entry_readback; | ||
ASSERT_TRUE(ReadBack(&entry_readback)); | ||
ASSERT_EQ(entry, entry_readback); | ||
} | ||
|
||
TEST_F(BoxDefinitionsTest, MHACSampleEntry) { | ||
AudioSampleEntry entry; | ||
entry.format = FOURCC_mhaC; | ||
entry.data_reference_index = 2; | ||
entry.channelcount = 5; | ||
entry.samplesize = 16; | ||
entry.samplerate = 44100; | ||
Fill(&entry.mhac); | ||
entry.Write(this->buffer_.get()); | ||
|
||
AudioSampleEntry entry_readback; | ||
ASSERT_TRUE(ReadBack(&entry_readback)); | ||
ASSERT_EQ(entry, entry_readback); | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test can be removed as it tests the same thing as the test above. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed. |
||
TEST_F(BoxDefinitionsTest, EC3SampleEntry) { | ||
AudioSampleEntry entry; | ||
entry.format = FOURCC_ec_3; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
80 characters line limit.
Can you break it into three lines, e.g.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies, I missed that one. Fixed.