Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Side by Side Diff: ppapi/c/dev/ppb_video_decoder_dev.h

Issue 6901036: Update VideoDecode PPAPI structs to be consistent with media structures, part 1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: a few minor clean-ups Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_C_DEV_PPB_VIDEO_DECODER_DEV_H_ 5 #ifndef PPAPI_C_DEV_PPB_VIDEO_DECODER_DEV_H_
6 #define PPAPI_C_DEV_PPB_VIDEO_DECODER_DEV_H_ 6 #define PPAPI_C_DEV_PPB_VIDEO_DECODER_DEV_H_
7 7
8 #include "ppapi/c/dev/pp_video_dev.h" 8 #include "ppapi/c/dev/pp_video_dev.h"
9 #include "ppapi/c/pp_completion_callback.h" 9 #include "ppapi/c/pp_completion_callback.h"
10 #include "ppapi/c/pp_var.h" 10 #include "ppapi/c/pp_var.h"
11 11
12 #define PPB_VIDEODECODER_DEV_INTERFACE_0_5 "PPB_VideoDecoder(Dev);0.5" 12 #define PPB_VIDEODECODER_DEV_INTERFACE_0_6 "PPB_VideoDecoder(Dev);0.6"
13 #define PPB_VIDEODECODER_DEV_INTERFACE PPB_VIDEODECODER_DEV_INTERFACE_0_5 13 #define PPB_VIDEODECODER_DEV_INTERFACE PPB_VIDEODECODER_DEV_INTERFACE_0_6
14 14
15 // Video decoder interface. 15 // Video decoder interface.
16 // 16 //
17 // Basic usage: 17 // Basic usage:
18 // 1. Use GetConfigs() to query potential configurations. Configuration 18 // 1. Use GetConfigs() to query potential configurations. Configuration
19 // information includes: 19 // information includes:
20 // a. Bitstream format. 20 // a. Bitstream format.
21 // b. Output picture format. 21 // b. Output picture format.
22 // c. Output picture buffer storage type. 22 // c. Output picture buffer storage type.
23 // 2. Select configuration that suits you and Create() the decoder with the 23 // 2. Select configuration that suits you and Create() the decoder with the
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // with valid elements to the buffer pointed by |matching_configs|. No more 63 // with valid elements to the buffer pointed by |matching_configs|. No more
64 // than |config_size| PP_VideoConfig_Devs will be returned even if more would 64 // than |config_size| PP_VideoConfig_Devs will be returned even if more would
65 // be available for the decoder device. 65 // be available for the decoder device.
66 // 66 //
67 // When this function is called with |matching_configs| = NULL, then no 67 // When this function is called with |matching_configs| = NULL, then no
68 // configurations are returned, but the total number of PP_VideoConfig_Devs 68 // configurations are returned, but the total number of PP_VideoConfig_Devs
69 // available will be returned in |num_of_matching_configs|. 69 // available will be returned in |num_of_matching_configs|.
70 // 70 //
71 // Returns PP_TRUE on success, PP_FALSE otherwise. 71 // Returns PP_TRUE on success, PP_FALSE otherwise.
72 PP_Bool (*GetConfigs)(PP_Instance instance, 72 PP_Bool (*GetConfigs)(PP_Instance instance,
73 struct PP_VideoDecoderConfig_Dev* proto_config, 73 PP_VideoConfigElement* proto_config,
74 struct PP_VideoDecoderConfig_Dev* matching_configs, 74 PP_VideoConfigElement* matching_configs,
75 int32_t matching_configs_size, 75 uint32_t matching_configs_size,
76 int32_t* num_of_matching_configs); 76 uint32_t* num_of_matching_configs);
77 77
78 // Creates a video decoder with requested |decoder_config|. 78 // Creates a video decoder with requested |decoder_config|.
79 // |input_format| in |decoder_config| specifies the format of input access 79 // |input_format| in |decoder_config| specifies the format of input access
80 // unit, with PP_VIDEOKEY_CODECID and PP_VIDEOKEY_PAYLOADFORMAT required. 80 // unit, with PP_VIDEOKEY_CODECID and PP_VIDEOKEY_PAYLOADFORMAT required.
81 // Plugin has the option to specify codec profile/level and other 81 // Plugin has the option to specify codec profile/level and other
82 // information such as PP_VIDEOKEY_ACCELERATION, to let browser choose 82 // information such as PP_VIDEOKEY_ACCELERATION, to let browser choose
83 // the most appropriate decoder. 83 // the most appropriate decoder.
84 // 84 //
85 // Parameters: 85 // Parameters:
86 // |instance| pointer to the plugin instance. 86 // |instance| pointer to the plugin instance.
87 // |dec_config| the configuration which to use to initialize the decoder. 87 // |dec_config| the configuration which to use to initialize the decoder.
88 // 88 //
89 // The created decoder is returned as PP_Resource. NULL means failure. 89 // The created decoder is returned as PP_Resource. NULL means failure.
90 PP_Resource (*Create)(PP_Instance instance, 90 PP_Resource (*Create)(PP_Instance instance,
91 struct PP_VideoDecoderConfig_Dev* dec_config); 91 PP_VideoConfigElement* dec_config);
92 92
93 // Tests whether |resource| is a video decoder created through Create 93 // Tests whether |resource| is a video decoder created through Create
94 // function of this interface. 94 // function of this interface.
95 // 95 //
96 // Parameters: 96 // Parameters:
97 // |resource| is handle to resource to test. 97 // |resource| is handle to resource to test.
98 // 98 //
99 // Returns true if is a video decoder, false otherwise. 99 // Returns true if is a video decoder, false otherwise.
100 PP_Bool (*IsVideoDecoder)(PP_Resource resource); 100 PP_Bool (*IsVideoDecoder)(PP_Resource resource);
101 101
102 // Dispatches bitstream buffer to the decoder. This is asynchronous and 102 // Dispatches bitstream buffer to the decoder. This is asynchronous and
103 // non-blocking function. 103 // non-blocking function.
104 // 104 //
105 // Parameters: 105 // Parameters:
106 // |video_decoder| is the previously created handle to the decoder instance. 106 // |video_decoder| is the previously created handle to the decoder instance.
107 // |bitstream_buffer| is the bitstream buffer that contains the input data. 107 // |bitstream_buffer| is the bitstream buffer that contains the input data.
108 // |callback| will be called when |bitstream_buffer| has been processed by 108 // |callback| will be called when |bitstream_buffer| has been processed by
109 // the decoder. 109 // the decoder.
110 // 110 //
111 // Returns PP_TRUE on decoder successfully accepting buffer, PP_FALSE 111 // Returns PP_TRUE on decoder successfully accepting buffer, PP_FALSE
112 // otherwise. 112 // otherwise.
113 PP_Bool (*Decode)(PP_Resource video_decoder, 113 PP_Bool (*Decode)(PP_Resource video_decoder,
114 struct PP_VideoBitstreamBuffer_Dev* bitstream_buffer, 114 struct PP_VideoBitstreamBuffer_Dev* bitstream_buffer,
115 struct PP_CompletionCallback callback); 115 struct PP_CompletionCallback callback);
116 116
117 // Provides the decoder with picture buffers for video decoding. This 117 // Provides the decoder with texture-backed picture buffers for video
118 // function should be called when decoder has issued ProvidePictureBuffers 118 // decoding.
119 // callback to the plugin with buffer requirements.
120 // 119 //
121 // If the plugin is can determine how many and what kind of buffers are 120 // This function should be called when decoder has issued the
122 // needed by the decoder it can provide them in advance. For this purpose 121 // ProvidePictureBuffers callback to the plugin with buffer requirements.
123 // the configuration map can provide how many extra buffers the decoder
124 // implementation requires for seamless operation.
125 // 122 //
126 // The decoder will pause if AssignPictureBuffer hasn't been called with 123 // It can also be called in advance or outside of ProvidePictureBuffers calls
127 // sufficient buffers. 124 // to provide the decoder with additional buffers. Additional buffers will be
125 // added to the decoder's buffer pool.
128 // 126 //
129 // If the decoder rejects the buffers it will return the buffers and issue 127 // The decoder will pause in decoding if it has not received enough buffers.
128 //
129 // If the buffer is invalid, the decoder will return the buffer and will issue
130 // ProvidePictureBuffers again. 130 // ProvidePictureBuffers again.
131 // 131 //
132 // If AssignPictureBuffer is called multiple times the decoder will add them 132 // TODO(vmr/vrk): Decide if the API is too flexible, i.e. stricter rules on
133 // to its pool of output pictures. 133 // errors/duplicates or requiring Assign*Buffers to only be called in response
134 // 134 // to ProvidePictureBuffers.
Ami GONE FROM CHROMIUM 2011/05/03 23:34:47 ...in which case they should just be callback para
vrk (LEFT CHROMIUM) 2011/05/05 05:57:12 Good point. Added this almost verbatim to the comm
135 // TODO(vmr): this API feels too flexible... should we make it more strict
136 // where the decoder errors on bad buffers/duplicate buffers? Perhaps
137 // AssignPictureBuffer should only get called in response to
138 // ProvidePictureBuffer?
139 // 135 //
140 // Parameters: 136 // Parameters:
141 // |video_decoder| is the previously created handle to the decoder instance. 137 // |video_decoder| is the previously created handle to the decoder instance.
142 // |no_of_buffers| how many buffers are behind picture buffer pointer. 138 // |no_of_buffers| how many buffers are behind picture buffer pointer.
143 // |picture_buffer| contains the reference to the picture buffer that was 139 // |buffers| contains the reference to the picture buffer that was
144 // processed. 140 // allocated.
145 void (*AssignPictureBuffer)(PP_Resource video_decoder, 141 void (*AssignGLESBuffers)(PP_Resource video_decoder,
142 uint32_t no_of_buffers,
143 struct PP_GLESBuffer_Dev* buffers);
144
145 // Provides the decoder with system memory-backed picture buffers for video
Ami GONE FROM CHROMIUM 2011/05/03 23:34:47 I think this comment & the newline preceding it ca
vrk (LEFT CHROMIUM) 2011/05/05 05:57:12 Done. I did a similar thing with the comments for
146 // decoding.
147 //
148 // Please see comment in AssignGLESBuffers for usage; it is the same as
149 // AssignGLES except it is for buffers in system memory, not GPU.
150 //
151 // Parameters:
152 // |video_decoder| is the previously created handle to the decoder instance.
153 // |no_of_buffers| how many buffers are behind picture buffer pointer.
154 // |buffers| contains the reference to the picture buffer that was
155 // allocated.
156 void (*AssignSysmemBuffers)(PP_Resource video_decoder,
146 uint32_t no_of_buffers, 157 uint32_t no_of_buffers,
147 union PP_PictureData_Dev* picture_buffer); 158 struct PP_SysmemBuffer_Dev* buffers);
148 159
149 // Tells the decoder to reuse given picture buffer. Typical use of this 160 // Tells the decoder to reuse given picture buffer. Typical use of this
150 // function is to call from PictureReady callback to recycle picture buffer 161 // function is to call from PictureReady callback to recycle picture buffer
151 // back to the decoder after blitting the image so that decoder can use the 162 // back to the decoder after blitting the image so that decoder can use the
152 // image for output again. 163 // image for output again.
153 // 164 //
154 // The decoder will ignore any picture buffer not previously provided via 165 // The decoder will ignore any picture buffer not previously provided via
155 // AssignPictureBuffer. 166 // AssignPictureBuffer.
156 // 167 //
157 // TODO(vmr): figure out how the sync will be handled with command buffer as 168 // TODO(vmr): figure out how the sync will be handled with command buffer as
158 // there will be possibly lag due to command buffer implementation 169 // there will be possibly lag due to command buffer implementation
159 // to actual GL swap. At that moment decoder may have already taken 170 // to actual GL swap. At that moment decoder may have already taken
160 // the GL textures for writing output again. 171 // the GL textures for writing output again.
161 // 172 //
162 // Parameters: 173 // Parameters:
163 // |video_decoder| is the previously created handle to the decoder instance. 174 // |video_decoder| is the previously created handle to the decoder instance.
164 // |picture_buffer| contains the reference to the picture buffer that was 175 // |picture_buffer| contains the reference to the picture buffer that was
165 // processed. 176 // processed.
166 void (*ReusePictureBuffer)(PP_Resource video_decoder, 177 void (*ReusePictureBuffer)(PP_Resource video_decoder,
167 union PP_PictureData_Dev* picture_buffer); 178 int32_t picture_buffer_id);
168 179
169 // Dispatches flushing request to the decoder to flush both input and output 180 // Dispatches flushing request to the decoder to flush both input and output
170 // buffers. Successful flushing will result in output of the pictures and 181 // buffers. Successful flushing will result in output of the pictures and
171 // buffers held inside the decoder and returning of bitstream buffers using 182 // buffers held inside the decoder and returning of bitstream buffers using
172 // the callbacks implemented by the plug-in. Once done with flushing, the 183 // the callbacks implemented by the plug-in. Once done with flushing, the
173 // decode will call the |callback|. 184 // decode will call the |callback|.
174 // 185 //
175 // Parameters: 186 // Parameters:
176 // |video_decoder| is the previously created handle to the decoder instance. 187 // |video_decoder| is the previously created handle to the decoder instance.
177 // |callback| is one-time callback that will be called once the flushing 188 // |callback| is one-time callback that will be called once the flushing
(...skipping 15 matching lines...) Expand all
193 // |callback| is one-time callback that will be called once the abortion 204 // |callback| is one-time callback that will be called once the abortion
194 // request has been completed. 205 // request has been completed.
195 // 206 //
196 // Returns PP_TRUE on acceptance of abort request and PP_FALSE if request to 207 // Returns PP_TRUE on acceptance of abort request and PP_FALSE if request to
197 // abort is rejected by the decoder. 208 // abort is rejected by the decoder.
198 PP_Bool (*Abort)(PP_Resource video_decoder, 209 PP_Bool (*Abort)(PP_Resource video_decoder,
199 struct PP_CompletionCallback callback); 210 struct PP_CompletionCallback callback);
200 }; 211 };
201 212
202 #endif /* PPAPI_C_DEV_PPB_VIDEO_DECODER_DEV_H_ */ 213 #endif /* PPAPI_C_DEV_PPB_VIDEO_DECODER_DEV_H_ */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698