******************************************************************************/
#include <unistd.h>
-#include <pthread.h>
#include <stdio.h> /* "intf_msg.h" */
#include <stdlib.h> /* malloc(), free() */
#include <netinet/in.h> /* ntohl() */
#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() */
*/
/* 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 */
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 );
/* 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 */
/* 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) )
/* 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
* 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 )
{
/* 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;
{
/* 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 )
}
/* 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 );
}
/******************************************************************************
#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() */
/******************************************************************************
* Preamble
******************************************************************************/
-#include <pthread.h>
#include <fcntl.h> /* open(), O_WRONLY */
#include <sys/ioctl.h> /* ioctl() */
#include <unistd.h> /* write(), close() */
#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"
* à 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 ?
*
*/
******************************************************************************/
#include <unistd.h>
-#include <pthread.h>
#include <sys/soundcard.h>
#include <stdio.h> /* "intf_msg.h" */
#include <stdlib.h> /* calloc(), malloc(), free() */
#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() */
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
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 );
/* 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 );
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++ )
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 );
}
{
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 );
}
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 );
}
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]);
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 )
}
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 );
}
}
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 );
}
*/
/* 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 );
}
* 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 );
}
* 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 )
}
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;
}
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;
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 */
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 )
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 )
* Preamble
*******************************************************************************/
#include <errno.h>
-#include <pthread.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "config.h"
#include "common.h"
#include "mtime.h"
+#include "vlc_thread.h"
#include "thread.h"
#include "intf_msg.h"
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");
/* 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 )
* Preamble
******************************************************************************/
#include <errno.h>
-#include <pthread.h>
#include <sys/uio.h> /* iovec */
#include <string.h>
#include "common.h"
#include "config.h"
#include "mtime.h"
+#include "vlc_thread.h"
#include "intf_msg.h"
#include "debug.h"
/* 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",
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
EndThread( p_input );
intf_DbgMsg("input debug: thread %p destroyed\n", p_input);
- pthread_exit( 0 );
+ vlc_thread_exit( 0 );
}
/* 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 )
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. */
// 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++ )
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,
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
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
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 ?? */
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;
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;
}
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. */
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
{
* Preamble
*******************************************************************************/
#include <errno.h>
-#include <pthread.h>
#include <sys/uio.h> /* iovec */
#include <stdlib.h> /* atoi(), malloc(), free() */
#include <string.h>
#include "common.h"
#include "config.h"
#include "mtime.h"
+#include "vlc_thread.h"
#include "intf_msg.h"
#include "debug.h"
/* 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++ )
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 );
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 );
}
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
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;
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;
/* 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 );
}
/* 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;
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 );
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 );
}
/* 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] )
}
/* Unlock the structure */
- pthread_mutex_unlock( &p_input->es_lock );
+ vlc_mutex_unlock( &p_input->es_lock );
return( b_is_recv );
}
/*******************************************************************************
* 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"
/*******************************************************************************
* Preamble
*******************************************************************************/
-#include <pthread.h>
#include <sys/uio.h>
#include <stdlib.h>
#include <stdio.h>
#include "common.h"
#include "config.h"
#include "mtime.h"
+#include "vlc_thread.h"
#include "intf_msg.h"
#include "debug.h"
#include "input.h"
/*******************************************************************************
* Preamble
*******************************************************************************/
-#include <pthread.h>
#include <sys/uio.h>
#include <string.h>
#include <stdio.h>
#include "common.h"
#include "config.h"
#include "mtime.h"
+#include "vlc_thread.h"
#include "netutils.h"
#include "input.h"
* Preamble
*******************************************************************************/
#include <stdio.h>
-#include <pthread.h>
#include <sys/uio.h> /* iovec */
#include <stdlib.h> /* atoi(), malloc(), free() */
#include <netinet/in.h>
#include "config.h"
#include "common.h"
#include "mtime.h"
+#include "vlc_thread.h"
#include "debug.h"
#include "input.h"
#include "intf_msg.h"
{
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 );
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 &&
p_pcr->c_average++;
}
- pthread_mutex_unlock( &p_pcr->lock );
+ vlc_mutex_unlock( &p_pcr->lock );
#ifdef STATS
{
* Preamble
******************************************************************************/
#include <errno.h>
-#include <pthread.h>
#include <stdio.h>
#include <sys/uio.h> /* iovec */
#include <stdlib.h> /* atoi(), malloc(), free() */
#include "common.h"
#include "config.h"
#include "mtime.h"
+#include "vlc_thread.h"
#include "intf_msg.h"
#include "debug.h"
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 )
}
/* Unock the tables */
- //pthread_mutex_unlock()
+ //vlc_mutex_unlock()
}
/******************************************************************************
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
/* 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] )
break;
}
}
- pthread_mutex_unlock( &p_input->es_lock );
+ vlc_mutex_unlock( &p_input->es_lock );
if( i_index >= INPUT_MAX_SELECTED_ES )
{
/* 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++ )
{
}
}
- 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 */
}
/******************************************************************************
- * DestroyPgrmDescr: destroy a program descriptor
+ * AddPgrmDescr: destroy a program descriptor
******************************************************************************
* All ES descriptions referenced in the descriptor will be deleted.
******************************************************************************/
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;
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 );
}
* Preamble
*******************************************************************************/
#include <errno.h>
-#include <pthread.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include "config.h"
#include "common.h"
#include "mtime.h"
+#include "vlc_thread.h"
#include "netutils.h"
#include "input.h"
}
/* 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 );
}
/* 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 ) )
}
/* 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 );
}
}
/* 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 );
}
/*******************************************************************************
/* 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++ )
{
}
/* Release lock */
- pthread_mutex_unlock( &p_method->lock );
+ vlc_mutex_unlock( &p_method->lock );
return( 0 );
}
/*******************************************************************************
* Preamble
*******************************************************************************/
-#include <pthread.h>
#include <stdio.h>
#include <netinet/in.h>
#include <sys/soundcard.h>
#include "config.h"
#include "common.h"
#include "mtime.h"
+#include "vlc_thread.h"
#include "input.h"
#include "input_vlan.h"
/*******************************************************************************
* Preamble
*******************************************************************************/
-#include <pthread.h>
#include <stdio.h>
#include <unistd.h>
#include <netinet/in.h>
#include "config.h"
#include "common.h"
#include "mtime.h"
+#include "vlc_thread.h"
#include "thread.h"
#include "debug.h"
* Preamble
*******************************************************************************/
#include <errno.h>
-#include <pthread.h>
#include <netinet/in.h>
#include <stdio.h>
#include <stdlib.h>
#include "config.h"
#include "common.h"
#include "mtime.h"
+#include "vlc_thread.h"
#include "input.h"
#include "input_vlan.h"
*******************************************************************************/
#include <errno.h>
#include <fcntl.h>
-#include <pthread.h>
#include <netinet/in.h>
#include <stdio.h>
#include <stdlib.h>
#include "config.h"
#include "common.h"
#include "mtime.h"
+#include "vlc_thread.h"
#include "debug.h"
#include "intf_msg.h"
* Preamble
*******************************************************************************/
#include <errno.h>
-#include <pthread.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include "config.h"
#include "common.h"
#include "mtime.h"
+#include "vlc_thread.h"
#include "debug.h"
#include "input.h"
{
#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
#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
* 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 */
{
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
* 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 */
{
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
*******************************************************************************/
#include <errno.h>
#include <getopt.h>
-#include <pthread.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include "config.h"
#include "common.h"
#include "mtime.h"
+#include "vlc_thread.h"
#include "netutils.h"
#include "debug.h"
*******************************************************************************/
#include <errno.h>
#include <keysym.h>
-#include <pthread.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "config.h"
#include "common.h"
#include "mtime.h"
+#include "vlc_thread.h"
#include "xutils.h"
#include "xconsole.h"
* Preamble
*******************************************************************************/
#include <errno.h>
-#include <pthread.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#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 */
* 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 */
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 );
/* 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 */
/* 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
/* ?? */
{
/* 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) )
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 );
}
* Preamble
*******************************************************************************/
#include <errno.h>
-#include <pthread.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "common.h"
#include "config.h"
#include "mtime.h"
+#include "vlc_thread.h"
#include "thread.h"
#include "video.h"
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");
}
/* Release lock and return */
- pthread_mutex_unlock( &p_vout->pictures_lock );
+ vlc_mutex_unlock( &p_vout->pictures_lock );
return( p_newpic );
}
/* 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,
}
/* Release lock and return */
- pthread_mutex_unlock( &p_vout->pictures_lock );
+ vlc_mutex_unlock( &p_vout->pictures_lock );
return( p_newpic );
}
}
/* Release lock and return */
- pthread_mutex_unlock( &p_vout->pictures_lock );
+ vlc_mutex_unlock( &p_vout->pictures_lock );
return( p_newpic );
}
*******************************************************************************/
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;
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 );
}
/* 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;
}
/* Release lock and return */
- pthread_mutex_unlock( &p_vout->pictures_lock );
+ vlc_mutex_unlock( &p_vout->pictures_lock );
return( p_newpic );
}
}
/* Release lock and return */
- pthread_mutex_unlock( &p_vout->pictures_lock );
+ vlc_mutex_unlock( &p_vout->pictures_lock );
return( p_newpic );
}
/* 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,
}
/* Release lock and return */
- pthread_mutex_unlock( &p_vout->pictures_lock );
+ vlc_mutex_unlock( &p_vout->pictures_lock );
return( p_newpic );
}
}
/* Release lock and return */
- pthread_mutex_unlock( &p_vout->pictures_lock );
+ vlc_mutex_unlock( &p_vout->pictures_lock );
return( p_newpic );
}
*******************************************************************************/
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;
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 );
}
/*******************************************************************************
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 );
}
/*******************************************************************************
*******************************************************************************/
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 );
}
/*******************************************************************************
*******************************************************************************/
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 )
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 );
}
/*******************************************************************************
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 )
/* 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 );
}
*******************************************************************************/
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);
}
*******************************************************************************/
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);
}
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++ )
/* 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 )
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 */
}
/* 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 );
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++ )
* Preamble
*******************************************************************************/
#include <errno.h>
-#include <pthread.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "config.h"
#include "common.h"
#include "mtime.h"
+#include "vlc_thread.h"
#include "xutils.h"
#include "input.h"