]> git.sesse.net Git - vlc/commitdiff
o changement de nom des fonctions sp�cifiques BeOS
authorSam Hocevar <sam@videolan.org>
Wed, 16 Feb 2000 03:54:07 +0000 (03:54 +0000)
committerSam Hocevar <sam@videolan.org>
Wed, 16 Feb 2000 03:54:07 +0000 (03:54 +0000)
 o d�but de l'�clatage de l'audio_output :
   . giclage des variables *dsp* en faveur de *sys*
   . aout_*GetBufInfo renvoie l_bytes pour que video_output.c ne d�pende
    plus de la structure audio_buf_info sp�cifique � <linux/soundcard.h>
   . cr�ation de la m�thode audio 'dummy' qui ne fait rien.
 o nouvelle option --aout acceptant 'dummy' et 'dsp' pour le moment

include/audio_dsp.h [deleted file]
include/audio_output.h
include/audio_sys.h [new file with mode: 0644]
include/intf_sys.h
include/video_sys.h
src/audio_output/audio_dsp.c [deleted file]
src/audio_output/audio_output.c
src/interface/interface.c
src/interface/intf_ctrl.c
src/video_output/video_output.c

diff --git a/include/audio_dsp.h b/include/audio_dsp.h
deleted file mode 100644 (file)
index 85d8d6d..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/*****************************************************************************
- * audio_dsp.h : header of the dsp functions library
- * (c)1999 VideoLAN
- *****************************************************************************
- * Required headers:
- * - "common.h" ( byte_t )
- * - "audio_output.h" ( aout_dsp_t )
- *****************************************************************************/
-
-/*****************************************************************************
- * Prototypes
- *****************************************************************************/
-int  aout_dspOpen       ( aout_dsp_t *p_dsp );
-int  aout_dspReset      ( aout_dsp_t *p_dsp );
-int  aout_dspSetFormat  ( aout_dsp_t *p_dsp );
-int  aout_dspSetChannels( aout_dsp_t *p_dsp );
-int  aout_dspSetRate    ( aout_dsp_t *p_dsp );
-void aout_dspGetBufInfo ( aout_dsp_t *p_dsp );
-void aout_dspPlaySamples( aout_dsp_t *p_dsp, byte_t *buffer, int i_size );
-void aout_dspClose      ( aout_dsp_t *p_dsp );
index f12ac9e16b45d15bdc1d71f71ec4a1d0af920c63..31a5bf0bc773e66f5732194beee7fb68f35c44cd 100644 (file)
@@ -60,7 +60,7 @@
 #define AOUT_FIFO_ISFULL( fifo )        ( ((((fifo).l_end_frame + 1) - (fifo).l_start_frame) & AOUT_FIFO_SIZE) == 0 )
 
 /*****************************************************************************
- * aout_dsp_t
+ * aout_sys_t
  *****************************************************************************/
 typedef struct
 {
@@ -75,11 +75,11 @@ typedef struct
     /* Rate of the audio output sound (in Hz) */
     long                l_rate;
 
-    /* Buffer information structure, used by aout_dspGetBufInfo() to store the
+    /* Buffer information structure, used by aout_sys_getbufinfo() to store the
      * current state of the internal sound card buffer */
     audio_buf_info      buf_info;
 
-} aout_dsp_t;
+} aout_sys_t;
 
 /*****************************************************************************
  * aout_increment_t
@@ -156,18 +156,38 @@ typedef struct
 #define AOUT_ADEC_STEREO_FIFO   4
 
 /*****************************************************************************
- * aout_thread_t
+ * aout_thread_t : audio output thread descriptor
  *****************************************************************************/
+typedef int  (aout_sys_open_t)           ( aout_sys_t *p_sys );
+typedef int  (aout_sys_reset_t)          ( aout_sys_t *p_sys );
+typedef int  (aout_sys_setformat_t)      ( aout_sys_t *p_sys );
+typedef int  (aout_sys_setchannels_t)    ( aout_sys_t *p_sys );
+typedef int  (aout_sys_setrate_t)        ( aout_sys_t *p_sys );
+typedef long (aout_sys_getbufinfo_t)     ( aout_sys_t *p_sys );
+typedef void (aout_sys_playsamples_t)    ( aout_sys_t *p_sys,
+                                           byte_t *buffer, int i_size );
+typedef void (aout_sys_close_t)          ( aout_sys_t *p_sys );
+
 typedef struct aout_thread_s
 {
     vlc_thread_t        thread_id;
     boolean_t           b_die;
 
-    aout_dsp_t          dsp;
+    aout_sys_t          sys;
 
     vlc_mutex_t         fifos_lock;
     aout_fifo_t         fifo[ AOUT_MAX_FIFOS ];
 
+    /* method-dependant functions */
+    aout_sys_open_t *           p_sys_open;
+    aout_sys_reset_t *          p_sys_reset;
+    aout_sys_setformat_t *      p_sys_setformat;
+    aout_sys_setchannels_t *    p_sys_setchannels;
+    aout_sys_setrate_t *        p_sys_setrate;
+    aout_sys_getbufinfo_t *     p_sys_getbufinfo;
+    aout_sys_playsamples_t *    p_sys_playsamples;
+    aout_sys_close_t *          p_sys_close;
+
     void *              buffer;
     /* The s32 buffer is used to mix all the audio fifos together before
      * converting them and storing them in the audio output buffer */
@@ -184,6 +204,15 @@ typedef struct aout_thread_s
 
 } aout_thread_t;
 
+/* Output methods */
+#define AOUT_DUMMY_METHOD       0x0000                 /* dummy video output */
+#define AOUT_DSP_METHOD         0x0001                     /* linux /dev/dsp */
+
+/* Get the fallback method */
+#ifdef AUDIO_DSP
+#define AOUT_DEFAULT_METHOD "dsp"
+#endif
+
 /*****************************************************************************
  * Prototypes
  *****************************************************************************/
diff --git a/include/audio_sys.h b/include/audio_sys.h
new file mode 100644 (file)
index 0000000..57ef606
--- /dev/null
@@ -0,0 +1,30 @@
+/*****************************************************************************
+ * audio_sys.h : header of the method-dependant functions library
+ * (c)1999 VideoLAN
+ *****************************************************************************
+ * Required headers:
+ * - "common.h" ( byte_t )
+ * - "audio_output.h" ( aout_dsp_t )
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Prototypes
+ *****************************************************************************/
+int  aout_DummySysOpen          ( aout_sys_t *p_sys );
+int  aout_DummySysReset         ( aout_sys_t *p_sys );
+int  aout_DummySysSetFormat     ( aout_sys_t *p_sys );
+int  aout_DummySysSetChannels   ( aout_sys_t *p_sys );
+int  aout_DummySysSetRate       ( aout_sys_t *p_sys );
+long aout_DummySysGetBufInfo    ( aout_sys_t *p_sys );
+void aout_DummySysPlaySamples   ( aout_sys_t *p_sys, byte_t *buffer, int i_size );
+void aout_DummySysClose         ( aout_sys_t *p_sys );
+#ifdef AUDIO_DSP
+int  aout_DspSysOpen            ( aout_sys_t *p_sys );
+int  aout_DspSysReset           ( aout_sys_t *p_sys );
+int  aout_DspSysSetFormat       ( aout_sys_t *p_sys );
+int  aout_DspSysSetChannels     ( aout_sys_t *p_sys );
+int  aout_DspSysSetRate         ( aout_sys_t *p_sys );
+long aout_DspSysGetBufInfo      ( aout_sys_t *p_sys );
+void aout_DspSysPlaySamples     ( aout_sys_t *p_dsp, byte_t *buffer, int i_size );
+void aout_DspSysClose           ( aout_sys_t *p_sys );
+#endif
index 0758777b9e385cf7611965af32b67a2b8651af4f..a1cda4db56f8fc587b600ebd88a212922ee9741f 100644 (file)
@@ -35,8 +35,8 @@ void    intf_GGISysDestroy   ( p_intf_thread_t p_intf );
 void    intf_GGISysManage    ( p_intf_thread_t p_intf );
 #endif
 #ifdef VIDEO_BEOS
-int     intf_BeSysCreate     ( p_intf_thread_t p_intf );
-void    intf_BeSysDestroy    ( p_intf_thread_t p_intf );
-void    intf_BeSysManage     ( p_intf_thread_t p_intf );
+int     intf_BSysCreate      ( p_intf_thread_t p_intf );
+void    intf_BSysDestroy     ( p_intf_thread_t p_intf );
+void    intf_BSysManage      ( p_intf_thread_t p_intf );
 #endif
 
index 0c7d8668b562fd3cb302dedb2d1cf82d45ec85cf..af68ccb4ca71838f289850effe8af6df52eeb127 100644 (file)
@@ -53,11 +53,11 @@ int     vout_GGISysManage     ( p_vout_thread_t p_vout );
 void    vout_GGISysDisplay    ( p_vout_thread_t p_vout );
 #endif
 #ifdef VIDEO_BEOS
-int     vout_BeSysCreate      ( p_vout_thread_t p_vout, char *psz_display, int i_root_window );
-int     vout_BeSysInit        ( p_vout_thread_t p_vout );
-void    vout_BeSysEnd         ( p_vout_thread_t p_vout );
-void    vout_BeSysDestroy     ( p_vout_thread_t p_vout );
-int     vout_BeSysManage      ( p_vout_thread_t p_vout );
-void    vout_BeSysDisplay     ( p_vout_thread_t p_vout );
+int     vout_BSysCreate       ( p_vout_thread_t p_vout, char *psz_display, int i_root_window );
+int     vout_BSysInit         ( p_vout_thread_t p_vout );
+void    vout_BSysEnd          ( p_vout_thread_t p_vout );
+void    vout_BSysDestroy      ( p_vout_thread_t p_vout );
+int     vout_BSysManage       ( p_vout_thread_t p_vout );
+void    vout_BSysDisplay      ( p_vout_thread_t p_vout );
 #endif
 
diff --git a/src/audio_output/audio_dsp.c b/src/audio_output/audio_dsp.c
deleted file mode 100644 (file)
index 02391bb..0000000
+++ /dev/null
@@ -1,176 +0,0 @@
-/*****************************************************************************
- * audio_dsp.c : dsp functions library
- * (c)1999 VideoLAN
- *****************************************************************************/
-
-/* TODO:
- *
- * - an aout_dspGetFormats() function
- * - dsp inline/static
- * - make this library portable (see mpg123)
- * - macroify aout_dspPlaySamples &/| aout_dspGetBufInfo ?
- *
- */
-
-/*****************************************************************************
- * Preamble
- *****************************************************************************/
-#include <fcntl.h>                                       /* open(), O_WRONLY */
-#include <sys/ioctl.h>                                            /* ioctl() */
-#include <unistd.h>                                      /* write(), close() */
-/* SNDCTL_DSP_RESET, SNDCTL_DSP_SETFMT, SNDCTL_DSP_STEREO, SNDCTL_DSP_SPEED, SNDCTL_DSP_GETOSPACE */
-#include <sys/soundcard.h>
-
-#include "common.h"                                     /* boolean_t, byte_t */
-#include "mtime.h"
-#include "vlc_thread.h"
-
-#include "audio_output.h"                                      /* aout_dsp_t */
-#include "audio_dsp.h"
-
-#include "intf_msg.h"                        /* intf_DbgMsg(), intf_ErrMsg() */
-
-/*****************************************************************************
- * aout_dspOpen: opens the audio device (the digital sound processor)
- *****************************************************************************
- * - This function opens the dsp as an usual non-blocking write-only file, and
- *   modifies the p_dsp->i_fd with the file's descriptor.
- * - p_dsp->psz_device must be set before calling this function !
- *****************************************************************************/
-int aout_dspOpen( aout_dsp_t *p_dsp )
-{
-    if ( (p_dsp->i_fd = open( p_dsp->psz_device, O_WRONLY )) < 0 )
-    {
-        intf_ErrMsg( "aout error: can't open audio device (%s)\n", p_dsp->psz_device );
-       return( -1 );
-    }
-
-    return( 0 );
-}
-
-/*****************************************************************************
- * aout_dspReset: resets the dsp
- *****************************************************************************/
-int aout_dspReset( aout_dsp_t *p_dsp )
-{
-    if ( ioctl( p_dsp->i_fd, SNDCTL_DSP_RESET, NULL ) < 0 )
-    {
-        intf_ErrMsg( "aout error: can't reset audio device (%s)\n", p_dsp->psz_device );
-       return( -1 );
-    }
-
-    return( 0 );
-}
-
-/*****************************************************************************
- * aout_dspSetFormat: sets the dsp output format
- *****************************************************************************
- * This functions tries to initialize the dsp output format with the value
- * contained in the dsp structure, and if this value could not be set, the
- * default value returned by ioctl is set.
- *****************************************************************************/
-int aout_dspSetFormat( aout_dsp_t *p_dsp )
-{
-    int i_format;
-
-    i_format = p_dsp->i_format;
-    if ( ioctl( p_dsp->i_fd, SNDCTL_DSP_SETFMT, &i_format ) < 0 )
-    {
-        intf_ErrMsg( "aout error: can't set audio output format (%i)\n", p_dsp->i_format );
-       return( -1 );
-    }
-
-    if ( i_format != p_dsp->i_format )
-    {
-        intf_DbgMsg( "aout debug: audio output format not supported (%i)\n", p_dsp->i_format );
-       p_dsp->i_format = i_format;
-    }
-
-    return( 0 );
-}
-
-/*****************************************************************************
- * aout_dspSetChannels: sets the dsp's stereo or mono mode
- *****************************************************************************
- * This function acts just like the previous one...
- *****************************************************************************/
-int aout_dspSetChannels( aout_dsp_t *p_dsp )
-{
-    boolean_t b_stereo;
-
-    b_stereo = p_dsp->b_stereo;
-    if ( ioctl( p_dsp->i_fd, SNDCTL_DSP_STEREO, &b_stereo ) < 0 )
-    {
-        intf_ErrMsg( "aout error: can't set number of audio channels (%i)\n", p_dsp->b_stereo );
-       return( -1 );
-    }
-
-    if ( b_stereo != p_dsp->b_stereo )
-    {
-        intf_DbgMsg( "aout debug: number of audio channels not supported (%i)\n", p_dsp->b_stereo );
-       p_dsp->b_stereo = b_stereo;
-    }
-
-    return( 0 );
-}
-
-/*****************************************************************************
- * aout_dspSetRate: sets the dsp's audio output rate
- *****************************************************************************
- * This function tries to initialize the dsp with the rate contained in the
- * dsp structure, but if the dsp doesn't support this value, the function uses
- * the value returned by ioctl...
- *****************************************************************************/
-int aout_dspSetRate( aout_dsp_t *p_dsp )
-{
-    long l_rate;
-
-    l_rate = p_dsp->l_rate;
-    if ( ioctl( p_dsp->i_fd, SNDCTL_DSP_SPEED, &l_rate ) < 0 )
-    {
-        intf_ErrMsg( "aout error: can't set audio output rate (%li)\n", p_dsp->l_rate );
-       return( -1 );
-    }
-
-    if ( l_rate != p_dsp->l_rate )
-    {
-        intf_DbgMsg( "aout debug: audio output rate not supported (%li)\n", p_dsp->l_rate );
-       p_dsp->l_rate = l_rate;
-    }
-
-    return( 0 );
-}
-
-/*****************************************************************************
- * aout_dspGetBufInfo: buffer status query
- *****************************************************************************
- * This function fills in the audio_buf_info structure :
- * - int fragments : number of available fragments (partially usend ones not
- *   counted)
- * - int fragstotal : total number of fragments allocated
- * - int fragsize : size of a fragment in bytes
- * - int bytes : available space in bytes (includes partially used fragments)
- * Note! 'bytes' could be more than fragments*fragsize
- *****************************************************************************/
-void aout_dspGetBufInfo( aout_dsp_t *p_dsp )
-{
-    ioctl( p_dsp->i_fd, SNDCTL_DSP_GETOSPACE, &p_dsp->buf_info );
-}
-
-/*****************************************************************************
- * aout_dspPlaySamples: plays a sound samples buffer
- *****************************************************************************
- * This function writes a buffer of i_length bytes in the dsp
- *****************************************************************************/
-void aout_dspPlaySamples( aout_dsp_t *p_dsp, byte_t *buffer, int i_size )
-{
-    write( p_dsp->i_fd, buffer, i_size );
-}
-
-/*****************************************************************************
- * aout_dspClose: closes the dsp audio device
- *****************************************************************************/
-void aout_dspClose( aout_dsp_t *p_dsp )
-{
-    close( p_dsp->i_fd );
-}
index cfa2fd9df375a35f60b115045bc6970c10f54e9f..3611abd2e86b4b23e21750e0e01f656b125295ce 100644 (file)
@@ -32,7 +32,7 @@
 #include "intf_msg.h"                        /* intf_DbgMsg(), intf_ErrMsg() */
 
 #include "audio_output.h"
-#include "audio_dsp.h"
+#include "audio_sys.h"
 #include "main.h"
 
 /*****************************************************************************
@@ -62,6 +62,7 @@ static __inline__ int NextFrame( aout_thread_t * p_aout, aout_fifo_t * p_fifo, m
 aout_thread_t *aout_CreateThread( int *pi_status )
 {
     aout_thread_t * p_aout;                             /* thread descriptor */
+    char * psz_method;
 //    int             i_status;                                 /* thread status */
 
     /* Allocate descriptor */
@@ -71,57 +72,91 @@ aout_thread_t *aout_CreateThread( int *pi_status )
         return( NULL );
     }
 
+    /* initialize method-dependent functions */
+    psz_method = main_GetPszVariable( AOUT_METHOD_VAR, AOUT_DEFAULT_METHOD );
+
+    if( !strcmp(psz_method, "dummy") )
+    {
+        p_aout->p_sys_open =           aout_DummySysOpen;
+        p_aout->p_sys_reset =          aout_DummySysReset;
+        p_aout->p_sys_setformat =      aout_DummySysSetFormat;
+        p_aout->p_sys_setchannels =    aout_DummySysSetChannels;
+        p_aout->p_sys_setrate =        aout_DummySysSetRate;
+        p_aout->p_sys_getbufinfo =     aout_DummySysGetBufInfo;
+        p_aout->p_sys_playsamples =    aout_DummySysPlaySamples;
+        p_aout->p_sys_close =          aout_DummySysClose;
+    }
+#ifdef VIDEO_X11
+    else if( !strcmp(psz_method, "dsp") )
+    {
+        p_aout->p_sys_open =           aout_DspSysOpen;
+        p_aout->p_sys_reset =          aout_DspSysReset;
+        p_aout->p_sys_setformat =      aout_DspSysSetFormat;
+        p_aout->p_sys_setchannels =    aout_DspSysSetChannels;
+        p_aout->p_sys_setrate =        aout_DspSysSetRate;
+        p_aout->p_sys_getbufinfo =     aout_DspSysGetBufInfo;
+        p_aout->p_sys_playsamples =    aout_DspSysPlaySamples;
+        p_aout->p_sys_close =          aout_DspSysClose;
+    }
+#endif
+    else
+    {
+        intf_ErrMsg( "error: requested audio output method not available\n" );
+        free( p_aout );
+        return( NULL );
+    }
+               
     //???? kludge to initialize some audio parameters - place this section somewhere
     //???? else
-    p_aout->dsp.i_format = AOUT_DEFAULT_FORMAT;
-    p_aout->dsp.psz_device = main_GetPszVariable( AOUT_DSP_VAR, AOUT_DSP_DEFAULT );
-    p_aout->dsp.b_stereo   = main_GetIntVariable( AOUT_STEREO_VAR, AOUT_STEREO_DEFAULT );
-    p_aout->dsp.l_rate     = main_GetIntVariable( AOUT_RATE_VAR, AOUT_RATE_DEFAULT );
+    p_aout->sys.i_format = AOUT_DEFAULT_FORMAT;
+    p_aout->sys.psz_device = main_GetPszVariable( AOUT_DSP_VAR, AOUT_DSP_DEFAULT );
+    p_aout->sys.b_stereo   = main_GetIntVariable( AOUT_STEREO_VAR, AOUT_STEREO_DEFAULT );
+    p_aout->sys.l_rate     = main_GetIntVariable( AOUT_RATE_VAR, AOUT_RATE_DEFAULT );
     // ???? end of kludge
 
     /*
      * Initialize DSP
      */
-    if ( aout_dspOpen( &p_aout->dsp ) )
+    if ( p_aout->p_sys_open( &p_aout->sys ) )
     {
         free( p_aout );
         return( NULL );
     }
-    if ( aout_dspReset( &p_aout->dsp ) )
+    if ( p_aout->p_sys_reset( &p_aout->sys ) )
     {
-       aout_dspClose( &p_aout->dsp );
+       p_aout->p_sys_close( &p_aout->sys );
        free( p_aout );
        return( NULL );
     }
-    if ( aout_dspSetFormat( &p_aout->dsp ) )
+    if ( p_aout->p_sys_setformat( &p_aout->sys ) )
     {
-       aout_dspClose( &p_aout->dsp );
+       p_aout->p_sys_close( &p_aout->sys );
        free( p_aout );
        return( NULL );
     }
-    if ( aout_dspSetChannels( &p_aout->dsp ) )
+    if ( p_aout->p_sys_setchannels( &p_aout->sys ) )
     {
-       aout_dspClose( &p_aout->dsp );
+       p_aout->p_sys_close( &p_aout->sys );
        free( p_aout );
         return( NULL );
     }
-    if ( aout_dspSetRate( &p_aout->dsp ) )
+    if ( p_aout->p_sys_setrate( &p_aout->sys ) )
     {
-       aout_dspClose( &p_aout->dsp );
+       p_aout->p_sys_close( &p_aout->sys );
        free( p_aout );
        return( NULL );
     }
     intf_DbgMsg("aout debug: audio device (%s) opened (format=%i, stereo=%i, rate=%li)\n",
-        p_aout->dsp.psz_device,
-        p_aout->dsp.i_format,
-        p_aout->dsp.b_stereo, p_aout->dsp.l_rate);
+        p_aout->sys.psz_device,
+        p_aout->sys.i_format,
+        p_aout->sys.b_stereo, p_aout->sys.l_rate);
 
     //?? maybe it would be cleaner to change SpawnThread prototype
     //?? see vout to handle status correctly - however, it is not critical since
-    //?? this thread is only called in main is all calls are blocking
+    //?? this thread is only called in main and all calls are blocking
     if( aout_SpawnThread( p_aout ) )
     {
-       aout_dspClose( &p_aout->dsp );
+       p_aout->p_sys_close( &p_aout->sys );
        free( p_aout );
        return( NULL );
     }
@@ -156,16 +191,16 @@ static int aout_SpawnThread( aout_thread_t * p_aout )
     /* Compute the size (in audio units) of the audio output buffer. Although
      * AOUT_BUFFER_DURATION is given in microseconds, the output rate is given
      * in Hz, that's why we need to divide by 10^6 microseconds (1 second) */
-    p_aout->l_units = (long)( ((s64)p_aout->dsp.l_rate * AOUT_BUFFER_DURATION) / 1000000 );
-    p_aout->l_msleep = (long)( ((s64)p_aout->l_units * 1000000) / (s64)p_aout->dsp.l_rate );
+    p_aout->l_units = (long)( ((s64)p_aout->sys.l_rate * AOUT_BUFFER_DURATION) / 1000000 );
+    p_aout->l_msleep = (long)( ((s64)p_aout->l_units * 1000000) / (s64)p_aout->sys.l_rate );
 
     /* Make aout_thread point to the right thread function, and compute the
      * byte size of the audio output buffer */
-    switch ( p_aout->dsp.b_stereo )
+    switch ( p_aout->sys.b_stereo )
     {
         /* Audio output is mono */
         case 0:
-            switch ( p_aout->dsp.i_format )
+            switch ( p_aout->sys.i_format )
             {
                 case AFMT_U8:
                     l_bytes = 1 * sizeof(u8) * p_aout->l_units;
@@ -191,14 +226,14 @@ static int aout_SpawnThread( aout_thread_t * p_aout )
 
                 default:
                     intf_ErrMsg("aout error: unknown audio output format (%i)\n",
-                        p_aout->dsp.i_format);
+                        p_aout->sys.i_format);
                    return( -1 );
             }
             break;
 
         /* Audio output is stereo */
         case 1:
-            switch ( p_aout->dsp.i_format )
+            switch ( p_aout->sys.i_format )
             {
                 case AFMT_U8:
                     l_bytes = 2 * sizeof(u8) * p_aout->l_units;
@@ -224,14 +259,14 @@ static int aout_SpawnThread( aout_thread_t * p_aout )
 
                 default:
                     intf_ErrMsg("aout error: unknown audio output format (%i)\n",
-                        p_aout->dsp.i_format);
+                        p_aout->sys.i_format);
                     return( -1 );
             }
             break;
 
         default:
             intf_ErrMsg("aout error: unknown number of audio channels (%i)\n",
-                p_aout->dsp.b_stereo + 1);
+                p_aout->sys.b_stereo + 1);
             return( -1 );
     }
 
@@ -242,7 +277,7 @@ static int aout_SpawnThread( aout_thread_t * p_aout )
         intf_ErrMsg("aout error: not enough memory to create the output buffer\n");
         return( -1 );
     }
-    if ( (p_aout->s32_buffer = (s32 *)calloc(p_aout->l_units, sizeof(s32) << p_aout->dsp.b_stereo)) == NULL )
+    if ( (p_aout->s32_buffer = (s32 *)calloc(p_aout->l_units, sizeof(s32) << p_aout->sys.b_stereo)) == NULL )
     {
         intf_ErrMsg("aout error: not enough memory to create the s32 output buffer\n");
         free( p_aout->buffer );
@@ -284,8 +319,8 @@ void aout_DestroyThread( aout_thread_t * p_aout, int *pi_status )
     free( p_aout->s32_buffer );
 
     /* Free the structure */
-    aout_dspClose( &p_aout->dsp );
-    intf_DbgMsg("aout debug: audio device (%s) closed\n", p_aout->dsp.psz_device);
+    p_aout->p_sys_close( &p_aout->sys );
+    intf_DbgMsg("aout debug: audio device (%s) closed\n", p_aout->sys.psz_device);
     free( p_aout );
 }
 
@@ -327,7 +362,7 @@ aout_fifo_t * aout_CreateFifo( aout_thread_t * p_aout, aout_fifo_t * p_fifo )
             p_aout->fifo[i_fifo].buffer = p_fifo->buffer;
 
             p_aout->fifo[i_fifo].l_unit = 0;
-            InitializeIncrement( &p_aout->fifo[i_fifo].unit_increment, p_fifo->l_rate, p_aout->dsp.l_rate );
+            InitializeIncrement( &p_aout->fifo[i_fifo].unit_increment, p_fifo->l_rate, p_aout->sys.l_rate );
             p_aout->fifo[i_fifo].l_units = p_fifo->l_units;
             break;
 
@@ -495,11 +530,11 @@ static __inline__ int NextFrame( aout_thread_t * p_aout, aout_fifo_t * p_fifo, m
     l_rate = p_fifo->l_rate + ((aout_date - p_fifo->date[p_fifo->l_start_frame]) / 256);
 //    fprintf( stderr, "aout debug: %lli (%li);\n", aout_date - p_fifo->date[p_fifo->l_start_frame], l_rate );
 
-    InitializeIncrement( &p_fifo->unit_increment, l_rate, p_aout->dsp.l_rate );
+    InitializeIncrement( &p_fifo->unit_increment, l_rate, p_aout->sys.l_rate );
 
     p_fifo->l_units = (((l_units - (p_fifo->l_unit -
         (p_fifo->l_start_frame * (p_fifo->l_frame_size >> p_fifo->b_stereo))))
-        * p_aout->dsp.l_rate) / l_rate) + 1;
+        * p_aout->sys.l_rate) / l_rate) + 1;
 
     /* We release the lock before leaving */
     vlc_mutex_unlock( &p_fifo->data_lock );
@@ -550,7 +585,7 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
                     if ( p_aout->fifo[i_fifo].l_units > p_aout->l_units )
                    {
                         l_buffer = 0;
-                        while ( l_buffer < (p_aout->l_units << 1) ) /* p_aout->dsp.b_stereo == 1 */
+                        while ( l_buffer < (p_aout->l_units << 1) ) /* p_aout->sys.b_stereo == 1 */
                        {
                             p_aout->s32_buffer[l_buffer++] +=
                                 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[p_aout->fifo[i_fifo].l_unit] );
@@ -563,7 +598,7 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
                     else
                    {
                         l_buffer = 0;
-                        while ( l_buffer < (p_aout->fifo[i_fifo].l_units << 1) ) /* p_aout->dsp.b_stereo == 1 */
+                        while ( l_buffer < (p_aout->fifo[i_fifo].l_units << 1) ) /* p_aout->sys.b_stereo == 1 */
                        {
                             p_aout->s32_buffer[l_buffer++] +=
                                 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[p_aout->fifo[i_fifo].l_unit] );
@@ -581,7 +616,7 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
                     if ( p_aout->fifo[i_fifo].l_units > p_aout->l_units )
                    {
                         l_buffer = 0;
-                        while ( l_buffer < (p_aout->l_units << 1) ) /* p_aout->dsp.b_stereo == 1 */
+                        while ( l_buffer < (p_aout->l_units << 1) ) /* p_aout->sys.b_stereo == 1 */
                        {
                             p_aout->s32_buffer[l_buffer++] +=
                                 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[2*p_aout->fifo[i_fifo].l_unit] );
@@ -594,7 +629,7 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
                     else
                    {
                         l_buffer = 0;
-                        while ( l_buffer < (p_aout->fifo[i_fifo].l_units << 1) ) /* p_aout->dsp.b_stereo */
+                        while ( l_buffer < (p_aout->fifo[i_fifo].l_units << 1) ) /* p_aout->sys.b_stereo */
                        {
                             p_aout->s32_buffer[l_buffer++] +=
                                 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[2*p_aout->fifo[i_fifo].l_unit] );
@@ -624,7 +659,7 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
                     {
                         if ( !p_aout->fifo[i_fifo].b_next_frame )
                         {
-                            if ( NextFrame(p_aout, &p_aout->fifo[i_fifo], p_aout->date + ((((mtime_t)(l_buffer >> 1)) * 1000000) / ((mtime_t)p_aout->dsp.l_rate))) )
+                            if ( NextFrame(p_aout, &p_aout->fifo[i_fifo], p_aout->date + ((((mtime_t)(l_buffer >> 1)) * 1000000) / ((mtime_t)p_aout->sys.l_rate))) )
                             {
                                 break;
                             }
@@ -632,7 +667,7 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
 
                         if ( p_aout->fifo[i_fifo].l_units > l_units )
                         {
-                            l_buffer_limit = p_aout->l_units << 1; /* p_aout->dsp.b_stereo == 1 */
+                            l_buffer_limit = p_aout->l_units << 1; /* p_aout->sys.b_stereo == 1 */
                             while ( l_buffer < l_buffer_limit )
                             {
                                 p_aout->s32_buffer[l_buffer++] +=
@@ -654,7 +689,7 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
                         else
                         {
                             l_buffer_limit = l_buffer + (p_aout->fifo[i_fifo].l_units << 1);
-                            /* p_aout->dsp.b_stereo == 1 */
+                            /* p_aout->sys.b_stereo == 1 */
                             while ( l_buffer < l_buffer_limit )
                             {
                                 p_aout->s32_buffer[l_buffer++] +=
@@ -701,7 +736,7 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
                     {
                         if ( !p_aout->fifo[i_fifo].b_next_frame )
                         {
-                            if ( NextFrame(p_aout, &p_aout->fifo[i_fifo], p_aout->date + ((((mtime_t)(l_buffer >> 1)) * 1000000) / ((mtime_t)p_aout->dsp.l_rate))) )
+                            if ( NextFrame(p_aout, &p_aout->fifo[i_fifo], p_aout->date + ((((mtime_t)(l_buffer >> 1)) * 1000000) / ((mtime_t)p_aout->sys.l_rate))) )
                             {
                                 break;
                             }
@@ -709,7 +744,7 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
 
                         if ( p_aout->fifo[i_fifo].l_units > l_units )
                         {
-                            l_buffer_limit = p_aout->l_units << 1; /* p_aout->dsp.b_stereo == 1 */
+                            l_buffer_limit = p_aout->l_units << 1; /* p_aout->sys.b_stereo == 1 */
                             while ( l_buffer < l_buffer_limit )
                             {
                                 p_aout->s32_buffer[l_buffer++] +=
@@ -731,7 +766,7 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
                         else
                         {
                             l_buffer_limit = l_buffer + (p_aout->fifo[i_fifo].l_units << 1);
-                            /* p_aout->dsp.b_stereo == 1 */
+                            /* p_aout->sys.b_stereo == 1 */
                             while ( l_buffer < l_buffer_limit )
                             {
                                 p_aout->s32_buffer[l_buffer++] +=
@@ -769,7 +804,7 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
         }
         vlc_mutex_unlock( &p_aout->fifos_lock );
 
-        l_buffer_limit = p_aout->l_units << 1; /* p_aout->dsp.b_stereo == 1 */
+        l_buffer_limit = p_aout->l_units << 1; /* p_aout->sys.b_stereo == 1 */
 
         for ( l_buffer = 0; l_buffer < l_buffer_limit; l_buffer++ )
        {
@@ -777,10 +812,9 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
             p_aout->s32_buffer[l_buffer] = 0;
         }
 
-        aout_dspGetBufInfo( &p_aout->dsp );
-        l_bytes = (p_aout->dsp.buf_info.fragstotal * p_aout->dsp.buf_info.fragsize) - p_aout->dsp.buf_info.bytes;
-        p_aout->date = mdate() + ((((mtime_t)(l_bytes / 4)) * 1000000) / ((mtime_t)p_aout->dsp.l_rate)); /* sizeof(s16) << p_aout->dsp.b_stereo == 4 */
-        aout_dspPlaySamples( &p_aout->dsp, (byte_t *)p_aout->buffer, l_buffer_limit * sizeof(s16) );
+        l_bytes = p_aout->p_sys_getbufinfo( &p_aout->sys );
+        p_aout->date = mdate() + ((((mtime_t)(l_bytes / 4)) * 1000000) / ((mtime_t)p_aout->sys.l_rate)); /* sizeof(s16) << p_aout->sys.b_stereo == 4 */
+        p_aout->p_sys_playsamples( &p_aout->sys, (byte_t *)p_aout->buffer, l_buffer_limit * sizeof(s16) );
         if ( l_bytes > (l_buffer_limit * sizeof(s16)) )
         {
             msleep( p_aout->l_msleep );
index c73942b68a5b6866e3ce5596380ed3d91808a6a0..ae7009c18ceb29665dc338a476b929fc0b693393 100644 (file)
@@ -130,14 +130,14 @@ intf_thread_t* intf_Create( void )
 #ifdef VIDEO_BEOS
     else if( !strcmp(psz_method, "beos") )
     {
-        p_intf->p_sys_create =    intf_BeSysCreate;
-        p_intf->p_sys_manage =    intf_BeSysManage;
-        p_intf->p_sys_destroy =   intf_BeSysDestroy;
+        p_intf->p_sys_create =    intf_BSysCreate;
+        p_intf->p_sys_manage =    intf_BSysManage;
+        p_intf->p_sys_destroy =   intf_BSysDestroy;
     }
 #endif
     else
     {
-        intf_ErrMsg( "error: video output method not available\n" );
+        intf_ErrMsg( "error: requested video output method not available\n" );
         free( p_intf );
         return( NULL );
     }
index dc3078aa65a11702d4ef6e726005fa69c313dfaa..3846ff034b5db6306182bb51f42efb15c73a9a15 100644 (file)
  *****************************************************************************/
 #include "vlc.h"
 #include <sys/stat.h>
-/*??#include <errno.h>
-#include <fcntl.h>
-#include <netinet/in.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/soundcard.h>
-#include <sys/uio.h>
-
-#include "config.h"
-#include "common.h"
-#include "mtime.h"
-#include "vlc_thread.h"
-#include "debug.h"
-
-#include "intf_msg.h"
-
-#include "input.h"
-#include "input_ctrl.h"
-#include "input_vlan.h"
-#include "input_psi.h"
-#include "input_netlist.h"
-#include "decoder_fifo.h"
-
-#include "audio_output.h"
-#include "audio_decoder.h"
-
-#include "video.h"
-#include "video_output.h"
-#include "video_graphics.h"
-#include "video_decoder.h"
-
-#include "xconsole.h"
-#include "interface.h"
-#include "intf_cmd.h"
-#include "control.h"
-#include "intf_ctrl.h"
-
-#include "pgm_data.h"
-*/
 
 /*
  * Local prototypes
@@ -382,8 +341,8 @@ static int PlayAudio( int i_argc, intf_arg_t *p_argv )
     }
     close( i_fd );
 
-   /* Now we can work out how many output units we can compute with the fifo */
-    fifo.l_units = (long)(((s64)fifo.l_units*(s64)p_main->p_aout->dsp.l_rate)/(s64)fifo.l_rate);
+    /* Now we can work out how many output units we can compute with the fifo */
+    fifo.l_units = (long)(((s64)fifo.l_units*(s64)p_main->p_aout->sys.l_rate)/(s64)fifo.l_rate);
 
     /* Create the fifo */
     if ( aout_CreateFifo(p_main->p_aout, &fifo) == NULL )
index 0fa13334e40d82da3e00a68da05c1e55c2fb9eeb..c82a0fd4ba7bbc270ed3f3f13ae920e66540c477 100644 (file)
@@ -144,12 +144,12 @@ vout_thread_t * vout_CreateThread   ( char *psz_display, int i_root_window,
 #endif
 #ifdef VIDEO_BEOS
         case VOUT_BEOS_METHOD:
-            p_vout->p_sys_create =    vout_BeSysCreate;
-            p_vout->p_sys_init =      vout_BeSysInit;
-            p_vout->p_sys_end =       vout_BeSysEnd;
-            p_vout->p_sys_destroy =   vout_BeSysDestroy;
-            p_vout->p_sys_manage =    vout_BeSysManage;
-            p_vout->p_sys_display =   vout_BeSysDisplay;
+            p_vout->p_sys_create =    vout_BSysCreate;
+            p_vout->p_sys_init =      vout_BSysInit;
+            p_vout->p_sys_end =       vout_BSysEnd;
+            p_vout->p_sys_destroy =   vout_BSysDestroy;
+            p_vout->p_sys_manage =    vout_BSysManage;
+            p_vout->p_sys_display =   vout_BSysDisplay;
             break;
 #endif
         default: