Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Side by Side Diff: media/base/video_decoder_config.h

Issue 1786733004: Revert of media config: expand is_encrypted to a struct. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/base/test_helpers.cc ('k') | media/base/video_decoder_config.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
15 #include "media/base/media_export.h" 14 #include "media/base/media_export.h"
16 #include "media/base/video_codecs.h" 15 #include "media/base/video_codecs.h"
17 #include "media/base/video_types.h" 16 #include "media/base/video_types.h"
18 #include "ui/gfx/geometry/rect.h" 17 #include "ui/gfx/geometry/rect.h"
19 #include "ui/gfx/geometry/size.h" 18 #include "ui/gfx/geometry/size.h"
20 19
21 namespace media { 20 namespace media {
22 21
23 MEDIA_EXPORT VideoCodec 22 MEDIA_EXPORT VideoCodec
24 VideoCodecProfileToVideoCodec(VideoCodecProfile profile); 23 VideoCodecProfileToVideoCodec(VideoCodecProfile profile);
25 24
26 class MEDIA_EXPORT VideoDecoderConfig { 25 class MEDIA_EXPORT VideoDecoderConfig {
27 public: 26 public:
28 // Constructs an uninitialized object. Clients should call Initialize() with 27 // Constructs an uninitialized object. Clients should call Initialize() with
29 // appropriate values before using. 28 // appropriate values before using.
30 VideoDecoderConfig(); 29 VideoDecoderConfig();
31 30
32 // Constructs an initialized object. It is acceptable to pass in NULL for 31 // Constructs an initialized object. It is acceptable to pass in NULL for
33 // |extra_data|, otherwise the memory is copied. 32 // |extra_data|, otherwise the memory is copied.
34 VideoDecoderConfig(VideoCodec codec, 33 VideoDecoderConfig(VideoCodec codec,
35 VideoCodecProfile profile, 34 VideoCodecProfile profile,
36 VideoPixelFormat format, 35 VideoPixelFormat format,
37 ColorSpace color_space, 36 ColorSpace color_space,
38 const gfx::Size& coded_size, 37 const gfx::Size& coded_size,
39 const gfx::Rect& visible_rect, 38 const gfx::Rect& visible_rect,
40 const gfx::Size& natural_size, 39 const gfx::Size& natural_size,
41 const std::vector<uint8_t>& extra_data, 40 const std::vector<uint8_t>& extra_data,
42 const EncryptionScheme& encryption_scheme); 41 bool is_encrypted);
43 42
44 VideoDecoderConfig(const VideoDecoderConfig& other); 43 VideoDecoderConfig(const VideoDecoderConfig& other);
45 44
46 ~VideoDecoderConfig(); 45 ~VideoDecoderConfig();
47 46
48 // Resets the internal state of this object. 47 // Resets the internal state of this object.
49 void Initialize(VideoCodec codec, 48 void Initialize(VideoCodec codec,
50 VideoCodecProfile profile, 49 VideoCodecProfile profile,
51 VideoPixelFormat format, 50 VideoPixelFormat format,
52 ColorSpace color_space, 51 ColorSpace color_space,
53 const gfx::Size& coded_size, 52 const gfx::Size& coded_size,
54 const gfx::Rect& visible_rect, 53 const gfx::Rect& visible_rect,
55 const gfx::Size& natural_size, 54 const gfx::Size& natural_size,
56 const std::vector<uint8_t>& extra_data, 55 const std::vector<uint8_t>& extra_data,
57 const EncryptionScheme& encryption_scheme); 56 bool is_encrypted);
58 57
59 // Returns true if this object has appropriate configuration values, false 58 // Returns true if this object has appropriate configuration values, false
60 // otherwise. 59 // otherwise.
61 bool IsValidConfig() const; 60 bool IsValidConfig() const;
62 61
63 // Returns true if all fields in |config| match this config. 62 // Returns true if all fields in |config| match this config.
64 // Note: The contents of |extra_data_| are compared not the raw pointers. 63 // Note: The contents of |extra_data_| are compared not the raw pointers.
65 bool Matches(const VideoDecoderConfig& config) const; 64 bool Matches(const VideoDecoderConfig& config) const;
66 65
67 // Returns a human-readable string describing |*this|. For debugging & test 66 // Returns a human-readable string describing |*this|. For debugging & test
(...skipping 26 matching lines...) Expand all
94 // into account. 93 // into account.
95 gfx::Size natural_size() const { return natural_size_; } 94 gfx::Size natural_size() const { return natural_size_; }
96 95
97 // Optional byte data required to initialize video decoders, such as H.264 96 // Optional byte data required to initialize video decoders, such as H.264
98 // AAVC data. 97 // AAVC data.
99 const std::vector<uint8_t>& extra_data() const { return extra_data_; } 98 const std::vector<uint8_t>& extra_data() const { return extra_data_; }
100 99
101 // Whether the video stream is potentially encrypted. 100 // Whether the video stream is potentially encrypted.
102 // Note that in a potentially encrypted video stream, individual buffers 101 // Note that in a potentially encrypted video stream, individual buffers
103 // can be encrypted or not encrypted. 102 // can be encrypted or not encrypted.
104 bool is_encrypted() const { return encryption_scheme_.is_encrypted(); } 103 bool is_encrypted() const { return is_encrypted_; }
105
106 // Encryption scheme used for encrypted buffers.
107 const EncryptionScheme& encryption_scheme() const {
108 return encryption_scheme_;
109 }
110 104
111 private: 105 private:
112 VideoCodec codec_; 106 VideoCodec codec_;
113 VideoCodecProfile profile_; 107 VideoCodecProfile profile_;
114 108
115 VideoPixelFormat format_; 109 VideoPixelFormat format_;
116 ColorSpace color_space_; 110 ColorSpace color_space_;
117 111
118 gfx::Size coded_size_; 112 gfx::Size coded_size_;
119 gfx::Rect visible_rect_; 113 gfx::Rect visible_rect_;
120 gfx::Size natural_size_; 114 gfx::Size natural_size_;
121 115
122 std::vector<uint8_t> extra_data_; 116 std::vector<uint8_t> extra_data_;
123 117
124 EncryptionScheme encryption_scheme_; 118 bool is_encrypted_;
125 119
126 // 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
127 // generated copy constructor and assignment operator. Since the extra data is 121 // generated copy constructor and assignment operator. Since the extra data is
128 // typically small, the performance impact is minimal. 122 // typically small, the performance impact is minimal.
129 }; 123 };
130 124
131 } // namespace media 125 } // namespace media
132 126
133 #endif // MEDIA_BASE_VIDEO_DECODER_CONFIG_H_ 127 #endif // MEDIA_BASE_VIDEO_DECODER_CONFIG_H_
OLDNEW
« no previous file with comments | « media/base/test_helpers.cc ('k') | media/base/video_decoder_config.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698