| 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_old.h" | 11 #include "base/callback_old.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 | 154 // This interface is extended by the various components that ultimately |
| 232 // that's using it. | 155 // implement the backend of PPB_VideoDecode_Dev. |
| 233 class VideoDecodeAccelerator { | 156 class VideoDecodeAccelerator { |
| 234 public: | 157 public: |
| 235 virtual ~VideoDecodeAccelerator(); | 158 virtual ~VideoDecodeAccelerator(); |
| 236 | 159 |
| 237 // Enumeration of potential errors generated by the API. | 160 // Enumeration of potential errors generated by the API. |
| 238 enum Error { | 161 enum Error { |
| 239 VIDEODECODERERROR_NONE = 0, | 162 VIDEODECODERERROR_NONE = 0, |
| 240 VIDEODECODERERROR_UNINITIALIZED, | 163 VIDEODECODERERROR_UNINITIALIZED, |
| 241 VIDEODECODERERROR_UNSUPPORTED, | 164 VIDEODECODERERROR_UNSUPPORTED, |
| 242 VIDEODECODERERROR_INVALIDINPUT, | 165 VIDEODECODERERROR_INVALIDINPUT, |
| 243 VIDEODECODERERROR_MEMFAILURE, | 166 VIDEODECODERERROR_MEMFAILURE, |
| 244 VIDEODECODERERROR_INSUFFICIENT_BUFFERS, | 167 VIDEODECODERERROR_INSUFFICIENT_BUFFERS, |
| 245 VIDEODECODERERROR_INSUFFICIENT_RESOURCES, | 168 VIDEODECODERERROR_INSUFFICIENT_RESOURCES, |
| 246 VIDEODECODERERROR_HARDWARE, | 169 VIDEODECODERERROR_HARDWARE, |
| 247 VIDEODECODERERROR_UNEXPECTED_FLUSH, | 170 VIDEODECODERERROR_UNEXPECTED_FLUSH, |
| 248 }; | 171 }; |
| 249 | 172 |
| 250 // Interface expected from PictureBuffers where pictures are stored. | 173 // Represents the type of data buffer to be used by the decoder. |
| 251 class PictureBuffer { | 174 enum MemoryType { |
| 252 public: | 175 PICTUREBUFFER_MEMORYTYPE_NONE = 0, |
| 253 enum MemoryType { | 176 PICTUREBUFFER_MEMORYTYPE_SYSTEM, |
| 254 PICTUREBUFFER_MEMORYTYPE_NONE = 0, | 177 PICTUREBUFFER_MEMORYTYPE_GL_TEXTURE, |
| 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 }; | 178 }; |
| 317 | 179 |
| 318 // Interface for collaborating with picture interface to provide memory for | 180 // Interface for collaborating with picture interface to provide memory for |
| 319 // output picture and blitting them. | 181 // output picture and blitting them. |
| 182 // This interface is extended by the various layers that relay messages back |
| 183 // to the plugin, through the PPP_VideoDecode_Dev interface the plugin |
| 184 // implements. |
| 320 class Client { | 185 class Client { |
| 321 public: | 186 public: |
| 322 virtual ~Client() {} | 187 virtual ~Client() {} |
| 323 | 188 |
| 324 // Callback to tell the information needed by the client to provide decoding | 189 // Callback to tell the information needed by the client to provide decoding |
| 325 // buffer to the decoder. | 190 // buffer to the decoder. |
| 326 virtual void ProvidePictureBuffers( | 191 virtual void ProvidePictureBuffers( |
| 327 uint32 requested_num_of_buffers, | 192 uint32 requested_num_of_buffers, |
| 328 const std::vector<uint32>& buffer_properties) = 0; | 193 gfx::Size dimensions, |
| 194 MemoryType type) = 0; |
| 329 | 195 |
| 330 // Callback to dismiss picture buffer that was assigned earlier. | 196 // Callback to dismiss picture buffer that was assigned earlier. |
| 331 virtual void DismissPictureBuffer(PictureBuffer* picture_buffer) = 0; | 197 virtual void DismissPictureBuffer(int32 picture_buffer_id) = 0; |
| 332 | 198 |
| 333 // Callback to deliver decoded pictures ready to be displayed. | 199 // Callback to deliver decoded pictures ready to be displayed. |
| 334 virtual void PictureReady(Picture* picture) = 0; | 200 virtual void PictureReady(const Picture& picture) = 0; |
| 335 | 201 |
| 336 // Callback to notify that decoder has decoded end of stream marker and has | 202 // Callback to notify that decoder has decoded end of stream marker and has |
| 337 // outputted all displayable pictures. | 203 // outputted all displayable pictures. |
| 338 virtual void NotifyEndOfStream() = 0; | 204 virtual void NotifyEndOfStream() = 0; |
| 339 | 205 |
| 340 // Callback to notify about decoding errors. | 206 // Callback to notify about decoding errors. |
| 341 virtual void NotifyError(Error error) = 0; | 207 virtual void NotifyError(Error error) = 0; |
| 342 }; | 208 }; |
| 343 | 209 |
| 344 // Video decoder functions. | 210 // Video decoder functions. |
| 345 // GetConfig returns supported configurations that are subsets of given | 211 // GetConfigs returns the supported configurations that is a subset of the |
| 346 // |prototype_config|. | 212 // given |requested_configs|. |
| 347 // Parameters: | 213 // Parameters: |
| 348 // |instance| is the pointer to the plug-in instance. | 214 // |requested_configs| is the set of configurations the plugin is querying |
| 349 // |prototype_config| is the prototypical configuration. | 215 // for support. |
| 350 // | 216 // |matched_configs| is the subset of |requested_configs| that the decoder |
| 351 // Returns std::vector containing all the configurations that match the | 217 // supports. |
| 352 // prototypical configuration. | 218 virtual void GetConfigs( |
| 353 virtual const std::vector<uint32>& GetConfig( | 219 const std::vector<uint32>& requested_configs, |
| 354 const std::vector<uint32>& prototype_config) = 0; | 220 std::vector<uint32>* matched_configs) = 0; |
| 355 | 221 |
| 356 // Initializes the video decoder with specific configuration. | 222 // Initializes the video decoder with specific configuration. |
| 357 // Parameters: | 223 // Parameters: |
| 358 // |config| is the configuration on which the decoder should be initialized. | 224 // |config| is the configuration on which the decoder should be initialized. |
| 359 // | 225 // |
| 360 // Returns true when command successfully accepted. Otherwise false. | 226 // Returns true when command successfully accepted. Otherwise false. |
| 361 virtual bool Initialize(const std::vector<uint32>& config) = 0; | 227 virtual bool Initialize(const std::vector<uint32>& config) = 0; |
| 362 | 228 |
| 363 // Decodes given bitstream buffer. Once decoder is done with processing | 229 // Decodes given bitstream buffer. Once decoder is done with processing |
| 364 // |bitstream_buffer| is will call |callback|. | 230 // |bitstream_buffer| is will call |callback|. |
| 365 // Parameters: | 231 // Parameters: |
| 366 // |bitstream_buffer| is the input bitstream that is sent for decoding. | 232 // |bitstream_buffer| is the input bitstream that is sent for decoding. |
| 367 // |callback| contains the callback function pointer for informing about | 233 // |callback| contains the callback function pointer for informing about |
| 368 // finished processing for |bitstream_buffer|. | 234 // finished processing for |bitstream_buffer|. |
| 369 // | 235 // |
| 370 // Returns true when command successfully accepted. Otherwise false. | 236 // Returns true when command successfully accepted. Otherwise false. |
| 371 virtual bool Decode(BitstreamBuffer* bitstream_buffer, | 237 virtual bool Decode(const BitstreamBuffer& bitstream_buffer, |
| 372 VideoDecodeAcceleratorCallback* callback) = 0; | 238 VideoDecodeAcceleratorCallback* callback) = 0; |
| 373 | 239 |
| 374 // Assigns picture buffer to the video decoder. This function must be called | 240 // Assigns a set of picture buffers to the video decoder. |
| 375 // at latest when decoder has made a ProvidePictureBuffers callback to the | 241 // AssignGLESBuffers assigns texture-backed buffers. |
| 376 // client. Ownership of the picture buffer remains with the client, but it is | 242 // AssignSysmemBuffers assigns system memory-backed buffers. |
| 377 // not allowed to deallocate picture buffer before DismissPictureBuffer | 243 // |
| 244 // Ownership of each picture buffer remains with the client, but the client |
| 245 // is not allowed to deallocate the buffer before the DismissPictureBuffer |
| 378 // callback has been initiated for a given buffer. | 246 // callback has been initiated for a given buffer. |
| 379 // | 247 // |
| 380 // Parameters: | 248 // Parameters: |
| 381 // |picture_buffers| contains the allocated picture buffers for the output. | 249 // |buffers| contains the allocated picture buffers for the output. |
| 382 virtual void AssignPictureBuffer( | 250 virtual void AssignGLESBuffers(const std::vector<GLESBuffer>& buffers) = 0; |
| 383 std::vector<PictureBuffer*> picture_buffers) = 0; | 251 virtual void AssignSysmemBuffers( |
| 252 const std::vector<SysmemBuffer>& buffers) = 0; |
| 384 | 253 |
| 385 // Sends picture buffers to be reused by the decoder. This needs to be called | 254 // 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 | 255 // for each buffer that has been processed so that decoder may know onto which |
| 387 // picture buffers it can write the output to. | 256 // picture buffers it can write the output to. |
| 388 // | 257 // |
| 389 // Parameters: | 258 // Parameters: |
| 390 // |picture_buffer| points to the picture buffer that is to be reused. | 259 // |picture_buffer_id| id of the picture buffer that is to be reused. |
| 391 virtual void ReusePictureBuffer(PictureBuffer* picture_buffer) = 0; | 260 virtual void ReusePictureBuffer(uint32 picture_buffer_id) = 0; |
| 392 | 261 |
| 393 // Flushes the decoder. Flushing will result in output of the | 262 // Flushes the decoder. Flushing will result in output of the |
| 394 // pictures and buffers held inside the decoder and returning of bitstream | 263 // pictures and buffers held inside the decoder and returning of bitstream |
| 395 // buffers using the callbacks implemented by the plug-in. Once done with | 264 // buffers using the callbacks implemented by the plug-in. Once done with |
| 396 // flushing, the decode will call the |callback|. | 265 // flushing, the decode will call the |callback|. |
| 397 // | 266 // |
| 398 // Parameters: | 267 // Parameters: |
| 399 // |callback| contains the callback function pointer. | 268 // |callback| contains the callback function pointer. |
| 400 // | 269 // |
| 401 // Returns true when command successfully accepted. Otherwise false. | 270 // Returns true when command successfully accepted. Otherwise false. |
| 402 virtual bool Flush(VideoDecodeAcceleratorCallback* callback) = 0; | 271 virtual bool Flush(VideoDecodeAcceleratorCallback* callback) = 0; |
| 403 | 272 |
| 404 // Aborts the decoder. Decode will abort the decoding as soon as possible and | 273 // 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 | 274 // 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 | 275 // been finished. After abort all buffers can be considered dismissed, even |
| 407 // when there has not been callbacks to dismiss them. | 276 // when there has not been callbacks to dismiss them. |
| 408 // | 277 // |
| 409 // Parameters: | 278 // Parameters: |
| 410 // |callback| contains the callback function pointer. | 279 // |callback| contains the callback function pointer. |
| 411 // | 280 // |
| 412 // Returns true when command successfully accepted. Otherwise false. | 281 // Returns true when command successfully accepted. Otherwise false. |
| 413 virtual bool Abort(VideoDecodeAcceleratorCallback* callback) = 0; | 282 virtual bool Abort(VideoDecodeAcceleratorCallback* callback) = 0; |
| 414 }; | 283 }; |
| 415 | 284 |
| 416 } // namespace media | 285 } // namespace media |
| 417 | 286 |
| 418 #endif // MEDIA_VIDEO_VIDEO_DECODE_ACCELERATOR_H_ | 287 #endif // MEDIA_VIDEO_VIDEO_DECODE_ACCELERATOR_H_ |
| OLD | NEW |