| 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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 // Note the PRESUBMIT_IGNORE_UMA_MAX below, this silences the PRESUBMIT.py | 401 // Note the PRESUBMIT_IGNORE_UMA_MAX below, this silences the PRESUBMIT.py |
| 402 // check for uma enum max usage, since we're abusing | 402 // check for uma enum max usage, since we're abusing |
| 403 // UMA_HISTOGRAM_ENUMERATION to report a discrete value. | 403 // UMA_HISTOGRAM_ENUMERATION to report a discrete value. |
| 404 UMA_HISTOGRAM_ENUMERATION("Media.VideoColorRange", | 404 UMA_HISTOGRAM_ENUMERATION("Media.VideoColorRange", |
| 405 stream->codec->color_range, | 405 stream->codec->color_range, |
| 406 AVCOL_RANGE_NB); // PRESUBMIT_IGNORE_UMA_MAX | 406 AVCOL_RANGE_NB); // PRESUBMIT_IGNORE_UMA_MAX |
| 407 } | 407 } |
| 408 | 408 |
| 409 VideoPixelFormat format = | 409 VideoPixelFormat format = |
| 410 PixelFormatToVideoPixelFormat(stream->codec->pix_fmt); | 410 PixelFormatToVideoPixelFormat(stream->codec->pix_fmt); |
| 411 // The format and coded size may be unknown if FFmpeg is compiled without |
| 412 // video decoders. |
| 413 #if defined(DISABLE_FFMPEG_VIDEO_DECODERS) |
| 414 if (format == PIXEL_FORMAT_UNKNOWN) |
| 415 format = PIXEL_FORMAT_YV12; |
| 416 if (coded_size == gfx::Size(0, 0)) |
| 417 coded_size = visible_rect.size(); |
| 418 #endif |
| 419 |
| 411 if (codec == kCodecVP9) { | 420 if (codec == kCodecVP9) { |
| 412 // TODO(tomfinegan): libavcodec doesn't know about VP9. | 421 // TODO(tomfinegan): libavcodec doesn't know about VP9. |
| 413 format = PIXEL_FORMAT_YV12; | 422 format = PIXEL_FORMAT_YV12; |
| 414 coded_size = visible_rect.size(); | 423 coded_size = visible_rect.size(); |
| 415 } | 424 } |
| 416 | 425 |
| 417 // Pad out |coded_size| for subsampled YUV formats. | 426 // Pad out |coded_size| for subsampled YUV formats. |
| 418 if (format != PIXEL_FORMAT_YV24) { | 427 if (format != PIXEL_FORMAT_YV24) { |
| 419 coded_size.set_width((coded_size.width() + 1) / 2 * 2); | 428 coded_size.set_width((coded_size.width() + 1) / 2 * 2); |
| 420 if (format != PIXEL_FORMAT_YV16) | 429 if (format != PIXEL_FORMAT_YV16) |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 return false; | 637 return false; |
| 629 | 638 |
| 630 *out = parsed_time; | 639 *out = parsed_time; |
| 631 return true; | 640 return true; |
| 632 } | 641 } |
| 633 | 642 |
| 634 return false; | 643 return false; |
| 635 } | 644 } |
| 636 | 645 |
| 637 } // namespace media | 646 } // namespace media |
| OLD | NEW |