Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(304)

Unified Diff: media/ffmpeg/ffmpeg_common.cc

Issue 11644078: Add wrapper class to media for support of VP9 video, and add a command line flag to enable the supp… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Roll libvpx_revision to pick up a bug fix. Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/video_decoder_config.h ('k') | media/filters/vpx_video_decoder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/ffmpeg/ffmpeg_common.cc
diff --git a/media/ffmpeg/ffmpeg_common.cc b/media/ffmpeg/ffmpeg_common.cc
index 1fd5cd9991f82edbb8447f69c4e432c8102f2aca..3562ec3fdea4823211714ecd6ad780f0a01957d4 100644
--- a/media/ffmpeg/ffmpeg_common.cc
+++ b/media/ffmpeg/ffmpeg_common.cc
@@ -10,6 +10,10 @@
#include "media/base/video_frame.h"
#include "media/base/video_util.h"
+// TODO(tomfinegan): Remove this once FFmpeg rolls for M25. The VP9 patch is in
+// tree, but this is required until the roll happens.
+#define AV_CODEC_ID_VP9 170
+
namespace media {
// Why FF_INPUT_BUFFER_PADDING_SIZE? FFmpeg assumes all input buffers are
@@ -149,6 +153,11 @@ VideoCodec CodecIDToVideoCodec(CodecID codec_id) {
case CODEC_ID_VP8:
return kCodecVP8;
default:
+ if (codec_id == AV_CODEC_ID_VP9) {
+ // TODO(tomfinegan): Remove this once FFmpeg rolls for M25, and
+ // AV_CODEC_ID_VP9 is part of CodecID.
+ return kCodecVP9;
+ }
DVLOG(1) << "Unknown video CodecID: " << codec_id;
}
return kUnknownVideoCodec;
@@ -168,6 +177,10 @@ static CodecID VideoCodecToCodecID(VideoCodec video_codec) {
return CODEC_ID_MPEG4;
case kCodecVP8:
return CODEC_ID_VP8;
+ case kCodecVP9:
+ // TODO(tomfinegan): Remove this cast once FFmpeg rolls for M25, and the
+ // local define for AV_CODEC_ID_VP9 is removed.
+ return static_cast<CodecID>(AV_CODEC_ID_VP9);
default:
DVLOG(1) << "Unknown VideoCodec: " << video_codec;
}
@@ -311,13 +324,28 @@ void AVStreamToVideoDecoderConfig(
aspect_ratio = stream->codec->sample_aspect_ratio;
VideoCodec codec = CodecIDToVideoCodec(stream->codec->codec_id);
- VideoCodecProfile profile = (codec == kCodecVP8) ? VP8PROFILE_MAIN :
- ProfileIDToVideoCodecProfile(stream->codec->profile);
+
+ VideoCodecProfile profile = VIDEO_CODEC_PROFILE_UNKNOWN;
+ if (codec == kCodecVP8)
+ profile = VP8PROFILE_MAIN;
+ else if (codec == kCodecVP9)
+ profile = VP9PROFILE_MAIN;
+ else
+ profile = ProfileIDToVideoCodecProfile(stream->codec->profile);
+
gfx::Size natural_size = GetNaturalSize(
visible_rect.size(), aspect_ratio.num, aspect_ratio.den);
+
+ VideoFrame::Format format = PixelFormatToVideoFormat(stream->codec->pix_fmt);
+ if (codec == kCodecVP9) {
+ // TODO(tomfinegan): libavcodec doesn't know about VP9.
+ format = VideoFrame::YV12;
+ coded_size = natural_size;
+ }
+
config->Initialize(codec,
profile,
- PixelFormatToVideoFormat(stream->codec->pix_fmt),
+ format,
coded_size, visible_rect, natural_size,
stream->codec->extradata, stream->codec->extradata_size,
false, // Not encrypted.
« no previous file with comments | « media/base/video_decoder_config.h ('k') | media/filters/vpx_video_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698