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