| 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 VIDEODECODERERROR_UNINITIALIZED, | 175 VIDEODECODERERROR_UNINITIALIZED, |
| 176 VIDEODECODERERROR_UNSUPPORTED, | 176 VIDEODECODERERROR_UNSUPPORTED, |
| 177 VIDEODECODERERROR_INVALIDINPUT, | 177 VIDEODECODERERROR_INVALIDINPUT, |
| 178 VIDEODECODERERROR_MEMFAILURE, | 178 VIDEODECODERERROR_MEMFAILURE, |
| 179 VIDEODECODERERROR_INSUFFICIENT_BUFFERS, | 179 VIDEODECODERERROR_INSUFFICIENT_BUFFERS, |
| 180 VIDEODECODERERROR_INSUFFICIENT_RESOURCES, | 180 VIDEODECODERERROR_INSUFFICIENT_RESOURCES, |
| 181 VIDEODECODERERROR_HARDWARE, | 181 VIDEODECODERERROR_HARDWARE, |
| 182 VIDEODECODERERROR_UNEXPECTED_FLUSH, | 182 VIDEODECODERERROR_UNEXPECTED_FLUSH, |
| 183 }; | 183 }; |
| 184 | 184 |
| 185 // Represents the type of data buffer to be used by the decoder. | |
| 186 enum MemoryType { | |
| 187 PICTUREBUFFER_MEMORYTYPE_NONE = 0, | |
| 188 PICTUREBUFFER_MEMORYTYPE_SYSTEM, | |
| 189 PICTUREBUFFER_MEMORYTYPE_GL_TEXTURE, | |
| 190 }; | |
| 191 | |
| 192 // Interface for collaborating with picture interface to provide memory for | 185 // Interface for collaborating with picture interface to provide memory for |
| 193 // output picture and blitting them. | 186 // output picture and blitting them. |
| 194 // This interface is extended by the various layers that relay messages back | 187 // This interface is extended by the various layers that relay messages back |
| 195 // to the plugin, through the PPP_VideoDecode_Dev interface the plugin | 188 // to the plugin, through the PPP_VideoDecode_Dev interface the plugin |
| 196 // implements. | 189 // implements. |
| 197 class Client { | 190 class Client { |
| 198 public: | 191 public: |
| 199 virtual ~Client() {} | 192 virtual ~Client() {} |
| 200 | 193 |
| 201 // Callback to notify client that decoder has been initialized. | 194 // Callback to notify client that decoder has been initialized. |
| 202 virtual void NotifyInitializeDone() = 0; | 195 virtual void NotifyInitializeDone() = 0; |
| 203 | 196 |
| 204 // Callback to tell the information needed by the client to provide decoding | 197 // Callback to tell client how many and what size of buffers to provide. |
| 205 // buffer to the decoder. | |
| 206 virtual void ProvidePictureBuffers( | 198 virtual void ProvidePictureBuffers( |
| 207 uint32 requested_num_of_buffers, | 199 uint32 requested_num_of_buffers, const gfx::Size& dimensions) = 0; |
| 208 const gfx::Size& dimensions, | |
| 209 MemoryType type) = 0; | |
| 210 | 200 |
| 211 // Callback to dismiss picture buffer that was assigned earlier. | 201 // Callback to dismiss picture buffer that was assigned earlier. |
| 212 virtual void DismissPictureBuffer(int32 picture_buffer_id) = 0; | 202 virtual void DismissPictureBuffer(int32 picture_buffer_id) = 0; |
| 213 | 203 |
| 214 // Callback to deliver decoded pictures ready to be displayed. | 204 // Callback to deliver decoded pictures ready to be displayed. |
| 215 virtual void PictureReady(const Picture& picture) = 0; | 205 virtual void PictureReady(const Picture& picture) = 0; |
| 216 | 206 |
| 217 // Callback to notify that decoder has decoded end of stream marker and has | 207 // Callback to notify that decoder has decoded end of stream marker and has |
| 218 // outputted all displayable pictures. | 208 // outputted all displayable pictures. |
| 219 virtual void NotifyEndOfStream() = 0; | 209 virtual void NotifyEndOfStream() = 0; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 249 virtual void Decode(const BitstreamBuffer& bitstream_buffer) = 0; | 239 virtual void Decode(const BitstreamBuffer& bitstream_buffer) = 0; |
| 250 | 240 |
| 251 // Assigns a set of texture-backed picture buffers to the video decoder. | 241 // Assigns a set of texture-backed picture buffers to the video decoder. |
| 252 // | 242 // |
| 253 // Ownership of each picture buffer remains with the client, but the client | 243 // Ownership of each picture buffer remains with the client, but the client |
| 254 // is not allowed to deallocate the buffer before the DismissPictureBuffer | 244 // is not allowed to deallocate the buffer before the DismissPictureBuffer |
| 255 // callback has been initiated for a given buffer. | 245 // callback has been initiated for a given buffer. |
| 256 // | 246 // |
| 257 // Parameters: | 247 // Parameters: |
| 258 // |buffers| contains the allocated picture buffers for the output. | 248 // |buffers| contains the allocated picture buffers for the output. |
| 259 virtual void AssignGLESBuffers(const std::vector<GLESBuffer>& buffers) = 0; | 249 virtual void AssignPictureBuffers( |
| 250 const std::vector<PictureBuffer>& buffers) = 0; |
| 260 | 251 |
| 261 // Sends picture buffers to be reused by the decoder. This needs to be called | 252 // Sends picture buffers to be reused by the decoder. This needs to be called |
| 262 // for each buffer that has been processed so that decoder may know onto which | 253 // for each buffer that has been processed so that decoder may know onto which |
| 263 // picture buffers it can write the output to. | 254 // picture buffers it can write the output to. |
| 264 // | 255 // |
| 265 // Parameters: | 256 // Parameters: |
| 266 // |picture_buffer_id| id of the picture buffer that is to be reused. | 257 // |picture_buffer_id| id of the picture buffer that is to be reused. |
| 267 virtual void ReusePictureBuffer(int32 picture_buffer_id) = 0; | 258 virtual void ReusePictureBuffer(int32 picture_buffer_id) = 0; |
| 268 | 259 |
| 269 // Flushes the decoder: all pending inputs will be decoded and pictures handed | 260 // Flushes the decoder: all pending inputs will be decoded and pictures handed |
| (...skipping 14 matching lines...) Expand all Loading... |
| 284 virtual void Destroy() = 0; | 275 virtual void Destroy() = 0; |
| 285 | 276 |
| 286 protected: | 277 protected: |
| 287 friend class base::RefCountedThreadSafe<VideoDecodeAccelerator>; | 278 friend class base::RefCountedThreadSafe<VideoDecodeAccelerator>; |
| 288 virtual ~VideoDecodeAccelerator(); | 279 virtual ~VideoDecodeAccelerator(); |
| 289 }; | 280 }; |
| 290 | 281 |
| 291 } // namespace media | 282 } // namespace media |
| 292 | 283 |
| 293 #endif // MEDIA_VIDEO_VIDEO_DECODE_ACCELERATOR_H_ | 284 #endif // MEDIA_VIDEO_VIDEO_DECODE_ACCELERATOR_H_ |
| OLD | NEW |