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

Side by Side Diff: media/video/video_decode_accelerator.h

Issue 1963903002: Remove VideoDecodeAccelerator::SetCdm() and pass the cdm in Initialize() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add cdm_id to paramtraits Created 4 years, 7 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
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_VIDEO_VIDEO_DECODE_ACCELERATOR_H_ 5 #ifndef MEDIA_VIDEO_VIDEO_DECODE_ACCELERATOR_H_
6 #define MEDIA_VIDEO_VIDEO_DECODE_ACCELERATOR_H_ 6 #define MEDIA_VIDEO_VIDEO_DECODE_ACCELERATOR_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "media/base/bitstream_buffer.h" 15 #include "media/base/bitstream_buffer.h"
16 #include "media/base/cdm_context.h"
16 #include "media/base/surface_manager.h" 17 #include "media/base/surface_manager.h"
17 #include "media/base/video_decoder_config.h" 18 #include "media/base/video_decoder_config.h"
18 #include "media/video/picture.h" 19 #include "media/video/picture.h"
19 #include "ui/gfx/geometry/size.h" 20 #include "ui/gfx/geometry/size.h"
20 #include "ui/gfx/gpu_memory_buffer.h" 21 #include "ui/gfx/gpu_memory_buffer.h"
21 22
22 typedef unsigned int GLenum; 23 typedef unsigned int GLenum;
23 24
24 namespace base { 25 namespace base {
25 class SingleThreadTaskRunner; 26 class SingleThreadTaskRunner;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 // for PictureBuffers at the time of AssignPictureBuffers() call. 109 // for PictureBuffers at the time of AssignPictureBuffers() call.
109 // When set to IMPORT, the VDA will not allocate, but after receiving 110 // When set to IMPORT, the VDA will not allocate, but after receiving
110 // AssignPictureBuffers() call, it will expect a call to 111 // AssignPictureBuffers() call, it will expect a call to
111 // ImportBufferForPicture() for each PictureBuffer before use. 112 // ImportBufferForPicture() for each PictureBuffer before use.
112 enum class OutputMode { 113 enum class OutputMode {
113 ALLOCATE, 114 ALLOCATE,
114 IMPORT, 115 IMPORT,
115 }; 116 };
116 117
117 Config() = default; 118 Config() = default;
119
120 // Intentional converting constructor.
121 // TODO(watk): Make this explicit.
118 Config(VideoCodecProfile profile); 122 Config(VideoCodecProfile profile);
119 Config(const VideoDecoderConfig& video_decoder_config);
120 123
121 std::string AsHumanReadableString() const; 124 std::string AsHumanReadableString() const;
122 125
123 // |profile| combines the information about the codec and its profile. 126 // The video codec and profile.
124 VideoCodecProfile profile = VIDEO_CODEC_PROFILE_UNKNOWN; 127 VideoCodecProfile profile = VIDEO_CODEC_PROFILE_UNKNOWN;
125 128
126 // The flag indicating whether the stream is encrypted. 129 // Whether the stream is encrypted.
127 bool is_encrypted = false; 130 bool is_encrypted = false;
128 131
129 // The flag indicating whether the client supports deferred initialization 132 // The CDM that the VDA should use to decode encrypted streams. Must be
130 // or not. 133 // set to a valid ID if |is_encrypted|.
134 int cdm_id = CdmContext::kInvalidCdmId;
135
136 // Whether the client supports deferred initialization.
131 bool is_deferred_initialization_allowed = false; 137 bool is_deferred_initialization_allowed = false;
132 138
133 // An optional graphics surface that the VDA should render to. For setting 139 // An optional graphics surface that the VDA should render to. For setting
134 // an output SurfaceView on Android. It's only valid when not equal to 140 // an output SurfaceView on Android. It's only valid when not equal to
135 // |kNoSurfaceID|. 141 // |kNoSurfaceID|.
136 int surface_id = kNoSurfaceID; 142 int surface_id = kNoSurfaceID;
137 143
138 // Coded size of the video frame hint, subject to change. 144 // Coded size of the video frame hint, subject to change.
139 gfx::Size initial_expected_coded_size = gfx::Size(320, 240); 145 gfx::Size initial_expected_coded_size = gfx::Size(320, 240);
140 146
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 // decoder construction. This call is synchronous and returns true iff 203 // decoder construction. This call is synchronous and returns true iff
198 // initialization is successful, unless deferred initialization is used. 204 // initialization is successful, unless deferred initialization is used.
199 // 205 //
200 // By default, deferred initialization is not used. However, if Config:: 206 // By default, deferred initialization is not used. However, if Config::
201 // is_deferred_initialization_allowed is set by the client, and if 207 // is_deferred_initialization_allowed is set by the client, and if
202 // Capabilities::Flags::SUPPORTS_DEFERRED_INITIALIZATION is set by the VDA, 208 // Capabilities::Flags::SUPPORTS_DEFERRED_INITIALIZATION is set by the VDA,
203 // and if VDA::Initialize returns true, then the client can expect a call to 209 // and if VDA::Initialize returns true, then the client can expect a call to
204 // NotifyInitializationComplete with the actual success / failure of 210 // NotifyInitializationComplete with the actual success / failure of
205 // initialization. Note that a return value of false from VDA::Initialize 211 // initialization. Note that a return value of false from VDA::Initialize
206 // indicates that initialization definitely failed, and no callback is needed. 212 // indicates that initialization definitely failed, and no callback is needed.
207 // TODO(liberato): should we say that encrypted video requires deferred?
208 // 213 //
209 // For encrpyted video, the decoder needs a CDM to be able to decode encrypted 214 // For encrypted video, only deferred initialization is supported and |config|
210 // buffers. SetCdm() should be called after Initialize() to set such a CDM. 215 // must contain a valid |cdm_id|.
211 // Client::NotifyCdmAttached() will then be called to indicate whether the CDM
212 // is successfully attached to the decoder. Only when a CDM is successfully
213 // attached can we start to decode.
214 // 216 //
215 // Parameters: 217 // Parameters:
216 // |config| contains the initialization parameters. 218 // |config| contains the initialization parameters.
217 // |client| is the client of this video decoder. Does not take ownership of 219 // |client| is the client of this video decoder. Does not take ownership of
218 // |client| which must be valid until Destroy() is called. 220 // |client| which must be valid until Destroy() is called.
219 virtual bool Initialize(const Config& config, Client* client) = 0; 221 virtual bool Initialize(const Config& config, Client* client) = 0;
220 222
221 // Sets a CDM to be used by the decoder to decode encrypted buffers.
222 // Client::NotifyCdmAttached() will then be called to indicate whether the CDM
223 // is successfully attached to the decoder. The default implementation is a
224 // no-op since most VDAs don't support encrypted video.
225 virtual void SetCdm(int cdm_id);
226
227 // Decodes given bitstream buffer that contains at most one frame. Once 223 // Decodes given bitstream buffer that contains at most one frame. Once
228 // decoder is done with processing |bitstream_buffer| it will call 224 // decoder is done with processing |bitstream_buffer| it will call
229 // NotifyEndOfBitstreamBuffer() with the bitstream buffer id. 225 // NotifyEndOfBitstreamBuffer() with the bitstream buffer id.
230 // Parameters: 226 // Parameters:
231 // |bitstream_buffer| is the input bitstream that is sent for decoding. 227 // |bitstream_buffer| is the input bitstream that is sent for decoding.
232 virtual void Decode(const BitstreamBuffer& bitstream_buffer) = 0; 228 virtual void Decode(const BitstreamBuffer& bitstream_buffer) = 0;
233 229
234 // Assigns a set of texture-backed picture buffers to the video decoder. 230 // Assigns a set of texture-backed picture buffers to the video decoder.
235 // 231 //
236 // Ownership of each picture buffer remains with the client, but the client 232 // Ownership of each picture buffer remains with the client, but the client
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 // std::unique_ptr<VideoDecodeAccelerator> uses "Destroy()" instead of trying to 335 // std::unique_ptr<VideoDecodeAccelerator> uses "Destroy()" instead of trying to
340 // use the destructor. 336 // use the destructor.
341 template <> 337 template <>
342 struct MEDIA_EXPORT default_delete<media::VideoDecodeAccelerator> { 338 struct MEDIA_EXPORT default_delete<media::VideoDecodeAccelerator> {
343 void operator()(media::VideoDecodeAccelerator* vda) const; 339 void operator()(media::VideoDecodeAccelerator* vda) const;
344 }; 340 };
345 341
346 } // namespace std 342 } // namespace std
347 343
348 #endif // MEDIA_VIDEO_VIDEO_DECODE_ACCELERATOR_H_ 344 #endif // MEDIA_VIDEO_VIDEO_DECODE_ACCELERATOR_H_
OLDNEW
« no previous file with comments | « media/gpu/ipc/service/gpu_video_decode_accelerator.cc ('k') | media/video/video_decode_accelerator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698