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
a0fe3b29
authored
Apr 21, 2023
by
claincly
Committed by
Rohit Singh
Apr 24, 2023
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Allow customizing VideoFrameProcessor input and output colors in MCVR.
PiperOrigin-RevId: 526081541
parent
bb0c4a46
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
16 deletions
libraries/exoplayer/src/main/java/androidx/media3/exoplayer/video/MediaCodecVideoRenderer.java
libraries/exoplayer/src/main/java/androidx/media3/exoplayer/video/MediaCodecVideoRenderer.java
View file @
a0fe3b29
...
...
@@ -1510,6 +1510,28 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
}
/**
* Returns a {@link Pair} of {@linkplain ColorInfo input color} and {@linkplain ColorInfo output
* color} to configure the {@code VideoFrameProcessor}.
*/
protected
Pair
<
ColorInfo
,
ColorInfo
>
experimentalGetVideoFrameProcessorColorConfiguration
(
@Nullable
ColorInfo
inputColorInfo
)
{
// TODO(b/279163661) Remove this method after VideoFrameProcessor supports texture ID
// input/output.
if
(!
ColorInfo
.
isTransferHdr
(
inputColorInfo
))
{
return
Pair
.
create
(
ColorInfo
.
SDR_BT709_LIMITED
,
ColorInfo
.
SDR_BT709_LIMITED
);
}
if
(
inputColorInfo
.
colorTransfer
==
C
.
COLOR_TRANSFER_HLG
)
{
// SurfaceView only supports BT2020 PQ input, converting HLG to PQ.
return
Pair
.
create
(
inputColorInfo
,
inputColorInfo
.
buildUpon
().
setColorTransfer
(
C
.
COLOR_TRANSFER_ST2084
).
build
());
}
return
Pair
.
create
(
inputColorInfo
,
inputColorInfo
);
}
/**
* Renders the output buffer with the specified index now.
*
* @param codec The codec that owns the output buffer.
...
...
@@ -1982,22 +2004,11 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
return
false
;
}
ColorInfo
inputColorInfo
;
ColorInfo
outputColorInfo
;
if
(
inputFormat
.
colorInfo
!=
null
)
{
inputColorInfo
=
inputFormat
.
colorInfo
;
outputColorInfo
=
inputColorInfo
.
colorTransfer
==
C
.
COLOR_TRANSFER_HLG
// SurfaceView only supports BT2020 PQ input, converting HLG to PQ.
?
inputColorInfo
.
buildUpon
().
setColorTransfer
(
C
.
COLOR_TRANSFER_ST2084
).
build
()
:
inputColorInfo
;
}
else
{
inputColorInfo
=
ColorInfo
.
SDR_BT709_LIMITED
;
outputColorInfo
=
ColorInfo
.
SDR_BT709_LIMITED
;
}
// Playback thread handler.
handler
=
Util
.
createHandlerForCurrentLooper
();
Pair
<
ColorInfo
,
ColorInfo
>
inputAndOutputColorInfos
=
renderer
.
experimentalGetVideoFrameProcessorColorConfiguration
(
inputFormat
.
colorInfo
);
try
{
// TODO(b/243036513): Set rotation in setInputFormat() after supporting changing effects.
if
(!
codecAppliesRotation
()
&&
inputFormat
.
rotationDegrees
!=
0
)
{
...
...
@@ -2013,8 +2024,8 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
renderer
.
context
,
checkNotNull
(
videoEffects
),
DebugViewProvider
.
NONE
,
input
ColorInfo
,
outputColorInfo
,
input
AndOutputColorInfos
.
first
,
inputAndOutputColorInfos
.
second
,
INPUT_TYPE_SURFACE
,
/* releaseFramesAutomatically= */
false
,
/* executor= */
handler:
:
post
,
...
...
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