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(); | 44 ~VideoDecoderConfig(); |
| 44 | 45 |
| 45 // Resets the internal state of this object. | 46 // Resets the internal state of this object. |
| 46 void Initialize(VideoCodec codec, | 47 void Initialize(VideoCodec codec, |
| 47 VideoCodecProfile profile, | 48 VideoCodecProfile profile, |
| 48 VideoPixelFormat format, | 49 VideoPixelFormat format, |
| 49 ColorSpace color_space, | 50 ColorSpace color_space, |
| 50 const gfx::Size& coded_size, | 51 const gfx::Size& coded_size, |
| 51 const gfx::Rect& visible_rect, | 52 const gfx::Rect& visible_rect, |
| 52 const gfx::Size& natural_size, | 53 const gfx::Size& natural_size, |
| 53 const std::vector<uint8_t>& extra_data, | 54 const std::vector<uint8_t>& extra_data, |
| 54 bool is_encrypted); | 55 const EncryptionScheme& encryption_scheme); |
| 55 | 56 |
| 56 // Returns true if this object has appropriate configuration values, false | 57 // Returns true if this object has appropriate configuration values, false |
| 57 // otherwise. | 58 // otherwise. |
| 58 bool IsValidConfig() const; | 59 bool IsValidConfig() const; |
| 59 | 60 |
| 60 // Returns true if all fields in |config| match this config. | 61 // Returns true if all fields in |config| match this config. |
| 61 // Note: The contents of |extra_data_| are compared not the raw pointers. | 62 // Note: The contents of |extra_data_| are compared not the raw pointers. |
| 62 bool Matches(const VideoDecoderConfig& config) const; | 63 bool Matches(const VideoDecoderConfig& config) const; |
| 63 | 64 |
| 64 // Returns a human-readable string describing |*this|. For debugging & test | 65 // Returns a human-readable string describing |*this|. For debugging & test |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 91 // into account. | 92 // into account. |
| 92 gfx::Size natural_size() const { return natural_size_; } | 93 gfx::Size natural_size() const { return natural_size_; } |
| 93 | 94 |
| 94 // Optional byte data required to initialize video decoders, such as H.264 | 95 // Optional byte data required to initialize video decoders, such as H.264 |
| 95 // AAVC data. | 96 // AAVC data. |
| 96 const std::vector<uint8_t>& extra_data() const { return extra_data_; } | 97 const std::vector<uint8_t>& extra_data() const { return extra_data_; } |
| 97 | 98 |
| 98 // Whether the video stream is potentially encrypted. | 99 // Whether the video stream is potentially encrypted. |
| 99 // Note that in a potentially encrypted video stream, individual buffers | 100 // Note that in a potentially encrypted video stream, individual buffers |
| 100 // can be encrypted or not encrypted. | 101 // can be encrypted or not encrypted. |
| 101 bool is_encrypted() const { return is_encrypted_; } | 102 bool is_encrypted() const; |
|
ddorwin
2016/03/01 02:17:41
ditto
| |
| 103 | |
| 104 // Encryption scheme used for encrypted buffers. | |
| 105 const EncryptionScheme& encryption_scheme() const { | |
| 106 return encryption_scheme_; | |
| 107 } | |
| 102 | 108 |
| 103 private: | 109 private: |
| 104 VideoCodec codec_; | 110 VideoCodec codec_; |
| 105 VideoCodecProfile profile_; | 111 VideoCodecProfile profile_; |
| 106 | 112 |
| 107 VideoPixelFormat format_; | 113 VideoPixelFormat format_; |
| 108 ColorSpace color_space_; | 114 ColorSpace color_space_; |
| 109 | 115 |
| 110 gfx::Size coded_size_; | 116 gfx::Size coded_size_; |
| 111 gfx::Rect visible_rect_; | 117 gfx::Rect visible_rect_; |
| 112 gfx::Size natural_size_; | 118 gfx::Size natural_size_; |
| 113 | 119 |
| 114 std::vector<uint8_t> extra_data_; | 120 std::vector<uint8_t> extra_data_; |
| 115 | 121 |
| 116 bool is_encrypted_; | 122 EncryptionScheme encryption_scheme_; |
| 117 | 123 |
| 118 // Not using DISALLOW_COPY_AND_ASSIGN here intentionally to allow the compiler | 124 // Not using DISALLOW_COPY_AND_ASSIGN here intentionally to allow the compiler |
| 119 // generated copy constructor and assignment operator. Since the extra data is | 125 // generated copy constructor and assignment operator. Since the extra data is |
| 120 // typically small, the performance impact is minimal. | 126 // typically small, the performance impact is minimal. |
| 121 }; | 127 }; |
| 122 | 128 |
| 123 } // namespace media | 129 } // namespace media |
| 124 | 130 |
| 125 #endif // MEDIA_BASE_VIDEO_DECODER_CONFIG_H_ | 131 #endif // MEDIA_BASE_VIDEO_DECODER_CONFIG_H_ |
| OLD | NEW |