]> git.sesse.net Git - vlc/blobdiff - src/spu_decoder/spu_decoder.c
* Fixed a segfault in the SPU decoder initialization.
[vlc] / src / spu_decoder / spu_decoder.c
index 651d04ffc386970db13bf4ecb98ed53d44eb3c19..0079117009a13b799071691da0f2446f4276b84a 100644 (file)
@@ -2,7 +2,7 @@
  * spu_decoder.c : spu decoder thread
  *****************************************************************************
  * Copyright (C) 2000 VideoLAN
- * $Id: spu_decoder.c,v 1.36 2001/04/25 09:31:14 sam Exp $
+ * $Id: spu_decoder.c,v 1.39 2001/05/01 12:22:18 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -27,6 +27,9 @@
 #include "defs.h"
 
 #include <unistd.h>                                              /* getpid() */
+#ifdef WIN32                   /* getpid() for win32 is located in process.h */
+#include <process.h>
+#endif
 
 #include <stdlib.h>                                      /* malloc(), free() */
 #include <string.h>                                    /* memcpy(), memset() */
@@ -46,6 +49,8 @@
 
 #include "spu_decoder.h"
 
+#include "main.h" /* XXX: remove this later */
+
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
@@ -80,10 +85,20 @@ vlc_thread_t spudec_CreateThread( vdec_config_t * p_config )
      * Initialize the thread properties
      */
     p_spudec->p_config = p_config;
+
     p_spudec->p_fifo = p_config->decoder_config.p_decoder_fifo;
 
-    /* Get the video output informations */
-    p_spudec->p_vout = p_config->p_vout;
+    /* XXX: The vout request and fifo opening will eventually be here */
+    if( p_spudec->p_vout == NULL )
+    {
+        if( p_main->p_vout == NULL )
+        {
+            intf_Msg( "vpar: no vout present, spawning one" );
+            p_main->p_vout = vout_CreateThread( NULL );
+        }
+
+        p_spudec->p_vout = p_main->p_vout;
+    }
 
     /* Spawn the spu decoder thread */
     if ( vlc_thread_create(&p_spudec->thread_id, "spu decoder",
@@ -110,7 +125,7 @@ static int InitThread( spudec_thread_t *p_spudec )
 {
     p_spudec->p_config->decoder_config.pf_init_bit_stream(
             &p_spudec->bit_stream,
-            p_spudec->p_config->decoder_config.p_decoder_fifo );
+            p_spudec->p_config->decoder_config.p_decoder_fifo, NULL, NULL );
 
     /* Mark thread as running and return */
     return( 0 );