]> git.sesse.net Git - vlc/blobdiff - plugins/sdl/aout_sdl.c
* Fixed a total breakage of decoder plugins introduced by fast_memcpy.
[vlc] / plugins / sdl / aout_sdl.c
index d16f59e4ff404e2fa46cf26a34dd2a59036135e3..4f35c0558ee89d58b94738831131f84b792e5b9d 100644 (file)
@@ -1,7 +1,8 @@
 /*****************************************************************************
  * aout_sdl.c : audio sdl functions library
  *****************************************************************************
- * Copyright (C) 1999, 2000 VideoLAN
+ * Copyright (C) 1999-2001 VideoLAN
+ * $Id: aout_sdl.c,v 1.20 2001/12/07 18:33:08 sam Exp $
  *
  * Authors: Michel Kaempf <maxx@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -22,6 +23,9 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  *****************************************************************************/
 
+#define MODULE_NAME sdl
+#include "modules_inner.h"
+
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
 
 #include <errno.h>                                                 /* ENOMEM */
 #include <fcntl.h>                                       /* open(), O_WRONLY */
-#include <sys/ioctl.h>                                            /* ioctl() */
 #include <string.h>                                            /* strerror() */
 #include <unistd.h>                                      /* write(), close() */
 #include <stdio.h>                                           /* "intf_msg.h" */
 #include <stdlib.h>                            /* calloc(), malloc(), free() */
 
-#include <SDL/SDL.h>                                     /* SDL base include */
+#include SDL_INCLUDE_FILE
 
-#include "config.h"
 #include "common.h"                                     /* boolean_t, byte_t */
+#include "intf_msg.h"                        /* intf_DbgMsg(), intf_ErrMsg() */
 #include "threads.h"
 #include "mtime.h"
 #include "tests.h"
 
 #include "audio_output.h"                                   /* aout_thread_t */
 
-#include "intf_msg.h"                        /* intf_DbgMsg(), intf_ErrMsg() */
-#include "main.h"
-
 #include "modules.h"
+#include "modules_export.h"
 
 /*****************************************************************************
  * aout_sys_t: dsp audio output method descriptor
@@ -86,7 +87,7 @@ static void    aout_SDLCallback ( void *userdata, Uint8 *stream, int len );
  * Functions exported as capabilities. They are declared as static so that
  * we don't pollute the namespace too much.
  *****************************************************************************/
-void aout_getfunctions( function_list_t * p_function_list )
+void _M( aout_getfunctions )( function_list_t * p_function_list )
 {
     p_function_list->pf_probe = aout_Probe;
     p_function_list->functions.aout.pf_open = aout_Open;
@@ -104,9 +105,9 @@ void aout_getfunctions( function_list_t * p_function_list )
  *****************************************************************************/
 static int aout_Probe( probedata_t *p_data )
 {
+#if 0
     SDL_AudioSpec desired, obtained;
 
-    return 0;
     /* Start AudioSDL */
     if( SDL_Init(SDL_INIT_AUDIO | SDL_INIT_NOPARACHUTE) != 0 )
     {
@@ -117,7 +118,7 @@ static int aout_Probe( probedata_t *p_data )
     desired.freq       = 11025;                                 /* frequency */
     desired.format     = AUDIO_U8;                        /* unsigned 8 bits */
     desired.channels   = 2;                                          /* mono */
-    desired.callback   = NULL;                   /* no callback function yet */
+    desired.callback   = aout_SDLCallback;    /* callback function mandatory */
     desired.userdata   = NULL;                     /* null parm for callback */
     desired.samples    = 4096;
 
@@ -130,7 +131,9 @@ static int aout_Probe( probedata_t *p_data )
     }
 
     /* Otherwise, there are good chances we can use this plugin, return 100. */
+    intf_DbgMsg( "aout: SDL_OpenAudio successfully run" );
     SDL_CloseAudio();
+#endif
 
     if( TestMethod( AOUT_METHOD_VAR, "sdl" ) )
     {
@@ -233,6 +236,8 @@ static int aout_SetFormat( aout_thread_t *p_aout )
     p_aout->p_sys->b_active = 1;
     SDL_PauseAudio( 0 );
 
+    p_aout->i_latency = 0;
+    
     return( 0 );
 }