| 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/ffmpeg/ffmpeg_common.h" | 5 #include "media/ffmpeg/ffmpeg_common.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "media/base/video_util.h" | 8 #include "media/base/video_util.h" |
| 9 | 9 |
| 10 namespace media { | 10 namespace media { |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 | 262 |
| 263 VideoCodec codec = CodecIDToVideoCodec(stream->codec->codec_id); | 263 VideoCodec codec = CodecIDToVideoCodec(stream->codec->codec_id); |
| 264 VideoCodecProfile profile = (codec == kCodecVP8) ? VP8PROFILE_MAIN : | 264 VideoCodecProfile profile = (codec == kCodecVP8) ? VP8PROFILE_MAIN : |
| 265 ProfileIDToVideoCodecProfile(stream->codec->profile); | 265 ProfileIDToVideoCodecProfile(stream->codec->profile); |
| 266 gfx::Size natural_size = GetNaturalSize( | 266 gfx::Size natural_size = GetNaturalSize( |
| 267 visible_rect.size(), aspect_ratio.num, aspect_ratio.den); | 267 visible_rect.size(), aspect_ratio.num, aspect_ratio.den); |
| 268 config->Initialize(codec, | 268 config->Initialize(codec, |
| 269 profile, | 269 profile, |
| 270 PixelFormatToVideoFormat(stream->codec->pix_fmt), | 270 PixelFormatToVideoFormat(stream->codec->pix_fmt), |
| 271 coded_size, visible_rect, natural_size, | 271 coded_size, visible_rect, natural_size, |
| 272 stream->codec->extradata, | 272 stream->codec->extradata, stream->codec->extradata_size, |
| 273 stream->codec->extradata_size, | 273 false, |
| 274 true); | 274 true); |
| 275 } | 275 } |
| 276 | 276 |
| 277 void VideoDecoderConfigToAVCodecContext( | 277 void VideoDecoderConfigToAVCodecContext( |
| 278 const VideoDecoderConfig& config, | 278 const VideoDecoderConfig& config, |
| 279 AVCodecContext* codec_context) { | 279 AVCodecContext* codec_context) { |
| 280 codec_context->codec_type = AVMEDIA_TYPE_VIDEO; | 280 codec_context->codec_type = AVMEDIA_TYPE_VIDEO; |
| 281 codec_context->codec_id = VideoCodecToCodecID(config.codec()); | 281 codec_context->codec_id = VideoCodecToCodecID(config.codec()); |
| 282 codec_context->profile = VideoCodecProfileToProfileID(config.profile()); | 282 codec_context->profile = VideoCodecProfileToProfileID(config.profile()); |
| 283 codec_context->coded_width = config.coded_size().width(); | 283 codec_context->coded_width = config.coded_size().width(); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 avcodec_close(stream->codec); | 387 avcodec_close(stream->codec); |
| 388 } | 388 } |
| 389 } | 389 } |
| 390 } | 390 } |
| 391 | 391 |
| 392 // Then finally cleanup the format context. | 392 // Then finally cleanup the format context. |
| 393 avformat_close_input(&format_context); | 393 avformat_close_input(&format_context); |
| 394 } | 394 } |
| 395 | 395 |
| 396 } // namespace media | 396 } // namespace media |
| OLD | NEW |