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
11eb1c22
authored
Dec 15, 2014
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Identify AC-3 tracks by codecs="ac-3", not the MIME type.
parent
595147de
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
10 deletions
demo/src/main/java/com/google/android/exoplayer/demo/full/player/DashRendererBuilder.java
library/src/main/java/com/google/android/exoplayer/Ac3PassthroughAudioTrackRenderer.java
library/src/main/java/com/google/android/exoplayer/chunk/Format.java
library/src/main/java/com/google/android/exoplayer/dash/mpd/MediaPresentationDescriptionParser.java
demo/src/main/java/com/google/android/exoplayer/demo/full/player/DashRendererBuilder.java
View file @
11eb1c22
...
...
@@ -81,6 +81,9 @@ public class DashRendererBuilder implements RendererBuilder,
private
static
final
int
SECURITY_LEVEL_1
=
1
;
private
static
final
int
SECURITY_LEVEL_3
=
3
;
private
static
final
String
AC_3_CODEC
=
"ac-3"
;
private
static
final
String
E_AC_3_CODEC
=
"ec-3"
;
private
final
String
userAgent
;
private
final
String
url
;
private
final
String
contentId
;
...
...
@@ -225,15 +228,13 @@ public class DashRendererBuilder implements RendererBuilder,
format
.
audioSamplingRate
+
"Hz)"
);
audioChunkSourceList
.
add
(
new
DashChunkSource
(
manifestFetcher
,
audioAdaptationSetIndex
,
new
int
[]
{
i
},
audioDataSource
,
audioEvaluator
,
LIVE_EDGE_LATENCY_MS
));
haveAc3Tracks
|=
format
.
mimeType
.
equals
(
MimeTypes
.
AUDIO_AC3
)
||
format
.
mimeType
.
equals
(
MimeTypes
.
AUDIO_EC3
);
haveAc3Tracks
|=
AC_3_CODEC
.
equals
(
format
.
codecs
)
||
E_AC_3_CODEC
.
equals
(
format
.
codecs
);
}
// Filter out non-AC-3 tracks if there is an AC-3 track, to avoid having to switch renderers.
if
(
haveAc3Tracks
)
{
for
(
int
i
=
audioRepresentations
.
size
()
-
1
;
i
>=
0
;
i
--)
{
Format
format
=
audioRepresentations
.
get
(
i
).
format
;
if
(!
format
.
mimeType
.
equals
(
MimeTypes
.
AUDIO_AC3
)
&&
!
format
.
mimeType
.
equals
(
MimeTypes
.
AUDIO_EC3
))
{
if
(!
AC_3_CODEC
.
equals
(
format
.
codecs
)
&&
!
E_AC_3_CODEC
.
equals
(
format
.
codecs
))
{
audioTrackNameList
.
remove
(
i
);
audioChunkSourceList
.
remove
(
i
);
}
...
...
library/src/main/java/com/google/android/exoplayer/Ac3PassthroughAudioTrackRenderer.java
View file @
11eb1c22
...
...
@@ -136,7 +136,7 @@ public final class Ac3PassthroughAudioTrackRenderer extends TrackRenderer {
}
private
static
boolean
handlesMimeType
(
String
mimeType
)
{
return
MimeTypes
.
AUDIO_
AC3
.
equals
(
mimeType
)
||
MimeTypes
.
AUDIO_EC3
.
equals
(
mimeType
);
return
MimeTypes
.
AUDIO_
MP4
.
equals
(
mimeType
);
}
@Override
...
...
library/src/main/java/com/google/android/exoplayer/chunk/Format.java
View file @
11eb1c22
...
...
@@ -47,6 +47,11 @@ public class Format {
public
final
String
mimeType
;
/**
* The codecs used to decode the format, or {@code null} if they are not specified.
*/
public
final
String
codecs
;
/**
* The width of the video in pixels, or -1 for non-video formats.
*/
public
final
int
width
;
...
...
@@ -98,7 +103,7 @@ public class Format {
*/
public
Format
(
String
id
,
String
mimeType
,
int
width
,
int
height
,
int
numChannels
,
int
audioSamplingRate
,
int
bitrate
)
{
this
(
id
,
mimeType
,
width
,
height
,
numChannels
,
audioSamplingRate
,
bitrate
,
null
);
this
(
id
,
mimeType
,
width
,
height
,
numChannels
,
audioSamplingRate
,
bitrate
,
null
,
null
);
}
/**
...
...
@@ -113,6 +118,23 @@ public class Format {
*/
public
Format
(
String
id
,
String
mimeType
,
int
width
,
int
height
,
int
numChannels
,
int
audioSamplingRate
,
int
bitrate
,
String
language
)
{
this
(
id
,
mimeType
,
width
,
height
,
numChannels
,
audioSamplingRate
,
bitrate
,
language
,
null
);
}
/**
* @param id The format identifier.
* @param mimeType The format mime type.
* @param width The width of the video in pixels, or -1 for non-video formats.
* @param height The height of the video in pixels, or -1 for non-video formats.
* @param numChannels The number of audio channels, or -1 for non-audio formats.
* @param audioSamplingRate The audio sampling rate in Hz, or -1 for non-audio formats.
* @param bitrate The average bandwidth of the format in bits per second.
* @param language The language of the format.
* @param codecs The codecs used to decode the format.
*/
public
Format
(
String
id
,
String
mimeType
,
int
width
,
int
height
,
int
numChannels
,
int
audioSamplingRate
,
int
bitrate
,
String
language
,
String
codecs
)
{
this
.
id
=
Assertions
.
checkNotNull
(
id
);
this
.
mimeType
=
mimeType
;
this
.
width
=
width
;
...
...
@@ -121,6 +143,7 @@ public class Format {
this
.
audioSamplingRate
=
audioSamplingRate
;
this
.
bitrate
=
bitrate
;
this
.
language
=
language
;
this
.
codecs
=
codecs
;
this
.
bandwidth
=
bitrate
/
8
;
}
...
...
library/src/main/java/com/google/android/exoplayer/dash/mpd/MediaPresentationDescriptionParser.java
View file @
11eb1c22
...
...
@@ -283,6 +283,7 @@ public class MediaPresentationDescriptionParser extends DefaultHandler
int
width
=
parseInt
(
xpp
,
"width"
);
int
height
=
parseInt
(
xpp
,
"height"
);
mimeType
=
parseString
(
xpp
,
"mimeType"
,
mimeType
);
String
codecs
=
parseString
(
xpp
,
"codecs"
,
null
);
int
numChannels
=
-
1
;
do
{
...
...
@@ -302,15 +303,15 @@ public class MediaPresentationDescriptionParser extends DefaultHandler
}
while
(!
isEndTag
(
xpp
,
"Representation"
));
Format
format
=
buildFormat
(
id
,
mimeType
,
width
,
height
,
numChannels
,
audioSamplingRate
,
bandwidth
,
language
);
bandwidth
,
language
,
codecs
);
return
buildRepresentation
(
periodStartMs
,
periodDurationMs
,
contentId
,
-
1
,
format
,
segmentBase
);
}
protected
Format
buildFormat
(
String
id
,
String
mimeType
,
int
width
,
int
height
,
int
numChannels
,
int
audioSamplingRate
,
int
bandwidth
,
String
language
)
{
return
new
Format
(
id
,
mimeType
,
width
,
height
,
numChannels
,
audioSamplingRate
,
bandwidth
,
language
);
int
audioSamplingRate
,
int
bandwidth
,
String
language
,
String
codecs
)
{
return
new
Format
(
id
,
mimeType
,
width
,
height
,
numChannels
,
audioSamplingRate
,
bandwidth
,
language
,
codecs
);
}
protected
Representation
buildRepresentation
(
long
periodStartMs
,
long
periodDurationMs
,
...
...
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