]> git.sesse.net Git - vlc/blobdiff - modules/misc/dummy/aout.c
Lua_ext: fix race condition.
[vlc] / modules / misc / dummy / aout.c
index 20c45aa9d4845bdf96f47b784a7fbdbaf920b12b..e988e1928e4d75e3113fbe87d293bd448d3aa9bd 100644 (file)
@@ -1,16 +1,16 @@
 /*****************************************************************************
- * aout_dummy.c : dummy audio output plugin
+ * aout.c : dummy audio output plugin
  *****************************************************************************
- * Copyright (C) 2000, 2001 VideoLAN
- * $Id: aout.c,v 1.1 2002/08/04 17:23:43 sam Exp $
+ * Copyright (C) 2002 the VideoLAN team
+ * $Id$
  *
- * Authors: Samuel Hocevar <sam@zoy.org>
+ * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#include <string.h>
 
-#include <vlc/vlc.h>
-#include <vlc/aout.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
+#include <vlc_aout.h>
+
+#include "dummy.h"
+
+#define FRAME_SIZE 2048
+#define A52_FRAME_NB 1536
 
 /*****************************************************************************
  * Local prototypes.
  *****************************************************************************/
-static int     SetFormat   ( aout_thread_t * );
-static int     GetBufInfo  ( aout_thread_t *, int );
-static void    Play        ( aout_thread_t *, byte_t *, int );
+static void    Play        ( aout_instance_t * );
 
 /*****************************************************************************
- * OpenAudio: opens a dummy audio device
+ * OpenAudio: open a dummy audio device
  *****************************************************************************/
-int E_(OpenAudio) ( vlc_object_t *p_this )
+int OpenAudio ( vlc_object_t * p_this )
 {
-    aout_thread_t * p_aout = (aout_thread_t *)p_this;
+    aout_instance_t * p_aout = (aout_instance_t *)p_this;
 
-    p_aout->pf_setformat = SetFormat;
-    p_aout->pf_getbufinfo = GetBufInfo;
-    p_aout->pf_play = Play;
+    p_aout->output.pf_play = Play;
+    aout_VolumeSoftInit( p_aout );
 
-    return VLC_SUCCESS;
-}
+    if ( p_aout->output.output.i_format == VLC_CODEC_SPDIFL )
+    {
+        p_aout->output.i_nb_samples = A52_FRAME_NB;
+        p_aout->output.output.i_bytes_per_frame = AOUT_SPDIF_SIZE;
+        p_aout->output.output.i_frame_length = A52_FRAME_NB;
+    }
+    else
+    {
+        p_aout->output.i_nb_samples = FRAME_SIZE;
+    }
 
-/*****************************************************************************
- * SetFormat: pretends to set the dsp output format
- *****************************************************************************/
-static int SetFormat( aout_thread_t *p_aout )
-{
-    return( 0 );
-}
+    /* Create the variable for the audio-device */
+    var_Create( p_aout, "audio-device", VLC_VAR_INTEGER | VLC_VAR_HASCHOICE );
 
-/*****************************************************************************
- * GetBufInfo: returns available bytes in buffer
- *****************************************************************************/
-static int GetBufInfo( aout_thread_t *p_aout, int i_buffer_limit )
-{
-    return( sizeof(s16) * i_buffer_limit + 1 ); /* value big enough to sleep */
+    return VLC_SUCCESS;
 }
 
 /*****************************************************************************
- * Play: pretends to play a sound
+ * Play: pretend to play a sound
  *****************************************************************************/
-static void Play( aout_thread_t *p_aout, byte_t *buffer, int i_size )
+static void Play( aout_instance_t * p_aout )
 {
-    ;
+    aout_buffer_t * p_buffer = aout_FifoPop( p_aout, &p_aout->output.fifo );
+    aout_BufferFree( p_buffer );
 }