Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "media/base/bitstream_buffer.h" | 12 #include "media/base/bitstream_buffer.h" |
| 13 #include "media/video/picture.h" | |
| 13 #include "ui/gfx/size.h" | 14 #include "ui/gfx/size.h" |
| 14 | 15 |
| 15 namespace media { | 16 namespace media { |
| 16 | 17 |
| 17 typedef Callback0::Type VideoDecodeAcceleratorCallback; | 18 typedef Callback0::Type VideoDecodeAcceleratorCallback; |
| 18 | 19 |
| 19 // Enumeration defining global dictionary ranges for various purposes that are | 20 // Enumeration defining global dictionary ranges for various purposes that are |
| 20 // used to handle the configurations of the video decoder. | 21 // used to handle the configurations of the video decoder. |
| 21 enum VideoAttributeKey { | 22 enum VideoAttributeKey { |
| 22 VIDEOATTRIBUTEKEY_TERMINATOR = 0, | 23 VIDEOATTRIBUTEKEY_TERMINATOR = 0, |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 65 VIDEOATTRIBUTEKEY_BITSTREAMFORMAT_H264_FEATURE_FMO, | 66 VIDEOATTRIBUTEKEY_BITSTREAMFORMAT_H264_FEATURE_FMO, |
| 66 // H264 tool called Arbitrary Slice Ordering. | 67 // H264 tool called Arbitrary Slice Ordering. |
| 67 VIDEOATTRIBUTEKEY_BITSTREAMFORMAT_H264_FEATURE_ASO, | 68 VIDEOATTRIBUTEKEY_BITSTREAMFORMAT_H264_FEATURE_ASO, |
| 68 // H264 tool called Interlacing. | 69 // H264 tool called Interlacing. |
| 69 VIDEOATTRIBUTEKEY_BITSTREAMFORMAT_H264_FEATURE_INTERLACE, | 70 VIDEOATTRIBUTEKEY_BITSTREAMFORMAT_H264_FEATURE_INTERLACE, |
| 70 // H264 tool called Context-Adaptive Binary Arithmetic Coding. | 71 // H264 tool called Context-Adaptive Binary Arithmetic Coding. |
| 71 VIDEOATTRIBUTEKEY_BITSTREAMFORMAT_H264_FEATURE_CABAC, | 72 VIDEOATTRIBUTEKEY_BITSTREAMFORMAT_H264_FEATURE_CABAC, |
| 72 // H264 tool called Weighted Prediction. | 73 // H264 tool called Weighted Prediction. |
| 73 VIDEOATTRIBUTEKEY_BITSTREAMFORMAT_H264_FEATURE_WEIGHTEDPREDICTION, | 74 VIDEOATTRIBUTEKEY_BITSTREAMFORMAT_H264_FEATURE_WEIGHTEDPREDICTION, |
| 74 | 75 |
| 75 VIDEOATTRIBUTEKEY_COLORFORMAT_BASE = 0x1000, | 76 VIDEOATTRIBUTEKEY_COLOR_FORMAT_BASE = 0x1000, |
| 76 // Keys for definining attributes of a color buffer. Using these attributes | 77 // This specifies the output color format for a decoded frame. |
| 77 // users can define color spaces in terms of red, green, blue and alpha | 78 // When used in GetConfigs, this represents the color types the |
| 78 // components as well as with combination of luma and chroma values with | 79 // Decode is capable of decoding. |
| 79 // different subsampling schemes. Also planar, semiplanar and interleaved | 80 VIDEOATTRIBUTEKEY_COLORFORMAT_RGBA, |
| 80 // formats can be described by using the provided keys as instructed. | |
| 81 // | |
| 82 // Rules for describing the color planes (1 or more) that constitute the whole | |
| 83 // picture are: | |
| 84 // 1. Each plane starts with VIDEOATTRIBUTEKEY_COLORFORMAT_PLANE_PIXEL_SIZE | |
| 85 // attribute telling how many bits per pixel the plane contains. | |
| 86 // 2. VIDEOATTRIBUTEKEY_COLORFORMAT_PLANE_PIXEL_SIZE attribute must be | |
| 87 // followed either by | |
| 88 // a. Red, green and blue components followed optionally by alpha size | |
| 89 // attribute. | |
| 90 // OR | |
| 91 // b. Luma, blue difference chroma and red difference chroma components as | |
| 92 // well as three sampling reference factors that tell how the chroma may | |
| 93 // have been subsampled with respect to luma. | |
| 94 // 3. Description must be terminated with VIDEOATTRIBUTEKEY_COLORFORMAT_NONE | |
| 95 // key with no value for attribute. | |
| 96 // | |
| 97 // For example, semiplanar YCbCr 4:2:2 (2 planes, one containing 8-bit luma, | |
| 98 // the other containing two interleaved chroma data components) may be | |
| 99 // described with the following attributes: | |
| 100 // { | |
| 101 // VIDEOATTRIBUTEKEY_COLORFORMAT_PLANE_PIXEL_SIZE, 8, | |
| 102 // VIDEOATTRIBUTEKEY_COLORFORMAT_LUMA_SIZE, 8, | |
| 103 // VIDEOATTRIBUTEKEY_COLORFORMAT_PLANE_PIXEL_SIZE, 16, | |
| 104 // VIDEOATTRIBUTEKEY_COLORFORMAT_CHROMA_BLUE_SIZE, 8, | |
| 105 // VIDEOATTRIBUTEKEY_COLORFORMAT_CHROMA_RED_SIZE, 8, | |
| 106 // VIDEOATTRIBUTEKEY_COLORFORMAT_HORIZONTAL_SAMPLING_FACTOR_REFERENCE, 4, | |
| 107 // VIDEOATTRIBUTEKEY_COLORFORMAT_CHROMA_HORIZONTAL_SUBSAMPLING_FACTOR, 2, | |
| 108 // VIDEOATTRIBUTEKEY_COLORFORMAT_CHROMA_VERTICAL_SUBSAMPLING_FACTOR, 2 | |
| 109 // VIDEOATTRIBUTEKEY_TERMINATOR | |
| 110 // } | |
| 111 // | |
| 112 // Another example, commonly known 16-bit RGB 565 color format may be | |
| 113 // specified as follows: | |
| 114 // { | |
| 115 // VIDEOATTRIBUTEKEY_COLORFORMAT_PLANE_PIXEL_SIZE, 16, | |
| 116 // VIDEOATTRIBUTEKEY_COLORFORMAT_RED_SIZE, 5, | |
| 117 // VIDEOATTRIBUTEKEY_COLORFORMAT_GREEN_SIZE, 6, | |
| 118 // VIDEOATTRIBUTEKEY_COLORFORMAT_BLUE_SIZE, 5, | |
| 119 // VIDEOATTRIBUTEKEY_TERMINATOR | |
| 120 // } | |
| 121 // Total color component bits per pixel in the picture buffer. | |
| 122 VIDEOATTRIBUTEKEY_COLORFORMAT_PLANE_PIXEL_SIZE, | |
| 123 // Bits of red per pixel in picture buffer. | |
| 124 VIDEOATTRIBUTEKEY_COLORFORMAT_RED_SIZE, | |
| 125 // Bits of green per pixel in picture buffer. | |
| 126 VIDEOATTRIBUTEKEY_COLORFORMAT_GREEN_SIZE, | |
| 127 // Bits of blue per pixel in picture buffer. | |
| 128 VIDEOATTRIBUTEKEY_COLORFORMAT_BLUE_SIZE, | |
| 129 // Bits of alpha in color buffer. | |
| 130 VIDEOATTRIBUTEKEY_COLORFORMAT_ALPHA_SIZE, | |
| 131 // Bits of luma per pixel in color buffer. | |
| 132 VIDEOATTRIBUTEKEY_COLORFORMAT_LUMA_SIZE, | |
| 133 // Bits of blue difference chroma (Cb) data in color buffer. | |
| 134 VIDEOATTRIBUTEKEY_COLORFORMAT_CHROMA_BLUE_SIZE, | |
| 135 // Bits of blue difference chroma (Cr) data in color buffer. | |
| 136 VIDEOATTRIBUTEKEY_COLORFORMAT_CHROMA_RED_SIZE, | |
| 137 // Three keys to describe the subsampling of YCbCr sampled digital video | |
| 138 // signal. For example, 4:2:2 sampling could be defined by setting: | |
| 139 // VIDEOATTRIBUTEKEY_COLORFORMAT_HORIZONTAL_SAMPLING_FACTOR_REFERENCE = 4 | |
| 140 // VIDEOATTRIBUTEKEY_COLORFORMAT_CHROMINANCE_HORIZONTAL_SUBSAMPLING_FACTOR = 2 | |
| 141 // VIDEOATTRIBUTEKEY_COLORFORMAT_CHROMINANCE_VERTICAL_SUBSAMPLING_FACTOR = 2 | |
| 142 VIDEOATTRIBUTEKEY_COLORFORMAT_HORIZONTAL_SAMPLING_FACTOR_REFERENCE, | |
| 143 VIDEOATTRIBUTEKEY_COLORFORMAT_CHROMA_HORIZONTAL_SUBSAMPLING_FACTOR, | |
| 144 VIDEOATTRIBUTEKEY_COLORFORMAT_CHROMA_VERTICAL_SUBSAMPLING_FACTOR, | |
| 145 // Base for telling implementation specific information about the optimal | |
| 146 // number of picture buffers to be provided to the implementation. | |
| 147 VIDEOATTRIBUTEKEY_PICTUREBUFFER_REQUIREMENTS_BASE = 0x10000, | |
| 148 // Following two keys are used to signal how many buffers are needed by the | |
| 149 // implementation as a function of the maximum number of reference frames set | |
| 150 // by the stream. Number of required buffers is | |
| 151 // MAX_REF_FRAMES * REFERENCE_PIC_MULTIPLIER + ADDITIONAL_BUFFERS | |
| 152 VIDEOATTRIBUTEKEY_PICTUREBUFFER_REQUIREMENTS_ADDITIONAL_BUFFERS, | |
| 153 VIDEOATTRIBUTEKEY_PICTUREBUFFER_REQUIREMENTS_REFERENCE_PIC_MULTIPLIER, | |
| 154 // If decoder does not support pixel accurate strides for picture buffer, this | |
| 155 // parameter tells the stride multiple that is needed by the decoder. Plugin | |
| 156 // must obey the given stride in its picture buffer allocations. | |
| 157 VIDEOATTRIBUTEKEY_PICTUREBUFFER_REQUIREMENTS_STRIDE_MULTIPLE, | |
| 158 }; | 81 }; |
| 159 | 82 |
| 160 enum VideoCodecFourcc { | 83 enum VideoCodecFourcc { |
| 161 VIDEOCODECFOURCC_NONE = 0, | 84 VIDEOCODECFOURCC_NONE = 0, |
| 162 VIDEOCODECFOURCC_VP8 = 0x00385056, // a.k.a. Fourcc 'VP8\0'. | 85 VIDEOCODECFOURCC_VP8 = 0x00385056, // a.k.a. Fourcc 'VP8\0'. |
| 163 VIDEOCODECFOURCC_H264 = 0x31637661, // a.k.a. Fourcc 'avc1'. | 86 VIDEOCODECFOURCC_H264 = 0x31637661, // a.k.a. Fourcc 'avc1'. |
| 164 }; | 87 }; |
| 165 | 88 |
| 166 // VP8 specific information to be carried over the APIs. | 89 // VP8 specific information to be carried over the APIs. |
| 167 // Enumeration for flags defining supported VP8 profiles. | 90 // Enumeration for flags defining supported VP8 profiles. |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 221 H264PAYLOADFORMAT_ONE_NALU_PER_BUFFER = 1 << 1, | 144 H264PAYLOADFORMAT_ONE_NALU_PER_BUFFER = 1 << 1, |
| 222 // NALU separated by 1-byte interleaved length field. | 145 // NALU separated by 1-byte interleaved length field. |
| 223 H264PAYLOADFORMAT_ONE_BYTE_INTERLEAVED_LENGTH = 1 << 2, | 146 H264PAYLOADFORMAT_ONE_BYTE_INTERLEAVED_LENGTH = 1 << 2, |
| 224 // NALU separated by 2-byte interleaved length field. | 147 // NALU separated by 2-byte interleaved length field. |
| 225 H264PAYLOADFORMAT_TWO_BYTE_INTERLEAVED_LENGTH = 1 << 3, | 148 H264PAYLOADFORMAT_TWO_BYTE_INTERLEAVED_LENGTH = 1 << 3, |
| 226 // NALU separated by 4-byte interleaved length field. | 149 // NALU separated by 4-byte interleaved length field. |
| 227 H264PAYLOADFORMAT_FOUR_BYTE_INTERLEAVED_LENGTH = 1 << 4, | 150 H264PAYLOADFORMAT_FOUR_BYTE_INTERLEAVED_LENGTH = 1 << 4, |
| 228 }; | 151 }; |
| 229 | 152 |
| 230 // Video decoder interface. | 153 // Video decoder interface. |
| 231 // TODO(vmr): Move much of the inner classes to media namespace to simplify code | |
| 232 // that's using it. | |
| 233 class VideoDecodeAccelerator { | 154 class VideoDecodeAccelerator { |
| 234 public: | 155 public: |
| 235 virtual ~VideoDecodeAccelerator(); | 156 virtual ~VideoDecodeAccelerator(); |
| 236 | 157 |
| 237 // Enumeration of potential errors generated by the API. | 158 // Enumeration of potential errors generated by the API. |
| 238 enum Error { | 159 enum Error { |
| 239 VIDEODECODERERROR_NONE = 0, | 160 VIDEODECODERERROR_NONE = 0, |
| 240 VIDEODECODERERROR_UNINITIALIZED, | 161 VIDEODECODERERROR_UNINITIALIZED, |
| 241 VIDEODECODERERROR_UNSUPPORTED, | 162 VIDEODECODERERROR_UNSUPPORTED, |
| 242 VIDEODECODERERROR_INVALIDINPUT, | 163 VIDEODECODERERROR_INVALIDINPUT, |
| 243 VIDEODECODERERROR_MEMFAILURE, | 164 VIDEODECODERERROR_MEMFAILURE, |
| 244 VIDEODECODERERROR_INSUFFICIENT_BUFFERS, | 165 VIDEODECODERERROR_INSUFFICIENT_BUFFERS, |
| 245 VIDEODECODERERROR_INSUFFICIENT_RESOURCES, | 166 VIDEODECODERERROR_INSUFFICIENT_RESOURCES, |
| 246 VIDEODECODERERROR_HARDWARE, | 167 VIDEODECODERERROR_HARDWARE, |
| 247 VIDEODECODERERROR_UNEXPECTED_FLUSH, | 168 VIDEODECODERERROR_UNEXPECTED_FLUSH, |
| 248 }; | 169 }; |
| 249 | 170 |
| 250 // Interface expected from PictureBuffers where pictures are stored. | |
| 251 class PictureBuffer { | |
| 252 public: | |
| 253 enum MemoryType { | |
| 254 PICTUREBUFFER_MEMORYTYPE_NONE = 0, | |
| 255 PICTUREBUFFER_MEMORYTYPE_SYSTEM, | |
| 256 PICTUREBUFFER_MEMORYTYPE_GL_TEXTURE, | |
| 257 }; | |
| 258 // Union to represent one data plane in picture buffer. | |
| 259 union DataPlaneHandle { | |
| 260 struct { | |
| 261 uint32 context_id; // GLES context id. | |
| 262 uint32 texture_id; // GLES texture id. | |
| 263 }; | |
| 264 void* sysmem; // Simply a pointer to system memory. | |
| 265 }; | |
| 266 | |
| 267 virtual ~PictureBuffer(); | |
| 268 virtual int32 GetId() = 0; | |
| 269 virtual gfx::Size GetSize() = 0; | |
| 270 virtual const std::vector<uint32>& GetColorFormat() = 0; | |
| 271 virtual MemoryType GetMemoryType() = 0; | |
| 272 virtual std::vector<DataPlaneHandle>& GetPlaneHandles() = 0; | |
| 273 }; | |
| 274 | |
| 275 class Picture { | |
| 276 public: | |
| 277 virtual ~Picture(); | |
| 278 | |
| 279 // Picture size related functions. | |
| 280 // There are three types of logical picture sizes that applications using | |
| 281 // video decoder should be aware of: | |
| 282 // - Visible picture size, | |
| 283 // - Decoded picture size, and | |
| 284 // - Picture buffer size. | |
| 285 // | |
| 286 // Visible picture size means the actual picture size that is intended to be | |
| 287 // displayed from the decoded output. | |
| 288 // | |
| 289 // Decoded picture size might vary from the visible size of the picture, | |
| 290 // because of the underlying properties of the codec. Vast majority of | |
| 291 // modern video compression algorithms are based on (macro)block-based | |
| 292 // transforms and therefore process the picture in small windows (usually | |
| 293 // of size 16x16 pixels) one by one. However, if the native picture size | |
| 294 // does not happen to match the block-size of the algorithm, there may be | |
| 295 // redundant data left on the sides of the output picture, which are not | |
| 296 // intended for display. For example, this happens to video of size 854x480 | |
| 297 // and H.264 codec. Since the width (854 pixels) is not multiple of the | |
| 298 // block size of the coding format (16 pixels), pixel columns 854-863 | |
| 299 // contain garbage data which is notintended for display. | |
| 300 // | |
| 301 // Plugin is providing the buffers for output decoding and it should know | |
| 302 // the picture buffer size it has provided to the decoder. Thus, there is | |
| 303 // no function to query the buffer size from this class. | |
| 304 | |
| 305 // Returns the picture buffer where this picture is contained. | |
| 306 virtual PictureBuffer* picture_buffer() = 0; | |
| 307 | |
| 308 // Returns the decoded size of the decoded picture in pixels. | |
| 309 virtual gfx::Size GetDecodedSize() const = 0; | |
| 310 | |
| 311 // Returns the visible size of the decoded picture in pixels. | |
| 312 virtual gfx::Size GetVisibleSize() const = 0; | |
| 313 | |
| 314 // Returns metadata associated with the picture. | |
| 315 virtual void* GetUserHandle() = 0; | |
| 316 }; | |
| 317 | |
| 318 // Interface for collaborating with picture interface to provide memory for | 171 // Interface for collaborating with picture interface to provide memory for |
| 319 // output picture and blitting them. | 172 // output picture and blitting them. |
| 320 class Client { | 173 class Client { |
| 321 public: | 174 public: |
| 322 virtual ~Client() {} | 175 virtual ~Client() {} |
| 323 | 176 |
| 324 // Callback to tell the information needed by the client to provide decoding | 177 // Callback to tell the information needed by the client to provide decoding |
| 325 // buffer to the decoder. | 178 // buffer to the decoder. |
| 326 virtual void ProvidePictureBuffers( | 179 virtual void ProvidePictureBuffers( |
| 327 uint32 requested_num_of_buffers, | 180 uint32 requested_num_of_buffers, |
| 328 const std::vector<uint32>& buffer_properties) = 0; | 181 gfx::Size dimensions, |
| 182 media::PictureBuffer::MemoryType type) = 0; | |
| 329 | 183 |
| 330 // Callback to dismiss picture buffer that was assigned earlier. | 184 // Callback to dismiss picture buffer that was assigned earlier. |
| 331 virtual void DismissPictureBuffer(PictureBuffer* picture_buffer) = 0; | 185 virtual void DismissPictureBuffer(int32 picture_buffer_id) = 0; |
| 332 | 186 |
| 333 // Callback to deliver decoded pictures ready to be displayed. | 187 // Callback to deliver decoded pictures ready to be displayed. |
| 334 virtual void PictureReady(Picture* picture) = 0; | 188 virtual void PictureReady(const Picture& picture) = 0; |
| 335 | 189 |
| 336 // Callback to notify that decoder has decoded end of stream marker and has | 190 // Callback to notify that decoder has decoded end of stream marker and has |
| 337 // outputted all displayable pictures. | 191 // outputted all displayable pictures. |
| 338 virtual void NotifyEndOfStream() = 0; | 192 virtual void NotifyEndOfStream() = 0; |
| 339 | 193 |
| 340 // Callback to notify about decoding errors. | 194 // Callback to notify about decoding errors. |
| 341 virtual void NotifyError(Error error) = 0; | 195 virtual void NotifyError(Error error) = 0; |
| 342 }; | 196 }; |
| 343 | 197 |
| 344 // Video decoder functions. | 198 // Video decoder functions. |
| 345 // GetConfig returns supported configurations that are subsets of given | 199 // GetConfig returns supported configurations that are subsets of given |
| 346 // |prototype_config|. | 200 // |prototype_config|. |
| 347 // Parameters: | 201 // Parameters: |
| 348 // |instance| is the pointer to the plug-in instance. | |
| 349 // |prototype_config| is the prototypical configuration. | 202 // |prototype_config| is the prototypical configuration. |
| 350 // | 203 // |
| 351 // Returns std::vector containing all the configurations that match the | 204 // Returns std::vector containing all the configurations that match the |
| 352 // prototypical configuration. | 205 // prototypical configuration. |
| 353 virtual const std::vector<uint32>& GetConfig( | 206 virtual const std::vector<uint32> GetConfigs( |
|
Ami GONE FROM CHROMIUM
2011/04/29 18:40:34
If you're not returning a reference why make the r
vrk (LEFT CHROMIUM)
2011/05/03 18:19:58
Done.
| |
| 354 const std::vector<uint32>& prototype_config) = 0; | 207 const std::vector<uint32>& prototype_config) = 0; |
| 355 | 208 |
| 356 // Initializes the video decoder with specific configuration. | 209 // Initializes the video decoder with specific configuration. |
| 357 // Parameters: | 210 // Parameters: |
| 358 // |config| is the configuration on which the decoder should be initialized. | 211 // |config| is the configuration on which the decoder should be initialized. |
| 359 // | 212 // |
| 360 // Returns true when command successfully accepted. Otherwise false. | 213 // Returns true when command successfully accepted. Otherwise false. |
| 361 virtual bool Initialize(const std::vector<uint32>& config) = 0; | 214 virtual bool Initialize(const std::vector<uint32>& config) = 0; |
| 362 | 215 |
| 363 // Decodes given bitstream buffer. Once decoder is done with processing | 216 // Decodes given bitstream buffer. Once decoder is done with processing |
| 364 // |bitstream_buffer| is will call |callback|. | 217 // |bitstream_buffer| is will call |callback|. |
| 365 // Parameters: | 218 // Parameters: |
| 366 // |bitstream_buffer| is the input bitstream that is sent for decoding. | 219 // |bitstream_buffer| is the input bitstream that is sent for decoding. |
| 367 // |callback| contains the callback function pointer for informing about | 220 // |callback| contains the callback function pointer for informing about |
| 368 // finished processing for |bitstream_buffer|. | 221 // finished processing for |bitstream_buffer|. |
| 369 // | 222 // |
| 370 // Returns true when command successfully accepted. Otherwise false. | 223 // Returns true when command successfully accepted. Otherwise false. |
| 371 virtual bool Decode(BitstreamBuffer* bitstream_buffer, | 224 virtual bool Decode(const BitstreamBuffer& bitstream_buffer, |
| 372 VideoDecodeAcceleratorCallback* callback) = 0; | 225 VideoDecodeAcceleratorCallback* callback) = 0; |
| 373 | 226 |
| 374 // Assigns picture buffer to the video decoder. This function must be called | 227 // Assigns picture buffer to the video decoder. This function must be called |
| 375 // at latest when decoder has made a ProvidePictureBuffers callback to the | 228 // at latest when decoder has made a ProvidePictureBuffers callback to the |
| 376 // client. Ownership of the picture buffer remains with the client, but it is | 229 // client. Ownership of the picture buffer remains with the client, but it is |
| 377 // not allowed to deallocate picture buffer before DismissPictureBuffer | 230 // not allowed to deallocate picture buffer before DismissPictureBuffer |
| 378 // callback has been initiated for a given buffer. | 231 // callback has been initiated for a given buffer. |
| 379 // | 232 // |
| 380 // Parameters: | 233 // Parameters: |
| 381 // |picture_buffers| contains the allocated picture buffers for the output. | 234 // |picture_buffers| contains the allocated picture buffers for the output. |
| 382 virtual void AssignPictureBuffer( | 235 virtual void AssignPictureBuffer( |
| 383 std::vector<PictureBuffer*> picture_buffers) = 0; | 236 const std::vector<PictureBuffer>& picture_buffers) = 0; |
| 384 | 237 |
| 385 // Sends picture buffers to be reused by the decoder. This needs to be called | 238 // Sends picture buffers to be reused by the decoder. This needs to be called |
| 386 // for each buffer that has been processed so that decoder may know onto which | 239 // for each buffer that has been processed so that decoder may know onto which |
| 387 // picture buffers it can write the output to. | 240 // picture buffers it can write the output to. |
| 388 // | 241 // |
| 389 // Parameters: | 242 // Parameters: |
| 390 // |picture_buffer| points to the picture buffer that is to be reused. | 243 // |picture_buffer_id| id of the picture buffer that is to be reused. |
| 391 virtual void ReusePictureBuffer(PictureBuffer* picture_buffer) = 0; | 244 virtual void ReusePictureBuffer(uint32 picture_buffer_id) = 0; |
| 392 | 245 |
| 393 // Flushes the decoder. Flushing will result in output of the | 246 // Flushes the decoder. Flushing will result in output of the |
| 394 // pictures and buffers held inside the decoder and returning of bitstream | 247 // pictures and buffers held inside the decoder and returning of bitstream |
| 395 // buffers using the callbacks implemented by the plug-in. Once done with | 248 // buffers using the callbacks implemented by the plug-in. Once done with |
| 396 // flushing, the decode will call the |callback|. | 249 // flushing, the decode will call the |callback|. |
| 397 // | 250 // |
| 398 // Parameters: | 251 // Parameters: |
| 399 // |callback| contains the callback function pointer. | 252 // |callback| contains the callback function pointer. |
| 400 // | 253 // |
| 401 // Returns true when command successfully accepted. Otherwise false. | 254 // Returns true when command successfully accepted. Otherwise false. |
| 402 virtual bool Flush(VideoDecodeAcceleratorCallback* callback) = 0; | 255 virtual bool Flush(VideoDecodeAcceleratorCallback* callback) = 0; |
| 403 | 256 |
| 404 // Aborts the decoder. Decode will abort the decoding as soon as possible and | 257 // Aborts the decoder. Decode will abort the decoding as soon as possible and |
| 405 // will not output anything. |callback| will be called as soon as abort has | 258 // will not output anything. |callback| will be called as soon as abort has |
| 406 // been finished. After abort all buffers can be considered dismissed, even | 259 // been finished. After abort all buffers can be considered dismissed, even |
| 407 // when there has not been callbacks to dismiss them. | 260 // when there has not been callbacks to dismiss them. |
| 408 // | 261 // |
| 409 // Parameters: | 262 // Parameters: |
| 410 // |callback| contains the callback function pointer. | 263 // |callback| contains the callback function pointer. |
| 411 // | 264 // |
| 412 // Returns true when command successfully accepted. Otherwise false. | 265 // Returns true when command successfully accepted. Otherwise false. |
| 413 virtual bool Abort(VideoDecodeAcceleratorCallback* callback) = 0; | 266 virtual bool Abort(VideoDecodeAcceleratorCallback* callback) = 0; |
| 414 }; | 267 }; |
| 415 | 268 |
| 416 } // namespace media | 269 } // namespace media |
| 417 | 270 |
| 418 #endif // MEDIA_VIDEO_VIDEO_DECODE_ACCELERATOR_H_ | 271 #endif // MEDIA_VIDEO_VIDEO_DECODE_ACCELERATOR_H_ |
| OLD | NEW |