]> git.sesse.net Git - vlc/commitdiff
* ./modules/audio_output/*: ported the ALSA, aRts, esd and OSS modules to
authorSam Hocevar <sam@videolan.org>
Mon, 19 Aug 2002 23:07:30 +0000 (23:07 +0000)
committerSam Hocevar <sam@videolan.org>
Mon, 19 Aug 2002 23:07:30 +0000 (23:07 +0000)
    the latest aout3 changes.

modules/audio_output/alsa.c
modules/audio_output/arts.c
modules/audio_output/esd.c
modules/audio_output/file.c
modules/audio_output/oss.c

index a8da821ac3b88066ce5d0fb8d362c2059d245319..7718a4e7442f96dfcd5e1703dd49b43a92b54217 100644 (file)
@@ -2,7 +2,7 @@
  * alsa.c : alsa plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: alsa.c,v 1.5 2002/08/19 21:31:11 massiot Exp $
+ * $Id: alsa.c,v 1.6 2002/08/19 23:07:30 sam Exp $
  *
  * Authors: Henri Fallon <henri@videolan.org> - Original Author
  *          Jeffrey Baker <jwbaker@acm.org> - Port to ALSA 1.0 API
@@ -88,8 +88,8 @@ static void ALSAFill     ( aout_instance_t * );
  * Module descriptor
  *****************************************************************************/
 vlc_module_begin();
-    add_category_hint( N_("Audio"), NULL );
-    add_string( "alsa-device", NULL, NULL, N_("Name"), NULL );
+    add_category_hint( N_("ALSA"), NULL );
+    add_string( "alsa-device", NULL, NULL, N_("device name"), NULL );
     set_description( _("ALSA audio module") );
     set_capability( "audio output", 50 );
     set_callbacks( Open, Close );
@@ -234,9 +234,8 @@ static int SetFormat( aout_instance_t * p_aout )
             p_sys->b_can_sleek = VLC_TRUE;
             i_format = SND_PCM_FORMAT_S16_LE;
             i_channels = 2;
-            p_aout->output.output.i_bytes_per_sec =
-                    p_aout->output.output.i_rate * AOUT_SPDIF_SIZE /
-                    ALSA_SPDIF_PERIOD_SIZE;
+            p_aout->output.output.i_bytes_per_frame = AOUT_SPDIF_SIZE;
+            p_aout->output.output.i_frame_length = ALSA_SPDIF_PERIOD_SIZE;
             break;
         case AOUT_FMT_FIXED32:
         default:
index 19f5a8149f59f80575aa2d0f8f1dfc2f177015f8..e92dd3ae79914d78d6bcca028861bbe015e1c5c5 100644 (file)
@@ -159,8 +159,9 @@ static int SetFormat( aout_instance_t *p_aout )
 /*****************************************************************************
  * Play: queue a buffer for playing by aRtsThread
  *****************************************************************************/
-static void Play( aout_instance_t *p_aout );
+static void Play( aout_instance_t *p_aout )
 {
+    ;
 }
 
 /*****************************************************************************
@@ -213,9 +214,8 @@ static int aRtsThread( aout_instance_t * p_aout )
         }
         else
         {
-            i_size = aout_FormatToByterate( &p_aout->output.output )
-                      * p_sys->i_size
-                      / p_aout->output.output.i_rate;
+            i_size = p_sys->i_size / p_aout->output.output.i_frame_length
+                      * p_aout->output.output.i_bytes_per_frame;
             p_bytes = alloca( i_size );
             memset( p_bytes, 0, i_size );
         }
index 33e91c45ffdac1e1a1ad867c658c75969f79f431..cbf8130117b8311153dfe3edca1f1eed54958551 100644 (file)
@@ -2,7 +2,7 @@
  * esd.c : EsounD module
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: esd.c,v 1.7 2002/08/19 21:31:11 massiot Exp $
+ * $Id: esd.c,v 1.8 2002/08/19 23:07:30 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -147,10 +147,14 @@ static int SetFormat( aout_instance_t *p_aout )
      * number of buffered samples, so I assume ESD_BUF_SIZE/2 */
     p_sys->latency =
         (mtime_t)( esd_get_latency( esd_open_sound(NULL) ) + ESD_BUF_SIZE/2
-                    * aout_FormatToByterate( &p_aout->output.output )
+                    * p_aout->output.output.i_bytes_per_frame
+                    * p_aout->output.output.i_rate
+                    / p_aout->output.output.i_frame_length
                     / ESD_DEFAULT_RATE )
       * (mtime_t)1000000
-      / (mtime_t)aout_FormatToByterate( &p_aout->output.output );
+      / p_aout->output.output.i_bytes_per_frame
+      / p_aout->output.output.i_rate
+      * p_aout->output.output.i_frame_length;
 
     p_sys->b_initialized = VLC_TRUE;
 
@@ -209,9 +213,9 @@ static int ESDThread( aout_instance_t * p_aout )
         }
         else
         {
-            i_size = aout_FormatToByterate( &p_aout->output.output )
-                      * ESD_BUF_SIZE * 2
-                      / p_aout->output.output.i_rate;
+            i_size = ESD_BUF_SIZE * 2
+                      / p_aout->output.output.i_frame_length
+                      * p_aout->output.output.i_bytes_per_frame;
             p_bytes = alloca( i_size );
             memset( p_bytes, 0, i_size );
         }
index 564aa0336e9295dcdfe624d2993d4c664f1ccc9c..cd5ddfbb065a1fd6fe02a631fdd7f3a6f0a707af 100644 (file)
@@ -2,7 +2,7 @@
  * file.c : audio output which writes the samples to a file
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: file.c,v 1.6 2002/08/19 21:31:11 massiot Exp $
+ * $Id: file.c,v 1.7 2002/08/19 23:07:30 sam Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -47,7 +47,7 @@ static void    Play        ( aout_instance_t * );
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
-#define FORMAT_TEXT N_("Output format")
+#define FORMAT_TEXT N_("output format")
 #define FORMAT_LONGTEXT N_("one of \"u8\", \"s8\", \"u16\", \"s16\"," \
                            " \"u16_le\", \"s16_le\", \"u16_be\"," \
                            " \"s16_be\", \"fixed32\", \"float32\" or \"spdif\"")
@@ -60,7 +60,7 @@ static int format_int[] = { AOUT_FMT_U8, AOUT_FMT_S8, AOUT_FMT_U16_NE,
                             AOUT_FMT_U16_BE, AOUT_FMT_S16_BE, AOUT_FMT_FIXED32,
                             AOUT_FMT_FLOAT32, AOUT_FMT_SPDIF };
 
-#define PATH_TEXT N_("Path of the output file")
+#define PATH_TEXT N_("path of the output file")
 #define PATH_LONGTEXT N_("By default samples.raw")
 
 vlc_module_begin();
index 7e2e1f21b67f32cdd5a807d03076eb246787e5b1..fbb166fb60504b8a9a30b406bb63e6cb2afa2719 100644 (file)
@@ -2,7 +2,7 @@
  * oss.c : OSS /dev/dsp module for vlc
  *****************************************************************************
  * Copyright (C) 2000-2002 VideoLAN
- * $Id: oss.c,v 1.11 2002/08/19 21:31:11 massiot Exp $
+ * $Id: oss.c,v 1.12 2002/08/19 23:07:30 sam Exp $
  *
  * Authors: Michel Kaempf <maxx@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -82,7 +82,7 @@ static int  OSSThread    ( aout_instance_t * );
  * Module descriptor
  *****************************************************************************/
 vlc_module_begin();
-    add_category_hint( N_("Audio"), NULL );
+    add_category_hint( N_("OSS"), NULL );
     add_file( "dspdev", "/dev/dsp", NULL, N_("OSS dsp device"), NULL );
     set_description( _("Linux OSS /dev/dsp module") );
     set_capability( "audio output", 100 );
@@ -132,6 +132,7 @@ static int Open( vlc_object_t *p_this )
     if( vlc_thread_create( p_aout, "aout", OSSThread, VLC_FALSE ) )
     {
         msg_Err( p_aout, "cannot create OSS thread (%s)", strerror(errno) );
+        close( p_sys->i_fd );
         free( psz_device );
         free( p_sys );
         return -1;
@@ -309,14 +310,16 @@ static int OSSThread( aout_instance_t * p_aout )
              * Order is important here, since GetBufInfo is believed to take
              * more time than mdate(). */
             next_date = (mtime_t)GetBufInfo( p_aout ) * 1000000
-                      / aout_FormatToByterate( &p_aout->output.output );
+                      / p_aout->output.output.i_bytes_per_frame
+                      / p_aout->output.output.i_rate
+                      * p_aout->output.output.i_frame_length;
             next_date += mdate();
 
-            p_buffer = aout_OutputNextBuffer( p_aout, next_date, 0 );
+            p_buffer = aout_OutputNextBuffer( p_aout, next_date, VLC_FALSE );
         }
         else
         {
-            p_buffer = aout_OutputNextBuffer( p_aout, 0, 1 );
+            p_buffer = aout_OutputNextBuffer( p_aout, 0, VLC_TRUE );
         }
 
         if ( p_buffer != NULL )
@@ -326,9 +329,8 @@ static int OSSThread( aout_instance_t * p_aout )
         }
         else
         {
-            i_size = aout_FormatToByterate( &p_aout->output.output )
-                      * FRAME_SIZE
-                      / p_aout->output.output.i_rate;
+            i_size = FRAME_SIZE / p_aout->output.output.i_frame_length
+                      * p_aout->output.output.i_bytes_per_frame;
             p_bytes = alloca( i_size );
             memset( p_bytes, 0, i_size );
         }