| OLD | NEW |
| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 // content. | 89 // content. |
| 90 const VideoPixelFormat format = | 90 const VideoPixelFormat format = |
| 91 AVPixelFormatToVideoPixelFormat(codec_context->pix_fmt); | 91 AVPixelFormatToVideoPixelFormat(codec_context->pix_fmt); |
| 92 | 92 |
| 93 if (format == PIXEL_FORMAT_UNKNOWN) | 93 if (format == PIXEL_FORMAT_UNKNOWN) |
| 94 return AVERROR(EINVAL); | 94 return AVERROR(EINVAL); |
| 95 DCHECK(format == PIXEL_FORMAT_YV12 || format == PIXEL_FORMAT_YV16 || | 95 DCHECK(format == PIXEL_FORMAT_YV12 || format == PIXEL_FORMAT_YV16 || |
| 96 format == PIXEL_FORMAT_YV24 || format == PIXEL_FORMAT_YUV420P9 || | 96 format == PIXEL_FORMAT_YV24 || format == PIXEL_FORMAT_YUV420P9 || |
| 97 format == PIXEL_FORMAT_YUV420P10 || format == PIXEL_FORMAT_YUV422P9 || | 97 format == PIXEL_FORMAT_YUV420P10 || format == PIXEL_FORMAT_YUV422P9 || |
| 98 format == PIXEL_FORMAT_YUV422P10 || format == PIXEL_FORMAT_YUV444P9 || | 98 format == PIXEL_FORMAT_YUV422P10 || format == PIXEL_FORMAT_YUV444P9 || |
| 99 format == PIXEL_FORMAT_YUV444P10); | 99 format == PIXEL_FORMAT_YUV444P10 || format == PIXEL_FORMAT_YUV420P12 || |
| 100 format == PIXEL_FORMAT_YUV422P12 || format == PIXEL_FORMAT_YUV444P12); |
| 100 | 101 |
| 101 gfx::Size size(codec_context->width, codec_context->height); | 102 gfx::Size size(codec_context->width, codec_context->height); |
| 102 const int ret = av_image_check_size(size.width(), size.height(), 0, NULL); | 103 const int ret = av_image_check_size(size.width(), size.height(), 0, NULL); |
| 103 if (ret < 0) | 104 if (ret < 0) |
| 104 return ret; | 105 return ret; |
| 105 | 106 |
| 106 gfx::Size natural_size; | 107 gfx::Size natural_size; |
| 107 if (codec_context->sample_aspect_ratio.num > 0) { | 108 if (codec_context->sample_aspect_ratio.num > 0) { |
| 108 natural_size = GetNaturalSize(size, | 109 natural_size = GetNaturalSize(size, |
| 109 codec_context->sample_aspect_ratio.num, | 110 codec_context->sample_aspect_ratio.num, |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) { | 386 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) { |
| 386 ReleaseFFmpegResources(); | 387 ReleaseFFmpegResources(); |
| 387 return false; | 388 return false; |
| 388 } | 389 } |
| 389 | 390 |
| 390 av_frame_.reset(av_frame_alloc()); | 391 av_frame_.reset(av_frame_alloc()); |
| 391 return true; | 392 return true; |
| 392 } | 393 } |
| 393 | 394 |
| 394 } // namespace media | 395 } // namespace media |
| OLD | NEW |