| 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 PPAPI_CPP_DEV_VIDEO_DECODER_DEV_H_ | 5 #ifndef PPAPI_CPP_DEV_VIDEO_DECODER_DEV_H_ |
| 6 #define PPAPI_CPP_DEV_VIDEO_DECODER_DEV_H_ | 6 #define PPAPI_CPP_DEV_VIDEO_DECODER_DEV_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ppapi/c/dev/pp_video_dev.h" | 10 #include "ppapi/c/dev/pp_video_dev.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 // Callback to notify about decoding errors. | 47 // Callback to notify about decoding errors. |
| 48 virtual void NotifyError(PP_VideoDecodeError_Dev error) = 0; | 48 virtual void NotifyError(PP_VideoDecodeError_Dev error) = 0; |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 // Constructor for the video decoder. Calls the Create on the | 51 // Constructor for the video decoder. Calls the Create on the |
| 52 // PPB_VideoDecoder_Dev interface. | 52 // PPB_VideoDecoder_Dev interface. |
| 53 // | 53 // |
| 54 // Parameters: | 54 // Parameters: |
| 55 // |instance| is the pointer to the plug-in instance. | 55 // |instance| is the pointer to the plug-in instance. |
| 56 // |config| is the configuration on which the decoder should be initialized. | |
| 57 // |callback| will be called when decoder is initialized. | 56 // |callback| will be called when decoder is initialized. |
| 58 // |client| is the pointer to the client object. Ownership of the object is | 57 // |client| is the pointer to the client object. Ownership of the object is |
| 59 // not transferred and it must outlive the lifetime of this class. | 58 // not transferred and it must outlive the lifetime of this class. |
| 60 VideoDecoder(const Instance* instance, const std::vector<uint32_t>& config, | 59 VideoDecoder(const Instance* instance, Client* client); |
| 61 CompletionCallback callback, Client* client); | |
| 62 ~VideoDecoder(); | 60 ~VideoDecoder(); |
| 63 | 61 |
| 62 // Initializates the video decoder with a requested configuration. |
| 63 // Calls Init() on PPB_VideoDecoder_Dev interface. |
| 64 // |
| 65 // Parameters: |
| 66 // |config| is the configuration on which the decoder should be initialized. |
| 67 // |callback| will be called when decoder is initialized. |
| 68 int32_t Init(const std::vector<uint32_t>& config, |
| 69 CompletionCallback callback); |
| 70 |
| 64 // GetConfigs returns supported configurations that are subsets of given | 71 // GetConfigs returns supported configurations that are subsets of given |
| 65 // |prototype_config|. | 72 // |prototype_config|. |
| 66 static std::vector<uint32_t> GetConfigs( | 73 static std::vector<uint32_t> GetConfigs( |
| 67 Instance* instance, | 74 Instance* instance, |
| 68 const std::vector<uint32_t>& prototype_config); | 75 const std::vector<uint32_t>& prototype_config); |
| 69 | 76 |
| 70 // Provides the decoder with picture buffers for video decoding. | 77 // Provides the decoder with picture buffers for video decoding. |
| 71 // AssignGLESBuffers provides texture-backed buffers, whereas | 78 // AssignGLESBuffers provides texture-backed buffers, whereas |
| 72 // AssignSysmemBuffers provides system memory-backed buffers. | 79 // AssignSysmemBuffers provides system memory-backed buffers. |
| 73 void AssignGLESBuffers(uint32_t no_of_buffers, | 80 void AssignGLESBuffers(uint32_t no_of_buffers, |
| 74 const PP_GLESBuffer_Dev& buffers); | 81 const PP_GLESBuffer_Dev& buffers); |
| 75 void AssignSysmemBuffers(uint32_t no_of_buffers, | 82 void AssignSysmemBuffers(uint32_t no_of_buffers, |
| 76 const PP_SysmemBuffer_Dev& buffers); | 83 const PP_SysmemBuffer_Dev& buffers); |
| 77 | 84 |
| 78 // Decodes given bitstream buffer. Once decoder is done with processing | 85 // Decodes given bitstream buffer. Once decoder is done with processing |
| 79 // |bitstream_buffer| is will call |callback| with provided user data. | 86 // |bitstream_buffer| is will call |callback| with provided user data. |
| 80 bool Decode(const PP_VideoBitstreamBuffer_Dev& bitstream_buffer, | 87 int32_t Decode(const PP_VideoBitstreamBuffer_Dev& bitstream_buffer, |
| 81 CompletionCallback callback); | 88 CompletionCallback callback); |
| 82 | 89 |
| 83 // Tells the decoder to reuse given picture buffer. | 90 // Tells the decoder to reuse given picture buffer. |
| 84 void ReusePictureBuffer(int32_t picture_buffer_id); | 91 void ReusePictureBuffer(int32_t picture_buffer_id); |
| 85 | 92 |
| 86 // Flushes the decoder. |callback| will be called as soon as Flush has been | 93 // Flushes the decoder. |callback| will be called as soon as Flush has been |
| 87 // finished. | 94 // finished. |
| 88 bool Flush(CompletionCallback callback); | 95 int32_t Flush(CompletionCallback callback); |
| 89 | 96 |
| 90 // Dispatches abortion request to the decoder to abort decoding as soon as | 97 // Dispatches abortion request to the decoder to abort decoding as soon as |
| 91 // possible. |callback| will be called as soon as abortion has been finished. | 98 // possible. |callback| will be called as soon as abortion has been finished. |
| 92 bool Abort(CompletionCallback callback); | 99 int32_t Abort(CompletionCallback callback); |
| 93 | 100 |
| 94 private: | 101 private: |
| 95 // Pointer to the plugin's video decoder support interface for providing the | 102 // Pointer to the plugin's video decoder support interface for providing the |
| 96 // buffers for video decoding. | 103 // buffers for video decoding. |
| 97 Client* client_; | 104 Client* client_; |
| 98 | 105 |
| 99 // Suppress compiler-generated copy constructors. | 106 // Suppress compiler-generated copy constructors. |
| 100 VideoDecoder(const VideoDecoder&); | 107 VideoDecoder(const VideoDecoder&); |
| 101 void operator=(const VideoDecoder&); | 108 void operator=(const VideoDecoder&); |
| 102 }; | 109 }; |
| 103 | 110 |
| 104 } // namespace pp | 111 } // namespace pp |
| 105 | 112 |
| 106 #endif // PPAPI_CPP_DEV_VIDEO_DECODER_DEV_H_ | 113 #endif // PPAPI_CPP_DEV_VIDEO_DECODER_DEV_H_ |
| OLD | NEW |