1 /*
2  * Copyright (C) 2000-2020 the xine project
3  *
4  * This file is part of xine, a free video player.
5  *
6  * xine is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * xine is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
19  *
20  * public xine-lib (libxine) interface and documentation
21  *
22  *
23  * some programming guidelines about this api:
24  * -------------------------------------------
25  *
26  * (1) libxine has (per stream instance) a fairly static memory
27  *     model
28  * (2) as a rule of thumb, never free() or realloc() any pointers
29  *     returned by the xine engine (unless stated otherwise)
30  *     or, in other words:
31  *     do not free() stuff you have not malloc()ed
32  * (3) xine is multi-threaded, make sure your programming environment
33  *     can handle this.
34  *     for x11-related stuff this means that you either have to properly
35  *     use xlockdisplay() or use two seperate connections to the x-server
36  *
37  */
38 /*_x_ Lines formatted like this one are xine-lib developer comments.  */
39 /*_x_ They will be removed from the installed version of this header. */
40 
41 #ifndef HAVE_XINE_H
42 #define HAVE_XINE_H
43 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
48 #include <stdarg.h>
49 #include <sys/time.h>
50 #include <sys/types.h>
51 
52 #if defined(WIN32) && !defined(XINE_COMPILE)
53 #include <windows.h>
54 #endif
55 
56 #include <xine/os_types.h>
57 #include <xine/attributes.h>
58 #include <xine/version.h>
59 
60 /* This enables some experimental features. These are not part of the
61  * official libxine API, so use them only, if you absolutely need them.
62  * Although we make efforts to keep even this part of the API as stable
63  * as possible, this is not guaranteed. Incompatible changes can occur.
64  */
65 /* #define XINE_ENABLE_EXPERIMENTAL_FEATURES */
66 
67 /* This disables some deprecated features. These are still part of the
68  * official libxine API and you may still use them. During the current
69  * major release series, these will always be available and will stay
70  * compatible. However, removal is likely to occur as soon as possible.
71  */
72 /* #define XINE_DISABLE_DEPRECATED_FEATURES */
73 
74 
75 /*********************************************************************
76  * xine opaque data types                                            *
77  *********************************************************************/
78 
79 typedef struct xine_s xine_t;
80 typedef struct xine_stream_s xine_stream_t;
81 typedef struct xine_audio_port_s xine_audio_port_t;
82 typedef struct xine_video_port_s xine_video_port_t;
83 
84 /*********************************************************************
85  * global engine handling                                            *
86  *********************************************************************/
87 
88 /*
89  * version information
90  */
91 
92 /* dynamic info from actually linked libxine */
93 const char *xine_get_version_string (void) XINE_PROTECTED;
94 void xine_get_version (int *major, int *minor, int *sub) XINE_PROTECTED;
95 
96 /* compare given version to libxine version,
97    return 1 if compatible, 0 otherwise */
98 int  xine_check_version (int major, int minor, int sub) XINE_PROTECTED;
99 
100 /*
101  * pre-init the xine engine
102  *
103  * will first malloc and init a xine_t, create an empty config
104  * system, then scan through all installed plugins and add them
105  * to an internal list for later use.
106  *
107  * to fully init the xine engine, you have to load config values
108  * (either using your own storage method and calling
109  * xine_config_register_entry, or by using the xine_load_config
110  * utility function - see below) and then call xine_init
111  *
112  * the only proper way to shut down the xine engine is to
113  * call xine_exit() - do not try to free() the xine pointer
114  * yourself and do not try to access any internal data structures
115  */
116 xine_t *xine_new (void) XINE_PROTECTED;
117 
118 /* allow the setting of some flags before xine_init
119  * FIXME-ABI: this is currently GLOBAL
120  */
121 void xine_set_flags (xine_t *, int) XINE_PROTECTED XINE_WEAK;
122 #define XINE_FLAG_NO_WRITE_CACHE		1
123 
124 /*
125  * post_init the xine engine
126  */
127 void xine_init (xine_t *self) XINE_PROTECTED;
128 
129 /*
130  * helper functions to find and init audio/video drivers
131  * from xine's plugin collection
132  *
133  * id    : identifier of the driver, may be NULL for auto-detection
134  * data  : special data struct for ui/driver communications, depends
135  *         on driver
136  * visual: video driver flavor selector, constants see below
137  *
138  * both functions may return NULL if driver failed to load, was not
139  * found ...
140  *
141  * use xine_close_audio/video_driver() to close loaded drivers
142  * and free resources allocated by them
143  */
144 xine_audio_port_t *xine_open_audio_driver (xine_t *self, const char *id,
145                                            const void *data) XINE_PROTECTED;
146 xine_video_port_t *xine_open_video_driver (xine_t *self, const char *id,
147                                            int visual, const void *data) XINE_PROTECTED;
148 
149 void xine_close_audio_driver (xine_t *self, xine_audio_port_t  *driver) XINE_PROTECTED;
150 void xine_close_video_driver (xine_t *self, xine_video_port_t  *driver) XINE_PROTECTED;
151 
152 /* valid visual types */
153 #define XINE_VISUAL_TYPE_NONE              0
154 #define XINE_VISUAL_TYPE_X11               1
155 #define XINE_VISUAL_TYPE_X11_2            10
156 #define XINE_VISUAL_TYPE_AA                2
157 #define XINE_VISUAL_TYPE_FB                3
158 #define XINE_VISUAL_TYPE_GTK               4
159 #define XINE_VISUAL_TYPE_DFB               5
160 #define XINE_VISUAL_TYPE_PM                6 /* used by the OS/2 port */
161 #define XINE_VISUAL_TYPE_DIRECTX           7 /* used by the win32/msvc port */
162 #define XINE_VISUAL_TYPE_CACA              8
163 #define XINE_VISUAL_TYPE_MACOSX            9
164 #define XINE_VISUAL_TYPE_XCB              11
165 #define XINE_VISUAL_TYPE_RAW              12
166 #define XINE_VISUAL_TYPE_WAYLAND          13
167 
168 /*
169  * free all resources, close all plugins, close engine.
170  * self pointer is no longer valid after this call.
171  */
172 void xine_exit (xine_t *self) XINE_PROTECTED;
173 
174 
175 /*********************************************************************
176  * stream handling                                                   *
177  *********************************************************************/
178 
179 /*
180  * create a new stream for media playback/access
181  *
182  * returns xine_stream_t* if OK,
183  *         NULL on error (use xine_get_error for details)
184  *
185  * the only proper way to free the stream pointer returned by this
186  * function is to call xine_dispose() on it. do not try to access any
187  * fields in xine_stream_t, they're all private and subject to change
188  * without further notice.
189  */
190 xine_stream_t *xine_stream_new (xine_t *self,
191 				xine_audio_port_t *ao, xine_video_port_t *vo) XINE_PROTECTED;
192 
193 /*
194  * A side stream is like a side car on a bike. It has its own mrl, input, and demux.
195  * Everything else is handled by the master (play, seek, pause, close, dispose).
196  * This is intended for streams who have separate mrls for audio, video, and subtitle.
197  * Index 0 just returns the master itself, 1 ... 3 are free for side mrls. */
198 #define XINE_SIDE_STREAMS 1
199 xine_stream_t *xine_get_side_stream (xine_stream_t *master, int index) XINE_PROTECTED;
200 
201 /*
202  * Make one stream the slave of another.
203  * This establishes a binary master slave relation on streams, where
204  * certain operations (specified by parameter "affection") on the master
205  * stream are also applied to the slave stream.
206  * If you want more than one stream to react to one master, you have to
207  * apply the calls in a top down way:
208  *  xine_stream_master_slave(stream1, stream2, 3);
209  *  xine_stream_master_slave(stream2, stream3, 3);
210  * This will make stream1 affect stream2 and stream2 affect stream3, so
211  * effectively, operations on stream1 propagate to stream2 and 3.
212  *
213  * Please note that subsequent master_slave calls on the same streams
214  * will overwrite their previous master/slave setting.
215  * Be sure to not mess around.
216  *
217  * returns 1 on success, 0 on failure
218  */
219 int xine_stream_master_slave(xine_stream_t *master, xine_stream_t *slave,
220                              int affection) XINE_PROTECTED;
221 
222 /* affection is some of the following ORed together: */
223 /* playing the master plays the slave */
224 #define XINE_MASTER_SLAVE_PLAY     (1<<0)
225 /* slave stops on master stop */
226 #define XINE_MASTER_SLAVE_STOP     (1<<1)
227 /* slave is synced to master's speed */
228 #define XINE_MASTER_SLAVE_SPEED    (1<<2)
229 
230 /*
231  * open a stream
232  *
233  * look for input / demux / decoder plugins, find out about the format
234  * see if it is supported, set up internal buffers and threads
235  *
236  * returns 1 if OK, 0 on error (use xine_get_error for details)
237  */
238 int xine_open (xine_stream_t *stream, const char *mrl) XINE_PROTECTED;
239 
240 /** The keyframe seek index feature. */
241 
242 #define XINE_KEYFRAMES 1 /**<< Check this for feature available. */
243 
244 typedef struct {
245   int msecs;   /**<< Milliseconds from beginning of stream. */
246   int normpos; /**<< Size based stream position (beginning == 0, end == 64k - 1). */
247 } xine_keyframes_entry_t;
248 
249 /** @brief Query stream keyframe seek index.
250     @note  We dont do an expensive file scan. We will only find keyframes listed in
251            container or already seen while playing.
252     @param stream The stream that index is for.
253     @param pos    On call, the start time or normpos.
254                   On return, the found time and normpos.
255     @param offs   0 gets nearest keyframe, other values step from exact given pos.
256     @return  0: Found.
257              1: Search truncated to first or last known keyframe.
258              2: Failure.
259 */
260 int xine_keyframes_find (xine_stream_t *stream, xine_keyframes_entry_t *pos, int offs) XINE_PROTECTED;
261 
262 /** @brief Get a private stream keyframe seek index copy, free () it when done.
263     @param stream The stream that index is for.
264     @param size   On return, the count of entries there are.
265     @return The entry array or NULL.
266 */
267 xine_keyframes_entry_t *xine_keyframes_get (xine_stream_t *stream, int *size) XINE_PROTECTED;
268 
269 /*
270  * play a stream from a given position
271  *
272  * start_pos:  0..65535
273  * start_time: milliseconds
274  * if both start position parameters are != 0 start_pos will be used
275  * for non-seekable streams both values will be ignored
276  *
277  * returns 1 if OK, 0 on error (use xine_get_error for details)
278  */
279 int  xine_play (xine_stream_t *stream, int start_pos, int start_time) XINE_PROTECTED;
280 
281 /*
282  * stop stream playback
283  * xine_stream_t stays valid for new xine_open or xine_play
284  */
285 void xine_stop (xine_stream_t *stream) XINE_PROTECTED;
286 
287 /*
288  * stop stream playback, free all stream-related resources
289  * xine_stream_t stays valid for new xine_open
290  */
291 void xine_close (xine_stream_t *stream) XINE_PROTECTED;
292 
293 /*
294  * ask current/recent input plugin to eject media - may or may not work,
295  * depending on input plugin capabilities
296  */
297 int  xine_eject (xine_stream_t *stream) XINE_PROTECTED;
298 
299 /*
300  * stop playback, dispose all stream-related resources
301  * xine_stream_t no longer valid when after this
302  */
303 void xine_dispose (xine_stream_t *stream) XINE_PROTECTED;
304 
305 /*
306  * set/get engine parameters.
307  */
308 void xine_engine_set_param(xine_t *self, int param, int value) XINE_PROTECTED;
309 int xine_engine_get_param(xine_t *self, int param) XINE_PROTECTED;
310 
311 #define XINE_ENGINE_PARAM_VERBOSITY        1
312 
313 /*
314  * set/get xine stream parameters
315  * e.g. playback speed, constants see below
316  */
317 void xine_set_param (xine_stream_t *stream, int param, int value) XINE_PROTECTED;
318 int  xine_get_param (xine_stream_t *stream, int param) XINE_PROTECTED;
319 
320 /*
321  * xine stream parameters
322  */
323 #define XINE_PARAM_SPEED                   1 /* see below                   */
324 #define XINE_PARAM_AV_OFFSET               2 /* unit: 1/90000 sec           */
325 #define XINE_PARAM_AUDIO_CHANNEL_LOGICAL   3 /* -1 => auto, -2 => off       */
326 #define XINE_PARAM_SPU_CHANNEL             4
327 #define XINE_PARAM_VIDEO_CHANNEL           5
328 #define XINE_PARAM_AUDIO_VOLUME            6 /* 0..100                      */
329 #define XINE_PARAM_AUDIO_MUTE              7 /* 1=>mute, 0=>unmute          */
330 #define XINE_PARAM_AUDIO_COMPR_LEVEL       8 /* <100=>off, % compress otherw*/
331 #define XINE_PARAM_AUDIO_AMP_LEVEL         9 /* 0..200, 100=>100% (default) */
332 #define XINE_PARAM_AUDIO_REPORT_LEVEL     10 /* 1=>send events, 0=> don't   */
333 #define XINE_PARAM_VERBOSITY              11 /* control console output      */
334 #define XINE_PARAM_SPU_OFFSET             12 /* unit: 1/90000 sec           */
335 #define XINE_PARAM_IGNORE_VIDEO           13 /* disable video decoding      */
336 #define XINE_PARAM_IGNORE_AUDIO           14 /* disable audio decoding      */
337 #define XINE_PARAM_IGNORE_SPU             15 /* disable spu decoding        */
338 #define XINE_PARAM_BROADCASTER_PORT       16 /* 0: disable, x: server port  */
339 #define XINE_PARAM_METRONOM_PREBUFFER     17 /* unit: 1/90000 sec           */
340 #define XINE_PARAM_EQ_30HZ                18 /* equalizer gains -100..100   */
341 #define XINE_PARAM_EQ_60HZ                19 /* equalizer gains -100..100   */
342 #define XINE_PARAM_EQ_125HZ               20 /* equalizer gains -100..100   */
343 #define XINE_PARAM_EQ_250HZ               21 /* equalizer gains -100..100   */
344 #define XINE_PARAM_EQ_500HZ               22 /* equalizer gains -100..100   */
345 #define XINE_PARAM_EQ_1000HZ              23 /* equalizer gains -100..100   */
346 #define XINE_PARAM_EQ_2000HZ              24 /* equalizer gains -100..100   */
347 #define XINE_PARAM_EQ_4000HZ              25 /* equalizer gains -100..100   */
348 #define XINE_PARAM_EQ_8000HZ              26 /* equalizer gains -100..100   */
349 #define XINE_PARAM_EQ_16000HZ             27 /* equalizer gains -100..100   */
350 #define XINE_PARAM_AUDIO_CLOSE_DEVICE     28 /* force closing audio device  */
351 #define XINE_PARAM_AUDIO_AMP_MUTE         29 /* 1=>mute, 0=>unmute */
352 #define XINE_PARAM_FINE_SPEED             30 /* 1.000.000 => normal speed   */
353 #define XINE_PARAM_EARLY_FINISHED_EVENT   31 /* send event when demux finish*/
354 #define XINE_PARAM_GAPLESS_SWITCH         32 /* next stream only gapless swi*/
355 #define XINE_PARAM_DELAY_FINISHED_EVENT   33 /* 1/10sec,0=>disable,-1=>forev*/
356 
357 /*
358  * speed values for XINE_PARAM_SPEED parameter.
359  *
360  * alternatively, one may use XINE_PARAM_FINE_SPEED for greater
361  * control of the speed value, where:
362  * XINE_PARAM_SPEED / 4 <-> XINE_PARAM_FINE_SPEED / 1000000
363  */
364 #define XINE_SPEED_PAUSE                   0
365 #define XINE_SPEED_SLOW_4                  1
366 #define XINE_SPEED_SLOW_2                  2
367 #define XINE_SPEED_NORMAL                  4
368 #define XINE_SPEED_FAST_2                  8
369 #define XINE_SPEED_FAST_4                  16
370 
371 /* normal speed value for XINE_PARAM_FINE_SPEED parameter */
372 #define XINE_FINE_SPEED_NORMAL             1000000
373 
374 /* video parameters */
375 #define XINE_PARAM_VO_DEINTERLACE          0x01000000 /* bool               */
376 #define XINE_PARAM_VO_ASPECT_RATIO         0x01000001 /* see below          */
377 #define XINE_PARAM_VO_HUE                  0x01000002 /* 0..65535           */
378 #define XINE_PARAM_VO_SATURATION           0x01000003 /* 0..65535           */
379 #define XINE_PARAM_VO_CONTRAST             0x01000004 /* 0..65535           */
380 #define XINE_PARAM_VO_BRIGHTNESS           0x01000005 /* 0..65535           */
381 #define XINE_PARAM_VO_GAMMA                0x0100000c /* 0..65535           */
382 #define XINE_PARAM_VO_ZOOM_X               0x01000008 /* percent            */
383 #define XINE_PARAM_VO_ZOOM_Y               0x0100000d /* percent            */
384 #define XINE_PARAM_VO_PAN_SCAN             0x01000009 /* bool               */
385 #define XINE_PARAM_VO_TVMODE               0x0100000a /* ???                */
386 #define XINE_PARAM_VO_WINDOW_WIDTH         0x0100000f /* readonly           */
387 #define XINE_PARAM_VO_WINDOW_HEIGHT        0x01000010 /* readonly           */
388 #define XINE_PARAM_VO_SHARPNESS            0x01000018 /* 0..65535           */
389 #define XINE_PARAM_VO_NOISE_REDUCTION      0x01000019 /* 0..65535           */
390 #define XINE_PARAM_VO_CROP_LEFT            0x01000020 /* crop frame pixels  */
391 #define XINE_PARAM_VO_CROP_RIGHT           0x01000021 /* crop frame pixels  */
392 #define XINE_PARAM_VO_CROP_TOP             0x01000022 /* crop frame pixels  */
393 #define XINE_PARAM_VO_CROP_BOTTOM          0x01000023 /* crop frame pixels  */
394 #define XINE_PARAM_VO_SINGLE_STEP          0x01000024 /* 1 = "advance to next frame, then pause" */
395 
396 #define XINE_VO_ZOOM_STEP                  100
397 #define XINE_VO_ZOOM_MAX                   400
398 #define XINE_VO_ZOOM_MIN                   -85
399 
400 /* possible ratios for XINE_PARAM_VO_ASPECT_RATIO */
401 #define XINE_VO_ASPECT_AUTO                0
402 #define XINE_VO_ASPECT_SQUARE              1 /* 1:1    */
403 #define XINE_VO_ASPECT_4_3                 2 /* 4:3    */
404 #define XINE_VO_ASPECT_ANAMORPHIC          3 /* 16:9   */
405 #define XINE_VO_ASPECT_DVB                 4 /* 2.11:1 */
406 #define XINE_VO_ASPECT_NUM_RATIOS          5
407 #ifndef XINE_DISABLE_DEPRECATED_FEATURES
408 #define XINE_VO_ASPECT_PAN_SCAN            41
409 #define XINE_VO_ASPECT_DONT_TOUCH          42
410 #endif
411 
412 /* stream format detection strategies */
413 
414 /* recognize stream type first by content then by extension. */
415 #define XINE_DEMUX_DEFAULT_STRATEGY        0
416 /* recognize stream type first by extension then by content. */
417 #define XINE_DEMUX_REVERT_STRATEGY         1
418 /* recognize stream type by content only.                    */
419 #define XINE_DEMUX_CONTENT_STRATEGY        2
420 /* recognize stream type by extension only.                  */
421 #define XINE_DEMUX_EXTENSION_STRATEGY      3
422 
423 /* verbosity settings */
424 #define XINE_VERBOSITY_NONE                0
425 #define XINE_VERBOSITY_LOG                 1
426 #define XINE_VERBOSITY_DEBUG               2
427 
428 /*
429  * snapshot function
430  *
431  * image format can be YUV 4:2:0 or 4:2:2
432  * will copy the image data into memory that <img> points to
433  * (interleaved for yuv 4:2:2 or planary for 4:2:0)
434  *
435  * xine_get_current_frame() requires that <img> must be able
436  * to hold the image data. Use a NULL pointer to retrieve the
437  * necessary parameters for calculating the buffer size. Be
438  * aware that the image can change between two successive calls
439  * so you better pause the stream.
440  *
441  * xine_get_current_frame_s() requires to specify the buffer
442  * size and it returns the needed / used size. It won't copy
443  * image data into a too small buffer.
444  *
445  * xine_get_current_frame_alloc() takes care of allocating
446  * a buffer on its own, so image data can be retrieved by
447  * a single call without the need to pause the stream.
448  *
449  * xine_get_current_frame_data() passes the parameters of the
450  * previously mentioned functions plus further information in
451  * a structure and can work like the _s or _alloc function
452  * respectively depending on the passed flags.
453  *
454  * all functions return 1 on success, 0 failure.
455  */
456 int  xine_get_current_frame (xine_stream_t *stream,
457 			     int *width, int *height,
458 			     int *ratio_code, int *format,
459                              uint8_t *img) XINE_PROTECTED XINE_DEPRECATED;
460 
461 int  xine_get_current_frame_s (xine_stream_t *stream,
462 			     int *width, int *height,
463 			     int *ratio_code, int *format,
464 			     uint8_t *img, int *img_size) XINE_PROTECTED;
465 
466 int  xine_get_current_frame_alloc (xine_stream_t *stream,
467 			     int *width, int *height,
468 			     int *ratio_code, int *format,
469 			     uint8_t **img, int *img_size) XINE_PROTECTED;
470 
471 typedef struct xine_current_frame_data_s xine_current_frame_data_t;
472 
473 struct xine_current_frame_data_s {
474   int      width;
475   int      height;
476   int      crop_left;
477   int      crop_right;
478   int      crop_top;
479   int      crop_bottom;
480   int      ratio_code;
481   int      interlaced;
482   int      format;
483   int      img_size;
484   uint8_t *img;
485 };
486 
487 #define XINE_FRAME_DATA_ALLOCATE_IMG (1<<0)
488 
489 int  xine_get_current_frame_data (xine_stream_t *stream,
490 			     xine_current_frame_data_t *data,
491 			     int flags) XINE_PROTECTED;
492 
493 /* xine image formats */
494 #define XINE_IMGFMT_YV12 (('2'<<24)|('1'<<16)|('V'<<8)|'Y')
495 #define XINE_IMGFMT_YUY2 (('2'<<24)|('Y'<<16)|('U'<<8)|'Y')
496 #define XINE_IMGFMT_XVMC (('C'<<24)|('M'<<16)|('v'<<8)|'X')
497 #define XINE_IMGFMT_XXMC (('C'<<24)|('M'<<16)|('x'<<8)|'X')
498 #define XINE_IMGFMT_VDPAU (('A'<<24)|('P'<<16)|('D'<<8)|'V')
499 #define XINE_IMGFMT_VAAPI (('P'<<24)|('A'<<16)|('A'<<8)|'V')
500 
501 /* get current xine's virtual presentation timestamp (1/90000 sec)
502  * note: this is mostly internal data.
503  * one can use vpts with xine_osd_show() and xine_osd_hide().
504  */
505 int64_t xine_get_current_vpts(xine_stream_t *stream) XINE_PROTECTED;
506 
507 
508 /*
509  * Continuous video frame grabbing feature.
510  *
511  * In opposite to the 'xine_get_current_frame' based snapshot function this grabbing
512  * feature allow continuous grabbing of last or next displayed video frame.
513  * Grabbed video frames are returned in simple three byte RGB format.
514  *
515  * Depending on the capabilities of the used video output driver video image data is
516  * taken as close as possible at the end of the video processing chain. Thus a returned
517  * video image could contain the blended OSD data, is deinterlaced, cropped and scaled
518  * and video properties like hue, sat could be applied.
519  * If a video output driver does not have a decent grabbing implementation then there
520  * is a generic fallback feature that grabs the video frame as they are taken from the video
521  * display queue (like the xine_get_current_frame' function).
522  * In this case color correct conversation to a RGB image incorporating source cropping
523  * and scaling to the requested grab size is also supported.
524  *
525  * The caller must first request a new video grab frame using the public 'xine_new_grab_video_frame'
526  * function. Then the caller should populate the frame with the wanted source cropping, grab image
527  * size and control flags. After that grab requests could be done by calling the supplied grab() feature
528  * of the frame. At the end a call to the supplied dispose() feature of the frame releases all needed
529  * resources.
530  * The caller should have acquired a port ticket while calling these features.
531  *
532  */
533 #define HAVE_XINE_GRAB_VIDEO_FRAME      1
534 
535 /*
536  * frame structure used for grabbing video frames of format RGB.
537  */
538 typedef struct xine_grab_video_frame_s xine_grab_video_frame_t;
539 struct xine_grab_video_frame_s {
540   /*
541    *  grab last/next displayed image.
542    *  returns 0 if grab is successful, 1 on timeout and -1 on error
543    */
544   int (*grab) (xine_grab_video_frame_t *self);
545 
546   /*
547    *  free all resources.
548    */
549   void (*dispose) (xine_grab_video_frame_t *self);
550 
551   /*
552    *  Cropping of source image. Has to be specified by caller.
553    */
554   int crop_left;
555   int crop_right;
556   int crop_top;
557   int crop_bottom;
558 
559   /*
560    * Parameters of returned RGB image.
561    * Caller can specify wanted frame size giving width and/or height a value > 0.
562    * In this case the grabbed image is scaled to the requested size.
563    * Otherwise the grab function returns the actual size of the grabbed image
564    * in width/height without scaling the image.
565    */
566   int width, height; /* requested/returned size of image */
567   uint8_t *img;      /* returned RGB image data taking three bytes per pixel */
568   int64_t vpts;      /* virtual presentation timestamp (1/90000 sec) of returned frame */
569 
570   int timeout;       /* Max. time to wait for next displayed frame in milliseconds */
571   int flags;         /* Controlling flags. See XINE_GRAB_VIDEO_FRAME_FLAGS_* definitions */
572 };
573 
574 #define XINE_GRAB_VIDEO_FRAME_FLAGS_CONTINUOUS  0x01    /* optimize resource allocation for continuous frame grabbing */
575 #define XINE_GRAB_VIDEO_FRAME_FLAGS_WAIT_NEXT   0x02    /* wait for next display frame instead of using last displayed frame */
576 
577 #define XINE_GRAB_VIDEO_FRAME_DEFAULT_TIMEOUT   500
578 
579 /*
580  * Allocate new grab video frame. Returns NULL on error.
581  */
582 xine_grab_video_frame_t*  xine_new_grab_video_frame (xine_stream_t *stream) XINE_PROTECTED;
583 
584 
585 /*********************************************************************
586  * media processing                                                  *
587  *********************************************************************/
588 
589 #ifdef XINE_ENABLE_EXPERIMENTAL_FEATURES
590 
591 /*
592  * access to decoded audio and video frames from a stream
593  * these functions are intended to provide the basis for
594  * re-encoding and other video processing applications
595  *
596  * note that the xine playback engine will block when
597  * rendering to a framegrab port: to unblock the stream,
598  * you must fetch the frames manually with the
599  * xine_get_next_* functions.  this ensures that a
600  * framegrab port is guaranteed to never miss a frame.
601  *
602  */
603 
604 xine_video_port_t *xine_new_framegrab_video_port (xine_t *self) XINE_PROTECTED;
605 
606 typedef struct {
607 
608   int64_t  vpts;       /* timestamp 1/90000 sec for a/v sync */
609   int64_t  duration;
610   double   aspect_ratio;
611   int      width, height;
612   int      colorspace; /* XINE_IMGFMT_* */
613 
614   int      pos_stream; /* bytes from stream start */
615   int      pos_time;   /* milliseconds */
616 
617   int      frame_number; /* frame number (may be unknown) */
618 
619   uint8_t *data;
620   void    *xine_frame; /* used internally by xine engine */
621 } xine_video_frame_t;
622 
623 int xine_get_next_video_frame (xine_video_port_t *port,
624 			       xine_video_frame_t *frame) XINE_PROTECTED;
625 
626 void xine_free_video_frame (xine_video_port_t *port, xine_video_frame_t *frame) XINE_PROTECTED;
627 
628 xine_audio_port_t *xine_new_framegrab_audio_port (xine_t *self) XINE_PROTECTED;
629 
630 typedef struct {
631 
632   int64_t  vpts;       /* timestamp 1/90000 sec for a/v sync */
633   int      num_samples;
634   int      sample_rate;
635   int      num_channels;
636   int      bits_per_sample; /* per channel */
637 
638   uint8_t *data;
639   void    *xine_frame; /* used internally by xine engine */
640 
641   off_t    pos_stream; /* bytes from stream start */
642   int      pos_time;   /* milliseconds */
643 } xine_audio_frame_t;
644 
645 int xine_get_next_audio_frame (xine_audio_port_t *port,
646 			       xine_audio_frame_t *frame) XINE_PROTECTED;
647 
648 void xine_free_audio_frame (xine_audio_port_t *port, xine_audio_frame_t *frame) XINE_PROTECTED;
649 
650 #endif
651 
652 
653 /*********************************************************************
654  * post plugin handling                                              *
655  *********************************************************************/
656 
657 /*
658  * post effect plugin functions
659  *
660  * after the data leaves the decoder it can pass an arbitrary tree
661  * of post plugins allowing for effects to be applied to the video
662  * frames/audio buffers before they reach the output stage
663  */
664 
665 typedef struct xine_post_s xine_post_t;
666 
667 struct xine_post_s {
668 
669   /* a NULL-terminated array of audio input ports this post plugin
670    * provides; you can hand these to other post plugin's outputs or
671    * pass them to the initialization of streams
672    */
673   xine_audio_port_t **audio_input;
674 
675   /* a NULL-terminated array of video input ports this post plugin
676    * provides; you can hand these to other post plugin's outputs or
677    * pass them to the initialization of streams
678    */
679   xine_video_port_t **video_input;
680 
681   /* the type of the post plugin
682    * one of XINE_POST_TYPE_* can be used here
683    */
684   int type;
685 
686 };
687 
688 /*
689  * initialize a post plugin
690  *
691  * returns xine_post_t* on success, NULL on failure
692  *
693  * Initializes the post plugin with the given name and connects its
694  * outputs to the NULL-terminated arrays of audio and video ports.
695  * Some plugins also care about the number of inputs you request
696  * (e.g. mixer plugins), others simply ignore this number.
697  */
698 xine_post_t *xine_post_init(xine_t *xine, const char *name,
699 			    int inputs,
700 			    xine_audio_port_t **audio_target,
701 			    xine_video_port_t **video_target) XINE_PROTECTED;
702 
703 /* get a list of all available post plugins */
704 const char *const *xine_list_post_plugins(xine_t *xine) XINE_PROTECTED;
705 
706 /* get a list of all post plugins of one type */
707 const char *const *xine_list_post_plugins_typed(xine_t *xine, uint32_t type) XINE_PROTECTED;
708 
709 /*
710  * post plugin input/output
711  *
712  * These structures encapsulate inputs/outputs for post plugins
713  * to transfer arbitrary data. Frontends can also provide inputs
714  * and outputs and connect them to post plugins to exchange data
715  * with them.
716  */
717 
718 typedef struct xine_post_in_s  xine_post_in_t;
719 typedef struct xine_post_out_s xine_post_out_t;
720 
721 struct xine_post_in_s {
722 
723   /* the name identifying this input */
724   const char   *name;
725 
726   /* the data pointer; input is directed to this memory location,
727    * so you simply access the pointer to access the input data */
728   void         *data;
729 
730   /* the datatype of this input, use one of XINE_POST_DATA_* here */
731   int           type;
732 
733 };
734 
735 struct xine_post_out_s {
736 
737   /* the name identifying this output */
738   const char   *name;
739 
740   /* the data pointer; output should be directed to this memory location,
741    * so in the easy case you simply write through the pointer */
742   void         *data;
743 
744   /* this function is called, when the output should be redirected
745    * to another input, you sould set the data pointer to direct
746    * any output to this new input;
747    * a special situation is, when this function is called with a NULL
748    * argument: in this case you should disconnect the data pointer
749    * from any output and if necessary to avoid writing to some stray
750    * memory you should make it point to some dummy location,
751    * returns 1 on success, 0 on failure;
752    * if you do not implement rewiring, set this to NULL */
753   int (*rewire) (xine_post_out_t *self, void *data);
754 
755   /* the datatype of this output, use one of XINE_POST_DATA_* here */
756   int           type;
757 
758 };
759 
760 /* get a list of all inputs of a post plugin */
761 const char *const *xine_post_list_inputs(xine_post_t *self) XINE_PROTECTED;
762 
763 /* get a list of all outputs of a post plugin */
764 const char *const *xine_post_list_outputs(xine_post_t *self) XINE_PROTECTED;
765 
766 /* retrieve one specific input of a post plugin */
767 xine_post_in_t *xine_post_input(xine_post_t *self, const char *name) XINE_PROTECTED;
768 
769 /* retrieve one specific output of a post plugin */
770 xine_post_out_t *xine_post_output(xine_post_t *self, const char *name) XINE_PROTECTED;
771 
772 /*
773  * wire an input to an output
774  * returns 1 on success, 0 on failure
775  */
776 int xine_post_wire(xine_post_out_t *source, xine_post_in_t *target) XINE_PROTECTED;
777 
778 /*
779  * wire a video port to a video output
780  * This can be used to rewire different post plugins to the video output
781  * plugin layer. The ports you hand in at xine_post_init() will already
782  * be wired with the post plugin, so you need this function for
783  * _re_connecting only.
784  *
785  * returns 1 on success, 0 on failure
786  */
787 int xine_post_wire_video_port(xine_post_out_t *source, xine_video_port_t *vo) XINE_PROTECTED;
788 
789 /*
790  * wire an audio port to an audio output
791  * This can be used to rewire different post plugins to the audio output
792  * plugin layer. The ports you hand in at xine_post_init() will already
793  * be wired with the post plugin, so you need this function for
794  * _re_connecting only.
795  *
796  * returns 1 on success, 0 on failure
797  */
798 int xine_post_wire_audio_port(xine_post_out_t *source, xine_audio_port_t *ao) XINE_PROTECTED;
799 
800 /*
801  * Extracts an output for a stream. Use this to rewire the outputs of streams.
802  */
803 xine_post_out_t * xine_get_video_source(xine_stream_t *stream) XINE_PROTECTED;
804 xine_post_out_t * xine_get_audio_source(xine_stream_t *stream) XINE_PROTECTED;
805 
806 /*
807  * disposes the post plugin
808  * please make sure that no other post plugin and no stream is
809  * connected to any of this plugin's inputs
810  */
811 void xine_post_dispose(xine_t *xine, xine_post_t *self) XINE_PROTECTED;
812 
813 
814 /* post plugin types */
815 #define XINE_POST_TYPE_VIDEO_FILTER		0x010000
816 #define XINE_POST_TYPE_VIDEO_VISUALIZATION	0x010001
817 #define XINE_POST_TYPE_VIDEO_COMPOSE		0x010002
818 #define XINE_POST_TYPE_AUDIO_FILTER		0x020000
819 #define XINE_POST_TYPE_AUDIO_VISUALIZATION	0x020001
820 
821 
822 /* post plugin data types */
823 
824 /* video port data
825  * input->data is a xine_video_port_t*
826  * output->data usually is a xine_video_port_t**
827  */
828 #define XINE_POST_DATA_VIDEO          0
829 
830 /* audio port data
831  * input->data is a xine_audio_port_t*
832  * output->data usually is a xine_audio_port_t**
833  */
834 #define XINE_POST_DATA_AUDIO          1
835 
836 /* integer data
837  * input->data is a int*
838  * output->data usually is a int*
839  */
840 #define XINE_POST_DATA_INT            3
841 
842 /* double precision floating point data
843  * input->data is a double*
844  * output->data usually is a double*
845  */
846 #define XINE_POST_DATA_DOUBLE         4
847 
848 /* parameters api (used by frontends)
849  * input->data is xine_post_api_t*  (see below)
850  */
851 #define XINE_POST_DATA_PARAMETERS     5
852 
853 /* defines a single parameter entry. */
854 typedef struct {
855   int              type;             /* POST_PARAM_TYPE_xxx             */
856   const char      *name;             /* name of this parameter          */
857   int              size;             /* sizeof(parameter)               */
858   int              offset;           /* offset in bytes from struct ptr */
859   char           **enum_values;      /* enumeration (first=0) or NULL   */
860   double           range_min;        /* minimum value                   */
861   double           range_max;        /* maximum value                   */
862   int              readonly;         /* 0 = read/write, 1=read-only     */
863   const char      *description;      /* user-friendly description       */
864 } xine_post_api_parameter_t;
865 
866 /* description of parameters struct (params). */
867 typedef struct {
868   int struct_size;                       /* sizeof(params)     */
869   xine_post_api_parameter_t *parameter;  /* list of parameters */
870 } xine_post_api_descr_t;
871 
872 typedef struct {
873   /*
874    * method to set all the read/write parameters.
875    * params is a struct * defined by xine_post_api_descr_t
876    */
877   int (*set_parameters) (xine_post_t *self, const void *params);
878 
879   /*
880    * method to get all parameters.
881    */
882   int (*get_parameters) (xine_post_t *self, void *params);
883 
884   /*
885    * method to get params struct definition
886    */
887   xine_post_api_descr_t * (*get_param_descr) (void);
888 
889   /*
890    * method to get plugin and parameters help (UTF-8)
891    * the help string must be word wrapped by the frontend.
892    * it might contain \n to mark paragraph breaks.
893    */
894   char * (*get_help) (void);
895 } xine_post_api_t;
896 
897 /* post parameter types */
898 #define POST_PARAM_TYPE_LAST       0  /* terminator of parameter list       */
899 #define POST_PARAM_TYPE_INT        1  /* integer (or vector of integers)    */
900 #define POST_PARAM_TYPE_DOUBLE     2  /* double (or vector of doubles)      */
901 #define POST_PARAM_TYPE_CHAR       3  /* char (or vector of chars = string) */
902 #define POST_PARAM_TYPE_STRING     4  /* (char *), ASCIIZ                   */
903 #define POST_PARAM_TYPE_STRINGLIST 5  /* (char **) list, NULL terminated    */
904 #define POST_PARAM_TYPE_BOOL       6  /* integer (0 or 1)                   */
905 
906 
907 /*********************************************************************
908  * information retrieval                                             *
909  *********************************************************************/
910 
911 /*
912  * xine log functions
913  *
914  * frontends can display xine log output using these functions
915  */
916 int    xine_get_log_section_count(xine_t *self) XINE_PROTECTED;
917 
918 /* return a NULL terminated array of log sections names */
919 const char *const *xine_get_log_names(xine_t *self) XINE_PROTECTED;
920 
921 /* print some log information to <buf> section */
922 void   xine_log (xine_t *self, int buf,
923 		 const char *format, ...) XINE_FORMAT_PRINTF(3, 4) XINE_PROTECTED;
924 void   xine_vlog(xine_t *self, int buf,
925 		  const char *format, va_list args) XINE_FORMAT_PRINTF(3, 0) XINE_PROTECTED;
926 
927 /* get log messages of specified section */
928 char *const *xine_get_log (xine_t *self, int buf) XINE_PROTECTED;
929 
930 /* log callback will be called whenever something is logged */
931 typedef void (*xine_log_cb_t) (void *user_data, int section);
932 void   xine_register_log_cb (xine_t *self, xine_log_cb_t cb,
933 			     void *user_data) XINE_PROTECTED;
934 
935 /*
936  * error handling / engine status
937  */
938 
939 /* return last error  */
940 int  xine_get_error (xine_stream_t *stream) XINE_PROTECTED;
941 
942 /* get current xine engine status (constants see below) */
943 int  xine_get_status (xine_stream_t *stream) XINE_PROTECTED;
944 
945 /*
946  * engine status codes
947  */
948 #define XINE_STATUS_IDLE                   0 /* no mrl assigned */
949 #define XINE_STATUS_STOP                   1
950 #define XINE_STATUS_PLAY                   2
951 #define XINE_STATUS_QUIT                   3
952 
953 /*
954  * xine error codes
955  */
956 #define XINE_ERROR_NONE                    0
957 #define XINE_ERROR_NO_INPUT_PLUGIN         1
958 #define XINE_ERROR_NO_DEMUX_PLUGIN         2
959 #define XINE_ERROR_DEMUX_FAILED            3
960 #define XINE_ERROR_MALFORMED_MRL           4
961 #define XINE_ERROR_INPUT_FAILED            5
962 
963 /*
964  * try to find out audio/spu language of given channel
965  * (use -1 for current channel)
966  *
967  * lang must point to a buffer of at least XINE_LANG_MAX bytes
968  *
969  * returns 1 on success, 0 on failure
970  */
971 int xine_get_audio_lang (xine_stream_t *stream, int channel,
972 			 char *lang) XINE_PROTECTED;
973 int xine_get_spu_lang   (xine_stream_t *stream, int channel,
974 			 char *lang) XINE_PROTECTED;
975 /*_x_ increasing this number means an incompatible ABI breakage! */
976 #define XINE_LANG_MAX                     32
977 
978 /*
979  * get position / length information
980  *
981  * depending of the nature and system layer of the stream,
982  * some or all of this information may be unavailable or incorrect
983  * (e.g. live network streams may not have a valid length)
984  *
985  * returns 1 on success, 0 on failure (data was not updated,
986  * probably because it's not known yet... try again later)
987  */
988 int  xine_get_pos_length (xine_stream_t *stream,
989 			  int *pos_stream,  /* 0..65535     */
990 			  int *pos_time,    /* milliseconds */
991 			  int *length_time) /* milliseconds */
992   XINE_PROTECTED;
993 
994 /*
995  * get information about the stream such as
996  * video width/height, codecs, audio format, title, author...
997  * strings are UTF-8 encoded.
998  *
999  * constants see below
1000  */
1001 uint32_t    xine_get_stream_info (xine_stream_t *stream, int info) XINE_PROTECTED;
1002 const char *xine_get_meta_info   (xine_stream_t *stream, int info) XINE_PROTECTED;
1003 
1004 /* xine_get_stream_info */
1005 #define XINE_STREAM_INFO_BITRATE           0
1006 #define XINE_STREAM_INFO_SEEKABLE          1
1007 #define XINE_STREAM_INFO_VIDEO_WIDTH       2
1008 #define XINE_STREAM_INFO_VIDEO_HEIGHT      3
1009 #define XINE_STREAM_INFO_VIDEO_RATIO       4 /* *10000 */
1010 #define XINE_STREAM_INFO_VIDEO_CHANNELS    5
1011 #define XINE_STREAM_INFO_VIDEO_STREAMS     6
1012 #define XINE_STREAM_INFO_VIDEO_BITRATE     7
1013 #define XINE_STREAM_INFO_VIDEO_FOURCC      8
1014 #define XINE_STREAM_INFO_VIDEO_HANDLED     9  /* codec available? */
1015 #define XINE_STREAM_INFO_FRAME_DURATION    10 /* 1/90000 sec */
1016 #define XINE_STREAM_INFO_AUDIO_CHANNELS    11
1017 #define XINE_STREAM_INFO_AUDIO_BITS        12
1018 #define XINE_STREAM_INFO_AUDIO_SAMPLERATE  13
1019 #define XINE_STREAM_INFO_AUDIO_BITRATE     14
1020 #define XINE_STREAM_INFO_AUDIO_FOURCC      15
1021 #define XINE_STREAM_INFO_AUDIO_HANDLED     16 /* codec available? */
1022 #define XINE_STREAM_INFO_HAS_CHAPTERS      17
1023 #define XINE_STREAM_INFO_HAS_VIDEO         18
1024 #define XINE_STREAM_INFO_HAS_AUDIO         19
1025 #define XINE_STREAM_INFO_IGNORE_VIDEO      20
1026 #define XINE_STREAM_INFO_IGNORE_AUDIO      21
1027 #define XINE_STREAM_INFO_IGNORE_SPU        22
1028 #define XINE_STREAM_INFO_VIDEO_HAS_STILL   23
1029 #define XINE_STREAM_INFO_MAX_AUDIO_CHANNEL 24
1030 #define XINE_STREAM_INFO_MAX_SPU_CHANNEL   25
1031 #define XINE_STREAM_INFO_AUDIO_MODE        26
1032 #define XINE_STREAM_INFO_SKIPPED_FRAMES    27 /* for 1000 frames delivered */
1033 #define XINE_STREAM_INFO_DISCARDED_FRAMES  28 /* for 1000 frames delivered */
1034 #define XINE_STREAM_INFO_VIDEO_AFD         29
1035 #define XINE_STREAM_INFO_DVD_TITLE_NUMBER   30
1036 #define XINE_STREAM_INFO_DVD_TITLE_COUNT    31
1037 #define XINE_STREAM_INFO_DVD_CHAPTER_NUMBER 32
1038 #define XINE_STREAM_INFO_DVD_CHAPTER_COUNT  33
1039 #define XINE_STREAM_INFO_DVD_ANGLE_NUMBER   34
1040 #define XINE_STREAM_INFO_DVD_ANGLE_COUNT    35
1041 
1042 /* possible values for XINE_STREAM_INFO_VIDEO_AFD */
1043 #define XINE_VIDEO_AFD_NOT_PRESENT         -1
1044 #define XINE_VIDEO_AFD_RESERVED_0          0
1045 #define XINE_VIDEO_AFD_RESERVED_1          1
1046 #define XINE_VIDEO_AFD_BOX_16_9_TOP        2
1047 #define XINE_VIDEO_AFD_BOX_14_9_TOP        3
1048 #define XINE_VIDEO_AFD_BOX_GT_16_9_CENTRE  4
1049 #define XINE_VIDEO_AFD_RESERVED_5          5
1050 #define XINE_VIDEO_AFD_RESERVED_6          6
1051 #define XINE_VIDEO_AFD_RESERVED_7          7
1052 #define XINE_VIDEO_AFD_SAME_AS_FRAME       8
1053 #define XINE_VIDEO_AFD_4_3_CENTRE          9
1054 #define XINE_VIDEO_AFD_16_9_CENTRE         10
1055 #define XINE_VIDEO_AFD_14_9_CENTRE         11
1056 #define XINE_VIDEO_AFD_RESERVED_12         12
1057 #define XINE_VIDEO_AFD_4_3_PROTECT_14_9    13
1058 #define XINE_VIDEO_AFD_16_9_PROTECT_14_9   14
1059 #define XINE_VIDEO_AFD_16_9_PROTECT_4_3    15
1060 
1061 /* xine_get_meta_info */
1062 #define XINE_META_INFO_TITLE               0
1063 #define XINE_META_INFO_COMMENT             1
1064 #define XINE_META_INFO_ARTIST              2
1065 #define XINE_META_INFO_GENRE               3
1066 #define XINE_META_INFO_ALBUM               4
1067 #define XINE_META_INFO_YEAR                5 /* may be full date */
1068 #define XINE_META_INFO_VIDEOCODEC          6
1069 #define XINE_META_INFO_AUDIOCODEC          7
1070 #define XINE_META_INFO_SYSTEMLAYER         8
1071 #define XINE_META_INFO_INPUT_PLUGIN        9
1072 #define XINE_META_INFO_CDINDEX_DISCID      10
1073 #define XINE_META_INFO_TRACK_NUMBER        11
1074 #define XINE_META_INFO_COMPOSER            12
1075 /* post-1.1.17; taken from the list at http://age.hobba.nl/audio/mirroredpages/ogg-tagging.html on 2009-12-11 */
1076 #define XINE_META_INFO_PUBLISHER	   13
1077 #define XINE_META_INFO_COPYRIGHT	   14
1078 #define XINE_META_INFO_LICENSE		   15
1079 #define XINE_META_INFO_ARRANGER		   16
1080 #define XINE_META_INFO_LYRICIST		   17
1081 #define XINE_META_INFO_AUTHOR		   18
1082 #define XINE_META_INFO_CONDUCTOR	   19
1083 #define XINE_META_INFO_PERFORMER	   20
1084 #define XINE_META_INFO_ENSEMBLE		   21
1085 #define XINE_META_INFO_OPUS		   22
1086 #define XINE_META_INFO_PART		   23
1087 #define XINE_META_INFO_PARTNUMBER	   24
1088 #define XINE_META_INFO_LOCATION		   25
1089 /* post-1.1.18.1 */
1090 #define XINE_META_INFO_DISCNUMBER	   26
1091 
1092 
1093 /*********************************************************************
1094  * plugin management / autoplay / mrl browsing                       *
1095  *********************************************************************/
1096 
1097 /*
1098  * note: the pointers to strings or string arrays returned
1099  *       by some of these functions are pointers to statically
1100  *       alloced internal xine memory chunks.
1101  *       they're only valid between xine function calls
1102  *       and should never be free()d.
1103  */
1104 
1105 typedef struct xine_mrl_s xine_mrl_t;
1106 
1107 struct xine_mrl_s {
1108   char      *origin; /* file plugin: path */
1109   char      *mrl;    /* <type>://<location> */
1110   char      *link;
1111   off_t      size;   /* size of this source, may be 0 */
1112   uint32_t   type;   /* see below */
1113 };
1114 
1115 /* mrl types */
1116 #define XINE_MRL_TYPE_unknown        (0 << 0)
1117 #define XINE_MRL_TYPE_dvd            (1 << 0)
1118 #define XINE_MRL_TYPE_vcd            (1 << 1)
1119 #define XINE_MRL_TYPE_net            (1 << 2)
1120 #define XINE_MRL_TYPE_rtp            (1 << 3)
1121 #define XINE_MRL_TYPE_stdin          (1 << 4)
1122 #define XINE_MRL_TYPE_cda            (1 << 5)
1123 #define XINE_MRL_TYPE_file           (1 << 6)
1124 #define XINE_MRL_TYPE_file_fifo      (1 << 7)
1125 #define XINE_MRL_TYPE_file_chardev   (1 << 8)
1126 #define XINE_MRL_TYPE_file_directory (1 << 9)
1127 #define XINE_MRL_TYPE_file_blockdev  (1 << 10)
1128 #define XINE_MRL_TYPE_file_normal    (1 << 11)
1129 #define XINE_MRL_TYPE_file_symlink   (1 << 12)
1130 #define XINE_MRL_TYPE_file_sock      (1 << 13)
1131 #define XINE_MRL_TYPE_file_exec      (1 << 14)
1132 #define XINE_MRL_TYPE_file_backup    (1 << 15)
1133 #define XINE_MRL_TYPE_file_hidden    (1 << 16)
1134 
1135 /* get a list of browsable input plugin ids */
1136 const char *const *xine_get_browsable_input_plugin_ids (xine_t *self)  XINE_PROTECTED;
1137 
1138 /*
1139  * ask input plugin named <plugin_id> to return
1140  * a list of available MRLs in domain/directory <start_mrl>.
1141  *
1142  * <start_mrl> may be NULL indicating the toplevel domain/dir
1143  * returns <start_mrl> if <start_mrl> is a valid MRL, not a directory
1144  * returns NULL if <start_mrl> is an invalid MRL, not even a directory.
1145  */
1146 xine_mrl_t **xine_get_browse_mrls (xine_t *self,
1147 				   const char *plugin_id,
1148 				   const char *start_mrl,
1149 				   int *num_mrls) XINE_PROTECTED;
1150 
1151 /* get a list of plugins that support the autoplay feature */
1152 const char *const *xine_get_autoplay_input_plugin_ids (xine_t *self) XINE_PROTECTED;
1153 
1154 /* get autoplay MRL list from input plugin named <plugin_id> */
1155 const char * const *xine_get_autoplay_mrls (xine_t *self,
1156 					    const char *plugin_id,
1157 					    int *num_mrls) XINE_PROTECTED;
1158 
1159 /* get a list of file extensions for file types supported by xine
1160  * the list is separated by spaces
1161  *
1162  * the pointer returned can be free()ed when no longer used */
1163 char *xine_get_file_extensions (xine_t *self) XINE_PROTECTED;
1164 
1165 /* get a list of mime types supported by xine
1166  *
1167  * the pointer returned can be free()ed when no longer used */
1168 char *xine_get_mime_types (xine_t *self) XINE_PROTECTED;
1169 
1170 /* get the demuxer identifier that handles a given mime type
1171  *
1172  * the pointer returned can be free()ed when no longer used
1173  * returns NULL if no demuxer is available to handle this. */
1174 char *xine_get_demux_for_mime_type (xine_t *self, const char *mime_type) XINE_PROTECTED;
1175 
1176 /* get a description string for a plugin */
1177 const char *xine_get_input_plugin_description (xine_t *self,
1178 					       const char *plugin_id) XINE_PROTECTED;
1179 const char *xine_get_demux_plugin_description (xine_t *self,
1180 					       const char *plugin_id) XINE_PROTECTED;
1181 const char *xine_get_spu_plugin_description   (xine_t *self,
1182 					       const char *plugin_id) XINE_PROTECTED;
1183 const char *xine_get_audio_plugin_description (xine_t *self,
1184 					       const char *plugin_id) XINE_PROTECTED;
1185 const char *xine_get_video_plugin_description (xine_t *self,
1186 					       const char *plugin_id) XINE_PROTECTED;
1187 const char *xine_get_audio_driver_plugin_description (xine_t *self,
1188 					       const char *plugin_id) XINE_PROTECTED;
1189 const char *xine_get_video_driver_plugin_description (xine_t *self,
1190 					       const char *plugin_id) XINE_PROTECTED;
1191 const char *xine_get_post_plugin_description  (xine_t *self,
1192 					       const char *plugin_id) XINE_PROTECTED;
1193 
1194 /* get lists of available audio and video output plugins */
1195 const char *const *xine_list_audio_output_plugins (xine_t *self) XINE_PROTECTED;
1196 const char *const *xine_list_video_output_plugins (xine_t *self) XINE_PROTECTED;
1197 /* typemask is (1ULL << XINE_VISUAL_TYPE_FOO) | ... */
1198 const char *const *xine_list_video_output_plugins_typed (xine_t *self, uint64_t typemask) XINE_PROTECTED;
1199 
1200 /* get list of available demultiplexor plugins */
1201 const char *const *xine_list_demuxer_plugins(xine_t *self) XINE_PROTECTED;
1202 
1203 /* get list of available input plugins */
1204 const char *const *xine_list_input_plugins(xine_t *self) XINE_PROTECTED;
1205 
1206 /* get list of available subpicture plugins */
1207 const char *const *xine_list_spu_plugins(xine_t *self) XINE_PROTECTED;
1208 
1209 /* get list of available audio and video decoder plugins */
1210 const char *const *xine_list_audio_decoder_plugins(xine_t *self) XINE_PROTECTED;
1211 const char *const *xine_list_video_decoder_plugins(xine_t *self) XINE_PROTECTED;
1212 
1213 /* unload unused plugins */
1214 void xine_plugins_garbage_collector(xine_t *self) XINE_PROTECTED;
1215 
1216 
1217 /*********************************************************************
1218  * visual specific gui <-> xine engine communication                 *
1219  *********************************************************************/
1220 
1221 /* new (preferred) method to talk to video driver. */
1222 int    xine_port_send_gui_data (xine_video_port_t *vo,
1223 			        int type, void *data) XINE_PROTECTED;
1224 
1225 typedef struct {
1226 
1227   /* area of that drawable to be used by video */
1228   int      x,y,w,h;
1229 
1230 } x11_rectangle_t;
1231 
1232 /*
1233  * this is the visual data struct any x11 gui
1234  * must supply to the xine_open_video_driver call
1235  * ("data" parameter)
1236  */
1237 typedef struct {
1238 
1239   /* some information about the display */
1240   void             *display; /* Display* */
1241   int               screen;
1242 
1243   /* drawable to display the video in/on */
1244   unsigned long     d; /* Drawable */
1245 
1246   void             *user_data;
1247 
1248   /*
1249    * dest size callback
1250    *
1251    * this will be called by the video driver to find out
1252    * how big the video output area size will be for a
1253    * given video size. The ui should _not_ adjust its
1254    * video out area, just do some calculations and return
1255    * the size. This will be called for every frame, ui
1256    * implementation should be fast.
1257    * dest_pixel_aspect should be set to the used display pixel aspect.
1258    * NOTE: Semantics has changed: video_width and video_height
1259    * are no longer pixel aspect corrected. Get the old semantics
1260    * in the UI with
1261    *   *dest_pixel_aspect = display_pixel_aspect;
1262    *   if (video_pixel_aspect >= display_pixel_aspect)
1263    *     video_width  = video_width * video_pixel_aspect / display_pixel_aspect + .5;
1264    *   else
1265    *     video_height = video_height * display_pixel_aspect / video_pixel_aspect + .5;
1266    */
1267   void (*dest_size_cb) (void *user_data,
1268 			int video_width, int video_height,
1269 			double video_pixel_aspect,
1270 			int *dest_width, int *dest_height,
1271 			double *dest_pixel_aspect);
1272 
1273   /*
1274    * frame output callback
1275    *
1276    * this will be called by the video driver for every frame
1277    * it's about to draw. ui can adapt its size if necessary
1278    * here.
1279    * note: the ui doesn't have to adjust itself to this
1280    * size, this is just to be taken as a hint.
1281    * ui must return the actual size of the video output
1282    * area and the video output driver will do its best
1283    * to adjust the video frames to that size (while
1284    * preserving aspect ratio and stuff).
1285    *    dest_x, dest_y: offset inside window
1286    *    dest_width, dest_height: available drawing space
1287    *    dest_pixel_aspect: display pixel aspect
1288    *    win_x, win_y: window absolute screen position
1289    * NOTE: Semantics has changed: video_width and video_height
1290    * are no longer pixel aspect corrected. Get the old semantics
1291    * in the UI with
1292    *   *dest_pixel_aspect = display_pixel_aspect;
1293    *   if (video_pixel_aspect >= display_pixel_aspect)
1294    *     video_width  = video_width * video_pixel_aspect / display_pixel_aspect + .5;
1295    *   else
1296    *     video_height = video_height * display_pixel_aspect / video_pixel_aspect + .5;
1297    */
1298   void (*frame_output_cb) (void *user_data,
1299 			   int video_width, int video_height,
1300 			   double video_pixel_aspect,
1301 			   int *dest_x, int *dest_y,
1302 			   int *dest_width, int *dest_height,
1303 			   double *dest_pixel_aspect,
1304 			   int *win_x, int *win_y);
1305 
1306   /*
1307    * lock display callback
1308    *
1309    * this callback is called when the video driver
1310    * needs access to the x11 display connection
1311    *
1312    * note: to enable this you MUST use XINE_VISUAL_TYPE_X11_2
1313    * note: if display_lock is NULL, the fallback is used
1314    * note: fallback for this function is XLockDisplay(display)
1315    */
1316    void (*lock_display) (void *user_data);
1317 
1318   /*
1319    * unlock display callback
1320    *
1321    * this callback is called when the video driver
1322    * doesn't need access to the x11 display connection anymore
1323    *
1324    * note: to enable this you MUST use XINE_VISUAL_TYPE_X11_2
1325    * note: if display_unlock is NULL, the fallback is used
1326    * note: fallback for this function is XUnlockDisplay(display)
1327    */
1328    void (*unlock_display) (void *user_data);
1329 
1330 } x11_visual_t;
1331 
1332 /*
1333  * this is the visual data struct any xcb gui
1334  * must supply to the xine_open_video_driver call
1335  * ("data" parameter)
1336  */
1337 typedef struct {
1338 
1339   /* some information about the display */
1340   void        *connection; /* xcb_connection_t */
1341   void        *screen;     /* xcb_screen_t     */
1342 
1343   /* window to display the video in / on */
1344   unsigned int window; /* xcb_window_t */
1345 
1346   void        *user_data;
1347 
1348   /*
1349    * dest size callback
1350    *
1351    * this will be called by the video driver to find out
1352    * how big the video output area size will be for a
1353    * given video size. The ui should _not_ adjust its
1354    * video out area, just do some calculations and return
1355    * the size. This will be called for every frame, ui
1356    * implementation should be fast.
1357    * dest_pixel_aspect should be set to the used display pixel aspect.
1358    * NOTE: Semantics has changed: video_width and video_height
1359    * are no longer pixel aspect corrected. Get the old semantics
1360    * in the UI with
1361    *   *dest_pixel_aspect = display_pixel_aspect;
1362    *   if (video_pixel_aspect >= display_pixel_aspect)
1363    *     video_width  = video_width * video_pixel_aspect / display_pixel_aspect + .5;
1364    *   else
1365    *     video_height = video_height * display_pixel_aspect / video_pixel_aspect + .5;
1366    */
1367   void (*dest_size_cb) (void *user_data,
1368 			int video_width, int video_height,
1369 			double video_pixel_aspect,
1370 			int *dest_width, int *dest_height,
1371 			double *dest_pixel_aspect);
1372 
1373   /*
1374    * frame output callback
1375    *
1376    * this will be called by the video driver for every frame
1377    * it's about to draw. ui can adapt its size if necessary
1378    * here.
1379    * note: the ui doesn't have to adjust itself to this
1380    * size, this is just to be taken as a hint.
1381    * ui must return the actual size of the video output
1382    * area and the video output driver will do its best
1383    * to adjust the video frames to that size (while
1384    * preserving aspect ratio and stuff).
1385    *    dest_x, dest_y: offset inside window
1386    *    dest_width, dest_height: available drawing space
1387    *    dest_pixel_aspect: display pixel aspect
1388    *    win_x, win_y: window absolute screen position
1389    * NOTE: Semantics has changed: video_width and video_height
1390    * are no longer pixel aspect corrected. Get the old semantics
1391    * in the UI with
1392    *   *dest_pixel_aspect = display_pixel_aspect;
1393    *   if (video_pixel_aspect >= display_pixel_aspect)
1394    *     video_width  = video_width * video_pixel_aspect / display_pixel_aspect + .5;
1395    *   else
1396    *     video_height = video_height * display_pixel_aspect / video_pixel_aspect + .5;
1397    */
1398   void (*frame_output_cb) (void *user_data,
1399 			   int video_width, int video_height,
1400 			   double video_pixel_aspect,
1401 			   int *dest_x, int *dest_y,
1402 			   int *dest_width, int *dest_height,
1403 			   double *dest_pixel_aspect,
1404 			   int *win_x, int *win_y);
1405 
1406 } xcb_visual_t;
1407 
1408 /*
1409  * this is the visual data struct any Wayland GUI
1410  * must supply to the xine_open_video_driver call
1411  * ("data" parameter)
1412  */
1413 
1414 struct wl_display;
1415 struct wl_surface;
1416 
1417 typedef struct {
1418 
1419   struct wl_display *display;
1420   struct wl_surface *surface;
1421 
1422   void *user_data;
1423   void (*frame_output_cb) (void *user_data,
1424                            int video_width, int video_height,
1425                            double video_pixel_aspect,
1426                            int *dest_x, int *dest_y,
1427                            int *dest_width, int *dest_height,
1428                            double *dest_pixel_aspect,
1429                            int *win_x, int *win_y);
1430 
1431 } xine_wayland_visual_t;
1432 
1433 /**************************************************
1434  * XINE_VO_RAW struct definitions
1435  *************************************************/
1436 /*  frame_format definitions */
1437 #define XINE_VORAW_YV12 1
1438 #define XINE_VORAW_YUY2 2
1439 #define XINE_VORAW_RGB 4
1440 
1441 /*  maximum number of overlays the raw driver can handle */
1442 #define XINE_VORAW_MAX_OVL 16
1443 
1444 /* raw_overlay_t struct used in raw_overlay_cb callback */
1445 typedef struct {
1446   uint8_t *ovl_rgba;
1447   int ovl_w, ovl_h; /* overlay's width and height */
1448   int ovl_x, ovl_y; /* overlay's top-left display position */
1449 } raw_overlay_t;
1450 
1451 /* this is the visual data struct any raw gui
1452  * must supply to the xine_open_video_driver call
1453  * ("data" parameter)
1454  */
1455 typedef struct {
1456   void *user_data;
1457 
1458   /* OR'ed frame_format
1459    * Unsupported frame formats are converted to rgb.
1460    * XINE_VORAW_RGB is always assumed by the driver, even if not set.
1461    * So a frontend must at least support rgb.
1462    * Be aware that rgb requires more cpu than yuv,
1463    * so avoid its usage for video playback.
1464    * However, it's useful for single frame capture (e.g. thumbs)
1465    */
1466   int supported_formats;
1467 
1468   /* raw output callback
1469    * this will be called by the video driver for every frame
1470    *
1471    * If frame_format==XINE_VORAW_YV12, data0 points to frame_width*frame_height Y values
1472    *                                   data1 points to (frame_width/2)*(frame_height/2) U values
1473    *                                   data2 points to (frame_width/2)*(frame_height/2) V values
1474    *
1475    * If frame_format==XINE_VORAW_YUY2, data0 points to frame_width*frame_height*2 YU/Y²V values
1476    *                                   data1 is NULL
1477    *                                   data2 is NULL
1478    *
1479    * If frame_format==XINE_VORAW_RGB, data0 points to frame_width*frame_height*3 RGB values
1480    *                                  data1 is NULL
1481    *                                  data2 is NULL
1482    */
1483   void (*raw_output_cb) (void *user_data, int frame_format,
1484                         int frame_width, int frame_height,
1485 			double frame_aspect,
1486 			void *data0, void *data1, void *data2);
1487 
1488   /* raw overlay callback
1489    * this will be called by the video driver for every new overlay state
1490    * overlays_array points to an array of num_ovl raw_overlay_t
1491    * Note that num_ovl can be 0, meaning "end of overlay display"
1492    * num_ovl is at most XINE_VORAW_MAX_OVL */
1493   void (*raw_overlay_cb) (void *user_data, int num_ovl,
1494                          raw_overlay_t *overlays_array);
1495 } raw_visual_t;
1496 /**********************************************
1497  * end of vo_raw defs
1498  *********************************************/
1499 
1500 /*
1501  * this is the visual data struct any fb gui
1502  * may supply to the xine_open_video_driver call
1503  * ("data" parameter) to get frame_output_cd calls
1504  */
1505 
1506 typedef struct {
1507 
1508  void (*frame_output_cb) (void *user_data,
1509 			   int video_width, int video_height,
1510 			   double video_pixel_aspect,
1511 			   int *dest_x, int *dest_y,
1512 			   int *dest_width, int *dest_height,
1513 			   double *dest_pixel_aspect,
1514 			   int *win_x, int *win_y);
1515 
1516   void             *user_data;
1517 
1518 } fb_visual_t;
1519 
1520 #if defined(WIN32) && (!defined(XINE_COMPILE) || defined(XINE_NEED_WIN32_VISUAL))
1521 /*
1522  * this is the visual data struct any win32 gui should supply
1523  * (pass this to init_video_out_plugin or the xine_load_video_output_plugin
1524  * utility function)
1525  */
1526 
1527 typedef struct {
1528 
1529   HWND      WndHnd;     /* handle of window associated with primary surface */
1530   HINSTANCE HInst;      /* handle of windows application instance */
1531   RECT      WndRect;    /* rect of window client points translated to screen
1532                          * cooridnates */
1533   int       FullScreen; /* is window fullscreen */
1534   HBRUSH    Brush;      /* window brush for background color */
1535   COLORREF  ColorKey;   /* window brush color key */
1536 
1537 } win32_visual_t;
1538 
1539 /*
1540  * constants for gui_data_exchange's data_type parameter
1541  */
1542 
1543 #define GUI_WIN32_MOVED_OR_RESIZED	0
1544 
1545 #endif /* WIN32 */
1546 
1547 /*
1548  * "type" constants for xine_port_send_gui_data(...)
1549  */
1550 
1551 #ifndef XINE_DISABLE_DEPRECATED_FEATURES
1552 /* xevent *data */
1553 #define XINE_GUI_SEND_COMPLETION_EVENT       1 /* DEPRECATED */
1554 #endif
1555 
1556 /* Drawable data */
1557 #define XINE_GUI_SEND_DRAWABLE_CHANGED       2
1558 
1559 /* xevent *data */
1560 #define XINE_GUI_SEND_EXPOSE_EVENT           3
1561 
1562 /* x11_rectangle_t *data */
1563 #define XINE_GUI_SEND_TRANSLATE_GUI_TO_VIDEO 4
1564 
1565 /* int data */
1566 #define XINE_GUI_SEND_VIDEOWIN_VISIBLE	     5
1567 
1568 /* *data contains chosen visual, select a new one or change it to NULL
1569  * to indicate the visual to use or that no visual will work */
1570 /* XVisualInfo **data */
1571 #define XINE_GUI_SEND_SELECT_VISUAL          8
1572 
1573 /* Gui is about to destroy drawable */
1574 #define XINE_GUI_SEND_WILL_DESTROY_DRAWABLE  9
1575 
1576 
1577 /*********************************************************************
1578  * xine health check stuff                                           *
1579  *********************************************************************/
1580 
1581 #define XINE_HEALTH_CHECK_OK            0
1582 #define XINE_HEALTH_CHECK_FAIL          1
1583 #define XINE_HEALTH_CHECK_UNSUPPORTED   2
1584 #define XINE_HEALTH_CHECK_NO_SUCH_CHECK 3
1585 
1586 #define CHECK_KERNEL    0
1587 #define CHECK_MTRR      1
1588 #define CHECK_CDROM     2
1589 #define CHECK_DVDROM    3
1590 #define CHECK_DMA       4
1591 #define CHECK_X         5
1592 #define CHECK_XV        6
1593 
1594 struct xine_health_check_s {
1595   const char* cdrom_dev;
1596   const char* dvd_dev;
1597   const char* msg;
1598   const char* title;
1599   const char* explanation;
1600   int         status;
1601 };
1602 
1603 typedef struct xine_health_check_s xine_health_check_t;
1604 xine_health_check_t* xine_health_check(xine_health_check_t*, int check_num) XINE_PROTECTED;
1605 
1606 
1607 /*********************************************************************
1608  * configuration system                                              *
1609  *********************************************************************/
1610 
1611 /*
1612  * config entry data types
1613  */
1614 
1615 #define XINE_CONFIG_TYPE_UNKNOWN 0
1616 #define XINE_CONFIG_TYPE_RANGE   1
1617 #define XINE_CONFIG_TYPE_STRING  2
1618 #define XINE_CONFIG_TYPE_ENUM    3
1619 #define XINE_CONFIG_TYPE_NUM     4
1620 #define XINE_CONFIG_TYPE_BOOL    5
1621 
1622 /* For the string type (1.1.4 and later). These are stored in num_value. */
1623 #define XINE_CONFIG_STRING_IS_STRING		0
1624 #define XINE_CONFIG_STRING_IS_FILENAME		1
1625 #define XINE_CONFIG_STRING_IS_DEVICE_NAME	2
1626 #define XINE_CONFIG_STRING_IS_DIRECTORY_NAME	3
1627 
1628 typedef struct xine_cfg_entry_s xine_cfg_entry_t;
1629 
1630 typedef void (*xine_config_cb_t) (void *user_data,
1631 				  xine_cfg_entry_t *entry);
1632 struct xine_cfg_entry_s {
1633   const char      *key;     /* unique id (example: gui.logo_mrl) */
1634 
1635   int              type;
1636 
1637   /* user experience level */
1638   int              exp_level; /* 0 => beginner,
1639 			        10 => advanced user,
1640 			        20 => expert */
1641 
1642   /* type unknown */
1643   char            *unknown_value;
1644 
1645   /* type string */
1646   char            *str_value;
1647   char            *str_default;
1648 
1649   /* common to range, enum, num, bool;
1650    * num_value is also used by string to indicate what's required:
1651    * plain string, file name, device name, directory name
1652    */
1653   int              num_value;
1654   int              num_default;
1655 
1656   /* type range specific: */
1657   int              range_min;
1658   int              range_max;
1659 
1660   /* type enum specific: */
1661   char           **enum_values;
1662 
1663   /* help info for the user (UTF-8)
1664    * the help string must be word wrapped by the frontend.
1665    * it might contain \n to mark paragraph breaks.
1666    */
1667   const char      *description;
1668   const char      *help;
1669 
1670   /* callback function and data for live changeable values */
1671   /* some config entries will take effect immediately, although they
1672    * do not have a callback registered; such values will have some
1673    * non-NULL dummy value in callback_data; so if you want to check,
1674    * if a config change will require restarting xine, check for
1675    * callback_data == NULL */
1676   xine_config_cb_t callback;
1677   void            *callback_data;
1678 
1679 };
1680 
1681 const char *xine_config_register_string (xine_t *self,
1682 					 const char *key,
1683 					 const char *def_value,
1684 					 const char *description,
1685 					 const char *help,
1686 					 int   exp_level,
1687 					 xine_config_cb_t changed_cb,
1688 					 void *cb_data) XINE_PROTECTED;
1689 
1690 const char *xine_config_register_filename (xine_t *self,
1691 					   const char *key,
1692 					   const char *def_value,
1693 					   int req_type, /* XINE_CONFIG_STRING_IS_* */
1694 					   const char *description,
1695 					   const char *help,
1696 					   int   exp_level,
1697 					   xine_config_cb_t changed_cb,
1698 					   void *cb_data) XINE_PROTECTED;
1699 
1700 int   xine_config_register_range  (xine_t *self,
1701 				   const char *key,
1702 				   int def_value,
1703 				   int min, int max,
1704 				   const char *description,
1705 				   const char *help,
1706 				   int   exp_level,
1707 				   xine_config_cb_t changed_cb,
1708 				   void *cb_data) XINE_PROTECTED;
1709 
1710 int   xine_config_register_enum   (xine_t *self,
1711 				   const char *key,
1712 				   int def_value,
1713 				   char **values,
1714 				   const char *description,
1715 				   const char *help,
1716 				   int   exp_level,
1717 				   xine_config_cb_t changed_cb,
1718 				   void *cb_data) XINE_PROTECTED;
1719 
1720 int   xine_config_register_num    (xine_t *self,
1721 				   const char *key,
1722 				   int def_value,
1723 				   const char *description,
1724 				   const char *help,
1725 				   int   exp_level,
1726 				   xine_config_cb_t changed_cb,
1727 				   void *cb_data) XINE_PROTECTED;
1728 
1729 int   xine_config_register_bool   (xine_t *self,
1730 				   const char *key,
1731 				   int def_value,
1732 				   const char *description,
1733 				   const char *help,
1734 				   int   exp_level,
1735 				   xine_config_cb_t changed_cb,
1736 				   void *cb_data) XINE_PROTECTED;
1737 
1738 /**
1739  * unregister multiple entry callback functions.
1740  * all 3 values need to match unless they are NULL.
1741  * if cb_data_size is not zero, data pointers within the range
1742  * (cb_data <= ptr < cb_data + cb_data_size) will match.
1743  * returns the count of unregistered functions.
1744  */
1745 #define HAVE_XINE_CONFIG_UNREGISTER_CALLBACKS 1
1746 int xine_config_unregister_callbacks (xine_t *self,
1747   const char *key, xine_config_cb_t changed_cb, void *cb_data, size_t cb_data_size) XINE_PROTECTED;
1748 
1749 /*
1750  * the following functions will copy data from the internal xine_config
1751  * data database to the xine_cfg_entry_t *entry you provide
1752  *
1753  * they return 1 on success, 0 on failure
1754  */
1755 
1756 /* get first config item */
1757 int  xine_config_get_first_entry (xine_t *self, xine_cfg_entry_t *entry) XINE_PROTECTED;
1758 
1759 /* get next config item (iterate through the items) */
1760 int  xine_config_get_next_entry (xine_t *self, xine_cfg_entry_t *entry) XINE_PROTECTED;
1761 
1762 /* search for a config entry by key */
1763 int  xine_config_lookup_entry (xine_t *self, const char *key,
1764 			       xine_cfg_entry_t *entry) XINE_PROTECTED;
1765 
1766 /*
1767  * Helper function to get numeric value of config entry.
1768  * Return def_value if entry was not found (or is not correct type).
1769  */
1770 int xine_config_lookup_num(xine_t *self, const char *key, int def_value) XINE_PROTECTED;
1771 
1772 /*
1773  * Thread-safe helper function to get string value of config entry.
1774  * Return copy of current value or NULL.
1775  * Returned string must be freed with xine_config_free_str().
1776  */
1777 char *xine_config_lookup_string(xine_t *self, const char *key) XINE_PROTECTED;
1778 void xine_config_free_string(xine_t *self, char **value) XINE_PROTECTED;
1779 
1780 /*
1781  * update a config entry (which was returned from lookup_entry() )
1782  *
1783  * xine will make a deep copy of the data in the entry into its internal
1784  * config database.
1785  */
1786 void xine_config_update_entry (xine_t *self,
1787 			       const xine_cfg_entry_t *entry) XINE_PROTECTED;
1788 
1789 /*
1790  * translation of old configuration entry names
1791  */
1792 typedef struct {
1793   const char *old_name, *new_name;
1794 } xine_config_entry_translation_t;
1795 
1796 void xine_config_set_translation_user (const xine_config_entry_translation_t *) XINE_PROTECTED;
1797 
1798 /*
1799  * load/save config data from/to afile (e.g. $HOME/.xine/config)
1800  */
1801 void xine_config_load  (xine_t *self, const char *cfg_filename) XINE_PROTECTED;
1802 void xine_config_save  (xine_t *self, const char *cfg_filename) XINE_PROTECTED;
1803 void xine_config_reset (xine_t *self) XINE_PROTECTED;
1804 
1805 
1806 /*********************************************************************
1807  * asynchroneous xine event mechanism                                *
1808  *********************************************************************/
1809 
1810 /*
1811  * to receive events you have to register an event queue with
1812  * the xine engine (xine_event_new_queue, see below).
1813  *
1814  * then you can either
1815  * 1) check for incoming events regularly (xine_event_get/wait),
1816  *    process them and free them using xine_event_free
1817  * 2) use xine_event_create_listener_thread and specify a callback
1818  *    which will then be called for each event
1819  *
1820  * to send events to every module listening you don't need
1821  * to register an event queue but simply call xine_event_send.
1822  *
1823  * front ends should listen for one of MRL_REFERENCE and MRL_REFERENCE_EXT
1824  * since both will be sent for compatibility reasons
1825  */
1826 
1827 /* event types */
1828 #define XINE_EVENT_UI_PLAYBACK_FINISHED   1 /* frontend can e.g. move on to next playlist entry */
1829 #define XINE_EVENT_UI_CHANNELS_CHANGED    2 /* inform ui that new channel info is available */
1830 #define XINE_EVENT_UI_SET_TITLE           3 /* request title display change in ui */
1831 #define XINE_EVENT_UI_MESSAGE             4 /* message (dialog) for the ui to display */
1832 #define XINE_EVENT_FRAME_FORMAT_CHANGE    5 /* e.g. aspect ratio change during dvd playback */
1833 #define XINE_EVENT_AUDIO_LEVEL            6 /* report current audio level (l/r/mute) */
1834 #define XINE_EVENT_QUIT                   7 /* last event sent when stream is disposed */
1835 #define XINE_EVENT_PROGRESS               8 /* index creation/network connections */
1836 #define XINE_EVENT_MRL_REFERENCE          9 /* (deprecated) demuxer->frontend: MRL reference(s) for the real stream */
1837 #define XINE_EVENT_UI_NUM_BUTTONS        10 /* number of buttons for interactive menus */
1838 #define XINE_EVENT_SPU_BUTTON            11 /* the mouse pointer enter/leave a button */
1839 #define XINE_EVENT_DROPPED_FRAMES        12 /* number of dropped frames is too high */
1840 #define XINE_EVENT_MRL_REFERENCE_EXT     13 /* demuxer->frontend: MRL reference(s) for the real stream */
1841 #define XINE_EVENT_AUDIO_AMP_LEVEL       14 /* report current audio amp level (l/r/mute) */
1842 #define XINE_EVENT_NBC_STATS             15 /* nbc buffer status */
1843 
1844 
1845 /* input events coming from frontend */
1846 #define XINE_EVENT_INPUT_MOUSE_BUTTON   101
1847 #define XINE_EVENT_INPUT_MOUSE_MOVE     102
1848 #define XINE_EVENT_INPUT_MENU1          103
1849 #define XINE_EVENT_INPUT_MENU2          104
1850 #define XINE_EVENT_INPUT_MENU3          105
1851 #define XINE_EVENT_INPUT_MENU4          106
1852 #define XINE_EVENT_INPUT_MENU5          107
1853 #define XINE_EVENT_INPUT_MENU6          108
1854 #define XINE_EVENT_INPUT_MENU7          109
1855 #define XINE_EVENT_INPUT_UP             110
1856 #define XINE_EVENT_INPUT_DOWN           111
1857 #define XINE_EVENT_INPUT_LEFT           112
1858 #define XINE_EVENT_INPUT_RIGHT          113
1859 #define XINE_EVENT_INPUT_SELECT         114
1860 #define XINE_EVENT_INPUT_NEXT           115
1861 #define XINE_EVENT_INPUT_PREVIOUS       116
1862 #define XINE_EVENT_INPUT_ANGLE_NEXT     117
1863 #define XINE_EVENT_INPUT_ANGLE_PREVIOUS 118
1864 #define XINE_EVENT_INPUT_BUTTON_FORCE   119
1865 #define XINE_EVENT_INPUT_NUMBER_0       120
1866 #define XINE_EVENT_INPUT_NUMBER_1       121
1867 #define XINE_EVENT_INPUT_NUMBER_2       122
1868 #define XINE_EVENT_INPUT_NUMBER_3       123
1869 #define XINE_EVENT_INPUT_NUMBER_4       124
1870 #define XINE_EVENT_INPUT_NUMBER_5       125
1871 #define XINE_EVENT_INPUT_NUMBER_6       126
1872 #define XINE_EVENT_INPUT_NUMBER_7       127
1873 #define XINE_EVENT_INPUT_NUMBER_8       128
1874 #define XINE_EVENT_INPUT_NUMBER_9       129
1875 #define XINE_EVENT_INPUT_NUMBER_10_ADD  130
1876 
1877 /* specific event types */
1878 #define XINE_EVENT_SET_V4L2             200
1879 #define XINE_EVENT_PVR_SAVE             201
1880 #define XINE_EVENT_PVR_REPORT_NAME      202
1881 #define XINE_EVENT_PVR_REALTIME         203
1882 #define XINE_EVENT_PVR_PAUSE            204
1883 #define XINE_EVENT_SET_MPEG_DATA        205
1884 
1885 /* VDR specific event types */
1886 #define XINE_EVENT_VDR_RED              300
1887 #define XINE_EVENT_VDR_GREEN            301
1888 #define XINE_EVENT_VDR_YELLOW           302
1889 #define XINE_EVENT_VDR_BLUE             303
1890 #define XINE_EVENT_VDR_PLAY             304
1891 #define XINE_EVENT_VDR_PAUSE            305
1892 #define XINE_EVENT_VDR_STOP             306
1893 #define XINE_EVENT_VDR_RECORD           307
1894 #define XINE_EVENT_VDR_FASTFWD          308
1895 #define XINE_EVENT_VDR_FASTREW          309
1896 #define XINE_EVENT_VDR_POWER            310
1897 #define XINE_EVENT_VDR_CHANNELPLUS      311
1898 #define XINE_EVENT_VDR_CHANNELMINUS     312
1899 #define XINE_EVENT_VDR_SCHEDULE         313
1900 #define XINE_EVENT_VDR_CHANNELS         314
1901 #define XINE_EVENT_VDR_TIMERS           315
1902 #define XINE_EVENT_VDR_RECORDINGS       316
1903 #define XINE_EVENT_VDR_SETUP            317
1904 #define XINE_EVENT_VDR_COMMANDS         318
1905 #define XINE_EVENT_VDR_BACK             319
1906 #define XINE_EVENT_VDR_USER1            320
1907 #define XINE_EVENT_VDR_USER2            321
1908 #define XINE_EVENT_VDR_USER3            322
1909 #define XINE_EVENT_VDR_USER4            323
1910 #define XINE_EVENT_VDR_USER5            324
1911 #define XINE_EVENT_VDR_USER6            325
1912 #define XINE_EVENT_VDR_USER7            326
1913 #define XINE_EVENT_VDR_USER8            327
1914 #define XINE_EVENT_VDR_USER9            328
1915 #define XINE_EVENT_VDR_VOLPLUS          329
1916 #define XINE_EVENT_VDR_VOLMINUS         330
1917 #define XINE_EVENT_VDR_MUTE             331
1918 #define XINE_EVENT_VDR_AUDIO            332
1919 #define XINE_EVENT_VDR_INFO             333
1920 #define XINE_EVENT_VDR_CHANNELPREVIOUS  334
1921 #define XINE_EVENT_VDR_SUBTITLES        335
1922 #define XINE_EVENT_VDR_USER0            336
1923 /* some space for further keys */
1924 #define XINE_EVENT_VDR_SETVIDEOWINDOW   350
1925 #define XINE_EVENT_VDR_FRAMESIZECHANGED 351
1926 #define XINE_EVENT_VDR_SELECTAUDIO      352
1927 #define XINE_EVENT_VDR_TRICKSPEEDMODE   353
1928 #define XINE_EVENT_VDR_PLUGINSTARTED    354
1929 #define XINE_EVENT_VDR_DISCONTINUITY    355
1930 
1931 /* events generated from post plugins */
1932 #define XINE_EVENT_POST_TVTIME_FILMMODE_CHANGE   400
1933 
1934 /*
1935  * xine event struct
1936  */
1937 typedef struct {
1938   xine_stream_t                   *stream; /* stream this event belongs to     */
1939 
1940   void                            *data;   /* contents depending on type */
1941   int                              data_length;
1942 
1943   int                              type;   /* event type (constants see above) */
1944 
1945   /* you do not have to provide this, it will be filled in by xine_event_send() */
1946   struct timeval                   tv;     /* timestamp of event creation */
1947 } xine_event_t;
1948 
1949 /*
1950  * input event dynamic data
1951  */
1952 typedef struct {
1953   xine_event_t        event;
1954   uint8_t             button; /* Generally 1 = left, 2 = mid, 3 = right */
1955   uint16_t            x,y;    /* In Image space */
1956 } xine_input_data_t;
1957 
1958 /*
1959  * UI event dynamic data - send information to/from UI.
1960  */
1961 typedef struct {
1962   int                 num_buttons;
1963   int                 str_len;
1964   char                str[256]; /* might be longer */
1965 } xine_ui_data_t;
1966 
1967 /*
1968  * Send messages to UI. used mostly to report errors.
1969  */
1970 typedef struct {
1971   /*
1972    * old xine-ui versions expect xine_ui_data_t type.
1973    * this struct is added for compatibility.
1974    */
1975   xine_ui_data_t      compatibility;
1976 
1977   /* See XINE_MSG_xxx for defined types. */
1978   int                 type;
1979 
1980   /* defined types are provided with a standard explanation.
1981    * note: zero means no explanation.
1982    */
1983   int                 explanation; /* add to struct address to get a valid (char *) */
1984 
1985   /* parameters are zero terminated strings */
1986   int                 num_parameters;
1987   int                 parameters;  /* add to struct address to get a valid (char *) */
1988 
1989   /* where messages are stored, will be longer
1990    *
1991    * this field begins with the message text itself (\0-terminated),
1992    * followed by (optional) \0-terminated parameter strings
1993    * the end marker is \0 \0
1994    */
1995   char                messages[1];
1996 } xine_ui_message_data_t;
1997 
1998 
1999 /*
2000  * notify frame format change
2001  */
2002 typedef struct {
2003   int                 width;
2004   int                 height;
2005   /* these are aspect codes as defined in MPEG2, because this
2006    * is only used for DVD playback, pan_scan is a boolean flag */
2007   int                 aspect;
2008   int                 pan_scan;
2009 } xine_format_change_data_t;
2010 
2011 /*
2012  * audio level for left/right channel
2013  */
2014 typedef struct {
2015   int                 left;
2016   int                 right;  /* 0..100 % */
2017   int                 mute;
2018 } xine_audio_level_data_t;
2019 
2020 /*
2021  * index generation / buffering
2022  */
2023 typedef struct {
2024   const char         *description; /* e.g. "connecting..." */
2025   int                 percent;
2026 } xine_progress_data_t;
2027 
2028 /*
2029  * nbc buffer status
2030  */
2031 typedef struct {
2032   int                 v_percent;    /* fill of video buffer */
2033   int64_t             v_remaining;  /* remaining time in ms till underrun */
2034   int64_t             v_bitrate;    /* current bitrate */
2035   int                 v_in_disc;    /* in discontinuity */
2036   int                 a_percent;    /* like video, but for audio */
2037   int64_t             a_remaining;
2038   int64_t             a_bitrate;
2039   int                 a_in_disc;
2040   int                 buffering;    /* currently filling buffer */
2041   int                 enabled;      /* buffer disabled by engine */
2042   int                 type;         /* 0=buffer put, 1=buffer get */
2043 } xine_nbc_stats_data_t;
2044 
2045 /*
2046  * mrl reference data is sent by demuxers when a reference stream is found.
2047  * this stream just contains pointers (urls) to the real data, which are
2048  * passed to frontend using this event type. (examples: .asx, .mov and .ram)
2049  *
2050  * ideally, frontends should add these mrls to a "hierarchical playlist".
2051  * that is, instead of the original file, the ones provided here should be
2052  * played instead. on pratice, just using a simple playlist should work.
2053  *
2054  * mrl references should be played in the same order they are received, just
2055  * after the current stream finishes.
2056  * alternative entries may be provided and should be used in case of
2057  * failure of the primary stream (the one with alternative=0).
2058  *
2059  * sample playlist:
2060  *   1) http://something/something.ram
2061  *     1a) rtsp://something/realsomething1.rm (alternative=0)
2062  *     1b) pnm://something/realsomething1.rm (alternative=1)
2063  *   2) http://another/another.avi
2064  *
2065  * 1 and 2 are the original items on this playlist. 1a and 1b were received
2066  * by events (they are the mrl references enclosed in 1). 1a is played after
2067  * receiving the finished event from 1. note: 1b is usually ignored, it should
2068  * only be used in case 1a fails to open.
2069  *
2070  * An event listener which accepts XINE_EVENT_MRL_REFERENCE_EXT events
2071  * *must* ignore XINE_EVENT_MRL_REFERENCE events.
2072  */
2073 typedef struct {
2074   int                 alternative; /* alternative playlist number, usually 0 */
2075   char                mrl[1]; /* might (will) be longer */
2076 } xine_mrl_reference_data_t XINE_DEPRECATED;
2077 
2078 typedef struct {
2079   int                 alternative; /* as above */
2080   uint32_t            start_time, duration; /* milliseconds */
2081   uint32_t            spare[20]; /* for future expansion */
2082   const char          mrl[1]; /* might (will) be longer */
2083 /*const char          title[]; ** immediately follows MRL's terminating NUL */
2084 } xine_mrl_reference_data_ext_t;
2085 
2086 /*
2087  * configuration options for video4linux-like input plugins
2088  */
2089 typedef struct {
2090   /* input selection */
2091   int input;                    /* select active input from card */
2092   int channel;                  /* channel number */
2093   int radio;                    /* ask for a radio channel */
2094   uint32_t frequency;           /* frequency divided by 62.5KHz or 62.5 Hz */
2095   uint32_t transmission;        /* The transmission standard. */
2096 
2097   /* video parameters */
2098   uint32_t framerate_numerator; /* framerate as numerator/denominator */
2099   uint32_t framerate_denominator;
2100   uint32_t framelines;          /* Total lines per frame including blanking */
2101   uint64_t standard_id;         /* One of the V4L2_STD_* values */
2102   uint32_t colorstandard;       /* One of the V4L2_COLOR_STD_* values */
2103   uint32_t colorsubcarrier;     /* The color subcarrier frequency */
2104   int frame_width;              /* scaled frame width */
2105   int frame_height;             /* scaled frame height */
2106 
2107   /* let some spare space so we can add new fields without breaking
2108    * binary api compatibility.
2109    */
2110   uint32_t spare[20];
2111 
2112   /* used by pvr plugin */
2113   int32_t session_id;           /* -1 stops pvr recording */
2114 
2115 } xine_set_v4l2_data_t;
2116 
2117 /*
2118  * configuration options for plugins that can do a kind of mpeg encoding
2119  * note: highly experimental api :)
2120  */
2121 typedef struct {
2122 
2123   /* mpeg2 parameters */
2124   int bitrate_vbr;              /* 1 = vbr, 0 = cbr */
2125   int bitrate_mean;             /* mean (target) bitrate in kbps*/
2126   int bitrate_peak;             /* peak (max) bitrate in kbps */
2127   int gop_size;                 /* GOP size in frames */
2128   int gop_closure;              /* open/closed GOP */
2129   int b_frames;                 /* number of B frames to use */
2130   int aspect_ratio;             /* XINE_VO_ASPECT_xxx */
2131 
2132   /* let some spare space so we can add new fields without breaking
2133    * binary api compatibility.
2134    */
2135   uint32_t spare[20];
2136 
2137 } xine_set_mpeg_data_t;
2138 
2139 typedef struct {
2140   int                 direction; /* 0 leave, 1 enter */
2141   int32_t             button; /* button number */
2142 } xine_spu_button_t;
2143 
2144 #ifdef XINE_ENABLE_EXPERIMENTAL_FEATURES
2145 
2146 /*
2147  * ask pvr to save (ie. do not discard) the current session
2148  * see comments on input_pvr.c to understand how it works.
2149  */
2150 typedef struct {
2151   /* mode values:
2152    * -1 = do nothing, just set the name
2153    * 0 = truncate current session and save from now on
2154    * 1 = save from last sync point
2155    * 2 = save everything on current session
2156    */
2157   int mode;
2158   int id;
2159   char name[256]; /* name for saving, might be longer */
2160 } xine_pvr_save_data_t;
2161 
2162 typedef struct {
2163   /* mode values:
2164    * 0 = non realtime
2165    * 1 = realtime
2166    */
2167   int mode;
2168 } xine_pvr_realtime_t;
2169 
2170 typedef struct {
2171   /* mode values:
2172    * 0 = playing
2173    * 1 = paused
2174    */
2175   int mode;
2176 } xine_pvr_pause_t;
2177 
2178 #endif
2179 
2180 /* event XINE_EVENT_DROPPED_FRAMES is generated if libxine detects a
2181  * high number of dropped frames (above configured thresholds). it can
2182  * be used by the front end to warn about performance problems.
2183  */
2184 typedef struct {
2185   /* these values are given for 1000 frames delivered */
2186   /* (that is, divide by 10 to get percentages) */
2187   int skipped_frames;
2188   int skipped_threshold;
2189   int discarded_frames;
2190   int discarded_threshold;
2191 } xine_dropped_frames_t;
2192 
2193 
2194 /*
2195  * Defined message types for XINE_EVENT_UI_MESSAGE
2196  * This is the mechanism to report async errors from engine.
2197  *
2198  * If frontend knows about the XINE_MSG_xxx type it may safely
2199  * ignore the 'explanation' field and provide its own custom
2200  * dialogue to the 'parameters'.
2201  *
2202  * right column specifies the usual parameters.
2203  */
2204 
2205 #define XINE_MSG_NO_ERROR		0  /* (messages to UI)   */
2206 #define XINE_MSG_GENERAL_WARNING	1  /* (warning message)  */
2207 #define XINE_MSG_UNKNOWN_HOST		2  /* (host name)        */
2208 #define XINE_MSG_UNKNOWN_DEVICE		3  /* (device name)      */
2209 #define XINE_MSG_NETWORK_UNREACHABLE	4  /* none               */
2210 #define XINE_MSG_CONNECTION_REFUSED	5  /* (host name)        */
2211 #define XINE_MSG_FILE_NOT_FOUND		6  /* (file name or mrl) */
2212 #define XINE_MSG_READ_ERROR		7  /* (device/file/mrl)  */
2213 #define XINE_MSG_LIBRARY_LOAD_ERROR	8  /* (library/decoder)  */
2214 #define XINE_MSG_ENCRYPTED_SOURCE	9  /* none               */
2215 #define XINE_MSG_SECURITY		10 /* (security message) */
2216 #define XINE_MSG_AUDIO_OUT_UNAVAILABLE	11 /* none               */
2217 #define XINE_MSG_PERMISSION_ERROR       12 /* (file name or mrl) */
2218 #define XINE_MSG_FILE_EMPTY             13 /* file is empty      */
2219 #define XINE_MSG_AUTHENTICATION_NEEDED	14 /* (mrl, likely http) */
2220 
2221 /* opaque xine_event_queue_t */
2222 typedef struct xine_event_queue_s xine_event_queue_t;
2223 
2224 /*
2225  * register a new event queue
2226  *
2227  * you have to receive messages from this queue regularly
2228  *
2229  * use xine_event_dispose_queue to unregister and free the queue
2230  */
2231 xine_event_queue_t *xine_event_new_queue (xine_stream_t *stream) XINE_PROTECTED;
2232 void xine_event_dispose_queue (xine_event_queue_t *queue) XINE_PROTECTED;
2233 
2234 /** @brief Filter events by type.
2235  *  @param queue The queue that shall receive a few types only.
2236  *  @param types List of event types, termiated by XINE_EVENT_QUIT. NULL reverts to the "all types" default. */
2237 void xine_event_select (xine_event_queue_t *queue, const int *types) XINE_PROTECTED;
2238 
2239 /*
2240  * receive events (poll)
2241  *
2242  * use xine_event_free on the events received from these calls
2243  * when they're no longer needed
2244  */
2245 /* get first event or NULL when queue is empty. */
2246 xine_event_t *xine_event_get  (xine_event_queue_t *queue) XINE_PROTECTED;
2247 /* free prev_event if not NULL, then same as xine_event_get (). */
2248 xine_event_t *xine_event_next (xine_event_queue_t *queue, xine_event_t *prev_event) XINE_PROTECTED;
2249 /* get first event, wait for it if needed. */
2250 xine_event_t *xine_event_wait (xine_event_queue_t *queue) XINE_PROTECTED;
2251 /* free or reuse event. may be NULL. */
2252 void          xine_event_free (xine_event_t *event) XINE_PROTECTED;
2253 
2254 /*
2255  * receive events (callback)
2256  *
2257  * a thread is created which will receive all events from
2258  * the specified queue, call your callback on each of them
2259  * and will then free the event when your callback returns
2260  *
2261  * Note: only one listener thread / event queue !
2262  *
2263  * @return 0 on error
2264  */
2265 typedef void (*xine_event_listener_cb_t) (void *user_data,
2266 					  const xine_event_t *event);
2267 int xine_event_create_listener_thread (xine_event_queue_t *queue,
2268                                        xine_event_listener_cb_t callback,
2269                                        void *user_data) XINE_PROTECTED;
2270 
2271 /*
2272  * send an event to all queues
2273  *
2274  * the event will be copied so you can free or reuse
2275  * *event as soon as xine_event_send returns.
2276  */
2277 void xine_event_send (xine_stream_t *stream, const xine_event_t *event) XINE_PROTECTED;
2278 
2279 
2280 
2281 /*********************************************************************
2282  * OSD (on screen display)                                           *
2283  *********************************************************************/
2284 
2285 #define XINE_TEXT_PALETTE_SIZE 11
2286 
2287 #define XINE_OSD_TEXT1  (0 * XINE_TEXT_PALETTE_SIZE)
2288 #define XINE_OSD_TEXT2  (1 * XINE_TEXT_PALETTE_SIZE)
2289 #define XINE_OSD_TEXT3  (2 * XINE_TEXT_PALETTE_SIZE)
2290 #define XINE_OSD_TEXT4  (3 * XINE_TEXT_PALETTE_SIZE)
2291 #define XINE_OSD_TEXT5  (4 * XINE_TEXT_PALETTE_SIZE)
2292 #define XINE_OSD_TEXT6  (5 * XINE_TEXT_PALETTE_SIZE)
2293 #define XINE_OSD_TEXT7  (6 * XINE_TEXT_PALETTE_SIZE)
2294 #define XINE_OSD_TEXT8  (7 * XINE_TEXT_PALETTE_SIZE)
2295 #define XINE_OSD_TEXT9  (8 * XINE_TEXT_PALETTE_SIZE)
2296 #define XINE_OSD_TEXT10 (9 * XINE_TEXT_PALETTE_SIZE)
2297 
2298 /* white text, black border, transparent background  */
2299 #define XINE_TEXTPALETTE_WHITE_BLACK_TRANSPARENT    0
2300 /* white text, noborder, transparent background      */
2301 #define XINE_TEXTPALETTE_WHITE_NONE_TRANSPARENT     1
2302 /* white text, no border, translucid background      */
2303 #define XINE_TEXTPALETTE_WHITE_NONE_TRANSLUCID      2
2304 /* yellow text, black border, transparent background */
2305 #define XINE_TEXTPALETTE_YELLOW_BLACK_TRANSPARENT   3
2306 
2307 #define XINE_OSD_CAP_FREETYPE2     0x0001 /* freetype2 support compiled in     */
2308 #define XINE_OSD_CAP_UNSCALED      0x0002 /* unscaled overlays supp. by vo drv */
2309 #define XINE_OSD_CAP_CUSTOM_EXTENT 0x0004 /* hardware scaled to match video output window */
2310 #define XINE_OSD_CAP_ARGB_LAYER    0x0008 /* supports ARGB true color pixmaps */
2311 #define XINE_OSD_CAP_VIDEO_WINDOW  0x0010 /* can scale video to an area within osd extent */
2312 
2313 typedef struct xine_osd_s xine_osd_t;
2314 
2315 xine_osd_t *xine_osd_new           (xine_stream_t *self, int x, int y,
2316 				    int width, int height) XINE_PROTECTED;
2317 uint32_t    xine_osd_get_capabilities (xine_osd_t *self) XINE_PROTECTED;
2318 void        xine_osd_draw_point    (xine_osd_t *self, int x, int y, int color) XINE_PROTECTED;
2319 
2320 void        xine_osd_draw_line     (xine_osd_t *self, int x1, int y1,
2321 				    int x2, int y2, int color) XINE_PROTECTED;
2322 void        xine_osd_draw_rect     (xine_osd_t *self, int x1, int y1,
2323 				    int x2, int y2,
2324 				    int color, int filled ) XINE_PROTECTED;
2325 /* x1 and y1 specifies the upper left corner of the text to be rendered */
2326 void        xine_osd_draw_text     (xine_osd_t *self, int x1, int y1,
2327 				    const char *text, int color_base) XINE_PROTECTED;
2328 void        xine_osd_draw_bitmap   (xine_osd_t *self, uint8_t *bitmap,
2329 				    int x1, int y1, int width, int height,
2330 				    uint8_t *palette_map) XINE_PROTECTED;
2331 /* for freetype2 fonts the height is the maximum height for the whole font and not
2332  * only for the specified text */
2333 void        xine_osd_get_text_size (xine_osd_t *self, const char *text,
2334 				    int *width, int *height) XINE_PROTECTED;
2335 /* with freetype2 support compiled in, you can also specify a font file
2336    as 'fontname' here */
2337 int         xine_osd_set_font      (xine_osd_t *self, const char *fontname,
2338 				    int size) XINE_PROTECTED;
2339 /*
2340  * specifying encoding of texts
2341  *   ""   ... means current locale encoding (default)
2342  *   NULL ... means latin1
2343  */
2344 void        xine_osd_set_encoding(xine_osd_t *self, const char *encoding) XINE_PROTECTED;
2345 /* set position were overlay will be blended */
2346 void        xine_osd_set_position  (xine_osd_t *self, int x, int y) XINE_PROTECTED;
2347 void        xine_osd_show          (xine_osd_t *self, int64_t vpts) XINE_PROTECTED;
2348 void        xine_osd_show_unscaled (xine_osd_t *self, int64_t vpts) XINE_PROTECTED;
2349 void        xine_osd_hide          (xine_osd_t *self, int64_t vpts) XINE_PROTECTED;
2350 /* empty drawing area */
2351 void        xine_osd_clear         (xine_osd_t *self) XINE_PROTECTED;
2352 /*
2353  * set on existing text palette
2354  * (-1 to set used specified palette)
2355  *
2356  * color_base specifies the first color index to use for this text
2357  * palette. The OSD palette is then modified starting at this
2358  * color index, up to the size of the text palette.
2359  *
2360  * Use OSD_TEXT1, OSD_TEXT2, ... for some preassigned color indices.
2361  *
2362  * These palettes are not working well with the true type fonts.
2363  * First thing is that these fonts cannot have a border. So you get
2364  * the best results by loading a linearly blending palette from the
2365  * background (at index 0) to the forground color (at index 10).
2366  */
2367 void        xine_osd_set_text_palette (xine_osd_t *self,
2368 				       int palette_number,
2369 				       int color_base ) XINE_PROTECTED;
2370 /* get palette (color and transparency) */
2371 void        xine_osd_get_palette   (xine_osd_t *self, uint32_t *color,
2372 				    uint8_t *trans) XINE_PROTECTED;
2373 void        xine_osd_set_palette   (xine_osd_t *self,
2374 				    const uint32_t *const color,
2375 				    const uint8_t *const trans ) XINE_PROTECTED;
2376 
2377 /*
2378  * Set an ARGB buffer to be blended into video.
2379  * The buffer must stay valid while the OSD is on screen.
2380  * Pass a NULL pointer to safely remove the buffer from
2381  * the OSD layer. Only the dirty area  will be
2382  * updated on screen. For convenience the whole
2383  * OSD object will be considered dirty when setting
2384  * a different buffer pointer.
2385  * see also XINE_OSD_CAP_ARGB_LAYER
2386  */
2387 void xine_osd_set_argb_buffer(xine_osd_t *self, uint32_t *argb_buffer,
2388                               int dirty_x, int dirty_y, int dirty_width, int dirty_height) XINE_PROTECTED;
2389 
2390 /*
2391  * define extent of reference coordinate system
2392  * for video resolution independent osds.
2393  * see also XINE_OSD_CAP_CUSTOM_EXTENT
2394  */
2395 void xine_osd_set_extent(xine_osd_t *self, int extent_width, int extent_height) XINE_PROTECTED;
2396 
2397 /*
2398  * define area within osd extent to output
2399  * video to while osd is on screen
2400  * see also XINE_OSD_CAP_VIDEO_WINDOW
2401  */
2402 void xine_osd_set_video_window(xine_osd_t *self, int window_x, int window_y, int window_width, int window_height) XINE_PROTECTED;
2403 
2404 /*
2405  * close osd rendering engine
2406  * loaded fonts are unloaded
2407  * osd objects are closed
2408  */
2409 void        xine_osd_free          (xine_osd_t *self) XINE_PROTECTED;
2410 
2411 #ifdef __cplusplus
2412 }
2413 #endif
2414 
2415 #endif
2416