+/* Alignment of critical static data structures */
+#ifdef ATTRIBUTE_ALIGNED_MAX
+# define ATTR_ALIGN(align) __attribute__ ((__aligned__ ((ATTRIBUTE_ALIGNED_MAX < align) ? ATTRIBUTE_ALIGNED_MAX : align)))
+#else
+# define ATTR_ALIGN(align)
+#endif
+
+/* Alignment of critical dynamic data structure */
+#ifdef HAVE_MEMALIGN
+ /* Some systems have memalign() but no declaration for it */
+ void * memalign( size_t align, size_t size );
+#else
+# ifdef HAVE_VALLOC
+ /* That's like using a hammer to kill a fly, but eh... */
+# include <unistd.h>
+# define memalign(align,size) valloc(size)
+# else
+ /* Assume malloc alignment is sufficient */
+# define memalign(align,size) malloc(size)
+# endif
+#endif
+
+#define I64C(x) x##LL
+
+
+#if defined( WIN32 )
+/* The ntoh* and hton* bytes swapping functions are provided by winsock
+ * but for conveniency and speed reasons it is better to implement them
+ * ourselves. ( several plugins use them and it is too much hassle to link
+ * winsock with each of them ;-)
+ */
+# undef ntoh32(x)
+# undef ntoh16(x)
+# undef ntoh64(x)
+# undef hton32(x)
+# undef hton16(x)
+# undef hton64(x)
+
+# ifdef WORDS_BIGENDIAN
+# define ntoh32(x) (x)
+# define ntoh16(x) (x)
+# define ntoh64(x) (x)
+# define hton32(x) (x)
+# define hton16(x) (x)
+# define hton64(x) (x)
+# else
+# define ntoh32(x) __bswap_32 (x)
+# define ntoh16(x) __bswap_16 (x)
+# define ntoh64(x) __bswap_32 (x)
+# define hton32(x) __bswap_32 (x)
+# define hton16(x) __bswap_16 (x)
+# define hton64(x) __bswap_32 (x)
+# endif
+
+/* win32, cl and icl support */
+# if defined( _MSC_VER )
+# define __attribute__(x)
+# define __inline__ __inline
+# define strncasecmp strnicmp
+# define strcasecmp stricmp
+# define S_ISBLK(m) (0)
+# define S_ISCHR(m) (0)
+# define S_ISFIFO(m) (((m)&_S_IFMT) == _S_IFIFO)
+# define S_ISREG(m) (((m)&_S_IFMT) == _S_IFREG)
+# undef I64C(x)
+# define I64C(x) x##i64
+# endif
+
+/* several type definitions */
+# if defined( __MINGW32__ )
+# if !defined( _OFF_T_ )
+typedef long long _off_t;
+typedef _off_t off_t;
+# define _OFF_T_
+# else
+# define off_t long long
+# endif
+# endif
+
+# if defined( _MSC_VER )
+# if !defined( _OFF_T_DEFINED )
+typedef __int64 off_t;
+# define _OFF_T_DEFINED
+# else
+# define off_t __int64
+# endif
+# define stat _stati64
+# endif
+
+# ifndef snprintf
+# define snprintf _snprintf /* snprintf not defined in mingw32 (bug?) */
+# endif
+
+#endif
+
+/*****************************************************************************
+ * CPU capabilities
+ *****************************************************************************/
+#define CPU_CAPABILITY_NONE 0
+#define CPU_CAPABILITY_486 (1<<0)
+#define CPU_CAPABILITY_586 (1<<1)
+#define CPU_CAPABILITY_PPRO (1<<2)
+#define CPU_CAPABILITY_MMX (1<<3)
+#define CPU_CAPABILITY_3DNOW (1<<4)
+#define CPU_CAPABILITY_MMXEXT (1<<5)
+#define CPU_CAPABILITY_SSE (1<<6)
+#define CPU_CAPABILITY_ALTIVEC (1<<16)
+#define CPU_CAPABILITY_FPU (1<<31)
+
+/*****************************************************************************
+ * I18n stuff
+ *****************************************************************************/
+#if defined( ENABLE_NLS ) && defined ( HAVE_GETTEXT )
+# include <libintl.h>
+#else
+# define _(String) (String)
+# define N_(String) (String)
+# define textdomain(Domain)
+# define bindtextdomain(Package, Directory) 1
+#endif
+
+/*****************************************************************************
+ * Plug-in stuff
+ *****************************************************************************/
+typedef struct module_symbols_s
+{
+ struct main_s* p_main;
+ struct input_bank_s* p_input_bank;
+ struct aout_bank_s* p_aout_bank;
+ struct vout_bank_s* p_vout_bank;
+
+ int ( * main_GetIntVariable ) ( char *, int );
+ char * ( * main_GetPszVariable ) ( char *, char * );
+ void ( * main_PutIntVariable ) ( char *, int );
+ void ( * main_PutPszVariable ) ( char *, char * );
+
+ int ( * intf_ProcessKey ) ( struct intf_thread_s *, int );
+ void ( * intf_AssignKey ) ( struct intf_thread_s *, int, int, int );
+
+ void ( * intf_Msg ) ( char *, ... );
+ void ( * intf_ErrMsg ) ( char *, ... );
+ void ( * intf_StatMsg ) ( char *, ... );
+ void ( * intf_WarnMsg ) ( int, char *, ... );
+ void ( * intf_WarnMsgImm ) ( int, char *, ... );
+#ifdef TRACE
+ void ( * intf_DbgMsg ) ( char *, char *, int, char *, ... );
+ void ( * intf_DbgMsgImm ) ( char *, char *, int, char *, ... );
+#endif
+
+ int ( * intf_PlaylistAdd ) ( struct playlist_s *, int, const char* );
+ int ( * intf_PlaylistDelete ) ( struct playlist_s *, int );
+ void ( * intf_PlaylistNext ) ( struct playlist_s * );
+ void ( * intf_PlaylistPrev ) ( struct playlist_s * );
+ void ( * intf_PlaylistDestroy ) ( struct playlist_s * );
+ void ( * intf_PlaylistJumpto ) ( struct playlist_s *, int );
+ void ( * intf_UrlDecode ) ( char * );
+ int ( * intf_Eject ) ( const char * );
+
+ void ( * msleep ) ( mtime_t );
+ mtime_t ( * mdate ) ( void );
+
+ int ( * network_ChannelCreate )( void );
+ int ( * network_ChannelJoin ) ( int );
+
+ int ( * input_SetProgram ) ( struct input_thread_s *,
+ struct pgrm_descriptor_s * );
+ void ( * input_SetStatus ) ( struct input_thread_s *, int );
+ void ( * input_Seek ) ( struct input_thread_s *, off_t );
+ void ( * input_DumpStream ) ( struct input_thread_s * );
+ char * ( * input_OffsetToTime ) ( struct input_thread_s *, char *, off_t );
+ int ( * input_ChangeES ) ( struct input_thread_s *,
+ struct es_descriptor_s *, u8 );
+ int ( * input_ToggleES ) ( struct input_thread_s *,
+ struct es_descriptor_s *, boolean_t );
+ int ( * input_ChangeArea ) ( struct input_thread_s *,
+ struct input_area_s * );
+ struct es_descriptor_s * ( * input_FindES ) ( struct input_thread_s *,
+ u16 );
+ struct es_descriptor_s * ( * input_AddES ) ( struct input_thread_s *,
+ struct pgrm_descriptor_s *, u16, size_t );
+ void ( * input_DelES ) ( struct input_thread_s *,
+ struct es_descriptor_s * );
+ int ( * input_SelectES ) ( struct input_thread_s *,
+ struct es_descriptor_s * );
+ int ( * input_UnselectES ) ( struct input_thread_s *,
+ struct es_descriptor_s * );
+ struct pgrm_descriptor_s* ( * input_AddProgram ) ( struct input_thread_s *,
+ u16, size_t );
+ void ( * input_DelProgram ) ( struct input_thread_s *,
+ struct pgrm_descriptor_s * );
+ struct input_area_s * ( * input_AddArea ) ( struct input_thread_s * );
+ void ( * input_DelArea ) ( struct input_thread_s *,
+ struct input_area_s * );
+
+ void ( * InitBitstream ) ( struct bit_stream_s *,
+ struct decoder_fifo_s *,
+ void ( * ) ( struct bit_stream_s *,
+ boolean_t ),
+ void * );
+ void ( * DecoderError ) ( struct decoder_fifo_s * p_fifo );
+ int ( * input_InitStream ) ( struct input_thread_s *, size_t );
+ void ( * input_EndStream ) ( struct input_thread_s * );
+
+ void ( * input_ParsePES ) ( struct input_thread_s *,
+ struct es_descriptor_s * );
+ void ( * input_GatherPES ) ( struct input_thread_s *,
+ struct data_packet_s *,
+ struct es_descriptor_s *,
+ boolean_t, boolean_t );
+ void ( * input_DecodePES ) ( struct decoder_fifo_s *,
+ struct pes_packet_s * );
+ struct es_descriptor_s * ( * input_ParsePS ) ( struct input_thread_s *,
+ struct data_packet_s * );
+ void ( * input_DemuxPS ) ( struct input_thread_s *,
+ struct data_packet_s * );
+ void ( * input_DemuxTS ) ( struct input_thread_s *,
+ struct data_packet_s * );
+ void ( * input_DemuxPSI ) ( struct input_thread_s *,
+ struct data_packet_s *,
+ struct es_descriptor_s *,
+ boolean_t, boolean_t );
+
+ int ( * input_ClockManageControl ) ( struct input_thread_s *,
+ struct pgrm_descriptor_s *,
+ mtime_t );
+
+ struct aout_fifo_s * ( * aout_CreateFifo )
+ ( int, int, long, long, long, void * );
+ void ( * aout_DestroyFifo ) ( struct aout_fifo_s * );
+
+ struct vout_thread_s * (* vout_CreateThread) ( int *, int, int, u32, int );
+ void ( * vout_DestroyThread ) ( struct vout_thread_s *, int * );
+
+ struct picture_s * ( * vout_CreatePicture )
+ ( struct vout_thread_s *,
+ boolean_t, boolean_t, boolean_t );
+ void ( * vout_AllocatePicture )( struct picture_s *, int, int, u32 );
+ void ( * vout_DisplayPicture ) ( struct vout_thread_s *,
+ struct picture_s * );
+ void ( * vout_DestroyPicture ) ( struct vout_thread_s *,
+ struct picture_s * );
+ void ( * vout_LinkPicture ) ( struct vout_thread_s *,
+ struct picture_s * );
+ void ( * vout_UnlinkPicture ) ( struct vout_thread_s *,
+ struct picture_s * );
+ void ( * vout_DatePicture ) ( struct vout_thread_s *,
+ struct picture_s *, mtime_t );
+ void ( * vout_PlacePicture ) ( struct vout_thread_s *, int, int,
+ int *, int *, int *, int * );
+
+ struct subpicture_s * (* vout_CreateSubPicture)
+ ( struct vout_thread_s *, int, int );
+ void ( * vout_DestroySubPicture ) ( struct vout_thread_s *,
+ struct subpicture_s * );
+ void ( * vout_DisplaySubPicture ) ( struct vout_thread_s *,
+ struct subpicture_s * );
+
+ u32 ( * UnalignedShowBits ) ( struct bit_stream_s *, unsigned int );
+ void ( * UnalignedRemoveBits ) ( struct bit_stream_s * );
+ u32 ( * UnalignedGetBits ) ( struct bit_stream_s *, unsigned int );
+
+ char * ( * DecodeLanguage ) ( u16 );
+
+ struct module_s * ( * module_Need ) ( int, char *, struct probedata_s * );
+ void ( * module_Unneed ) ( struct module_s * );
+
+} module_symbols_t;
+
+#ifdef PLUGIN
+extern module_symbols_t* p_symbols;
+#endif
+