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
0be3451c
authored
Jan 31, 2020
by
olly
Committed by
Oliver Woodman
Feb 03, 2020
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Change Format.createImageSampleFormat for common use case
PiperOrigin-RevId: 292570360
parent
a7c6cb4a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
29 deletions
library/common/src/main/java/com/google/android/exoplayer2/Format.java
library/extractor/src/main/java/com/google/android/exoplayer2/extractor/mkv/MatroskaExtractor.java
library/extractor/src/main/java/com/google/android/exoplayer2/extractor/ts/DvbSubtitleReader.java
library/common/src/main/java/com/google/android/exoplayer2/Format.java
View file @
0be3451c
...
...
@@ -664,25 +664,22 @@ public final class Format implements Parcelable {
public
static
Format
createImageSampleFormat
(
@Nullable
String
id
,
@Nullable
String
sampleMimeType
,
@Nullable
String
codecs
,
int
bitrate
,
@C
.
SelectionFlags
int
selectionFlags
,
@Nullable
List
<
byte
[]>
initializationData
,
@Nullable
String
language
,
@Nullable
DrmInitData
drmInitData
)
{
@Nullable
String
language
)
{
return
new
Format
(
id
,
/* label= */
null
,
selectionFlags
,
/* roleFlags= */
0
,
bitrate
,
codecs
,
/* bitrate= */
NO_VALUE
,
/* codecs= */
null
,
/* metadata=*/
null
,
/* containerMimeType= */
null
,
sampleMimeType
,
/* maxInputSize= */
NO_VALUE
,
initializationData
,
drmInitData
,
/* drmInitData= */
null
,
OFFSET_SAMPLE_RELATIVE
,
/* width= */
NO_VALUE
,
/* height= */
NO_VALUE
,
...
...
@@ -890,9 +887,8 @@ public final class Format implements Parcelable {
this
.
width
=
width
;
this
.
height
=
height
;
this
.
frameRate
=
frameRate
;
this
.
rotationDegrees
=
rotationDegrees
==
Format
.
NO_VALUE
?
0
:
rotationDegrees
;
this
.
pixelWidthHeightRatio
=
pixelWidthHeightRatio
==
Format
.
NO_VALUE
?
1
:
pixelWidthHeightRatio
;
this
.
rotationDegrees
=
rotationDegrees
==
NO_VALUE
?
0
:
rotationDegrees
;
this
.
pixelWidthHeightRatio
=
pixelWidthHeightRatio
==
NO_VALUE
?
1
:
pixelWidthHeightRatio
;
this
.
projectionData
=
projectionData
;
this
.
stereoMode
=
stereoMode
;
this
.
colorInfo
=
colorInfo
;
...
...
@@ -900,8 +896,8 @@ public final class Format implements Parcelable {
this
.
channelCount
=
channelCount
;
this
.
sampleRate
=
sampleRate
;
this
.
pcmEncoding
=
pcmEncoding
;
this
.
encoderDelay
=
encoderDelay
==
Format
.
NO_VALUE
?
0
:
encoderDelay
;
this
.
encoderPadding
=
encoderPadding
==
Format
.
NO_VALUE
?
0
:
encoderPadding
;
this
.
encoderDelay
=
encoderDelay
==
NO_VALUE
?
0
:
encoderDelay
;
this
.
encoderPadding
=
encoderPadding
==
NO_VALUE
?
0
:
encoderPadding
;
// Audio and text specific.
this
.
language
=
Util
.
normalizeLanguageCode
(
language
);
this
.
accessibilityChannel
=
accessibilityChannel
;
...
...
@@ -1584,22 +1580,22 @@ public final class Format implements Parcelable {
}
StringBuilder
builder
=
new
StringBuilder
();
builder
.
append
(
"id="
).
append
(
format
.
id
).
append
(
", mimeType="
).
append
(
format
.
sampleMimeType
);
if
(
format
.
bitrate
!=
Format
.
NO_VALUE
)
{
if
(
format
.
bitrate
!=
NO_VALUE
)
{
builder
.
append
(
", bitrate="
).
append
(
format
.
bitrate
);
}
if
(
format
.
codecs
!=
null
)
{
builder
.
append
(
", codecs="
).
append
(
format
.
codecs
);
}
if
(
format
.
width
!=
Format
.
NO_VALUE
&&
format
.
height
!=
Format
.
NO_VALUE
)
{
if
(
format
.
width
!=
NO_VALUE
&&
format
.
height
!=
NO_VALUE
)
{
builder
.
append
(
", res="
).
append
(
format
.
width
).
append
(
"x"
).
append
(
format
.
height
);
}
if
(
format
.
frameRate
!=
Format
.
NO_VALUE
)
{
if
(
format
.
frameRate
!=
NO_VALUE
)
{
builder
.
append
(
", fps="
).
append
(
format
.
frameRate
);
}
if
(
format
.
channelCount
!=
Format
.
NO_VALUE
)
{
if
(
format
.
channelCount
!=
NO_VALUE
)
{
builder
.
append
(
", channels="
).
append
(
format
.
channelCount
);
}
if
(
format
.
sampleRate
!=
Format
.
NO_VALUE
)
{
if
(
format
.
sampleRate
!=
NO_VALUE
)
{
builder
.
append
(
", sample_rate="
).
append
(
format
.
sampleRate
);
}
if
(
format
.
language
!=
null
)
{
...
...
library/extractor/src/main/java/com/google/android/exoplayer2/extractor/mkv/MatroskaExtractor.java
View file @
0be3451c
...
...
@@ -2152,14 +2152,12 @@ public class MatroskaExtractor implements Extractor {
type
=
C
.
TRACK_TYPE_TEXT
;
format
=
Format
.
createImageSampleFormat
(
Integer
.
toString
(
trackId
),
mimeType
,
null
,
Format
.
NO_VALUE
,
selectionFlags
,
initializationData
,
language
,
drmInitData
);
Integer
.
toString
(
trackId
),
mimeType
,
selectionFlags
,
initializationData
,
language
)
.
copyWithDrmInitData
(
drmInitData
);
}
else
{
throw
new
ParserException
(
"Unexpected MIME type."
);
}
...
...
library/extractor/src/main/java/com/google/android/exoplayer2/extractor/ts/DvbSubtitleReader.java
View file @
0be3451c
...
...
@@ -64,12 +64,9 @@ public final class DvbSubtitleReader implements ElementaryStreamReader {
Format
.
createImageSampleFormat
(
idGenerator
.
getFormatId
(),
MimeTypes
.
APPLICATION_DVBSUBS
,
/* codecs= */
null
,
Format
.
NO_VALUE
,
/* selectionFlags= */
0
,
Collections
.
singletonList
(
subtitleInfo
.
initializationData
),
subtitleInfo
.
language
,
/* drmInitData= */
null
));
subtitleInfo
.
language
));
outputs
[
i
]
=
output
;
}
}
...
...
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