]> git.sesse.net Git - vlc/commitdiff
Fin du remplacement des pthread + ajout du frame rate dans display.c.
authorJean-Marc Dressler <polux@videolan.org>
Wed, 8 Dec 1999 16:01:40 +0000 (16:01 +0000)
committerJean-Marc Dressler <polux@videolan.org>
Wed, 8 Dec 1999 16:01:40 +0000 (16:01 +0000)
Polux

23 files changed:
src/audio_decoder/audio_decoder.c
src/audio_decoder/audio_math.c
src/audio_output/audio_dsp.c
src/audio_output/audio_output.c
src/generic_decoder/generic_decoder.c
src/input/input.c
src/input/input_ctrl.c
src/input/input_file.c
src/input/input_netlist.c
src/input/input_network.c
src/input/input_pcr.c
src/input/input_psi.c
src/input/input_vlan.c
src/interface/control.c
src/interface/interface.c
src/interface/intf_cmd.c
src/interface/intf_ctrl.c
src/interface/intf_msg.c
src/interface/main.c
src/interface/xconsole.c
src/video_decoder/video_decoder.c
src/video_output/video_output.c
src/video_output/video_x11.c

index d09ebaa9bb21c65b4713f2acd7282b81e864812e..ece18682d30366c50bc291e4f37dfd4401fcdcd1 100644 (file)
@@ -13,7 +13,6 @@
  ******************************************************************************/
 #include <unistd.h>
 
-#include <pthread.h>
 #include <stdio.h>                                            /* "intf_msg.h" */
 #include <stdlib.h>                                       /* malloc(), free() */
 #include <netinet/in.h>                                            /* ntohl() */
@@ -23,6 +22,7 @@
 #include "common.h"
 #include "config.h"
 #include "mtime.h"
+#include "vlc_thread.h"
 #include "debug.h"                                       /* "input_netlist.h" */
 
 #include "intf_msg.h"                         /* intf_DbgMsg(), intf_ErrMsg() */
@@ -85,8 +85,8 @@ adec_thread_t * adec_CreateThread( input_thread_t * p_input )
      */
     /* Initialize the decoder fifo's data lock and conditional variable and set
      * its buffer as empty */
-    pthread_mutex_init( &p_adec->fifo.data_lock, NULL );
-    pthread_cond_init( &p_adec->fifo.data_wait, NULL );
+    vlc_mutex_init( &p_adec->fifo.data_lock );
+    vlc_cond_init( &p_adec->fifo.data_wait );
     p_adec->fifo.i_start = 0;
     p_adec->fifo.i_end = 0;
     /* Initialize the bit stream structure */
@@ -110,7 +110,7 @@ adec_thread_t * adec_CreateThread( input_thread_t * p_input )
     p_adec->p_aout_fifo = NULL;
 
     /* Spawn the audio decoder thread */
-    if ( pthread_create(&p_adec->thread_id, NULL, (void *)RunThread, (void *)p_adec) )
+    if ( vlc_thread_create(&p_adec->thread_id, "audio decoder", (vlc_thread_func)RunThread, (void *)p_adec) )
     {
         intf_ErrMsg("adec error: can't spawn audio decoder thread\n");
         free( p_adec );
@@ -137,13 +137,13 @@ void adec_DestroyThread( adec_thread_t * p_adec )
     /* Ask thread to kill itself */
     p_adec->b_die = 1;
     /* Make sure the decoder thread leaves the GetByte() function */
-    pthread_mutex_lock( &(p_adec->fifo.data_lock) );
-    pthread_cond_signal( &(p_adec->fifo.data_wait) );
-    pthread_mutex_unlock( &(p_adec->fifo.data_lock) );
+    vlc_mutex_lock( &(p_adec->fifo.data_lock) );
+    vlc_cond_signal( &(p_adec->fifo.data_wait) );
+    vlc_mutex_unlock( &(p_adec->fifo.data_lock) );
 
     /* Waiting for the decoder thread to exit */
     /* Remove this as soon as the "status" flag is implemented */
-    pthread_join( p_adec->thread_id, NULL );
+    vlc_thread_join( p_adec->thread_id );
 }
 
 /* Following functions are local */
@@ -702,14 +702,14 @@ static int InitThread( adec_thread_t * p_adec )
 
     /* Our first job is to initialize the bit stream structure with the
      * beginning of the input stream */
-    pthread_mutex_lock( &p_adec->fifo.data_lock );
+    vlc_mutex_lock( &p_adec->fifo.data_lock );
     while ( DECODER_FIFO_ISEMPTY(p_adec->fifo) )
     {
-        pthread_cond_wait( &p_adec->fifo.data_wait, &p_adec->fifo.data_lock );
+        vlc_cond_wait( &p_adec->fifo.data_wait, &p_adec->fifo.data_lock );
     }
     p_adec->bit_stream.p_ts = DECODER_FIFO_START( p_adec->fifo )->p_first_ts;
     p_adec->bit_stream.i_byte = p_adec->bit_stream.p_ts->i_payload_start;
-    pthread_mutex_unlock( &p_adec->fifo.data_lock );
+    vlc_mutex_unlock( &p_adec->fifo.data_lock );
 
     /* Now we look for an audio frame header in the input stream */
     if ( FindHeader(p_adec) )
@@ -836,7 +836,7 @@ static void RunThread( adec_thread_t * p_adec )
 
                     /* Waiting until there is enough free space in the audio output fifo
                      * in order to store the new decoded frames */
-                    pthread_mutex_lock( &p_adec->p_aout_fifo->data_lock );
+                    vlc_mutex_lock( &p_adec->p_aout_fifo->data_lock );
                     /* adec_Layer2_Stereo() produces 6 output frames (2*1152/384)...
                      * If these 6 frames were recorded in the audio output fifo, the
                      * l_end_frame index would be incremented 6 times. But, if after
@@ -844,14 +844,14 @@ static void RunThread( adec_thread_t * p_adec )
                      * it would mean that we had not enough room to store the 6 frames :-P */
                     while ( (((p_adec->p_aout_fifo->l_end_frame + 6) - p_adec->p_aout_fifo->l_start_frame) & AOUT_FIFO_SIZE) < 6 ) /* !! */
                     {
-                        pthread_cond_wait( &p_adec->p_aout_fifo->data_wait, &p_adec->p_aout_fifo->data_lock );
+                        vlc_cond_wait( &p_adec->p_aout_fifo->data_wait, &p_adec->p_aout_fifo->data_lock );
                     }
-                    pthread_mutex_unlock( &p_adec->p_aout_fifo->data_lock );
+                    vlc_mutex_unlock( &p_adec->p_aout_fifo->data_lock );
 
                     /* Decoding the frames */
                     if ( adec_Layer2_Stereo(p_adec) )
                     {
-                        pthread_mutex_lock( &p_adec->p_aout_fifo->data_lock );
+                        vlc_mutex_lock( &p_adec->p_aout_fifo->data_lock );
                         /* Frame 1 */
                         if ( DECODER_FIFO_START(p_adec->fifo)->b_has_pts )
                         {
@@ -878,7 +878,7 @@ static void RunThread( adec_thread_t * p_adec )
                         /* Frame 6 */
                         p_adec->p_aout_fifo->date[p_adec->p_aout_fifo->l_end_frame] = LAST_MDATE;
                         p_adec->p_aout_fifo->l_end_frame = (p_adec->p_aout_fifo->l_end_frame + 1) & AOUT_FIFO_SIZE;
-                        pthread_mutex_unlock( &p_adec->p_aout_fifo->data_lock );
+                        vlc_mutex_unlock( &p_adec->p_aout_fifo->data_lock );
                     }
                 }
                 break;
@@ -926,7 +926,7 @@ static void ErrorThread( adec_thread_t *p_adec )
 {
     /* We take the lock, because we are going to read/write the start/end
      * indexes of the decoder fifo */
-    pthread_mutex_lock( &p_adec->fifo.data_lock );
+    vlc_mutex_lock( &p_adec->fifo.data_lock );
 
     /* Wait until a `die' order is sent */
     while( !p_adec->b_die )
@@ -939,11 +939,11 @@ static void ErrorThread( adec_thread_t *p_adec )
         }
 
         /* Waiting for the input thread to put new PES packets in the fifo */
-        pthread_cond_wait( &p_adec->fifo.data_wait, &p_adec->fifo.data_lock );
+        vlc_cond_wait( &p_adec->fifo.data_wait, &p_adec->fifo.data_lock );
     }
 
     /* We can release the lock before leaving */
-    pthread_mutex_unlock( &p_adec->fifo.data_lock );
+    vlc_mutex_unlock( &p_adec->fifo.data_lock );
 }
 
 /******************************************************************************
index 203f6e4e37bfc88fb3c5144bdfc718610caffb84..00675db0ad8e6f26f30145dea45d2f82ca4f4e2e 100644 (file)
 #include <stdlib.h>                                       /* malloc(), free() */
 #include <netinet/in.h>                                            /* ntohl() */
 #include <sys/soundcard.h>                                /* "audio_output.h" */
-#include <pthread.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"                         /* intf_DbgMsg(), intf_ErrMsg() */
index 074846ab8746a803e712fe0a5a5250d7c366537c..7a9059f78d92b41a12fe47c0de21727580ac333f 100644 (file)
@@ -15,7 +15,6 @@
 /******************************************************************************
  * Preamble
  ******************************************************************************/
-#include <pthread.h>
 #include <fcntl.h>                                        /* open(), O_WRONLY */
 #include <sys/ioctl.h>                                             /* ioctl() */
 #include <unistd.h>                                       /* write(), close() */
@@ -24,6 +23,7 @@
 
 #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"
index 5c9f1047488b6709c3dc11a24467fdf1a6f47d68..d4bf1534f2a6ece29a3c814da6895840031059b2 100644 (file)
@@ -12,7 +12,7 @@
  *     à chaque boucle
  *   = Utiliser des tables pour les gros calculs
  * - Faire une structure différente pour intf/adec fifo
- * - Rajouter des pthread_cond_signal ?
+ * - Rajouter des vlc_cond_signal ?
  *
  */
 
@@ -21,7 +21,6 @@
  ******************************************************************************/
 #include <unistd.h>
 
-#include <pthread.h>
 #include <sys/soundcard.h>
 #include <stdio.h>                                            /* "intf_msg.h" */
 #include <stdlib.h>                             /* calloc(), malloc(), free() */
@@ -29,6 +28,7 @@
 #include "common.h"
 #include "config.h"
 #include "mtime.h"                              /* mtime_t, mdate(), msleep() */
+#include "vlc_thread.h"
 
 #include "intf_msg.h"                         /* intf_DbgMsg(), intf_ErrMsg() */
 
@@ -112,13 +112,13 @@ int aout_SpawnThread( aout_thread_t * p_aout )
     p_aout->b_die = 0;
 
     /* Initialize the fifos lock */
-    pthread_mutex_init( &p_aout->fifos_lock, NULL );
+    vlc_mutex_init( &p_aout->fifos_lock );
     /* Initialize audio fifos : set all fifos as empty and initialize locks */
     for ( i_fifo = 0; i_fifo < AOUT_MAX_FIFOS; i_fifo++ )
     {
         p_aout->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO;
-        pthread_mutex_init( &p_aout->fifo[i_fifo].data_lock, NULL );
-        pthread_cond_init( &p_aout->fifo[i_fifo].data_wait, NULL );
+        vlc_mutex_init( &p_aout->fifo[i_fifo].data_lock );
+        vlc_cond_init( &p_aout->fifo[i_fifo].data_wait );
     }
 
     /* Compute the size (in audio units) of the audio output buffer. Although
@@ -239,7 +239,7 @@ int aout_SpawnThread( aout_thread_t * p_aout )
     p_aout->date = mdate();
 
     /* Launch the thread */
-    if ( pthread_create( &p_aout->thread_id, NULL, aout_thread, p_aout ) )
+    if ( vlc_thread_create( &p_aout->thread_id, "audio output", (vlc_thread_func)aout_thread, p_aout ) )
     {
         intf_ErrMsg("aout error: can't spawn audio output thread (%p)\n", p_aout);
         free( p_aout->buffer );
@@ -260,7 +260,7 @@ void aout_CancelThread( aout_thread_t * p_aout )
 
     /* Ask thread to kill itself and wait until it's done */
     p_aout->b_die = 1;
-    pthread_join( p_aout->thread_id, NULL );
+    vlc_thread_join( p_aout->thread_id );
 
     /* Free the allocated memory */
     free( p_aout->buffer );
@@ -284,7 +284,7 @@ aout_fifo_t * aout_CreateFifo( aout_thread_t * p_aout, aout_fifo_t * p_fifo )
     int i_fifo;
 
     /* Take the fifos lock */
-    pthread_mutex_lock( &p_aout->fifos_lock );
+    vlc_mutex_lock( &p_aout->fifos_lock );
 
     /* Looking for a free fifo structure */
     for ( i_fifo = 0; i_fifo < AOUT_MAX_FIFOS; i_fifo++ )
@@ -297,7 +297,7 @@ aout_fifo_t * aout_CreateFifo( aout_thread_t * p_aout, aout_fifo_t * p_fifo )
     if ( i_fifo == AOUT_MAX_FIFOS )
     {
         intf_ErrMsg("aout error: no empty fifo available\n");
-        pthread_mutex_unlock( &p_aout->fifos_lock );
+        vlc_mutex_unlock( &p_aout->fifos_lock );
         return( NULL );
     }
 
@@ -333,7 +333,7 @@ aout_fifo_t * aout_CreateFifo( aout_thread_t * p_aout, aout_fifo_t * p_fifo )
            {
                 intf_ErrMsg("aout error: not enough memory to create the frames buffer\n");
                 p_aout->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO;
-               pthread_mutex_unlock( &p_aout->fifos_lock );
+               vlc_mutex_unlock( &p_aout->fifos_lock );
                return( NULL );
            }
 
@@ -343,7 +343,7 @@ aout_fifo_t * aout_CreateFifo( aout_thread_t * p_aout, aout_fifo_t * p_fifo )
                 intf_ErrMsg("aout error: not enough memory to create the dates buffer\n");
                 free( p_aout->fifo[i_fifo].buffer );
                 p_aout->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO;
-                pthread_mutex_unlock( &p_aout->fifos_lock );
+                vlc_mutex_unlock( &p_aout->fifos_lock );
                 return( NULL );
             }
 
@@ -365,12 +365,12 @@ aout_fifo_t * aout_CreateFifo( aout_thread_t * p_aout, aout_fifo_t * p_fifo )
         default:
             intf_ErrMsg("aout error: unknown fifo type (%i)\n", p_aout->fifo[i_fifo].i_type);
             p_aout->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO;
-            pthread_mutex_unlock( &p_aout->fifos_lock );
+            vlc_mutex_unlock( &p_aout->fifos_lock );
             return( NULL );
     }
 
     /* Release the fifos lock */
-    pthread_mutex_unlock( &p_aout->fifos_lock );
+    vlc_mutex_unlock( &p_aout->fifos_lock );
 
     /* Return the pointer to the fifo structure */
     intf_DbgMsg("aout debug: audio output fifo (%p) allocated\n", &p_aout->fifo[i_fifo]);
@@ -431,7 +431,7 @@ static __inline__ int NextFrame( aout_thread_t * p_aout, aout_fifo_t * p_fifo/*,
     long l_units, l_rate;
 
     /* We take the lock */
-    pthread_mutex_lock( &p_fifo->data_lock );
+    vlc_mutex_lock( &p_fifo->data_lock );
 
     /* Are we looking for a dated start frame ? */
     if ( !p_fifo->b_start_frame )
@@ -448,7 +448,7 @@ static __inline__ int NextFrame( aout_thread_t * p_aout, aout_fifo_t * p_fifo/*,
         }
         if ( p_fifo->l_start_frame == p_fifo->l_end_frame )
         {
-            pthread_mutex_unlock( &p_fifo->data_lock );
+            vlc_mutex_unlock( &p_fifo->data_lock );
             return( -1 );
         }
     }
@@ -456,7 +456,7 @@ static __inline__ int NextFrame( aout_thread_t * p_aout, aout_fifo_t * p_fifo/*,
     if ( aout_date < p_fifo->date[p_fifo->l_start_frame] )
     {
         fprintf(stderr, "+");
-        pthread_mutex_unlock( &p_fifo->data_lock );
+        vlc_mutex_unlock( &p_fifo->data_lock );
         return( -1 );
     }
 */
@@ -496,7 +496,7 @@ static __inline__ int NextFrame( aout_thread_t * p_aout, aout_fifo_t * p_fifo/*,
             /* p_fifo->b_next_frame = 0; */
             p_fifo->l_end_frame = 0;
         }
-        pthread_mutex_unlock( &p_fifo->data_lock );
+        vlc_mutex_unlock( &p_fifo->data_lock );
         return( -1 );
     }
 
@@ -513,7 +513,7 @@ static __inline__ int NextFrame( aout_thread_t * p_aout, aout_fifo_t * p_fifo/*,
         * p_aout->dsp.l_rate) / l_rate) + 1;
 
     /* We release the lock before leaving */
-    pthread_mutex_unlock( &p_fifo->data_lock );
+    vlc_mutex_unlock( &p_fifo->data_lock );
     return( 0 );
 }
 
@@ -549,7 +549,7 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
      * memory to zero and we can immediately jump into the thread's loop */
     while ( !p_aout->b_die )
     {
-        pthread_mutex_lock( &p_aout->fifos_lock );
+        vlc_mutex_lock( &p_aout->fifos_lock );
         for ( i_fifo = 0; i_fifo < AOUT_MAX_FIFOS; i_fifo++ )
        {
             switch ( p_aout->fifo[i_fifo].i_type )
@@ -674,10 +674,10 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
                             }
                             l_units -= p_aout->fifo[i_fifo].l_units;
 
-                            pthread_mutex_lock( &p_aout->fifo[i_fifo].data_lock );
+                            vlc_mutex_lock( &p_aout->fifo[i_fifo].data_lock );
                             p_aout->fifo[i_fifo].l_start_frame = p_aout->fifo[i_fifo].l_next_frame;
-                            pthread_cond_signal( &p_aout->fifo[i_fifo].data_wait );
-                            pthread_mutex_unlock( &p_aout->fifo[i_fifo].data_lock );
+                            vlc_cond_signal( &p_aout->fifo[i_fifo].data_wait );
+                            vlc_mutex_unlock( &p_aout->fifo[i_fifo].data_lock );
 
                             /* p_aout->fifo[i_fifo].b_start_frame = 1; */
                             p_aout->fifo[i_fifo].l_next_frame += 1;
@@ -742,10 +742,10 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
                             }
                             l_units -= p_aout->fifo[i_fifo].l_units;
 
-                            pthread_mutex_lock( &p_aout->fifo[i_fifo].data_lock );
+                            vlc_mutex_lock( &p_aout->fifo[i_fifo].data_lock );
                             p_aout->fifo[i_fifo].l_start_frame = p_aout->fifo[i_fifo].l_next_frame;
-                            pthread_cond_signal( &p_aout->fifo[i_fifo].data_wait );
-                            pthread_mutex_unlock( &p_aout->fifo[i_fifo].data_lock );
+                            vlc_cond_signal( &p_aout->fifo[i_fifo].data_wait );
+                            vlc_mutex_unlock( &p_aout->fifo[i_fifo].data_lock );
 
                             /* p_aout->fifo[i_fifo].b_start_frame = 1; */
                             p_aout->fifo[i_fifo].l_next_frame += 1;
@@ -760,7 +760,7 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
                     break;
             }
         }
-        pthread_mutex_unlock( &p_aout->fifos_lock );
+        vlc_mutex_unlock( &p_aout->fifos_lock );
 
         l_buffer_limit = p_aout->l_units << 1; /* p_aout->dsp.b_stereo == 1 */
 
@@ -790,7 +790,7 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
         UPDATE_INCREMENT( p_aout->date_increment, p_aout->date )
     }
 
-    pthread_mutex_lock( &p_aout->fifos_lock );
+    vlc_mutex_lock( &p_aout->fifos_lock );
     for ( i_fifo = 0; i_fifo < AOUT_MAX_FIFOS; i_fifo++ )
     {
         switch ( p_aout->fifo[i_fifo].i_type )
@@ -817,7 +817,7 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
                 break;
         }
     }
-    pthread_mutex_unlock( &p_aout->fifos_lock );
+    vlc_mutex_unlock( &p_aout->fifos_lock );
 }
 
 void aout_Thread_U16_Mono( aout_thread_t * p_aout )
index 89a74ac99fe7c9a3dc2d8633d718083989666b14..2653a27cc2dc3807a432f78bf7c314168d506817 100644 (file)
@@ -16,7 +16,6 @@
  * Preamble
  *******************************************************************************/
 #include <errno.h>
-#include <pthread.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
@@ -28,6 +27,7 @@
 #include "config.h"
 #include "common.h"
 #include "mtime.h"
+#include "vlc_thread.h"
 #include "thread.h"
 
 #include "intf_msg.h"
@@ -100,7 +100,7 @@ gdec_thread_t * gdec_CreateThread( gdec_cfg_t *p_cfg, input_thread_t *p_input,
     p_gdec->b_active = 1;
 
     /* Create thread */
-    if( pthread_create( &p_gdec->thread_id, NULL, (void *) RunThread, (void *) p_gdec) )
+    if( vlc_thread_create( &p_gdec->thread_id, "generic decoder", (vlc_thread_func)RunThread, (void *) p_gdec) )
     {
         intf_ErrMsg("gdec error: %s\n", strerror(ENOMEM));
         intf_DbgMsg("failed\n");        
@@ -145,9 +145,9 @@ void gdec_DestroyThread( gdec_thread_t *p_gdec, int *pi_status )
     /* Request thread destruction */
     p_gdec->b_die = 1;
     /* Make sure the decoder thread leaves the GetByte() function */
-    pthread_mutex_lock( &(p_gdec->fifo.data_lock) );
-    pthread_cond_signal( &(p_gdec->fifo.data_wait) );
-    pthread_mutex_unlock( &(p_gdec->fifo.data_lock) );
+    vlc_mutex_lock( &(p_gdec->fifo.data_lock) );
+    vlc_cond_signal( &(p_gdec->fifo.data_wait) );
+    vlc_mutex_unlock( &(p_gdec->fifo.data_lock) );
 
     /* If status is NULL, wait until thread has been destroyed */
     if( pi_status )
index eaf1278bd262492894d487852cfdf7abcd86275b..b5fa1b42d4e164daaae102b065725bdb2b6be058 100644 (file)
@@ -10,7 +10,6 @@
  * Preamble
  ******************************************************************************/
 #include <errno.h>
-#include <pthread.h>
 #include <sys/uio.h>                                                 /* iovec */
 #include <string.h>
 
@@ -27,6 +26,7 @@
 #include "common.h"
 #include "config.h"
 #include "mtime.h"
+#include "vlc_thread.h"
 #include "intf_msg.h"
 #include "debug.h"
 
@@ -186,13 +186,13 @@ input_thread_t *input_CreateThread( input_cfg_t *p_cfg )
 
     /* Create thread and set locks. */
     p_input->b_die = 0;
-    pthread_mutex_init( &p_input->netlist.lock, NULL );
-    pthread_mutex_init( &p_input->programs_lock, NULL );
-    pthread_mutex_init( &p_input->es_lock, NULL );
+    vlc_mutex_init( &p_input->netlist.lock );
+    vlc_mutex_init( &p_input->programs_lock );
+    vlc_mutex_init( &p_input->es_lock );
 #ifdef NO_THREAD
     input_Thread( p_input );
 #else
-    if( pthread_create(&p_input->thread_id, NULL, (void *) input_Thread, 
+    if( vlc_thread_create(&p_input->thread_id, "input", (vlc_thread_func)input_Thread, 
                        (void *) p_input) )
     {
         intf_ErrMsg("input error: can't spawn input thread (%s)\n", 
@@ -223,7 +223,7 @@ void input_DestroyThread( input_thread_t *p_input )
     p_input->b_die = 1;                          /* ask thread to kill itself */
 
     /* Remove this as soon as the "status" flag is implemented */
-    pthread_join( p_input->thread_id, NULL );         /* wait until it's done */
+    vlc_thread_join( p_input->thread_id );            /* wait until it's done */
 }
 
 #if 0
@@ -304,7 +304,7 @@ static void input_Thread( input_thread_t *p_input )
     EndThread( p_input );
 
     intf_DbgMsg("input debug: thread %p destroyed\n", p_input);
-    pthread_exit( 0 );
+    vlc_thread_exit( 0 );
 }
 
 
@@ -458,7 +458,7 @@ static __inline__ int input_ReadPacket( input_thread_t *p_input )
     /* Remove the TS packets we have just filled from the netlist */
 #ifdef INPUT_LIFO_TS_NETLIST
     /* We need to take a lock here while we're calculating index positions. */
-    pthread_mutex_lock( &p_input->netlist.lock );
+    vlc_mutex_lock( &p_input->netlist.lock );
 
     i_meanwhile_released = i_base_index - p_input->netlist.i_ts_index;
     if( i_meanwhile_released )
@@ -498,7 +498,7 @@ static __inline__ int input_ReadPacket( input_thread_t *p_input )
         p_input->netlist.i_ts_index = i_current_index;
     }
 
-    pthread_mutex_unlock( &p_input->netlist.lock );
+    vlc_mutex_unlock( &p_input->netlist.lock );
 
 #else /* FIFO netlist */
     /* & is modulo ; that's where we make the loop. */
@@ -538,7 +538,7 @@ static __inline__ void input_SortPacket( input_thread_t *p_input,
 //                    i_current_pid, p_ts_packet);
 
         /* Lock current ES state. */
-        pthread_mutex_lock( &p_input->es_lock );
+        vlc_mutex_lock( &p_input->es_lock );
         
        /* Verify that we actually want this PID. */
         for( i_es_loop = 0; i_es_loop < INPUT_MAX_SELECTED_ES; i_es_loop++ )
@@ -553,7 +553,7 @@ static __inline__ void input_SortPacket( input_thread_t *p_input,
                        modified from inside the input_thread (by the PSI
                        decoder): interface thread is only allowed to modify
                        the pp_selected_es table */
-                    pthread_mutex_unlock( &p_input->es_lock );
+                    vlc_mutex_unlock( &p_input->es_lock );
 
                     /* We're interested. Pass it to the demultiplexer. */
                     input_DemuxTS( p_input, p_ts_packet,
@@ -567,7 +567,7 @@ static __inline__ void input_SortPacket( input_thread_t *p_input,
                 break;
             }
         }
-        pthread_mutex_unlock( &p_input->es_lock );
+        vlc_mutex_unlock( &p_input->es_lock );
     }
 
     /* We weren't interested in receiving this packet. Give it back to the
@@ -705,16 +705,6 @@ static __inline__ void input_DemuxTS( input_thread_t *p_input,
             intf_DbgMsg("Duplicate packet received by TS demux\n");
             b_trash = 1;
         }
-        else if( p_es_descriptor->i_continuity_counter == 0xFF )
-        {
-            /* This means that the packet is the first one we receive for this
-               ES since the continuity counter ranges between 0 and 0x0F
-               excepts when it has been initialized by the input: Init the 
-               counter to the correct value. */
-            intf_DbgMsg("First packet for PID %d received by TS demux\n",
-                        p_es_descriptor->i_id);
-            p_es_descriptor->i_continuity_counter = (p[3] & 0x0f);
-        }
         else
         {
             /* This can indicate that we missed a packet or that the
@@ -841,7 +831,7 @@ static __inline__ void input_DemuxPES( input_thread_t *p_input,
                      so the PES won't be usefull for any decoder. Moreover,
                      this should never happen so we can trash the packet and
                      exit roughly without regrets */
-                  intf_DbgMsg("PES packet is too short: trashed\n");
+                  intf_DbgMsg("PES packet too short: trashed\n");
                   input_NetlistFreePES( p_input, p_pes );
                   p_pes = NULL;
                   /* Stats ?? */
@@ -915,7 +905,7 @@ static __inline__ void input_DemuxPES( input_thread_t *p_input,
                     pcr_descriptor_t * p_pcr;
 
                     p_pcr = p_input->p_pcr;
-                    pthread_mutex_lock( &p_pcr->lock );
+                    vlc_mutex_lock( &p_pcr->lock );
                     if( p_pcr->delta_clock == 0 )
                     {
                         p_pes->b_has_pts = 0;
@@ -935,7 +925,7 @@ static __inline__ void input_DemuxPES( input_thread_t *p_input,
                         p_pes->i_pts += p_pcr->delta_decode;
                         p_pcr->c_pts += 1;
                     }
-                    pthread_mutex_unlock( &p_pcr->lock );
+                    vlc_mutex_unlock( &p_pcr->lock );
                 }
                 break;
             }
@@ -982,7 +972,7 @@ static __inline__ void input_DemuxPES( input_thread_t *p_input,
 
             if( p_fifo != NULL )
             {
-                pthread_mutex_lock( &p_fifo->data_lock );
+                vlc_mutex_lock( &p_fifo->data_lock );
                 if( DECODER_FIFO_ISFULL( *p_fifo ) )
                 {
                     /* The FIFO is full !!! This should not happen. */
@@ -1002,9 +992,9 @@ static __inline__ void input_DemuxPES( input_thread_t *p_input,
                     DECODER_FIFO_INCEND( *p_fifo );
 
                     /* Warn the decoder that it's got work to do. */
-                    pthread_cond_signal( &p_fifo->data_wait );
+                    vlc_cond_signal( &p_fifo->data_wait );
                 }
-                pthread_mutex_unlock( &p_fifo->data_lock );
+                vlc_mutex_unlock( &p_fifo->data_lock );
             }
             else
             {
index 1ce5bb21d0b0909b22d91ee6e99ae850a046b9d1..d276e7308671c695128ffc8001499fec4b0bbe9b 100644 (file)
@@ -10,7 +10,6 @@
  * Preamble
  *******************************************************************************/
 #include <errno.h>
-#include <pthread.h>
 #include <sys/uio.h>                                                 /* iovec */
 #include <stdlib.h>                               /* atoi(), malloc(), free() */
 #include <string.h>
@@ -25,6 +24,7 @@
 #include "common.h"
 #include "config.h"
 #include "mtime.h"
+#include "vlc_thread.h"
 #include "intf_msg.h"
 #include "debug.h"
 
@@ -56,7 +56,7 @@ int input_AddPgrmElem( input_thread_t *p_input, int i_current_id )
     
     /* Since this function is intended to be called by interface, lock the
      * elementary stream structure. */
-    pthread_mutex_lock( &p_input->es_lock );
+    vlc_mutex_lock( &p_input->es_lock );
 
     /* Find out which PID we need. */
     for( i_es_loop = 0; i_es_loop < INPUT_MAX_ES; i_es_loop++ )
@@ -66,7 +66,7 @@ int input_AddPgrmElem( input_thread_t *p_input, int i_current_id )
             if( p_input->p_es[i_es_loop].p_dec != NULL )
             {
                 /* We already have a decoder for that PID. */
-                pthread_mutex_unlock( &p_input->es_lock );
+                vlc_mutex_unlock( &p_input->es_lock );
                 intf_ErrMsg("input error: PID %d already selected\n",
                             i_current_id);
                 return( -1 );
@@ -82,7 +82,7 @@ int input_AddPgrmElem( input_thread_t *p_input, int i_current_id )
             if( i_selected_es_loop == INPUT_MAX_SELECTED_ES )
             {
                 /* array full */
-                pthread_mutex_unlock( &p_input->es_lock );
+                vlc_mutex_unlock( &p_input->es_lock );
                 intf_ErrMsg("input error: MAX_SELECTED_ES reached: try increasing it in config.h\n");
                 return( -1 );
             }
@@ -91,7 +91,7 @@ int input_AddPgrmElem( input_thread_t *p_input, int i_current_id )
             if( p_input->p_es[i_es_loop].b_psi )
             {
                 intf_ErrMsg("input_error: trying to decode PID %d which is the one of a PSI\n");
-                pthread_mutex_unlock( &p_input->es_lock );
+                vlc_mutex_unlock( &p_input->es_lock );
                 return( -1 );
             }
             else
@@ -106,7 +106,7 @@ int input_AddPgrmElem( input_thread_t *p_input, int i_current_id )
                             adec_CreateThread( p_input )) == NULL )
                         {
                             intf_ErrMsg("Could not start audio decoder\n");
-                            pthread_mutex_unlock( &p_input->es_lock );
+                            vlc_mutex_unlock( &p_input->es_lock );
                             return( -1 );
                         }
                         break;
@@ -119,7 +119,7 @@ int input_AddPgrmElem( input_thread_t *p_input, int i_current_id )
                             vdec_CreateThread( p_input )) == NULL )
                         {
                             intf_ErrMsg("Could not start video decoder\n");
-                            pthread_mutex_unlock( &p_input->es_lock );
+                            vlc_mutex_unlock( &p_input->es_lock );
                             return( -1 );
                         }
                         break;
@@ -128,27 +128,27 @@ int input_AddPgrmElem( input_thread_t *p_input, int i_current_id )
                         /* That should never happen. */
                         intf_DbgMsg("input error: unknown stream type (%d)\n",
                                     p_input->p_es[i_es_loop].i_type);
-                        pthread_mutex_unlock( &p_input->es_lock );
+                        vlc_mutex_unlock( &p_input->es_lock );
                         return( -1 );
                         break;
                 }
 
                 /* Initialise the demux */
                 p_input->p_es[i_es_loop].p_pes_packet = NULL;
-                p_input->p_es[i_es_loop].i_continuity_counter = 0xFF;
+                p_input->p_es[i_es_loop].i_continuity_counter = 0;
                 p_input->p_es[i_es_loop].b_random = 0;
                
                 /* Mark stream to be demultiplexed. */
                 intf_DbgMsg("Stream %d added in %d\n", i_current_id, i_selected_es_loop);
                 p_input->pp_selected_es[i_selected_es_loop] = &p_input->p_es[i_es_loop];
-                pthread_mutex_unlock( &p_input->es_lock );
+                vlc_mutex_unlock( &p_input->es_lock );
                 return( 0 );
             }
         }
     }
     
     /* We haven't found this PID in the current stream. */
-    pthread_mutex_unlock( &p_input->es_lock );
+    vlc_mutex_unlock( &p_input->es_lock );
     intf_ErrMsg("input error: can't find PID %d\n", i_current_id);
     return( -1 );
 }
@@ -167,7 +167,7 @@ int input_DelPgrmElem( input_thread_t *p_input, int i_current_id )
 
     /* Since this function is intended to be called by interface, lock the
        structure. */
-    pthread_mutex_lock( &p_input->es_lock );
+    vlc_mutex_lock( &p_input->es_lock );
 
     /* Find out which PID we need. */
     for( i_selected_es_loop = 0; i_selected_es_loop < INPUT_MAX_SELECTED_ES;
@@ -180,7 +180,7 @@ int input_DelPgrmElem( input_thread_t *p_input, int i_current_id )
                 if( !(p_input->pp_selected_es[i_selected_es_loop]->p_dec) )
                 {
                     /* We don't have a decoder for that PID. */
-                    pthread_mutex_unlock( &p_input->es_lock );
+                    vlc_mutex_unlock( &p_input->es_lock );
                     intf_ErrMsg("input error: PID %d already deselected\n",
                                 i_current_id);
                     return( -1 );
@@ -217,14 +217,14 @@ int input_DelPgrmElem( input_thread_t *p_input, int i_current_id )
                             p_input->pp_selected_es[i_last_selected];
                 p_input->pp_selected_es[i_last_selected] = NULL;
 
-                pthread_mutex_unlock( &p_input->es_lock );
+                vlc_mutex_unlock( &p_input->es_lock );
                 return( 0 );
             }
         }
     }
 
     /* We haven't found this PID in the current stream. */
-    pthread_mutex_unlock( &p_input->es_lock );
+    vlc_mutex_unlock( &p_input->es_lock );
     intf_ErrMsg("input error: can't find PID %d\n", i_current_id);
     return( -1 );
 }
@@ -244,7 +244,7 @@ boolean_t input_IsElemRecv( input_thread_t *p_input, int i_id )
 
    /* Since this function is intended to be called by interface, lock the
        structure. */
-    pthread_mutex_lock( &p_input->es_lock );
+    vlc_mutex_lock( &p_input->es_lock );
 
     /* Scan the table */
     while( i_index < INPUT_MAX_SELECTED_ES && !p_input->pp_selected_es[i_index] )
@@ -257,7 +257,7 @@ boolean_t input_IsElemRecv( input_thread_t *p_input, int i_id )
     }
 
     /* Unlock the structure */
-    pthread_mutex_unlock( &p_input->es_lock );
+    vlc_mutex_unlock( &p_input->es_lock );
 
     return( b_is_recv );
 }
index b078c87d9bd0fac4c6a710cda8aa5fd79d821769..fecc8d0f398933a58f95e62d13c9908cccda6bd0 100644 (file)
@@ -6,12 +6,12 @@
 /*******************************************************************************
  * Preamble
  *******************************************************************************/
-#include <pthread.h>
 #include <sys/uio.h>
 
 #include "common.h"
 #include "config.h"
 #include "mtime.h"
+#include "vlc_thread.h"
 
 #include "input.h"
 #include "input_file.h"
index caf3b3efc4f6a54d77a8afb710e9c3ebd82943bf..d6875e1476257ed55fc935d3e1f1cc1116124140 100644 (file)
@@ -8,7 +8,6 @@
 /*******************************************************************************
  * Preamble
  *******************************************************************************/
-#include <pthread.h>
 #include <sys/uio.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -18,6 +17,7 @@
 #include "common.h"
 #include "config.h"
 #include "mtime.h"
+#include "vlc_thread.h"
 #include "intf_msg.h"
 #include "debug.h"
 #include "input.h"
index d1cf219b53c2f2702d2e557a7b74dcb73e8b5151..45dfb47b4548f1b78fc01ced25d4472259a42d01 100644 (file)
@@ -8,7 +8,6 @@
 /*******************************************************************************
  * Preamble
  *******************************************************************************/
-#include <pthread.h>
 #include <sys/uio.h>
 #include <string.h>
 #include <stdio.h>
@@ -24,6 +23,7 @@
 #include "common.h"
 #include "config.h"
 #include "mtime.h"
+#include "vlc_thread.h"
 #include "netutils.h"
 
 #include "input.h"
index 289778ae9f697279fdf303764ebaa8ab511e60ba..575defb100daf1dc7392ecea84c5a6f88c461026 100644 (file)
@@ -9,7 +9,6 @@
  * Preamble
  *******************************************************************************/
 #include <stdio.h>
-#include <pthread.h>
 #include <sys/uio.h>                                                 /* iovec */
 #include <stdlib.h>                               /* atoi(), malloc(), free() */
 #include <netinet/in.h>
@@ -17,6 +16,7 @@
 #include "config.h"
 #include "common.h"
 #include "mtime.h"
+#include "vlc_thread.h"
 #include "debug.h"
 #include "input.h"
 #include "intf_msg.h"
@@ -54,7 +54,7 @@ int input_PcrInit( input_thread_t *p_input )
     {
         return( -1 );
     }
-    pthread_mutex_init( &p_input->p_pcr->lock, NULL );
+    vlc_mutex_init( &p_input->p_pcr->lock );
     input_PcrReInit(p_input);
     
     return( 0 );
@@ -81,7 +81,7 @@ void input_PcrDecode( input_thread_t *p_input, es_descriptor_t *p_es,
     sys_time = mdate();
     delta_clock = sys_time - pcr_time;
     
-    pthread_mutex_lock( &p_pcr->lock );
+    vlc_mutex_lock( &p_pcr->lock );
     
     if( p_es->b_discontinuity ||
         ( p_pcr->last_pcr != 0 && 
@@ -106,7 +106,7 @@ void input_PcrDecode( input_thread_t *p_input, es_descriptor_t *p_es,
         p_pcr->c_average++;
     }
 
-    pthread_mutex_unlock( &p_pcr->lock );
+    vlc_mutex_unlock( &p_pcr->lock );
     
 #ifdef STATS
     {
index f883fe7e64330fb53b991baa458d1ef298257d36..54ac3cc070d9ad0ec534566adadd1be882a97fbe 100644 (file)
@@ -10,7 +10,6 @@
  * Preamble
  ******************************************************************************/
 #include <errno.h>
-#include <pthread.h>
 #include <stdio.h>
 #include <sys/uio.h>                                                 /* iovec */
 #include <stdlib.h>                               /* atoi(), malloc(), free() */
@@ -23,6 +22,7 @@
 #include "common.h"
 #include "config.h"
 #include "mtime.h"
+#include "vlc_thread.h"
 #include "intf_msg.h"
 #include "debug.h"
 
@@ -163,7 +163,7 @@ void input_PsiRead( input_thread_t *p_input /* ??? */ )
   ASSERT( p_input );
  
   /* Lock the tables, since this method can be called from any thread */
-  //pthread_mutex_lock()
+  //vlc_mutex_lock()
 
   /* Check if the table is complete or not */
   if( !p_input->p_stream->b_is_PMT_complete )
@@ -195,7 +195,7 @@ void input_PsiRead( input_thread_t *p_input /* ??? */ )
   }
 
   /* Unock the tables */
-  //pthread_mutex_unlock()
+  //vlc_mutex_unlock()
 }
 
 /******************************************************************************
@@ -566,7 +566,7 @@ static void DecodePgrmMapSection( u8* p_pms, input_thread_t* p_input )
             intf_DbgMsg("ES Type: %d\n", p_pms[i_offset]);
 
             /* Read PID of that ES */
-            i_es_pid = U16_AT(&p_pms[i_offset+1]) & 0x1FFF;
+            i_es_pid = U16_AT(&p_pms[i_offset+1]) & 0x1FF;
             intf_DbgMsg("ES PID: %d\n", i_es_pid);
 
             /* Add the ES to the program description and reserve a slot in the
@@ -880,7 +880,7 @@ static int input_AddPsiPID( input_thread_t *p_input, int i_pid )
       /* Ask the input thread to demultiplex it: since the interface
          can also access the table of selected es, lock the elementary
          stream structure */
-      pthread_mutex_lock( &p_input->es_lock );
+      vlc_mutex_lock( &p_input->es_lock );
       for( i_index = 0; i_index < INPUT_MAX_SELECTED_ES; i_index++ )
       {
         if( !p_input->pp_selected_es[i_index] )
@@ -891,7 +891,7 @@ static int input_AddPsiPID( input_thread_t *p_input, int i_pid )
           break;
         }
       }
-      pthread_mutex_unlock( &p_input->es_lock );
+      vlc_mutex_unlock( &p_input->es_lock );
 
       if( i_index >= INPUT_MAX_SELECTED_ES )
       {
@@ -922,7 +922,7 @@ static int input_DelPsiPID( input_thread_t *p_input, int i_pid )
 
   /* Stop to receive the ES. Since the interface can also access the table
      of selected es, lock the elementary stream structure */
-  pthread_mutex_lock( &p_input->es_lock );
+  vlc_mutex_lock( &p_input->es_lock );
   
   for( i_es_index = 0; i_es_index < INPUT_MAX_SELECTED_ES; i_es_index++ )
   {
@@ -942,7 +942,7 @@ static int input_DelPsiPID( input_thread_t *p_input, int i_pid )
     }
   }
 
-  pthread_mutex_unlock( &p_input->es_lock );
+  vlc_mutex_unlock( &p_input->es_lock );
 
 #ifdef DEBUG
   /* Check if the pp_selected_es table may be corrupted */
@@ -1167,7 +1167,7 @@ static pgrm_descriptor_t* AddPgrmDescr( stream_descriptor_t* p_stream,
 }
 
 /******************************************************************************
- * DestroyPgrmDescr: destroy a program descriptor
+ * AddPgrmDescr: destroy a program descriptor
  ******************************************************************************
  * All ES descriptions referenced in the descriptor will be deleted.
  ******************************************************************************/
@@ -1253,7 +1253,6 @@ static es_descriptor_t* AddESDescr(input_thread_t* p_input,
     p_es->i_type = 0;  /* ??? */
     p_es->b_psi = 0;
     p_es->b_pcr = 0;
-    p_es->i_continuity_counter = 0xFF;
     
     p_es->p_pes_packet = NULL;
 //    p_es->p_next_pes_packet = NULL;
@@ -1270,7 +1269,7 @@ static es_descriptor_t* AddESDescr(input_thread_t* p_input,
                    i_es_pid, p_pgrm->i_number );
     }
     else
-      intf_DbgMsg( "ES %d not added to the definition of any pgrm\n",
+      intf_DbgMsg( "Added ES %d not added to the definition of any pgrm\n",
                    i_es_pid );
   }
   
index d5d911b0c47ae50df9aa7d45ff1e535d6951fecb..d4db14ceb96e30f4be6511f700fb5efeaae8bf0a 100644 (file)
@@ -29,7 +29,6 @@
  * Preamble
  *******************************************************************************/
 #include <errno.h>
-#include <pthread.h>
 #include <unistd.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -46,6 +45,7 @@
 #include "config.h"
 #include "common.h"
 #include "mtime.h"
+#include "vlc_thread.h"
 #include "netutils.h"
 
 #include "input.h"
@@ -172,7 +172,7 @@ int input_VlanMethodInit( input_vlan_method_t *p_method, char *psz_server, int i
     }      
 
     /* Initialize lock */
-    pthread_mutex_init( &p_method->lock, NULL );
+    vlc_mutex_init( &p_method->lock );
 
     intf_Msg("input: vlans input method installed\n", p_method->i_ifaces);
     return( 0 );    
@@ -270,7 +270,7 @@ int input_VlanJoin( int i_vlan_id )
     }
     
     /* Get lock */
-    pthread_mutex_lock( &p_method->lock );
+    vlc_mutex_lock( &p_method->lock );
     
     /* If the interface is in the wished vlan, increase lock counter */
     if( p_iface->i_vlan != VLAN_ID_VLAN( i_vlan_id ) )
@@ -301,7 +301,7 @@ int input_VlanJoin( int i_vlan_id )
     }                    
 
     /* Release lock (if this point is reached, the function succeeded) */
-    pthread_mutex_unlock( &p_method->lock );       
+    vlc_mutex_unlock( &p_method->lock );       
     return( i_err );    
 }
 
@@ -327,13 +327,13 @@ void input_VlanLeave( int i_vlan_id )
     }
     
     /* Get lock */
-    pthread_mutex_lock( &p_method->lock );
+    vlc_mutex_lock( &p_method->lock );
 
     /* Decrease reference counter */
     p_method->p_iface[ VLAN_ID_IFACE( i_vlan_id ) ].i_refcount--;    
 
     /* Release lock */
-    pthread_mutex_unlock( &p_method->lock );   
+    vlc_mutex_unlock( &p_method->lock );   
 }
 
 /*******************************************************************************
@@ -391,7 +391,7 @@ int input_VlanSynchronize( void )
     
     /* Get lock */
     p_method = &p_program_data->input_vlan_method;
-    pthread_mutex_lock( &p_method->lock );
+    vlc_mutex_lock( &p_method->lock );
 
     for( i_index = 0; i_index < p_method->i_ifaces; i_index++ )
     {        
@@ -431,7 +431,7 @@ int input_VlanSynchronize( void )
     }    
 
     /* Release lock */
-    pthread_mutex_unlock( &p_method->lock );   
+    vlc_mutex_unlock( &p_method->lock );   
     return( 0 );    
 }
 
index de19a23e40f095c31a0b3e7b1ba1b895ffd0a2a5..68915be5b217ac6f5655f7cc9ef745ec103a0abd 100644 (file)
@@ -10,7 +10,6 @@
 /*******************************************************************************
  * Preamble
  *******************************************************************************/
-#include <pthread.h>
 #include <stdio.h>
 #include <netinet/in.h>
 #include <sys/soundcard.h>
@@ -21,6 +20,7 @@
 #include "config.h"
 #include "common.h"
 #include "mtime.h"
+#include "vlc_thread.h"
 
 #include "input.h"
 #include "input_vlan.h"
index 154711dc608076ff7787b4ece20be0c778508274..f86b632ef9e14e92a3a66f37ae2336c6e42edcfc 100644 (file)
@@ -9,7 +9,6 @@
 /*******************************************************************************
  * Preamble
  *******************************************************************************/
-#include <pthread.h>
 #include <stdio.h>
 #include <unistd.h>
 #include <netinet/in.h>
@@ -25,6 +24,7 @@
 #include "config.h"
 #include "common.h"
 #include "mtime.h"
+#include "vlc_thread.h"
 #include "thread.h"
 #include "debug.h"
 
index 9cff69df86cef5d8833115149c752bafc60f09ab..1bfde537b0cae913e526f551dc0dc7a8c4a8fe44 100644 (file)
@@ -11,7 +11,6 @@
  * Preamble
  *******************************************************************************/
 #include <errno.h>
-#include <pthread.h>
 #include <netinet/in.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -24,6 +23,7 @@
 #include "config.h"
 #include "common.h"
 #include "mtime.h"
+#include "vlc_thread.h"
 
 #include "input.h"
 #include "input_vlan.h"
index 5f4b02625f71e6ce4c5f75394d6bd50573dd4074..6ac632a02b70795fa3e57c0c1f86353e8adc1a87 100644 (file)
@@ -26,7 +26,6 @@
  *******************************************************************************/
 #include <errno.h>
 #include <fcntl.h>
-#include <pthread.h>
 #include <netinet/in.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -41,6 +40,7 @@
 #include "config.h"
 #include "common.h"
 #include "mtime.h"
+#include "vlc_thread.h"
 #include "debug.h"
 
 #include "intf_msg.h"
index e8261d4fb17ff36782392718f6a99c7b3c62ca22..0b452ae1d14c1023253c14273d3667d024fc8da8 100644 (file)
@@ -15,7 +15,6 @@
  * Preamble
  *******************************************************************************/
 #include <errno.h>
-#include <pthread.h>
 #include <stdio.h>
 #include <stdarg.h>
 #include <stdlib.h>
@@ -29,6 +28,7 @@
 #include "config.h"
 #include "common.h"
 #include "mtime.h"
+#include "vlc_thread.h"
 #include "debug.h"
 
 #include "input.h"
@@ -73,7 +73,7 @@ int intf_InitMsg( interface_msg_t *p_intf_msg )
 {
 #ifdef INTF_MSG_QUEUE
     /* Message queue initialization */
-    pthread_mutex_init( &p_intf_msg->lock, NULL );           /* intialize lock */
+    vlc_mutex_init( &p_intf_msg->lock );                     /* intialize lock */
     p_intf_msg->i_count = 0;                                 /* queue is empty */
 #endif
 
@@ -241,9 +241,9 @@ void _intf_DbgMsgImm( char *psz_file, char *psz_function, int i_line,
 #ifdef INTF_MSG_QUEUE
 void intf_FlushMsg( void )
 {
-    pthread_mutex_lock( &p_program_data->intf_msg.lock );          /* get lock */
+    vlc_mutex_lock( &p_program_data->intf_msg.lock );              /* get lock */
     FlushLockedMsg( &p_program_data->intf_msg );             /* flush messages */
-    pthread_mutex_unlock( &p_program_data->intf_msg.lock );  /* give lock back */
+    vlc_mutex_unlock( &p_program_data->intf_msg.lock );      /* give lock back */
 }
 #endif
 
@@ -280,7 +280,7 @@ static void QueueMsg(interface_msg_t *p_intf_msg, int i_type, char *psz_format,
      * Queue mode: the queue is flushed if it is full, then the message is
      * queued. A lock is required on queue to avoid indexes corruption 
      */
-    pthread_mutex_lock( &p_intf_msg->lock );                        /* get lock */
+    vlc_mutex_lock( &p_intf_msg->lock );                            /* get lock */
     
     if( p_intf_msg->i_count == INTF_MSG_QSIZE )        /* flush queue if needed */
     {  
@@ -297,7 +297,7 @@ static void QueueMsg(interface_msg_t *p_intf_msg, int i_type, char *psz_format,
     p_intf_msg->msg[ p_intf_msg->i_count ].date =       mdate();
 #endif
 
-    pthread_mutex_unlock( &p_intf_msg->lock );               /* give lock back */
+    vlc_mutex_unlock( &p_intf_msg->lock );                  /* give lock back */
 
 #else
 
@@ -346,7 +346,7 @@ static void QueueDbgMsg(interface_msg_t *p_intf_msg, char *psz_file, char *psz_f
      * Queue mode: the queue is flushed if it is full, then the message is
      * queued. A lock is required on queue to avoid indexes corruption 
      */
-    pthread_mutex_lock( &p_intf_msg->lock );                       /* get lock */
+    vlc_mutex_lock( &p_intf_msg->lock );                           /* get lock */
     
     if( p_intf_msg->i_count == INTF_MSG_QSIZE )       /* flush queue if needed */
     {  
@@ -362,7 +362,7 @@ static void QueueDbgMsg(interface_msg_t *p_intf_msg, char *psz_file, char *psz_f
     p_intf_msg->msg[ p_intf_msg->i_count ].i_line =         i_line;
     p_intf_msg->msg[ p_intf_msg->i_count++ ].psz_msg =      psz_str;    
 
-    pthread_mutex_unlock( &p_intf_msg->lock );               /* give lock back */
+    vlc_mutex_unlock( &p_intf_msg->lock );                  /* give lock back */
 
 #else
 
index 28665d10c7b19d6d9618caffde40cdac30b59101..7edd9f35cdb2a122252540a9dd608dcf0a75248c 100644 (file)
@@ -11,7 +11,6 @@
  *******************************************************************************/
 #include <errno.h>
 #include <getopt.h>
-#include <pthread.h>
 #include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -25,6 +24,7 @@
 #include "config.h"
 #include "common.h"
 #include "mtime.h"
+#include "vlc_thread.h"
 #include "netutils.h"
 #include "debug.h"
 
index 914206adfb854bd0c43790a84a7e6d58982939ff..be4d97d2558ce84c9c181dee9a2f0295b1aa75b6 100644 (file)
@@ -24,7 +24,6 @@
  *******************************************************************************/
 #include <errno.h>
 #include <keysym.h>
-#include <pthread.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
@@ -34,6 +33,7 @@
 #include "config.h"
 #include "common.h"
 #include "mtime.h"
+#include "vlc_thread.h"
 #include "xutils.h"
 
 #include "xconsole.h"
index f7db898ad4895639e467b387672d98fa18126ef0..245129b780bfff192a74bbffc87d4da07375c1e1 100644 (file)
@@ -9,7 +9,6 @@
  * Preamble
  *******************************************************************************/
 #include <errno.h>
-#include <pthread.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <unistd.h>
@@ -21,6 +20,7 @@
 #include "config.h"
 #include "common.h"
 #include "mtime.h"
+#include "vlc_thread.h"
 
 #include "intf_msg.h"
 #include "debug.h"                      /* ?? temporaire, requis par netlist.h */
@@ -73,8 +73,8 @@ vdec_thread_t * vdec_CreateThread( /* video_cfg_t *p_cfg, */ input_thread_t *p_i
      * Initialize the input properties
      */
     /* Initialize the decoder fifo's data lock and conditional variable and set     * its buffer as empty */
-    pthread_mutex_init( &p_vdec->fifo.data_lock, NULL );
-    pthread_cond_init( &p_vdec->fifo.data_wait, NULL );
+    vlc_mutex_init( &p_vdec->fifo.data_lock );
+    vlc_cond_init( &p_vdec->fifo.data_wait );
     p_vdec->fifo.i_start = 0;
     p_vdec->fifo.i_end = 0;
     /* Initialize the bit stream structure */
@@ -84,7 +84,7 @@ vdec_thread_t * vdec_CreateThread( /* video_cfg_t *p_cfg, */ input_thread_t *p_i
     p_vdec->bit_stream.fifo.i_available = 0;
 
     /* Spawn the video decoder thread */
-    if ( pthread_create(&p_vdec->thread_id, NULL, (void *)RunThread, (void *)p_vdec) )
+    if ( vlc_thread_create(&p_vdec->thread_id, "video decoder", (vlc_thread_func)RunThread, (void *)p_vdec) )
     {
         intf_ErrMsg("vdec error: can't spawn video decoder thread\n");
         free( p_vdec );
@@ -109,13 +109,13 @@ void vdec_DestroyThread( vdec_thread_t *p_vdec /*, int *pi_status */ )
     /* Ask thread to kill itself */
     p_vdec->b_die = 1;
     /* Make sure the decoder thread leaves the GetByte() function */
-    pthread_mutex_lock( &(p_vdec->fifo.data_lock) );
-    pthread_cond_signal( &(p_vdec->fifo.data_wait) );
-    pthread_mutex_unlock( &(p_vdec->fifo.data_lock) );
+    vlc_mutex_lock( &(p_vdec->fifo.data_lock) );
+    vlc_cond_signal( &(p_vdec->fifo.data_wait) );
+    vlc_mutex_unlock( &(p_vdec->fifo.data_lock) );
 
     /* Waiting for the decoder thread to exit */
     /* Remove this as soon as the "status" flag is implemented */
-    pthread_join( p_vdec->thread_id, NULL );
+    vlc_thread_join( p_vdec->thread_id );
 }
 
 /* following functions are local */
@@ -149,14 +149,14 @@ static int InitThread( vdec_thread_t *p_vdec )
 
     /* Our first job is to initialize the bit stream structure with the
      * beginning of the input stream */
-    pthread_mutex_lock( &p_vdec->fifo.data_lock );
+    vlc_mutex_lock( &p_vdec->fifo.data_lock );
     while ( DECODER_FIFO_ISEMPTY(p_vdec->fifo) )
     {
-        pthread_cond_wait( &p_vdec->fifo.data_wait, &p_vdec->fifo.data_lock );
+        vlc_cond_wait( &p_vdec->fifo.data_wait, &p_vdec->fifo.data_lock );
     }
     p_vdec->bit_stream.p_ts = DECODER_FIFO_START( p_vdec->fifo )->p_first_ts;
     p_vdec->bit_stream.i_byte = p_vdec->bit_stream.p_ts->i_payload_start;
-    pthread_mutex_unlock( &p_vdec->fifo.data_lock );
+    vlc_mutex_unlock( &p_vdec->fifo.data_lock );
 
 #if 0
     /* ?? */
@@ -250,7 +250,7 @@ static void ErrorThread( vdec_thread_t *p_vdec )
     {
         /* We take the lock, because we are going to read/write the start/end
          * indexes of the decoder fifo */
-        pthread_mutex_lock( &p_vdec->fifo.data_lock );
+        vlc_mutex_lock( &p_vdec->fifo.data_lock );
 
         /* ?? trash all trashable PES packets */
         while( !DECODER_FIFO_ISEMPTY(p_vdec->fifo) )
@@ -259,7 +259,7 @@ static void ErrorThread( vdec_thread_t *p_vdec )
             DECODER_FIFO_INCSTART( p_vdec->fifo );
         }
 
-        pthread_mutex_unlock( &p_vdec->fifo.data_lock );
+        vlc_mutex_unlock( &p_vdec->fifo.data_lock );
         /* Sleep a while */
         msleep( VDEC_IDLE_SLEEP );                
     }
index 276655d7abc6a7e0d99e2d402228b1e9470f2875..376652aef3d6bb0a2bc358e449aade2f36226f2b 100644 (file)
@@ -11,7 +11,6 @@
  * Preamble
  *******************************************************************************/
 #include <errno.h> 
-#include <pthread.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
@@ -22,6 +21,7 @@
 #include "common.h"
 #include "config.h"
 #include "mtime.h"
+#include "vlc_thread.h"
 #include "thread.h"
 
 #include "video.h"
@@ -105,9 +105,9 @@ vout_thread_t *vout_CreateThread( video_cfg_t *p_cfg, int *pi_status )
     p_vout->b_active = 0;
 
     /* Create thread and set locks */
-    pthread_mutex_init( &p_vout->streams_lock, NULL );
-    pthread_mutex_init( &p_vout->pictures_lock, NULL );
-    if( pthread_create( &p_vout->thread_id, NULL, (void *) RunThread, (void *) p_vout) )
+    vlc_mutex_init( &p_vout->streams_lock );
+    vlc_mutex_init( &p_vout->pictures_lock );
+    if( vlc_thread_create( &p_vout->thread_id, "video output", (vlc_thread_func)RunThread, (void *) p_vout) )
     {
         intf_ErrMsg("vout error: %s\n", strerror(ENOMEM));
         intf_DbgMsg("failed\n");        
@@ -195,7 +195,7 @@ picture_t * vout_DisplayPicture( vout_thread_t *p_vout, picture_t *p_pic )
     }
 
     /* Release lock and return */
-    pthread_mutex_unlock( &p_vout->pictures_lock );
+    vlc_mutex_unlock( &p_vout->pictures_lock );
     return( p_newpic );
 }
 
@@ -229,7 +229,7 @@ picture_t * vout_DisplayPictureCopy( vout_thread_t *p_vout, picture_t *p_pic )
                 /* Restore type and flags */
                 p_newpic->i_type = EMPTY_PICTURE;
                 p_newpic->i_flags = 0;
-                pthread_mutex_unlock( &p_vout->pictures_lock );            
+                vlc_mutex_unlock( &p_vout->pictures_lock );            
                 return( NULL );
             }
             memcpy( p_newpic->p_data, p_pic->p_data,
@@ -251,7 +251,7 @@ picture_t * vout_DisplayPictureCopy( vout_thread_t *p_vout, picture_t *p_pic )
     }
 
     /* Release lock and return */
-    pthread_mutex_unlock( &p_vout->pictures_lock );
+    vlc_mutex_unlock( &p_vout->pictures_lock );
     return( p_newpic );
 }
 
@@ -286,7 +286,7 @@ picture_t * vout_DisplayPictureReplicate( vout_thread_t *p_vout, picture_t *p_pi
     }
 
    /* Release lock and return */
-    pthread_mutex_unlock( &p_vout->pictures_lock );
+    vlc_mutex_unlock( &p_vout->pictures_lock );
     return( p_newpic );
 }
 
@@ -301,7 +301,7 @@ picture_t * vout_DisplayPictureReplicate( vout_thread_t *p_vout, picture_t *p_pi
  *******************************************************************************/
 picture_t * vout_DisplayReservedPicture( vout_thread_t *p_vout, picture_t *p_pic )
 {
-    pthread_mutex_lock( &p_vout->pictures_lock );
+    vlc_mutex_lock( &p_vout->pictures_lock );
 
     /* Remove reservation flag */
     p_pic->i_flags &= ~RESERVED_PICTURE;
@@ -312,7 +312,7 @@ picture_t * vout_DisplayReservedPicture( vout_thread_t *p_vout, picture_t *p_pic
     p_vout->p_stream[ p_pic->i_stream ].c_pictures++;
 #endif
 
-    pthread_mutex_unlock( &p_vout->pictures_lock );
+    vlc_mutex_unlock( &p_vout->pictures_lock );
     return( p_pic );
 }
 
@@ -355,7 +355,7 @@ picture_t *vout_CreateReservedPicture( vout_thread_t *p_vout, video_cfg_t *p_cfg
             /* Error: restore type and flags */
             p_newpic->i_type = EMPTY_PICTURE;
             p_newpic->i_flags = 0;
-            pthread_mutex_unlock( &p_vout->pictures_lock );
+            vlc_mutex_unlock( &p_vout->pictures_lock );
             return( NULL );
         }
         p_newpic->i_flags |= RESERVED_PICTURE;
@@ -365,7 +365,7 @@ picture_t *vout_CreateReservedPicture( vout_thread_t *p_vout, video_cfg_t *p_cfg
     }
 
     /* Release lock and return */
-    pthread_mutex_unlock( &p_vout->pictures_lock );
+    vlc_mutex_unlock( &p_vout->pictures_lock );
     return( p_newpic );
 }
 
@@ -395,7 +395,7 @@ picture_t *vout_ReservePicture( vout_thread_t *p_vout, picture_t *p_pic )
     }
 
     /* Release lock and return */
-    pthread_mutex_unlock( &p_vout->pictures_lock );
+    vlc_mutex_unlock( &p_vout->pictures_lock );
     return( p_newpic );
 }
 
@@ -426,7 +426,7 @@ picture_t *vout_ReservePictureCopy( vout_thread_t *p_vout, picture_t *p_pic )
                 /* Restore type and flags */
                 p_newpic->i_type = EMPTY_PICTURE;
                 p_newpic->i_flags = 0;
-                pthread_mutex_unlock( &p_vout->pictures_lock );   
+                vlc_mutex_unlock( &p_vout->pictures_lock );   
                 return( NULL );
             }
             memcpy( p_newpic->p_data, p_pic->p_data,
@@ -445,7 +445,7 @@ picture_t *vout_ReservePictureCopy( vout_thread_t *p_vout, picture_t *p_pic )
     }
 
     /* Release lock and return */
-    pthread_mutex_unlock( &p_vout->pictures_lock );
+    vlc_mutex_unlock( &p_vout->pictures_lock );
     return( p_newpic );
 }
 
@@ -475,7 +475,7 @@ picture_t *vout_ReservePictureReplicate( vout_thread_t *p_vout, picture_t *p_pic
     }
 
     /* Release lock and return */
-    pthread_mutex_unlock( &p_vout->pictures_lock );
+    vlc_mutex_unlock( &p_vout->pictures_lock );
     return( p_newpic );
 }
 
@@ -487,7 +487,7 @@ picture_t *vout_ReservePictureReplicate( vout_thread_t *p_vout, picture_t *p_pic
  *******************************************************************************/
 void vout_RemovePicture( vout_thread_t *p_vout, picture_t *p_pic )
 {
-    pthread_mutex_lock( &p_vout->pictures_lock );
+    vlc_mutex_lock( &p_vout->pictures_lock );
 
     /* Mark picture for destruction */
     p_pic->i_flags |= DESTROY_PICTURE;
@@ -496,7 +496,7 @@ void vout_RemovePicture( vout_thread_t *p_vout, picture_t *p_pic )
     p_pic->i_flags &= ~PERMANENT_PICTURE;
     intf_DbgMsg("%p -> picture %p removing requested\n", p_vout, p_pic );
 
-    pthread_mutex_unlock( &p_vout->pictures_lock );
+    vlc_mutex_unlock( &p_vout->pictures_lock );
 }
 
 /*******************************************************************************
@@ -508,10 +508,10 @@ void vout_RemovePicture( vout_thread_t *p_vout, picture_t *p_pic )
 void vout_RefreshPermanentPicture( vout_thread_t *p_vout, picture_t *p_pic, 
                                    mtime_t display_date )
 {
-    pthread_mutex_lock( &p_vout->pictures_lock );
+    vlc_mutex_lock( &p_vout->pictures_lock );
     p_pic->i_flags &= ~DISPLAYED_PICTURE;
     p_pic->date = display_date;
-    pthread_mutex_lock( &p_vout->pictures_lock );
+    vlc_mutex_lock( &p_vout->pictures_lock );
 }
 
 /*******************************************************************************
@@ -522,9 +522,9 @@ void vout_RefreshPermanentPicture( vout_thread_t *p_vout, picture_t *p_pic,
  *******************************************************************************/
 void vout_LinkPicture( vout_thread_t *p_vout, picture_t *p_pic )
 {
-    pthread_mutex_lock( &p_vout->pictures_lock );
+    vlc_mutex_lock( &p_vout->pictures_lock );
     p_pic->i_refcount++;
-    pthread_mutex_unlock( &p_vout->pictures_lock );
+    vlc_mutex_unlock( &p_vout->pictures_lock );
 }
 
 /*******************************************************************************
@@ -534,7 +534,7 @@ void vout_LinkPicture( vout_thread_t *p_vout, picture_t *p_pic )
  *******************************************************************************/
 void vout_UnlinkPicture( vout_thread_t *p_vout, picture_t *p_pic )
 {
-    pthread_mutex_lock( &p_vout->pictures_lock );
+    vlc_mutex_lock( &p_vout->pictures_lock );
     p_pic->i_refcount--;
 #ifdef DEBUG
     if( p_pic->i_refcount < 0 )
@@ -542,7 +542,7 @@ void vout_UnlinkPicture( vout_thread_t *p_vout, picture_t *p_pic )
         intf_DbgMsg("%p -> picture %p i_refcount < 0\n", p_vout, p_pic);
     }
 #endif
-    pthread_mutex_unlock( &p_vout->pictures_lock );    
+    vlc_mutex_unlock( &p_vout->pictures_lock );    
 }
 
 /*******************************************************************************
@@ -558,7 +558,7 @@ int vout_CreateStream( vout_thread_t *p_vout )
     int     i_index;                                           /* stream index */
 
     /* Find free (inactive) stream id */
-    pthread_mutex_lock( &p_vout->streams_lock );                   /* get lock */
+    vlc_mutex_lock( &p_vout->streams_lock );                   /* get lock */
     for( i_index = 1; i_index < VOUT_MAX_STREAMS; i_index++ )  /* find free id */
     {
         if( p_vout->p_stream[i_index].i_status == VOUT_INACTIVE_STREAM )
@@ -572,14 +572,14 @@ int vout_CreateStream( vout_thread_t *p_vout )
             
             /* Return stream id */
             intf_DbgMsg("%p -> stream %i created\n", p_vout, i_index);
-            pthread_mutex_unlock( &p_vout->streams_lock );     /* release lock */
+            vlc_mutex_unlock( &p_vout->streams_lock );     /* release lock */
             return( i_index );                                    /* return id */
         }
     }
    
     /* Failure: all streams id are already active */
     intf_DbgMsg("%p -> failed\n", p_vout);    
-    pthread_mutex_unlock( &p_vout->streams_lock );    
+    vlc_mutex_unlock( &p_vout->streams_lock );    
     return( -1 );
 }
 
@@ -592,9 +592,9 @@ int vout_CreateStream( vout_thread_t *p_vout )
  *******************************************************************************/
 void vout_EndStream( vout_thread_t *p_vout, int i_stream )
 {
-    pthread_mutex_lock( &p_vout->streams_lock );                   /* get lock */
+    vlc_mutex_lock( &p_vout->streams_lock );                   /* get lock */
     p_vout->p_stream[i_stream].i_status = VOUT_ENDING_STREAM;   /* mark stream */
-    pthread_mutex_unlock( &p_vout->streams_lock );             /* release lock */
+    vlc_mutex_unlock( &p_vout->streams_lock );             /* release lock */
     intf_DbgMsg("%p -> stream %d\n", p_vout, i_stream);
 }
 
@@ -607,9 +607,9 @@ void vout_EndStream( vout_thread_t *p_vout, int i_stream )
  *******************************************************************************/
 void vout_DestroyStream( vout_thread_t *p_vout, int i_stream )
 {
-    pthread_mutex_lock( &p_vout->streams_lock );                   /* get lock */
+    vlc_mutex_lock( &p_vout->streams_lock );                   /* get lock */
     p_vout->p_stream[i_stream].i_status = VOUT_DESTROYED_STREAM;/* mark stream */
-    pthread_mutex_unlock( &p_vout->streams_lock );             /* release lock */
+    vlc_mutex_unlock( &p_vout->streams_lock );             /* release lock */
     intf_DbgMsg("%p -> stream %d\n", p_vout, i_stream);
 }
 
@@ -765,8 +765,8 @@ static void RunThread( vout_thread_t *p_vout)
     while( (!p_vout->b_die) && (!p_vout->b_error) )
     {
         /* Get locks on pictures and streams */
-        pthread_mutex_lock( &p_vout->streams_lock );
-        pthread_mutex_lock( &p_vout->pictures_lock );
+        vlc_mutex_lock( &p_vout->streams_lock );
+        vlc_mutex_lock( &p_vout->pictures_lock );
         
         /* Initialise streams: clear images from all streams */
         for( i_stream = 0; i_stream < VOUT_MAX_STREAMS; i_stream++ )
@@ -824,8 +824,8 @@ static void RunThread( vout_thread_t *p_vout)
         /* From now until next loop, only next_picture field in streams
          * will be used, and selected pictures structures won't modified.
          * Therefore, locks can be released */
-        pthread_mutex_unlock( &p_vout->pictures_lock );
-        pthread_mutex_unlock( &p_vout->streams_lock );
+        vlc_mutex_unlock( &p_vout->pictures_lock );
+        vlc_mutex_unlock( &p_vout->streams_lock );
 
         /* If there are some pictures to display, then continue */
         if( display_date != LAST_MDATE )
@@ -929,7 +929,7 @@ static void ErrorThread( vout_thread_t *p_vout )
     while( !p_vout->b_die )
     {
         /* Get lock on pictures */
-        pthread_mutex_lock( &p_vout->pictures_lock );     
+        vlc_mutex_lock( &p_vout->pictures_lock );     
 
         /* Try to remove all pictures - only removable pictures will be
          * removed */
@@ -942,7 +942,7 @@ static void ErrorThread( vout_thread_t *p_vout )
         }
         
         /* Release locks on pictures */
-        pthread_mutex_unlock( &p_vout->pictures_lock );
+        vlc_mutex_unlock( &p_vout->pictures_lock );
 
         /* Sleep a while */
         msleep( VOUT_IDLE_SLEEP );                
@@ -1008,7 +1008,7 @@ static picture_t *FindPicture( vout_thread_t *p_vout )
     int         i_picture;                                    /* picture index */
 
     /* Get lock */
-    pthread_mutex_lock( &p_vout->pictures_lock );
+    vlc_mutex_lock( &p_vout->pictures_lock );
 
     /* Look for an empty place */
     for( i_picture = 0; i_picture < p_vout->i_max_pictures; i_picture++ )
index d929443b964f48451800e9644250f25e715180f3..846c4494df67a287d9e996651c8e342748fc3caf 100644 (file)
@@ -11,7 +11,6 @@
  * Preamble
  *******************************************************************************/
 #include <errno.h>
-#include <pthread.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
@@ -27,6 +26,7 @@
 #include "config.h"
 #include "common.h"
 #include "mtime.h"
+#include "vlc_thread.h"
 #include "xutils.h"
 
 #include "input.h"