Index: media/ffmpeg/ffmpeg_common.cc |
diff --git a/media/ffmpeg/ffmpeg_common.cc b/media/ffmpeg/ffmpeg_common.cc |
index 1fd5cd9991f82edbb8447f69c4e432c8102f2aca..c42104bf0beec7621524f82b4e3f5df40faf2b0b 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 |
@@ -148,6 +152,8 @@ VideoCodec CodecIDToVideoCodec(CodecID codec_id) { |
return kCodecMPEG4; |
case CODEC_ID_VP8: |
return kCodecVP8; |
+ case AV_CODEC_ID_VP9: |
+ return kCodecVP9; |
default: |
DVLOG(1) << "Unknown video CodecID: " << codec_id; |
} |
@@ -168,6 +174,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; |
} |
@@ -312,12 +322,21 @@ void AVStreamToVideoDecoderConfig( |
VideoCodec codec = CodecIDToVideoCodec(stream->codec->codec_id); |
VideoCodecProfile profile = (codec == kCodecVP8) ? VP8PROFILE_MAIN : |
scherkus (not reviewing)
2012/12/18 01:01:56
for clarity's sake let's unfold the nested ?: oper
Tom Finegan
2012/12/18 01:47:42
Done.
|
- ProfileIDToVideoCodecProfile(stream->codec->profile); |
+ (codec == kCodecVP9) ? VP9PROFILE_MAIN : |
+ 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; |
scherkus (not reviewing)
2012/12/18 01:01:56
is this always true?
Tom Finegan
2012/12/18 01:47:42
Yes: libvpx outputs either YV12 or I420. The wrapp
|
+ 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. |