From 6a93f3e3e4577423b07c33b2dcc4e74c8f6cfe0d Mon Sep 17 00:00:00 2001 From: jzern Date: Tue, 11 Aug 2015 21:01:11 -0700 Subject: [PATCH] ffmpeg_common: s/PIX_FMT/AV_PIX_FMT/ + PixelFormat -> AVPixelFormat the versions without a prefix have been deprecated for a few years BUG=519105 Review URL: https://codereview.chromium.org/1287533003 Cr-Commit-Position: refs/heads/master@{#342973} --- media/cast/test/fake_media_source.cc | 2 +- media/ffmpeg/ffmpeg_common.cc | 34 +++++++++++++++++----------------- media/ffmpeg/ffmpeg_common.h | 4 ++-- media/filters/ffmpeg_video_decoder.cc | 2 +- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/media/cast/test/fake_media_source.cc b/media/cast/test/fake_media_source.cc index ea42a3a84762..184f69f76ba8 100644 --- a/media/cast/test/fake_media_source.cc +++ b/media/cast/test/fake_media_source.cc @@ -173,7 +173,7 @@ void FakeMediaSource::SetSourceFile(const base::FilePath& video_file, LOG(INFO) << "Source file has audio."; } else if (av_codec->type == AVMEDIA_TYPE_VIDEO) { VideoPixelFormat format = - PixelFormatToVideoPixelFormat(av_codec_context->pix_fmt); + AVPixelFormatToVideoPixelFormat(av_codec_context->pix_fmt); if (format != PIXEL_FORMAT_YV12) { LOG(ERROR) << "Cannot handle non YV12 video format: " << format; continue; diff --git a/media/ffmpeg/ffmpeg_common.cc b/media/ffmpeg/ffmpeg_common.cc index 5b6ef7fe3c19..61dd12d8cac7 100644 --- a/media/ffmpeg/ffmpeg_common.cc +++ b/media/ffmpeg/ffmpeg_common.cc @@ -407,7 +407,7 @@ void AVStreamToVideoDecoderConfig( } VideoPixelFormat format = - PixelFormatToVideoPixelFormat(stream->codec->pix_fmt); + AVPixelFormatToVideoPixelFormat(stream->codec->pix_fmt); // The format and coded size may be unknown if FFmpeg is compiled without // video decoders. #if defined(DISABLE_FFMPEG_VIDEO_DECODERS) @@ -464,7 +464,7 @@ 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 = VideoPixelFormatToPixelFormat(config.format()); + codec_context->pix_fmt = VideoPixelFormatToAVPixelFormat(config.format()); if (config.color_space() == COLOR_SPACE_JPEG) codec_context->color_range = AVCOL_RANGE_JPEG; @@ -547,41 +547,41 @@ ChannelLayout ChannelLayoutToChromeChannelLayout(int64_t layout, int channels) { } } -VideoPixelFormat PixelFormatToVideoPixelFormat(PixelFormat pixel_format) { +VideoPixelFormat AVPixelFormatToVideoPixelFormat(AVPixelFormat pixel_format) { // The YUVJ alternatives are FFmpeg's (deprecated, but still in use) way to // specify a pixel format and full range color combination. switch (pixel_format) { - case PIX_FMT_YUV422P: - case PIX_FMT_YUVJ422P: + case AV_PIX_FMT_YUV422P: + case AV_PIX_FMT_YUVJ422P: return PIXEL_FORMAT_YV16; - case PIX_FMT_YUV444P: - case PIX_FMT_YUVJ444P: + case AV_PIX_FMT_YUV444P: + case AV_PIX_FMT_YUVJ444P: return PIXEL_FORMAT_YV24; - case PIX_FMT_YUV420P: - case PIX_FMT_YUVJ420P: + case AV_PIX_FMT_YUV420P: + case AV_PIX_FMT_YUVJ420P: return PIXEL_FORMAT_YV12; - case PIX_FMT_YUVA420P: + case AV_PIX_FMT_YUVA420P: return PIXEL_FORMAT_YV12A; default: - DVLOG(1) << "Unsupported PixelFormat: " << pixel_format; + DVLOG(1) << "Unsupported AVPixelFormat: " << pixel_format; } return PIXEL_FORMAT_UNKNOWN; } -PixelFormat VideoPixelFormatToPixelFormat(VideoPixelFormat video_format) { +AVPixelFormat VideoPixelFormatToAVPixelFormat(VideoPixelFormat video_format) { switch (video_format) { case PIXEL_FORMAT_YV16: - return PIX_FMT_YUV422P; + return AV_PIX_FMT_YUV422P; case PIXEL_FORMAT_YV12: - return PIX_FMT_YUV420P; + return AV_PIX_FMT_YUV420P; case PIXEL_FORMAT_YV12A: - return PIX_FMT_YUVA420P; + return AV_PIX_FMT_YUVA420P; case PIXEL_FORMAT_YV24: - return PIX_FMT_YUV444P; + return AV_PIX_FMT_YUV444P; default: DVLOG(1) << "Unsupported Format: " << video_format; } - return PIX_FMT_NONE; + return AV_PIX_FMT_NONE; } ColorSpace AVColorSpaceToColorSpace(AVColorSpace color_space, diff --git a/media/ffmpeg/ffmpeg_common.h b/media/ffmpeg/ffmpeg_common.h index b760f23f94d6..a4dbcf3d42d4 100644 --- a/media/ffmpeg/ffmpeg_common.h +++ b/media/ffmpeg/ffmpeg_common.h @@ -119,10 +119,10 @@ MEDIA_EXPORT SampleFormat // Converts FFmpeg's pixel formats to its corresponding supported video format. MEDIA_EXPORT VideoPixelFormat -PixelFormatToVideoPixelFormat(PixelFormat pixel_format); +AVPixelFormatToVideoPixelFormat(AVPixelFormat pixel_format); // Converts video formats to its corresponding FFmpeg's pixel formats. -PixelFormat VideoPixelFormatToPixelFormat(VideoPixelFormat video_format); +AVPixelFormat VideoPixelFormatToAVPixelFormat(VideoPixelFormat video_format); ColorSpace AVColorSpaceToColorSpace(AVColorSpace color_space, AVColorRange color_range); diff --git a/media/filters/ffmpeg_video_decoder.cc b/media/filters/ffmpeg_video_decoder.cc index c19659047872..2d158c4a2738 100644 --- a/media/filters/ffmpeg_video_decoder.cc +++ b/media/filters/ffmpeg_video_decoder.cc @@ -79,7 +79,7 @@ int FFmpegVideoDecoder::GetVideoBuffer(struct AVCodecContext* codec_context, // updated width/height/pix_fmt, which can change for adaptive // content. const VideoPixelFormat format = - PixelFormatToVideoPixelFormat(codec_context->pix_fmt); + AVPixelFormatToVideoPixelFormat(codec_context->pix_fmt); if (format == PIXEL_FORMAT_UNKNOWN) return AVERROR(EINVAL); -- 2.11.4.GIT