| OLD | NEW |
| 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 <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 // Interface for collaborating with picture interface to provide memory for | 55 // Interface for collaborating with picture interface to provide memory for |
| 56 // output picture and blitting them. These callbacks will not be made unless | 56 // output picture and blitting them. These callbacks will not be made unless |
| 57 // Initialize() has returned successfully. | 57 // Initialize() has returned successfully. |
| 58 // This interface is extended by the various layers that relay messages back | 58 // This interface is extended by the various layers that relay messages back |
| 59 // to the plugin, through the PPP_VideoDecoder_Dev interface the plugin | 59 // to the plugin, through the PPP_VideoDecoder_Dev interface the plugin |
| 60 // implements. | 60 // implements. |
| 61 class MEDIA_EXPORT Client { | 61 class MEDIA_EXPORT Client { |
| 62 public: | 62 public: |
| 63 // SetCdm completion callback to indicate whether the CDM is successfully |
| 64 // attached to the decoder. The default implementation is a no-op since most |
| 65 // VDAs don't support encrypted video. |
| 66 virtual void NotifyCdmAttached(bool success); |
| 67 |
| 63 // Callback to tell client how many and what size of buffers to provide. | 68 // Callback to tell client how many and what size of buffers to provide. |
| 64 // Note that the actual count provided through AssignPictureBuffers() can be | 69 // Note that the actual count provided through AssignPictureBuffers() can be |
| 65 // larger than the value requested. | 70 // larger than the value requested. |
| 66 virtual void ProvidePictureBuffers(uint32 requested_num_of_buffers, | 71 virtual void ProvidePictureBuffers(uint32 requested_num_of_buffers, |
| 67 const gfx::Size& dimensions, | 72 const gfx::Size& dimensions, |
| 68 uint32 texture_target) = 0; | 73 uint32 texture_target) = 0; |
| 69 | 74 |
| 70 // Callback to dismiss picture buffer that was assigned earlier. | 75 // Callback to dismiss picture buffer that was assigned earlier. |
| 71 virtual void DismissPictureBuffer(int32 picture_buffer_id) = 0; | 76 virtual void DismissPictureBuffer(int32 picture_buffer_id) = 0; |
| 72 | 77 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 90 | 95 |
| 91 protected: | 96 protected: |
| 92 virtual ~Client() {} | 97 virtual ~Client() {} |
| 93 }; | 98 }; |
| 94 | 99 |
| 95 // Video decoder functions. | 100 // Video decoder functions. |
| 96 | 101 |
| 97 // Initializes the video decoder with specific configuration. Called once per | 102 // Initializes the video decoder with specific configuration. Called once per |
| 98 // decoder construction. This call is synchronous and returns true iff | 103 // decoder construction. This call is synchronous and returns true iff |
| 99 // initialization is successful. | 104 // initialization is successful. |
| 105 // |
| 106 // For encrpyted video, the decoder needs a CDM to be able to decode encrypted |
| 107 // buffers. SetCdm() should be called after Initialize() to set such a CDM. |
| 108 // Client::NotifyCdmAttached() will then be called to indicate whether the CDM |
| 109 // is successfully attached to the decoder. Only when a CDM is successfully |
| 110 // attached can we start to decode. |
| 111 // |
| 100 // Parameters: | 112 // Parameters: |
| 101 // |profile| is the video stream's format profile. | 113 // |profile| is the video stream's format profile. |
| 102 // |client| is the client of this video decoder. The provided pointer must | 114 // |client| is the client of this video decoder. Does not take ownership of |
| 103 // be valid until Destroy() is called. | 115 // |client| which must be valid until Destroy() is called. |
| 104 virtual bool Initialize(VideoCodecProfile profile, Client* client) = 0; | 116 virtual bool Initialize(VideoCodecProfile profile, Client* client) = 0; |
| 105 | 117 |
| 118 // Sets a CDM to be used by the decoder to decode encrypted buffers. |
| 119 // Client::NotifyCdmAttached() will then be called to indicate whether the CDM |
| 120 // is successfully attached to the decoder. The default implementation is a |
| 121 // no-op since most VDAs don't support encrypted video. |
| 122 virtual void SetCdm(int cdm_id); |
| 123 |
| 106 // Decodes given bitstream buffer that contains at most one frame. Once | 124 // Decodes given bitstream buffer that contains at most one frame. Once |
| 107 // decoder is done with processing |bitstream_buffer| it will call | 125 // decoder is done with processing |bitstream_buffer| it will call |
| 108 // NotifyEndOfBitstreamBuffer() with the bitstream buffer id. | 126 // NotifyEndOfBitstreamBuffer() with the bitstream buffer id. |
| 109 // Parameters: | 127 // Parameters: |
| 110 // |bitstream_buffer| is the input bitstream that is sent for decoding. | 128 // |bitstream_buffer| is the input bitstream that is sent for decoding. |
| 111 virtual void Decode(const BitstreamBuffer& bitstream_buffer) = 0; | 129 virtual void Decode(const BitstreamBuffer& bitstream_buffer) = 0; |
| 112 | 130 |
| 113 // Assigns a set of texture-backed picture buffers to the video decoder. | 131 // Assigns a set of texture-backed picture buffers to the video decoder. |
| 114 // | 132 // |
| 115 // Ownership of each picture buffer remains with the client, but the client | 133 // Ownership of each picture buffer remains with the client, but the client |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 // uses "Destroy()" instead of trying to use the destructor. | 199 // uses "Destroy()" instead of trying to use the destructor. |
| 182 template <> | 200 template <> |
| 183 struct MEDIA_EXPORT DefaultDeleter<media::VideoDecodeAccelerator> { | 201 struct MEDIA_EXPORT DefaultDeleter<media::VideoDecodeAccelerator> { |
| 184 public: | 202 public: |
| 185 void operator()(void* video_decode_accelerator) const; | 203 void operator()(void* video_decode_accelerator) const; |
| 186 }; | 204 }; |
| 187 | 205 |
| 188 } // namespace base | 206 } // namespace base |
| 189 | 207 |
| 190 #endif // MEDIA_VIDEO_VIDEO_DECODE_ACCELERATOR_H_ | 208 #endif // MEDIA_VIDEO_VIDEO_DECODE_ACCELERATOR_H_ |
| OLD | NEW |