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