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

Side by Side Diff: media/filters/ffmpeg_video_decoder.cc

Issue 88403004: Add plumbing for video pixel formats with JPEG color range. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add YV12J to a DCHECK Created 7 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 unified diff | Download patch
« no previous file with comments | « media/ffmpeg/ffmpeg_common.cc ('k') | media/filters/skcanvas_video_renderer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/filters/ffmpeg_video_decoder.h" 5 #include "media/filters/ffmpeg_video_decoder.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 int FFmpegVideoDecoder::GetVideoBuffer(AVCodecContext* codec_context, 64 int FFmpegVideoDecoder::GetVideoBuffer(AVCodecContext* codec_context,
65 AVFrame* frame) { 65 AVFrame* frame) {
66 // Don't use |codec_context_| here! With threaded decoding, 66 // Don't use |codec_context_| here! With threaded decoding,
67 // it will contain unsynchronized width/height/pix_fmt values, 67 // it will contain unsynchronized width/height/pix_fmt values,
68 // whereas |codec_context| contains the current threads's 68 // whereas |codec_context| contains the current threads's
69 // updated width/height/pix_fmt, which can change for adaptive 69 // updated width/height/pix_fmt, which can change for adaptive
70 // content. 70 // content.
71 VideoFrame::Format format = PixelFormatToVideoFormat(codec_context->pix_fmt); 71 VideoFrame::Format format = PixelFormatToVideoFormat(codec_context->pix_fmt);
72 if (format == VideoFrame::UNKNOWN) 72 if (format == VideoFrame::UNKNOWN)
73 return AVERROR(EINVAL); 73 return AVERROR(EINVAL);
74 DCHECK(format == VideoFrame::YV12 || format == VideoFrame::YV16); 74 DCHECK(format == VideoFrame::YV12 || format == VideoFrame::YV16 ||
75 format == VideoFrame::YV12J);
75 76
76 gfx::Size size(codec_context->width, codec_context->height); 77 gfx::Size size(codec_context->width, codec_context->height);
77 int ret; 78 int ret;
78 if ((ret = av_image_check_size(size.width(), size.height(), 0, NULL)) < 0) 79 if ((ret = av_image_check_size(size.width(), size.height(), 0, NULL)) < 0)
79 return ret; 80 return ret;
80 81
81 gfx::Size natural_size; 82 gfx::Size natural_size;
82 if (codec_context->sample_aspect_ratio.num > 0) { 83 if (codec_context->sample_aspect_ratio.num > 0) {
83 natural_size = GetNaturalSize(size, 84 natural_size = GetNaturalSize(size,
84 codec_context->sample_aspect_ratio.num, 85 codec_context->sample_aspect_ratio.num,
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) { 380 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) {
380 ReleaseFFmpegResources(); 381 ReleaseFFmpegResources();
381 return false; 382 return false;
382 } 383 }
383 384
384 av_frame_.reset(avcodec_alloc_frame()); 385 av_frame_.reset(avcodec_alloc_frame());
385 return true; 386 return true;
386 } 387 }
387 388
388 } // namespace media 389 } // namespace media
OLDNEW
« no previous file with comments | « media/ffmpeg/ffmpeg_common.cc ('k') | media/filters/skcanvas_video_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698