| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef MEDIA_BASE_VIDEO_DECODER_CONFIG_H_ | 5 #ifndef MEDIA_BASE_VIDEO_DECODER_CONFIG_H_ |
| 6 #define MEDIA_BASE_VIDEO_DECODER_CONFIG_H_ | 6 #define MEDIA_BASE_VIDEO_DECODER_CONFIG_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "media/base/media_export.h" | 10 #include "media/base/media_export.h" |
| 11 #include "media/base/video_frame.h" | 11 #include "media/base/video_frame.h" |
| 12 #include "ui/gfx/rect.h" | 12 #include "ui/gfx/rect.h" |
| 13 #include "ui/gfx/size.h" | 13 #include "ui/gfx/size.h" |
| 14 | 14 |
| 15 namespace media { | 15 namespace media { |
| 16 | 16 |
| 17 enum MEDIA_EXPORT VideoCodec { | 17 enum VideoCodec { |
| 18 // These values are histogrammed over time; do not change their ordinal | 18 // These values are histogrammed over time; do not change their ordinal |
| 19 // values. When deleting a codec replace it with a dummy value; when adding a | 19 // values. When deleting a codec replace it with a dummy value; when adding a |
| 20 // codec, do so at the bottom (and update kVideoCodecMax). | 20 // codec, do so at the bottom (and update kVideoCodecMax). |
| 21 kUnknownVideoCodec = 0, | 21 kUnknownVideoCodec = 0, |
| 22 kCodecH264, | 22 kCodecH264, |
| 23 kCodecVC1, | 23 kCodecVC1, |
| 24 kCodecMPEG2, | 24 kCodecMPEG2, |
| 25 kCodecMPEG4, | 25 kCodecMPEG4, |
| 26 kCodecTheora, | 26 kCodecTheora, |
| 27 kCodecVP8, | 27 kCodecVP8, |
| 28 // DO NOT ADD RANDOM VIDEO CODECS! | 28 // DO NOT ADD RANDOM VIDEO CODECS! |
| 29 // | 29 // |
| 30 // The only acceptable time to add a new codec is if there is production code | 30 // The only acceptable time to add a new codec is if there is production code |
| 31 // that uses said codec in the same CL. | 31 // that uses said codec in the same CL. |
| 32 | 32 |
| 33 kVideoCodecMax = kCodecVP8 // Must equal the last "real" codec above. | 33 kVideoCodecMax = kCodecVP8 // Must equal the last "real" codec above. |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 // Video stream profile. This *must* match PP_VideoDecoder_Profile. | |
| 37 enum MEDIA_EXPORT VideoCodecProfile { | |
| 38 // Keep the values in this enum unique, as they imply format (h.264 vs. VP8, | |
| 39 // for example), and keep the values for a particular format grouped | |
| 40 // together for clarity. | |
| 41 VIDEO_CODEC_PROFILE_UNKNOWN = -1, | |
| 42 H264PROFILE_MIN = 0, | |
| 43 H264PROFILE_BASELINE = H264PROFILE_MIN, | |
| 44 H264PROFILE_MAIN, | |
| 45 H264PROFILE_EXTENDED, | |
| 46 H264PROFILE_HIGH, | |
| 47 H264PROFILE_HIGH10PROFILE, | |
| 48 H264PROFILE_HIGH422PROFILE, | |
| 49 H264PROFILE_HIGH444PREDICTIVEPROFILE, | |
| 50 H264PROFILE_SCALABLEBASELINE, | |
| 51 H264PROFILE_SCALABLEHIGH, | |
| 52 H264PROFILE_STEREOHIGH, | |
| 53 H264PROFILE_MULTIVIEWHIGH, | |
| 54 H264PROFILE_MAX = H264PROFILE_MULTIVIEWHIGH, | |
| 55 VIDEO_CODEC_PROFILE_MAX = H264PROFILE_MAX, | |
| 56 }; | |
| 57 | |
| 58 class MEDIA_EXPORT VideoDecoderConfig { | 36 class MEDIA_EXPORT VideoDecoderConfig { |
| 59 public: | 37 public: |
| 60 // Constructs an uninitialized object. Clients should call Initialize() with | 38 // Constructs an uninitialized object. Clients should call Initialize() with |
| 61 // appropriate values before using. | 39 // appropriate values before using. |
| 62 VideoDecoderConfig(); | 40 VideoDecoderConfig(); |
| 63 | 41 |
| 64 // Constructs an initialized object. It is acceptable to pass in NULL for | 42 // Constructs an initialized object. It is acceptable to pass in NULL for |
| 65 // |extra_data|, otherwise the memory is copied. | 43 // |extra_data|, otherwise the memory is copied. |
| 66 VideoDecoderConfig(VideoCodec codec, | 44 VideoDecoderConfig(VideoCodec codec, |
| 67 VideoCodecProfile profile, | |
| 68 VideoFrame::Format format, | 45 VideoFrame::Format format, |
| 69 const gfx::Size& coded_size, | 46 const gfx::Size& coded_size, |
| 70 const gfx::Rect& visible_rect, | 47 const gfx::Rect& visible_rect, |
| 71 int frame_rate_numerator, int frame_rate_denominator, | 48 int frame_rate_numerator, int frame_rate_denominator, |
| 72 int aspect_ratio_numerator, int aspect_ratio_denominator, | 49 int aspect_ratio_numerator, int aspect_ratio_denominator, |
| 73 const uint8* extra_data, size_t extra_data_size); | 50 const uint8* extra_data, size_t extra_data_size); |
| 74 | 51 |
| 75 ~VideoDecoderConfig(); | 52 ~VideoDecoderConfig(); |
| 76 | 53 |
| 77 // Resets the internal state of this object. | 54 // Resets the internal state of this object. |
| 78 void Initialize(VideoCodec codec, | 55 void Initialize(VideoCodec codec, |
| 79 VideoCodecProfile profile, | |
| 80 VideoFrame::Format format, | 56 VideoFrame::Format format, |
| 81 const gfx::Size& coded_size, | 57 const gfx::Size& coded_size, |
| 82 const gfx::Rect& visible_rect, | 58 const gfx::Rect& visible_rect, |
| 83 int frame_rate_numerator, int frame_rate_denominator, | 59 int frame_rate_numerator, int frame_rate_denominator, |
| 84 int aspect_ratio_numerator, int aspect_ratio_denominator, | 60 int aspect_ratio_numerator, int aspect_ratio_denominator, |
| 85 const uint8* extra_data, size_t extra_data_size); | 61 const uint8* extra_data, size_t extra_data_size); |
| 86 | 62 |
| 87 // Returns true if this object has appropriate configuration values, false | 63 // Returns true if this object has appropriate configuration values, false |
| 88 // otherwise. | 64 // otherwise. |
| 89 bool IsValidConfig() const; | 65 bool IsValidConfig() const; |
| 90 | 66 |
| 91 // Returns a human-readable string describing |*this|. For debugging & test | |
| 92 // output only. | |
| 93 std::string AsHumanReadableString() const; | |
| 94 | |
| 95 VideoCodec codec() const; | 67 VideoCodec codec() const; |
| 96 VideoCodecProfile profile() const; | |
| 97 | 68 |
| 98 // Video format used to determine YUV buffer sizes. | 69 // Video format used to determine YUV buffer sizes. |
| 99 VideoFrame::Format format() const; | 70 VideoFrame::Format format() const; |
| 100 | 71 |
| 101 // Width and height of video frame immediately post-decode. Not all pixels | 72 // Width and height of video frame immediately post-decode. Not all pixels |
| 102 // in this region are valid. | 73 // in this region are valid. |
| 103 gfx::Size coded_size() const; | 74 gfx::Size coded_size() const; |
| 104 | 75 |
| 105 // Region of |coded_size_| that is visible. | 76 // Region of |coded_size_| that is visible. |
| 106 gfx::Rect visible_rect() const; | 77 gfx::Rect visible_rect() const; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 124 int aspect_ratio_numerator() const; | 95 int aspect_ratio_numerator() const; |
| 125 int aspect_ratio_denominator() const; | 96 int aspect_ratio_denominator() const; |
| 126 | 97 |
| 127 // Optional byte data required to initialize video decoders, such as H.264 | 98 // Optional byte data required to initialize video decoders, such as H.264 |
| 128 // AAVC data. | 99 // AAVC data. |
| 129 uint8* extra_data() const; | 100 uint8* extra_data() const; |
| 130 size_t extra_data_size() const; | 101 size_t extra_data_size() const; |
| 131 | 102 |
| 132 private: | 103 private: |
| 133 VideoCodec codec_; | 104 VideoCodec codec_; |
| 134 VideoCodecProfile profile_; | |
| 135 | 105 |
| 136 VideoFrame::Format format_; | 106 VideoFrame::Format format_; |
| 137 | 107 |
| 138 gfx::Size coded_size_; | 108 gfx::Size coded_size_; |
| 139 gfx::Rect visible_rect_; | 109 gfx::Rect visible_rect_; |
| 140 gfx::Size natural_size_; | 110 gfx::Size natural_size_; |
| 141 | 111 |
| 142 int frame_rate_numerator_; | 112 int frame_rate_numerator_; |
| 143 int frame_rate_denominator_; | 113 int frame_rate_denominator_; |
| 144 | 114 |
| 145 int aspect_ratio_numerator_; | 115 int aspect_ratio_numerator_; |
| 146 int aspect_ratio_denominator_; | 116 int aspect_ratio_denominator_; |
| 147 | 117 |
| 148 scoped_array<uint8> extra_data_; | 118 scoped_array<uint8> extra_data_; |
| 149 size_t extra_data_size_; | 119 size_t extra_data_size_; |
| 150 | 120 |
| 151 DISALLOW_COPY_AND_ASSIGN(VideoDecoderConfig); | 121 DISALLOW_COPY_AND_ASSIGN(VideoDecoderConfig); |
| 152 }; | 122 }; |
| 153 | 123 |
| 154 } // namespace media | 124 } // namespace media |
| 155 | 125 |
| 156 #endif // MEDIA_BASE_VIDEO_DECODER_CONFIG_H_ | 126 #endif // MEDIA_BASE_VIDEO_DECODER_CONFIG_H_ |
| OLD | NEW |