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
ded12062
authored
Apr 13, 2023
by
rohks
Committed by
Rohit Singh
Apr 13, 2023
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Update `colr` box values to be overridden by bitstream boxes
#minor-release PiperOrigin-RevId: 523983688
parent
4a02c5ff
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
39 deletions
library/extractor/src/main/java/com/google/android/exoplayer2/extractor/mp4/AtomParsers.java
library/extractor/src/main/java/com/google/android/exoplayer2/extractor/mp4/AtomParsers.java
View file @
ded12062
...
@@ -1208,15 +1208,9 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
...
@@ -1208,15 +1208,9 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
pixelWidthHeightRatio
=
hevcConfig
.
pixelWidthHeightRatio
;
pixelWidthHeightRatio
=
hevcConfig
.
pixelWidthHeightRatio
;
}
}
codecs
=
hevcConfig
.
codecs
;
codecs
=
hevcConfig
.
codecs
;
// Modify these values only if they have not already been set. If 'Atom.TYPE_colr' atom is
colorSpace
=
hevcConfig
.
colorSpace
;
// present, these values may be overridden.
colorRange
=
hevcConfig
.
colorRange
;
if
(
colorSpace
==
Format
.
NO_VALUE
colorTransfer
=
hevcConfig
.
colorTransfer
;
&&
colorRange
==
Format
.
NO_VALUE
&&
colorTransfer
==
Format
.
NO_VALUE
)
{
colorSpace
=
hevcConfig
.
colorSpace
;
colorRange
=
hevcConfig
.
colorRange
;
colorTransfer
=
hevcConfig
.
colorTransfer
;
}
}
else
if
(
childAtomType
==
Atom
.
TYPE_dvcC
||
childAtomType
==
Atom
.
TYPE_dvvC
)
{
}
else
if
(
childAtomType
==
Atom
.
TYPE_dvcC
||
childAtomType
==
Atom
.
TYPE_dvvC
)
{
@Nullable
DolbyVisionConfig
dolbyVisionConfig
=
DolbyVisionConfig
.
parse
(
parent
);
@Nullable
DolbyVisionConfig
dolbyVisionConfig
=
DolbyVisionConfig
.
parse
(
parent
);
if
(
dolbyVisionConfig
!=
null
)
{
if
(
dolbyVisionConfig
!=
null
)
{
...
@@ -1232,16 +1226,10 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
...
@@ -1232,16 +1226,10 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
boolean
fullRangeFlag
=
(
parent
.
readUnsignedByte
()
&
1
)
!=
0
;
boolean
fullRangeFlag
=
(
parent
.
readUnsignedByte
()
&
1
)
!=
0
;
int
colorPrimaries
=
parent
.
readUnsignedByte
();
int
colorPrimaries
=
parent
.
readUnsignedByte
();
int
transferCharacteristics
=
parent
.
readUnsignedByte
();
int
transferCharacteristics
=
parent
.
readUnsignedByte
();
// Modify these values only if they have not already been set. If 'Atom.TYPE_colr' atom is
colorSpace
=
ColorInfo
.
isoColorPrimariesToColorSpace
(
colorPrimaries
);
// present, these values may be overridden.
colorRange
=
fullRangeFlag
?
C
.
COLOR_RANGE_FULL
:
C
.
COLOR_RANGE_LIMITED
;
if
(
colorSpace
==
Format
.
NO_VALUE
colorTransfer
=
&&
colorRange
==
Format
.
NO_VALUE
ColorInfo
.
isoTransferCharacteristicsToColorTransfer
(
transferCharacteristics
);
&&
colorTransfer
==
Format
.
NO_VALUE
)
{
colorSpace
=
ColorInfo
.
isoColorPrimariesToColorSpace
(
colorPrimaries
);
colorRange
=
fullRangeFlag
?
C
.
COLOR_RANGE_FULL
:
C
.
COLOR_RANGE_LIMITED
;
colorTransfer
=
ColorInfo
.
isoTransferCharacteristicsToColorTransfer
(
transferCharacteristics
);
}
}
else
if
(
childAtomType
==
Atom
.
TYPE_av1C
)
{
}
else
if
(
childAtomType
==
Atom
.
TYPE_av1C
)
{
ExtractorUtil
.
checkContainerInput
(
mimeType
==
null
,
/* message= */
null
);
ExtractorUtil
.
checkContainerInput
(
mimeType
==
null
,
/* message= */
null
);
mimeType
=
MimeTypes
.
VIDEO_AV1
;
mimeType
=
MimeTypes
.
VIDEO_AV1
;
...
@@ -1321,26 +1309,33 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
...
@@ -1321,26 +1309,33 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
}
}
}
}
}
else
if
(
childAtomType
==
Atom
.
TYPE_colr
)
{
}
else
if
(
childAtomType
==
Atom
.
TYPE_colr
)
{
int
colorType
=
parent
.
readInt
();
// Only modify these values if they have not been previously established by the bitstream.
if
(
colorType
==
TYPE_nclx
||
colorType
==
TYPE_nclc
)
{
// If 'Atom.TYPE_hvcC' atom or 'Atom.TYPE_vpcC' is available, they will take precedence and
// For more info on syntax, see Section 8.5.2.2 in ISO/IEC 14496-12:2012(E) and
// overwrite any existing values.
// https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap3/qtff3.html.
if
(
colorSpace
==
Format
.
NO_VALUE
int
colorPrimaries
=
parent
.
readUnsignedShort
();
&&
colorRange
==
Format
.
NO_VALUE
int
transferCharacteristics
=
parent
.
readUnsignedShort
();
&&
colorTransfer
==
Format
.
NO_VALUE
)
{
parent
.
skipBytes
(
2
);
// matrix_coefficients.
int
colorType
=
parent
.
readInt
();
if
(
colorType
==
TYPE_nclx
||
colorType
==
TYPE_nclc
)
{
// Only try and read full_range_flag if the box is long enough. It should be present in
// For more info on syntax, see Section 8.5.2.2 in ISO/IEC 14496-12:2012(E) and
// all colr boxes with type=nclx (Section 8.5.2.2 in ISO/IEC 14496-12:2012(E)) but some
// https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap3/qtff3.html.
// device cameras record videos with type=nclx without this final flag (and therefore
int
colorPrimaries
=
parent
.
readUnsignedShort
();
// size=18): https://github.com/google/ExoPlayer/issues/9332
int
transferCharacteristics
=
parent
.
readUnsignedShort
();
boolean
fullRangeFlag
=
parent
.
skipBytes
(
2
);
// matrix_coefficients.
childAtomSize
==
19
&&
(
parent
.
readUnsignedByte
()
&
0b10000000
)
!=
0
;
colorSpace
=
ColorInfo
.
isoColorPrimariesToColorSpace
(
colorPrimaries
);
// Only try and read full_range_flag if the box is long enough. It should be present in
colorRange
=
fullRangeFlag
?
C
.
COLOR_RANGE_FULL
:
C
.
COLOR_RANGE_LIMITED
;
// all colr boxes with type=nclx (Section 8.5.2.2 in ISO/IEC 14496-12:2012(E)) but some
colorTransfer
=
// device cameras record videos with type=nclx without this final flag (and therefore
ColorInfo
.
isoTransferCharacteristicsToColorTransfer
(
transferCharacteristics
);
// size=18): https://github.com/google/ExoPlayer/issues/9332
}
else
{
boolean
fullRangeFlag
=
Log
.
w
(
TAG
,
"Unsupported color type: "
+
Atom
.
getAtomTypeString
(
colorType
));
childAtomSize
==
19
&&
(
parent
.
readUnsignedByte
()
&
0b10000000
)
!=
0
;
colorSpace
=
ColorInfo
.
isoColorPrimariesToColorSpace
(
colorPrimaries
);
colorRange
=
fullRangeFlag
?
C
.
COLOR_RANGE_FULL
:
C
.
COLOR_RANGE_LIMITED
;
colorTransfer
=
ColorInfo
.
isoTransferCharacteristicsToColorTransfer
(
transferCharacteristics
);
}
else
{
Log
.
w
(
TAG
,
"Unsupported color type: "
+
Atom
.
getAtomTypeString
(
colorType
));
}
}
}
}
}
childPosition
+=
childAtomSize
;
childPosition
+=
childAtomSize
;
...
...
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