1 /*
2 mediastreamer2 library - modular sound and video processing and streaming
3 Copyright (C) 2006  Simon MORLAT (simon.morlat@linphone.org)
4 
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
9 
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU General Public License for more details.
14 
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18 */
19 
20 #ifndef msvideo_h
21 #define msvideo_h
22 
23 #include <mediastreamer2/msfilter.h>
24 
25 
26 /* some global constants for video MSFilter(s) */
27 #define MS_VIDEO_SIZE_UNKNOWN_W 0
28 #define MS_VIDEO_SIZE_UNKNOWN_H 0
29 
30 #define MS_VIDEO_SIZE_SQCIF_W 128
31 #define MS_VIDEO_SIZE_SQCIF_H 96
32 
33 #define MS_VIDEO_SIZE_WQCIF_W 256
34 #define MS_VIDEO_SIZE_WQCIF_H 144
35 
36 #define MS_VIDEO_SIZE_QCIF_W 176
37 #define MS_VIDEO_SIZE_QCIF_H 144
38 
39 #define MS_VIDEO_SIZE_CIF_W 352
40 #define MS_VIDEO_SIZE_CIF_H 288
41 
42 #define MS_VIDEO_SIZE_CVD_W 352
43 #define MS_VIDEO_SIZE_CVD_H 480
44 
45 #define MS_VIDEO_SIZE_ICIF_W 352
46 #define MS_VIDEO_SIZE_ICIF_H 576
47 
48 #define MS_VIDEO_SIZE_4CIF_W 704
49 #define MS_VIDEO_SIZE_4CIF_H 576
50 
51 #define MS_VIDEO_SIZE_W4CIF_W 1024
52 #define MS_VIDEO_SIZE_W4CIF_H 576
53 
54 #define MS_VIDEO_SIZE_QQVGA_W 160
55 #define MS_VIDEO_SIZE_QQVGA_H 120
56 
57 #define MS_VIDEO_SIZE_HQVGA_W 160
58 #define MS_VIDEO_SIZE_HQVGA_H 240
59 
60 #define MS_VIDEO_SIZE_QVGA_W 320
61 #define MS_VIDEO_SIZE_QVGA_H 240
62 
63 #define MS_VIDEO_SIZE_HVGA_W 320
64 #define MS_VIDEO_SIZE_HVGA_H 480
65 
66 #define MS_VIDEO_SIZE_VGA_W 640
67 #define MS_VIDEO_SIZE_VGA_H 480
68 
69 #define MS_VIDEO_SIZE_SVGA_W 800
70 #define MS_VIDEO_SIZE_SVGA_H 600
71 
72 #define MS_VIDEO_SIZE_NS1_W 324
73 #define MS_VIDEO_SIZE_NS1_H 248
74 
75 #define MS_VIDEO_SIZE_QSIF_W 176
76 #define MS_VIDEO_SIZE_QSIF_H 120
77 
78 #define MS_VIDEO_SIZE_SIF_W 352
79 #define MS_VIDEO_SIZE_SIF_H 240
80 
81 #define MS_VIDEO_SIZE_IOS_MEDIUM_W 480
82 #define MS_VIDEO_SIZE_IOS_MEDIUM_H 360
83 
84 #define MS_VIDEO_SIZE_ISIF_W 352
85 #define MS_VIDEO_SIZE_ISIF_H 480
86 
87 #define MS_VIDEO_SIZE_4SIF_W 704
88 #define MS_VIDEO_SIZE_4SIF_H 480
89 
90 #define MS_VIDEO_SIZE_288P_W 512
91 #define MS_VIDEO_SIZE_288P_H 288
92 
93 #define MS_VIDEO_SIZE_432P_W 768
94 #define MS_VIDEO_SIZE_432P_H 432
95 
96 #define MS_VIDEO_SIZE_448P_W 768
97 #define MS_VIDEO_SIZE_448P_H 448
98 
99 #define MS_VIDEO_SIZE_480P_W 848
100 #define MS_VIDEO_SIZE_480P_H 480
101 
102 #define MS_VIDEO_SIZE_576P_W 1024
103 #define MS_VIDEO_SIZE_576P_H 576
104 
105 #define MS_VIDEO_SIZE_720P_W 1280
106 #define MS_VIDEO_SIZE_720P_H 720
107 
108 #define MS_VIDEO_SIZE_1080P_W 1920
109 #define MS_VIDEO_SIZE_1080P_H 1080
110 
111 #define MS_VIDEO_SIZE_SDTV_W 768
112 #define MS_VIDEO_SIZE_SDTV_H 576
113 
114 #define MS_VIDEO_SIZE_HDTVP_W 1920
115 #define MS_VIDEO_SIZE_HDTVP_H 1200
116 
117 #define MS_VIDEO_SIZE_XGA_W 1024
118 #define MS_VIDEO_SIZE_XGA_H 768
119 
120 #define MS_VIDEO_SIZE_WXGA_W 1080
121 #define MS_VIDEO_SIZE_WXGA_H 768
122 
123 #define MS_VIDEO_SIZE_SXGA_MINUS_W 1280
124 #define MS_VIDEO_SIZE_SXGA_MINUS_H 960
125 
126 #define MS_VIDEO_SIZE_UXGA_W 1600
127 #define MS_VIDEO_SIZE_UXGA_H 1200
128 
129 
130 
131 
132 typedef struct MSRect{
133 	int x,y,w,h;
134 } MSRect;
135 
136 /**
137  * Structure describing a video configuration to be able to define a video size, a FPS
138  * and some other parameters according to the desired bitrate.
139  */
140 struct _MSVideoConfiguration {
141 	int required_bitrate;	/**< The minimum bitrate required for the video configuration to be used. */
142 	int bitrate_limit;	/**< The maximum bitrate to use when this video configuration is used. */
143 	MSVideoSize vsize;	/**< The video size that is used when using this video configuration. */
144 	float fps;	/**< The FPS that is used when using this video configuration. */
145 	int mincpu;	/**< The minimum cpu count necessary when this configuration is used */
146 	void *extra;	/**< A pointer to some extra parameters that may be used by the encoder when using this video configuration. */
147 };
148 
149 #define MS_VIDEO_CONF(required_bitrate, bitrate_limit, resolution, fps, mincpu) \
150 	{ required_bitrate, bitrate_limit, { MS_VIDEO_SIZE_ ## resolution ## _W, MS_VIDEO_SIZE_ ## resolution ## _H }, fps, mincpu, NULL }
151 
152 /**
153  * Definition of the MSVideoConfiguration type.
154  * @see struct _MSVideoConfiguration
155  */
156 typedef struct _MSVideoConfiguration MSVideoConfiguration;
157 
158 #define MS_VIDEO_SIZE_UNKNOWN (MSVideoSize){ MS_VIDEO_SIZE_UNKNOWN_W, MS_VIDEO_SIZE_UNKNOWN_H }
159 
160 #define MS_VIDEO_SIZE_CIF (MSVideoSize){MS_VIDEO_SIZE_CIF_W,MS_VIDEO_SIZE_CIF_H}
161 #define MS_VIDEO_SIZE_QCIF (MSVideoSize){MS_VIDEO_SIZE_QCIF_W,MS_VIDEO_SIZE_QCIF_H}
162 #define MS_VIDEO_SIZE_4CIF (MSVideoSize){MS_VIDEO_SIZE_4CIF_W,MS_VIDEO_SIZE_4CIF_H}
163 #define MS_VIDEO_SIZE_CVD (MSVideoSize){MS_VIDEO_SIZE_CVD_W, MS_VIDEO_SIZE_CVD_H}
164 #define MS_VIDEO_SIZE_QQVGA (MSVideoSize){MS_VIDEO_SIZE_QQVGA_W,MS_VIDEO_SIZE_QQVGA_H}
165 #define MS_VIDEO_SIZE_QVGA (MSVideoSize){MS_VIDEO_SIZE_QVGA_W,MS_VIDEO_SIZE_QVGA_H}
166 #define MS_VIDEO_SIZE_VGA (MSVideoSize){MS_VIDEO_SIZE_VGA_W,MS_VIDEO_SIZE_VGA_H}
167 
168 #define MS_VIDEO_SIZE_IOS_MEDIUM (MSVideoSize){ MS_VIDEO_SIZE_IOS_MEDIUM_W, MS_VIDEO_SIZE_IOS_MEDIUM_H }
169 
170 #define MS_VIDEO_SIZE_720P (MSVideoSize){MS_VIDEO_SIZE_720P_W, MS_VIDEO_SIZE_720P_H}
171 
172 #define MS_VIDEO_SIZE_1080P (MSVideoSize){ MS_VIDEO_SIZE_1080P_W, MS_VIDEO_SIZE_1080P_H }
173 
174 #define MS_VIDEO_SIZE_NS1 (MSVideoSize){MS_VIDEO_SIZE_NS1_W,MS_VIDEO_SIZE_NS1_H}
175 
176 #define MS_VIDEO_SIZE_XGA (MSVideoSize){MS_VIDEO_SIZE_XGA_W, MS_VIDEO_SIZE_XGA_H}
177 
178 #define MS_VIDEO_SIZE_SVGA (MSVideoSize){MS_VIDEO_SIZE_SVGA_W, MS_VIDEO_SIZE_SVGA_H}
179 
180 #define MS_VIDEO_SIZE_SXGA_MINUS (MSVideoSize){ MS_VIDEO_SIZE_SXGA_MINUS_W, MS_VIDEO_SIZE_SXGA_MINUS_H }
181 
182 #define MS_VIDEO_SIZE_UXGA (MSVideoSize){ MS_VIDEO_SIZE_UXGA_W, MS_VIDEO_SIZE_UXGA_H }
183 
184 #ifdef _MSC_VER
185 #define MS_VIDEO_SIZE_ASSIGN(vsize,name) \
186 	{\
187 	(vsize).width=MS_VIDEO_SIZE_##name##_W; \
188 	(vsize).height=MS_VIDEO_SIZE_##name##_H; \
189 	}
190 #else
191 #define MS_VIDEO_SIZE_ASSIGN(vsize,name) \
192 	vsize=MS_VIDEO_SIZE_##name
193 #endif
194 
195 /*deprecated: use MS_VIDEO_SIZE_SVGA*/
196 #define MS_VIDEO_SIZE_800X600_W MS_VIDEO_SIZE_SVGA_W
197 #define MS_VIDEO_SIZE_800X600_H MS_VIDEO_SIZE_SVGA_H
198 #define MS_VIDEO_SIZE_800X600 MS_VIDEO_SIZE_SVGA
199 /*deprecated use MS_VIDEO_SIZE_XGA*/
200 #define MS_VIDEO_SIZE_1024_W 1024
201 #define MS_VIDEO_SIZE_1024_H 768
202 #define MS_VIDEO_SIZE_1024 MS_VIDEO_SIZE_XGA
203 
204 typedef enum{
205 	MS_NO_MIRROR,
206 	MS_HORIZONTAL_MIRROR, /*according to a vertical line in the center of buffer*/
207 	MS_CENTRAL_MIRROR, /*both*/
208 	MS_VERTICAL_MIRROR /*according to an horizontal line*/
209 }MSMirrorType;
210 
211 typedef enum MSVideoOrientation{
212 	MS_VIDEO_LANDSCAPE = 0,
213 	MS_VIDEO_PORTRAIT =1
214 }MSVideoOrientation;
215 
216 typedef enum{
217 	MS_PIX_FMT_UNKNOWN, /* First, so that it's value does not change. */
218 	MS_YUV420P,
219 	MS_YUYV,
220 	MS_RGB24,
221 	MS_RGB24_REV, /*->microsoft down-top bitmaps */
222 	MS_MJPEG,
223 	MS_UYVY,
224 	MS_YUY2,   /* -> same as MS_YUYV */
225 	MS_RGBA32,
226 	MS_RGB565,
227 	MS_H264
228 }MSPixFmt;
229 
230 typedef struct _MSPicture{
231 	int w,h;
232 	uint8_t *planes[4]; /* we usually use 3 planes, 4th is for compatibility with ffmpeg's swscale.h */
233 	int strides[4];	/* Bytes per row */
234 }MSPicture;
235 
236 typedef struct _MSPicture YuvBuf; /*for backward compatibility*/
237 
238 typedef msgb_allocator_t MSYuvBufAllocator;
239 
240 #ifdef __cplusplus
241 extern "C"{
242 #endif
243 
244 MS2_PUBLIC const char *ms_pix_fmt_to_string(MSPixFmt fmt);
245 MS2_PUBLIC int ms_pix_fmt_to_ffmpeg(MSPixFmt fmt);
246 MS2_PUBLIC MSPixFmt ffmpeg_pix_fmt_to_ms(int fmt);
247 MS2_PUBLIC MSPixFmt ms_fourcc_to_pix_fmt(uint32_t fourcc);
248 MS2_PUBLIC void ms_ffmpeg_check_init(void);
249 MS2_PUBLIC void ms_yuv_buf_init(YuvBuf *buf, int w, int h, int stride, uint8_t *ptr);
250 MS2_PUBLIC int ms_yuv_buf_init_from_mblk(MSPicture *buf, mblk_t *m);
251 MS2_PUBLIC int ms_yuv_buf_init_from_mblk_with_size(MSPicture *buf, mblk_t *m, int w, int h);
252 MS2_PUBLIC int ms_picture_init_from_mblk_with_size(MSPicture *buf, mblk_t *m, MSPixFmt fmt, int w, int h);
253 MS2_PUBLIC mblk_t * ms_yuv_buf_alloc(MSPicture *buf, int w, int h);
254 
255 /* Allocates a video mblk_t with supplied width and height, the pixels being contained in an external buffer.
256 The returned mblk_t points to the external buffer, which is not copied, nor ref'd: the reference is simply transfered to the returned mblk_t*/
257 MS2_PUBLIC mblk_t * ms_yuv_buf_alloc_from_buffer(int w, int h, mblk_t* buffer);
258 MS2_PUBLIC void ms_yuv_buf_copy(uint8_t *src_planes[], const int src_strides[],
259 		uint8_t *dst_planes[], const int dst_strides[], MSVideoSize roi);
260 MS2_PUBLIC void ms_yuv_buf_copy_with_pix_strides(uint8_t *src_planes[], const int src_row_strides[], const int src_pix_strides[], MSRect src_roi,
261 		uint8_t *dst_planes[], const int dst_row_strides[], const int dst_pix_strides[], MSRect dst_roi);
262 MS2_PUBLIC void ms_yuv_buf_mirror(YuvBuf *buf);
263 MS2_PUBLIC void ms_yuv_buf_mirrors(YuvBuf *buf,const MSMirrorType type);
264 MS2_PUBLIC void rgb24_mirror(uint8_t *buf, int w, int h, int linesize);
265 MS2_PUBLIC void rgb24_revert(uint8_t *buf, int w, int h, int linesize);
266 MS2_PUBLIC void rgb24_copy_revert(uint8_t *dstbuf, int dstlsz,
267 				const uint8_t *srcbuf, int srclsz, MSVideoSize roi);
268 
269 MS2_PUBLIC MSYuvBufAllocator *ms_yuv_buf_allocator_new(void);
270 MS2_PUBLIC mblk_t *ms_yuv_buf_allocator_get(MSYuvBufAllocator *obj, MSPicture *buf, int w, int h);
271 MS2_PUBLIC void ms_yuv_buf_allocator_free(MSYuvBufAllocator *obj);
272 
273 MS2_PUBLIC void ms_rgb_to_yuv(const uint8_t rgb[3], uint8_t yuv[3]);
274 
275 
276 #ifdef MS_HAS_ARM
277 MS2_PUBLIC void rotate_plane_neon_clockwise(int wDest, int hDest, int full_width, const uint8_t* src, uint8_t* dst);
278 MS2_PUBLIC void rotate_plane_neon_anticlockwise(int wDest, int hDest, int full_width, const uint8_t* src, uint8_t* dst);
279 MS2_PUBLIC void deinterlace_and_rotate_180_neon(const uint8_t* ysrc, const uint8_t* cbcrsrc, uint8_t* ydst, uint8_t* udst, uint8_t* vdst, int w, int h, int y_byte_per_row,int cbcr_byte_per_row);
280 void deinterlace_down_scale_and_rotate_180_neon(const uint8_t* ysrc, const uint8_t* cbcrsrc, uint8_t* ydst, uint8_t* udst, uint8_t* vdst, int w, int h, int y_byte_per_row,int cbcr_byte_per_row,bool_t down_scale);
281 void deinterlace_down_scale_neon(const uint8_t* ysrc, const uint8_t* cbcrsrc, uint8_t* ydst, uint8_t* u_dst, uint8_t* v_dst, int w, int h, int y_byte_per_row,int cbcr_byte_per_row,bool_t down_scale);
282 #endif
283 MS2_PUBLIC mblk_t *copy_ycbcrbiplanar_to_true_yuv_with_rotation_and_down_scale_by_2(MSYuvBufAllocator *allocator, const uint8_t* y, const uint8_t * cbcr, int rotation, int w, int h, int y_byte_per_row,int cbcr_byte_per_row, bool_t uFirstvSecond, bool_t down_scale);
284 
ms_video_size_make(int width,int height)285 static MS2_INLINE MSVideoSize ms_video_size_make(int width, int height){
286 	MSVideoSize vsize;
287 	vsize.width = width;
288 	vsize.height = height;
289 	return vsize;
290 }
291 
ms_video_size_greater_than(MSVideoSize vs1,MSVideoSize vs2)292 static MS2_INLINE bool_t ms_video_size_greater_than(MSVideoSize vs1, MSVideoSize vs2){
293 	return (vs1.width>=vs2.width) && (vs1.height>=vs2.height);
294 }
295 
ms_video_size_area_greater_than(MSVideoSize vs1,MSVideoSize vs2)296 static MS2_INLINE bool_t ms_video_size_area_greater_than(MSVideoSize vs1, MSVideoSize vs2){
297 	return (vs1.width*vs1.height >= vs2.width*vs2.height);
298 }
299 
ms_video_size_area_strictly_greater_than(MSVideoSize vs1,MSVideoSize vs2)300 static MS2_INLINE bool_t ms_video_size_area_strictly_greater_than(MSVideoSize vs1, MSVideoSize vs2){
301 	return (vs1.width*vs1.height > vs2.width*vs2.height);
302 }
303 
ms_video_size_max(MSVideoSize vs1,MSVideoSize vs2)304 static MS2_INLINE MSVideoSize ms_video_size_max(MSVideoSize vs1, MSVideoSize vs2){
305 	return ms_video_size_greater_than(vs1,vs2) ? vs1 : vs2;
306 }
307 
ms_video_size_min(MSVideoSize vs1,MSVideoSize vs2)308 static MS2_INLINE MSVideoSize ms_video_size_min(MSVideoSize vs1, MSVideoSize vs2){
309 	return ms_video_size_greater_than(vs1,vs2) ? vs2 : vs1;
310 }
311 
ms_video_size_area_max(MSVideoSize vs1,MSVideoSize vs2)312 static MS2_INLINE MSVideoSize ms_video_size_area_max(MSVideoSize vs1, MSVideoSize vs2){
313 	return ms_video_size_area_greater_than(vs1,vs2) ? vs1 : vs2;
314 }
315 
ms_video_size_area_min(MSVideoSize vs1,MSVideoSize vs2)316 static MS2_INLINE MSVideoSize ms_video_size_area_min(MSVideoSize vs1, MSVideoSize vs2){
317 	return ms_video_size_area_greater_than(vs1,vs2) ? vs2 : vs1;
318 }
319 
ms_video_size_equal(MSVideoSize vs1,MSVideoSize vs2)320 static MS2_INLINE bool_t ms_video_size_equal(MSVideoSize vs1, MSVideoSize vs2){
321 	return vs1.width==vs2.width && vs1.height==vs2.height;
322 }
323 
324 MS2_PUBLIC MSVideoSize ms_video_size_get_just_lower_than(MSVideoSize vs);
325 
ms_video_size_get_orientation(MSVideoSize vs)326 static MS2_INLINE MSVideoOrientation ms_video_size_get_orientation(MSVideoSize vs){
327 	return vs.width>=vs.height ? MS_VIDEO_LANDSCAPE : MS_VIDEO_PORTRAIT;
328 }
329 
ms_video_size_change_orientation(MSVideoSize vs,MSVideoOrientation o)330 static MS2_INLINE MSVideoSize ms_video_size_change_orientation(MSVideoSize vs, MSVideoOrientation o){
331 	MSVideoSize ret;
332 	if (o!=ms_video_size_get_orientation(vs)){
333 		ret.width=vs.height;
334 		ret.height=vs.width;
335 	}else ret=vs;
336 	return ret;
337 }
338 
339 /* abstraction for image scaling and color space conversion routines*/
340 
341 typedef struct _MSScalerContext MSScalerContext;
342 
343 #define MS_SCALER_METHOD_NEIGHBOUR 1
344 #define MS_SCALER_METHOD_BILINEAR (1<<1)
345 
346 struct _MSScalerDesc {
347 	MSScalerContext * (*create_context)(int src_w, int src_h, MSPixFmt src_fmt,
348                                          int dst_w, int dst_h, MSPixFmt dst_fmt, int flags);
349 	int (*context_process)(MSScalerContext *ctx, uint8_t *src[], int src_strides[], uint8_t *dst[], int dst_strides[]);
350 	void (*context_free)(MSScalerContext *ctx);
351 };
352 
353 typedef struct  _MSScalerDesc MSScalerDesc;
354 
355 MS2_PUBLIC MSScalerContext *ms_scaler_create_context(int src_w, int src_h, MSPixFmt src_fmt,
356                                           int dst_w, int dst_h, MSPixFmt dst_fmt, int flags);
357 
358 MS2_PUBLIC int ms_scaler_process(MSScalerContext *ctx, uint8_t *src[], int src_strides[], uint8_t *dst[], int dst_strides[]);
359 
360 MS2_PUBLIC void ms_scaler_context_free(MSScalerContext *ctx);
361 
362 MS2_PUBLIC void ms_video_set_scaler_impl(MSScalerDesc *desc);
363 
364 MS2_PUBLIC mblk_t *copy_ycbcrbiplanar_to_true_yuv_with_rotation(MSYuvBufAllocator *allocator, const uint8_t* y, const uint8_t* cbcr, int rotation, int w, int h, int y_byte_per_row,int cbcr_byte_per_row, bool_t uFirstvSecond);
365 
366 /*** Encoder Helpers ***/
367 /* Frame rate controller */
368 struct _MSFrameRateController {
369 	uint64_t start_time;
370 	int th_frame_count;
371 	float fps;
372 };
373 typedef struct _MSFrameRateController MSFrameRateController;
374 MS2_PUBLIC void ms_video_init_framerate_controller(MSFrameRateController* ctrl, float fps);
375 MS2_PUBLIC bool_t ms_video_capture_new_frame(MSFrameRateController* ctrl, uint64_t current_time);
376 
377 /* Average FPS calculator */
378 struct _MSAverageFPS {
379 	uint64_t last_frame_time, last_print_time;
380 	float mean_inter_frame;
381 	const char* context;
382 };
383 typedef struct _MSAverageFPS MSAverageFPS;
384 MS2_PUBLIC void ms_average_fps_init(MSAverageFPS* afps, const char* context);
385 MS2_PUBLIC bool_t ms_average_fps_update(MSAverageFPS* afps, uint64_t current_time);
386 MS2_PUBLIC float ms_average_fps_get(const MSAverageFPS* afps);
387 
388 /*deprecated: for compatibility with plugin*/
389 MS2_PUBLIC void ms_video_init_average_fps(MSAverageFPS* afps, const char* ctx);
390 MS2_PUBLIC bool_t ms_video_update_average_fps(MSAverageFPS* afps, uint64_t current_time);
391 
392 
393 /**
394  * Find the best video configuration from a list of configurations according to a given bitrate limit.
395  * @param[in] vconf_list The list of video configurations to choose from.
396  * @param[in] bitrate The maximum bitrate limit the chosen configuration is allowed to use.
397  * @param[in] cpucount the number of cpu that can be used for this encoding.
398  * @return The best video configuration found in the given list.
399  */
400 MS2_PUBLIC MSVideoConfiguration ms_video_find_best_configuration_for_bitrate(const MSVideoConfiguration *vconf_list, int bitrate, int cpucount);
401 
402 /**
403  * Find the best video configuration from a list of configuration according to a given video size.
404  * @param[in] vconf_list The list of video configurations to choose from.
405  * @param[in] vsize The maximum video size the chosen configuration is allowed to use.
406  * @param[in] cpucount the number of cpu that can be used for this encoding.
407  * @return The best video configuration found in the given list.
408  */
409 MS2_PUBLIC MSVideoConfiguration ms_video_find_best_configuration_for_size(const MSVideoConfiguration *vconf_list, MSVideoSize vsize, int cpucount);
410 
411 MS2_PUBLIC MSVideoConfiguration ms_video_find_best_configuration_for_size_and_bitrate(const MSVideoConfiguration *vconf_list, MSVideoSize vsize, int cpu_count, int bitrate);
412 
413 #ifdef __cplusplus
414 }
415 #endif
416 
417 #define MS_FILTER_SET_VIDEO_SIZE	MS_FILTER_BASE_METHOD(100,MSVideoSize)
418 #define MS_FILTER_GET_VIDEO_SIZE	MS_FILTER_BASE_METHOD(101,MSVideoSize)
419 
420 #define MS_FILTER_SET_PIX_FMT		MS_FILTER_BASE_METHOD(102,MSPixFmt)
421 #define MS_FILTER_GET_PIX_FMT		MS_FILTER_BASE_METHOD(103,MSPixFmt)
422 
423 #define MS_FILTER_SET_FPS		MS_FILTER_BASE_METHOD(104,float)
424 #define MS_FILTER_GET_FPS		MS_FILTER_BASE_METHOD(105,float)
425 
426 #define MS_FILTER_VIDEO_AUTO		((unsigned long) 0)
427 #define MS_FILTER_VIDEO_NONE		((unsigned long) -1)
428 
429 /* request a video-fast-update (=I frame for H263,MP4V-ES) to a video encoder*/
430 /* DEPRECATED: Use MS_VIDEO_ENCODER_REQ_VFU instead */
431 #define MS_FILTER_REQ_VFU		MS_FILTER_BASE_METHOD_NO_ARG(106)
432 
433 #endif
434