Index: media/video/ffmpeg_video_decode_engine.cc |
diff --git a/media/video/ffmpeg_video_decode_engine.cc b/media/video/ffmpeg_video_decode_engine.cc |
index 65edc2fc2d4a8dd6af8c789824e7096c72239231..b854e5dba1fe3491b2d920a11b0be08a5df62ae8 100644 |
--- a/media/video/ffmpeg_video_decode_engine.cc |
+++ b/media/video/ffmpeg_video_decode_engine.cc |
@@ -58,7 +58,8 @@ void FFmpegVideoDecodeEngine::Initialize( |
codec_context_ = avcodec_alloc_context(); |
// TODO(scherkus): should video format get passed in via VideoDecoderConfig? |
- codec_context_->pix_fmt = PIX_FMT_YUV420P; |
+ // (shadi): yes! YV16 and Y12 have different memory format. |
scherkus (not reviewing)
2011/09/28 17:32:17
haha!
if these TODOs are sufficiently addressed t
shadi1
2011/09/29 18:31:03
Done.
|
+ codec_context_->pix_fmt = config.pix_fmt(); |
codec_context_->codec_type = AVMEDIA_TYPE_VIDEO; |
codec_context_->codec_id = VideoCodecToCodecID(config.codec()); |
codec_context_->coded_width = config.coded_size().width(); |
@@ -112,7 +113,7 @@ void FFmpegVideoDecodeEngine::Initialize( |
// Create output buffer pool when direct rendering is not used. |
for (size_t i = 0; i < Limits::kMaxVideoFrames; ++i) { |
scoped_refptr<VideoFrame> video_frame = |
- VideoFrame::CreateFrame(VideoFrame::YV12, |
+ VideoFrame::CreateFrame(PixFmtToVideoFormat(codec_context_->pix_fmt), |
config.visible_rect().width(), |
config.visible_rect().height(), |
kNoTimestamp, |
@@ -250,7 +251,8 @@ void FFmpegVideoDecodeEngine::DecodeFrame(scoped_refptr<Buffer> buffer) { |
// output, meaning the data is only valid until the next |
// avcodec_decode_video() call. |
int y_rows = codec_context_->height; |
- int uv_rows = codec_context_->height / 2; |
+ int uv_rows = video_frame->rows(VideoFrame::kUPlane); |
scherkus (not reviewing)
2011/09/28 17:32:17
nice :)
|
+ |
CopyYPlane(av_frame_->data[0], av_frame_->linesize[0], y_rows, video_frame); |
CopyUPlane(av_frame_->data[1], av_frame_->linesize[1], uv_rows, video_frame); |
CopyVPlane(av_frame_->data[2], av_frame_->linesize[2], uv_rows, video_frame); |