Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
59a789b3
authored
Sep 10, 2015
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Include missing durations in AC3/DTS formats.
parent
e13e23e3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
library/src/main/java/com/google/android/exoplayer/extractor/mp4/AtomParsers.java
library/src/main/java/com/google/android/exoplayer/util/Ac3Util.java
library/src/main/java/com/google/android/exoplayer/extractor/mp4/AtomParsers.java
View file @
59a789b3
...
...
@@ -635,17 +635,17 @@ import java.util.List;
// TODO: Choose the right AC-3 track based on the contents of dac3/dec3.
// TODO: Add support for encryption (by setting out.trackEncryptionBoxes).
parent
.
setPosition
(
Atom
.
HEADER_SIZE
+
childStartPosition
);
out
.
mediaFormat
=
Ac3Util
.
parseAnnexFAc3Format
(
parent
);
out
.
mediaFormat
=
Ac3Util
.
parseAnnexFAc3Format
(
parent
,
durationUs
);
return
;
}
else
if
(
atomType
==
Atom
.
TYPE_ec_3
&&
childAtomType
==
Atom
.
TYPE_dec3
)
{
parent
.
setPosition
(
Atom
.
HEADER_SIZE
+
childStartPosition
);
out
.
mediaFormat
=
Ac3Util
.
parseAnnexFEAc3Format
(
parent
);
out
.
mediaFormat
=
Ac3Util
.
parseAnnexFEAc3Format
(
parent
,
durationUs
);
return
;
}
else
if
((
atomType
==
Atom
.
TYPE_dtsc
||
atomType
==
Atom
.
TYPE_dtse
||
atomType
==
Atom
.
TYPE_dtsh
||
atomType
==
Atom
.
TYPE_dtsl
)
&&
childAtomType
==
Atom
.
TYPE_ddts
)
{
out
.
mediaFormat
=
MediaFormat
.
createAudioFormat
(
mimeType
,
MediaFormat
.
NO_VALUE
,
MediaFormat
.
NO_VALUE
,
channelCount
,
sampleRate
,
null
);
MediaFormat
.
NO_VALUE
,
durationUs
,
channelCount
,
sampleRate
,
null
);
return
;
}
childPosition
+=
childAtomSize
;
...
...
library/src/main/java/com/google/android/exoplayer/util/Ac3Util.java
View file @
59a789b3
...
...
@@ -37,7 +37,7 @@ public final class Ac3Util {
* Returns the AC-3 format given {@code data} containing the AC3SpecificBox according to
* ETSI TS 102 366 Annex F.
*/
public
static
MediaFormat
parseAnnexFAc3Format
(
ParsableByteArray
data
)
{
public
static
MediaFormat
parseAnnexFAc3Format
(
ParsableByteArray
data
,
long
durationUs
)
{
// fscod (sample rate code)
int
fscod
=
(
data
.
readUnsignedByte
()
&
0xC0
)
>>
6
;
int
sampleRate
=
SAMPLE_RATES
[
fscod
];
...
...
@@ -49,14 +49,14 @@ public final class Ac3Util {
channelCount
++;
}
return
MediaFormat
.
createAudioFormat
(
MimeTypes
.
AUDIO_AC3
,
MediaFormat
.
NO_VALUE
,
MediaFormat
.
NO_VALUE
,
channelCount
,
sampleRate
,
null
);
MediaFormat
.
NO_VALUE
,
durationUs
,
channelCount
,
sampleRate
,
null
);
}
/**
* Returns the AC-3 format given {@code data} containing the EC3SpecificBox according to
* ETSI TS 102 366 Annex F.
*/
public
static
MediaFormat
parseAnnexFEAc3Format
(
ParsableByteArray
data
)
{
public
static
MediaFormat
parseAnnexFEAc3Format
(
ParsableByteArray
data
,
long
durationUs
)
{
data
.
skipBytes
(
2
);
// Skip data_rate and num_ind_sub.
// Read only the first substream.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment