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" |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 240 VIDEODECODERERROR_UNINITIALIZED, | 240 VIDEODECODERERROR_UNINITIALIZED, |
| 241 VIDEODECODERERROR_UNSUPPORTED, | 241 VIDEODECODERERROR_UNSUPPORTED, |
| 242 VIDEODECODERERROR_INVALIDINPUT, | 242 VIDEODECODERERROR_INVALIDINPUT, |
| 243 VIDEODECODERERROR_MEMFAILURE, | 243 VIDEODECODERERROR_MEMFAILURE, |
| 244 VIDEODECODERERROR_INSUFFICIENT_BUFFERS, | 244 VIDEODECODERERROR_INSUFFICIENT_BUFFERS, |
| 245 VIDEODECODERERROR_INSUFFICIENT_RESOURCES, | 245 VIDEODECODERERROR_INSUFFICIENT_RESOURCES, |
| 246 VIDEODECODERERROR_HARDWARE, | 246 VIDEODECODERERROR_HARDWARE, |
| 247 VIDEODECODERERROR_UNEXPECTED_FLUSH, | 247 VIDEODECODERERROR_UNEXPECTED_FLUSH, |
| 248 }; | 248 }; |
| 249 | 249 |
| 250 // Interface expected from PictureBuffers where pictures are stored. | 250 // Interface expected from PictureBuffers where pictures are stored. |
|
Ami GONE FROM CHROMIUM
2011/04/29 18:40:34
Yay!
| |
| 251 class PictureBuffer { | 251 class PictureBuffer { |
| 252 public: | 252 public: |
| 253 enum MemoryType { | 253 enum MemoryType { |
| 254 PICTUREBUFFER_MEMORYTYPE_NONE = 0, | 254 PICTUREBUFFER_MEMORYTYPE_NONE = 0, |
| 255 PICTUREBUFFER_MEMORYTYPE_SYSTEM, | 255 PICTUREBUFFER_MEMORYTYPE_SYSTEM, |
| 256 PICTUREBUFFER_MEMORYTYPE_GL_TEXTURE, | 256 PICTUREBUFFER_MEMORYTYPE_GL_TEXTURE, |
| 257 }; | 257 }; |
| 258 // Union to represent one data plane in picture buffer. | 258 // Union to represent one data plane in picture buffer. |
| 259 union DataPlaneHandle { | 259 union DataPlaneHandle { |
| 260 struct { | 260 struct { |
| 261 uint32 context_id; // GLES context id. | 261 uint32 context_id; // GLES context id. |
| 262 uint32 texture_id; // GLES texture id. | 262 uint32 texture_id; // GLES texture id. |
| 263 }; | 263 } gles2_texture; |
| 264 void* sysmem; // Simply a pointer to system memory. | 264 void* sysmem; // Simply a pointer to system memory. |
| 265 }; | 265 }; |
| 266 | 266 |
| 267 virtual ~PictureBuffer(); | 267 virtual ~PictureBuffer(); |
| 268 virtual int32 GetId() = 0; | 268 virtual int32 GetId() = 0; |
| 269 virtual gfx::Size GetSize() = 0; | 269 virtual gfx::Size GetSize() = 0; |
| 270 virtual const std::vector<uint32>& GetColorFormat() = 0; | |
| 271 virtual MemoryType GetMemoryType() = 0; | 270 virtual MemoryType GetMemoryType() = 0; |
| 272 virtual std::vector<DataPlaneHandle>& GetPlaneHandles() = 0; | 271 virtual std::vector<DataPlaneHandle>& GetPlaneHandles() = 0; |
| 273 }; | 272 }; |
| 274 | 273 |
| 275 class Picture { | 274 class Picture { |
| 276 public: | 275 public: |
| 277 virtual ~Picture(); | 276 virtual ~Picture(); |
| 278 | 277 |
| 279 // Picture size related functions. | 278 // Picture size related functions. |
| 280 // There are three types of logical picture sizes that applications using | 279 // There are three types of logical picture sizes that applications using |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 295 // redundant data left on the sides of the output picture, which are not | 294 // 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 | 295 // 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 | 296 // 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 | 297 // block size of the coding format (16 pixels), pixel columns 854-863 |
| 299 // contain garbage data which is notintended for display. | 298 // contain garbage data which is notintended for display. |
| 300 // | 299 // |
| 301 // Plugin is providing the buffers for output decoding and it should know | 300 // 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 | 301 // the picture buffer size it has provided to the decoder. Thus, there is |
| 303 // no function to query the buffer size from this class. | 302 // no function to query the buffer size from this class. |
| 304 | 303 |
| 305 // Returns the picture buffer where this picture is contained. | 304 // Returns the id of the picture buffer where this picture is contained. |
| 306 virtual PictureBuffer* picture_buffer() = 0; | 305 virtual int32 GetId() = 0; |
| 307 | 306 |
| 308 // Returns the decoded size of the decoded picture in pixels. | 307 // Returns the decoded size of the decoded picture in pixels. |
| 309 virtual gfx::Size GetDecodedSize() const = 0; | 308 virtual gfx::Size GetDecodedSize() const = 0; |
| 310 | 309 |
| 311 // Returns the visible size of the decoded picture in pixels. | 310 // Returns the visible size of the decoded picture in pixels. |
| 312 virtual gfx::Size GetVisibleSize() const = 0; | 311 virtual gfx::Size GetVisibleSize() const = 0; |
| 313 | 312 |
| 314 // Returns metadata associated with the picture. | 313 // Returns metadata associated with the picture. |
| 315 virtual void* GetUserHandle() = 0; | 314 virtual void* GetUserHandle() = 0; |
| 316 }; | 315 }; |
| 317 | 316 |
| 318 // Interface for collaborating with picture interface to provide memory for | 317 // Interface for collaborating with picture interface to provide memory for |
| 319 // output picture and blitting them. | 318 // output picture and blitting them. |
| 320 class Client { | 319 class Client { |
| 321 public: | 320 public: |
| 322 virtual ~Client() {} | 321 virtual ~Client() {} |
| 323 | 322 |
| 324 // Callback to tell the information needed by the client to provide decoding | 323 // Callback to tell the information needed by the client to provide decoding |
| 325 // buffer to the decoder. | 324 // buffer to the decoder. |
| 326 virtual void ProvidePictureBuffers( | 325 virtual void ProvidePictureBuffers( |
| 327 uint32 requested_num_of_buffers, | 326 uint32 requested_num_of_buffers, |
| 328 const std::vector<uint32>& buffer_properties) = 0; | 327 const std::vector<uint32>& buffer_properties) = 0; |
| 329 | 328 |
| 330 // Callback to dismiss picture buffer that was assigned earlier. | 329 // Callback to dismiss picture buffer that was assigned earlier. |
| 331 virtual void DismissPictureBuffer(PictureBuffer* picture_buffer) = 0; | 330 virtual void DismissPictureBuffer(int32 picture_buffer_id) = 0; |
| 332 | 331 |
| 333 // Callback to deliver decoded pictures ready to be displayed. | 332 // Callback to deliver decoded pictures ready to be displayed. |
| 334 virtual void PictureReady(Picture* picture) = 0; | 333 virtual void PictureReady(Picture& picture) = 0; |
|
scherkus (not reviewing)
2011/04/26 22:36:34
why ref versus pointer?
if ref we usually go with
vrk (LEFT CHROMIUM)
2011/04/27 00:40:33
I believe the only reason the parameter is a point
| |
| 335 | 334 |
| 336 // Callback to notify that decoder has decoded end of stream marker and has | 335 // Callback to notify that decoder has decoded end of stream marker and has |
| 337 // outputted all displayable pictures. | 336 // outputted all displayable pictures. |
| 338 virtual void NotifyEndOfStream() = 0; | 337 virtual void NotifyEndOfStream() = 0; |
| 339 | 338 |
| 340 // Callback to notify about decoding errors. | 339 // Callback to notify about decoding errors. |
| 341 virtual void NotifyError(Error error) = 0; | 340 virtual void NotifyError(Error error) = 0; |
| 342 }; | 341 }; |
| 343 | 342 |
| 344 // Video decoder functions. | 343 // Video decoder functions. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 380 // Parameters: | 379 // Parameters: |
| 381 // |picture_buffers| contains the allocated picture buffers for the output. | 380 // |picture_buffers| contains the allocated picture buffers for the output. |
| 382 virtual void AssignPictureBuffer( | 381 virtual void AssignPictureBuffer( |
| 383 std::vector<PictureBuffer*> picture_buffers) = 0; | 382 std::vector<PictureBuffer*> picture_buffers) = 0; |
| 384 | 383 |
| 385 // Sends picture buffers to be reused by the decoder. This needs to be called | 384 // 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 | 385 // for each buffer that has been processed so that decoder may know onto which |
| 387 // picture buffers it can write the output to. | 386 // picture buffers it can write the output to. |
| 388 // | 387 // |
| 389 // Parameters: | 388 // Parameters: |
| 390 // |picture_buffer| points to the picture buffer that is to be reused. | 389 // |picture_buffer_id| id of the picture buffer that is to be reused. |
| 391 virtual void ReusePictureBuffer(PictureBuffer* picture_buffer) = 0; | 390 virtual void ReusePictureBuffer(uint32 picture_buffer_id) = 0; |
| 392 | 391 |
| 393 // Flushes the decoder. Flushing will result in output of the | 392 // Flushes the decoder. Flushing will result in output of the |
| 394 // pictures and buffers held inside the decoder and returning of bitstream | 393 // pictures and buffers held inside the decoder and returning of bitstream |
| 395 // buffers using the callbacks implemented by the plug-in. Once done with | 394 // buffers using the callbacks implemented by the plug-in. Once done with |
| 396 // flushing, the decode will call the |callback|. | 395 // flushing, the decode will call the |callback|. |
| 397 // | 396 // |
| 398 // Parameters: | 397 // Parameters: |
| 399 // |callback| contains the callback function pointer. | 398 // |callback| contains the callback function pointer. |
| 400 // | 399 // |
| 401 // Returns true when command successfully accepted. Otherwise false. | 400 // Returns true when command successfully accepted. Otherwise false. |
| 402 virtual bool Flush(VideoDecodeAcceleratorCallback* callback) = 0; | 401 virtual bool Flush(VideoDecodeAcceleratorCallback* callback) = 0; |
| 403 | 402 |
| 404 // Aborts the decoder. Decode will abort the decoding as soon as possible and | 403 // 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 | 404 // 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 | 405 // been finished. After abort all buffers can be considered dismissed, even |
| 407 // when there has not been callbacks to dismiss them. | 406 // when there has not been callbacks to dismiss them. |
| 408 // | 407 // |
| 409 // Parameters: | 408 // Parameters: |
| 410 // |callback| contains the callback function pointer. | 409 // |callback| contains the callback function pointer. |
| 411 // | 410 // |
| 412 // Returns true when command successfully accepted. Otherwise false. | 411 // Returns true when command successfully accepted. Otherwise false. |
| 413 virtual bool Abort(VideoDecodeAcceleratorCallback* callback) = 0; | 412 virtual bool Abort(VideoDecodeAcceleratorCallback* callback) = 0; |
| 414 }; | 413 }; |
| 415 | 414 |
| 416 } // namespace media | 415 } // namespace media |
| 417 | 416 |
| 418 #endif // MEDIA_VIDEO_VIDEO_DECODE_ACCELERATOR_H_ | 417 #endif // MEDIA_VIDEO_VIDEO_DECODE_ACCELERATOR_H_ |
| OLD | NEW |