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 #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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "media/base/encryption_scheme.h" | |
| 14 #include "media/base/media_export.h" | 15 #include "media/base/media_export.h" |
| 15 #include "media/base/video_codecs.h" | 16 #include "media/base/video_codecs.h" |
| 16 #include "media/base/video_types.h" | 17 #include "media/base/video_types.h" |
| 17 #include "ui/gfx/geometry/rect.h" | 18 #include "ui/gfx/geometry/rect.h" |
| 18 #include "ui/gfx/geometry/size.h" | 19 #include "ui/gfx/geometry/size.h" |
| 19 | 20 |
| 20 namespace media { | 21 namespace media { |
| 21 | 22 |
| 22 MEDIA_EXPORT VideoCodec | 23 MEDIA_EXPORT VideoCodec |
| 23 VideoCodecProfileToVideoCodec(VideoCodecProfile profile); | 24 VideoCodecProfileToVideoCodec(VideoCodecProfile profile); |
| 24 | 25 |
| 25 class MEDIA_EXPORT VideoDecoderConfig { | 26 class MEDIA_EXPORT VideoDecoderConfig { |
| 26 public: | 27 public: |
| 27 // Constructs an uninitialized object. Clients should call Initialize() with | 28 // Constructs an uninitialized object. Clients should call Initialize() with |
| 28 // appropriate values before using. | 29 // appropriate values before using. |
| 29 VideoDecoderConfig(); | 30 VideoDecoderConfig(); |
| 30 | 31 |
| 31 // Constructs an initialized object. It is acceptable to pass in NULL for | 32 // Constructs an initialized object. It is acceptable to pass in NULL for |
| 32 // |extra_data|, otherwise the memory is copied. | 33 // |extra_data|, otherwise the memory is copied. |
| 33 VideoDecoderConfig(VideoCodec codec, | 34 VideoDecoderConfig(VideoCodec codec, |
| 34 VideoCodecProfile profile, | 35 VideoCodecProfile profile, |
| 35 VideoPixelFormat format, | 36 VideoPixelFormat format, |
| 36 ColorSpace color_space, | 37 ColorSpace color_space, |
| 37 const gfx::Size& coded_size, | 38 const gfx::Size& coded_size, |
| 38 const gfx::Rect& visible_rect, | 39 const gfx::Rect& visible_rect, |
| 39 const gfx::Size& natural_size, | 40 const gfx::Size& natural_size, |
| 40 const std::vector<uint8_t>& extra_data, | 41 const std::vector<uint8_t>& extra_data, |
| 41 bool is_encrypted); | 42 const EncryptionScheme& encryption_scheme); |
| 42 | 43 |
| 43 VideoDecoderConfig(const VideoDecoderConfig& other); | 44 VideoDecoderConfig(const VideoDecoderConfig& other); |
| 44 | 45 |
| 45 ~VideoDecoderConfig(); | 46 ~VideoDecoderConfig(); |
| 46 | 47 |
| 47 // Resets the internal state of this object. | 48 // Resets the internal state of this object. |
| 48 void Initialize(VideoCodec codec, | 49 void Initialize(VideoCodec codec, |
| 49 VideoCodecProfile profile, | 50 VideoCodecProfile profile, |
| 50 VideoPixelFormat format, | 51 VideoPixelFormat format, |
| 51 ColorSpace color_space, | 52 ColorSpace color_space, |
| 52 const gfx::Size& coded_size, | 53 const gfx::Size& coded_size, |
| 53 const gfx::Rect& visible_rect, | 54 const gfx::Rect& visible_rect, |
| 54 const gfx::Size& natural_size, | 55 const gfx::Size& natural_size, |
| 55 const std::vector<uint8_t>& extra_data, | 56 const std::vector<uint8_t>& extra_data, |
| 56 bool is_encrypted); | 57 const EncryptionScheme& encryption_scheme); |
| 57 | 58 |
| 58 // Returns true if this object has appropriate configuration values, false | 59 // Returns true if this object has appropriate configuration values, false |
| 59 // otherwise. | 60 // otherwise. |
| 60 bool IsValidConfig() const; | 61 bool IsValidConfig() const; |
| 61 | 62 |
| 62 // Returns true if all fields in |config| match this config. | 63 // Returns true if all fields in |config| match this config. |
| 63 // Note: The contents of |extra_data_| are compared not the raw pointers. | 64 // Note: The contents of |extra_data_| are compared not the raw pointers. |
| 64 bool Matches(const VideoDecoderConfig& config) const; | 65 bool Matches(const VideoDecoderConfig& config) const; |
| 65 | 66 |
| 66 // Returns a human-readable string describing |*this|. For debugging & test | 67 // Returns a human-readable string describing |*this|. For debugging & test |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 93 // into account. | 94 // into account. |
| 94 gfx::Size natural_size() const { return natural_size_; } | 95 gfx::Size natural_size() const { return natural_size_; } |
| 95 | 96 |
| 96 // Optional byte data required to initialize video decoders, such as H.264 | 97 // Optional byte data required to initialize video decoders, such as H.264 |
| 97 // AAVC data. | 98 // AAVC data. |
| 98 const std::vector<uint8_t>& extra_data() const { return extra_data_; } | 99 const std::vector<uint8_t>& extra_data() const { return extra_data_; } |
| 99 | 100 |
| 100 // Whether the video stream is potentially encrypted. | 101 // Whether the video stream is potentially encrypted. |
| 101 // Note that in a potentially encrypted video stream, individual buffers | 102 // Note that in a potentially encrypted video stream, individual buffers |
| 102 // can be encrypted or not encrypted. | 103 // can be encrypted or not encrypted. |
| 103 bool is_encrypted() const { return is_encrypted_; } | 104 bool is_encrypted() const; |
|
ddorwin
2016/03/02 23:24:05
ditto on finding places where we expect true in th
| |
| 105 | |
| 106 // Encryption scheme used for encrypted buffers. | |
| 107 const EncryptionScheme& encryption_scheme() const { | |
| 108 return encryption_scheme_; | |
| 109 } | |
| 104 | 110 |
| 105 private: | 111 private: |
| 106 VideoCodec codec_; | 112 VideoCodec codec_; |
| 107 VideoCodecProfile profile_; | 113 VideoCodecProfile profile_; |
| 108 | 114 |
| 109 VideoPixelFormat format_; | 115 VideoPixelFormat format_; |
| 110 ColorSpace color_space_; | 116 ColorSpace color_space_; |
| 111 | 117 |
| 112 gfx::Size coded_size_; | 118 gfx::Size coded_size_; |
| 113 gfx::Rect visible_rect_; | 119 gfx::Rect visible_rect_; |
| 114 gfx::Size natural_size_; | 120 gfx::Size natural_size_; |
| 115 | 121 |
| 116 std::vector<uint8_t> extra_data_; | 122 std::vector<uint8_t> extra_data_; |
| 117 | 123 |
| 118 bool is_encrypted_; | 124 EncryptionScheme encryption_scheme_; |
| 119 | 125 |
| 120 // Not using DISALLOW_COPY_AND_ASSIGN here intentionally to allow the compiler | 126 // Not using DISALLOW_COPY_AND_ASSIGN here intentionally to allow the compiler |
| 121 // generated copy constructor and assignment operator. Since the extra data is | 127 // generated copy constructor and assignment operator. Since the extra data is |
| 122 // typically small, the performance impact is minimal. | 128 // typically small, the performance impact is minimal. |
| 123 }; | 129 }; |
| 124 | 130 |
| 125 } // namespace media | 131 } // namespace media |
| 126 | 132 |
| 127 #endif // MEDIA_BASE_VIDEO_DECODER_CONFIG_H_ | 133 #endif // MEDIA_BASE_VIDEO_DECODER_CONFIG_H_ |
| OLD | NEW |