]> git.sesse.net Git - vlc/blob - include/common.h
fea4bf75131410d39492c8b26eb30513c64a4740
[vlc] / include / common.h
1 /*****************************************************************************
2  * common.h: common definitions
3  * Collection of useful common types and macros definitions
4  *****************************************************************************
5  * Copyright (C) 1998, 1999, 2000 VideoLAN
6  * $Id: common.h,v 1.92 2002/04/05 01:05:22 gbazin Exp $
7  *
8  * Authors: Samuel Hocevar <sam@via.ecp.fr>
9  *          Vincent Seguin <seguin@via.ecp.fr>
10  *          Gildas Bazin <gbazin@netcourrier.com>
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 2 of the License, or
15  * (at your option) any later version.
16  * 
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
25  *****************************************************************************/
26
27 /*****************************************************************************
28  * Required system headers
29  *****************************************************************************/
30 #include <string.h>                                            /* strerror() */
31 #include <sys/types.h>
32
33 /*****************************************************************************
34  * Basic types definitions
35  *****************************************************************************/
36
37 typedef unsigned char       u8;
38 typedef signed char         s8;
39
40 typedef unsigned short      u16;
41 typedef signed short        s16;
42
43 typedef unsigned int        u32;
44 typedef signed int          s32;
45
46 #if defined( _MSC_VER ) || ( defined( WIN32 ) && !defined( __MINGW32__ ) )
47 typedef unsigned __int64    u64;
48 typedef signed __int64      s64;
49 #else
50 typedef unsigned long long  u64;
51 typedef signed long long    s64;
52 #endif
53
54 typedef u8                  byte_t;
55
56 /* Boolean type */
57 #ifdef BOOLEAN_T_IN_SYS_TYPES_H
58     /* <sys/types.h> already included */
59 #elif defined(BOOLEAN_T_IN_PTHREAD_H)
60 #   include <pthread.h>
61 #elif defined(BOOLEAN_T_IN_CTHREADS_H)
62 #   include <cthreads.h>
63 #else
64 typedef int                 boolean_t;
65 #endif
66 #ifdef SYS_GNU
67 #   define _MACH_I386_BOOLEAN_H_
68 #endif
69
70 /* ptrdiff_t definition */
71 #ifdef HAVE_STDDEF_H
72 #   include <stddef.h>
73 #else
74 #   include <malloc.h>
75 #   ifndef _PTRDIFF_T
76 #       define _PTRDIFF_T
77 /* Not portable in a 64-bit environment. */
78 typedef int                 ptrdiff_t;
79 #   endif
80 #endif
81
82 #if defined( WIN32 )
83 typedef int                 ssize_t;
84 #endif
85
86 /* Counter for statistics and profiling */
87 typedef unsigned long       count_t;
88
89 /* DCT elements types */
90 typedef s16                 dctelem_t;
91
92 /* Video buffer types */
93 typedef u8                  yuv_data_t;
94
95 /*****************************************************************************
96  * mtime_t: high precision date or time interval
97  *****************************************************************************
98  * Store an high precision date or time interval. The maximum precision is the
99  * micro-second, and a 64 bits integer is used to avoid any overflow (maximum
100  * time interval is then 292271 years, which should be long enough for any
101  * video). Date are stored as a time interval since a common date.
102  * Note that date and time intervals can be manipulated using regular
103  * arithmetic operators, and that no special functions are required.
104  *****************************************************************************/
105 typedef s64 mtime_t;
106
107 /*****************************************************************************
108  * Classes declaration
109  *****************************************************************************/
110
111 /* System */
112 struct main_sys_s;
113
114 typedef struct main_sys_s *             p_main_sys_t;
115
116 /* Plugins */
117 struct plugin_bank_s;
118 struct plugin_info_s;
119
120 typedef struct plugin_bank_s *          p_plugin_bank_t;
121 typedef struct plugin_info_s *          p_plugin_info_t;
122
123 /* Playlist */
124 struct playlist_s;
125 struct playlist_item_s;
126 struct module_s;
127 struct module_config_s;
128
129 typedef struct playlist_s *             p_playlist_t;
130 typedef struct playlist_item_s *        p_playlist_item_t;
131 typedef struct module_s *               p_module_t;
132 typedef struct module_config_s *        p_module_config_t;
133
134 /* Interface */
135 struct intf_thread_s;
136 struct intf_sys_s;
137 struct intf_console_s;
138 struct intf_msg_s;
139 struct intf_channel_s;
140
141 typedef struct intf_thread_s *          p_intf_thread_t;
142 typedef struct intf_sys_s *             p_intf_sys_t;
143 typedef struct intf_console_s *         p_intf_console_t;
144 typedef struct intf_msg_s *             p_intf_msg_t;
145 typedef struct intf_channel_s *         p_intf_channel_t;
146
147 /* Input */
148 struct input_thread_s;
149 struct input_channel_s;
150 struct input_cfg_s;
151 struct input_area_s;
152
153 typedef struct input_thread_s *         p_input_thread_t;
154 typedef struct input_channel_s *        p_input_channel_t;
155 typedef struct input_cfg_s *            p_input_cfg_t;
156 typedef struct input_area_s *           p_input_area_t;
157
158 /* Audio */
159 struct aout_thread_s;
160 struct aout_sys_s;
161
162 typedef struct aout_thread_s *          p_aout_thread_t;
163 typedef struct aout_sys_s *             p_aout_sys_t;
164
165 /* Video */
166 struct vout_thread_s;
167 struct vout_font_s;
168 struct vout_sys_s;
169 struct chroma_sys_s;
170 struct vdec_thread_s;
171 struct vpar_thread_s;
172 struct video_parser_s;
173
174 typedef struct vout_thread_s *          p_vout_thread_t;
175 typedef struct vout_font_s *            p_vout_font_t;
176 typedef struct vout_sys_s *             p_vout_sys_t;
177 typedef struct chroma_sys_s *           p_chroma_sys_t;
178 typedef struct vdec_thread_s *          p_vdec_thread_t;
179 typedef struct vpar_thread_s *          p_vpar_thread_t;
180 typedef struct video_parser_s *         p_video_parser_t;
181
182 /* Decoders */
183 struct decoder_config_s;
184 struct decoder_fifo_s;
185
186 /* Misc */
187 struct macroblock_s;
188 struct data_packet_s;
189 struct imdct_s;
190 struct complex_s;
191 struct dm_par_s;
192 struct picture_s;
193 struct picture_sys_s;
194 struct picture_heap_s;
195 struct es_descriptor_s;
196 struct pgrm_descriptor_s;
197 struct pes_packet_s;
198 struct input_area_s;
199 struct bit_stream_s;
200 struct input_buffers_s;
201 struct network_socket_s;
202 struct intf_subscription_s;
203
204 /*****************************************************************************
205  * Macros and inline functions
206  *****************************************************************************/
207 #ifdef NTOHL_IN_SYS_PARAM_H
208 #   include <sys/param.h>
209
210 #elif defined(WIN32)
211 /* Swap bytes in 16 bit value.  */
212 #   define __bswap_constant_16(x) \
213      ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8))
214
215 #   if defined __GNUC__ && __GNUC__ >= 2
216 #       define __bswap_16(x) \
217             (__extension__                                                    \
218              ({ register unsigned short int __v;                              \
219                 if (__builtin_constant_p (x))                                 \
220                   __v = __bswap_constant_16 (x);                              \
221                 else                                                          \
222                   __asm__ __volatile__ ("rorw $8, %w0"                        \
223                                         : "=r" (__v)                          \
224                                         : "0" ((unsigned short int) (x))      \
225                                         : "cc");                              \
226                 __v; }))
227 #   else
228 /* This is better than nothing.  */
229 #       define __bswap_16(x) __bswap_constant_16 (x)
230 #   endif
231
232 /* Swap bytes in 32 bit value.  */
233 #   define __bswap_constant_32(x) \
234         ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >>  8) |            \
235          (((x) & 0x0000ff00) <<  8) | (((x) & 0x000000ff) << 24))
236
237 #   if defined __GNUC__ && __GNUC__ >= 2
238 /* To swap the bytes in a word the i486 processors and up provide the
239    `bswap' opcode.  On i386 we have to use three instructions.  */
240 #       if !defined __i486__ && !defined __pentium__ && !defined __pentiumpro__
241 #           define __bswap_32(x) \
242                 (__extension__                                                \
243                  ({ register unsigned int __v;                                \
244                     if (__builtin_constant_p (x))                             \
245                       __v = __bswap_constant_32 (x);                          \
246                     else                                                      \
247                       __asm__ __volatile__ ("rorw $8, %w0;"                   \
248                                             "rorl $16, %0;"                   \
249                                             "rorw $8, %w0"                    \
250                                             : "=r" (__v)                      \
251                                             : "0" ((unsigned int) (x))        \
252                                             : "cc");                          \
253                     __v; }))
254 #       else
255 #           define __bswap_32(x) \
256                 (__extension__                                                \
257                  ({ register unsigned int __v;                                \
258                     if (__builtin_constant_p (x))                             \
259                       __v = __bswap_constant_32 (x);                          \
260                     else                                                      \
261                       __asm__ __volatile__ ("bswap %0"                        \
262                                             : "=r" (__v)                      \
263                                             : "0" ((unsigned int) (x)));      \
264                     __v; }))
265 #       endif
266 #   else
267 #       define __bswap_32(x) __bswap_constant_32 (x)
268 #   endif
269
270 #   if defined __GNUC__ && __GNUC__ >= 2
271 /* Swap bytes in 64 bit value.  */
272 #       define __bswap_constant_64(x) \
273             ((((x) & 0xff00000000000000ull) >> 56)                            \
274              | (((x) & 0x00ff000000000000ull) >> 40)                          \
275              | (((x) & 0x0000ff0000000000ull) >> 24)                          \
276              | (((x) & 0x000000ff00000000ull) >> 8)                           \
277              | (((x) & 0x00000000ff000000ull) << 8)                           \
278              | (((x) & 0x0000000000ff0000ull) << 24)                          \
279              | (((x) & 0x000000000000ff00ull) << 40)                          \
280              | (((x) & 0x00000000000000ffull) << 56))
281
282 #       define __bswap_64(x) \
283             (__extension__                                                    \
284              ({ union { __extension__ unsigned long long int __ll;            \
285                         unsigned long int __l[2]; } __w, __r;                 \
286                 if (__builtin_constant_p (x))                                 \
287                   __r.__ll = __bswap_constant_64 (x);                         \
288                 else                                                          \
289                   {                                                           \
290                     __w.__ll = (x);                                           \
291                     __r.__l[0] = __bswap_32 (__w.__l[1]);                     \
292                     __r.__l[1] = __bswap_32 (__w.__l[0]);                     \
293                   }                                                           \
294                 __r.__ll; }))
295 #   else
296 #       define __bswap_64(i) \
297             (u64)((__bswap_32((i) & 0xffffffff) << 32) |                      \
298             __bswap_32(((i) >> 32) & 0xffffffff ))
299 #   endif
300
301 #else /* NTOHL_IN_SYS_PARAM_H || WIN32 */
302 #   include <netinet/in.h>
303
304 #endif /* NTOHL_IN_SYS_PARAM_H || WIN32 */
305
306 /* CEIL: division with round to nearest greater integer */
307 #define CEIL(n, d)  ( ((n) / (d)) + ( ((n) % (d)) ? 1 : 0) )
308
309 /* PAD: PAD(n, d) = CEIL(n ,d) * d */
310 #define PAD(n, d)   ( ((n) % (d)) ? ((((n) / (d)) + 1) * (d)) : (n) )
311
312 /* __MAX and __MIN: self explanatory */
313 #ifndef __MAX
314 #   define __MAX(a, b)   ( ((a) > (b)) ? (a) : (b) )
315 #endif
316 #ifndef __MIN
317 #   define __MIN(a, b)   ( ((a) < (b)) ? (a) : (b) )
318 #endif
319
320 /* MSB (big endian)/LSB (little endian) conversions - network order is always
321  * MSB, and should be used for both network communications and files. Note that
322  * byte orders other than little and big endians are not supported, but only
323  * the VAX seems to have such exotic properties - note that these 'functions'
324  * needs <netinet/in.h> or the local equivalent. */
325 #if !defined( WIN32 )
326 #if WORDS_BIGENDIAN
327 #   define hton16      htons
328 #   define hton32      htonl
329 #   define hton64(i)   ( i )
330 #   define ntoh16      ntohs
331 #   define ntoh32      ntohl
332 #   define ntoh64(i)   ( i )
333 #else
334 #   define hton16      htons
335 #   define hton32      htonl
336     static __inline__ u64 __hton64( u64 i )
337     {
338         return ((u64)(htonl((i) & 0xffffffff)) << 32)
339                 | htonl(((i) >> 32) & 0xffffffff );
340     }
341 #   define hton64(i)   __hton64( i )
342 #   define ntoh16      ntohs
343 #   define ntoh32      ntohl
344 #   define ntoh64      hton64
345 #endif
346 #endif /* !defined( WIN32 ) */
347
348 /* Macros with automatic casts */
349 #define U64_AT(p)   ( ntoh64 ( *( (u64 *)(p) ) ) )
350 #define U32_AT(p)   ( ntoh32 ( *( (u32 *)(p) ) ) )
351 #define U16_AT(p)   ( ntoh16 ( *( (u16 *)(p) ) ) )
352
353 /* Alignment of critical static data structures */
354 #ifdef ATTRIBUTE_ALIGNED_MAX
355 #   define ATTR_ALIGN(align) __attribute__ ((__aligned__ ((ATTRIBUTE_ALIGNED_MAX < align) ? ATTRIBUTE_ALIGNED_MAX : align)))
356 #else
357 #   define ATTR_ALIGN(align)
358 #endif
359
360 /* Alignment of critical dynamic data structure
361  *
362  * Not all platforms support memalign so we provide a vlc_memalign wrapper
363  * void *vlc_memalign( size_t align, size_t size, void **pp_orig )
364  * *pp_orig is the pointer that has to be freed afterwards.
365  */
366 #if 0
367 #ifdef HAVE_POSIX_MEMALIGN
368 #   define vlc_memalign(align,size,pp_orig) \
369     ( !posix_memalign( pp_orig, align, size ) ? *(pp_orig) : NULL )
370 #endif
371 #endif
372 #ifdef HAVE_MEMALIGN
373     /* Some systems have memalign() but no declaration for it */
374     void * memalign( size_t align, size_t size );
375
376 #   define vlc_memalign(align,size,pp_orig) \
377     ( *(pp_orig) = memalign( align, size ) )
378
379 #else /* We don't have any choice but to align manually */
380 #   define vlc_memalign(align,size,pp_orig) \
381     (( *(pp_orig) = malloc( size + align - 1 )) ? \
382         (void *)( (((unsigned long)*(pp_orig)) + 15) & ~0xFUL ) : NULL )
383
384 #endif
385
386
387 #define I64C(x)         x##LL
388
389
390 #if defined( WIN32 )
391 /* The ntoh* and hton* bytes swapping functions are provided by winsock
392  * but for conveniency and speed reasons it is better to implement them
393  * ourselves. ( several plugins use them and it is too much hassle to link
394  * winsock with each of them ;-)
395  */
396 #   ifdef WORDS_BIGENDIAN
397 #       define ntoh32(x)       (x)
398 #       define ntoh16(x)       (x)
399 #       define ntoh64(x)       (x)
400 #       define hton32(x)       (x)
401 #       define hton16(x)       (x)
402 #       define hton64(x)       (x)
403 #   else
404 #       define ntoh32(x)     __bswap_32 (x)
405 #       define ntoh16(x)     __bswap_16 (x)
406 #       define ntoh64(x)     __bswap_32 (x)
407 #       define hton32(x)     __bswap_32 (x)
408 #       define hton16(x)     __bswap_16 (x)
409 #       define hton64(x)     __bswap_64 (x)
410 #   endif
411
412 /* win32, cl and icl support */
413 #   if defined( _MSC_VER ) || !defined( __MINGW32__ )
414 #       define __attribute__(x)
415 #       define __inline__      __inline
416 #       define strncasecmp     strnicmp
417 #       define strcasecmp      stricmp
418 #       define S_IFBLK         0x3000  /* Block */
419 #       define S_ISBLK(m)      (0)
420 #       define S_ISCHR(m)      (0)
421 #       define S_ISFIFO(m)     (((m)&_S_IFMT) == _S_IFIFO)
422 #       define S_ISREG(m)      (((m)&_S_IFMT) == _S_IFREG)
423 #       undef I64C
424 #       define I64C(x)         x##i64
425 #   endif
426
427 /* several type definitions */
428 #   if defined( __MINGW32__ )
429 #       if !defined( _OFF_T_ )
430 typedef long long _off_t;
431 typedef _off_t off_t;
432 #           define _OFF_T_
433 #       else
434 #           define off_t long long
435 #       endif
436 #   endif
437
438 #   if defined( _MSC_VER )
439 #       if !defined( _OFF_T_DEFINED )
440 typedef __int64 off_t;
441 #           define _OFF_T_DEFINED
442 #       else
443 #           define off_t __int64
444 #       endif
445 #   endif
446
447 #   if defined( __BORLANDC__ )
448 #       undef off_t
449 #       define off_t unsigned __int64
450 #   endif
451
452 #   ifndef O_NONBLOCK
453 #       define O_NONBLOCK 0
454 #   endif
455
456 #   ifndef snprintf
457 #       define snprintf _snprintf  /* snprintf not defined in mingw32 (bug?) */
458 #   endif
459
460 #endif
461
462 /*****************************************************************************
463  * CPU capabilities
464  *****************************************************************************/
465 #define CPU_CAPABILITY_NONE    0
466 #define CPU_CAPABILITY_486     (1<<0)
467 #define CPU_CAPABILITY_586     (1<<1)
468 #define CPU_CAPABILITY_PPRO    (1<<2)
469 #define CPU_CAPABILITY_MMX     (1<<3)
470 #define CPU_CAPABILITY_3DNOW   (1<<4)
471 #define CPU_CAPABILITY_MMXEXT  (1<<5)
472 #define CPU_CAPABILITY_SSE     (1<<6)
473 #define CPU_CAPABILITY_ALTIVEC (1<<16)
474 #define CPU_CAPABILITY_FPU     (1<<31)
475
476 /*****************************************************************************
477  * I18n stuff
478  *****************************************************************************/
479 #if defined( ENABLE_NLS ) && defined ( HAVE_GETTEXT )
480 #   include <libintl.h>
481 #else
482 #   define _(String) (String)
483 #   define N_(String) (String)
484 #endif
485
486 /*****************************************************************************
487  * Plug-in stuff
488  *****************************************************************************/
489 typedef struct module_symbols_s
490 {
491     struct main_s* p_main;
492     struct main_sys_s* p_main_sys;
493     struct module_bank_s* p_module_bank;
494     struct input_bank_s* p_input_bank;
495     struct aout_bank_s*  p_aout_bank;
496     struct vout_bank_s*  p_vout_bank;
497
498     int    ( * config_GetIntVariable ) ( const char * );
499     char * ( * config_GetPszVariable ) ( const char * );
500     void   ( * config_PutIntVariable ) ( const char *, int );
501     void   ( * config_PutPszVariable ) ( const char *, char * );
502     int    ( * config_LoadConfigFile ) ( const char * );
503     int    ( * config_SaveConfigFile ) ( const char * );
504     struct module_config_s * ( * config_FindConfig ) ( const char * );
505     struct module_config_s * ( * config_Duplicate ) ( struct module_s * );
506
507     struct intf_subscription_s * ( * intf_MsgSub ) ( void );
508     void ( * intf_MsgUnsub )   ( struct intf_subscription_s * );
509
510     void ( * intf_Msg )        ( char *, ... );
511     void ( * intf_ErrMsg )     ( char *, ... );
512     void ( * intf_StatMsg )    ( char *, ... );
513     void ( * intf_WarnMsg )    ( int, char *, ... );
514
515     int  ( * intf_PlaylistAdd )     ( struct playlist_s *, int, const char* );
516     int  ( * intf_PlaylistDelete )  ( struct playlist_s *, int );
517     void ( * intf_PlaylistNext )    ( struct playlist_s * );
518     void ( * intf_PlaylistPrev )    ( struct playlist_s * );
519     void ( * intf_PlaylistDestroy ) ( struct playlist_s * );
520     void ( * intf_PlaylistJumpto )  ( struct playlist_s *, int );
521     void ( * intf_UrlDecode )       ( char * );
522     int  ( * intf_Eject )           ( const char * );
523
524     void    ( * msleep )            ( mtime_t );
525     mtime_t ( * mdate )             ( void );
526     char  * ( * mstrtime )          ( char *, mtime_t );
527
528     int  ( * network_ChannelCreate )( void );
529     int  ( * network_ChannelJoin )  ( int );
530
531     int  ( * input_SetProgram )     ( struct input_thread_s *,
532                                       struct pgrm_descriptor_s * );
533     void ( * input_SetStatus )      ( struct input_thread_s *, int );
534     void ( * input_Seek )           ( struct input_thread_s *, off_t );
535     void ( * input_DumpStream )     ( struct input_thread_s * );
536     char * ( * input_OffsetToTime ) ( struct input_thread_s *, char *, off_t );
537     int  ( * input_ChangeES )       ( struct input_thread_s *,
538                                       struct es_descriptor_s *, u8 );
539     int  ( * input_ToggleES )       ( struct input_thread_s *,
540                                       struct es_descriptor_s *, boolean_t );
541     int  ( * input_ChangeArea )     ( struct input_thread_s *,
542                                       struct input_area_s * );
543     int  ( * input_ChangeProgram )  ( struct input_thread_s *, u16 );
544     struct es_descriptor_s * ( * input_FindES ) ( struct input_thread_s *,
545                                                   u16 );
546     struct es_descriptor_s * ( * input_AddES ) ( struct input_thread_s *,
547                                       struct pgrm_descriptor_s *, u16, size_t );
548     void ( * input_DelES )          ( struct input_thread_s *,
549                                       struct es_descriptor_s * );
550     int  ( * input_SelectES )       ( struct input_thread_s *,
551                                       struct es_descriptor_s * );
552     int  ( * input_UnselectES )     ( struct input_thread_s *,
553                                       struct es_descriptor_s * );
554     struct pgrm_descriptor_s* ( * input_AddProgram ) ( struct input_thread_s *,
555                                                        u16, size_t );
556     void ( * input_DelProgram )     ( struct input_thread_s *,
557                                       struct pgrm_descriptor_s * );
558     struct input_area_s * ( * input_AddArea ) ( struct input_thread_s * );
559     void ( * input_DelArea )        ( struct input_thread_s *,
560                                       struct input_area_s * );
561
562     void ( * InitBitstream )        ( struct bit_stream_s *,
563                                       struct decoder_fifo_s *,
564                                       void ( * ) ( struct bit_stream_s *,
565                                                    boolean_t ),
566                                       void * );
567     void ( * BitstreamNextDataPacket )( struct bit_stream_s * );
568     boolean_t ( * NextDataPacket )  ( struct decoder_fifo_s *,
569                                       struct data_packet_s ** );
570     void ( * DecoderError )         ( struct decoder_fifo_s * p_fifo );
571     int  ( * input_InitStream )     ( struct input_thread_s *, size_t );
572     void ( * input_EndStream )      ( struct input_thread_s * );
573
574     void ( * input_ParsePES )       ( struct input_thread_s *,
575                                       struct es_descriptor_s * );
576     void ( * input_GatherPES )      ( struct input_thread_s *,
577                                       struct data_packet_s *,
578                                       struct es_descriptor_s *,
579                                       boolean_t, boolean_t );
580     void ( * input_DecodePES )      ( struct decoder_fifo_s *,
581                                       struct pes_packet_s * );
582     struct es_descriptor_s * ( * input_ParsePS ) ( struct input_thread_s *,
583                                                    struct data_packet_s * );
584     ssize_t ( * input_ReadPS )      ( struct input_thread_s *,
585                                       struct data_packet_s ** );
586     void ( * input_DemuxPS )        ( struct input_thread_s *,
587                                       struct data_packet_s * );
588     ssize_t ( * input_ReadTS )      ( struct input_thread_s *,
589                                       struct data_packet_s ** );
590     void ( * input_DemuxTS )        ( struct input_thread_s *,
591                                       struct data_packet_s * );
592     void ( * input_DemuxPSI )       ( struct input_thread_s *,
593                                       struct data_packet_s *,
594                                       struct es_descriptor_s *, 
595                                       boolean_t, boolean_t );
596     int ( * input_ClockManageControl )   ( struct input_thread_s *,
597                                            struct pgrm_descriptor_s *,
598                                            mtime_t );
599     void ( * input_FDSeek )         ( struct input_thread_s *, off_t );
600     void ( * input_FDClose )        ( struct input_thread_s * );
601     ssize_t ( * input_FDRead )          ( struct input_thread_s *, byte_t *,
602                                       size_t );
603     ssize_t ( * input_FDNetworkRead )   ( struct input_thread_s *, byte_t *,
604                                       size_t );
605
606     void * ( * input_BuffersInit )( void );
607     void ( * input_BuffersEnd )( struct input_buffers_s * );
608     struct data_buffer_s * ( * input_NewBuffer )( struct input_buffers_s *, size_t );
609     void ( * input_ReleaseBuffer )( struct input_buffers_s *, struct data_buffer_s * );
610     struct data_packet_s * ( * input_ShareBuffer )( struct input_buffers_s *,
611                                               struct data_buffer_s * );
612     struct data_packet_s * ( * input_NewPacket )( struct input_buffers_s *, size_t );
613     void ( * input_DeletePacket )( struct input_buffers_s *, struct data_packet_s * );
614     struct pes_packet_s * ( * input_NewPES )( struct input_buffers_s * );
615     void ( * input_DeletePES )( struct input_buffers_s *, struct pes_packet_s * );
616     ssize_t ( * input_FillBuffer )( struct input_thread_s * );
617     ssize_t ( * input_Peek )( struct input_thread_s *, byte_t **, size_t );
618     ssize_t ( * input_SplitBuffer )( struct input_thread_s *, struct data_packet_s **, size_t );
619     int ( * input_AccessInit )( struct input_thread_s * );
620     void ( * input_AccessReinit )( struct input_thread_s * );
621     void ( * input_AccessEnd )( struct input_thread_s * );
622
623     struct aout_fifo_s * ( * aout_CreateFifo ) ( int, int, int, int, void * );
624     void ( * aout_DestroyFifo )     ( struct aout_fifo_s * );
625
626     struct vout_thread_s * (* vout_CreateThread) ( int *, int, int, u32, int );
627     void  ( * vout_DestroyThread )  ( struct vout_thread_s *, int * );
628
629     struct picture_s * ( * vout_CreatePicture )
630                                     ( struct vout_thread_s *,
631                                       boolean_t, boolean_t, boolean_t ); 
632     void  ( * vout_AllocatePicture )( struct picture_s *, int, int, u32 );
633     void  ( * vout_DisplayPicture ) ( struct vout_thread_s *, 
634                                       struct picture_s * );
635     void  ( * vout_DestroyPicture ) ( struct vout_thread_s *,
636                                       struct picture_s * );
637     void  ( * vout_LinkPicture )    ( struct vout_thread_s *,
638                                       struct picture_s * );
639     void  ( * vout_UnlinkPicture )  ( struct vout_thread_s *,
640                                       struct picture_s * );
641     void  ( * vout_DatePicture )    ( struct vout_thread_s *, 
642                                       struct picture_s *, mtime_t );
643     void  ( * vout_PlacePicture )   ( struct vout_thread_s *, int, int,
644                                       int *, int *, int *, int * );
645
646     struct subpicture_s * (* vout_CreateSubPicture)
647                                         ( struct vout_thread_s *, int, int );
648     void  ( * vout_DestroySubPicture )  ( struct vout_thread_s *, 
649                                           struct subpicture_s * );
650     void  ( * vout_DisplaySubPicture )  ( struct vout_thread_s *, 
651                                           struct subpicture_s * );
652     
653     u32  ( * UnalignedShowBits )    ( struct bit_stream_s *, unsigned int );
654     void ( * UnalignedRemoveBits )  ( struct bit_stream_s * );
655     u32  ( * UnalignedGetBits )     ( struct bit_stream_s *, unsigned int );
656     void ( * CurrentPTS )           ( struct bit_stream_s *, mtime_t *,
657                                       mtime_t * );
658
659     char * ( * DecodeLanguage ) ( u16 );
660
661     struct module_s * ( * module_Need )   ( int, char *, void * );
662     void              ( * module_Unneed ) ( struct module_s * );
663
664 } module_symbols_t;
665
666 #ifdef PLUGIN
667 extern module_symbols_t* p_symbols;
668 #endif
669