* Collection of useful common types and macros definitions
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: common.h,v 1.72 2002/02/14 23:29:17 sam Exp $
+ * $Id: common.h,v 1.89 2002/03/25 23:36:57 ipkiss Exp $
*
* Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr>
* Required system headers
*****************************************************************************/
#include <string.h> /* strerror() */
+#include <sys/types.h>
/*****************************************************************************
* Basic types definitions
*****************************************************************************/
+typedef unsigned char u8;
+typedef signed char s8;
+
+typedef unsigned short u16;
+typedef signed short s16;
+
+typedef unsigned int u32;
+typedef signed int s32;
+
+#if defined( _MSC_VER ) || ( defined( WIN32 ) && !defined( __MINGW32__ ) )
+typedef unsigned __int64 u64;
+typedef signed __int64 s64;
+#else
+typedef unsigned long long u64;
+typedef signed long long s64;
+#endif
+
typedef u8 byte_t;
/* Boolean type */
#ifdef BOOLEAN_T_IN_SYS_TYPES_H
-# include <sys/types.h>
+ /* <sys/types.h> already included */
#elif defined(BOOLEAN_T_IN_PTHREAD_H)
# include <pthread.h>
#elif defined(BOOLEAN_T_IN_CTHREADS_H)
# endif
#endif
+#if defined( WIN32 )
+typedef int ssize_t;
+#endif
+
/* Counter for statistics and profiling */
typedef unsigned long count_t;
struct playlist_s;
struct playlist_item_s;
struct module_s;
+struct module_config_s;
typedef struct playlist_s * p_playlist_t;
typedef struct playlist_item_s * p_playlist_item_t;
+typedef struct module_s * p_module_t;
+typedef struct module_config_s * p_module_config_t;
/* Interface */
struct intf_thread_s;
struct pes_packet_s;
struct input_area_s;
struct bit_stream_s;
-struct probedata_s;
+struct input_buffers_s;
+struct network_socket_s;
+struct intf_subscription_s;
/*****************************************************************************
* Macros and inline functions
/* PAD: PAD(n, d) = CEIL(n ,d) * d */
#define PAD(n, d) ( ((n) % (d)) ? ((((n) / (d)) + 1) * (d)) : (n) )
-/* MAX and MIN: self explanatory */
-#ifndef MAX
-# define MAX(a, b) ( ((a) > (b)) ? (a) : (b) )
+/* __MAX and __MIN: self explanatory */
+#ifndef __MAX
+# define __MAX(a, b) ( ((a) > (b)) ? (a) : (b) )
#endif
-#ifndef MIN
-# define MIN(a, b) ( ((a) < (b)) ? (a) : (b) )
+#ifndef __MIN
+# define __MIN(a, b) ( ((a) < (b)) ? (a) : (b) )
#endif
/* MSB (big endian)/LSB (little endian) conversions - network order is always
# endif
/* win32, cl and icl support */
-# if defined( _MSC_VER )
+# if defined( _MSC_VER ) || !defined( __MINGW32__ )
# define __attribute__(x)
# define __inline__ __inline
# define strncasecmp strnicmp
# define stat _stati64
# endif
+# if defined( __BORLANDC__ )
+# undef off_t
+# define off_t unsigned __int64
+# endif
+
# ifndef O_NONBLOCK
# define O_NONBLOCK 0
# endif
typedef struct module_symbols_s
{
struct main_s* p_main;
+ struct module_bank_s* p_module_bank;
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 ( * config_GetIntVariable ) ( const char * );
+ char * ( * config_GetPszVariable ) ( const char * );
+ void ( * config_PutIntVariable ) ( const char *, int );
+ void ( * config_PutPszVariable ) ( const char *, char * );
+ int ( * config_LoadConfigFile ) ( const char * );
+ int ( * config_SaveConfigFile ) ( const char * );
+ struct module_config_s * ( * config_FindConfig ) ( const char * );
+ struct module_config_s * ( * config_Duplicate ) ( struct module_s * );
- int ( * intf_ProcessKey ) ( struct intf_thread_s *, int );
- void ( * intf_AssignKey ) ( struct intf_thread_s *, int, int, int );
+ struct intf_subscription_s * ( * intf_MsgSub ) ( void );
+ void ( * intf_MsgUnsub ) ( struct intf_subscription_s * );
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_UrlDecode ) ( char * );
int ( * intf_Eject ) ( const char * );
- void ( * msleep ) ( mtime_t );
- mtime_t ( * mdate ) ( void );
- char * ( * mstrtime ) ( char *, mtime_t );
+ void ( * msleep ) ( mtime_t );
+ mtime_t ( * mdate ) ( void );
+ char * ( * mstrtime ) ( char *, mtime_t );
int ( * network_ChannelCreate )( void );
int ( * network_ChannelJoin ) ( int );
struct es_descriptor_s *, boolean_t );
int ( * input_ChangeArea ) ( struct input_thread_s *,
struct input_area_s * );
+ int ( * input_ChangeProgram ) ( struct input_thread_s *, u16 );
struct es_descriptor_s * ( * input_FindES ) ( struct input_thread_s *,
u16 );
struct es_descriptor_s * ( * input_AddES ) ( struct input_thread_s *,
struct pes_packet_s * );
struct es_descriptor_s * ( * input_ParsePS ) ( struct input_thread_s *,
struct data_packet_s * );
+ ssize_t ( * input_ReadPS ) ( struct input_thread_s *,
+ struct data_packet_s ** );
void ( * input_DemuxPS ) ( struct input_thread_s *,
struct data_packet_s * );
+ ssize_t ( * input_ReadTS ) ( 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 ( * input_FDSeek ) ( struct input_thread_s *, off_t );
+ void ( * input_FDClose ) ( struct input_thread_s * );
+ ssize_t ( * input_FDRead ) ( struct input_thread_s *, byte_t *,
+ size_t );
+ ssize_t ( * input_FDNetworkRead ) ( struct input_thread_s *, byte_t *,
+ size_t );
+
+ void * ( * input_BuffersInit )( void );
+ void ( * input_BuffersEnd )( struct input_buffers_s * );
+ struct data_buffer_s * ( * input_NewBuffer )( struct input_buffers_s *, size_t );
+ void ( * input_ReleaseBuffer )( struct input_buffers_s *, struct data_buffer_s * );
+ struct data_packet_s * ( * input_ShareBuffer )( struct input_buffers_s *,
+ struct data_buffer_s * );
+ struct data_packet_s * ( * input_NewPacket )( struct input_buffers_s *, size_t );
+ void ( * input_DeletePacket )( struct input_buffers_s *, struct data_packet_s * );
+ struct pes_packet_s * ( * input_NewPES )( struct input_buffers_s * );
+ void ( * input_DeletePES )( struct input_buffers_s *, struct pes_packet_s * );
+ ssize_t ( * input_FillBuffer )( struct input_thread_s * );
+ ssize_t ( * input_Peek )( struct input_thread_s *, byte_t **, size_t );
+ ssize_t ( * input_SplitBuffer )( struct input_thread_s *, struct data_packet_s **, size_t );
+ int ( * input_AccessInit )( struct input_thread_s * );
+ void ( * input_AccessReinit )( struct input_thread_s * );
+ void ( * input_AccessEnd )( struct input_thread_s * );
+
+ struct aout_fifo_s * ( * aout_CreateFifo ) ( int, int, int, int, void * );
void ( * aout_DestroyFifo ) ( struct aout_fifo_s * );
struct vout_thread_s * (* vout_CreateThread) ( int *, int, int, u32, int );
char * ( * DecodeLanguage ) ( u16 );
- struct module_s * ( * module_Need ) ( int, char *, struct probedata_s * );
- void ( * module_Unneed ) ( struct module_s * );
+ struct module_s * ( * module_Need ) ( int, char *, void * );
+ void ( * module_Unneed ) ( struct module_s * );
} module_symbols_t;