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