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
e0b46ece
authored
Jul 13, 2022
by
samrobinson
Committed by
Rohit Singh
Jul 13, 2022
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Clarify format is supported by encoder.
#cleanup #minor-release PiperOrigin-RevId: 460688226
parent
91855006
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
10 deletions
library/transformer/src/main/java/com/google/android/exoplayer2/transformer/DefaultEncoderFactory.java
library/transformer/src/main/java/com/google/android/exoplayer2/transformer/DefaultEncoderFactory.java
View file @
e0b46ece
...
@@ -229,24 +229,34 @@ public final class DefaultEncoderFactory implements Codec.EncoderFactory {
...
@@ -229,24 +229,34 @@ public final class DefaultEncoderFactory implements Codec.EncoderFactory {
}
}
MediaCodecInfo
encoderInfo
=
encoderAndClosestFormatSupport
.
encoder
;
MediaCodecInfo
encoderInfo
=
encoderAndClosestFormatSupport
.
encoder
;
f
ormat
=
encoderAndClosestFormatSupport
.
supportedFormat
;
Format
encoderSupportedF
ormat
=
encoderAndClosestFormatSupport
.
supportedFormat
;
VideoEncoderSettings
supportedVideoEncoderSettings
=
VideoEncoderSettings
supportedVideoEncoderSettings
=
encoderAndClosestFormatSupport
.
supportedEncoderSettings
;
encoderAndClosestFormatSupport
.
supportedEncoderSettings
;
String
mimeType
=
checkNotNull
(
format
.
sampleMimeType
);
String
mimeType
=
checkNotNull
(
encoderSupportedFormat
.
sampleMimeType
);
MediaFormat
mediaFormat
=
MediaFormat
.
createVideoFormat
(
mimeType
,
format
.
width
,
format
.
height
);
MediaFormat
mediaFormat
=
mediaFormat
.
setInteger
(
MediaFormat
.
KEY_FRAME_RATE
,
round
(
format
.
frameRate
));
MediaFormat
.
createVideoFormat
(
mimeType
,
encoderSupportedFormat
.
width
,
encoderSupportedFormat
.
height
);
mediaFormat
.
setInteger
(
MediaFormat
.
KEY_FRAME_RATE
,
round
(
encoderSupportedFormat
.
frameRate
));
int
bitrate
;
int
bitrate
;
if
(
supportedVideoEncoderSettings
.
enableHighQualityTargeting
)
{
if
(
supportedVideoEncoderSettings
.
enableHighQualityTargeting
)
{
bitrate
=
bitrate
=
new
DeviceMappedEncoderBitrateProvider
()
new
DeviceMappedEncoderBitrateProvider
()
.
getBitrate
(
encoderInfo
.
getName
(),
format
.
width
,
format
.
height
,
format
.
frameRate
);
.
getBitrate
(
encoderInfo
.
getName
(),
encoderSupportedFormat
.
width
,
encoderSupportedFormat
.
height
,
encoderSupportedFormat
.
frameRate
);
}
else
if
(
supportedVideoEncoderSettings
.
bitrate
!=
VideoEncoderSettings
.
NO_VALUE
)
{
}
else
if
(
supportedVideoEncoderSettings
.
bitrate
!=
VideoEncoderSettings
.
NO_VALUE
)
{
bitrate
=
supportedVideoEncoderSettings
.
bitrate
;
bitrate
=
supportedVideoEncoderSettings
.
bitrate
;
}
else
{
}
else
{
bitrate
=
getSuggestedBitrate
(
format
.
width
,
format
.
height
,
format
.
frameRate
);
bitrate
=
getSuggestedBitrate
(
encoderSupportedFormat
.
width
,
encoderSupportedFormat
.
height
,
encoderSupportedFormat
.
frameRate
);
}
}
mediaFormat
.
setInteger
(
MediaFormat
.
KEY_BIT_RATE
,
bitrate
);
mediaFormat
.
setInteger
(
MediaFormat
.
KEY_BIT_RATE
,
bitrate
);
...
@@ -265,7 +275,7 @@ public final class DefaultEncoderFactory implements Codec.EncoderFactory {
...
@@ -265,7 +275,7 @@ public final class DefaultEncoderFactory implements Codec.EncoderFactory {
adjustMediaFormatForH264EncoderSettings
(
mediaFormat
,
encoderInfo
);
adjustMediaFormatForH264EncoderSettings
(
mediaFormat
,
encoderInfo
);
}
}
MediaFormatUtil
.
maybeSetColorInfo
(
mediaFormat
,
f
ormat
.
colorInfo
);
MediaFormatUtil
.
maybeSetColorInfo
(
mediaFormat
,
encoderSupportedF
ormat
.
colorInfo
);
mediaFormat
.
setInteger
(
mediaFormat
.
setInteger
(
MediaFormat
.
KEY_COLOR_FORMAT
,
supportedVideoEncoderSettings
.
colorProfile
);
MediaFormat
.
KEY_COLOR_FORMAT
,
supportedVideoEncoderSettings
.
colorProfile
);
...
@@ -301,7 +311,7 @@ public final class DefaultEncoderFactory implements Codec.EncoderFactory {
...
@@ -301,7 +311,7 @@ public final class DefaultEncoderFactory implements Codec.EncoderFactory {
return
new
DefaultCodec
(
return
new
DefaultCodec
(
context
,
context
,
f
ormat
,
encoderSupportedF
ormat
,
mediaFormat
,
mediaFormat
,
encoderInfo
.
getName
(),
encoderInfo
.
getName
(),
/* isDecoder= */
false
,
/* isDecoder= */
false
,
...
@@ -394,7 +404,7 @@ public final class DefaultEncoderFactory implements Codec.EncoderFactory {
...
@@ -394,7 +404,7 @@ public final class DefaultEncoderFactory implements Codec.EncoderFactory {
VideoEncoderSettings
.
NO_VALUE
,
VideoEncoderSettings
.
NO_VALUE
);
VideoEncoderSettings
.
NO_VALUE
,
VideoEncoderSettings
.
NO_VALUE
);
}
}
Format
supportedEncoder
Format
=
Format
encoderSupported
Format
=
requestedFormat
requestedFormat
.
buildUpon
()
.
buildUpon
()
.
setSampleMimeType
(
mimeType
)
.
setSampleMimeType
(
mimeType
)
...
@@ -403,7 +413,7 @@ public final class DefaultEncoderFactory implements Codec.EncoderFactory {
...
@@ -403,7 +413,7 @@ public final class DefaultEncoderFactory implements Codec.EncoderFactory {
.
setAverageBitrate
(
closestSupportedBitrate
)
.
setAverageBitrate
(
closestSupportedBitrate
)
.
build
();
.
build
();
return
new
VideoEncoderQueryResult
(
return
new
VideoEncoderQueryResult
(
pickedEncoderInfo
,
supportedEncoder
Format
,
supportedEncodingSettingBuilder
.
build
());
pickedEncoderInfo
,
encoderSupported
Format
,
supportedEncodingSettingBuilder
.
build
());
}
}
/** Returns a list of encoders that support the requested resolution most closely. */
/** Returns a list of encoders that support the requested resolution most closely. */
...
...
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