-
Notifications
You must be signed in to change notification settings - Fork 516
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: This patch adds support for DTS:X Profile 2 audio in MP4 files. (…
…#1303) feat: Added audio specific configuration udts box to AudioSampleEntry for MP4 input/output. DASH tags for DTS audio as specified in ETSI TS 103 491 and ETSI TS 102 114. Closes #1301 --------- Co-authored-by: Cosmin Stejerean <[email protected]>
- Loading branch information
1 parent
f7b3986
commit 07f780d
Showing
23 changed files
with
373 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!--Generated with https://github.com/shaka-project/shaka-packager version <tag>-<hash>-<test>--> | ||
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011" minBufferTime="PT2S" type="static" mediaPresentationDuration="PT3.114667S"> | ||
<Period id="0"> | ||
<AdaptationSet id="0" contentType="audio" subsegmentAlignment="true"> | ||
<Representation id="0" bandwidth="227665" codecs="dtsx" mimeType="audio/mp4" audioSamplingRate="48000"> | ||
<AudioChannelConfiguration schemeIdUri="tag:dts.com,2018:uhd:audio_channel_configuration" value="0000003F"/> | ||
<BaseURL>bear-dtsx-audio.mp4</BaseURL> | ||
<SegmentBase indexRange="742-821" timescale="48000"> | ||
<Initialization range="0-741"/> | ||
</SegmentBase> | ||
</Representation> | ||
</AdaptationSet> | ||
</Period> | ||
</MPD> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,7 @@ enum Codec { | |
kCodecDTSL, | ||
kCodecDTSM, | ||
kCodecDTSP, | ||
kCodecDTSX, | ||
kCodecEAC3, | ||
kCodecFlac, | ||
kCodecOpus, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright (c) 2023 Google Inc. All rights reserved. | ||
// | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include <packager/media/codecs/dts_audio_specific_config.h> | ||
|
||
#include <packager/media/base/bit_reader.h> | ||
#include <packager/media/base/rcheck.h> | ||
|
||
namespace shaka { | ||
namespace media { | ||
|
||
bool GetDTSXChannelMask(const std::vector<uint8_t>& udts, uint32_t& mask) { | ||
// udts is the DTS-UHD Specific Box: ETSI TS 103 491 V1.2.1 Table B-2 | ||
// DecoderProfileCode(6 bits) | ||
// FrameDurationCode(2 bits) | ||
// MaxPayloadCode(3 bits) | ||
// NumPresentationsCode(5 bits) | ||
// ChannelMask (32 bits) | ||
BitReader bit_reader(udts.data(), udts.size()); | ||
RCHECK(bit_reader.SkipBits(16)); | ||
RCHECK(bit_reader.ReadBits(32, &mask)); | ||
return true; | ||
} | ||
|
||
} // namespace media | ||
} // namespace shaka |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright (c) 2023 Google Inc. All rights reserved. | ||
// | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef PACKAGER_MEDIA_CODECS_DTS_AUDIO_SPECIFIC_CONFIG_H_ | ||
#define PACKAGER_MEDIA_CODECS_DTS_AUDIO_SPECIFIC_CONFIG_H_ | ||
|
||
#include <stddef.h> | ||
#include <stdint.h> | ||
|
||
#include <vector> | ||
|
||
namespace shaka { | ||
namespace media { | ||
|
||
class BitReader; | ||
|
||
bool GetDTSXChannelMask(const std::vector<uint8_t>& udts, uint32_t& mask); | ||
|
||
} // namespace media | ||
} // namespace shaka | ||
|
||
#endif // PACKAGER_MEDIA_CODECS_DTS_AUDIO_SPECIFIC_CONFIG_H_ |
37 changes: 37 additions & 0 deletions
37
packager/media/codecs/dts_audio_specific_config_unittest.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright 2023 Google Inc. All rights reserved. | ||
// | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include <gtest/gtest.h> | ||
|
||
#include "packager/media/codecs/dts_audio_specific_config.h" | ||
|
||
namespace shaka { | ||
namespace media { | ||
|
||
TEST(DTSAudioSpecificConfigTest, BasicProfileTest) { | ||
uint8_t buffer[] = {0x01, 0x20, 0x00, 0x00, 0x0, 0x3F, 0x80, 0x00}; | ||
std::vector<uint8_t> data(std::begin(buffer), std::end(buffer)); | ||
uint32_t mask; | ||
EXPECT_TRUE(GetDTSXChannelMask(data, mask)); | ||
EXPECT_EQ(0x3F, mask); | ||
} | ||
|
||
TEST(DTSAudioSpecificConfigTest, ChannelMaskBytes) { | ||
uint8_t buffer[] = {0x01, 0x20, 0x12, 0x34, 0x56, 0x78, 0x80, 0x00}; | ||
std::vector<uint8_t> data(std::begin(buffer), std::end(buffer)); | ||
uint32_t mask; | ||
EXPECT_TRUE(GetDTSXChannelMask(data, mask)); | ||
EXPECT_EQ(0x12345678, mask); | ||
} | ||
|
||
TEST(DTSAudioSpecificConfigTest, Truncated) { | ||
uint8_t buffer[] = {0x01, 0x20, 0x00, 0x00, 0x00}; | ||
std::vector<uint8_t> data(std::begin(buffer), std::end(buffer)); | ||
uint32_t mask; | ||
EXPECT_FALSE(GetDTSXChannelMask(data, mask)); | ||
} | ||
|
||
} // namespace media | ||
} // namespace shaka |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.