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 | 8 |
9 namespace media { | 9 namespace media { |
10 | 10 |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 // for now, but may not always be true forever. Fix this in the future. | 241 // for now, but may not always be true forever. Fix this in the future. |
242 gfx::Rect visible_rect(stream->codec->width, stream->codec->height); | 242 gfx::Rect visible_rect(stream->codec->width, stream->codec->height); |
243 | 243 |
244 AVRational aspect_ratio = { 1, 1 }; | 244 AVRational aspect_ratio = { 1, 1 }; |
245 if (stream->sample_aspect_ratio.num) | 245 if (stream->sample_aspect_ratio.num) |
246 aspect_ratio = stream->sample_aspect_ratio; | 246 aspect_ratio = stream->sample_aspect_ratio; |
247 else if (stream->codec->sample_aspect_ratio.num) | 247 else if (stream->codec->sample_aspect_ratio.num) |
248 aspect_ratio = stream->codec->sample_aspect_ratio; | 248 aspect_ratio = stream->codec->sample_aspect_ratio; |
249 | 249 |
250 VideoCodec codec = CodecIDToVideoCodec(stream->codec->codec_id); | 250 VideoCodec codec = CodecIDToVideoCodec(stream->codec->codec_id); |
251 VideoCodecProfile profile = kCodecVP8 ? VP8PROFILE_MAIN : | 251 VideoCodecProfile profile = (codec == kCodecVP8) ? VP8PROFILE_MAIN : |
252 ProfileIDToVideoCodecProfile(stream->codec->profile); | 252 ProfileIDToVideoCodecProfile(stream->codec->profile); |
253 config->Initialize(codec, | 253 config->Initialize(codec, |
254 profile, | 254 profile, |
255 PixelFormatToVideoFormat(stream->codec->pix_fmt), | 255 PixelFormatToVideoFormat(stream->codec->pix_fmt), |
256 coded_size, visible_rect, | 256 coded_size, visible_rect, |
257 stream->r_frame_rate.num, | 257 stream->r_frame_rate.num, |
258 stream->r_frame_rate.den, | 258 stream->r_frame_rate.den, |
259 aspect_ratio.num, | 259 aspect_ratio.num, |
260 aspect_ratio.den, | 260 aspect_ratio.den, |
261 stream->codec->extradata, | 261 stream->codec->extradata, |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 avcodec_close(stream->codec); | 384 avcodec_close(stream->codec); |
385 } | 385 } |
386 } | 386 } |
387 } | 387 } |
388 | 388 |
389 // Then finally cleanup the format context. | 389 // Then finally cleanup the format context. |
390 avformat_close_input(&format_context); | 390 avformat_close_input(&format_context); |
391 } | 391 } |
392 | 392 |
393 } // namespace media | 393 } // namespace media |
OLD | NEW |