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
b3277c66
authored
Jul 28, 2014
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add language to Format (+other misc fix).
parent
bb5cfd52
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
9 deletions
library/src/main/java/com/google/android/exoplayer/MediaCodecTrackRenderer.java
library/src/main/java/com/google/android/exoplayer/chunk/Format.java
library/src/main/java/com/google/android/exoplayer/dash/mpd/MediaPresentationDescriptionParser.java
library/src/main/java/com/google/android/exoplayer/MediaCodecTrackRenderer.java
View file @
b3277c66
...
...
@@ -280,14 +280,20 @@ public abstract class MediaCodecTrackRenderer extends TrackRenderer {
@Override
protected
void
onDisabled
()
{
releaseCodec
();
format
=
null
;
drmInitData
=
null
;
if
(
openedDrmSession
)
{
drmSessionManager
.
close
();
openedDrmSession
=
false
;
try
{
releaseCodec
();
}
finally
{
try
{
if
(
openedDrmSession
)
{
drmSessionManager
.
close
();
openedDrmSession
=
false
;
}
}
finally
{
source
.
disable
(
trackIndex
);
}
}
source
.
disable
(
trackIndex
);
}
protected
void
releaseCodec
()
{
...
...
library/src/main/java/com/google/android/exoplayer/chunk/Format.java
View file @
b3277c66
...
...
@@ -72,6 +72,14 @@ public class Format {
public
final
int
bitrate
;
/**
* The language of the format. Can be null if unknown.
* <p>
* The language codes are two-letter lowercase ISO language codes (such as "en") as defined by
* ISO 639-1.
*/
public
final
String
language
;
/**
* The average bandwidth in bytes per second.
*
* @deprecated Use {@link #bitrate}. However note that the units of measurement are different.
...
...
@@ -90,6 +98,21 @@ 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
);
}
/**
* @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.
*/
public
Format
(
String
id
,
String
mimeType
,
int
width
,
int
height
,
int
numChannels
,
int
audioSamplingRate
,
int
bitrate
,
String
language
)
{
this
.
id
=
Assertions
.
checkNotNull
(
id
);
this
.
mimeType
=
mimeType
;
this
.
width
=
width
;
...
...
@@ -97,6 +120,7 @@ public class Format {
this
.
numChannels
=
numChannels
;
this
.
audioSamplingRate
=
audioSamplingRate
;
this
.
bitrate
=
bitrate
;
this
.
language
=
language
;
this
.
bandwidth
=
bitrate
/
8
;
}
...
...
library/src/main/java/com/google/android/exoplayer/dash/mpd/MediaPresentationDescriptionParser.java
View file @
b3277c66
...
...
@@ -140,6 +140,7 @@ public class MediaPresentationDescriptionParser extends DefaultHandler {
throws
XmlPullParserException
,
IOException
{
String
mimeType
=
xpp
.
getAttributeValue
(
null
,
"mimeType"
);
String
language
=
xpp
.
getAttributeValue
(
null
,
"lang"
);
int
contentType
=
parseAdaptationSetTypeFromMimeType
(
mimeType
);
int
id
=
-
1
;
...
...
@@ -160,7 +161,7 @@ public class MediaPresentationDescriptionParser extends DefaultHandler {
parseAdaptationSetType
(
xpp
.
getAttributeValue
(
null
,
"contentType"
)));
}
else
if
(
isStartTag
(
xpp
,
"Representation"
))
{
Representation
representation
=
parseRepresentation
(
xpp
,
contentId
,
baseUrl
,
periodStartMs
,
periodDurationMs
,
mimeType
,
segmentBase
);
periodDurationMs
,
mimeType
,
language
,
segmentBase
);
contentType
=
checkAdaptationSetTypeConsistency
(
contentType
,
parseAdaptationSetTypeFromMimeType
(
representation
.
format
.
mimeType
));
representations
.
add
(
representation
);
...
...
@@ -230,8 +231,8 @@ public class MediaPresentationDescriptionParser extends DefaultHandler {
// Representation parsing.
private
Representation
parseRepresentation
(
XmlPullParser
xpp
,
String
contentId
,
Uri
baseUrl
,
long
periodStartMs
,
long
periodDurationMs
,
String
mimeType
,
S
egmentBase
segmentBase
)
throws
XmlPullParserException
,
IOException
{
long
periodStartMs
,
long
periodDurationMs
,
String
mimeType
,
S
tring
language
,
SegmentBase
segmentBase
)
throws
XmlPullParserException
,
IOException
{
String
id
=
xpp
.
getAttributeValue
(
null
,
"id"
);
int
bandwidth
=
parseInt
(
xpp
,
"bandwidth"
);
int
audioSamplingRate
=
parseInt
(
xpp
,
"audioSamplingRate"
);
...
...
@@ -257,7 +258,7 @@ public class MediaPresentationDescriptionParser extends DefaultHandler {
}
while
(!
isEndTag
(
xpp
,
"Representation"
));
Format
format
=
new
Format
(
id
,
mimeType
,
width
,
height
,
numChannels
,
audioSamplingRate
,
bandwidth
);
bandwidth
,
language
);
return
Representation
.
newInstance
(
periodStartMs
,
periodDurationMs
,
contentId
,
-
1
,
format
,
segmentBase
);
}
...
...
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