summaryrefslogtreecommitdiff
path: root/chromium/media/ffmpeg
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-08-30 10:22:43 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-08-30 12:36:28 +0000
commit271a6c3487a14599023a9106329505597638d793 (patch)
treee040d58ffc86c1480b79ca8528020ca9ec919bf8 /chromium/media/ffmpeg
parent7b2ffa587235a47d4094787d72f38102089f402a (diff)
downloadqtwebengine-chromium-271a6c3487a14599023a9106329505597638d793.tar.gz
BASELINE: Update Chromium to 77.0.3865.59
Change-Id: I1e89a5f3b009a9519a6705102ad65c92fe736f21 Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/media/ffmpeg')
-rw-r--r--chromium/media/ffmpeg/ffmpeg_common.cc70
-rw-r--r--chromium/media/ffmpeg/ffmpeg_common.h3
2 files changed, 7 insertions, 66 deletions
diff --git a/chromium/media/ffmpeg/ffmpeg_common.cc b/chromium/media/ffmpeg/ffmpeg_common.cc
index 1d5d08510a7..afd81dfbd5c 100644
--- a/chromium/media/ffmpeg/ffmpeg_common.cc
+++ b/chromium/media/ffmpeg/ffmpeg_common.cc
@@ -469,9 +469,6 @@ bool AVStreamToVideoDecoderConfig(const AVStream* stream,
gfx::Size natural_size =
GetNaturalSize(visible_rect.size(), aspect_ratio.num, aspect_ratio.den);
- VideoPixelFormat format =
- AVPixelFormatToVideoPixelFormat(codec_context->pix_fmt);
-
// Without the ffmpeg decoder configured, libavformat is unable to get the
// profile, format, or coded size. So choose sensible defaults and let
// decoders fail later if the configuration is actually unsupported.
@@ -496,15 +493,10 @@ bool AVStreamToVideoDecoderConfig(const AVStream* stream,
// All the heuristics failed, let's assign a default profile
if (profile == VIDEO_CODEC_PROFILE_UNKNOWN)
profile = H264PROFILE_BASELINE;
-
- format = PIXEL_FORMAT_I420;
break;
}
#endif
case kCodecVP8:
-#if !BUILDFLAG(ENABLE_FFMPEG_VIDEO_DECODERS)
- format = PIXEL_FORMAT_I420;
-#endif
profile = VP8PROFILE_ANY;
break;
case kCodecVP9:
@@ -525,10 +517,8 @@ bool AVStreamToVideoDecoderConfig(const AVStream* stream,
profile = VP9PROFILE_MIN;
break;
}
- format = PIXEL_FORMAT_I420;
break;
case kCodecAV1:
- format = PIXEL_FORMAT_I420;
profile = AV1PROFILE_PROFILE_MAIN;
break;
#if BUILDFLAG(ENABLE_HEVC_DEMUXING)
@@ -543,18 +533,8 @@ bool AVStreamToVideoDecoderConfig(const AVStream* stream,
profile = ProfileIDToVideoCodecProfile(codec_context->profile);
}
- // Pad out |coded_size| for subsampled YUV formats.
- if (format != PIXEL_FORMAT_I444 && format != PIXEL_FORMAT_UNKNOWN) {
- coded_size.set_width((coded_size.width() + 1) / 2 * 2);
- if (format != PIXEL_FORMAT_I422)
- coded_size.set_height((coded_size.height() + 1) / 2 * 2);
- }
-
- AVDictionaryEntry* webm_alpha =
- av_dict_get(stream->metadata, "alpha_mode", nullptr, 0);
- if (webm_alpha && !strcmp(webm_alpha->value, "1")) {
- format = PIXEL_FORMAT_I420A;
- }
+ auto* alpha_mode = av_dict_get(stream->metadata, "alpha_mode", nullptr, 0);
+ const bool has_alpha = alpha_mode && !strcmp(alpha_mode->value, "1");
VideoRotation video_rotation = VIDEO_ROTATION_0;
int rotation = 0;
@@ -622,9 +602,11 @@ bool AVStreamToVideoDecoderConfig(const AVStream* stream,
codec_context->extradata + codec_context->extradata_size);
}
// TODO(tmathmeyer) ffmpeg can't provide us with an actual video rotation yet.
- config->Initialize(codec, profile, format, color_space,
- VideoTransformation(video_rotation), coded_size,
- visible_rect, natural_size, extra_data,
+ config->Initialize(codec, profile,
+ has_alpha ? VideoDecoderConfig::AlphaMode::kHasAlpha
+ : VideoDecoderConfig::AlphaMode::kIsOpaque,
+ color_space, VideoTransformation(video_rotation),
+ coded_size, visible_rect, natural_size, extra_data,
GetEncryptionScheme(stream));
if (stream->nb_side_data) {
@@ -670,7 +652,6 @@ void VideoDecoderConfigToAVCodecContext(
codec_context->profile = VideoCodecProfileToProfileID(config.profile());
codec_context->coded_width = config.coded_size().width();
codec_context->coded_height = config.coded_size().height();
- codec_context->pix_fmt = VideoPixelFormatToAVPixelFormat(config.format());
if (config.color_space_info().range == gfx::ColorSpace::RangeID::FULL)
codec_context->color_range = AVCOL_RANGE_JPEG;
@@ -806,43 +787,6 @@ VideoPixelFormat AVPixelFormatToVideoPixelFormat(AVPixelFormat pixel_format) {
return PIXEL_FORMAT_UNKNOWN;
}
-AVPixelFormat VideoPixelFormatToAVPixelFormat(VideoPixelFormat video_format) {
- switch (video_format) {
- case PIXEL_FORMAT_I420:
- return AV_PIX_FMT_YUV420P;
- case PIXEL_FORMAT_I422:
- return AV_PIX_FMT_YUV422P;
- case PIXEL_FORMAT_I420A:
- return AV_PIX_FMT_YUVA420P;
- case PIXEL_FORMAT_I444:
- return AV_PIX_FMT_YUV444P;
- case PIXEL_FORMAT_YUV420P9:
- return AV_PIX_FMT_YUV420P9LE;
- case PIXEL_FORMAT_YUV420P10:
- return AV_PIX_FMT_YUV420P10LE;
- case PIXEL_FORMAT_YUV420P12:
- return AV_PIX_FMT_YUV420P12LE;
- case PIXEL_FORMAT_YUV422P9:
- return AV_PIX_FMT_YUV422P9LE;
- case PIXEL_FORMAT_YUV422P10:
- return AV_PIX_FMT_YUV422P10LE;
- case PIXEL_FORMAT_YUV422P12:
- return AV_PIX_FMT_YUV422P12LE;
- case PIXEL_FORMAT_YUV444P9:
- return AV_PIX_FMT_YUV444P9LE;
- case PIXEL_FORMAT_YUV444P10:
- return AV_PIX_FMT_YUV444P10LE;
- case PIXEL_FORMAT_YUV444P12:
- return AV_PIX_FMT_YUV444P12LE;
- case PIXEL_FORMAT_P016LE:
- return AV_PIX_FMT_P016LE;
-
- default:
- DVLOG(1) << "Unsupported Format: " << video_format;
- }
- return AV_PIX_FMT_NONE;
-}
-
VideoColorSpace AVColorSpaceToColorSpace(AVColorSpace color_space,
AVColorRange color_range) {
// TODO(hubbe): make this better
diff --git a/chromium/media/ffmpeg/ffmpeg_common.h b/chromium/media/ffmpeg/ffmpeg_common.h
index 8f7d8f49e84..3c6c62bb6a3 100644
--- a/chromium/media/ffmpeg/ffmpeg_common.h
+++ b/chromium/media/ffmpeg/ffmpeg_common.h
@@ -135,9 +135,6 @@ AVSampleFormatToSampleFormat(AVSampleFormat sample_format, AVCodecID codec_id);
MEDIA_EXPORT VideoPixelFormat
AVPixelFormatToVideoPixelFormat(AVPixelFormat pixel_format);
-// Converts video formats to its corresponding FFmpeg's pixel formats.
-AVPixelFormat VideoPixelFormatToAVPixelFormat(VideoPixelFormat video_format);
-
VideoColorSpace AVColorSpaceToColorSpace(AVColorSpace color_space,
AVColorRange color_range);