]> git.sesse.net Git - vlc/commitdiff
D�but du portage BeOS. Beaucoup de fuchiers ont �t� modifi� car il a fallu
authorJean-Marc Dressler <polux@videolan.org>
Sat, 4 Mar 2000 22:33:01 +0000 (22:33 +0000)
committerJean-Marc Dressler <polux@videolan.org>
Sat, 4 Mar 2000 22:33:01 +0000 (22:33 +0000)
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.

41 files changed:
Makefile
include/audio_output.h
include/common.h
include/config.h
include/interface.h
include/plugins.h
include/threads.h
include/video_output.h
src/ac3_decoder/ac3_decoder_thread.c
src/audio_decoder/audio_decoder.c
src/audio_decoder/audio_math.c
src/audio_output/audio_output.c
src/input/input.c
src/input/input_ctrl.c
src/input/input_file.c
src/input/input_netlist.c
src/input/input_network.c
src/input/input_pcr.c
src/input/input_psi.c
src/input/input_vlan.c
src/interface/interface.c
src/interface/intf_cmd.c
src/interface/intf_ctrl.c
src/interface/intf_msg.c
src/interface/main.c
src/misc/decoder_fifo.c
src/misc/mtime.c
src/misc/netutils.c
src/misc/plugins.c
src/spu_decoder/spu_decoder.c
src/video_decoder/vdec_idct.c
src/video_decoder/vdec_motion.c
src/video_decoder/vdec_motion_inner.c
src/video_decoder/video_decoder.c
src/video_output/video_output.c
src/video_output/video_yuv.c
src/video_parser/video_fifo.c
src/video_parser/video_parser.c
src/video_parser/vpar_blocks.c
src/video_parser/vpar_headers.c
src/video_parser/vpar_synchro.c

index e20f48518203e7cd6f375152785f2905e71477f9..8ab557efbcce9bc997a0e82ac36ef024bee1d341 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -10,7 +10,7 @@
 ################################################################################
 
 # Environment
-CC=egcc
+CC=gcc
 #CC=gcc295
 SHELL=/bin/sh
 INSTALL=install
@@ -30,7 +30,7 @@ VIDEO = x11
 #VIDEO += ggi
 #VIDEO += glide
 # Not yet supported
-#VIDEO += beos
+#VIDEO = beos
 #VIDEO += dga
 # Fallback method that should always work
 VIDEO += dummy
@@ -82,7 +82,9 @@ endif
 # PROGRAM_BUILD is a complete identification of the build
 # ( we can't use fancy options with date since OSes like Solaris
 # 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, 
 # including ARCH_xx and SYS_xx. It will be passed to C compiler.
@@ -124,6 +126,10 @@ ifeq ($(SYS),LINUX)
 LIB += -lpthread -ldl
 endif
 
+ifeq ($SYS),BEOS)
+LIB += -llibroot -llibgame -llibbe
+endif
+
 LIB += -lm
 
 #
index 17e9c34f20271f348f3e42e933bc99a1d4dd50ab..3bc7fbaccd2d8aba021c5905fad895bb3a8c7fbd 100644 (file)
@@ -184,7 +184,7 @@ typedef struct aout_thread_s
     aout_fifo_t         fifo[ AOUT_MAX_FIFOS ];
 
     /* 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_reset_t *          p_sys_reset;
     aout_sys_setformat_t *      p_sys_setformat;
index cc49cd53525576b5261f4d840ff082027858b156..e9e105df42d86420ca7b1d579e9e61f2346679ea 100644 (file)
@@ -103,8 +103,12 @@ typedef struct video_parser_s *         p_video_parser_t;
 #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) )
+#endif
+#ifndef MIN
 #define MIN(a, b)   ( ((a) < (b)) ? (a) : (b) )
+#endif
 
 /* MSB (big endian)/LSB (little endian) convertions - network order is always
  * MSB, and should be used for both network communications and files. Note that
index 6a79293e3aebc5bd33ad9502a1f93f8444b6420b..0f0dd3b6839f44a2e563bb25687f0705abe06785 100644 (file)
  * 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
  * queue are printed by the calling thread */
 #define INTF_MSG_QSIZE                  64
index 2a8f55c3c74d5bd40eeed6dd144fd467ad585885..d9c7b7ae4656377b838cf154dea1cd407afb8274 100644 (file)
@@ -58,7 +58,7 @@ typedef struct intf_thread_s
     p_intf_sys_t        p_sys;                           /* system interface */
 
     /* 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_manage_t *     p_sys_manage;                       /* main loop */
     intf_sys_destroy_t *    p_sys_destroy;              /* destroy interface */
index e5d042a97c9d71101a53b86f8d0657b178375d87..7c2629d0ff982b3a90faabd2bac1d97c481bcc0f 100644 (file)
  * Boston, MA 02111-1307, USA.
  *****************************************************************************/
 
-void * RequestPlugin     ( char * psz_mask, char * psz_name );
-void   TrashPlugin       ( void * p_plugin );
-void * GetPluginFunction ( void *plugin, char *name );
+#ifdef SYS_BEOS
+typedef int plugin_id_t;
+#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 );
 
index 73fb41d67a6a6e051df935cd5ad13a0e05bc6ca9..56c5e7d5e72d7e7f04c5cc4cec3e77c41de0705c 100644 (file)
  * Boston, MA 02111-1307, USA.
  *****************************************************************************/
 
+
 #ifdef SYS_GNU
 #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>
 #endif
 
@@ -80,13 +88,38 @@ typedef struct s_condition {
     struct cond_imp *implications;
 } 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_mutex_t  vlc_mutex_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);
 
@@ -122,7 +155,14 @@ static __inline__ int vlc_thread_create( vlc_thread_t *p_thread,
 #ifdef SYS_GNU
     *p_thread = cthread_fork( (cthread_fn_t)func, (any_t)p_data );
     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 );
 #endif
 }
@@ -135,7 +175,13 @@ static __inline__ void vlc_thread_exit( void )
 #ifdef SYS_GNU
     int result;
     cthread_exit( &result );
-#else          
+#endif
+
+#ifdef SYS_BEOS
+    exit_thread( 0 );
+#endif
+
+#if defined(SYS_LINUX) || defined(SYS_BSD)     
     pthread_exit( 0 );
 #endif
 }
@@ -147,11 +193,34 @@ static __inline__ void vlc_thread_join( vlc_thread_t thread )
 {
 #ifdef SYS_GNU
     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 );
 #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
  *****************************************************************************/
@@ -160,7 +229,20 @@ static __inline__ int vlc_mutex_init( vlc_mutex_t *p_mutex )
 #ifdef SYS_GNU
     mutex_init( p_mutex );
     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 );
 #endif
 }
@@ -173,7 +255,21 @@ static __inline__ int vlc_mutex_lock( vlc_mutex_t *p_mutex )
 #ifdef SYS_GNU
     mutex_lock( p_mutex );
     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 );
 #endif
 }
@@ -186,11 +282,40 @@ static __inline__ int vlc_mutex_unlock( vlc_mutex_t *p_mutex )
 #ifdef SYS_GNU
     mutex_unlock( p_mutex );
     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 );
 #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
  *****************************************************************************/
@@ -204,7 +329,21 @@ static __inline__ int vlc_cond_init( vlc_cond_t *p_condvar )
     p_condvar->implications = 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 );
 #endif
 }
@@ -221,7 +360,33 @@ static __inline__ int vlc_cond_signal( vlc_cond_t *p_condvar )
         cond_signal( (condition_t)p_condvar );
     }
     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 );
 #endif
 }
@@ -234,8 +399,39 @@ static __inline__ int vlc_cond_wait( vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex
 #ifdef SYS_GNU
     condition_wait( (condition_t)p_condvar, (mutex_t)p_mutex );
     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 );
 #endif
 }
-
index e61ae7c6eff8173429803dd495c77cce586f669b..ce917e0c71e405680bc5a71c1c43838e80081024 100644 (file)
@@ -152,7 +152,7 @@ typedef struct vout_thread_s
     u32                 i_blue_pixel;                                /* blue */
 
     /* 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_init_t *       p_sys_init;          /* initialize output method */
     vout_sys_end_t *        p_sys_end;            /* terminate output method */
index 3038448f358a940a7a55d86df60e8cd746b2ca39..76b1def656f696f8f6fd87d4f887fc1fd5adce20 100644 (file)
 #include <sys/types.h>                        /* on BSD, uio.h needs types.h */
 #include <sys/uio.h>                                            /* "input.h" */
 
+#include "threads.h"
 #include "common.h"
 #include "config.h"
 #include "mtime.h"
-#include "threads.h"
+#include "plugins.h"
 #include "debug.h"                                      /* "input_netlist.h" */
 
 #include "intf_msg.h"                        /* intf_DbgMsg(), intf_ErrMsg() */
index a3620bafe262ef51ac1cfe869dcc9ff3f876486a..48567fbeddb84bd0824f9c65588f0a4e8d2027c2 100644 (file)
 #include <sys/types.h>                        /* on BSD, uio.h needs types.h */
 #include <sys/uio.h>                                            /* "input.h" */
 
+#include "threads.h"
 #include "common.h"
 #include "config.h"
 #include "mtime.h"
-#include "threads.h"
+#include "plugins.h"
 #include "debug.h"                                      /* "input_netlist.h" */
 
 #include "intf_msg.h"                        /* intf_DbgMsg(), intf_ErrMsg() */
index 17832d7b1bf02800984929ecada61c9db5b5a005..1200f0cb2a24f6d87ed62a411a6bd37cda6571de 100644 (file)
 #include <sys/types.h>                        /* on BSD, uio.h needs types.h */
 #include <sys/uio.h>                                            /* "input.h" */
 
+#include "threads.h"
 #include "config.h"
 #include "common.h"
 #include "mtime.h"                                                /* mtime_t */
-#include "threads.h"
+#include "plugins.h"
 
 #include "intf_msg.h"                        /* intf_DbgMsg(), intf_ErrMsg() */
 
index ca22fbc3914b004d884adcf00359b9fc9d52e83c..6b951162d35ec978b14e7b9ed4eef33cc63232f0 100644 (file)
 #include <stdio.h>                                           /* "intf_msg.h" */
 #include <stdlib.h>                            /* calloc(), malloc(), free() */
 
+#include "threads.h"
 #include "common.h"
 #include "config.h"
 #include "mtime.h"                             /* mtime_t, mdate(), msleep() */
-#include "threads.h"
 #include "plugins.h"
 
 #include "intf_msg.h"                        /* intf_DbgMsg(), intf_ErrMsg() */
@@ -93,9 +93,8 @@ aout_thread_t *aout_CreateThread( int *pi_status )
 
     /* Request an interface plugin */
     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 );
         free( p_aout );
@@ -103,21 +102,21 @@ aout_thread_t *aout_CreateThread( int *pi_status )
     }
 
     /* Get plugins */
-    p_aout->p_sys_open =         GetPluginFunction( p_aout->p_aout_plugin, "aout_SysOpen" );
-    p_aout->p_sys_reset =        GetPluginFunction( p_aout->p_aout_plugin, "aout_SysReset" );
-    p_aout->p_sys_setformat =    GetPluginFunction( p_aout->p_aout_plugin, "aout_SysSetFormat" );
-    p_aout->p_sys_setchannels =  GetPluginFunction( p_aout->p_aout_plugin, "aout_SysSetChannels" );
-    p_aout->p_sys_setrate =      GetPluginFunction( p_aout->p_aout_plugin, "aout_SysSetRate" );
-    p_aout->p_sys_getbufinfo =   GetPluginFunction( p_aout->p_aout_plugin, "aout_SysGetBufInfo" );
-    p_aout->p_sys_playsamples =  GetPluginFunction( p_aout->p_aout_plugin, "aout_SysPlaySamples" );
-    p_aout->p_sys_close =        GetPluginFunction( p_aout->p_aout_plugin, "aout_SysClose" );
+    p_aout->p_sys_open =         GetPluginFunction( p_aout->aout_plugin, "aout_SysOpen" );
+    p_aout->p_sys_reset =        GetPluginFunction( p_aout->aout_plugin, "aout_SysReset" );
+    p_aout->p_sys_setformat =    GetPluginFunction( p_aout->aout_plugin, "aout_SysSetFormat" );
+    p_aout->p_sys_setchannels =  GetPluginFunction( p_aout->aout_plugin, "aout_SysSetChannels" );
+    p_aout->p_sys_setrate =      GetPluginFunction( p_aout->aout_plugin, "aout_SysSetRate" );
+    p_aout->p_sys_getbufinfo =   GetPluginFunction( p_aout->aout_plugin, "aout_SysGetBufInfo" );
+    p_aout->p_sys_playsamples =  GetPluginFunction( p_aout->aout_plugin, "aout_SysPlaySamples" );
+    p_aout->p_sys_close =        GetPluginFunction( p_aout->aout_plugin, "aout_SysClose" );
 
     /*
      * Initialize audio device
      */
     if ( p_aout->p_sys_open( p_aout ) )
     {
-        TrashPlugin( p_aout->p_aout_plugin );
+        TrashPlugin( p_aout->aout_plugin );
         free( p_aout );
         return( NULL );
     }
@@ -128,28 +127,28 @@ aout_thread_t *aout_CreateThread( int *pi_status )
     if ( p_aout->p_sys_reset( p_aout ) )
     {
         p_aout->p_sys_close( p_aout );
-        TrashPlugin( p_aout->p_aout_plugin );
+        TrashPlugin( p_aout->aout_plugin );
         free( p_aout );
         return( NULL );
     }
     if ( p_aout->p_sys_setformat( p_aout ) )
     {
         p_aout->p_sys_close( p_aout );
-        TrashPlugin( p_aout->p_aout_plugin );
+        TrashPlugin( p_aout->aout_plugin );
         free( p_aout );
         return( NULL );
     }
     if ( p_aout->p_sys_setchannels( p_aout ) )
     {
         p_aout->p_sys_close( p_aout );
-        TrashPlugin( p_aout->p_aout_plugin );
+        TrashPlugin( p_aout->aout_plugin );
         free( p_aout );
         return( NULL );
     }
     if ( p_aout->p_sys_setrate( p_aout ) )
     {
         p_aout->p_sys_close( p_aout );
-        TrashPlugin( p_aout->p_aout_plugin );
+        TrashPlugin( p_aout->aout_plugin );
         free( p_aout );
         return( NULL );
     }
@@ -160,7 +159,7 @@ aout_thread_t *aout_CreateThread( int *pi_status )
     if( aout_SpawnThread( p_aout ) )
     {
         p_aout->p_sys_close( p_aout );
-        TrashPlugin( p_aout->p_aout_plugin );
+        TrashPlugin( p_aout->aout_plugin );
         free( p_aout );
         return( NULL );
     }
@@ -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);
 
     /* Close plugin */
-    TrashPlugin( p_aout->p_aout_plugin );
+    TrashPlugin( p_aout->aout_plugin );
 
     /* Free structure */
     free( p_aout );
index a7d9f742856936c8b0fc2104e4a669795ea5b7c4..85adfe29f603afae6ddd04121e24d91896559471 100644 (file)
 #include <stdlib.h>                                                /* free() */
 #include <netinet/in.h>                                           /* ntohs() */
 
+#include "threads.h"
 #include "common.h"
 #include "config.h"
 #include "mtime.h"
-#include "threads.h"
 #include "intf_msg.h"
+#include "plugins.h"
 #include "debug.h"
 
 #include "input.h"
index 41c7b015a67236d99a3b3578a27401b20d906d6f..7e482d745c52ce7cd8f746090800c555938a4f77 100644 (file)
 
 #include <netinet/in.h>                                             /* ntohs */
 
+#include "threads.h"
 #include "common.h"
 #include "config.h"
 #include "mtime.h"
-#include "threads.h"
 #include "intf_msg.h"
+#include "plugins.h"
 #include "debug.h"
 
 #include "input.h"
index 32949453ba6b31c6128bb67b6cb6b04f0d6f9e27..5754dd7f61795dfda570745dd1f52a913143cc57 100644 (file)
 #include <sys/types.h>                        /* on BSD, uio.h needs types.h */
 #include <sys/uio.h>                                            /* "input.h" */
 
+#include "threads.h"
 #include "common.h"
 #include "config.h"
 #include "mtime.h"
-#include "threads.h"
 
 #include "input.h"
 #include "input_file.h"
index e1b2b398dc4f661b7be7ef27d7d1fbcd9d7e77b3..724e4a3cd0d6dfb8e1b6f16a11719503c4f67a50 100644 (file)
 #include <string.h>                                            /* strerror() */
 #include <errno.h>                                                  /* errno */
 
+#include "threads.h"
 #include "common.h"
 #include "config.h"
 #include "mtime.h"
-#include "threads.h"
 #include "intf_msg.h"
 #include "debug.h"
 #include "input.h"
index 578171181594af0e0ced0ab428153ea2abe75e34..f69244df819ebe0f14081e19f9cd6d947a6387bb 100644 (file)
 #include <errno.h>                                                  /* errno */
 #include <sys/time.h>                                   /* "input_network.h" */
 
-#ifdef SYS_BSD
+#if defined(SYS_BSD) || defined(SYS_BEOS)
 #include <sys/socket.h>                                   /* struct sockaddr */
 #endif
 
 #include <netdb.h>     /* servent, getservbyname(), hostent, gethostbyname() */
 #include <netinet/in.h>                     /* sockaddr_in, htons(), htonl() */
 
+#include "threads.h"
 #include "common.h"
 #include "config.h"
 #include "mtime.h"
-#include "threads.h"
 #include "netutils.h"
 
 #include "input.h"
@@ -96,6 +96,7 @@ int input_NetworkOpen( input_thread_t *p_input )
         return( 1 );
     }
 
+#ifndef SYS_BEOS
     /* Increase the receive buffer size to 1/2MB (8Mb/s during 1/2s) to avoid
      * packet loss caused by scheduling problems */
     i_socket_option = 524288;
@@ -109,6 +110,7 @@ int input_NetworkOpen( input_thread_t *p_input )
         close( p_input->i_handle );
         return( 1 );
     }
+#endif /* SYS_BEOS */
 
     /*
      * Bind the socket
index 11a5e51ae94673e0df2c93914de4ae4620de67e6..57af8a70b35cf91ccf095919e43ddac8d16f8a05 100644 (file)
 #include <stdlib.h>                              /* atoi(), malloc(), free() */
 #include <netinet/in.h>                                           /* ntohl() */
 
+#include "threads.h"
 #include "config.h"
 #include "common.h"
 #include "mtime.h"
-#include "threads.h"
 #include "debug.h"
 #include "input.h"
 #include "intf_msg.h"
index b03745dab13f7bb59353acf9f4f4b9c2925ca514..015427753234270c71b65e6d26dceb1e712cb5a4 100644 (file)
 #include <string.h>                                               /* bzero() */
 #include <netinet/in.h>                                           /* ntohs() */
 
+#include "threads.h"
 #include "common.h"
 #include "config.h"
 #include "mtime.h"
-#include "threads.h"
 #include "intf_msg.h"
 #include "debug.h"
 
@@ -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_known_PAT_sections = 0;
-  bzero( p_input->p_stream->a_known_PAT_sections,
-         sizeof(*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) );
   p_input->p_stream->b_is_PAT_complete = 0;
 
   p_input->p_stream->i_known_PMT_sections = 0;
-  bzero( p_input->p_stream->a_known_PMT_sections,
-         sizeof(*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) );
   p_input->p_stream->b_is_PMT_complete = 0;
 
 #ifdef DVB_EXTENSIONS
   p_input->p_stream->i_SDT_version = PSI_UNINITIALISED;
   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) );
   p_input->p_stream->b_is_SDT_complete = 0;
 #endif
index c901077d738137aab62fcacd184710bdf14140fb..a089abe6bf230f9942304305b069a26faac3c9c1 100644 (file)
 #include <string.h>                                   /* strerror(), bzero() */
 #include <stdlib.h>                                                /* free() */
 
-#ifdef SYS_BSD
+#if defined(SYS_BSD) || defined(SYS_BEOS)
 #include <netinet/in.h>                                    /* struct in_addr */
 #include <sys/socket.h>                                   /* struct sockaddr */
 #endif
 
+#if defined(SYS_LINUX) || defined(SYS_BSD) || defined(SYS_GNU)
 #include <arpa/inet.h>                           /* inet_ntoa(), inet_aton() */
+#endif
 
 #ifdef SYS_LINUX
 #include <sys/ioctl.h>                                            /* ioctl() */
 #include <net/if.h>                            /* interface (arch-dependent) */
 #endif
 
+#include "threads.h"
 #include "config.h"
 #include "common.h"
 #include "mtime.h"
-#include "threads.h"
 #include "netutils.h"
 #include "input_vlan.h"
 #include "intf_msg.h"
@@ -76,6 +78,10 @@ static int ZeTrucMucheFunction( int Channel );
  *****************************************************************************/
 int input_VlanCreate( void )
 {
+#ifdef SYS_BEOS
+    intf_ErrMsg( "error: vlans are not supported under beos\n" );
+    return( 1 );
+#else
     /* Allocate structure */
     p_main->p_vlan = malloc( sizeof( input_vlan_t ) );
     if( p_main->p_vlan == NULL )
@@ -90,6 +96,7 @@ int input_VlanCreate( void )
 
     intf_Msg("VLANs initialized\n");
     return( 0 );
+#endif /* SYS_BEOS */
 }
 
 /*****************************************************************************
@@ -123,6 +130,9 @@ void input_VlanDestroy( void )
  *****************************************************************************/
 int input_VlanJoin( int i_vlan_id )
 {
+#ifdef SYS_BEOS
+    return( -1 );
+#else
     /* If last change is too recent, wait a while */
     if( mdate() - p_main->p_vlan->last_change < INPUT_VLAN_CHANGE_DELAY )
     {
@@ -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 );
     return( ZeTrucMucheFunction( i_vlan_id ) ); /* FIXME: join vlan ?? */
+#endif /* SYS_BEOS */
 }
 
 /*****************************************************************************
index cd869c39ab8cd66b9386e0f4fcf65005b7a0b4cb..e8c49b944fae52643912c10435a6c104dbe4038c 100644 (file)
 #include <sys/types.h>                        /* on BSD, uio.h needs types.h */
 #include <sys/uio.h>                                          /* for input.h */
 
+#include "threads.h"
 #include "config.h"
 #include "common.h"
 #include "mtime.h"
-#include "threads.h"
 #include "plugins.h"
 #include "input.h"
 
@@ -99,9 +99,8 @@ intf_thread_t* intf_Create( void )
 
     /* Request an interface plugin */
     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 );
         free( p_intf );
@@ -109,9 +108,9 @@ intf_thread_t* intf_Create( void )
     }
 
     /* Get plugins */
-    p_intf->p_sys_create =  GetPluginFunction( p_intf->p_intf_plugin, "intf_SysCreate" );
-    p_intf->p_sys_manage =  GetPluginFunction( p_intf->p_intf_plugin, "intf_SysManage" );
-    p_intf->p_sys_destroy = GetPluginFunction( p_intf->p_intf_plugin, "intf_SysDestroy" );
+    p_intf->p_sys_create =  GetPluginFunction( p_intf->intf_plugin, "intf_SysCreate" );
+    p_intf->p_sys_manage =  GetPluginFunction( p_intf->intf_plugin, "intf_SysManage" );
+    p_intf->p_sys_destroy = GetPluginFunction( p_intf->intf_plugin, "intf_SysDestroy" );
 
     /* Initialize structure */
     p_intf->b_die =     0;
@@ -128,7 +127,7 @@ intf_thread_t* intf_Create( void )
     if( p_intf->p_console == NULL )
     {
         intf_ErrMsg("error: can't create control console\n");
-        TrashPlugin( p_intf->p_intf_plugin );
+        TrashPlugin( p_intf->intf_plugin );
         free( p_intf );
         return( NULL );
     }
@@ -136,7 +135,7 @@ intf_thread_t* intf_Create( void )
     {
         intf_ErrMsg("error: can't create interface\n");
         intf_ConsoleDestroy( p_intf->p_console );
-        TrashPlugin( p_intf->p_intf_plugin );
+        TrashPlugin( p_intf->intf_plugin );
         free( p_intf );
         return( NULL );
     }
@@ -202,7 +201,7 @@ void intf_Destroy( intf_thread_t *p_intf )
     UnloadChannels( p_intf );
 
     /* Close plugin */
-    TrashPlugin( p_intf->p_intf_plugin );
+    TrashPlugin( p_intf->intf_plugin );
 
     /* Free structure */
     free( p_intf );
index 6ccb75bcc287c52e2ddbea82cc3b78975e6422df..91b8adb20cef42c84398e457b0569b29be5c6d1f 100644 (file)
 #include <stdlib.h>                                    /* strtod(), strtol() */
 #include <string.h>                                            /* strerror() */
 
+#include "threads.h"
 #include "config.h"
 #include "common.h"
 #include "mtime.h"
-#include "threads.h"
+#include "plugins.h"
 
 #include "interface.h"
 #include "intf_msg.h"
index 5ccff0acbe43ce3892f056ad6f48e368c6ae98cf..797f770f30754818af6b17224ca9de60f18386ed 100644 (file)
 #include <fcntl.h>                                                 /* open() */
 
 /* Common headers */
+#include "threads.h"
 #include "config.h"
 #include "common.h"
 #include "mtime.h"
-#include "threads.h"
 #include "debug.h"
+#include "plugins.h"
 #include "intf_msg.h"
 
 #include "input.h"
index 7fb09521b1ea317ad7c3819dfc8ba7a17c200820..5a8376b99e91d39038f46dceb753bf56bdc1d1d2 100644 (file)
 #include <string.h>                                            /* strerror() */
 #include <unistd.h>                                      /* close(), write() */
 
+#include "threads.h"
 #include "config.h"
 #include "common.h"
 #include "mtime.h"
-#include "threads.h"
+#include "plugins.h"
 #include "intf_msg.h"
 #include "interface.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
     /*
      * 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 );
+#endif
     if( psz_str == NULL )
     {
         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,
     /*
      * 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 );
+#endif
     if( psz_str == NULL )
     {
         fprintf(stderr, "warning: can't store following message (%s): ",
index 95dda7794d49181830efd2e9f6b3d065504402af..4969b50e6818963c8d13e5525a0c564b4b59e39d 100644 (file)
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#include <getopt.h>                                              /* getopt() */
 #include <signal.h>                               /* SIGHUP, SIGINT, SIGKILL */
+#include <getopt.h>                                              /* getopt() */
 #include <stdio.h>                                              /* sprintf() */
 
 #include <errno.h>                                                 /* ENOMEM */
 #include <stdlib.h>                                  /* getenv(), strtol(),  */
 #include <string.h>                                            /* strerror() */
 
+#include "threads.h"
 #include "config.h"
 #include "common.h"
 #include "mtime.h"
-#include "threads.h"
+#include "plugins.h"
 #include "input_vlan.h"
 
 #include "intf_msg.h"
@@ -574,6 +575,9 @@ static void SignalHandler( int i_signal )
  *****************************************************************************/
 static int TestMMX( void )
 {
+/* FIXME: under beos, gcc does not support the foolowing inline assembly */ 
+#ifndef SYS_BEOS
+
     int i_reg, i_dummy = 0;
 
     /* test for a 386 cpu */
@@ -635,5 +639,9 @@ static int TestMMX( void )
         return( 0 );
 
     return( 1 );
+
+#else /* SYS_BEOS */
+    return( 1 );
+#endif /* SYS_BEOS */
 }
 #endif
index f0a4c9031f0434c6733a8ad3e866de12502caaa8..1431ca58565045723aa73b31c04342c903d742d0 100644 (file)
 #include <sys/types.h>                        /* on BSD, uio.h needs types.h */
 #include <sys/uio.h>                                          /* for input.h */
 
+#include "threads.h"
 #include "config.h"
 #include "common.h"
 #include "mtime.h"
-#include "threads.h"
 
 #include "debug.h"                 /* XXX?? temporaire, requis par netlist.h */
 
index 2f2b42b359abb0a703f7e95e48c7506c7eb3c44f..cd11520ae01375a447eea4aa9e7c5d31d34629b8 100644 (file)
 #include <unistd.h>                                              /* select() */
 #include <sys/time.h>
 
+#ifdef SYS_BEOS
+#include <kernel/OS.h>
+#endif
+
 #include "common.h"
 #include "mtime.h"
 
@@ -63,6 +67,9 @@ char *mstrtime( char *psz_buffer, mtime_t date )
  *****************************************************************************/
 mtime_t mdate( void )
 {
+#ifdef SYS_BEOS
+    return( real_time_clock_usecs() );
+#else
     struct timeval tv_date;
 
     /* gettimeofday() could return an error, and should be tested. However, the
@@ -70,6 +77,7 @@ mtime_t mdate( void )
      * here, since tv is a local variable. */
     gettimeofday( &tv_date, NULL );
     return( (mtime_t) tv_date.tv_sec * 1000000 + (mtime_t) tv_date.tv_usec );
+#endif
 }
 
 /*****************************************************************************
@@ -81,6 +89,17 @@ mtime_t mdate( void )
  *****************************************************************************/
 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;
     mtime_t        delay;          /* delay in msec, signed to detect errors */
 
@@ -102,6 +121,8 @@ void mwait( mtime_t date )
 #else
     usleep( delay );
 #endif
+
+#endif /* SYS_BEOS */
 }
 
 /*****************************************************************************
@@ -111,6 +132,10 @@ void mwait( mtime_t date )
  *****************************************************************************/
 void msleep( mtime_t delay )
 {
+#ifdef SYS_BEOS
+    snooze( delay );
+#else /* SYS_BEOS */
+
 #ifndef usleep
     struct timeval tv_delay;
 
@@ -124,4 +149,6 @@ void msleep( mtime_t delay )
 #else
     usleep( delay );
 #endif
+
+#endif /* SYS_BEOS */
 }
index 2aeed67c736af3ce0e34e6a6289850ec539e8acd..6566f21c9716b01f4b72ca147830c37b908943a5 100644 (file)
 #include <sys/socket.h>                                   /* struct sockaddr */
 #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
 #include <sys/ioctl.h>                                            /* ioctl() */
@@ -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 */
 
-    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_port = htons( i_port );                             /* 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
      * 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) )
+#endif
     {
         /* The convertion failed: the address is an host name, which needs
          * to be resolved */
@@ -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 */
-        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 );
 }
index c0cb7a3708c96670e1353524ba1f76e190ed0274..ced56d186c491fb16e74188c40a3357e674d14a0 100644 (file)
 
 #include <stdlib.h>                                      /* free(), strtol() */
 #include <stdio.h>                                              /* sprintf() */
+
+#if defined(SYS_LINUX) || defined(SYS_BSD) || defined(SYS_GNU)
 #include <dlfcn.h>                           /* dlopen(), dlsym(), dlclose() */
+#endif
+
+#ifdef SYS_BEOS
+#include <image.h>
+#endif
+
+#include "plugins.h"
 
 #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;
-    void * fd;
     char * psz_plugin;
     char * psz_plugin_path[ PLUGIN_PATH_COUNT ] =
     {
@@ -48,23 +56,45 @@ void * RequestPlugin ( char * psz_mask, char * psz_name )
     {
         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 );
-        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 );
 
-        if( fd != NULL )
-            return( fd );
+#ifdef SYS_BEOS
+        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
 }
 
index 3fa4708141e66c83e66da7efdb413d6e692efbc9..0910b57fbd377eada17d9ea69474b6d083d4c805 100644 (file)
 #include <sys/uio.h>                                          /* for input.h */
 #include <unistd.h>                                              /* getpid() */
 
+#include "threads.h"
 #include "config.h"
 #include "common.h"
 #include "mtime.h"
-#include "threads.h"
 
 #include "intf_msg.h"
 #include "debug.h"                                                 /* ASSERT */
index b0b1aaee0036b21f15395228ffa38bad1a560008..2d867cd70f2eef4d3416555d732be6337005d367 100644 (file)
 #include <sys/types.h>                        /* on BSD, uio.h needs types.h */
 #include <sys/uio.h>                                          /* for input.h */
 
+#include "threads.h"
 #include "config.h"
 #include "common.h"
 #include "mtime.h"
-#include "threads.h"
+#include "plugins.h"
 
 #include "intf_msg.h"
 
index bde293bda10c33ea7f34f727ca67d356be8bed68..eff0323b2bc523c28e1cfe0bb8e1819d392a306f 100644 (file)
 #include <sys/types.h>                        /* on BSD, uio.h needs types.h */
 #include <sys/uio.h>                                          /* for input.h */
 
+#include "threads.h"
 #include "config.h"
 #include "common.h"
 #include "mtime.h"
-#include "threads.h"
+#include "plugins.h"
 
 #include "intf_msg.h"
 
index 56689d8de1b34074ce05b619e3bf1bb7417e9888..7181d558fdbd9f4701d621d288df3d6328c326f7 100644 (file)
 #include <sys/types.h>                        /* on BSD, uio.h needs types.h */
 #include <sys/uio.h>                                          /* for input.h */
 
+#include "threads.h"
 #include "config.h"
 #include "common.h"
 #include "mtime.h"
-#include "threads.h"
+#include "plugins.h"
 
 #include "intf_msg.h"
 
index 03d49892aa9287ea2c7730051e3a5cd96f212251..4c7443f8aa50158bb581c809987a9ffd3f3ad5a0 100644 (file)
 #include <sys/types.h>                        /* on BSD, uio.h needs types.h */
 #include <sys/uio.h>                                          /* for input.h */
 
+#include "threads.h"
 #include "config.h"
 #include "common.h"
 #include "mtime.h"
-#include "threads.h"
+#include "plugins.h"
 
 #include "intf_msg.h"
 
index 0341868ebe59e6d2912b21df1e9231847be3a63d..5c9731834b45275243a15fc25ed47a0e70a55508 100644 (file)
 #include <stdio.h>                                              /* sprintf() */
 #include <string.h>                                            /* strerror() */
 
+#include "threads.h"
 #include "common.h"
 #include "config.h"
 #include "mtime.h"
-#include "threads.h"
 #include "plugins.h"
 #include "video.h"
 #include "video_output.h"
@@ -103,9 +103,8 @@ vout_thread_t * vout_CreateThread   ( char *psz_display, int i_root_window,
 
     /* Request an interface plugin */
     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 );
         free( p_vout );
@@ -113,12 +112,12 @@ vout_thread_t * vout_CreateThread   ( char *psz_display, int i_root_window,
     }
 
     /* Get plugins */
-    p_vout->p_sys_create =  GetPluginFunction( p_vout->p_vout_plugin, "vout_SysCreate" );
-    p_vout->p_sys_init =    GetPluginFunction( p_vout->p_vout_plugin, "vout_SysInit" );
-    p_vout->p_sys_end =     GetPluginFunction( p_vout->p_vout_plugin, "vout_SysEnd" );
-    p_vout->p_sys_destroy = GetPluginFunction( p_vout->p_vout_plugin, "vout_SysDestroy" );
-    p_vout->p_sys_manage =  GetPluginFunction( p_vout->p_vout_plugin, "vout_SysManage" );
-    p_vout->p_sys_display = GetPluginFunction( p_vout->p_vout_plugin, "vout_SysDisplay" );
+    p_vout->p_sys_create =  GetPluginFunction( p_vout->vout_plugin, "vout_SysCreate" );
+    p_vout->p_sys_init =    GetPluginFunction( p_vout->vout_plugin, "vout_SysInit" );
+    p_vout->p_sys_end =     GetPluginFunction( p_vout->vout_plugin, "vout_SysEnd" );
+    p_vout->p_sys_destroy = GetPluginFunction( p_vout->vout_plugin, "vout_SysDestroy" );
+    p_vout->p_sys_manage =  GetPluginFunction( p_vout->vout_plugin, "vout_SysManage" );
+    p_vout->p_sys_display = GetPluginFunction( p_vout->vout_plugin, "vout_SysDisplay" );
 
     /* Initialize thread properties - thread id and locks will be initialized
      * later */
@@ -181,7 +180,7 @@ vout_thread_t * vout_CreateThread   ( char *psz_display, int i_root_window,
      * own error messages */
     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 );
         return( NULL );
     }
@@ -207,7 +206,7 @@ vout_thread_t * vout_CreateThread   ( char *psz_display, int i_root_window,
     if( p_vout->p_default_font == NULL )
     {
         p_vout->p_sys_destroy( p_vout );
-        TrashPlugin( p_vout->p_vout_plugin );
+        TrashPlugin( p_vout->vout_plugin );
         free( p_vout );
         return( NULL );
     }
@@ -216,7 +215,7 @@ vout_thread_t * vout_CreateThread   ( char *psz_display, int i_root_window,
     {
         vout_UnloadFont( p_vout->p_default_font );
         p_vout->p_sys_destroy( p_vout );
-        TrashPlugin( p_vout->p_vout_plugin );
+        TrashPlugin( p_vout->vout_plugin );
         free( p_vout );
         return( NULL );
     }
@@ -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_large_font );
         p_vout->p_sys_destroy( p_vout );
-        TrashPlugin( p_vout->p_vout_plugin );
+        TrashPlugin( p_vout->vout_plugin );
         free( p_vout );
         return( NULL );
     }
@@ -1254,7 +1253,7 @@ static void DestroyThread( vout_thread_t *p_vout, int i_status )
     p_vout->p_sys_destroy( p_vout );
 
     /* Close plugin */
-    TrashPlugin( p_vout->p_vout_plugin );
+    TrashPlugin( p_vout->vout_plugin );
 
     /* Free structure */
     free( p_vout );
index 3b8ed95f7a3778522638fcf9960f4da7c33d6d23..7113ca662fe0115f9e3c11e08a53f6648bbbff6a 100644 (file)
 #include <stdlib.h>                                                /* free() */
 #include <string.h>                                            /* strerror() */
 
+#include "threads.h"
 #include "common.h"
 #include "config.h"
 #include "mtime.h"
-#include "threads.h"
+#include "plugins.h"
 #include "video.h"
 #include "video_output.h"
 #include "video_yuv.h"
index 3c48da63b0b7b085dadadaf05d23ce918052c895..d0c4df5578cf7b9fae694abc50b0fd98d2a5f152 100644 (file)
 #include <sys/types.h>                        /* on BSD, uio.h needs types.h */
 #include <sys/uio.h>                                             /* "input.h */
 
+#include "threads.h"
 #include "config.h"
 #include "common.h"
 #include "mtime.h"
-#include "threads.h"
+#include "plugins.h"
 
 #include "intf_msg.h"
 #include "debug.h"                 /* XXX?? temporaire, requis par netlist.h */
index 29b3dabbb381e9d72fc1a11f65224faf421ebc01..beab526a7b846529452cc16544424f50a48985b4 100644 (file)
 #include <sys/types.h>                        /* on BSD, uio.h needs types.h */
 #include <sys/uio.h>                                            /* "input.h" */
 
+#include "threads.h"
 #include "config.h"
 #include "common.h"
 #include "mtime.h"
-#include "threads.h"
+#include "plugins.h"
 
 #include "intf_msg.h"
 #include "debug.h"                 /* XXX?? temporaire, requis par netlist.h */
index ec14db40c1d8b09be638e7839b14f5ccb32a9723..a0711fb3a54ede8832981e4403afdba926120322 100644 (file)
 #include <sys/types.h>                        /* on BSD, uio.h needs types.h */
 #include <sys/uio.h>                                            /* "input.h" */
 
+#include "threads.h"
 #include "config.h"
 #include "common.h"
 #include "mtime.h"
-#include "threads.h"
+#include "plugins.h"
 
 #include "intf_msg.h"
 #include "debug.h"                 /* XXX?? temporaire, requis par netlist.h */
index 41499974ed39286f5f51b0fde19a169cb6f986b0..d58dba8e788ef72d0e61d04fefc580556a085124 100644 (file)
 #include <sys/types.h>                        /* on BSD, uio.h needs types.h */
 #include <sys/uio.h>                                            /* "input.h" */
 
+#include "threads.h"
 #include "config.h"
 #include "common.h"
 #include "mtime.h"
-#include "threads.h"
+#include "plugins.h"
 
 #include "intf_msg.h"
 
index 7c7c18a8eacd608d9755c9e8f3d7a0aa1a9d0620..200c0fe6148434067ac4735b137dfb9e2c12266e 100644 (file)
 #include <sys/types.h>                        /* on BSD, uio.h needs types.h */
 #include <sys/uio.h>                                            /* "input.h" */
 
+#include "threads.h"
 #include "config.h"
 #include "common.h"
 #include "mtime.h"
-#include "threads.h"
+#include "plugins.h"
 
 #include "intf_msg.h"