Commit ac08ae30 authored by Jean-Marc Dressler's avatar Jean-Marc Dressler

D�but du portage BeOS. Beaucoup de fuchiers ont �t� modifi� car il a fallu

r�organiser les headers pour que ce soient les headers les plus proches
du syst�me qui se retrouvent en premier (threads.h devrait toujours �tre
le premier des headers non syst�mes). J'ai du aussi rajouter un type
plugin_id_t et par la m�me occasion inclure plugins.h dans la plupart
des fichiers. Voici en vrac les modifs les plus importantes que j'ai op�r�:

o L�g�re r�organisation pour les raisons �voqu�es ci-dessus (certaines
  macros comme MIN et MAX peuvent �tre d�j� d�finies par le syst�me et
  interf�rer avec celles d�finies dans common.h ou autre)

o Dans intf_msg j'ai du remplacer les vasprintf par des vsprintf
  dans le cas o� ARCH=BEOS.

o la commande hostname du Makefile n'�tait pas compatible et je
  l'ai donc enlev�, en avons-nous besoin ? Auquel cas il suffit de
  rajouter un ifeq.

o J'ai aussi remplac�  les bzero et bcopy par memset et memmove.

o plugin.c, mtime.c et threads.h et quelques fichiers de l'input
  ont �t� adapt�s � BeOS � grand coup de #ifdef SYS_*.

TODO:

o Ecrire intf_beos.cpp, vout_beos.cpp et aout_beos.cpp

Je suis sous linux et je viens de tester le client qui marche tr�s
bien, mais il est n�anmoins possible que j'ai introduit quelques
probl�mes de compilations pour certains modules, si c'est le cas
pr�venez moi.
parent ec9bf58a
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
################################################################################ ################################################################################
# Environment # Environment
CC=egcc CC=gcc
#CC=gcc295 #CC=gcc295
SHELL=/bin/sh SHELL=/bin/sh
INSTALL=install INSTALL=install
...@@ -30,7 +30,7 @@ VIDEO = x11 ...@@ -30,7 +30,7 @@ VIDEO = x11
#VIDEO += ggi #VIDEO += ggi
#VIDEO += glide #VIDEO += glide
# Not yet supported # Not yet supported
#VIDEO += beos #VIDEO = beos
#VIDEO += dga #VIDEO += dga
# Fallback method that should always work # Fallback method that should always work
VIDEO += dummy VIDEO += dummy
...@@ -82,7 +82,9 @@ endif ...@@ -82,7 +82,9 @@ endif
# PROGRAM_BUILD is a complete identification of the build # PROGRAM_BUILD is a complete identification of the build
# ( we can't use fancy options with date since OSes like Solaris # ( we can't use fancy options with date since OSes like Solaris
# or FreeBSD have strange date implementations ) # or FreeBSD have strange date implementations )
PROGRAM_BUILD = `date` $(USER)@`hostname` PROGRAM_BUILD = `date` $(USER)
# XXX: beos does not support hostname
#PROGRAM_BUILD = `date` $(USER)@`hostname`
# DEFINE will contain some of the constants definitions decided in Makefile, # DEFINE will contain some of the constants definitions decided in Makefile,
# including ARCH_xx and SYS_xx. It will be passed to C compiler. # including ARCH_xx and SYS_xx. It will be passed to C compiler.
...@@ -124,6 +126,10 @@ ifeq ($(SYS),LINUX) ...@@ -124,6 +126,10 @@ ifeq ($(SYS),LINUX)
LIB += -lpthread -ldl LIB += -lpthread -ldl
endif endif
ifeq ($SYS),BEOS)
LIB += -llibroot -llibgame -llibbe
endif
LIB += -lm LIB += -lm
# #
......
...@@ -184,7 +184,7 @@ typedef struct aout_thread_s ...@@ -184,7 +184,7 @@ typedef struct aout_thread_s
aout_fifo_t fifo[ AOUT_MAX_FIFOS ]; aout_fifo_t fifo[ AOUT_MAX_FIFOS ];
/* Plugins */ /* Plugins */
void * p_aout_plugin; /* video output plugin */ plugin_id_t aout_plugin; /* video output plugin */
aout_sys_open_t * p_sys_open; aout_sys_open_t * p_sys_open;
aout_sys_reset_t * p_sys_reset; aout_sys_reset_t * p_sys_reset;
aout_sys_setformat_t * p_sys_setformat; aout_sys_setformat_t * p_sys_setformat;
......
...@@ -103,8 +103,12 @@ typedef struct video_parser_s * p_video_parser_t; ...@@ -103,8 +103,12 @@ typedef struct video_parser_s * p_video_parser_t;
#define PAD(n, d) ( ((n) % (d)) ? ((((n) / (d)) + 1) * (d)) : (n) ) #define PAD(n, d) ( ((n) % (d)) ? ((((n) / (d)) + 1) * (d)) : (n) )
/* MAX and MIN: self explanatory */ /* MAX and MIN: self explanatory */
#ifndef MAX
#define MAX(a, b) ( ((a) > (b)) ? (a) : (b) ) #define MAX(a, b) ( ((a) > (b)) ? (a) : (b) )
#endif
#ifndef MIN
#define MIN(a, b) ( ((a) < (b)) ? (a) : (b) ) #define MIN(a, b) ( ((a) < (b)) ? (a) : (b) )
#endif
/* MSB (big endian)/LSB (little endian) convertions - network order is always /* MSB (big endian)/LSB (little endian) convertions - network order is always
* MSB, and should be used for both network communications and files. Note that * MSB, and should be used for both network communications and files. Note that
......
...@@ -373,6 +373,10 @@ ...@@ -373,6 +373,10 @@
* Messages and console interfaces configuration * Messages and console interfaces configuration
*****************************************************************************/ *****************************************************************************/
/* Maximal size of a message to be stored in the mesage queue,
* it is needed when vasprintf is not avalaible */
#define INTF_MAX_MSG_SIZE 512
/* Maximal size of the message queue - in case of overflow, all messages in the /* Maximal size of the message queue - in case of overflow, all messages in the
* queue are printed by the calling thread */ * queue are printed by the calling thread */
#define INTF_MSG_QSIZE 64 #define INTF_MSG_QSIZE 64
......
...@@ -58,7 +58,7 @@ typedef struct intf_thread_s ...@@ -58,7 +58,7 @@ typedef struct intf_thread_s
p_intf_sys_t p_sys; /* system interface */ p_intf_sys_t p_sys; /* system interface */
/* Plugin */ /* Plugin */
void * p_intf_plugin; /* interface plugin */ plugin_id_t intf_plugin; /* interface plugin */
intf_sys_create_t * p_sys_create; /* create interface thread */ intf_sys_create_t * p_sys_create; /* create interface thread */
intf_sys_manage_t * p_sys_manage; /* main loop */ intf_sys_manage_t * p_sys_manage; /* main loop */
intf_sys_destroy_t * p_sys_destroy; /* destroy interface */ intf_sys_destroy_t * p_sys_destroy; /* destroy interface */
......
...@@ -21,7 +21,13 @@ ...@@ -21,7 +21,13 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*****************************************************************************/ *****************************************************************************/
void * RequestPlugin ( char * psz_mask, char * psz_name ); #ifdef SYS_BEOS
void TrashPlugin ( void * p_plugin ); typedef int plugin_id_t;
void * GetPluginFunction ( void *plugin, char *name ); #else
typedef void* plugin_id_t;
#endif
int RequestPlugin ( plugin_id_t * p_plugin, char * psz_mask, char * psz_name );
void TrashPlugin ( plugin_id_t p_plugin );
void * GetPluginFunction ( plugin_id_t plugin, char *name );
...@@ -24,9 +24,17 @@ ...@@ -24,9 +24,17 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*****************************************************************************/ *****************************************************************************/
#ifdef SYS_GNU #ifdef SYS_GNU
#include <cthreads.h> #include <cthreads.h>
#else #endif
#ifdef SYS_BEOS
#include <kernel/OS.h>
#include <kernel/scheduler.h>
#endif
#if defined(SYS_LINUX) || defined(SYS_BSD)
#include <pthread.h> #include <pthread.h>
#endif #endif
...@@ -80,13 +88,38 @@ typedef struct s_condition { ...@@ -80,13 +88,38 @@ typedef struct s_condition {
struct cond_imp *implications; struct cond_imp *implications;
} vlc_cond_t; } vlc_cond_t;
#else /* SYS_GNU */ #endif /* SYS_GNU */
#ifdef SYS_BEOS
typedef thread_id vlc_thread_t;
typedef struct
{
int32 init;
sem_id lock;
thread_id owner;
} vlc_mutex_t;
typedef struct
{
int32 init;
sem_id sem;
sem_id handshakeSem;
sem_id signalSem;
volatile int32 nw;
volatile int32 ns;
} vlc_cond_t;
#endif /* SYS_BEOS */
#if defined(SYS_LINUX) || defined(SYS_BSD)
typedef pthread_t vlc_thread_t; typedef pthread_t vlc_thread_t;
typedef pthread_mutex_t vlc_mutex_t; typedef pthread_mutex_t vlc_mutex_t;
typedef pthread_cond_t vlc_cond_t; typedef pthread_cond_t vlc_cond_t;
#endif /* SYS_GNU */ #endif /* SYS_LINUX || SYS_BSD */
typedef void *(*vlc_thread_func_t)(void *p_data); typedef void *(*vlc_thread_func_t)(void *p_data);
...@@ -122,7 +155,14 @@ static __inline__ int vlc_thread_create( vlc_thread_t *p_thread, ...@@ -122,7 +155,14 @@ static __inline__ int vlc_thread_create( vlc_thread_t *p_thread,
#ifdef SYS_GNU #ifdef SYS_GNU
*p_thread = cthread_fork( (cthread_fn_t)func, (any_t)p_data ); *p_thread = cthread_fork( (cthread_fn_t)func, (any_t)p_data );
return( 0 ); return( 0 );
#else #endif
#ifdef SYS_BEOS
*p_thread = spawn_thread( (thread_func)func, psz_name, B_NORMAL_PRIORITY, p_data );
return resume_thread( *p_thread );
#endif
#if defined(SYS_LINUX) || defined(SYS_BSD)
return pthread_create( p_thread, NULL, func, p_data ); return pthread_create( p_thread, NULL, func, p_data );
#endif #endif
} }
...@@ -135,7 +175,13 @@ static __inline__ void vlc_thread_exit( void ) ...@@ -135,7 +175,13 @@ static __inline__ void vlc_thread_exit( void )
#ifdef SYS_GNU #ifdef SYS_GNU
int result; int result;
cthread_exit( &result ); cthread_exit( &result );
#else #endif
#ifdef SYS_BEOS
exit_thread( 0 );
#endif
#if defined(SYS_LINUX) || defined(SYS_BSD)
pthread_exit( 0 ); pthread_exit( 0 );
#endif #endif
} }
...@@ -147,11 +193,34 @@ static __inline__ void vlc_thread_join( vlc_thread_t thread ) ...@@ -147,11 +193,34 @@ static __inline__ void vlc_thread_join( vlc_thread_t thread )
{ {
#ifdef SYS_GNU #ifdef SYS_GNU
cthread_join( thread ); cthread_join( thread );
#else #endif
#ifdef SYS_BEOS
int32 exit_value;
wait_for_thread( thread, &exit_value );
#endif
#if defined(SYS_LINUX) || defined(SYS_BSD)
pthread_join( thread, NULL ); pthread_join( thread, NULL );
#endif #endif
} }
#ifdef SYS_BEOS
/* lazy_init_mutex */
static __inline__ void lazy_init_mutex(vlc_mutex_t* p_mutex)
{
int32 v = atomic_or( &p_mutex->init, 1 );
if( 2000 == v ) // we're the first, so do the init
{
vlc_mutex_init( p_mutex );
}
else // we're not the first, so wait until the init is finished
{
while( p_mutex->init != 9999 ) snooze( 10000 );
}
}
#endif
/***************************************************************************** /*****************************************************************************
* vlc_mutex_init: initialize a mutex * vlc_mutex_init: initialize a mutex
*****************************************************************************/ *****************************************************************************/
...@@ -160,7 +229,20 @@ static __inline__ int vlc_mutex_init( vlc_mutex_t *p_mutex ) ...@@ -160,7 +229,20 @@ static __inline__ int vlc_mutex_init( vlc_mutex_t *p_mutex )
#ifdef SYS_GNU #ifdef SYS_GNU
mutex_init( p_mutex ); mutex_init( p_mutex );
return( 0 ); return( 0 );
#else #endif
#ifdef SYS_BEOS
// check the arguments and whether it's already been initialized
if( !p_mutex ) return B_BAD_VALUE;
if( p_mutex->init == 9999 ) return EALREADY;
p_mutex->lock = create_sem( 1, "BeMutex" );
p_mutex->owner = -1;
p_mutex->init = 9999;
return B_OK;
#endif
#if defined(SYS_LINUX) || defined(SYS_BSD)
return pthread_mutex_init( p_mutex, NULL ); return pthread_mutex_init( p_mutex, NULL );
#endif #endif
} }
...@@ -173,7 +255,21 @@ static __inline__ int vlc_mutex_lock( vlc_mutex_t *p_mutex ) ...@@ -173,7 +255,21 @@ static __inline__ int vlc_mutex_lock( vlc_mutex_t *p_mutex )
#ifdef SYS_GNU #ifdef SYS_GNU
mutex_lock( p_mutex ); mutex_lock( p_mutex );
return( 0 ); return( 0 );
#else #endif
#ifdef SYS_BEOS
status_t err;
if( !p_mutex ) return B_BAD_VALUE;
if( p_mutex->init < 2000 ) return B_NO_INIT;
lazy_init_mutex( p_mutex );
err = acquire_sem( p_mutex->lock );
if( !err ) p_mutex->owner = find_thread( NULL );
return err;
#endif
#if defined(SYS_LINUX) || defined(SYS_BSD)
return pthread_mutex_lock( p_mutex ); return pthread_mutex_lock( p_mutex );
#endif #endif
} }
...@@ -186,11 +282,40 @@ static __inline__ int vlc_mutex_unlock( vlc_mutex_t *p_mutex ) ...@@ -186,11 +282,40 @@ static __inline__ int vlc_mutex_unlock( vlc_mutex_t *p_mutex )
#ifdef SYS_GNU #ifdef SYS_GNU
mutex_unlock( p_mutex ); mutex_unlock( p_mutex );
return( 0 ); return( 0 );
#else #endif
#ifdef SYS_BEOS
if(! p_mutex) return B_BAD_VALUE;
if( p_mutex->init < 2000 ) return B_NO_INIT;
lazy_init_mutex( p_mutex );
if( p_mutex->owner != find_thread(NULL) ) return ENOLCK;
p_mutex->owner = -1;
release_sem( p_mutex->lock );
return B_OK;
#endif
#if defined(SYS_LINUX) || defined(SYS_BSD)
return pthread_mutex_unlock( p_mutex ); return pthread_mutex_unlock( p_mutex );
#endif #endif
} }
#ifdef SYS_BEOS
/* lazy_init_cond */
static __inline__ void lazy_init_cond( vlc_cond_t* p_condvar )
{
int32 v = atomic_or( &p_condvar->init, 1 );
if( 2000 == v ) // we're the first, so do the init
{
vlc_cond_init( p_condvar );
}
else // we're not the first, so wait until the init is finished
{
while( p_condvar->init != 9999 ) snooze( 10000 );
}
}
#endif
/***************************************************************************** /*****************************************************************************
* vlc_cond_init: initialize a condition * vlc_cond_init: initialize a condition
*****************************************************************************/ *****************************************************************************/
...@@ -204,7 +329,21 @@ static __inline__ int vlc_cond_init( vlc_cond_t *p_condvar ) ...@@ -204,7 +329,21 @@ static __inline__ int vlc_cond_init( vlc_cond_t *p_condvar )
p_condvar->implications = 0; p_condvar->implications = 0;
return( 0 ); return( 0 );
#else #endif
#ifdef SYS_BEOS
if( !p_condvar ) return B_BAD_VALUE;
if( p_condvar->init == 9999 ) return EALREADY;
p_condvar->sem = create_sem( 0, "CVSem" );
p_condvar->handshakeSem = create_sem( 0, "CVHandshake" );
p_condvar->signalSem = create_sem( 1, "CVSignal" );
p_condvar->ns = p_condvar->nw = 0;
p_condvar->init = 9999;
return B_OK;
#endif
#if defined(SYS_LINUX) || defined(SYS_BSD)
return pthread_cond_init( p_condvar, NULL ); return pthread_cond_init( p_condvar, NULL );
#endif #endif
} }
...@@ -221,7 +360,33 @@ static __inline__ int vlc_cond_signal( vlc_cond_t *p_condvar ) ...@@ -221,7 +360,33 @@ static __inline__ int vlc_cond_signal( vlc_cond_t *p_condvar )
cond_signal( (condition_t)p_condvar ); cond_signal( (condition_t)p_condvar );
} }
return( 0 ); return( 0 );
#else #endif
#ifdef SYS_BEOS
status_t err = B_OK;
if( !p_condvar ) return B_BAD_VALUE;
if( p_condvar->init < 2000 ) return B_NO_INIT;
lazy_init_cond( p_condvar );
if( acquire_sem(p_condvar->signalSem) == B_INTERRUPTED) return B_INTERRUPTED;
if( p_condvar->nw > p_condvar->ns )
{
p_condvar->ns += 1;
release_sem( p_condvar->sem );
release_sem( p_condvar->signalSem );
while( acquire_sem(p_condvar->handshakeSem) == B_INTERRUPTED )
{ err = B_INTERRUPTED; }
}
else
{
release_sem( p_condvar->signalSem );
}
return err;
#endif
#if defined(SYS_LINUX) || defined(SYS_BSD)
return pthread_cond_signal( p_condvar ); return pthread_cond_signal( p_condvar );
#endif #endif
} }
...@@ -234,8 +399,39 @@ static __inline__ int vlc_cond_wait( vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex ...@@ -234,8 +399,39 @@ static __inline__ int vlc_cond_wait( vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex
#ifdef SYS_GNU #ifdef SYS_GNU
condition_wait( (condition_t)p_condvar, (mutex_t)p_mutex ); condition_wait( (condition_t)p_condvar, (mutex_t)p_mutex );
return( 0 ); return( 0 );
#else #endif
#ifdef SYS_BEOS
status_t err;
if( !p_condvar ) return B_BAD_VALUE;
if( !p_mutex ) return B_BAD_VALUE;
if( p_condvar->init < 2000 ) return B_NO_INIT;
lazy_init_cond( p_condvar );
if( acquire_sem(p_condvar->signalSem) == B_INTERRUPTED ) return B_INTERRUPTED;
p_condvar->nw += 1;
release_sem( p_condvar->signalSem );
vlc_mutex_unlock( p_mutex );
err = acquire_sem( p_condvar->sem );
while( acquire_sem(p_condvar->signalSem) == B_INTERRUPTED)
{ err = B_INTERRUPTED; }
if( p_condvar->ns > 0 )
{
release_sem( p_condvar->handshakeSem );
p_condvar->ns -= 1;
}
p_condvar->nw -= 1;
release_sem( p_condvar->signalSem );
while( vlc_mutex_lock(p_mutex) == B_INTERRUPTED)
{ err = B_INTERRUPTED; }
return err;
#endif
#if defined(SYS_LINUX) || defined(SYS_BSD)
return pthread_cond_wait( p_condvar, p_mutex ); return pthread_cond_wait( p_condvar, p_mutex );
#endif #endif
} }
...@@ -152,7 +152,7 @@ typedef struct vout_thread_s ...@@ -152,7 +152,7 @@ typedef struct vout_thread_s
u32 i_blue_pixel; /* blue */ u32 i_blue_pixel; /* blue */
/* Plugins */ /* Plugins */
void * p_vout_plugin; /* video output plugin */ plugin_id_t vout_plugin; /* video output plugin */
vout_sys_create_t * p_sys_create; /* allocate output method */ vout_sys_create_t * p_sys_create; /* allocate output method */
vout_sys_init_t * p_sys_init; /* initialize output method */ vout_sys_init_t * p_sys_init; /* initialize output method */
vout_sys_end_t * p_sys_end; /* terminate output method */ vout_sys_end_t * p_sys_end; /* terminate output method */
......
...@@ -40,10 +40,11 @@ ...@@ -40,10 +40,11 @@
#include <sys/types.h> /* on BSD, uio.h needs types.h */ #include <sys/types.h> /* on BSD, uio.h needs types.h */
#include <sys/uio.h> /* "input.h" */ #include <sys/uio.h> /* "input.h" */
#include "threads.h"
#include "common.h" #include "common.h"
#include "config.h" #include "config.h"
#include "mtime.h" #include "mtime.h"
#include "threads.h" #include "plugins.h"
#include "debug.h" /* "input_netlist.h" */ #include "debug.h" /* "input_netlist.h" */
#include "intf_msg.h" /* intf_DbgMsg(), intf_ErrMsg() */ #include "intf_msg.h" /* intf_DbgMsg(), intf_ErrMsg() */
......
...@@ -39,10 +39,11 @@ ...@@ -39,10 +39,11 @@
#include <sys/types.h> /* on BSD, uio.h needs types.h */ #include <sys/types.h> /* on BSD, uio.h needs types.h */
#include <sys/uio.h> /* "input.h" */ #include <sys/uio.h> /* "input.h" */
#include "threads.h"
#include "common.h" #include "common.h"
#include "config.h" #include "config.h"
#include "mtime.h" #include "mtime.h"
#include "threads.h" #include "plugins.h"
#include "debug.h" /* "input_netlist.h" */ #include "debug.h" /* "input_netlist.h" */
#include "intf_msg.h" /* intf_DbgMsg(), intf_ErrMsg() */ #include "intf_msg.h" /* intf_DbgMsg(), intf_ErrMsg() */
......
...@@ -29,10 +29,11 @@ ...@@ -29,10 +29,11 @@
#include <sys/types.h> /* on BSD, uio.h needs types.h */ #include <sys/types.h> /* on BSD, uio.h needs types.h */
#include <sys/uio.h> /* "input.h" */ #include <sys/uio.h> /* "input.h" */
#include "threads.h"
#include "config.h" #include "config.h"
#include "common.h" #include "common.h"
#include "mtime.h" /* mtime_t */ #include "mtime.h" /* mtime_t */
#include "threads.h" #include "plugins.h"
#include "intf_msg.h" /* intf_DbgMsg(), intf_ErrMsg() */ #include "intf_msg.h" /* intf_DbgMsg(), intf_ErrMsg() */
......
...@@ -41,10 +41,10 @@ ...@@ -41,10 +41,10 @@
#include <stdio.h> /* "intf_msg.h" */ #include <stdio.h> /* "intf_msg.h" */
#include <stdlib.h> /* calloc(), malloc(), free() */ #include <stdlib.h> /* calloc(), malloc(), free() */
#include "threads.h"
#include "common.h" #include "common.h"
#include "config.h" #include "config.h"
#include "mtime.h" /* mtime_t, mdate(), msleep() */ #include "mtime.h" /* mtime_t, mdate(), msleep() */
#include "threads.h"
#include "plugins.h" #include "plugins.h"
#include "intf_msg.h" /* intf_DbgMsg(), intf_ErrMsg() */ #include "intf_msg.h" /* intf_DbgMsg(), intf_ErrMsg() */
...@@ -93,9 +93,8 @@ aout_thread_t *aout_CreateThread( int *pi_status ) ...@@ -93,9 +93,8 @@ aout_thread_t *aout_CreateThread( int *pi_status )
/* Request an interface plugin */ /* Request an interface plugin */
psz_method = main_GetPszVariable( AOUT_METHOD_VAR, AOUT_DEFAULT_METHOD ); psz_method = main_GetPszVariable( AOUT_METHOD_VAR, AOUT_DEFAULT_METHOD );
p_aout->p_aout_plugin = RequestPlugin( "aout", psz_method );
if( !p_aout->p_aout_plugin ) if( RequestPlugin( &p_aout->aout_plugin, "aout", psz_method ) )
{ {
intf_ErrMsg( "error: could not open audio plugin aout_%s.so\n", psz_method ); intf_ErrMsg( "error: could not open audio plugin aout_%s.so\n", psz_method );
free( p_aout ); free( p_aout );
...@@ -103,21 +102,21 @@ aout_thread_t *aout_CreateThread( int *pi_status ) ...@@ -103,21 +102,21 @@ aout_thread_t *aout_CreateThread( int *pi_status )
} }
/* Get plugins */ /* Get plugins */
p_aout->p_sys_open = GetPluginFunction( p_aout->p_aout_plugin, "aout_SysOpen" ); p_aout->p_sys_open = GetPluginFunction( p_aout->aout_plugin, "aout_SysOpen" );
p_aout->p_sys_reset = GetPluginFunction( p_aout->p_aout_plugin, "aout_SysReset" ); p_aout->p_sys_reset = GetPluginFunction( p_aout->aout_plugin, "aout_SysReset" );
p_aout->p_sys_setformat = GetPluginFunction( p_aout->p_aout_plugin, "aout_SysSetFormat" ); p_aout->p_sys_setformat = GetPluginFunction( p_aout->aout_plugin, "aout_SysSetFormat" );
p_aout->p_sys_setchannels = GetPluginFunction( p_aout->p_aout_plugin, "aout_SysSetChannels" ); p_aout->p_sys_setchannels = GetPluginFunction( p_aout->aout_plugin, "aout_SysSetChannels" );
p_aout->p_sys_setrate = GetPluginFunction( p_aout->p_aout_plugin, "aout_SysSetRate" ); p_aout->p_sys_setrate = GetPluginFunction( p_aout->aout_plugin, "aout_SysSetRate" );
p_aout->p_sys_getbufinfo = GetPluginFunction( p_aout->p_aout_plugin, "aout_SysGetBufInfo" ); p_aout->p_sys_getbufinfo = GetPluginFunction( p_aout->aout_plugin, "aout_SysGetBufInfo" );
p_aout->p_sys_playsamples = GetPluginFunction( p_aout->p_aout_plugin, "aout_SysPlaySamples" ); p_aout->p_sys_playsamples = GetPluginFunction( p_aout->aout_plugin, "aout_SysPlaySamples" );
p_aout->p_sys_close = GetPluginFunction( p_aout->p_aout_plugin, "aout_SysClose" ); p_aout->p_sys_close = GetPluginFunction( p_aout->aout_plugin, "aout_SysClose" );
/* /*
* Initialize audio device * Initialize audio device
*/ */
if ( p_aout->p_sys_open( p_aout ) ) if ( p_aout->p_sys_open( p_aout ) )
{ {
TrashPlugin( p_aout->p_aout_plugin ); TrashPlugin( p_aout->aout_plugin );
free( p_aout ); free( p_aout );
return( NULL ); return( NULL );
} }
...@@ -128,28 +127,28 @@ aout_thread_t *aout_CreateThread( int *pi_status ) ...@@ -128,28 +127,28 @@ aout_thread_t *aout_CreateThread( int *pi_status )
if ( p_aout->p_sys_reset( p_aout ) ) if ( p_aout->p_sys_reset( p_aout ) )
{ {
p_aout->p_sys_close( p_aout ); p_aout->p_sys_close( p_aout );
TrashPlugin( p_aout->p_aout_plugin ); TrashPlugin( p_aout->aout_plugin );
free( p_aout ); free( p_aout );
return( NULL ); return( NULL );
} }
if ( p_aout->p_sys_setformat( p_aout ) ) if ( p_aout->p_sys_setformat( p_aout ) )
{ {
p_aout->p_sys_close( p_aout ); p_aout->p_sys_close( p_aout );
TrashPlugin( p_aout->p_aout_plugin ); TrashPlugin( p_aout->aout_plugin );
free( p_aout ); free( p_aout );
return( NULL ); return( NULL );
} }
if ( p_aout->p_sys_setchannels( p_aout ) ) if ( p_aout->p_sys_setchannels( p_aout ) )
{ {
p_aout->p_sys_close( p_aout ); p_aout->p_sys_close( p_aout );
TrashPlugin( p_aout->p_aout_plugin ); TrashPlugin( p_aout->aout_plugin );
free( p_aout ); free( p_aout );
return( NULL ); return( NULL );
} }
if ( p_aout->p_sys_setrate( p_aout ) ) if ( p_aout->p_sys_setrate( p_aout ) )
{ {
p_aout->p_sys_close( p_aout ); p_aout->p_sys_close( p_aout );
TrashPlugin( p_aout->p_aout_plugin ); TrashPlugin( p_aout->aout_plugin );
free( p_aout ); free( p_aout );
return( NULL ); return( NULL );
} }
...@@ -160,7 +159,7 @@ aout_thread_t *aout_CreateThread( int *pi_status ) ...@@ -160,7 +159,7 @@ aout_thread_t *aout_CreateThread( int *pi_status )
if( aout_SpawnThread( p_aout ) ) if( aout_SpawnThread( p_aout ) )
{ {
p_aout->p_sys_close( p_aout ); p_aout->p_sys_close( p_aout );
TrashPlugin( p_aout->p_aout_plugin ); TrashPlugin( p_aout->aout_plugin );
free( p_aout ); free( p_aout );
return( NULL ); return( NULL );
} }
...@@ -327,7 +326,7 @@ void aout_DestroyThread( aout_thread_t * p_aout, int *pi_status ) ...@@ -327,7 +326,7 @@ void aout_DestroyThread( aout_thread_t * p_aout, int *pi_status )
intf_DbgMsg("aout debug: audio device (%s) closed\n", p_aout->psz_device); intf_DbgMsg("aout debug: audio device (%s) closed\n", p_aout->psz_device);
/* Close plugin */ /* Close plugin */
TrashPlugin( p_aout->p_aout_plugin ); TrashPlugin( p_aout->aout_plugin );
/* Free structure */ /* Free structure */
free( p_aout ); free( p_aout );
......
...@@ -34,11 +34,12 @@ ...@@ -34,11 +34,12 @@
#include <stdlib.h> /* free() */ #include <stdlib.h> /* free() */
#include <netinet/in.h> /* ntohs() */ #include <netinet/in.h> /* ntohs() */
#include "threads.h"
#include "common.h" #include "common.h"
#include "config.h" #include "config.h"
#include "mtime.h" #include "mtime.h"
#include "threads.h"
#include "intf_msg.h" #include "intf_msg.h"
#include "plugins.h"
#include "debug.h" #include "debug.h"
#include "input.h" #include "input.h"
......
...@@ -31,11 +31,12 @@ ...@@ -31,11 +31,12 @@
#include <netinet/in.h> /* ntohs */ #include <netinet/in.h> /* ntohs */
#include "threads.h"
#include "common.h" #include "common.h"
#include "config.h" #include "config.h"
#include "mtime.h" #include "mtime.h"
#include "threads.h"
#include "intf_msg.h" #include "intf_msg.h"
#include "plugins.h"
#include "debug.h" #include "debug.h"
#include "input.h" #include "input.h"
......
...@@ -27,10 +27,10 @@ ...@@ -27,10 +27,10 @@
#include <sys/types.h> /* on BSD, uio.h needs types.h */ #include <sys/types.h> /* on BSD, uio.h needs types.h */
#include <sys/uio.h> /* "input.h" */ #include <sys/uio.h> /* "input.h" */
#include "threads.h"
#include "common.h" #include "common.h"
#include "config.h" #include "config.h"
#include "mtime.h" #include "mtime.h"
#include "threads.h"
#include "input.h" #include "input.h"
#include "input_file.h" #include "input_file.h"
......
...@@ -32,10 +32,10 @@ ...@@ -32,10 +32,10 @@
#include <string.h> /* strerror() */ #include <string.h> /* strerror() */
#include <errno.h> /* errno */ #include <errno.h> /* errno */
#include "threads.h"
#include "common.h" #include "common.h"
#include "config.h" #include "config.h"
#include "mtime.h" #include "mtime.h"
#include "threads.h"
#include "intf_msg.h" #include "intf_msg.h"
#include "debug.h" #include "debug.h"
#include "input.h" #include "input.h"
......
...@@ -32,17 +32,17 @@ ...@@ -32,17 +32,17 @@
#include <errno.h> /* errno */ #include <errno.h> /* errno */
#include <sys/time.h> /* "input_network.h" */ #include <sys/time.h> /* "input_network.h" */
#ifdef SYS_BSD #if defined(SYS_BSD) || defined(SYS_BEOS)
#include <sys/socket.h> /* struct sockaddr */ #include <sys/socket.h> /* struct sockaddr */
#endif #endif
#include <netdb.h> /* servent, getservbyname(), hostent, gethostbyname() */ #include <netdb.h> /* servent, getservbyname(), hostent, gethostbyname() */
#include <netinet/in.h> /* sockaddr_in, htons(), htonl() */ #include <netinet/in.h> /* sockaddr_in, htons(), htonl() */
#include "threads.h"
#include "common.h" #include "common.h"
#include "config.h" #include "config.h"
#include "mtime.h" #include "mtime.h"
#include "threads.h"
#include "netutils.h" #include "netutils.h"
#include "input.h" #include "input.h"
...@@ -96,6 +96,7 @@ int input_NetworkOpen( input_thread_t *p_input ) ...@@ -96,6 +96,7 @@ int input_NetworkOpen( input_thread_t *p_input )
return( 1 ); return( 1 );
} }
#ifndef SYS_BEOS
/* Increase the receive buffer size to 1/2MB (8Mb/s during 1/2s) to avoid /* Increase the receive buffer size to 1/2MB (8Mb/s during 1/2s) to avoid
* packet loss caused by scheduling problems */ * packet loss caused by scheduling problems */
i_socket_option = 524288; i_socket_option = 524288;
...@@ -109,6 +110,7 @@ int input_NetworkOpen( input_thread_t *p_input ) ...@@ -109,6 +110,7 @@ int input_NetworkOpen( input_thread_t *p_input )
close( p_input->i_handle ); close( p_input->i_handle );
return( 1 ); return( 1 );
} }
#endif /* SYS_BEOS */
/* /*
* Bind the socket * Bind the socket
......
...@@ -30,10 +30,10 @@ ...@@ -30,10 +30,10 @@
#include <stdlib.h> /* atoi(), malloc(), free() */ #include <stdlib.h> /* atoi(), malloc(), free() */
#include <netinet/in.h> /* ntohl() */ #include <netinet/in.h> /* ntohl() */
#include "threads.h"
#include "config.h" #include "config.h"
#include "common.h" #include "common.h"
#include "mtime.h" #include "mtime.h"
#include "threads.h"
#include "debug.h" #include "debug.h"
#include "input.h" #include "input.h"
#include "intf_msg.h" #include "intf_msg.h"
......
...@@ -32,10 +32,10 @@ ...@@ -32,10 +32,10 @@
#include <string.h> /* bzero() */ #include <string.h> /* bzero() */
#include <netinet/in.h> /* ntohs() */ #include <netinet/in.h> /* ntohs() */
#include "threads.h"
#include "common.h" #include "common.h"
#include "config.h" #include "config.h"
#include "mtime.h" #include "mtime.h"
#include "threads.h"
#include "intf_msg.h" #include "intf_msg.h"
#include "debug.h" #include "debug.h"
...@@ -1109,19 +1109,19 @@ static stream_descriptor_t* AddStreamDescr(input_thread_t* p_input, ...@@ -1109,19 +1109,19 @@ static stream_descriptor_t* AddStreamDescr(input_thread_t* p_input,
p_input->p_stream->i_PAT_version = PSI_UNINITIALISED; p_input->p_stream->i_PAT_version = PSI_UNINITIALISED;
p_input->p_stream->i_known_PAT_sections = 0; p_input->p_stream->i_known_PAT_sections = 0;
bzero( p_input->p_stream->a_known_PAT_sections, memset( p_input->p_stream->a_known_PAT_sections, 0,
sizeof(*p_input->p_stream->a_known_PAT_sections) ); sizeof(*p_input->p_stream->a_known_PAT_sections) );
p_input->p_stream->b_is_PAT_complete = 0; p_input->p_stream->b_is_PAT_complete = 0;
p_input->p_stream->i_known_PMT_sections = 0; p_input->p_stream->i_known_PMT_sections = 0;
bzero( p_input->p_stream->a_known_PMT_sections, memset( p_input->p_stream->a_known_PMT_sections, 0,
sizeof(*p_input->p_stream->a_known_PMT_sections) ); sizeof(*p_input->p_stream->a_known_PMT_sections) );
p_input->p_stream->b_is_PMT_complete = 0; p_input->p_stream->b_is_PMT_complete = 0;
#ifdef DVB_EXTENSIONS #ifdef DVB_EXTENSIONS
p_input->p_stream->i_SDT_version = PSI_UNINITIALISED; p_input->p_stream->i_SDT_version = PSI_UNINITIALISED;
p_input->p_stream->i_known_SDT_sections = 0; p_input->p_stream->i_known_SDT_sections = 0;
bzero( p_input->p_stream->a_known_SDT_sections, memset( p_input->p_stream->a_known_SDT_sections, 0,
sizeof(*p_input->p_stream->a_known_SDT_sections) ); sizeof(*p_input->p_stream->a_known_SDT_sections) );
p_input->p_stream->b_is_SDT_complete = 0; p_input->p_stream->b_is_SDT_complete = 0;
#endif #endif
......
...@@ -30,22 +30,24 @@ ...@@ -30,22 +30,24 @@
#include <string.h> /* strerror(), bzero() */ #include <string.h> /* strerror(), bzero() */
#include <stdlib.h> /* free() */ #include <stdlib.h> /* free() */
#ifdef SYS_BSD #if defined(SYS_BSD) || defined(SYS_BEOS)
#include <netinet/in.h> /* struct in_addr */ #include <netinet/in.h> /* struct in_addr */
#include <sys/socket.h> /* struct sockaddr */ #include <sys/socket.h> /* struct sockaddr */
#endif #endif
#if defined(SYS_LINUX) || defined(SYS_BSD) || defined(SYS_GNU)
#include <arpa/inet.h> /* inet_ntoa(), inet_aton() */ #include <arpa/inet.h> /* inet_ntoa(), inet_aton() */
#endif
#ifdef SYS_LINUX #ifdef SYS_LINUX
#include <sys/ioctl.h> /* ioctl() */ #include <sys/ioctl.h> /* ioctl() */
#include <net/if.h> /* interface (arch-dependent) */ #include <net/if.h> /* interface (arch-dependent) */
#endif #endif
#include "threads.h"
#include "config.h" #include "config.h"
#include "common.h" #include "common.h"
#include "mtime.h" #include "mtime.h"
#include "threads.h"
#include "netutils.h" #include "netutils.h"
#include "input_vlan.h" #include "input_vlan.h"
#include "intf_msg.h" #include "intf_msg.h"
...@@ -76,6 +78,10 @@ static int ZeTrucMucheFunction( int Channel ); ...@@ -76,6 +78,10 @@ static int ZeTrucMucheFunction( int Channel );
*****************************************************************************/ *****************************************************************************/
int input_VlanCreate( void ) int input_VlanCreate( void )
{ {
#ifdef SYS_BEOS
intf_ErrMsg( "error: vlans are not supported under beos\n" );
return( 1 );
#else
/* Allocate structure */ /* Allocate structure */
p_main->p_vlan = malloc( sizeof( input_vlan_t ) ); p_main->p_vlan = malloc( sizeof( input_vlan_t ) );
if( p_main->p_vlan == NULL ) if( p_main->p_vlan == NULL )
...@@ -90,6 +96,7 @@ int input_VlanCreate( void ) ...@@ -90,6 +96,7 @@ int input_VlanCreate( void )
intf_Msg("VLANs initialized\n"); intf_Msg("VLANs initialized\n");
return( 0 ); return( 0 );
#endif /* SYS_BEOS */
} }
/***************************************************************************** /*****************************************************************************
...@@ -123,6 +130,9 @@ void input_VlanDestroy( void ) ...@@ -123,6 +130,9 @@ void input_VlanDestroy( void )
*****************************************************************************/ *****************************************************************************/
int input_VlanJoin( int i_vlan_id ) int input_VlanJoin( int i_vlan_id )
{ {
#ifdef SYS_BEOS
return( -1 );
#else
/* If last change is too recent, wait a while */ /* If last change is too recent, wait a while */
if( mdate() - p_main->p_vlan->last_change < INPUT_VLAN_CHANGE_DELAY ) if( mdate() - p_main->p_vlan->last_change < INPUT_VLAN_CHANGE_DELAY )
{ {
...@@ -134,6 +144,7 @@ int input_VlanJoin( int i_vlan_id ) ...@@ -134,6 +144,7 @@ int input_VlanJoin( int i_vlan_id )
intf_Msg("Joining VLAN %d (channel %d)\n", i_vlan_id + 2, i_vlan_id ); intf_Msg("Joining VLAN %d (channel %d)\n", i_vlan_id + 2, i_vlan_id );
return( ZeTrucMucheFunction( i_vlan_id ) ); /* FIXME: join vlan ?? */ return( ZeTrucMucheFunction( i_vlan_id ) ); /* FIXME: join vlan ?? */
#endif /* SYS_BEOS */
} }
/***************************************************************************** /*****************************************************************************
......
...@@ -33,10 +33,10 @@ ...@@ -33,10 +33,10 @@
#include <sys/types.h> /* on BSD, uio.h needs types.h */ #include <sys/types.h> /* on BSD, uio.h needs types.h */
#include <sys/uio.h> /* for input.h */ #include <sys/uio.h> /* for input.h */
#include "threads.h"
#include "config.h" #include "config.h"
#include "common.h" #include "common.h"
#include "mtime.h" #include "mtime.h"
#include "threads.h"
#include "plugins.h" #include "plugins.h"
#include "input.h" #include "input.h"
...@@ -99,9 +99,8 @@ intf_thread_t* intf_Create( void ) ...@@ -99,9 +99,8 @@ intf_thread_t* intf_Create( void )
/* Request an interface plugin */ /* Request an interface plugin */
psz_method = main_GetPszVariable( VOUT_METHOD_VAR, VOUT_DEFAULT_METHOD ); psz_method = main_GetPszVariable( VOUT_METHOD_VAR, VOUT_DEFAULT_METHOD );
p_intf->p_intf_plugin = RequestPlugin( "intf", psz_method );
if( !p_intf->p_intf_plugin ) if( RequestPlugin( &p_intf->intf_plugin, "intf", psz_method ) < 0 )
{ {
intf_ErrMsg( "error: could not open interface plugin intf_%s.so\n", psz_method ); intf_ErrMsg( "error: could not open interface plugin intf_%s.so\n", psz_method );
free( p_intf ); free( p_intf );
...@@ -109,9 +108,9 @@ intf_thread_t* intf_Create( void ) ...@@ -109,9 +108,9 @@ intf_thread_t* intf_Create( void )
} }
/* Get plugins */ /* Get plugins */
p_intf->p_sys_create = GetPluginFunction( p_intf->p_intf_plugin, "intf_SysCreate" ); p_intf->p_sys_create = GetPluginFunction( p_intf->intf_plugin, "intf_SysCreate" );
p_intf->p_sys_manage = GetPluginFunction( p_intf->p_intf_plugin, "intf_SysManage" ); p_intf->p_sys_manage = GetPluginFunction( p_intf->intf_plugin, "intf_SysManage" );
p_intf->p_sys_destroy = GetPluginFunction( p_intf->p_intf_plugin, "intf_SysDestroy" ); p_intf->p_sys_destroy = GetPluginFunction( p_intf->intf_plugin, "intf_SysDestroy" );
/* Initialize structure */ /* Initialize structure */
p_intf->b_die = 0; p_intf->b_die = 0;
...@@ -128,7 +127,7 @@ intf_thread_t* intf_Create( void ) ...@@ -128,7 +127,7 @@ intf_thread_t* intf_Create( void )
if( p_intf->p_console == NULL ) if( p_intf->p_console == NULL )
{ {
intf_ErrMsg("error: can't create control console\n"); intf_ErrMsg("error: can't create control console\n");
TrashPlugin( p_intf->p_intf_plugin ); TrashPlugin( p_intf->intf_plugin );
free( p_intf ); free( p_intf );
return( NULL ); return( NULL );
} }
...@@ -136,7 +135,7 @@ intf_thread_t* intf_Create( void ) ...@@ -136,7 +135,7 @@ intf_thread_t* intf_Create( void )
{ {
intf_ErrMsg("error: can't create interface\n"); intf_ErrMsg("error: can't create interface\n");
intf_ConsoleDestroy( p_intf->p_console ); intf_ConsoleDestroy( p_intf->p_console );
TrashPlugin( p_intf->p_intf_plugin ); TrashPlugin( p_intf->intf_plugin );
free( p_intf ); free( p_intf );
return( NULL ); return( NULL );
} }
...@@ -202,7 +201,7 @@ void intf_Destroy( intf_thread_t *p_intf ) ...@@ -202,7 +201,7 @@ void intf_Destroy( intf_thread_t *p_intf )
UnloadChannels( p_intf ); UnloadChannels( p_intf );
/* Close plugin */ /* Close plugin */
TrashPlugin( p_intf->p_intf_plugin ); TrashPlugin( p_intf->intf_plugin );
/* Free structure */ /* Free structure */
free( p_intf ); free( p_intf );
......
...@@ -32,10 +32,11 @@ ...@@ -32,10 +32,11 @@
#include <stdlib.h> /* strtod(), strtol() */ #include <stdlib.h> /* strtod(), strtol() */
#include <string.h> /* strerror() */ #include <string.h> /* strerror() */
#include "threads.h"
#include "config.h" #include "config.h"
#include "common.h" #include "common.h"
#include "mtime.h" #include "mtime.h"
#include "threads.h" #include "plugins.h"
#include "interface.h" #include "interface.h"
#include "intf_msg.h" #include "intf_msg.h"
......
...@@ -50,11 +50,12 @@ ...@@ -50,11 +50,12 @@
#include <fcntl.h> /* open() */ #include <fcntl.h> /* open() */
/* Common headers */ /* Common headers */
#include "threads.h"
#include "config.h" #include "config.h"
#include "common.h" #include "common.h"
#include "mtime.h" #include "mtime.h"
#include "threads.h"
#include "debug.h" #include "debug.h"
#include "plugins.h"
#include "intf_msg.h" #include "intf_msg.h"
#include "input.h" #include "input.h"
......
...@@ -34,10 +34,11 @@ ...@@ -34,10 +34,11 @@
#include <string.h> /* strerror() */ #include <string.h> /* strerror() */
#include <unistd.h> /* close(), write() */ #include <unistd.h> /* close(), write() */
#include "threads.h"
#include "config.h" #include "config.h"
#include "common.h" #include "common.h"
#include "mtime.h" #include "mtime.h"
#include "threads.h" #include "plugins.h"
#include "intf_msg.h" #include "intf_msg.h"
#include "interface.h" #include "interface.h"
#include "intf_console.h" #include "intf_console.h"
...@@ -345,7 +346,12 @@ static void QueueMsg( intf_msg_t *p_msg, int i_type, char *psz_format, va_list a ...@@ -345,7 +346,12 @@ static void QueueMsg( intf_msg_t *p_msg, int i_type, char *psz_format, va_list a
/* /*
* Convert message to string * Convert message to string
*/ */
#ifdef SYS_BEOS
psz_str = (char*) malloc( INTF_MAX_MSG_SIZE );
vsprintf( psz_str, psz_format, ap );
#else
vasprintf( &psz_str, psz_format, ap ); vasprintf( &psz_str, psz_format, ap );
#endif
if( psz_str == NULL ) if( psz_str == NULL )
{ {
fprintf(stderr, "warning: can't store following message (%s): ", fprintf(stderr, "warning: can't store following message (%s): ",
...@@ -401,7 +407,12 @@ static void QueueDbgMsg(intf_msg_t *p_msg, char *psz_file, char *psz_function, ...@@ -401,7 +407,12 @@ static void QueueDbgMsg(intf_msg_t *p_msg, char *psz_file, char *psz_function,
/* /*
* Convert message to string * Convert message to string
*/ */
#ifdef SYS_BEOS
psz_str = (char*) malloc( INTF_MAX_MSG_SIZE );
vsprintf( psz_str, psz_format, ap );
#else
vasprintf( &psz_str, psz_format, ap ); vasprintf( &psz_str, psz_format, ap );
#endif
if( psz_str == NULL ) if( psz_str == NULL )
{ {
fprintf(stderr, "warning: can't store following message (%s): ", fprintf(stderr, "warning: can't store following message (%s): ",
......
...@@ -26,18 +26,19 @@ ...@@ -26,18 +26,19 @@
/***************************************************************************** /*****************************************************************************
* Preamble * Preamble
*****************************************************************************/ *****************************************************************************/
#include <getopt.h> /* getopt() */
#include <signal.h> /* SIGHUP, SIGINT, SIGKILL */ #include <signal.h> /* SIGHUP, SIGINT, SIGKILL */
#include <getopt.h> /* getopt() */
#include <stdio.h> /* sprintf() */ #include <stdio.h> /* sprintf() */
#include <errno.h> /* ENOMEM */ #include <errno.h> /* ENOMEM */
#include <stdlib.h> /* getenv(), strtol(), */ #include <stdlib.h> /* getenv(), strtol(), */
#include <string.h> /* strerror() */ #include <string.h> /* strerror() */
#include "threads.h"
#include "config.h" #include "config.h"
#include "common.h" #include "common.h"
#include "mtime.h" #include "mtime.h"
#include "threads.h" #include "plugins.h"
#include "input_vlan.h" #include "input_vlan.h"
#include "intf_msg.h" #include "intf_msg.h"
...@@ -574,6 +575,9 @@ static void SignalHandler( int i_signal ) ...@@ -574,6 +575,9 @@ static void SignalHandler( int i_signal )
*****************************************************************************/ *****************************************************************************/
static int TestMMX( void ) static int TestMMX( void )
{ {
/* FIXME: under beos, gcc does not support the foolowing inline assembly */
#ifndef SYS_BEOS
int i_reg, i_dummy = 0; int i_reg, i_dummy = 0;
/* test for a 386 cpu */ /* test for a 386 cpu */
...@@ -635,5 +639,9 @@ static int TestMMX( void ) ...@@ -635,5 +639,9 @@ static int TestMMX( void )
return( 0 ); return( 0 );
return( 1 ); return( 1 );
#else /* SYS_BEOS */
return( 1 );
#endif /* SYS_BEOS */
} }
#endif #endif
...@@ -24,10 +24,10 @@ ...@@ -24,10 +24,10 @@
#include <sys/types.h> /* on BSD, uio.h needs types.h */ #include <sys/types.h> /* on BSD, uio.h needs types.h */
#include <sys/uio.h> /* for input.h */ #include <sys/uio.h> /* for input.h */
#include "threads.h"
#include "config.h" #include "config.h"
#include "common.h" #include "common.h"
#include "mtime.h" #include "mtime.h"
#include "threads.h"
#include "debug.h" /* XXX?? temporaire, requis par netlist.h */ #include "debug.h" /* XXX?? temporaire, requis par netlist.h */
......
...@@ -34,6 +34,10 @@ ...@@ -34,6 +34,10 @@
#include <unistd.h> /* select() */ #include <unistd.h> /* select() */
#include <sys/time.h> #include <sys/time.h>
#ifdef SYS_BEOS
#include <kernel/OS.h>
#endif
#include "common.h" #include "common.h"
#include "mtime.h" #include "mtime.h"
...@@ -63,6 +67,9 @@ char *mstrtime( char *psz_buffer, mtime_t date ) ...@@ -63,6 +67,9 @@ char *mstrtime( char *psz_buffer, mtime_t date )
*****************************************************************************/ *****************************************************************************/
mtime_t mdate( void ) mtime_t mdate( void )
{ {
#ifdef SYS_BEOS
return( real_time_clock_usecs() );
#else
struct timeval tv_date; struct timeval tv_date;
/* gettimeofday() could return an error, and should be tested. However, the /* gettimeofday() could return an error, and should be tested. However, the
...@@ -70,6 +77,7 @@ mtime_t mdate( void ) ...@@ -70,6 +77,7 @@ mtime_t mdate( void )
* here, since tv is a local variable. */ * here, since tv is a local variable. */
gettimeofday( &tv_date, NULL ); gettimeofday( &tv_date, NULL );
return( (mtime_t) tv_date.tv_sec * 1000000 + (mtime_t) tv_date.tv_usec ); return( (mtime_t) tv_date.tv_sec * 1000000 + (mtime_t) tv_date.tv_usec );
#endif
} }
/***************************************************************************** /*****************************************************************************
...@@ -81,6 +89,17 @@ mtime_t mdate( void ) ...@@ -81,6 +89,17 @@ mtime_t mdate( void )
*****************************************************************************/ *****************************************************************************/
void mwait( mtime_t date ) void mwait( mtime_t date )
{ {
#ifdef SYS_BEOS
mtime_t delay;
delay = date - real_time_clock_usecs();
if( delay <= 0 )
{
return;
}
snooze( delay );
#else /* SYS_BEOS */
struct timeval tv_date, tv_delay; struct timeval tv_date, tv_delay;
mtime_t delay; /* delay in msec, signed to detect errors */ mtime_t delay; /* delay in msec, signed to detect errors */
...@@ -102,6 +121,8 @@ void mwait( mtime_t date ) ...@@ -102,6 +121,8 @@ void mwait( mtime_t date )
#else #else
usleep( delay ); usleep( delay );
#endif #endif
#endif /* SYS_BEOS */
} }
/***************************************************************************** /*****************************************************************************
...@@ -111,6 +132,10 @@ void mwait( mtime_t date ) ...@@ -111,6 +132,10 @@ void mwait( mtime_t date )
*****************************************************************************/ *****************************************************************************/
void msleep( mtime_t delay ) void msleep( mtime_t delay )
{ {
#ifdef SYS_BEOS
snooze( delay );
#else /* SYS_BEOS */
#ifndef usleep #ifndef usleep
struct timeval tv_delay; struct timeval tv_delay;
...@@ -124,4 +149,6 @@ void msleep( mtime_t delay ) ...@@ -124,4 +149,6 @@ void msleep( mtime_t delay )
#else #else
usleep( delay ); usleep( delay );
#endif #endif
#endif /* SYS_BEOS */
} }
...@@ -34,7 +34,10 @@ ...@@ -34,7 +34,10 @@
#include <sys/socket.h> /* struct sockaddr */ #include <sys/socket.h> /* struct sockaddr */
#endif #endif
#include <arpa/inet.h> /* htons(), htonl() */ #if defined(SYS_LINUX) || defined(SYS_BSD) || defined(SYS_GNU)
#include <arpa/inet.h> /* inet_ntoa(), inet_aton() */
#endif
#ifdef SYS_LINUX #ifdef SYS_LINUX
#include <sys/ioctl.h> /* ioctl() */ #include <sys/ioctl.h> /* ioctl() */
...@@ -62,7 +65,7 @@ int BuildInetAddr( struct sockaddr_in *p_sa_in, char *psz_in_addr, int i_port ) ...@@ -62,7 +65,7 @@ int BuildInetAddr( struct sockaddr_in *p_sa_in, char *psz_in_addr, int i_port )
{ {
struct hostent *p_hostent; /* host descriptor */ struct hostent *p_hostent; /* host descriptor */
bzero( p_sa_in, sizeof( struct sockaddr_in ) ); memset( p_sa_in, 0, sizeof( struct sockaddr_in ) );
p_sa_in->sin_family = AF_INET; /* family */ p_sa_in->sin_family = AF_INET; /* family */
p_sa_in->sin_port = htons( i_port ); /* port */ p_sa_in->sin_port = htons( i_port ); /* port */
...@@ -73,7 +76,11 @@ int BuildInetAddr( struct sockaddr_in *p_sa_in, char *psz_in_addr, int i_port ) ...@@ -73,7 +76,11 @@ int BuildInetAddr( struct sockaddr_in *p_sa_in, char *psz_in_addr, int i_port )
} }
/* Try to convert address directly from in_addr - this will work if /* Try to convert address directly from in_addr - this will work if
* psz_in_addr is dotted decimal. */ * psz_in_addr is dotted decimal. */
#ifdef SYS_BEOS
else if( (p_sa_in->sin_addr.s_addr = inet_addr( psz_in_addr )) == -1 )
#else
else if( !inet_aton( psz_in_addr, &p_sa_in->sin_addr) ) else if( !inet_aton( psz_in_addr, &p_sa_in->sin_addr) )
#endif
{ {
/* The convertion failed: the address is an host name, which needs /* The convertion failed: the address is an host name, which needs
* to be resolved */ * to be resolved */
...@@ -85,7 +92,7 @@ int BuildInetAddr( struct sockaddr_in *p_sa_in, char *psz_in_addr, int i_port ) ...@@ -85,7 +92,7 @@ int BuildInetAddr( struct sockaddr_in *p_sa_in, char *psz_in_addr, int i_port )
} }
/* Copy the first address of the host in the socket address */ /* Copy the first address of the host in the socket address */
bcopy( p_hostent->h_addr_list[0], &p_sa_in->sin_addr, p_hostent->h_length); memmove( &p_sa_in->sin_addr, p_hostent->h_addr_list[0], p_hostent->h_length );
} }
return( 0 ); return( 0 );
} }
......
...@@ -23,14 +23,22 @@ ...@@ -23,14 +23,22 @@
#include <stdlib.h> /* free(), strtol() */ #include <stdlib.h> /* free(), strtol() */
#include <stdio.h> /* sprintf() */ #include <stdio.h> /* sprintf() */
#if defined(SYS_LINUX) || defined(SYS_BSD) || defined(SYS_GNU)
#include <dlfcn.h> /* dlopen(), dlsym(), dlclose() */ #include <dlfcn.h> /* dlopen(), dlsym(), dlclose() */
#endif
#ifdef SYS_BEOS
#include <image.h>
#endif
#include "plugins.h"
#define PLUGIN_PATH_COUNT 5 #define PLUGIN_PATH_COUNT 5
void * RequestPlugin ( char * psz_mask, char * psz_name ) int RequestPlugin ( plugin_id_t * p_plugin, char * psz_mask, char * psz_name )
{ {
int i_count, i_length; int i_count, i_length;
void * fd;
char * psz_plugin; char * psz_plugin;
char * psz_plugin_path[ PLUGIN_PATH_COUNT ] = char * psz_plugin_path[ PLUGIN_PATH_COUNT ] =
{ {
...@@ -48,23 +56,45 @@ void * RequestPlugin ( char * psz_mask, char * psz_name ) ...@@ -48,23 +56,45 @@ void * RequestPlugin ( char * psz_mask, char * psz_name )
{ {
psz_plugin = malloc( strlen(psz_plugin_path[i_count]) + i_length + 6 ); psz_plugin = malloc( strlen(psz_plugin_path[i_count]) + i_length + 6 );
sprintf( psz_plugin, "%s/%s_%s.so", psz_plugin_path[i_count], psz_mask, psz_name ); sprintf( psz_plugin, "%s/%s_%s.so", psz_plugin_path[i_count], psz_mask, psz_name );
fd = dlopen( psz_plugin, RTLD_NOW | RTLD_GLOBAL ); #ifdef SYS_BEOS
*p_plugin = load_addon_image( psz_plugin );
#else /* SYS_BEOS */
*p_plugin = dlopen( psz_plugin, RTLD_NOW | RTLD_GLOBAL );
#endif /* SYS_BEOS */
free( psz_plugin ); free( psz_plugin );
if( fd != NULL ) #ifdef SYS_BEOS
return( fd ); if( *p_plugin >= 0 )
return( 0 );
#else
if( *p_plugin != NULL )
return( 0 );
#endif
} }
return( 0 ); return( -1 );
} }
void TrashPlugin ( void * p_plugin ) void TrashPlugin ( plugin_id_t plugin )
{ {
dlclose( p_plugin ); #ifdef SYS_BEOS
unload_add_on( plugin );
#else
dlclose( plugin );
#endif
} }
void *GetPluginFunction ( void *p_plugin, char *psz_name ) void * GetPluginFunction ( plugin_id_t plugin, char *psz_name )
{ {
return( dlsym(p_plugin, psz_name) ); #ifdef SYS_BEOS
void * p_func;
if( get_image_symbol( plugin, psz_name, B_SYMBOL_TYPE_TEXT, &p_func ) )
return( NULL );
else
return( p_func );
#else
return( dlsym(plugin, psz_name) );
#endif
} }
...@@ -32,10 +32,10 @@ ...@@ -32,10 +32,10 @@
#include <sys/uio.h> /* for input.h */ #include <sys/uio.h> /* for input.h */
#include <unistd.h> /* getpid() */ #include <unistd.h> /* getpid() */
#include "threads.h"
#include "config.h" #include "config.h"
#include "common.h" #include "common.h"
#include "mtime.h" #include "mtime.h"
#include "threads.h"
#include "intf_msg.h" #include "intf_msg.h"
#include "debug.h" /* ASSERT */ #include "debug.h" /* ASSERT */
......
...@@ -27,10 +27,11 @@ ...@@ -27,10 +27,11 @@
#include <sys/types.h> /* on BSD, uio.h needs types.h */ #include <sys/types.h> /* on BSD, uio.h needs types.h */
#include <sys/uio.h> /* for input.h */ #include <sys/uio.h> /* for input.h */
#include "threads.h"
#include "config.h" #include "config.h"
#include "common.h" #include "common.h"
#include "mtime.h" #include "mtime.h"
#include "threads.h" #include "plugins.h"
#include "intf_msg.h" #include "intf_msg.h"
......
...@@ -27,10 +27,11 @@ ...@@ -27,10 +27,11 @@
#include <sys/types.h> /* on BSD, uio.h needs types.h */ #include <sys/types.h> /* on BSD, uio.h needs types.h */
#include <sys/uio.h> /* for input.h */ #include <sys/uio.h> /* for input.h */
#include "threads.h"
#include "config.h" #include "config.h"
#include "common.h" #include "common.h"
#include "mtime.h" #include "mtime.h"
#include "threads.h" #include "plugins.h"
#include "intf_msg.h" #include "intf_msg.h"
......
...@@ -27,10 +27,11 @@ ...@@ -27,10 +27,11 @@
#include <sys/types.h> /* on BSD, uio.h needs types.h */ #include <sys/types.h> /* on BSD, uio.h needs types.h */
#include <sys/uio.h> /* for input.h */ #include <sys/uio.h> /* for input.h */
#include "threads.h"
#include "config.h" #include "config.h"
#include "common.h" #include "common.h"
#include "mtime.h" #include "mtime.h"
#include "threads.h" #include "plugins.h"
#include "intf_msg.h" #include "intf_msg.h"
......
...@@ -31,10 +31,11 @@ ...@@ -31,10 +31,11 @@
#include <sys/types.h> /* on BSD, uio.h needs types.h */ #include <sys/types.h> /* on BSD, uio.h needs types.h */
#include <sys/uio.h> /* for input.h */ #include <sys/uio.h> /* for input.h */
#include "threads.h"
#include "config.h" #include "config.h"
#include "common.h" #include "common.h"
#include "mtime.h" #include "mtime.h"
#include "threads.h" #include "plugins.h"
#include "intf_msg.h" #include "intf_msg.h"
......
...@@ -32,10 +32,10 @@ ...@@ -32,10 +32,10 @@
#include <stdio.h> /* sprintf() */ #include <stdio.h> /* sprintf() */
#include <string.h> /* strerror() */ #include <string.h> /* strerror() */
#include "threads.h"
#include "common.h" #include "common.h"
#include "config.h" #include "config.h"
#include "mtime.h" #include "mtime.h"
#include "threads.h"
#include "plugins.h" #include "plugins.h"
#include "video.h" #include "video.h"
#include "video_output.h" #include "video_output.h"
...@@ -103,9 +103,8 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window, ...@@ -103,9 +103,8 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window,
/* Request an interface plugin */ /* Request an interface plugin */
psz_method = main_GetPszVariable( VOUT_METHOD_VAR, VOUT_DEFAULT_METHOD ); psz_method = main_GetPszVariable( VOUT_METHOD_VAR, VOUT_DEFAULT_METHOD );
p_vout->p_vout_plugin = RequestPlugin( "vout", psz_method );
if( !p_vout->p_vout_plugin ) if( RequestPlugin( &p_vout->vout_plugin, "vout", psz_method ) < 0 )
{ {
intf_ErrMsg( "error: could not open video plugin vout_%s.so\n", psz_method ); intf_ErrMsg( "error: could not open video plugin vout_%s.so\n", psz_method );
free( p_vout ); free( p_vout );
...@@ -113,12 +112,12 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window, ...@@ -113,12 +112,12 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window,
} }
/* Get plugins */ /* Get plugins */
p_vout->p_sys_create = GetPluginFunction( p_vout->p_vout_plugin, "vout_SysCreate" ); p_vout->p_sys_create = GetPluginFunction( p_vout->vout_plugin, "vout_SysCreate" );
p_vout->p_sys_init = GetPluginFunction( p_vout->p_vout_plugin, "vout_SysInit" ); p_vout->p_sys_init = GetPluginFunction( p_vout->vout_plugin, "vout_SysInit" );
p_vout->p_sys_end = GetPluginFunction( p_vout->p_vout_plugin, "vout_SysEnd" ); p_vout->p_sys_end = GetPluginFunction( p_vout->vout_plugin, "vout_SysEnd" );
p_vout->p_sys_destroy = GetPluginFunction( p_vout->p_vout_plugin, "vout_SysDestroy" ); p_vout->p_sys_destroy = GetPluginFunction( p_vout->vout_plugin, "vout_SysDestroy" );
p_vout->p_sys_manage = GetPluginFunction( p_vout->p_vout_plugin, "vout_SysManage" ); p_vout->p_sys_manage = GetPluginFunction( p_vout->vout_plugin, "vout_SysManage" );
p_vout->p_sys_display = GetPluginFunction( p_vout->p_vout_plugin, "vout_SysDisplay" ); p_vout->p_sys_display = GetPluginFunction( p_vout->vout_plugin, "vout_SysDisplay" );
/* Initialize thread properties - thread id and locks will be initialized /* Initialize thread properties - thread id and locks will be initialized
* later */ * later */
...@@ -181,7 +180,7 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window, ...@@ -181,7 +180,7 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window,
* own error messages */ * own error messages */
if( p_vout->p_sys_create( p_vout, psz_display, i_root_window ) ) if( p_vout->p_sys_create( p_vout, psz_display, i_root_window ) )
{ {
TrashPlugin( p_vout->p_vout_plugin ); TrashPlugin( p_vout->vout_plugin );
free( p_vout ); free( p_vout );
return( NULL ); return( NULL );
} }
...@@ -207,7 +206,7 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window, ...@@ -207,7 +206,7 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window,
if( p_vout->p_default_font == NULL ) if( p_vout->p_default_font == NULL )
{ {
p_vout->p_sys_destroy( p_vout ); p_vout->p_sys_destroy( p_vout );
TrashPlugin( p_vout->p_vout_plugin ); TrashPlugin( p_vout->vout_plugin );
free( p_vout ); free( p_vout );
return( NULL ); return( NULL );
} }
...@@ -216,7 +215,7 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window, ...@@ -216,7 +215,7 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window,
{ {
vout_UnloadFont( p_vout->p_default_font ); vout_UnloadFont( p_vout->p_default_font );
p_vout->p_sys_destroy( p_vout ); p_vout->p_sys_destroy( p_vout );
TrashPlugin( p_vout->p_vout_plugin ); TrashPlugin( p_vout->vout_plugin );
free( p_vout ); free( p_vout );
return( NULL ); return( NULL );
} }
...@@ -232,7 +231,7 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window, ...@@ -232,7 +231,7 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window,
vout_UnloadFont( p_vout->p_default_font ); vout_UnloadFont( p_vout->p_default_font );
vout_UnloadFont( p_vout->p_large_font ); vout_UnloadFont( p_vout->p_large_font );
p_vout->p_sys_destroy( p_vout ); p_vout->p_sys_destroy( p_vout );
TrashPlugin( p_vout->p_vout_plugin ); TrashPlugin( p_vout->vout_plugin );
free( p_vout ); free( p_vout );
return( NULL ); return( NULL );
} }
...@@ -1254,7 +1253,7 @@ static void DestroyThread( vout_thread_t *p_vout, int i_status ) ...@@ -1254,7 +1253,7 @@ static void DestroyThread( vout_thread_t *p_vout, int i_status )
p_vout->p_sys_destroy( p_vout ); p_vout->p_sys_destroy( p_vout );
/* Close plugin */ /* Close plugin */
TrashPlugin( p_vout->p_vout_plugin ); TrashPlugin( p_vout->vout_plugin );
/* Free structure */ /* Free structure */
free( p_vout ); free( p_vout );
......
...@@ -32,10 +32,11 @@ ...@@ -32,10 +32,11 @@
#include <stdlib.h> /* free() */ #include <stdlib.h> /* free() */
#include <string.h> /* strerror() */ #include <string.h> /* strerror() */
#include "threads.h"
#include "common.h" #include "common.h"
#include "config.h" #include "config.h"
#include "mtime.h" #include "mtime.h"
#include "threads.h" #include "plugins.h"
#include "video.h" #include "video.h"
#include "video_output.h" #include "video_output.h"
#include "video_yuv.h" #include "video_yuv.h"
......
...@@ -27,10 +27,11 @@ ...@@ -27,10 +27,11 @@
#include <sys/types.h> /* on BSD, uio.h needs types.h */ #include <sys/types.h> /* on BSD, uio.h needs types.h */
#include <sys/uio.h> /* "input.h */ #include <sys/uio.h> /* "input.h */
#include "threads.h"
#include "config.h" #include "config.h"
#include "common.h" #include "common.h"
#include "mtime.h" #include "mtime.h"
#include "threads.h" #include "plugins.h"
#include "intf_msg.h" #include "intf_msg.h"
#include "debug.h" /* XXX?? temporaire, requis par netlist.h */ #include "debug.h" /* XXX?? temporaire, requis par netlist.h */
......
...@@ -31,10 +31,11 @@ ...@@ -31,10 +31,11 @@
#include <sys/types.h> /* on BSD, uio.h needs types.h */ #include <sys/types.h> /* on BSD, uio.h needs types.h */
#include <sys/uio.h> /* "input.h" */ #include <sys/uio.h> /* "input.h" */
#include "threads.h"
#include "config.h" #include "config.h"
#include "common.h" #include "common.h"
#include "mtime.h" #include "mtime.h"
#include "threads.h" #include "plugins.h"
#include "intf_msg.h" #include "intf_msg.h"
#include "debug.h" /* XXX?? temporaire, requis par netlist.h */ #include "debug.h" /* XXX?? temporaire, requis par netlist.h */
......
...@@ -27,10 +27,11 @@ ...@@ -27,10 +27,11 @@
#include <sys/types.h> /* on BSD, uio.h needs types.h */ #include <sys/types.h> /* on BSD, uio.h needs types.h */
#include <sys/uio.h> /* "input.h" */ #include <sys/uio.h> /* "input.h" */
#include "threads.h"
#include "config.h" #include "config.h"
#include "common.h" #include "common.h"
#include "mtime.h" #include "mtime.h"
#include "threads.h" #include "plugins.h"
#include "intf_msg.h" #include "intf_msg.h"
#include "debug.h" /* XXX?? temporaire, requis par netlist.h */ #include "debug.h" /* XXX?? temporaire, requis par netlist.h */
......
...@@ -28,10 +28,11 @@ ...@@ -28,10 +28,11 @@
#include <sys/types.h> /* on BSD, uio.h needs types.h */ #include <sys/types.h> /* on BSD, uio.h needs types.h */
#include <sys/uio.h> /* "input.h" */ #include <sys/uio.h> /* "input.h" */
#include "threads.h"
#include "config.h" #include "config.h"
#include "common.h" #include "common.h"
#include "mtime.h" #include "mtime.h"
#include "threads.h" #include "plugins.h"
#include "intf_msg.h" #include "intf_msg.h"
......
...@@ -28,10 +28,11 @@ ...@@ -28,10 +28,11 @@
#include <sys/types.h> /* on BSD, uio.h needs types.h */ #include <sys/types.h> /* on BSD, uio.h needs types.h */
#include <sys/uio.h> /* "input.h" */ #include <sys/uio.h> /* "input.h" */
#include "threads.h"
#include "config.h" #include "config.h"
#include "common.h" #include "common.h"
#include "mtime.h" #include "mtime.h"
#include "threads.h" #include "plugins.h"
#include "intf_msg.h" #include "intf_msg.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment