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 "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 // FFmpeg channel_layout is 0 for .wav and .mp3. Attempt to guess layout | 506 // FFmpeg channel_layout is 0 for .wav and .mp3. Attempt to guess layout |
507 // based on the channel count. | 507 // based on the channel count. |
508 return GuessChannelLayout(channels); | 508 return GuessChannelLayout(channels); |
509 } | 509 } |
510 } | 510 } |
511 | 511 |
512 VideoFrame::Format PixelFormatToVideoFormat(PixelFormat pixel_format) { | 512 VideoFrame::Format PixelFormatToVideoFormat(PixelFormat pixel_format) { |
513 switch (pixel_format) { | 513 switch (pixel_format) { |
514 case PIX_FMT_YUV422P: | 514 case PIX_FMT_YUV422P: |
515 return VideoFrame::YV16; | 515 return VideoFrame::YV16; |
516 // TODO(scherkus): We should be paying attention to the color range of each | |
517 // format and scaling as appropriate when rendering. Regular YUV has a range | |
518 // of 16-239 where as YUVJ has a range of 0-255. | |
519 case PIX_FMT_YUV420P: | 516 case PIX_FMT_YUV420P: |
| 517 return VideoFrame::YV12; |
520 case PIX_FMT_YUVJ420P: | 518 case PIX_FMT_YUVJ420P: |
521 return VideoFrame::YV12; | 519 return VideoFrame::YV12J; |
522 case PIX_FMT_YUVA420P: | 520 case PIX_FMT_YUVA420P: |
523 return VideoFrame::YV12A; | 521 return VideoFrame::YV12A; |
524 default: | 522 default: |
525 DVLOG(1) << "Unsupported PixelFormat: " << pixel_format; | 523 DVLOG(1) << "Unsupported PixelFormat: " << pixel_format; |
526 } | 524 } |
527 return VideoFrame::UNKNOWN; | 525 return VideoFrame::UNKNOWN; |
528 } | 526 } |
529 | 527 |
530 PixelFormat VideoFormatToPixelFormat(VideoFrame::Format video_format) { | 528 PixelFormat VideoFormatToPixelFormat(VideoFrame::Format video_format) { |
531 switch (video_format) { | 529 switch (video_format) { |
532 case VideoFrame::YV16: | 530 case VideoFrame::YV16: |
533 return PIX_FMT_YUV422P; | 531 return PIX_FMT_YUV422P; |
534 case VideoFrame::YV12: | 532 case VideoFrame::YV12: |
535 return PIX_FMT_YUV420P; | 533 return PIX_FMT_YUV420P; |
| 534 case VideoFrame::YV12J: |
| 535 return PIX_FMT_YUVJ420P; |
536 case VideoFrame::YV12A: | 536 case VideoFrame::YV12A: |
537 return PIX_FMT_YUVA420P; | 537 return PIX_FMT_YUVA420P; |
538 default: | 538 default: |
539 DVLOG(1) << "Unsupported VideoFrame::Format: " << video_format; | 539 DVLOG(1) << "Unsupported VideoFrame::Format: " << video_format; |
540 } | 540 } |
541 return PIX_FMT_NONE; | 541 return PIX_FMT_NONE; |
542 } | 542 } |
543 | 543 |
544 } // namespace media | 544 } // namespace media |
OLD | NEW |