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
05a31dfd
authored
Jul 12, 2018
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Format cleanup
parent
41636ada
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
1036 additions
and
271 deletions
extensions/cast/src/main/java/com/google/android/exoplayer2/ext/cast/CastUtils.java
library/core/src/main/java/com/google/android/exoplayer2/Format.java
library/core/src/test/java/com/google/android/exoplayer2/FormatTest.java
library/core/src/test/java/com/google/android/exoplayer2/extractor/rawcc/RawCcExtractorTest.java
library/core/src/test/java/com/google/android/exoplayer2/trackselection/DefaultTrackSelectorTest.java
library/dash/src/main/java/com/google/android/exoplayer2/source/dash/manifest/DashManifestParser.java
library/dash/src/test/java/com/google/android/exoplayer2/source/dash/DashUtilTest.java
library/dash/src/test/java/com/google/android/exoplayer2/source/dash/manifest/RepresentationTest.java
library/hls/src/main/java/com/google/android/exoplayer2/source/hls/playlist/HlsMasterPlaylist.java
library/hls/src/main/java/com/google/android/exoplayer2/source/hls/playlist/HlsPlaylistParser.java
library/smoothstreaming/src/main/java/com/google/android/exoplayer2/source/smoothstreaming/manifest/SsManifestParser.java
library/smoothstreaming/src/test/java/com/google/android/exoplayer2/source/smoothstreaming/manifest/SsManifestTest.java
library/ui/src/main/java/com/google/android/exoplayer2/ui/DefaultTrackNameProvider.java
extensions/cast/src/main/java/com/google/android/exoplayer2/ext/cast/CastUtils.java
View file @
05a31dfd
...
...
@@ -101,8 +101,15 @@ import com.google.android.gms.cast.MediaTrack;
* @return The equivalent {@link Format}.
*/
public
static
Format
mediaTrackToFormat
(
MediaTrack
mediaTrack
)
{
return
Format
.
createContainerFormat
(
mediaTrack
.
getContentId
(),
mediaTrack
.
getContentType
(),
null
,
null
,
Format
.
NO_VALUE
,
0
,
mediaTrack
.
getLanguage
());
return
Format
.
createContainerFormat
(
mediaTrack
.
getContentId
(),
/* label= */
null
,
mediaTrack
.
getContentType
(),
/* sampleMimeType= */
null
,
/* codecs= */
null
,
/* bitrate= */
Format
.
NO_VALUE
,
/* selectionFlags= */
0
,
mediaTrack
.
getLanguage
());
}
private
CastUtils
()
{}
...
...
library/core/src/main/java/com/google/android/exoplayer2/Format.java
View file @
05a31dfd
...
...
@@ -46,6 +46,9 @@ public final class Format implements Parcelable {
/** An identifier for the format, or null if unknown or not applicable. */
public
final
@Nullable
String
id
;
/** The human readable label, or null if unknown or not applicable. */
public
final
@Nullable
String
label
;
/**
* The average bandwidth in bits per second, or {@link #NO_VALUE} if unknown or not applicable.
*/
...
...
@@ -160,11 +163,6 @@ public final class Format implements Parcelable {
public
final
@Nullable
String
language
;
/**
* The label, or null if unknown or not applicable.
*/
public
final
String
label
;
/**
* The Accessibility channel, or {@link #NO_VALUE} if not known or applicable.
*/
public
final
int
accessibilityChannel
;
...
...
@@ -174,6 +172,7 @@ public final class Format implements Parcelable {
// Video.
@Deprecated
public
static
Format
createVideoContainerFormat
(
@Nullable
String
id
,
@Nullable
String
containerMimeType
,
...
...
@@ -185,10 +184,60 @@ public final class Format implements Parcelable {
float
frameRate
,
List
<
byte
[]>
initializationData
,
@C
.
SelectionFlags
int
selectionFlags
)
{
return
new
Format
(
id
,
containerMimeType
,
sampleMimeType
,
codecs
,
bitrate
,
NO_VALUE
,
width
,
height
,
frameRate
,
NO_VALUE
,
NO_VALUE
,
null
,
NO_VALUE
,
null
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
selectionFlags
,
null
,
NO_VALUE
,
OFFSET_SAMPLE_RELATIVE
,
initializationData
,
null
,
null
,
null
);
return
createVideoContainerFormat
(
id
,
/* label= */
null
,
containerMimeType
,
sampleMimeType
,
codecs
,
bitrate
,
width
,
height
,
frameRate
,
initializationData
,
selectionFlags
);
}
public
static
Format
createVideoContainerFormat
(
@Nullable
String
id
,
@Nullable
String
label
,
@Nullable
String
containerMimeType
,
String
sampleMimeType
,
String
codecs
,
int
bitrate
,
int
width
,
int
height
,
float
frameRate
,
List
<
byte
[]>
initializationData
,
@C
.
SelectionFlags
int
selectionFlags
)
{
return
new
Format
(
id
,
label
,
containerMimeType
,
sampleMimeType
,
codecs
,
bitrate
,
/* maxInputSize= */
NO_VALUE
,
width
,
height
,
frameRate
,
/* rotationDegrees= */
NO_VALUE
,
/* pixelWidthHeightRatio= */
NO_VALUE
,
/* projectionData= */
null
,
/* stereoMode= */
NO_VALUE
,
/* colorInfo= */
null
,
/* channelCount= */
NO_VALUE
,
/* sampleRate= */
NO_VALUE
,
/* pcmEncoding= */
NO_VALUE
,
/* encoderDelay= */
NO_VALUE
,
/* encoderPadding= */
NO_VALUE
,
selectionFlags
,
/* language= */
null
,
/* accessibilityChannel= */
NO_VALUE
,
OFFSET_SAMPLE_RELATIVE
,
initializationData
,
/* drmInitData= */
null
,
/* metadata= */
null
);
}
public
static
Format
createVideoSampleFormat
(
...
...
@@ -202,8 +251,19 @@ public final class Format implements Parcelable {
float
frameRate
,
List
<
byte
[]>
initializationData
,
@Nullable
DrmInitData
drmInitData
)
{
return
createVideoSampleFormat
(
id
,
sampleMimeType
,
codecs
,
bitrate
,
maxInputSize
,
width
,
height
,
frameRate
,
initializationData
,
NO_VALUE
,
NO_VALUE
,
drmInitData
);
return
createVideoSampleFormat
(
id
,
sampleMimeType
,
codecs
,
bitrate
,
maxInputSize
,
width
,
height
,
frameRate
,
initializationData
,
/* rotationDegrees= */
NO_VALUE
,
/* pixelWidthHeightRatio= */
NO_VALUE
,
drmInitData
);
}
public
static
Format
createVideoSampleFormat
(
...
...
@@ -219,9 +279,22 @@ public final class Format implements Parcelable {
int
rotationDegrees
,
float
pixelWidthHeightRatio
,
@Nullable
DrmInitData
drmInitData
)
{
return
createVideoSampleFormat
(
id
,
sampleMimeType
,
codecs
,
bitrate
,
maxInputSize
,
width
,
height
,
frameRate
,
initializationData
,
rotationDegrees
,
pixelWidthHeightRatio
,
null
,
NO_VALUE
,
null
,
drmInitData
);
return
createVideoSampleFormat
(
id
,
sampleMimeType
,
codecs
,
bitrate
,
maxInputSize
,
width
,
height
,
frameRate
,
initializationData
,
rotationDegrees
,
pixelWidthHeightRatio
,
/* projectionData= */
null
,
/* stereoMode= */
NO_VALUE
,
/* colorInfo= */
null
,
drmInitData
);
}
public
static
Format
createVideoSampleFormat
(
...
...
@@ -240,14 +313,39 @@ public final class Format implements Parcelable {
@C
.
StereoMode
int
stereoMode
,
@Nullable
ColorInfo
colorInfo
,
@Nullable
DrmInitData
drmInitData
)
{
return
new
Format
(
id
,
null
,
sampleMimeType
,
codecs
,
bitrate
,
maxInputSize
,
width
,
height
,
frameRate
,
rotationDegrees
,
pixelWidthHeightRatio
,
projectionData
,
stereoMode
,
colorInfo
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
0
,
null
,
NO_VALUE
,
OFFSET_SAMPLE_RELATIVE
,
initializationData
,
drmInitData
,
null
,
null
);
return
new
Format
(
id
,
/* label= */
null
,
/* containerMimeType= */
null
,
sampleMimeType
,
codecs
,
bitrate
,
maxInputSize
,
width
,
height
,
frameRate
,
rotationDegrees
,
pixelWidthHeightRatio
,
projectionData
,
stereoMode
,
colorInfo
,
/* channelCount= */
NO_VALUE
,
/* sampleRate= */
NO_VALUE
,
/* pcmEncoding= */
NO_VALUE
,
/* encoderDelay= */
NO_VALUE
,
/* encoderPadding= */
NO_VALUE
,
/* selectionFlags= */
0
,
/* language= */
null
,
/* accessibilityChannel= */
NO_VALUE
,
OFFSET_SAMPLE_RELATIVE
,
initializationData
,
drmInitData
,
/* metadata= */
null
);
}
// Audio.
@Deprecated
public
static
Format
createAudioContainerFormat
(
@Nullable
String
id
,
@Nullable
String
containerMimeType
,
...
...
@@ -258,12 +356,61 @@ public final class Format implements Parcelable {
int
sampleRate
,
List
<
byte
[]>
initializationData
,
@C
.
SelectionFlags
int
selectionFlags
,
@Nullable
String
language
,
@Nullable
String
label
)
{
return
new
Format
(
id
,
containerMimeType
,
sampleMimeType
,
codecs
,
bitrate
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
null
,
NO_VALUE
,
null
,
channelCount
,
sampleRate
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
selectionFlags
,
language
,
NO_VALUE
,
OFFSET_SAMPLE_RELATIVE
,
initializationData
,
null
,
null
,
label
);
@Nullable
String
language
)
{
return
createAudioContainerFormat
(
id
,
/* label= */
null
,
containerMimeType
,
sampleMimeType
,
codecs
,
bitrate
,
channelCount
,
sampleRate
,
initializationData
,
selectionFlags
,
language
);
}
public
static
Format
createAudioContainerFormat
(
@Nullable
String
id
,
@Nullable
String
label
,
@Nullable
String
containerMimeType
,
@Nullable
String
sampleMimeType
,
@Nullable
String
codecs
,
int
bitrate
,
int
channelCount
,
int
sampleRate
,
List
<
byte
[]>
initializationData
,
@C
.
SelectionFlags
int
selectionFlags
,
@Nullable
String
language
)
{
return
new
Format
(
id
,
label
,
containerMimeType
,
sampleMimeType
,
codecs
,
bitrate
,
/* maxInputSize= */
NO_VALUE
,
/* width= */
NO_VALUE
,
/* height= */
NO_VALUE
,
/* frameRate= */
NO_VALUE
,
/* rotationDegrees= */
NO_VALUE
,
/* pixelWidthHeightRatio= */
NO_VALUE
,
/* projectionData= */
null
,
/* stereoMode= */
NO_VALUE
,
/* colorInfo= */
null
,
channelCount
,
sampleRate
,
/* pcmEncoding= */
NO_VALUE
,
/* encoderDelay= */
NO_VALUE
,
/* encoderPadding= */
NO_VALUE
,
selectionFlags
,
language
,
/* accessibilityChannel= */
NO_VALUE
,
OFFSET_SAMPLE_RELATIVE
,
initializationData
,
/* drmInitData= */
null
,
/* metadata= */
null
);
}
public
static
Format
createAudioSampleFormat
(
...
...
@@ -278,8 +425,19 @@ public final class Format implements Parcelable {
@Nullable
DrmInitData
drmInitData
,
@C
.
SelectionFlags
int
selectionFlags
,
@Nullable
String
language
)
{
return
createAudioSampleFormat
(
id
,
sampleMimeType
,
codecs
,
bitrate
,
maxInputSize
,
channelCount
,
sampleRate
,
NO_VALUE
,
initializationData
,
drmInitData
,
selectionFlags
,
language
);
return
createAudioSampleFormat
(
id
,
sampleMimeType
,
codecs
,
bitrate
,
maxInputSize
,
channelCount
,
sampleRate
,
/* pcmEncoding= */
NO_VALUE
,
initializationData
,
drmInitData
,
selectionFlags
,
language
);
}
public
static
Format
createAudioSampleFormat
(
...
...
@@ -295,9 +453,22 @@ public final class Format implements Parcelable {
@Nullable
DrmInitData
drmInitData
,
@C
.
SelectionFlags
int
selectionFlags
,
@Nullable
String
language
)
{
return
createAudioSampleFormat
(
id
,
sampleMimeType
,
codecs
,
bitrate
,
maxInputSize
,
channelCount
,
sampleRate
,
pcmEncoding
,
NO_VALUE
,
NO_VALUE
,
initializationData
,
drmInitData
,
selectionFlags
,
language
,
null
);
return
createAudioSampleFormat
(
id
,
sampleMimeType
,
codecs
,
bitrate
,
maxInputSize
,
channelCount
,
sampleRate
,
pcmEncoding
,
/* encoderDelay= */
NO_VALUE
,
/* encoderPadding= */
NO_VALUE
,
initializationData
,
drmInitData
,
selectionFlags
,
language
,
/* metadata= */
null
);
}
public
static
Format
createAudioSampleFormat
(
...
...
@@ -316,14 +487,39 @@ public final class Format implements Parcelable {
@C
.
SelectionFlags
int
selectionFlags
,
@Nullable
String
language
,
@Nullable
Metadata
metadata
)
{
return
new
Format
(
id
,
null
,
sampleMimeType
,
codecs
,
bitrate
,
maxInputSize
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
null
,
NO_VALUE
,
null
,
channelCount
,
sampleRate
,
pcmEncoding
,
encoderDelay
,
encoderPadding
,
selectionFlags
,
language
,
NO_VALUE
,
OFFSET_SAMPLE_RELATIVE
,
initializationData
,
drmInitData
,
metadata
,
null
);
return
new
Format
(
id
,
/* label= */
null
,
/* containerMimeType= */
null
,
sampleMimeType
,
codecs
,
bitrate
,
maxInputSize
,
/* width= */
NO_VALUE
,
/* height= */
NO_VALUE
,
/* frameRate= */
NO_VALUE
,
/* rotationDegrees= */
NO_VALUE
,
/* pixelWidthHeightRatio= */
NO_VALUE
,
/* projectionData= */
null
,
/* stereoMode= */
NO_VALUE
,
/* colorInfo= */
null
,
channelCount
,
sampleRate
,
pcmEncoding
,
encoderDelay
,
encoderPadding
,
selectionFlags
,
language
,
/* accessibilityChannel= */
NO_VALUE
,
OFFSET_SAMPLE_RELATIVE
,
initializationData
,
drmInitData
,
metadata
);
}
// Text.
@Deprecated
public
static
Format
createTextContainerFormat
(
@Nullable
String
id
,
@Nullable
String
containerMimeType
,
...
...
@@ -331,27 +527,77 @@ public final class Format implements Parcelable {
@Nullable
String
codecs
,
int
bitrate
,
@C
.
SelectionFlags
int
selectionFlags
,
@Nullable
String
language
,
@Nullable
String
label
)
{
return
createTextContainerFormat
(
id
,
containerMimeType
,
sampleMimeType
,
codecs
,
bitrate
,
selectionFlags
,
language
,
NO_VALUE
,
label
);
@Nullable
String
language
)
{
return
createTextContainerFormat
(
id
,
/* label= */
null
,
containerMimeType
,
sampleMimeType
,
codecs
,
bitrate
,
selectionFlags
,
language
);
}
public
static
Format
createTextContainerFormat
(
@Nullable
String
id
,
@Nullable
String
label
,
@Nullable
String
containerMimeType
,
@Nullable
String
sampleMimeType
,
@Nullable
String
codecs
,
int
bitrate
,
@C
.
SelectionFlags
int
selectionFlags
,
@Nullable
String
language
)
{
return
createTextContainerFormat
(
id
,
label
,
containerMimeType
,
sampleMimeType
,
codecs
,
bitrate
,
selectionFlags
,
language
,
/* accessibilityChannel= */
NO_VALUE
);
}
public
static
Format
createTextContainerFormat
(
@Nullable
String
id
,
@Nullable
String
label
,
@Nullable
String
containerMimeType
,
@Nullable
String
sampleMimeType
,
@Nullable
String
codecs
,
int
bitrate
,
@C
.
SelectionFlags
int
selectionFlags
,
@Nullable
String
language
,
int
accessibilityChannel
,
@Nullable
String
label
)
{
return
new
Format
(
id
,
containerMimeType
,
sampleMimeType
,
codecs
,
bitrate
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
null
,
NO_VALUE
,
null
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
selectionFlags
,
language
,
accessibilityChannel
,
OFFSET_SAMPLE_RELATIVE
,
null
,
null
,
null
,
label
);
int
accessibilityChannel
)
{
return
new
Format
(
id
,
label
,
containerMimeType
,
sampleMimeType
,
codecs
,
bitrate
,
/* maxInputSize= */
NO_VALUE
,
/* width= */
NO_VALUE
,
/* height= */
NO_VALUE
,
/* frameRate= */
NO_VALUE
,
/* rotationDegrees= */
NO_VALUE
,
/* pixelWidthHeightRatio= */
NO_VALUE
,
/* projectionData= */
null
,
/* stereoMode= */
NO_VALUE
,
/* colorInfo= */
null
,
/* channelCount= */
NO_VALUE
,
/* sampleRate= */
NO_VALUE
,
/* pcmEncoding= */
NO_VALUE
,
/* encoderDelay= */
NO_VALUE
,
/* encoderPadding= */
NO_VALUE
,
selectionFlags
,
language
,
accessibilityChannel
,
OFFSET_SAMPLE_RELATIVE
,
/* initializationData= */
null
,
/* drmInitData= */
null
,
/* metadata= */
null
);
}
public
static
Format
createTextSampleFormat
(
...
...
@@ -368,8 +614,17 @@ public final class Format implements Parcelable {
@C
.
SelectionFlags
int
selectionFlags
,
@Nullable
String
language
,
@Nullable
DrmInitData
drmInitData
)
{
return
createTextSampleFormat
(
id
,
sampleMimeType
,
null
,
NO_VALUE
,
selectionFlags
,
language
,
NO_VALUE
,
drmInitData
,
OFFSET_SAMPLE_RELATIVE
,
Collections
.<
byte
[]>
emptyList
());
return
createTextSampleFormat
(
id
,
sampleMimeType
,
/* codecs= */
null
,
/* bitrate= */
NO_VALUE
,
selectionFlags
,
language
,
NO_VALUE
,
drmInitData
,
OFFSET_SAMPLE_RELATIVE
,
Collections
.
emptyList
());
}
public
static
Format
createTextSampleFormat
(
...
...
@@ -381,8 +636,17 @@ public final class Format implements Parcelable {
@Nullable
String
language
,
int
accessibilityChannel
,
@Nullable
DrmInitData
drmInitData
)
{
return
createTextSampleFormat
(
id
,
sampleMimeType
,
codecs
,
bitrate
,
selectionFlags
,
language
,
accessibilityChannel
,
drmInitData
,
OFFSET_SAMPLE_RELATIVE
,
Collections
.<
byte
[]>
emptyList
());
return
createTextSampleFormat
(
id
,
sampleMimeType
,
codecs
,
bitrate
,
selectionFlags
,
language
,
accessibilityChannel
,
drmInitData
,
OFFSET_SAMPLE_RELATIVE
,
Collections
.
emptyList
());
}
public
static
Format
createTextSampleFormat
(
...
...
@@ -394,8 +658,17 @@ public final class Format implements Parcelable {
@Nullable
String
language
,
@Nullable
DrmInitData
drmInitData
,
long
subsampleOffsetUs
)
{
return
createTextSampleFormat
(
id
,
sampleMimeType
,
codecs
,
bitrate
,
selectionFlags
,
language
,
NO_VALUE
,
drmInitData
,
subsampleOffsetUs
,
Collections
.<
byte
[]>
emptyList
());
return
createTextSampleFormat
(
id
,
sampleMimeType
,
codecs
,
bitrate
,
selectionFlags
,
language
,
/* accessibilityChannel= */
NO_VALUE
,
drmInitData
,
subsampleOffsetUs
,
Collections
.
emptyList
());
}
public
static
Format
createTextSampleFormat
(
...
...
@@ -409,10 +682,34 @@ public final class Format implements Parcelable {
@Nullable
DrmInitData
drmInitData
,
long
subsampleOffsetUs
,
List
<
byte
[]>
initializationData
)
{
return
new
Format
(
id
,
null
,
sampleMimeType
,
codecs
,
bitrate
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
null
,
NO_VALUE
,
null
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
selectionFlags
,
language
,
accessibilityChannel
,
subsampleOffsetUs
,
initializationData
,
drmInitData
,
null
,
null
);
return
new
Format
(
id
,
/* label= */
null
,
/* containerMimeType= */
null
,
sampleMimeType
,
codecs
,
bitrate
,
/* maxInputSize= */
NO_VALUE
,
/* width= */
NO_VALUE
,
/* height= */
NO_VALUE
,
/* frameRate= */
NO_VALUE
,
/* rotationDegrees= */
NO_VALUE
,
/* pixelWidthHeightRatio= */
NO_VALUE
,
/* projectionData= */
null
,
/* stereoMode= */
NO_VALUE
,
/* colorInfo= */
null
,
/* channelCount= */
NO_VALUE
,
/* sampleRate= */
NO_VALUE
,
/* pcmEncoding= */
NO_VALUE
,
/* encoderDelay= */
NO_VALUE
,
/* encoderPadding= */
NO_VALUE
,
selectionFlags
,
language
,
accessibilityChannel
,
subsampleOffsetUs
,
initializationData
,
drmInitData
,
/* metadata= */
null
);
}
// Image.
...
...
@@ -428,55 +725,125 @@ public final class Format implements Parcelable {
@Nullable
DrmInitData
drmInitData
)
{
return
new
Format
(
id
,
null
,
/* label= */
null
,
/* containerMimeType= */
null
,
sampleMimeType
,
codecs
,
bitrate
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
null
,
NO_VALUE
,
null
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
/* maxInputSize= */
NO_VALUE
,
/* width= */
NO_VALUE
,
/* height= */
NO_VALUE
,
/* frameRate= */
NO_VALUE
,
/* rotationDegrees= */
NO_VALUE
,
/* pixelWidthHeightRatio= */
NO_VALUE
,
/* projectionData= */
null
,
/* stereoMode= */
NO_VALUE
,
/* colorInfo= */
null
,
/* channelCount= */
NO_VALUE
,
/* sampleRate= */
NO_VALUE
,
/* pcmEncoding= */
NO_VALUE
,
/* encoderDelay= */
NO_VALUE
,
/* encoderPadding= */
NO_VALUE
,
selectionFlags
,
language
,
NO_VALUE
,
/* accessibilityChannel= */
NO_VALUE
,
OFFSET_SAMPLE_RELATIVE
,
initializationData
,
drmInitData
,
null
,
null
);
/* metadata=*/
null
);
}
// Generic.
@Deprecated
public
static
Format
createContainerFormat
(
@Nullable
String
id
,
@Nullable
String
containerMimeType
,
@Nullable
String
sampleMimeType
,
@Nullable
String
codecs
,
int
bitrate
,
@C
.
SelectionFlags
int
selectionFlags
,
@Nullable
String
language
)
{
return
createContainerFormat
(
id
,
/* label= */
null
,
containerMimeType
,
sampleMimeType
,
codecs
,
bitrate
,
selectionFlags
,
language
);
}
public
static
Format
createContainerFormat
(
@Nullable
String
id
,
@Nullable
String
label
,
@Nullable
String
containerMimeType
,
@Nullable
String
sampleMimeType
,
@Nullable
String
codecs
,
int
bitrate
,
@C
.
SelectionFlags
int
selectionFlags
,
@Nullable
String
language
)
{
return
new
Format
(
id
,
containerMimeType
,
sampleMimeType
,
codecs
,
bitrate
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
null
,
NO_VALUE
,
null
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
selectionFlags
,
language
,
NO_VALUE
,
OFFSET_SAMPLE_RELATIVE
,
null
,
null
,
null
,
null
);
return
new
Format
(
id
,
label
,
containerMimeType
,
sampleMimeType
,
codecs
,
bitrate
,
/* maxInputSize= */
NO_VALUE
,
/* width= */
NO_VALUE
,
/* height= */
NO_VALUE
,
/* frameRate= */
NO_VALUE
,
/* rotationDegrees= */
NO_VALUE
,
/* pixelWidthHeightRatio= */
NO_VALUE
,
/* projectionData= */
null
,
/* stereoMode= */
NO_VALUE
,
/* colorInfo= */
null
,
/* channelCount= */
NO_VALUE
,
/* sampleRate= */
NO_VALUE
,
/* pcmEncoding= */
NO_VALUE
,
/* encoderDelay= */
NO_VALUE
,
/* encoderPadding= */
NO_VALUE
,
selectionFlags
,
language
,
/* accessibilityChannel= */
NO_VALUE
,
OFFSET_SAMPLE_RELATIVE
,
/* initializationData= */
null
,
/* drmInitData= */
null
,
/* metadata= */
null
);
}
public
static
Format
createSampleFormat
(
@Nullable
String
id
,
@Nullable
String
sampleMimeType
,
long
subsampleOffsetUs
)
{
return
new
Format
(
id
,
null
,
sampleMimeType
,
null
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
null
,
NO_VALUE
,
null
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
0
,
null
,
NO_VALUE
,
subsampleOffsetUs
,
null
,
null
,
null
,
null
);
return
new
Format
(
id
,
/* label= */
null
,
/* containerMimeType= */
null
,
sampleMimeType
,
/* codecs= */
null
,
/* bitrate= */
NO_VALUE
,
/* maxInputSize= */
NO_VALUE
,
/* width= */
NO_VALUE
,
/* height= */
NO_VALUE
,
/* frameRate= */
NO_VALUE
,
/* rotationDegrees= */
NO_VALUE
,
/* pixelWidthHeightRatio= */
NO_VALUE
,
/* projectionData= */
null
,
/* stereoMode= */
NO_VALUE
,
/* colorInfo= */
null
,
/* channelCount= */
NO_VALUE
,
/* sampleRate= */
NO_VALUE
,
/* pcmEncoding= */
NO_VALUE
,
/* encoderDelay= */
NO_VALUE
,
/* encoderPadding= */
NO_VALUE
,
/* selectionFlags= */
0
,
/* language= */
null
,
/* accessibilityChannel= */
NO_VALUE
,
subsampleOffsetUs
,
/* initializationData= */
null
,
/* drmInitData= */
null
,
/* metadata= */
null
);
}
public
static
Format
createSampleFormat
(
...
...
@@ -485,13 +852,39 @@ public final class Format implements Parcelable {
@Nullable
String
codecs
,
int
bitrate
,
@Nullable
DrmInitData
drmInitData
)
{
return
new
Format
(
id
,
null
,
sampleMimeType
,
codecs
,
bitrate
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
null
,
NO_VALUE
,
null
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
0
,
null
,
NO_VALUE
,
OFFSET_SAMPLE_RELATIVE
,
null
,
drmInitData
,
null
,
null
);
return
new
Format
(
id
,
/* label= */
null
,
/* containerMimeType= */
null
,
sampleMimeType
,
codecs
,
bitrate
,
/* maxInputSize= */
NO_VALUE
,
/* width= */
NO_VALUE
,
/* height= */
NO_VALUE
,
/* frameRate= */
NO_VALUE
,
/* rotationDegrees= */
NO_VALUE
,
/* pixelWidthHeightRatio= */
NO_VALUE
,
/* projectionData= */
null
,
/* stereoMode= */
NO_VALUE
,
/* colorInfo= */
null
,
/* channelCount= */
NO_VALUE
,
/* sampleRate= */
NO_VALUE
,
/* pcmEncoding= */
NO_VALUE
,
/* encoderDelay= */
NO_VALUE
,
/* encoderPadding= */
NO_VALUE
,
/* selectionFlags= */
0
,
/* language= */
null
,
/* accessibilityChannel= */
NO_VALUE
,
OFFSET_SAMPLE_RELATIVE
,
/* initializationData= */
null
,
drmInitData
,
/* metadata= */
null
);
}
/* package */
Format
(
@Nullable
String
id
,
@Nullable
String
label
,
@Nullable
String
containerMimeType
,
@Nullable
String
sampleMimeType
,
@Nullable
String
codecs
,
...
...
@@ -516,10 +909,9 @@ public final class Format implements Parcelable {
long
subsampleOffsetUs
,
@Nullable
List
<
byte
[]>
initializationData
,
@Nullable
DrmInitData
drmInitData
,
@Nullable
Metadata
metadata
,
@Nullable
String
label
)
{
@Nullable
Metadata
metadata
)
{
this
.
id
=
id
;
this
.
label
=
label
;
this
.
containerMimeType
=
containerMimeType
;
this
.
sampleMimeType
=
sampleMimeType
;
this
.
codecs
=
codecs
;
...
...
@@ -541,7 +933,6 @@ public final class Format implements Parcelable {
this
.
encoderPadding
=
encoderPadding
==
Format
.
NO_VALUE
?
0
:
encoderPadding
;
this
.
selectionFlags
=
selectionFlags
;
this
.
language
=
language
;
this
.
label
=
label
;
this
.
accessibilityChannel
=
accessibilityChannel
;
this
.
subsampleOffsetUs
=
subsampleOffsetUs
;
this
.
initializationData
=
initializationData
==
null
?
Collections
.<
byte
[]>
emptyList
()
...
...
@@ -553,6 +944,7 @@ public final class Format implements Parcelable {
@SuppressWarnings
(
"ResourceType"
)
/* package */
Format
(
Parcel
in
)
{
id
=
in
.
readString
();
label
=
in
.
readString
();
containerMimeType
=
in
.
readString
();
sampleMimeType
=
in
.
readString
();
codecs
=
in
.
readString
();
...
...
@@ -574,7 +966,6 @@ public final class Format implements Parcelable {
encoderPadding
=
in
.
readInt
();
selectionFlags
=
in
.
readInt
();
language
=
in
.
readString
();
label
=
in
.
readString
();
accessibilityChannel
=
in
.
readInt
();
subsampleOffsetUs
=
in
.
readLong
();
int
initializationDataSize
=
in
.
readInt
();
...
...
@@ -587,19 +978,65 @@ public final class Format implements Parcelable {
}
public
Format
copyWithMaxInputSize
(
int
maxInputSize
)
{
return
new
Format
(
id
,
containerMimeType
,
sampleMimeType
,
codecs
,
bitrate
,
maxInputSize
,
width
,
height
,
frameRate
,
rotationDegrees
,
pixelWidthHeightRatio
,
projectionData
,
stereoMode
,
colorInfo
,
channelCount
,
sampleRate
,
pcmEncoding
,
encoderDelay
,
encoderPadding
,
selectionFlags
,
language
,
accessibilityChannel
,
subsampleOffsetUs
,
initializationData
,
drmInitData
,
metadata
,
label
);
return
new
Format
(
id
,
label
,
containerMimeType
,
sampleMimeType
,
codecs
,
bitrate
,
maxInputSize
,
width
,
height
,
frameRate
,
rotationDegrees
,
pixelWidthHeightRatio
,
projectionData
,
stereoMode
,
colorInfo
,
channelCount
,
sampleRate
,
pcmEncoding
,
encoderDelay
,
encoderPadding
,
selectionFlags
,
language
,
accessibilityChannel
,
subsampleOffsetUs
,
initializationData
,
drmInitData
,
metadata
);
}
public
Format
copyWithSubsampleOffsetUs
(
long
subsampleOffsetUs
)
{
return
new
Format
(
id
,
containerMimeType
,
sampleMimeType
,
codecs
,
bitrate
,
maxInputSize
,
width
,
height
,
frameRate
,
rotationDegrees
,
pixelWidthHeightRatio
,
projectionData
,
stereoMode
,
colorInfo
,
channelCount
,
sampleRate
,
pcmEncoding
,
encoderDelay
,
encoderPadding
,
selectionFlags
,
language
,
accessibilityChannel
,
subsampleOffsetUs
,
initializationData
,
drmInitData
,
metadata
,
label
);
return
new
Format
(
id
,
label
,
containerMimeType
,
sampleMimeType
,
codecs
,
bitrate
,
maxInputSize
,
width
,
height
,
frameRate
,
rotationDegrees
,
pixelWidthHeightRatio
,
projectionData
,
stereoMode
,
colorInfo
,
channelCount
,
sampleRate
,
pcmEncoding
,
encoderDelay
,
encoderPadding
,
selectionFlags
,
language
,
accessibilityChannel
,
subsampleOffsetUs
,
initializationData
,
drmInitData
,
metadata
);
}
public
Format
copyWithContainerInfo
(
...
...
@@ -611,11 +1048,34 @@ public final class Format implements Parcelable {
int
height
,
@C
.
SelectionFlags
int
selectionFlags
,
@Nullable
String
language
)
{
return
new
Format
(
id
,
containerMimeType
,
sampleMimeType
,
codecs
,
bitrate
,
maxInputSize
,
width
,
height
,
frameRate
,
rotationDegrees
,
pixelWidthHeightRatio
,
projectionData
,
stereoMode
,
colorInfo
,
channelCount
,
sampleRate
,
pcmEncoding
,
encoderDelay
,
encoderPadding
,
selectionFlags
,
language
,
accessibilityChannel
,
subsampleOffsetUs
,
initializationData
,
drmInitData
,
metadata
,
label
);
return
new
Format
(
id
,
label
,
containerMimeType
,
sampleMimeType
,
codecs
,
bitrate
,
maxInputSize
,
width
,
height
,
frameRate
,
rotationDegrees
,
pixelWidthHeightRatio
,
projectionData
,
stereoMode
,
colorInfo
,
channelCount
,
sampleRate
,
pcmEncoding
,
encoderDelay
,
encoderPadding
,
selectionFlags
,
language
,
accessibilityChannel
,
subsampleOffsetUs
,
initializationData
,
drmInitData
,
metadata
);
}
@SuppressWarnings
(
"ReferenceEquality"
)
...
...
@@ -631,45 +1091,160 @@ public final class Format implements Parcelable {
@C
.
SelectionFlags
int
selectionFlags
=
this
.
selectionFlags
|
manifestFormat
.
selectionFlags
;
String
language
=
this
.
language
==
null
?
manifestFormat
.
language
:
this
.
language
;
String
label
=
this
.
label
==
null
?
manifestFormat
.
label
:
this
.
label
;
DrmInitData
drmInitData
=
DrmInitData
.
createSessionCreationData
(
manifestFormat
.
drmInitData
,
this
.
drmInitData
);
return
new
Format
(
id
,
containerMimeType
,
sampleMimeType
,
codecs
,
bitrate
,
maxInputSize
,
width
,
height
,
frameRate
,
rotationDegrees
,
pixelWidthHeightRatio
,
projectionData
,
stereoMode
,
colorInfo
,
channelCount
,
sampleRate
,
pcmEncoding
,
encoderDelay
,
encoderPadding
,
selectionFlags
,
language
,
accessibilityChannel
,
subsampleOffsetUs
,
initializationData
,
drmInitData
,
metadata
,
label
);
DrmInitData
drmInitData
=
DrmInitData
.
createSessionCreationData
(
manifestFormat
.
drmInitData
,
this
.
drmInitData
);
return
new
Format
(
id
,
label
,
containerMimeType
,
sampleMimeType
,
codecs
,
bitrate
,
maxInputSize
,
width
,
height
,
frameRate
,
rotationDegrees
,
pixelWidthHeightRatio
,
projectionData
,
stereoMode
,
colorInfo
,
channelCount
,
sampleRate
,
pcmEncoding
,
encoderDelay
,
encoderPadding
,
selectionFlags
,
language
,
accessibilityChannel
,
subsampleOffsetUs
,
initializationData
,
drmInitData
,
metadata
);
}
public
Format
copyWithGaplessInfo
(
int
encoderDelay
,
int
encoderPadding
)
{
return
new
Format
(
id
,
containerMimeType
,
sampleMimeType
,
codecs
,
bitrate
,
maxInputSize
,
width
,
height
,
frameRate
,
rotationDegrees
,
pixelWidthHeightRatio
,
projectionData
,
stereoMode
,
colorInfo
,
channelCount
,
sampleRate
,
pcmEncoding
,
encoderDelay
,
encoderPadding
,
selectionFlags
,
language
,
accessibilityChannel
,
subsampleOffsetUs
,
initializationData
,
drmInitData
,
metadata
,
label
);
return
new
Format
(
id
,
label
,
containerMimeType
,
sampleMimeType
,
codecs
,
bitrate
,
maxInputSize
,
width
,
height
,
frameRate
,
rotationDegrees
,
pixelWidthHeightRatio
,
projectionData
,
stereoMode
,
colorInfo
,
channelCount
,
sampleRate
,
pcmEncoding
,
encoderDelay
,
encoderPadding
,
selectionFlags
,
language
,
accessibilityChannel
,
subsampleOffsetUs
,
initializationData
,
drmInitData
,
metadata
);
}
public
Format
copyWithDrmInitData
(
@Nullable
DrmInitData
drmInitData
)
{
return
new
Format
(
id
,
containerMimeType
,
sampleMimeType
,
codecs
,
bitrate
,
maxInputSize
,
width
,
height
,
frameRate
,
rotationDegrees
,
pixelWidthHeightRatio
,
projectionData
,
stereoMode
,
colorInfo
,
channelCount
,
sampleRate
,
pcmEncoding
,
encoderDelay
,
encoderPadding
,
selectionFlags
,
language
,
accessibilityChannel
,
subsampleOffsetUs
,
initializationData
,
drmInitData
,
metadata
,
label
);
return
new
Format
(
id
,
label
,
containerMimeType
,
sampleMimeType
,
codecs
,
bitrate
,
maxInputSize
,
width
,
height
,
frameRate
,
rotationDegrees
,
pixelWidthHeightRatio
,
projectionData
,
stereoMode
,
colorInfo
,
channelCount
,
sampleRate
,
pcmEncoding
,
encoderDelay
,
encoderPadding
,
selectionFlags
,
language
,
accessibilityChannel
,
subsampleOffsetUs
,
initializationData
,
drmInitData
,
metadata
);
}
public
Format
copyWithMetadata
(
@Nullable
Metadata
metadata
)
{
return
new
Format
(
id
,
containerMimeType
,
sampleMimeType
,
codecs
,
bitrate
,
maxInputSize
,
width
,
height
,
frameRate
,
rotationDegrees
,
pixelWidthHeightRatio
,
projectionData
,
stereoMode
,
colorInfo
,
channelCount
,
sampleRate
,
pcmEncoding
,
encoderDelay
,
encoderPadding
,
selectionFlags
,
language
,
accessibilityChannel
,
subsampleOffsetUs
,
initializationData
,
drmInitData
,
metadata
,
label
);
return
new
Format
(
id
,
label
,
containerMimeType
,
sampleMimeType
,
codecs
,
bitrate
,
maxInputSize
,
width
,
height
,
frameRate
,
rotationDegrees
,
pixelWidthHeightRatio
,
projectionData
,
stereoMode
,
colorInfo
,
channelCount
,
sampleRate
,
pcmEncoding
,
encoderDelay
,
encoderPadding
,
selectionFlags
,
language
,
accessibilityChannel
,
subsampleOffsetUs
,
initializationData
,
drmInitData
,
metadata
);
}
public
Format
copyWithRotationDegrees
(
int
rotationDegrees
)
{
return
new
Format
(
id
,
containerMimeType
,
sampleMimeType
,
codecs
,
bitrate
,
maxInputSize
,
width
,
height
,
frameRate
,
rotationDegrees
,
pixelWidthHeightRatio
,
projectionData
,
stereoMode
,
colorInfo
,
channelCount
,
sampleRate
,
pcmEncoding
,
encoderDelay
,
encoderPadding
,
selectionFlags
,
language
,
accessibilityChannel
,
subsampleOffsetUs
,
initializationData
,
drmInitData
,
metadata
,
label
);
return
new
Format
(
id
,
label
,
containerMimeType
,
sampleMimeType
,
codecs
,
bitrate
,
maxInputSize
,
width
,
height
,
frameRate
,
rotationDegrees
,
pixelWidthHeightRatio
,
projectionData
,
stereoMode
,
colorInfo
,
channelCount
,
sampleRate
,
pcmEncoding
,
encoderDelay
,
encoderPadding
,
selectionFlags
,
language
,
accessibilityChannel
,
subsampleOffsetUs
,
initializationData
,
drmInitData
,
metadata
);
}
/**
...
...
@@ -682,9 +1257,30 @@ public final class Format implements Parcelable {
@Override
public
String
toString
()
{
return
"Format("
+
id
+
", "
+
containerMimeType
+
", "
+
sampleMimeType
+
", "
+
bitrate
+
", "
+
language
+
", ["
+
width
+
", "
+
height
+
", "
+
frameRate
+
"]"
+
", ["
+
channelCount
+
", "
+
sampleRate
+
"])"
;
return
"Format("
+
id
+
", "
+
label
+
", "
+
containerMimeType
+
", "
+
sampleMimeType
+
", "
+
bitrate
+
", "
+
language
+
", ["
+
width
+
", "
+
height
+
", "
+
frameRate
+
"]"
+
", ["
+
channelCount
+
", "
+
sampleRate
+
"])"
;
}
@Override
...
...
@@ -734,6 +1330,7 @@ public final class Format implements Parcelable {
&&
subsampleOffsetUs
==
other
.
subsampleOffsetUs
&&
selectionFlags
==
other
.
selectionFlags
&&
Util
.
areEqual
(
id
,
other
.
id
)
&&
Util
.
areEqual
(
label
,
other
.
label
)
&&
Util
.
areEqual
(
language
,
other
.
language
)
&&
accessibilityChannel
==
other
.
accessibilityChannel
&&
Util
.
areEqual
(
containerMimeType
,
other
.
containerMimeType
)
...
...
@@ -811,6 +1408,7 @@ public final class Format implements Parcelable {
@Override
public
void
writeToParcel
(
Parcel
dest
,
int
flags
)
{
dest
.
writeString
(
id
);
dest
.
writeString
(
label
);
dest
.
writeString
(
containerMimeType
);
dest
.
writeString
(
sampleMimeType
);
dest
.
writeString
(
codecs
);
...
...
library/core/src/test/java/com/google/android/exoplayer2/FormatTest.java
View file @
05a31dfd
...
...
@@ -64,10 +64,35 @@ public final class FormatTest {
ColorInfo
colorInfo
=
new
ColorInfo
(
C
.
COLOR_SPACE_BT709
,
C
.
COLOR_RANGE_LIMITED
,
C
.
COLOR_TRANSFER_SDR
,
new
byte
[]
{
1
,
2
,
3
,
4
,
5
,
6
,
7
});
Format
formatToParcel
=
new
Format
(
"id"
,
MimeTypes
.
VIDEO_MP4
,
MimeTypes
.
VIDEO_H264
,
null
,
1024
,
2048
,
1920
,
1080
,
24
,
90
,
2
,
projectionData
,
C
.
STEREO_MODE_TOP_BOTTOM
,
colorInfo
,
6
,
44100
,
C
.
ENCODING_PCM_24BIT
,
1001
,
1002
,
0
,
"und"
,
Format
.
NO_VALUE
,
Format
.
OFFSET_SAMPLE_RELATIVE
,
INIT_DATA
,
drmInitData
,
metadata
);
Format
formatToParcel
=
new
Format
(
"id"
,
"label"
,
/* containerMimeType= */
MimeTypes
.
VIDEO_MP4
,
/* sampleMimeType= */
MimeTypes
.
VIDEO_H264
,
"codec"
,
/* bitrate= */
1024
,
/* maxInputSize= */
2048
,
/* width= */
1920
,
/* height= */
1080
,
/* frameRate= */
24
,
/* rotationDegrees= */
90
,
/* pixelWidthHeightRatio= */
2
,
projectionData
,
C
.
STEREO_MODE_TOP_BOTTOM
,
colorInfo
,
/* channelCount= */
6
,
/* sampleRate= */
44100
,
C
.
ENCODING_PCM_24BIT
,
/* encoderDelay= */
1001
,
/* encoderPadding= */
1002
,
C
.
SELECTION_FLAG_DEFAULT
,
"language"
,
/* accessibilityChannel= */
Format
.
NO_VALUE
,
Format
.
OFFSET_SAMPLE_RELATIVE
,
INIT_DATA
,
drmInitData
,
metadata
);
Parcel
parcel
=
Parcel
.
obtain
();
formatToParcel
.
writeToParcel
(
parcel
,
0
);
...
...
library/core/src/test/java/com/google/android/exoplayer2/extractor/rawcc/RawCcExtractorTest.java
View file @
05a31dfd
...
...
@@ -38,14 +38,15 @@ public final class RawCcExtractorTest {
public
Extractor
create
()
{
return
new
RawCcExtractor
(
Format
.
createTextContainerFormat
(
null
,
null
,
MimeTypes
.
APPLICATION_CEA608
,
"cea608"
,
Format
.
NO_VALUE
,
0
,
null
,
1
));
/* id= */
null
,
/* label= */
null
,
/* containerMimeType= */
null
,
/* sampleMimeType= */
MimeTypes
.
APPLICATION_CEA608
,
/* codecs= */
"cea608"
,
/* bitrate= */
Format
.
NO_VALUE
,
/* selectionFlags= */
0
,
/* language= */
null
,
/* accessibilityChannel= */
1
));
}
},
"rawcc/sample.rawcc"
);
...
...
library/core/src/test/java/com/google/android/exoplayer2/trackselection/DefaultTrackSelectorTest.java
View file @
05a31dfd
...
...
@@ -759,45 +759,12 @@ public final class DefaultTrackSelectorTest {
/** Tests text track selection flags. */
@Test
public
void
testsTextTrackSelectionFlags
()
throws
ExoPlaybackException
{
Format
forcedOnly
=
Format
.
createTextContainerFormat
(
"forcedOnly"
,
null
,
MimeTypes
.
TEXT_VTT
,
null
,
Format
.
NO_VALUE
,
C
.
SELECTION_FLAG_FORCED
,
"eng"
);
Format
forcedOnly
=
buildTextFormat
(
"forcedOnly"
,
"eng"
,
C
.
SELECTION_FLAG_FORCED
);
Format
forcedDefault
=
Format
.
createTextContainerFormat
(
"forcedDefault"
,
null
,
MimeTypes
.
TEXT_VTT
,
null
,
Format
.
NO_VALUE
,
C
.
SELECTION_FLAG_FORCED
|
C
.
SELECTION_FLAG_DEFAULT
,
"eng"
);
Format
defaultOnly
=
Format
.
createTextContainerFormat
(
"defaultOnly"
,
null
,
MimeTypes
.
TEXT_VTT
,
null
,
Format
.
NO_VALUE
,
C
.
SELECTION_FLAG_DEFAULT
,
"eng"
);
Format
forcedOnlySpanish
=
Format
.
createTextContainerFormat
(
"forcedOnlySpanish"
,
null
,
MimeTypes
.
TEXT_VTT
,
null
,
Format
.
NO_VALUE
,
C
.
SELECTION_FLAG_FORCED
,
"spa"
);
Format
noFlag
=
Format
.
createTextContainerFormat
(
"noFlag"
,
null
,
MimeTypes
.
TEXT_VTT
,
null
,
Format
.
NO_VALUE
,
0
,
"eng"
);
buildTextFormat
(
"forcedDefault"
,
"eng"
,
C
.
SELECTION_FLAG_FORCED
|
C
.
SELECTION_FLAG_DEFAULT
);
Format
defaultOnly
=
buildTextFormat
(
"defaultOnly"
,
"eng"
,
C
.
SELECTION_FLAG_DEFAULT
);
Format
forcedOnlySpanish
=
buildTextFormat
(
"forcedOnlySpanish"
,
"spa"
,
C
.
SELECTION_FLAG_FORCED
);
Format
noFlag
=
buildTextFormat
(
"noFlag"
,
"eng"
);
RendererCapabilities
[]
textRendererCapabilities
=
new
RendererCapabilities
[]
{
ALL_TEXT_FORMAT_SUPPORTED_RENDERER_CAPABILITIES
};
...
...
@@ -891,14 +858,10 @@ public final class DefaultTrackSelectorTest {
*/
@Test
public
void
testSelectUndeterminedTextLanguageAsFallback
()
throws
ExoPlaybackException
{
Format
spanish
=
Format
.
createTextContainerFormat
(
"spanish"
,
null
,
MimeTypes
.
TEXT_VTT
,
null
,
Format
.
NO_VALUE
,
0
,
"spa"
);
Format
german
=
Format
.
createTextContainerFormat
(
"german"
,
null
,
MimeTypes
.
TEXT_VTT
,
null
,
Format
.
NO_VALUE
,
0
,
"de"
);
Format
undeterminedUnd
=
Format
.
createTextContainerFormat
(
"undeterminedUnd"
,
null
,
MimeTypes
.
TEXT_VTT
,
null
,
Format
.
NO_VALUE
,
0
,
"und"
);
Format
undeterminedNull
=
Format
.
createTextContainerFormat
(
"undeterminedNull"
,
null
,
MimeTypes
.
TEXT_VTT
,
null
,
Format
.
NO_VALUE
,
0
,
null
);
Format
spanish
=
buildTextFormat
(
"spanish"
,
"spa"
);
Format
german
=
buildTextFormat
(
"german"
,
"de"
);
Format
undeterminedUnd
=
buildTextFormat
(
"undeterminedUnd"
,
"und"
);
Format
undeterminedNull
=
buildTextFormat
(
"undeterminedNull"
,
null
);
RendererCapabilities
[]
textRendererCapabilites
=
new
RendererCapabilities
[]
{
ALL_TEXT_FORMAT_SUPPORTED_RENDERER_CAPABILITIES
};
...
...
@@ -1090,6 +1053,22 @@ public final class DefaultTrackSelectorTest {
return
new
TrackGroupArray
(
trackGroups
);
}
private
static
Format
buildTextFormat
(
String
id
,
String
language
)
{
return
buildTextFormat
(
id
,
language
,
/* selectionFlags= */
0
);
}
private
static
Format
buildTextFormat
(
String
id
,
String
language
,
int
selectionFlags
)
{
return
Format
.
createTextContainerFormat
(
id
,
/* label= */
null
,
/* containerMimeType= */
null
,
/* sampleMimeType= */
MimeTypes
.
TEXT_VTT
,
/* codecs= */
null
,
/* bitrate= */
Format
.
NO_VALUE
,
selectionFlags
,
language
);
}
/**
* A {@link RendererCapabilities} that advertises support for all formats of a given type using
* a provided support value. For any format that does not have the given track type,
...
...
library/dash/src/main/java/com/google/android/exoplayer2/source/dash/manifest/DashManifestParser.java
View file @
05a31dfd
...
...
@@ -247,8 +247,8 @@ public class DashManifestParser extends DefaultHandler
int
audioChannels
=
Format
.
NO_VALUE
;
int
audioSamplingRate
=
parseInt
(
xpp
,
"audioSamplingRate"
,
Format
.
NO_VALUE
);
String
language
=
xpp
.
getAttributeValue
(
null
,
"lang"
);
String
drmSchemeType
=
null
;
String
label
=
xpp
.
getAttributeValue
(
null
,
"label"
);
String
drmSchemeType
=
null
;
ArrayList
<
SchemeData
>
drmSchemeDatas
=
new
ArrayList
<>();
ArrayList
<
Descriptor
>
inbandEventStreams
=
new
ArrayList
<>();
ArrayList
<
Descriptor
>
accessibilityDescriptors
=
new
ArrayList
<>();
...
...
@@ -284,9 +284,22 @@ public class DashManifestParser extends DefaultHandler
}
else
if
(
XmlPullParserUtil
.
isStartTag
(
xpp
,
"SupplementalProperty"
))
{
supplementalProperties
.
add
(
parseDescriptor
(
xpp
,
"SupplementalProperty"
));
}
else
if
(
XmlPullParserUtil
.
isStartTag
(
xpp
,
"Representation"
))
{
RepresentationInfo
representationInfo
=
parseRepresentation
(
xpp
,
baseUrl
,
mimeType
,
codecs
,
width
,
height
,
frameRate
,
audioChannels
,
audioSamplingRate
,
language
,
selectionFlags
,
accessibilityDescriptors
,
segmentBase
,
label
);
RepresentationInfo
representationInfo
=
parseRepresentation
(
xpp
,
baseUrl
,
label
,
mimeType
,
codecs
,
width
,
height
,
frameRate
,
audioChannels
,
audioSamplingRate
,
language
,
selectionFlags
,
accessibilityDescriptors
,
segmentBase
);
contentType
=
checkContentTypeConsistency
(
contentType
,
getContentType
(
representationInfo
.
format
));
representationInfos
.
add
(
representationInfo
);
...
...
@@ -453,12 +466,21 @@ public class DashManifestParser extends DefaultHandler
// Representation parsing.
protected
RepresentationInfo
parseRepresentation
(
XmlPullParser
xpp
,
String
baseUrl
,
String
adaptationSetMimeType
,
String
adaptationSetCodecs
,
int
adaptationSetWidth
,
int
adaptationSetHeight
,
float
adaptationSetFrameRate
,
int
adaptationSetAudioChannels
,
int
adaptationSetAudioSamplingRate
,
String
adaptationSetLanguage
,
protected
RepresentationInfo
parseRepresentation
(
XmlPullParser
xpp
,
String
baseUrl
,
String
label
,
String
adaptationSetMimeType
,
String
adaptationSetCodecs
,
int
adaptationSetWidth
,
int
adaptationSetHeight
,
float
adaptationSetFrameRate
,
int
adaptationSetAudioChannels
,
int
adaptationSetAudioSamplingRate
,
String
adaptationSetLanguage
,
@C
.
SelectionFlags
int
adaptationSetSelectionFlags
,
List
<
Descriptor
>
adaptationSetAccessibilityDescriptors
,
SegmentBase
segmentBase
,
String
label
)
List
<
Descriptor
>
adaptationSetAccessibilityDescriptors
,
SegmentBase
segmentBase
)
throws
XmlPullParserException
,
IOException
{
String
id
=
xpp
.
getAttributeValue
(
null
,
"id"
);
int
bandwidth
=
parseInt
(
xpp
,
"bandwidth"
,
Format
.
NO_VALUE
);
...
...
@@ -506,30 +528,74 @@ public class DashManifestParser extends DefaultHandler
}
}
while
(!
XmlPullParserUtil
.
isEndTag
(
xpp
,
"Representation"
));
Format
format
=
buildFormat
(
id
,
mimeType
,
width
,
height
,
frameRate
,
audioChannels
,
audioSamplingRate
,
bandwidth
,
adaptationSetLanguage
,
adaptationSetSelectionFlags
,
adaptationSetAccessibilityDescriptors
,
codecs
,
supplementalProperties
,
label
);
Format
format
=
buildFormat
(
id
,
label
,
mimeType
,
width
,
height
,
frameRate
,
audioChannels
,
audioSamplingRate
,
bandwidth
,
adaptationSetLanguage
,
adaptationSetSelectionFlags
,
adaptationSetAccessibilityDescriptors
,
codecs
,
supplementalProperties
);
segmentBase
=
segmentBase
!=
null
?
segmentBase
:
new
SingleSegmentBase
();
return
new
RepresentationInfo
(
format
,
baseUrl
,
segmentBase
,
drmSchemeType
,
drmSchemeDatas
,
inbandEventStreams
,
Representation
.
REVISION_ID_DEFAULT
);
}
protected
Format
buildFormat
(
String
id
,
String
containerMimeType
,
int
width
,
int
height
,
float
frameRate
,
int
audioChannels
,
int
audioSamplingRate
,
int
bitrate
,
String
language
,
@C
.
SelectionFlags
int
selectionFlags
,
List
<
Descriptor
>
accessibilityDescriptors
,
String
codecs
,
List
<
Descriptor
>
supplementalProperties
,
String
label
)
{
protected
Format
buildFormat
(
String
id
,
String
label
,
String
containerMimeType
,
int
width
,
int
height
,
float
frameRate
,
int
audioChannels
,
int
audioSamplingRate
,
int
bitrate
,
String
language
,
@C
.
SelectionFlags
int
selectionFlags
,
List
<
Descriptor
>
accessibilityDescriptors
,
String
codecs
,
List
<
Descriptor
>
supplementalProperties
)
{
String
sampleMimeType
=
getSampleMimeType
(
containerMimeType
,
codecs
);
if
(
sampleMimeType
!=
null
)
{
if
(
MimeTypes
.
AUDIO_E_AC3
.
equals
(
sampleMimeType
))
{
sampleMimeType
=
parseEac3SupplementalProperties
(
supplementalProperties
);
}
if
(
MimeTypes
.
isVideo
(
sampleMimeType
))
{
return
Format
.
createVideoContainerFormat
(
id
,
containerMimeType
,
sampleMimeType
,
codecs
,
bitrate
,
width
,
height
,
frameRate
,
null
,
selectionFlags
);
return
Format
.
createVideoContainerFormat
(
id
,
label
,
containerMimeType
,
sampleMimeType
,
codecs
,
bitrate
,
width
,
height
,
frameRate
,
/* initializationData= */
null
,
selectionFlags
);
}
else
if
(
MimeTypes
.
isAudio
(
sampleMimeType
))
{
return
Format
.
createAudioContainerFormat
(
id
,
containerMimeType
,
sampleMimeType
,
codecs
,
bitrate
,
audioChannels
,
audioSamplingRate
,
null
,
selectionFlags
,
language
,
label
);
return
Format
.
createAudioContainerFormat
(
id
,
label
,
containerMimeType
,
sampleMimeType
,
codecs
,
bitrate
,
audioChannels
,
audioSamplingRate
,
/* initializationData= */
null
,
selectionFlags
,
language
);
}
else
if
(
mimeTypeIsRawText
(
sampleMimeType
))
{
int
accessibilityChannel
;
if
(
MimeTypes
.
APPLICATION_CEA608
.
equals
(
sampleMimeType
))
{
...
...
@@ -539,12 +605,20 @@ public class DashManifestParser extends DefaultHandler
}
else
{
accessibilityChannel
=
Format
.
NO_VALUE
;
}
return
Format
.
createTextContainerFormat
(
id
,
containerMimeType
,
sampleMimeType
,
codecs
,
bitrate
,
selectionFlags
,
language
,
accessibilityChannel
,
label
);
return
Format
.
createTextContainerFormat
(
id
,
label
,
containerMimeType
,
sampleMimeType
,
codecs
,
bitrate
,
selectionFlags
,
language
,
accessibilityChannel
);
}
}
return
Format
.
createContainerFormat
(
id
,
containerMimeType
,
sampleMimeType
,
codecs
,
bitrate
,
selectionFlags
,
language
);
return
Format
.
createContainerFormat
(
id
,
label
,
containerMimeType
,
sampleMimeType
,
codecs
,
bitrate
,
selectionFlags
,
language
);
}
protected
Representation
buildRepresentation
(
RepresentationInfo
representationInfo
,
...
...
library/dash/src/test/java/com/google/android/exoplayer2/source/dash/DashUtilTest.java
View file @
05a31dfd
...
...
@@ -76,15 +76,16 @@ public final class DashUtilTest {
Format
format
=
Format
.
createVideoContainerFormat
(
"id"
,
"label"
,
MimeTypes
.
VIDEO_MP4
,
MimeTypes
.
VIDEO_H264
,
""
,
/* codecs= */
""
,
Format
.
NO_VALUE
,
1024
,
768
,
/* width= */
1024
,
/* height= */
768
,
Format
.
NO_VALUE
,
null
,
0
);
/* initializationData= */
null
,
/* selectionFlags= */
0
);
if
(
drmInitData
!=
null
)
{
format
=
format
.
copyWithDrmInitData
(
drmInitData
);
}
...
...
library/dash/src/test/java/com/google/android/exoplayer2/source/dash/manifest/RepresentationTest.java
View file @
05a31dfd
...
...
@@ -32,37 +32,30 @@ public class RepresentationTest {
public
void
testGetCacheKey
()
{
String
uri
=
"http://www.google.com"
;
SegmentBase
base
=
new
SingleSegmentBase
(
new
RangedUri
(
null
,
0
,
1
),
1
,
0
,
1
,
1
);
Format
format
=
Format
.
createVideoContainerFormat
(
"0"
,
MimeTypes
.
APPLICATION_MP4
,
null
,
MimeTypes
.
VIDEO_H264
,
2500000
,
1920
,
1080
,
Format
.
NO_VALUE
,
null
,
0
);
Format
format
=
createVideoContainerFormat
(
"0"
);
Representation
representation
=
Representation
.
newInstance
(
"test_stream_1"
,
3
,
format
,
uri
,
base
);
assertThat
(
representation
.
getCacheKey
()).
isEqualTo
(
"test_stream_1.0.3"
);
format
=
Format
.
createVideoContainerFormat
(
"150"
,
MimeTypes
.
APPLICATION_MP4
,
null
,
MimeTypes
.
VIDEO_H264
,
2500000
,
1920
,
1080
,
Format
.
NO_VALUE
,
null
,
0
);
format
=
createVideoContainerFormat
(
"150"
);
representation
=
Representation
.
newInstance
(
"test_stream_1"
,
Representation
.
REVISION_ID_DEFAULT
,
format
,
uri
,
base
);
assertThat
(
representation
.
getCacheKey
()).
isEqualTo
(
"test_stream_1.150.-1"
);
}
private
static
Format
createVideoContainerFormat
(
String
id
)
{
return
Format
.
createVideoContainerFormat
(
id
,
"label"
,
/* containerMimeType= */
MimeTypes
.
APPLICATION_MP4
,
/* sampleMimeType= */
MimeTypes
.
VIDEO_H264
,
/* codecs= */
null
,
/* bitrate= */
2500000
,
/* width= */
1920
,
/* height= */
1080
,
/* frameRate= */
Format
.
NO_VALUE
,
/* initializationData= */
null
,
/* selectionFlags= */
0
);
}
}
library/hls/src/main/java/com/google/android/exoplayer2/source/hls/playlist/HlsMasterPlaylist.java
View file @
05a31dfd
...
...
@@ -50,8 +50,16 @@ public final class HlsMasterPlaylist extends HlsPlaylist {
* @return An HLS url.
*/
public
static
HlsUrl
createMediaPlaylistHlsUrl
(
String
url
)
{
Format
format
=
Format
.
createContainerFormat
(
"0"
,
MimeTypes
.
APPLICATION_M3U8
,
null
,
null
,
Format
.
NO_VALUE
,
0
,
null
);
Format
format
=
Format
.
createContainerFormat
(
"0"
,
/* label= */
null
,
MimeTypes
.
APPLICATION_M3U8
,
/* sampleMimeType= */
null
,
/* codecs= */
null
,
/* bitrate= */
Format
.
NO_VALUE
,
/* selectionFlags= */
0
,
/* language= */
null
);
return
new
HlsUrl
(
url
,
format
);
}
...
...
library/hls/src/main/java/com/google/android/exoplayer2/source/hls/playlist/HlsPlaylistParser.java
View file @
05a31dfd
...
...
@@ -274,8 +274,19 @@ public final class HlsPlaylistParser implements ParsingLoadable.Parser<HlsPlayli
}
line
=
iterator
.
next
();
// #EXT-X-STREAM-INF's URI.
if
(
variantUrls
.
add
(
line
))
{
Format
format
=
Format
.
createVideoContainerFormat
(
Integer
.
toString
(
variants
.
size
()),
MimeTypes
.
APPLICATION_M3U8
,
null
,
codecs
,
bitrate
,
width
,
height
,
frameRate
,
null
,
0
);
Format
format
=
Format
.
createVideoContainerFormat
(
/* id= */
Integer
.
toString
(
variants
.
size
()),
/* label= */
null
,
/* containerMimeType= */
MimeTypes
.
APPLICATION_M3U8
,
/* sampleMimeType= */
null
,
codecs
,
bitrate
,
width
,
height
,
frameRate
,
/* initializationData= */
null
,
/* selectionFlags= */
0
);
variants
.
add
(
new
HlsMasterPlaylist
.
HlsUrl
(
line
,
format
));
}
}
...
...
@@ -285,7 +296,7 @@ public final class HlsPlaylistParser implements ParsingLoadable.Parser<HlsPlayli
line
=
mediaTags
.
get
(
i
);
@C
.
SelectionFlags
int
selectionFlags
=
parseSelectionFlags
(
line
);
String
uri
=
parseOptionalStringAttr
(
line
,
REGEX_URI
);
String
id
=
parseStringAttr
(
line
,
REGEX_NAME
);
String
name
=
parseStringAttr
(
line
,
REGEX_NAME
);
String
language
=
parseOptionalStringAttr
(
line
,
REGEX_LANGUAGE
);
String
groupId
=
parseOptionalStringAttr
(
line
,
REGEX_GROUP_ID
);
Format
format
;
...
...
@@ -293,9 +304,19 @@ public final class HlsPlaylistParser implements ParsingLoadable.Parser<HlsPlayli
case
TYPE_AUDIO:
String
codecs
=
audioGroupIdToCodecs
.
get
(
groupId
);
String
sampleMimeType
=
codecs
!=
null
?
MimeTypes
.
getMediaMimeType
(
codecs
)
:
null
;
format
=
Format
.
createAudioContainerFormat
(
id
,
MimeTypes
.
APPLICATION_M3U8
,
sampleMimeType
,
codecs
,
Format
.
NO_VALUE
,
Format
.
NO_VALUE
,
Format
.
NO_VALUE
,
null
,
selectionFlags
,
language
,
id
);
format
=
Format
.
createAudioContainerFormat
(
/* id= */
name
,
/* label= */
name
,
/* containerMimeType= */
MimeTypes
.
APPLICATION_M3U8
,
sampleMimeType
,
codecs
,
/* bitrate= */
Format
.
NO_VALUE
,
/* channelCount= */
Format
.
NO_VALUE
,
/* sampleRate= */
Format
.
NO_VALUE
,
/* initializationData= */
null
,
selectionFlags
,
language
);
if
(
uri
==
null
)
{
muxedAudioFormat
=
format
;
}
else
{
...
...
@@ -303,8 +324,16 @@ public final class HlsPlaylistParser implements ParsingLoadable.Parser<HlsPlayli
}
break
;
case
TYPE_SUBTITLES:
format
=
Format
.
createTextContainerFormat
(
id
,
MimeTypes
.
APPLICATION_M3U8
,
MimeTypes
.
TEXT_VTT
,
null
,
Format
.
NO_VALUE
,
selectionFlags
,
language
,
id
);
format
=
Format
.
createTextContainerFormat
(
/* id= */
name
,
/* label= */
name
,
/* containerMimeType= */
MimeTypes
.
APPLICATION_M3U8
,
/* sampleMimeType= */
MimeTypes
.
TEXT_VTT
,
/* codecs= */
null
,
/* bitrate= */
Format
.
NO_VALUE
,
selectionFlags
,
language
);
subtitles
.
add
(
new
HlsMasterPlaylist
.
HlsUrl
(
uri
,
format
));
break
;
case
TYPE_CLOSED_CAPTIONS:
...
...
@@ -321,8 +350,17 @@ public final class HlsPlaylistParser implements ParsingLoadable.Parser<HlsPlayli
if
(
muxedCaptionFormats
==
null
)
{
muxedCaptionFormats
=
new
ArrayList
<>();
}
muxedCaptionFormats
.
add
(
Format
.
createTextContainerFormat
(
id
,
null
,
mimeType
,
null
,
Format
.
NO_VALUE
,
selectionFlags
,
language
,
accessibilityChannel
,
id
));
muxedCaptionFormats
.
add
(
Format
.
createTextContainerFormat
(
/* id= */
name
,
/* label= */
name
,
/* containerMimeType= */
null
,
/* sampleMimeType= */
mimeType
,
/* codecs= */
null
,
/* bitrate= */
Format
.
NO_VALUE
,
selectionFlags
,
language
,
accessibilityChannel
));
break
;
default
:
// Do nothing.
...
...
library/smoothstreaming/src/main/java/com/google/android/exoplayer2/source/smoothstreaming/manifest/SsManifestParser.java
View file @
05a31dfd
...
...
@@ -617,6 +617,7 @@ public class SsManifestParser implements ParsingLoadable.Parser<SsManifest> {
public
void
parseStartTag
(
XmlPullParser
parser
)
throws
ParserException
{
int
type
=
(
Integer
)
getNormalizedAttribute
(
KEY_TYPE
);
String
id
=
parser
.
getAttributeValue
(
null
,
KEY_INDEX
);
String
name
=
(
String
)
getNormalizedAttribute
(
KEY_NAME
);
int
bitrate
=
parseRequiredInt
(
parser
,
KEY_BITRATE
);
String
sampleMimeType
=
fourCCToMimeType
(
parseRequiredString
(
parser
,
KEY_FOUR_CC
));
...
...
@@ -625,8 +626,19 @@ public class SsManifestParser implements ParsingLoadable.Parser<SsManifest> {
int
height
=
parseRequiredInt
(
parser
,
KEY_MAX_HEIGHT
);
List
<
byte
[]>
codecSpecificData
=
buildCodecSpecificData
(
parser
.
getAttributeValue
(
null
,
KEY_CODEC_PRIVATE_DATA
));
format
=
Format
.
createVideoContainerFormat
(
id
,
MimeTypes
.
VIDEO_MP4
,
sampleMimeType
,
null
,
bitrate
,
width
,
height
,
Format
.
NO_VALUE
,
codecSpecificData
,
0
);
format
=
Format
.
createVideoContainerFormat
(
id
,
name
,
MimeTypes
.
VIDEO_MP4
,
sampleMimeType
,
/* codecs= */
null
,
bitrate
,
width
,
height
,
/* frameRate= */
Format
.
NO_VALUE
,
codecSpecificData
,
/* selectionFlags= */
0
);
}
else
if
(
type
==
C
.
TRACK_TYPE_AUDIO
)
{
sampleMimeType
=
sampleMimeType
==
null
?
MimeTypes
.
AUDIO_AAC
:
sampleMimeType
;
int
channels
=
parseRequiredInt
(
parser
,
KEY_CHANNELS
);
...
...
@@ -638,17 +650,42 @@ public class SsManifestParser implements ParsingLoadable.Parser<SsManifest> {
CodecSpecificDataUtil
.
buildAacLcAudioSpecificConfig
(
samplingRate
,
channels
));
}
String
language
=
(
String
)
getNormalizedAttribute
(
KEY_LANGUAGE
);
String
label
=
(
String
)
getNormalizedAttribute
(
KEY_NAME
);
format
=
Format
.
createAudioContainerFormat
(
id
,
MimeTypes
.
AUDIO_MP4
,
sampleMimeType
,
null
,
bitrate
,
channels
,
samplingRate
,
codecSpecificData
,
0
,
language
,
label
);
format
=
Format
.
createAudioContainerFormat
(
id
,
name
,
MimeTypes
.
AUDIO_MP4
,
sampleMimeType
,
/* codecs= */
null
,
bitrate
,
channels
,
samplingRate
,
codecSpecificData
,
/* selectionFlags= */
0
,
language
);
}
else
if
(
type
==
C
.
TRACK_TYPE_TEXT
)
{
String
language
=
(
String
)
getNormalizedAttribute
(
KEY_LANGUAGE
);
String
label
=
(
String
)
getNormalizedAttribute
(
KEY_NAME
);
format
=
Format
.
createTextContainerFormat
(
id
,
MimeTypes
.
APPLICATION_MP4
,
sampleMimeType
,
null
,
bitrate
,
0
,
language
,
label
);
format
=
Format
.
createTextContainerFormat
(
id
,
name
,
MimeTypes
.
APPLICATION_MP4
,
sampleMimeType
,
/* codecs= */
null
,
bitrate
,
/* selectionFlags= */
0
,
language
);
}
else
{
format
=
Format
.
createContainerFormat
(
id
,
MimeTypes
.
APPLICATION_MP4
,
sampleMimeType
,
null
,
bitrate
,
0
,
null
);
format
=
Format
.
createContainerFormat
(
id
,
name
,
MimeTypes
.
APPLICATION_MP4
,
sampleMimeType
,
/* codecs= */
null
,
bitrate
,
/* selectionFlags= */
0
,
/* language= */
null
);
}
}
...
...
library/smoothstreaming/src/test/java/com/google/android/exoplayer2/source/smoothstreaming/manifest/SsManifestTest.java
View file @
05a31dfd
...
...
@@ -135,6 +135,13 @@ public class SsManifestTest {
private
static
Format
newFormat
(
String
id
)
{
return
Format
.
createContainerFormat
(
id
,
MimeTypes
.
VIDEO_MP4
,
MimeTypes
.
VIDEO_H264
,
null
,
Format
.
NO_VALUE
,
0
,
null
);
id
,
/* label= */
null
,
MimeTypes
.
VIDEO_MP4
,
MimeTypes
.
VIDEO_H264
,
/* codecs= */
null
,
/* bitrate= */
Format
.
NO_VALUE
,
/* selectionFlags= */
0
,
/* language= */
null
);
}
}
library/ui/src/main/java/com/google/android/exoplayer2/ui/DefaultTrackNameProvider.java
View file @
05a31dfd
...
...
@@ -88,9 +88,6 @@ public class DefaultTrackNameProvider implements TrackNameProvider {
}
private
String
buildLanguageString
(
Format
format
)
{
if
(
!
TextUtils
.
isEmpty
(
format
.
label
)
){
return
format
.
label
;
}
String
language
=
format
.
language
;
return
TextUtils
.
isEmpty
(
language
)
||
C
.
LANGUAGE_UNDETERMINED
.
equals
(
language
)
?
""
...
...
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