| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 | 84 |
| 85 gfx::Size natural_size; | 85 gfx::Size natural_size; |
| 86 if (codec_context->sample_aspect_ratio.num > 0) { | 86 if (codec_context->sample_aspect_ratio.num > 0) { |
| 87 natural_size = GetNaturalSize(size, | 87 natural_size = GetNaturalSize(size, |
| 88 codec_context->sample_aspect_ratio.num, | 88 codec_context->sample_aspect_ratio.num, |
| 89 codec_context->sample_aspect_ratio.den); | 89 codec_context->sample_aspect_ratio.den); |
| 90 } else { | 90 } else { |
| 91 natural_size = demuxer_stream_->video_decoder_config().natural_size(); | 91 natural_size = demuxer_stream_->video_decoder_config().natural_size(); |
| 92 } | 92 } |
| 93 | 93 |
| 94 if (!VideoFrame::IsValidConfig(format, size, natural_size)) | 94 if (!VideoFrame::IsValidConfig(format, size, gfx::Rect(size), natural_size)) |
| 95 return AVERROR(EINVAL); | 95 return AVERROR(EINVAL); |
| 96 | 96 |
| 97 scoped_refptr<VideoFrame> video_frame = | 97 scoped_refptr<VideoFrame> video_frame = |
| 98 VideoFrame::CreateFrame(format, size, natural_size, kNoTimestamp()); | 98 VideoFrame::CreateFrame(format, size, gfx::Rect(size), natural_size, |
| 99 kNoTimestamp()); |
| 99 | 100 |
| 100 for (int i = 0; i < 3; i++) { | 101 for (int i = 0; i < 3; i++) { |
| 101 frame->base[i] = video_frame->data(i); | 102 frame->base[i] = video_frame->data(i); |
| 102 frame->data[i] = video_frame->data(i); | 103 frame->data[i] = video_frame->data(i); |
| 103 frame->linesize[i] = video_frame->stride(i); | 104 frame->linesize[i] = video_frame->stride(i); |
| 104 } | 105 } |
| 105 | 106 |
| 106 frame->opaque = NULL; | 107 frame->opaque = NULL; |
| 107 video_frame.swap(reinterpret_cast<VideoFrame**>(&frame->opaque)); | 108 video_frame.swap(reinterpret_cast<VideoFrame**>(&frame->opaque)); |
| 108 frame->type = FF_BUFFER_TYPE_USER; | 109 frame->type = FF_BUFFER_TYPE_USER; |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 if (!codec || avcodec_open2(codec_context_, codec, NULL) < 0) { | 528 if (!codec || avcodec_open2(codec_context_, codec, NULL) < 0) { |
| 528 ReleaseFFmpegResources(); | 529 ReleaseFFmpegResources(); |
| 529 return false; | 530 return false; |
| 530 } | 531 } |
| 531 | 532 |
| 532 av_frame_ = avcodec_alloc_frame(); | 533 av_frame_ = avcodec_alloc_frame(); |
| 533 return true; | 534 return true; |
| 534 } | 535 } |
| 535 | 536 |
| 536 } // namespace media | 537 } // namespace media |
| OLD | NEW |