1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
/**
* Copyright (c) 2017 Parrot Drones SAS
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the Parrot Drones SAS Company nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PARROT DRONES SAS COMPANY BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
extern "C" VDEC_API_EXPORTS
/* !_WIN32 */
/* !VDEC_API_EXPORTS */
/**
* Get the supported input buffer data formats for the given
* decoder implementation.
* Each implementation supports at least one input format,
* and optionally more. All input buffers need to be in one of
* the supported formats, otherwise they will be discarded.
* The returned formats array is a static array whose size is the return value
* of this function. If this function returns an error (negative errno value),
* then the value of *formats is undefined.
* @param implem: decoder implementation
* @param formats: pointer to the supported formats list (output)
* @return the size of the formats array, or a negative errno on error.
*/
VDEC_API int
;
/**
* Get the implementation that will be chosen in case VDEC_DECODER_IMPLEM_AUTO
* is used.
* @return the decoder implementation, or VDEC_DECODER_IMPLEM_AUTO in case of
* error
*/
VDEC_API enum vdec_decoder_implem ;
/**
* Get an implementation for a given coded format
* @param format: coded format to support
* @return the decoder implementation, or VDEC_DECODER_IMPLEM_AUTO in case of
* error
*/
VDEC_API enum ;
/**
* Create a decoder instance.
* The configuration and callbacks structures must be filled.
* The instance handle is returned through the ret_obj parameter.
* When no longer needed, the instance must be freed using the
* vdec_destroy() function.
* @param loop: event loop to use
* @param config: decoder configuration
* @param cbs: decoder callback functions
* @param userdata: callback functions user data (optional, can be null)
* @param ret_obj: decoder instance handle (output)
* @return 0 on success, negative errno value in case of error
*/
VDEC_API int ;
/**
* Flush the decoder.
* This function flushes all queues and optionally discards all buffers
* retained by the decoder. If the buffers are not discarded the frame
* output callback is called for each frame when the decoding is complete.
* The function is asynchronous and returns immediately. When flushing is
* complete the flush callback function is called if defined. After flushing
* the decoder new input buffers can still be queued but should start with a
* synchronization frame (e.g. IDR frame or start of refresh).
* @param self: decoder instance handle
* @param discard: if null, all pending buffers are output, otherwise they
* are discarded
* @return 0 on success, negative errno value in case of error
*/
VDEC_API int ;
/**
* Stop the decoder.
* This function stops any running threads. The function is asynchronous and
* returns immediately. When stopping is complete the stop callback function
* is called if defined. After stopping the decoder no new input buffers
* can be queued and the decoder instance must be freed using the
* vdec_destroy() function.
* @param self: decoder instance handle
* @return 0 on success, negative errno value in case of error
*/
VDEC_API int ;
/**
* Free a decoder instance.
* This function frees all resources associated with a decoder instance.
* @note this function blocks until all internal threads (if any) can be
* joined; therefore the application should call vdec_stop() and wait for
* the stop callback function to be called before calling vdec_destroy().
* @param self: decoder instance handle
* @return 0 on success, negative errno value in case of error
*/
VDEC_API int ;
/**
* Set the JPEG parameters for decoding.
* This function must be called prior to decoding (i.e. pushing buffer into
* the input queue). The ownership of the format_info struct stays
* with the caller. It is the caller's responsibility to ensure that the
* instance is configured to decode a MJPEG/JPEG stream.
* @param self decoder instance handle
* @param[in] format_info: image format information
* @return 0 on success, negative errno value in case of error
*/
VDEC_API int ;
/**
* Set the H264 parameter sets for decoding.
* This function must be called prior to decoding (i.e. pushing buffer into
* the input queue) with the H.264 SPS and PPS. The SPS and PPS data will be
* copied internally if necessary. The ownership of the SPS and PPS buffers
* stays with the caller. It is the caller's responsibility to ensure that
* the instance is configured to decode a H.264 stream.
* @param self decoder instance handle
* @param[in] sps: pointer to the SPS data
* @param[in] sps_size: SPS size
* @param[in] pps: pointer to the PPS data
* @param[in] pps_size: PPS size
* @param[in] format: SPS and PPS data format
* @return 0 on success, negative errno value in case of error
*/
VDEC_API int ;
/**
* Set the H.265 parameter sets for decoding.
* This function must be called prior to decoding (i.e. pushing buffers
* into the input queue) with the H.265 VPS, SPS and
* PPS. Ownership of buffers is retained by the caller. It is the caller's
* responsibility to ensure that the instance is configured to decode a H.265
* stream.
* @param[in] self: decoder instance handle
* @param[in] vps: VPS buffer pointer
* @param[in] vps_size: VPS buffer size
* @param[in] sps: SPS buffer pointer
* @param[in] sps_size: SPS buffer size
* @param[in] pps: PPS buffer pointer
* @param[in] pps_size: PPS buffer size
* @param[in] format: data format
* @return 0 on success, negative errno value in case of error.
*/
VDEC_API int ;
/**
* Get the input buffer pool.
* The input buffer pool is defined only for implementations that require
* using input memories from the decoder's own pool. This function must
* be called prior to decoding and if the returned value is not NULL the
* input buffer pool should be used to get input memories. If the input
* memories provided are not originating from the pool, they will be copied
* resulting in a loss of performance.
* @param self: decoder instance handle
* @return a pointer on the input memory pool on success, NULL in case of
* error or if no pool is used
*/
VDEC_API struct mbuf_pool *
;
/**
* Get the input frame queue.
* This function must be called prior to decoding and the input
* frame queue must be used to push input frames for decoding.
* @param self: decoder instance handle
* @return a pointer on the input frame queue on success, NULL in case of error
*/
VDEC_API struct mbuf_coded_video_frame_queue *
;
/**
* Get the video dimensions.
* @param self: decoder instance handle
* @param width: video width (output, optional, can be null)
* @param height: video height (output, optional, can be null)
* @param sar_width: video SAR width (output, optional, can be null)
* @param sar_width: video SAR height (output, optional, can be null)
* @param crop_left: video crop X coordinate (output, optional, can be null)
* @param crop_top: video crop Y coordinate (output, optional, can be null)
* @param crop_width: video crop width (output, optional, can be null)
* @param crop_height: video crop height (output, optional, can be null)
* @return 0 on success, negative errno value in case of error
*/
VDEC_API int ;
/**
* Get the decoder implementation used.
* @param self: decoder instance handle
* @return the decoder implementation used, or VDEC_DECODER_IMPLEM_AUTO
* in case of error
*/
VDEC_API enum ;
}
/* __cplusplus */
/* !_VDEC_H_ */