Chromium Code Reviews| 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/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "media/base/decoder_buffer.h" | 9 #include "media/base/decoder_buffer.h" |
| 10 #include "media/base/video_frame.h" | 10 #include "media/base/video_frame.h" |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 380 gfx::Size natural_size = GetNaturalSize( | 380 gfx::Size natural_size = GetNaturalSize( |
| 381 visible_rect.size(), aspect_ratio.num, aspect_ratio.den); | 381 visible_rect.size(), aspect_ratio.num, aspect_ratio.den); |
| 382 | 382 |
| 383 VideoFrame::Format format = PixelFormatToVideoFormat(stream->codec->pix_fmt); | 383 VideoFrame::Format format = PixelFormatToVideoFormat(stream->codec->pix_fmt); |
| 384 if (codec == kCodecVP9) { | 384 if (codec == kCodecVP9) { |
| 385 // TODO(tomfinegan): libavcodec doesn't know about VP9. | 385 // TODO(tomfinegan): libavcodec doesn't know about VP9. |
| 386 format = VideoFrame::YV12; | 386 format = VideoFrame::YV12; |
| 387 coded_size = natural_size; | 387 coded_size = natural_size; |
| 388 } | 388 } |
| 389 | 389 |
| 390 AVDictionaryEntry *webm_alpha = | |
|
fgalligan1
2013/02/12 01:20:58
nit: Asterisk adjacent to the type per style in th
vigneshv
2013/02/14 19:06:14
Done.
| |
| 391 av_dict_get(stream->metadata, "alpha_mode", NULL, 0); | |
|
fgalligan1
2013/02/12 01:20:58
4 space indent
http://google-styleguide.googlecode
vigneshv
2013/02/14 19:06:14
Done.
| |
| 392 if (webm_alpha && !strcmp(webm_alpha->value, "1")) { | |
| 393 format = VideoFrame::YV12A; | |
| 394 } | |
| 395 | |
| 390 config->Initialize(codec, | 396 config->Initialize(codec, |
| 391 profile, | 397 profile, |
| 392 format, | 398 format, |
| 393 coded_size, visible_rect, natural_size, | 399 coded_size, visible_rect, natural_size, |
| 394 stream->codec->extradata, stream->codec->extradata_size, | 400 stream->codec->extradata, stream->codec->extradata_size, |
| 395 false, // Not encrypted. | 401 false, // Not encrypted. |
| 396 true); | 402 true); |
| 397 } | 403 } |
| 398 | 404 |
| 399 void VideoDecoderConfigToAVCodecContext( | 405 void VideoDecoderConfigToAVCodecContext( |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 492 VideoFrame::Format PixelFormatToVideoFormat(PixelFormat pixel_format) { | 498 VideoFrame::Format PixelFormatToVideoFormat(PixelFormat pixel_format) { |
| 493 switch (pixel_format) { | 499 switch (pixel_format) { |
| 494 case PIX_FMT_YUV422P: | 500 case PIX_FMT_YUV422P: |
| 495 return VideoFrame::YV16; | 501 return VideoFrame::YV16; |
| 496 // TODO(scherkus): We should be paying attention to the color range of each | 502 // TODO(scherkus): We should be paying attention to the color range of each |
| 497 // format and scaling as appropriate when rendering. Regular YUV has a range | 503 // format and scaling as appropriate when rendering. Regular YUV has a range |
| 498 // of 16-239 where as YUVJ has a range of 0-255. | 504 // of 16-239 where as YUVJ has a range of 0-255. |
| 499 case PIX_FMT_YUV420P: | 505 case PIX_FMT_YUV420P: |
| 500 case PIX_FMT_YUVJ420P: | 506 case PIX_FMT_YUVJ420P: |
| 501 return VideoFrame::YV12; | 507 return VideoFrame::YV12; |
| 508 case PIX_FMT_YUVA420P: | |
| 509 return VideoFrame::YV12A; | |
| 502 default: | 510 default: |
| 503 DVLOG(1) << "Unsupported PixelFormat: " << pixel_format; | 511 DVLOG(1) << "Unsupported PixelFormat: " << pixel_format; |
| 504 } | 512 } |
| 505 return VideoFrame::INVALID; | 513 return VideoFrame::INVALID; |
| 506 } | 514 } |
| 507 | 515 |
| 508 PixelFormat VideoFormatToPixelFormat(VideoFrame::Format video_format) { | 516 PixelFormat VideoFormatToPixelFormat(VideoFrame::Format video_format) { |
| 509 switch (video_format) { | 517 switch (video_format) { |
| 510 case VideoFrame::YV16: | 518 case VideoFrame::YV16: |
| 511 return PIX_FMT_YUV422P; | 519 return PIX_FMT_YUV422P; |
| 512 case VideoFrame::YV12: | 520 case VideoFrame::YV12: |
| 513 return PIX_FMT_YUV420P; | 521 return PIX_FMT_YUV420P; |
| 522 case VideoFrame::YV12A: | |
| 523 return PIX_FMT_YUVA420P; | |
| 514 default: | 524 default: |
| 515 DVLOG(1) << "Unsupported VideoFrame::Format: " << video_format; | 525 DVLOG(1) << "Unsupported VideoFrame::Format: " << video_format; |
| 516 } | 526 } |
| 517 return PIX_FMT_NONE; | 527 return PIX_FMT_NONE; |
| 518 } | 528 } |
| 519 | 529 |
| 520 } // namespace media | 530 } // namespace media |
| OLD | NEW |