1 /*****************************************************************************
2 * audio_output.c : audio output thread
4 *****************************************************************************/
8 * - Passer un certain nombre de "fonctions" (genre add_samples) en macro ou
10 * - Faire les optimisations dans les fonctions threads :
11 * = Stocker les "petits calculs" dans des variables au lieu de les refaire
13 * = Utiliser des tables pour les gros calculs
14 * - Faire une structure différente pour intf/adec fifo
18 /*****************************************************************************
20 *****************************************************************************/
23 #include <stdio.h> /* "intf_msg.h" */
24 #include <stdlib.h> /* calloc(), malloc(), free() */
26 #include <dlfcn.h> /* plugins */
30 #include "mtime.h" /* mtime_t, mdate(), msleep() */
31 #include "vlc_thread.h"
33 #include "intf_msg.h" /* intf_DbgMsg(), intf_ErrMsg() */
35 #include "audio_output.h"
38 /*****************************************************************************
40 *****************************************************************************/
42 static int aout_SpawnThread( aout_thread_t * p_aout );
44 /* Creating as much aout_Thread functions as configurations is one solution,
45 * examining the different cases in the Thread loop of an unique function is
46 * another. I chose the first solution. */
47 void aout_Thread_S8_Mono ( aout_thread_t * p_aout );
48 void aout_Thread_U8_Mono ( aout_thread_t * p_aout );
49 void aout_Thread_S16_Mono ( aout_thread_t * p_aout );
50 void aout_Thread_U16_Mono ( aout_thread_t * p_aout );
51 void aout_Thread_S8_Stereo ( aout_thread_t * p_aout );
52 void aout_Thread_U8_Stereo ( aout_thread_t * p_aout );
53 void aout_Thread_S16_Stereo ( aout_thread_t * p_aout );
54 void aout_Thread_U16_Stereo ( aout_thread_t * p_aout );
56 static __inline__ void InitializeIncrement( aout_increment_t * p_increment, long l_numerator, long l_denominator );
57 static __inline__ int NextFrame( aout_thread_t * p_aout, aout_fifo_t * p_fifo, mtime_t aout_date );
59 /*****************************************************************************
60 * aout_CreateThread: initialize audio thread
61 *****************************************************************************/
62 aout_thread_t *aout_CreateThread( int *pi_status )
64 aout_thread_t * p_aout; /* thread descriptor */
67 // int i_status; /* thread status */
69 /* Allocate descriptor */
70 p_aout = (aout_thread_t *) malloc( sizeof(aout_thread_t) );
76 /* Initialize method-dependent functions */
77 psz_method = main_GetPszVariable( AOUT_METHOD_VAR, AOUT_DEFAULT_METHOD );
79 psz_plugin = malloc( sizeof("./audio_output/aout_.so") + strlen(psz_method) );
80 sprintf( psz_plugin, "./audio_output/aout_%s.so", psz_method );
82 p_aout->p_aout_plugin = dlopen (psz_plugin, RTLD_LAZY);
84 if( p_aout->p_aout_plugin == NULL )
86 intf_ErrMsg( "error: could not open audio plugin %s\n", psz_method );
94 p_aout->p_sys_open = dlsym(p_aout->p_aout_plugin, "aout_SysOpen");
95 p_aout->p_sys_reset = dlsym(p_aout->p_aout_plugin, "aout_SysReset");
96 p_aout->p_sys_setformat = dlsym(p_aout->p_aout_plugin, "aout_SysSetFormat");
97 p_aout->p_sys_setchannels = dlsym(p_aout->p_aout_plugin, "aout_SysSetChannels");
98 p_aout->p_sys_setrate = dlsym(p_aout->p_aout_plugin, "aout_SysSetRate");
99 p_aout->p_sys_getbufinfo = dlsym(p_aout->p_aout_plugin, "aout_SysGetBufInfo");
100 p_aout->p_sys_playsamples = dlsym(p_aout->p_aout_plugin, "aout_SysPlaySamples");
101 p_aout->p_sys_close = dlsym(p_aout->p_aout_plugin, "aout_SysClose");
104 * Initialize audio device
106 if ( p_aout->p_sys_open( p_aout ) )
108 dlclose( p_aout->p_aout_plugin );
113 p_aout->b_stereo = ( p_aout->i_channels == 2 ) ? 1 : 0; /* XXX only works
114 for i_channels == 1 or 2 */
116 if ( p_aout->p_sys_reset( p_aout ) )
118 p_aout->p_sys_close( p_aout );
119 dlclose( p_aout->p_aout_plugin );
123 if ( p_aout->p_sys_setformat( p_aout ) )
125 p_aout->p_sys_close( p_aout );
126 dlclose( p_aout->p_aout_plugin );
130 if ( p_aout->p_sys_setchannels( p_aout ) )
132 p_aout->p_sys_close( p_aout );
133 dlclose( p_aout->p_aout_plugin );
137 if ( p_aout->p_sys_setrate( p_aout ) )
139 p_aout->p_sys_close( p_aout );
140 dlclose( p_aout->p_aout_plugin );
145 //?? maybe it would be cleaner to change SpawnThread prototype
146 //?? see vout to handle status correctly - however, it is not critical since
147 //?? this thread is only called in main and all calls are blocking
148 if( aout_SpawnThread( p_aout ) )
150 p_aout->p_sys_close( p_aout );
151 dlclose( p_aout->p_aout_plugin );
159 /*****************************************************************************
161 *****************************************************************************/
162 static int aout_SpawnThread( aout_thread_t * p_aout )
166 void * aout_thread = NULL;
168 intf_DbgMsg("aout debug: spawning audio output thread (%p)\n", p_aout);
170 /* We want the audio output thread to live */
173 /* Initialize the fifos lock */
174 vlc_mutex_init( &p_aout->fifos_lock );
175 /* Initialize audio fifos : set all fifos as empty and initialize locks */
176 for ( i_fifo = 0; i_fifo < AOUT_MAX_FIFOS; i_fifo++ )
178 p_aout->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO;
179 vlc_mutex_init( &p_aout->fifo[i_fifo].data_lock );
180 vlc_cond_init( &p_aout->fifo[i_fifo].data_wait );
183 /* Compute the size (in audio units) of the audio output buffer. Although
184 * AOUT_BUFFER_DURATION is given in microseconds, the output rate is given
185 * in Hz, that's why we need to divide by 10^6 microseconds (1 second) */
186 p_aout->l_units = (long)( ((s64)p_aout->l_rate * AOUT_BUFFER_DURATION) / 1000000 );
187 p_aout->l_msleep = (long)( ((s64)p_aout->l_units * 1000000) / (s64)p_aout->l_rate );
189 /* Make aout_thread point to the right thread function, and compute the
190 * byte size of the audio output buffer */
191 switch ( p_aout->i_channels )
193 /* Audio output is mono */
195 switch ( p_aout->i_format )
198 l_bytes = 1 * sizeof(u8) * p_aout->l_units;
199 aout_thread = (void *)aout_Thread_U8_Mono;
203 l_bytes = 1 * sizeof(s8) * p_aout->l_units;
204 aout_thread = (void *)aout_Thread_S8_Mono;
207 case AOUT_FMT_U16_LE:
208 case AOUT_FMT_U16_BE:
209 l_bytes = 1 * sizeof(u16) * p_aout->l_units;
210 aout_thread = (void *)aout_Thread_U16_Mono;
213 case AOUT_FMT_S16_LE:
214 case AOUT_FMT_S16_BE:
215 l_bytes = 1 * sizeof(s16) * p_aout->l_units;
216 aout_thread = (void *)aout_Thread_S16_Mono;
220 intf_ErrMsg("aout error: unknown audio output format (%i)\n",
226 /* Audio output is stereo */
228 switch ( p_aout->i_format )
231 l_bytes = 2 * sizeof(u8) * p_aout->l_units;
232 aout_thread = (void *)aout_Thread_U8_Stereo;
236 l_bytes = 2 * sizeof(s8) * p_aout->l_units;
237 aout_thread = (void *)aout_Thread_S8_Stereo;
240 case AOUT_FMT_U16_LE:
241 case AOUT_FMT_U16_BE:
242 l_bytes = 2 * sizeof(u16) * p_aout->l_units;
243 aout_thread = (void *)aout_Thread_U16_Stereo;
246 case AOUT_FMT_S16_LE:
247 case AOUT_FMT_S16_BE:
248 l_bytes = 2 * sizeof(s16) * p_aout->l_units;
249 aout_thread = (void *)aout_Thread_S16_Stereo;
253 intf_ErrMsg("aout error: unknown audio output format (%i)\n",
260 intf_ErrMsg("aout error: unknown number of audio channels (%i)\n",
261 p_aout->i_channels );
265 /* Allocate the memory needed by the audio output buffers, and set to zero
266 * the s32 buffer's memory */
267 if ( (p_aout->buffer = malloc(l_bytes)) == NULL )
269 intf_ErrMsg("aout error: not enough memory to create the output buffer\n");
272 if ( (p_aout->s32_buffer = (s32 *)calloc(p_aout->l_units, sizeof(s32) << ( p_aout->b_stereo))) == NULL )
274 intf_ErrMsg("aout error: not enough memory to create the s32 output buffer\n");
275 free( p_aout->buffer );
279 /* Before launching the thread, we try to predict the date of the first
280 * audio unit in the first output buffer */
281 p_aout->date = mdate() - 1000000;
283 /* Launch the thread */
284 if ( vlc_thread_create( &p_aout->thread_id, "audio output", (vlc_thread_func_t)aout_thread, p_aout ) )
286 intf_ErrMsg("aout error: can't spawn audio output thread (%p)\n", p_aout);
287 free( p_aout->buffer );
288 free( p_aout->s32_buffer );
292 intf_DbgMsg("aout debug: audio output thread (%p) spawned\n", p_aout);
296 /*****************************************************************************
298 *****************************************************************************/
299 void aout_DestroyThread( aout_thread_t * p_aout, int *pi_status )
301 //???? pi_status is not handled correctly: check vout how to do!
303 intf_DbgMsg("aout debug: requesting termination of audio output thread (%p)\n", p_aout);
305 /* Ask thread to kill itself and wait until it's done */
307 vlc_thread_join( p_aout->thread_id ); // only if pi_status is NULL
309 /* Free the allocated memory */
310 free( p_aout->buffer );
311 free( p_aout->s32_buffer );
313 /* Free the structure */
314 p_aout->p_sys_close( p_aout );
315 intf_DbgMsg("aout debug: audio device (%s) closed\n", p_aout->psz_device);
318 dlclose( p_aout->p_aout_plugin );
324 /*****************************************************************************
326 *****************************************************************************/
327 aout_fifo_t * aout_CreateFifo( aout_thread_t * p_aout, aout_fifo_t * p_fifo )
331 /* Take the fifos lock */
332 vlc_mutex_lock( &p_aout->fifos_lock );
334 /* Looking for a free fifo structure */
335 for ( i_fifo = 0; i_fifo < AOUT_MAX_FIFOS; i_fifo++ )
337 if ( p_aout->fifo[i_fifo].i_type == AOUT_EMPTY_FIFO)
342 if ( i_fifo == AOUT_MAX_FIFOS )
344 intf_ErrMsg("aout error: no empty fifo available\n");
345 vlc_mutex_unlock( &p_aout->fifos_lock );
349 /* Initialize the new fifo structure */
350 switch ( p_aout->fifo[i_fifo].i_type = p_fifo->i_type )
352 case AOUT_INTF_MONO_FIFO:
353 case AOUT_INTF_STEREO_FIFO:
354 p_aout->fifo[i_fifo].b_die = 0;
356 p_aout->fifo[i_fifo].i_channels = p_fifo->i_channels;
357 p_aout->fifo[i_fifo].b_stereo = p_fifo->b_stereo;
358 p_aout->fifo[i_fifo].l_rate = p_fifo->l_rate;
360 p_aout->fifo[i_fifo].buffer = p_fifo->buffer;
362 p_aout->fifo[i_fifo].l_unit = 0;
363 InitializeIncrement( &p_aout->fifo[i_fifo].unit_increment, p_fifo->l_rate, p_aout->l_rate );
364 p_aout->fifo[i_fifo].l_units = p_fifo->l_units;
367 case AOUT_ADEC_MONO_FIFO:
368 case AOUT_ADEC_STEREO_FIFO:
369 p_aout->fifo[i_fifo].b_die = 0;
371 p_aout->fifo[i_fifo].i_channels = p_fifo->i_channels;
372 p_aout->fifo[i_fifo].b_stereo = p_fifo->b_stereo;
373 p_aout->fifo[i_fifo].l_rate = p_fifo->l_rate;
375 p_aout->fifo[i_fifo].l_frame_size = p_fifo->l_frame_size;
376 /* Allocate the memory needed to store the audio frames. As the
377 * fifo is a rotative fifo, we must be able to find out whether the
378 * fifo is full or empty, that's why we must in fact allocate memory
379 * for (AOUT_FIFO_SIZE+1) audio frames. */
380 if ( (p_aout->fifo[i_fifo].buffer = malloc( sizeof(s16)*(AOUT_FIFO_SIZE+1)*p_fifo->l_frame_size )) == NULL )
382 intf_ErrMsg("aout error: not enough memory to create the frames buffer\n");
383 p_aout->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO;
384 vlc_mutex_unlock( &p_aout->fifos_lock );
388 /* Allocate the memory needed to store the dates of the frames */
389 if ( (p_aout->fifo[i_fifo].date = (mtime_t *)malloc( sizeof(mtime_t)*(AOUT_FIFO_SIZE+1) )) == NULL )
391 intf_ErrMsg("aout error: not enough memory to create the dates buffer\n");
392 free( p_aout->fifo[i_fifo].buffer );
393 p_aout->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO;
394 vlc_mutex_unlock( &p_aout->fifos_lock );
398 /* Set the fifo's buffer as empty (the first frame that is to be
399 * played is also the first frame that is not to be played) */
400 p_aout->fifo[i_fifo].l_start_frame = 0;
401 /* p_aout->fifo[i_fifo].l_next_frame = 0; */
402 p_aout->fifo[i_fifo].l_end_frame = 0;
404 /* Waiting for the audio decoder to compute enough frames to work
405 * out the fifo's current rate (as soon as the decoder has decoded
406 * enough frames, the members of the fifo structure that are not
407 * initialized now will be calculated) */
408 p_aout->fifo[i_fifo].b_start_frame = 0;
409 p_aout->fifo[i_fifo].b_next_frame = 0;
413 intf_ErrMsg("aout error: unknown fifo type (%i)\n", p_aout->fifo[i_fifo].i_type);
414 p_aout->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO;
415 vlc_mutex_unlock( &p_aout->fifos_lock );
419 /* Release the fifos lock */
420 vlc_mutex_unlock( &p_aout->fifos_lock );
422 /* Return the pointer to the fifo structure */
423 intf_DbgMsg("aout debug: audio output fifo (%p) allocated\n", &p_aout->fifo[i_fifo]);
424 return( &p_aout->fifo[i_fifo] );
427 /*****************************************************************************
429 *****************************************************************************/
430 void aout_DestroyFifo( aout_fifo_t * p_fifo )
432 intf_DbgMsg("aout debug: requesting destruction of audio output fifo (%p)\n", p_fifo);
436 /* Here are the local macros */
438 #define UPDATE_INCREMENT( increment, integer ) \
439 if ( ((increment).l_remainder += (increment).l_euclidean_remainder) >= 0 )\
441 (integer) += (increment).l_euclidean_integer + 1; \
442 (increment).l_remainder -= (increment).l_euclidean_denominator; \
446 (integer) += (increment).l_euclidean_integer; \
449 /* Following functions are local */
451 /*****************************************************************************
452 * InitializeIncrement
453 *****************************************************************************/
454 static __inline__ void InitializeIncrement( aout_increment_t * p_increment, long l_numerator, long l_denominator )
456 p_increment->l_remainder = -l_denominator;
458 p_increment->l_euclidean_integer = 0;
459 while ( l_numerator >= l_denominator )
461 p_increment->l_euclidean_integer++;
462 l_numerator -= l_denominator;
465 p_increment->l_euclidean_remainder = l_numerator;
467 p_increment->l_euclidean_denominator = l_denominator;
470 /*****************************************************************************
472 *****************************************************************************/
473 static __inline__ int NextFrame( aout_thread_t * p_aout, aout_fifo_t * p_fifo, mtime_t aout_date )
475 long l_units, l_rate;
477 /* We take the lock */
478 vlc_mutex_lock( &p_fifo->data_lock );
480 /* Are we looking for a dated start frame ? */
481 if ( !p_fifo->b_start_frame )
483 while ( p_fifo->l_start_frame != p_fifo->l_end_frame )
485 if ( p_fifo->date[p_fifo->l_start_frame] != LAST_MDATE )
487 p_fifo->b_start_frame = 1;
488 p_fifo->l_next_frame = (p_fifo->l_start_frame + 1) & AOUT_FIFO_SIZE;
489 p_fifo->l_unit = p_fifo->l_start_frame * (p_fifo->l_frame_size >> (p_fifo->b_stereo));
492 p_fifo->l_start_frame = (p_fifo->l_start_frame + 1) & AOUT_FIFO_SIZE;
495 if ( p_fifo->l_start_frame == p_fifo->l_end_frame )
497 vlc_mutex_unlock( &p_fifo->data_lock );
502 /* We are looking for the next dated frame */
503 /* FIXME : is the output fifo full ? */
504 while ( !p_fifo->b_next_frame )
506 while ( p_fifo->l_next_frame != p_fifo->l_end_frame )
508 if ( p_fifo->date[p_fifo->l_next_frame] != LAST_MDATE )
510 p_fifo->b_next_frame = 1;
513 p_fifo->l_next_frame = (p_fifo->l_next_frame + 1) & AOUT_FIFO_SIZE;
516 while ( p_fifo->l_next_frame == p_fifo->l_end_frame )
518 vlc_cond_wait( &p_fifo->data_wait, &p_fifo->data_lock );
521 vlc_mutex_unlock( &p_fifo->data_lock );
527 l_units = ((p_fifo->l_next_frame - p_fifo->l_start_frame) & AOUT_FIFO_SIZE) * (p_fifo->l_frame_size >> (p_fifo->b_stereo));
529 l_rate = p_fifo->l_rate + ((aout_date - p_fifo->date[p_fifo->l_start_frame]) / 256);
530 // fprintf( stderr, "aout debug: %lli (%li);\n", aout_date - p_fifo->date[p_fifo->l_start_frame], l_rate );
532 InitializeIncrement( &p_fifo->unit_increment, l_rate, p_aout->l_rate );
534 p_fifo->l_units = (((l_units - (p_fifo->l_unit -
535 (p_fifo->l_start_frame * (p_fifo->l_frame_size >> (p_fifo->b_stereo)))))
536 * p_aout->l_rate) / l_rate) + 1;
538 /* We release the lock before leaving */
539 vlc_mutex_unlock( &p_fifo->data_lock );
543 void aout_Thread_S8_Mono( aout_thread_t * p_aout )
547 void aout_Thread_S8_Stereo( aout_thread_t * p_aout )
551 void aout_Thread_U8_Mono( aout_thread_t * p_aout )
555 void aout_Thread_U8_Stereo( aout_thread_t * p_aout )
558 long l_buffer, l_buffer_limit;
559 long l_units, l_bytes;
561 intf_DbgMsg("adec debug: ********aout_Thread_U8_Stereo********\n");
562 intf_DbgMsg("adec debug: running audio output thread (%p) (pid == %i)\n", p_aout, getpid());
564 /* As the s32_buffer was created with calloc(), we don't have to set this
565 * memory to zero and we can immediately jump into the thread's loop */
566 while ( !p_aout->b_die )
568 vlc_mutex_lock( &p_aout->fifos_lock );
569 for ( i_fifo = 0; i_fifo < AOUT_MAX_FIFOS; i_fifo++ )
571 switch ( p_aout->fifo[i_fifo].i_type )
573 case AOUT_EMPTY_FIFO:
576 case AOUT_INTF_MONO_FIFO:
577 if ( p_aout->fifo[i_fifo].l_units > p_aout->l_units )
580 while ( l_buffer < (p_aout->l_units << 1) ) /* p_aout->b_stereo == 1 */
582 p_aout->s32_buffer[l_buffer++] +=
583 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[p_aout->fifo[i_fifo].l_unit] );
584 p_aout->s32_buffer[l_buffer++] +=
585 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[p_aout->fifo[i_fifo].l_unit] );
586 UPDATE_INCREMENT( p_aout->fifo[i_fifo].unit_increment, p_aout->fifo[i_fifo].l_unit )
588 p_aout->fifo[i_fifo].l_units -= p_aout->l_units;
593 while ( l_buffer < (p_aout->fifo[i_fifo].l_units << 1) ) /* p_aout->b_stereo == 1 */
595 p_aout->s32_buffer[l_buffer++] +=
596 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[p_aout->fifo[i_fifo].l_unit] );
597 p_aout->s32_buffer[l_buffer++] +=
598 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[p_aout->fifo[i_fifo].l_unit] );
599 UPDATE_INCREMENT( p_aout->fifo[i_fifo].unit_increment, p_aout->fifo[i_fifo].l_unit )
601 free( p_aout->fifo[i_fifo].buffer ); /* !! */
602 p_aout->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO; /* !! */
603 intf_DbgMsg("aout debug: audio output fifo (%p) destroyed\n", &p_aout->fifo[i_fifo]); /* !! */
607 case AOUT_INTF_STEREO_FIFO:
608 if ( p_aout->fifo[i_fifo].l_units > p_aout->l_units )
611 while ( l_buffer < (p_aout->l_units << 1) ) /* p_aout->b_stereo == 1 */
613 p_aout->s32_buffer[l_buffer++] +=
614 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[2*p_aout->fifo[i_fifo].l_unit] );
615 p_aout->s32_buffer[l_buffer++] +=
616 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[2*p_aout->fifo[i_fifo].l_unit+1] );
617 UPDATE_INCREMENT( p_aout->fifo[i_fifo].unit_increment, p_aout->fifo[i_fifo].l_unit )
619 p_aout->fifo[i_fifo].l_units -= p_aout->l_units;
624 while ( l_buffer < (p_aout->fifo[i_fifo].l_units << 1) ) /* p_aout->b_stereo == 1 */
626 p_aout->s32_buffer[l_buffer++] +=
627 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[2*p_aout->fifo[i_fifo].l_unit] );
628 p_aout->s32_buffer[l_buffer++] +=
629 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[2*p_aout->fifo[i_fifo].l_unit+1] );
630 UPDATE_INCREMENT( p_aout->fifo[i_fifo].unit_increment, p_aout->fifo[i_fifo].l_unit )
632 free( p_aout->fifo[i_fifo].buffer ); /* !! */
633 p_aout->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO; /* !! */
634 intf_DbgMsg("aout debug: audio output fifo (%p) destroyed\n", &p_aout->fifo[i_fifo]); /* !! */
638 case AOUT_ADEC_MONO_FIFO:
639 if ( p_aout->fifo[i_fifo].b_die )
641 free( p_aout->fifo[i_fifo].buffer );
642 free( p_aout->fifo[i_fifo].date );
643 p_aout->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO; /* !! */
644 intf_DbgMsg("aout debug: audio output fifo (%p) destroyed\n", &p_aout->fifo[i_fifo]);
648 l_units = p_aout->l_units;
650 while ( l_units > 0 )
652 if ( !p_aout->fifo[i_fifo].b_next_frame )
654 if ( NextFrame(p_aout, &p_aout->fifo[i_fifo], p_aout->date + ((((mtime_t)(l_buffer >> 1)) * 1000000) / ((mtime_t)p_aout->l_rate))) )
660 if ( p_aout->fifo[i_fifo].l_units > l_units )
662 l_buffer_limit = p_aout->l_units << 1; /* p_aout->b_stereo == 1 */
663 while ( l_buffer < l_buffer_limit )
665 p_aout->s32_buffer[l_buffer++] +=
666 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[p_aout->fifo[i_fifo].l_unit] );
667 p_aout->s32_buffer[l_buffer++] +=
668 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[p_aout->fifo[i_fifo].l_unit] );
670 UPDATE_INCREMENT( p_aout->fifo[i_fifo].unit_increment, p_aout->fifo[i_fifo].l_unit )
671 if ( p_aout->fifo[i_fifo].l_unit >= /* p_aout->fifo[i_fifo].b_stereo == 0 */
672 ((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 0)) )
674 p_aout->fifo[i_fifo].l_unit -= /* p_aout->fifo[i_fifo].b_stereo == 0 */
675 ((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 0));
678 p_aout->fifo[i_fifo].l_units -= l_units;
683 l_buffer_limit = l_buffer + (p_aout->fifo[i_fifo].l_units << 1);
684 /* p_aout->b_stereo == 1 */
685 while ( l_buffer < l_buffer_limit )
687 p_aout->s32_buffer[l_buffer++] +=
688 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[p_aout->fifo[i_fifo].l_unit] );
689 p_aout->s32_buffer[l_buffer++] +=
690 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[p_aout->fifo[i_fifo].l_unit] );
692 UPDATE_INCREMENT( p_aout->fifo[i_fifo].unit_increment, p_aout->fifo[i_fifo].l_unit )
693 if ( p_aout->fifo[i_fifo].l_unit >= /* p_aout->fifo[i_fifo].b_stereo == 0 */
694 ((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 0)) )
696 p_aout->fifo[i_fifo].l_unit -= /* p_aout->fifo[i_fifo].b_stereo == 0 */
697 ((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 0));
700 l_units -= p_aout->fifo[i_fifo].l_units;
702 vlc_mutex_lock( &p_aout->fifo[i_fifo].data_lock );
703 p_aout->fifo[i_fifo].l_start_frame = p_aout->fifo[i_fifo].l_next_frame;
704 vlc_cond_signal( &p_aout->fifo[i_fifo].data_wait );
705 vlc_mutex_unlock( &p_aout->fifo[i_fifo].data_lock );
707 /* p_aout->fifo[i_fifo].b_start_frame = 1; */
708 p_aout->fifo[i_fifo].l_next_frame += 1;
709 p_aout->fifo[i_fifo].l_next_frame &= AOUT_FIFO_SIZE;
710 p_aout->fifo[i_fifo].b_next_frame = 0;
715 case AOUT_ADEC_STEREO_FIFO:
716 if ( p_aout->fifo[i_fifo].b_die )
718 free( p_aout->fifo[i_fifo].buffer );
719 free( p_aout->fifo[i_fifo].date );
720 p_aout->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO; /* !! */
721 intf_DbgMsg("aout debug: audio output fifo (%p) destroyed\n", &p_aout->fifo[i_fifo]);
725 l_units = p_aout->l_units;
727 while ( l_units > 0 )
729 if ( !p_aout->fifo[i_fifo].b_next_frame )
731 if ( NextFrame(p_aout, &p_aout->fifo[i_fifo], p_aout->date + ((((mtime_t)(l_buffer >> 1)) * 1000000) / ((mtime_t)p_aout->l_rate))) )
737 if ( p_aout->fifo[i_fifo].l_units > l_units )
739 l_buffer_limit = p_aout->l_units << 1; /* p_aout->b_stereo == 1 */
740 while ( l_buffer < l_buffer_limit )
742 p_aout->s32_buffer[l_buffer++] +=
743 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[2*p_aout->fifo[i_fifo].l_unit] );
744 p_aout->s32_buffer[l_buffer++] +=
745 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[2*p_aout->fifo[i_fifo].l_unit+1] );
747 UPDATE_INCREMENT( p_aout->fifo[i_fifo].unit_increment, p_aout->fifo[i_fifo].l_unit )
748 if ( p_aout->fifo[i_fifo].l_unit >= /* p_aout->fifo[i_fifo].b_stereo == 1 */
749 ((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 1)) )
751 p_aout->fifo[i_fifo].l_unit -= /* p_aout->fifo[i_fifo].b_stereo == 1 */
752 ((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 1));
755 p_aout->fifo[i_fifo].l_units -= l_units;
760 l_buffer_limit = l_buffer + (p_aout->fifo[i_fifo].l_units << 1);
761 /* p_aout->b_stereo == 1 */
762 while ( l_buffer < l_buffer_limit )
764 p_aout->s32_buffer[l_buffer++] +=
765 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[2*p_aout->fifo[i_fifo].l_unit] );
766 p_aout->s32_buffer[l_buffer++] +=
767 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[2*p_aout->fifo[i_fifo].l_unit+1] );
769 UPDATE_INCREMENT( p_aout->fifo[i_fifo].unit_increment, p_aout->fifo[i_fifo].l_unit )
770 if ( p_aout->fifo[i_fifo].l_unit >= /* p_aout->fifo[i_fifo].b_stereo == 1 */
771 ((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 1)) )
773 p_aout->fifo[i_fifo].l_unit -= /* p_aout->fifo[i_fifo].b_stereo == 1 */
774 ((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 1));
777 l_units -= p_aout->fifo[i_fifo].l_units;
779 vlc_mutex_lock( &p_aout->fifo[i_fifo].data_lock );
780 p_aout->fifo[i_fifo].l_start_frame = p_aout->fifo[i_fifo].l_next_frame;
781 vlc_cond_signal( &p_aout->fifo[i_fifo].data_wait );
782 vlc_mutex_unlock( &p_aout->fifo[i_fifo].data_lock );
784 /* p_aout->fifo[i_fifo].b_start_frame = 1; */
785 p_aout->fifo[i_fifo].l_next_frame += 1;
786 p_aout->fifo[i_fifo].l_next_frame &= AOUT_FIFO_SIZE;
787 p_aout->fifo[i_fifo].b_next_frame = 0;
793 intf_DbgMsg("aout debug: unknown fifo type (%i)\n", p_aout->fifo[i_fifo].i_type);
797 vlc_mutex_unlock( &p_aout->fifos_lock );
799 l_buffer_limit = p_aout->l_units << 1 ; /* p_aout->b_stereo == 1 */
801 for ( l_buffer = 0; l_buffer < l_buffer_limit; l_buffer++ )
803 ((u8 *)p_aout->buffer)[l_buffer] = (u8)( (p_aout->s32_buffer[l_buffer] / 256) + 128 );
804 p_aout->s32_buffer[l_buffer] = 0;
806 l_bytes = p_aout->p_sys_getbufinfo( p_aout, l_buffer_limit );
807 p_aout->date = mdate() + ((((mtime_t)(l_bytes / 2 )) * 1000000) / ((mtime_t)p_aout->l_rate)); /* sizeof(u8) << (p_aout->b_stereo) == 2 */
808 p_aout->p_sys_playsamples( p_aout, (byte_t *)p_aout->buffer, l_buffer_limit * sizeof(u8) );
809 if ( l_bytes > (l_buffer_limit * sizeof(u8)) )
811 msleep( p_aout->l_msleep );
815 vlc_mutex_lock( &p_aout->fifos_lock );
816 for ( i_fifo = 0; i_fifo < AOUT_MAX_FIFOS; i_fifo++ )
818 switch ( p_aout->fifo[i_fifo].i_type )
820 case AOUT_EMPTY_FIFO:
823 case AOUT_INTF_MONO_FIFO:
824 case AOUT_INTF_STEREO_FIFO:
825 free( p_aout->fifo[i_fifo].buffer ); /* !! */
826 p_aout->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO; /* !! */
827 intf_DbgMsg("aout debug: audio output fifo (%p) destroyed\n", &p_aout->fifo[i_fifo]);
830 case AOUT_ADEC_MONO_FIFO:
831 case AOUT_ADEC_STEREO_FIFO:
832 free( p_aout->fifo[i_fifo].buffer );
833 free( p_aout->fifo[i_fifo].date );
834 p_aout->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO; /* !! */
835 intf_DbgMsg("aout debug: audio output fifo (%p) destroyed\n", &p_aout->fifo[i_fifo]);
842 vlc_mutex_unlock( &p_aout->fifos_lock );
846 void aout_Thread_S16_Mono( aout_thread_t * p_aout )
850 void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
853 long l_buffer, l_buffer_limit;
854 long l_units, l_bytes;
856 intf_DbgMsg("adec debug: ********aout_Thread_S16_Stereo********\n");
857 intf_DbgMsg("adec debug: running audio output thread (%p) (pid == %i)\n", p_aout, getpid());
859 /* As the s32_buffer was created with calloc(), we don't have to set this
860 * memory to zero and we can immediately jump into the thread's loop */
861 while ( !p_aout->b_die )
863 vlc_mutex_lock( &p_aout->fifos_lock );
864 for ( i_fifo = 0; i_fifo < AOUT_MAX_FIFOS; i_fifo++ )
866 switch ( p_aout->fifo[i_fifo].i_type )
868 case AOUT_EMPTY_FIFO:
871 case AOUT_INTF_MONO_FIFO:
872 if ( p_aout->fifo[i_fifo].l_units > p_aout->l_units )
875 while ( l_buffer < (p_aout->l_units << 1) ) /* p_aout->b_stereo == 1 */
877 p_aout->s32_buffer[l_buffer++] +=
878 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[p_aout->fifo[i_fifo].l_unit] );
879 p_aout->s32_buffer[l_buffer++] +=
880 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[p_aout->fifo[i_fifo].l_unit] );
881 UPDATE_INCREMENT( p_aout->fifo[i_fifo].unit_increment, p_aout->fifo[i_fifo].l_unit )
883 p_aout->fifo[i_fifo].l_units -= p_aout->l_units;
888 while ( l_buffer < (p_aout->fifo[i_fifo].l_units << 1) ) /* p_aout->b_stereo == 1 */
890 p_aout->s32_buffer[l_buffer++] +=
891 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[p_aout->fifo[i_fifo].l_unit] );
892 p_aout->s32_buffer[l_buffer++] +=
893 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[p_aout->fifo[i_fifo].l_unit] );
894 UPDATE_INCREMENT( p_aout->fifo[i_fifo].unit_increment, p_aout->fifo[i_fifo].l_unit )
896 free( p_aout->fifo[i_fifo].buffer ); /* !! */
897 p_aout->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO; /* !! */
898 intf_DbgMsg("aout debug: audio output fifo (%p) destroyed\n", &p_aout->fifo[i_fifo]); /* !! */
902 case AOUT_INTF_STEREO_FIFO:
903 if ( p_aout->fifo[i_fifo].l_units > p_aout->l_units )
906 while ( l_buffer < (p_aout->l_units << 1) ) /* p_aout->b_stereo == 1 */
908 p_aout->s32_buffer[l_buffer++] +=
909 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[2*p_aout->fifo[i_fifo].l_unit] );
910 p_aout->s32_buffer[l_buffer++] +=
911 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[2*p_aout->fifo[i_fifo].l_unit+1] );
912 UPDATE_INCREMENT( p_aout->fifo[i_fifo].unit_increment, p_aout->fifo[i_fifo].l_unit )
914 p_aout->fifo[i_fifo].l_units -= p_aout->l_units;
919 while ( l_buffer < (p_aout->fifo[i_fifo].l_units << 1) ) /* p_aout->b_stereo == 1 */
921 p_aout->s32_buffer[l_buffer++] +=
922 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[2*p_aout->fifo[i_fifo].l_unit] );
923 p_aout->s32_buffer[l_buffer++] +=
924 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[2*p_aout->fifo[i_fifo].l_unit+1] );
925 UPDATE_INCREMENT( p_aout->fifo[i_fifo].unit_increment, p_aout->fifo[i_fifo].l_unit )
927 free( p_aout->fifo[i_fifo].buffer ); /* !! */
928 p_aout->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO; /* !! */
929 intf_DbgMsg("aout debug: audio output fifo (%p) destroyed\n", &p_aout->fifo[i_fifo]); /* !! */
933 case AOUT_ADEC_MONO_FIFO:
934 if ( p_aout->fifo[i_fifo].b_die )
936 free( p_aout->fifo[i_fifo].buffer );
937 free( p_aout->fifo[i_fifo].date );
938 p_aout->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO; /* !! */
939 intf_DbgMsg("aout debug: audio output fifo (%p) destroyed\n", &p_aout->fifo[i_fifo]);
943 l_units = p_aout->l_units;
945 while ( l_units > 0 )
947 if ( !p_aout->fifo[i_fifo].b_next_frame )
949 if ( NextFrame(p_aout, &p_aout->fifo[i_fifo], p_aout->date + ((((mtime_t)(l_buffer >> 1)) * 1000000) / ((mtime_t)p_aout->l_rate))) )
955 if ( p_aout->fifo[i_fifo].l_units > l_units )
957 l_buffer_limit = p_aout->l_units << 1; /* p_aout->b_stereo == 1 */
958 while ( l_buffer < l_buffer_limit )
960 p_aout->s32_buffer[l_buffer++] +=
961 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[p_aout->fifo[i_fifo].l_unit] );
962 p_aout->s32_buffer[l_buffer++] +=
963 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[p_aout->fifo[i_fifo].l_unit] );
965 UPDATE_INCREMENT( p_aout->fifo[i_fifo].unit_increment, p_aout->fifo[i_fifo].l_unit )
966 if ( p_aout->fifo[i_fifo].l_unit >= /* p_aout->fifo[i_fifo].b_stereo == 0 */
967 ((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 0)) )
969 p_aout->fifo[i_fifo].l_unit -= /* p_aout->fifo[i_fifo].b_stereo == 0 */
970 ((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 0));
973 p_aout->fifo[i_fifo].l_units -= l_units;
978 l_buffer_limit = l_buffer + (p_aout->fifo[i_fifo].l_units << 1);
979 /* p_aout->b_stereo == 1 */
980 while ( l_buffer < l_buffer_limit )
982 p_aout->s32_buffer[l_buffer++] +=
983 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[p_aout->fifo[i_fifo].l_unit] );
984 p_aout->s32_buffer[l_buffer++] +=
985 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[p_aout->fifo[i_fifo].l_unit] );
987 UPDATE_INCREMENT( p_aout->fifo[i_fifo].unit_increment, p_aout->fifo[i_fifo].l_unit )
988 if ( p_aout->fifo[i_fifo].l_unit >= /* p_aout->fifo[i_fifo].b_stereo == 0 */
989 ((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 0)) )
991 p_aout->fifo[i_fifo].l_unit -= /* p_aout->fifo[i_fifo].b_stereo == 0 */
992 ((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 0));
995 l_units -= p_aout->fifo[i_fifo].l_units;
997 vlc_mutex_lock( &p_aout->fifo[i_fifo].data_lock );
998 p_aout->fifo[i_fifo].l_start_frame = p_aout->fifo[i_fifo].l_next_frame;
999 vlc_cond_signal( &p_aout->fifo[i_fifo].data_wait );
1000 vlc_mutex_unlock( &p_aout->fifo[i_fifo].data_lock );
1002 /* p_aout->fifo[i_fifo].b_start_frame = 1; */
1003 p_aout->fifo[i_fifo].l_next_frame += 1;
1004 p_aout->fifo[i_fifo].l_next_frame &= AOUT_FIFO_SIZE;
1005 p_aout->fifo[i_fifo].b_next_frame = 0;
1010 case AOUT_ADEC_STEREO_FIFO:
1011 if ( p_aout->fifo[i_fifo].b_die )
1013 free( p_aout->fifo[i_fifo].buffer );
1014 free( p_aout->fifo[i_fifo].date );
1015 p_aout->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO; /* !! */
1016 intf_DbgMsg("aout debug: audio output fifo (%p) destroyed\n", &p_aout->fifo[i_fifo]);
1020 l_units = p_aout->l_units;
1022 while ( l_units > 0 )
1024 if ( !p_aout->fifo[i_fifo].b_next_frame )
1026 if ( NextFrame(p_aout, &p_aout->fifo[i_fifo], p_aout->date + ((((mtime_t)(l_buffer >> 1)) * 1000000) / ((mtime_t)p_aout->l_rate))) )
1032 if ( p_aout->fifo[i_fifo].l_units > l_units )
1034 l_buffer_limit = p_aout->l_units << 1; /* p_aout->b_stereo == 1 */
1035 while ( l_buffer < l_buffer_limit )
1037 p_aout->s32_buffer[l_buffer++] +=
1038 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[2*p_aout->fifo[i_fifo].l_unit] );
1039 p_aout->s32_buffer[l_buffer++] +=
1040 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[2*p_aout->fifo[i_fifo].l_unit+1] );
1042 UPDATE_INCREMENT( p_aout->fifo[i_fifo].unit_increment, p_aout->fifo[i_fifo].l_unit )
1043 if ( p_aout->fifo[i_fifo].l_unit >= /* p_aout->fifo[i_fifo].b_stereo == 1 */
1044 ((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 1)) )
1046 p_aout->fifo[i_fifo].l_unit -= /* p_aout->fifo[i_fifo].b_stereo == 1 */
1047 ((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 1));
1050 p_aout->fifo[i_fifo].l_units -= l_units;
1055 l_buffer_limit = l_buffer + (p_aout->fifo[i_fifo].l_units << 1);
1056 /* p_aout->b_stereo == 1 */
1057 while ( l_buffer < l_buffer_limit )
1059 p_aout->s32_buffer[l_buffer++] +=
1060 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[2*p_aout->fifo[i_fifo].l_unit] );
1061 p_aout->s32_buffer[l_buffer++] +=
1062 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[2*p_aout->fifo[i_fifo].l_unit+1] );
1064 UPDATE_INCREMENT( p_aout->fifo[i_fifo].unit_increment, p_aout->fifo[i_fifo].l_unit )
1065 if ( p_aout->fifo[i_fifo].l_unit >= /* p_aout->fifo[i_fifo].b_stereo == 1 */
1066 ((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 1)) )
1068 p_aout->fifo[i_fifo].l_unit -= /* p_aout->fifo[i_fifo].b_stereo == 1 */
1069 ((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 1));
1072 l_units -= p_aout->fifo[i_fifo].l_units;
1074 vlc_mutex_lock( &p_aout->fifo[i_fifo].data_lock );
1075 p_aout->fifo[i_fifo].l_start_frame = p_aout->fifo[i_fifo].l_next_frame;
1076 vlc_cond_signal( &p_aout->fifo[i_fifo].data_wait );
1077 vlc_mutex_unlock( &p_aout->fifo[i_fifo].data_lock );
1079 /* p_aout->fifo[i_fifo].b_start_frame = 1; */
1080 p_aout->fifo[i_fifo].l_next_frame += 1;
1081 p_aout->fifo[i_fifo].l_next_frame &= AOUT_FIFO_SIZE;
1082 p_aout->fifo[i_fifo].b_next_frame = 0;
1088 intf_DbgMsg("aout debug: unknown fifo type (%i)\n", p_aout->fifo[i_fifo].i_type);
1092 vlc_mutex_unlock( &p_aout->fifos_lock );
1094 l_buffer_limit = p_aout->l_units << 1; /* p_aout->b_stereo == 1 */
1096 for ( l_buffer = 0; l_buffer < l_buffer_limit; l_buffer++ )
1098 ((s16 *)p_aout->buffer)[l_buffer] = (s16)( p_aout->s32_buffer[l_buffer] / AOUT_MAX_FIFOS );
1099 p_aout->s32_buffer[l_buffer] = 0;
1102 l_bytes = p_aout->p_sys_getbufinfo( p_aout, l_buffer_limit );
1103 p_aout->date = -1000000 + mdate() + ((((mtime_t)(l_bytes / 4)) * 1000000) / ((mtime_t)p_aout->l_rate)); /* sizeof(s16) << (p_aout->b_stereo) == 4 */
1104 p_aout->p_sys_playsamples( p_aout, (byte_t *)p_aout->buffer, l_buffer_limit * sizeof(s16) );
1105 if ( l_bytes > (l_buffer_limit * sizeof(s16)) )
1107 msleep( p_aout->l_msleep );
1111 vlc_mutex_lock( &p_aout->fifos_lock );
1112 for ( i_fifo = 0; i_fifo < AOUT_MAX_FIFOS; i_fifo++ )
1114 switch ( p_aout->fifo[i_fifo].i_type )
1116 case AOUT_EMPTY_FIFO:
1119 case AOUT_INTF_MONO_FIFO:
1120 case AOUT_INTF_STEREO_FIFO:
1121 free( p_aout->fifo[i_fifo].buffer ); /* !! */
1122 p_aout->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO; /* !! */
1123 intf_DbgMsg("aout debug: audio output fifo (%p) destroyed\n", &p_aout->fifo[i_fifo]);
1126 case AOUT_ADEC_MONO_FIFO:
1127 case AOUT_ADEC_STEREO_FIFO:
1128 free( p_aout->fifo[i_fifo].buffer );
1129 free( p_aout->fifo[i_fifo].date );
1130 p_aout->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO; /* !! */
1131 intf_DbgMsg("aout debug: audio output fifo (%p) destroyed\n", &p_aout->fifo[i_fifo]);
1138 vlc_mutex_unlock( &p_aout->fifos_lock );
1141 void aout_Thread_U16_Mono( aout_thread_t * p_aout )
1145 void aout_Thread_U16_Stereo( aout_thread_t * p_aout )