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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 // TODO(vrk): This assumes decoded frame data starts at (0, 0), which is true | 240 // TODO(vrk): This assumes decoded frame data starts at (0, 0), which is true |
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 config->Initialize(CodecIDToVideoCodec(stream->codec->codec_id), | 250 VideoCodec codec = CodecIDToVideoCodec(stream->codec->codec_id); |
251 ProfileIDToVideoCodecProfile(stream->codec->profile), | 251 VideoCodecProfile profile = kCodecVP8 ? VP8PROFILE_MAIN : |
| 252 ProfileIDToVideoCodecProfile(stream->codec->profile); |
| 253 config->Initialize(codec, |
| 254 profile, |
252 PixelFormatToVideoFormat(stream->codec->pix_fmt), | 255 PixelFormatToVideoFormat(stream->codec->pix_fmt), |
253 coded_size, visible_rect, | 256 coded_size, visible_rect, |
254 stream->r_frame_rate.num, | 257 stream->r_frame_rate.num, |
255 stream->r_frame_rate.den, | 258 stream->r_frame_rate.den, |
256 aspect_ratio.num, | 259 aspect_ratio.num, |
257 aspect_ratio.den, | 260 aspect_ratio.den, |
258 stream->codec->extradata, | 261 stream->codec->extradata, |
259 stream->codec->extradata_size, | 262 stream->codec->extradata_size, |
260 true); | 263 true); |
261 } | 264 } |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 avcodec_close(stream->codec); | 384 avcodec_close(stream->codec); |
382 } | 385 } |
383 } | 386 } |
384 } | 387 } |
385 | 388 |
386 // Then finally cleanup the format context. | 389 // Then finally cleanup the format context. |
387 avformat_close_input(&format_context); | 390 avformat_close_input(&format_context); |
388 } | 391 } |
389 | 392 |
390 } // namespace media | 393 } // namespace media |
OLD | NEW |