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() */
28 #include "mtime.h" /* mtime_t, mdate(), msleep() */
29 #include "vlc_thread.h"
31 #include "intf_msg.h" /* intf_DbgMsg(), intf_ErrMsg() */
33 #include "audio_output.h"
34 #include "audio_sys.h"
37 /*****************************************************************************
39 *****************************************************************************/
41 static int aout_SpawnThread( aout_thread_t * p_aout );
43 /* Creating as much aout_Thread functions as configurations is one solution,
44 * examining the different cases in the Thread loop of an unique function is
45 * another. I chose the first solution. */
46 void aout_Thread_S8_Mono ( aout_thread_t * p_aout );
47 void aout_Thread_U8_Mono ( aout_thread_t * p_aout );
48 void aout_Thread_S16_Mono ( aout_thread_t * p_aout );
49 void aout_Thread_U16_Mono ( aout_thread_t * p_aout );
50 void aout_Thread_S8_Stereo ( aout_thread_t * p_aout );
51 void aout_Thread_U8_Stereo ( aout_thread_t * p_aout );
52 void aout_Thread_S16_Stereo ( aout_thread_t * p_aout );
53 void aout_Thread_U16_Stereo ( aout_thread_t * p_aout );
55 static __inline__ void InitializeIncrement( aout_increment_t * p_increment, long l_numerator, long l_denominator );
56 static __inline__ int NextFrame( aout_thread_t * p_aout, aout_fifo_t * p_fifo, mtime_t aout_date );
58 /*****************************************************************************
59 * aout_CreateThread: initialize audio thread
60 *****************************************************************************/
61 aout_thread_t *aout_CreateThread( int *pi_status )
63 aout_thread_t * p_aout; /* thread descriptor */
65 // int i_status; /* thread status */
67 /* Allocate descriptor */
68 p_aout = (aout_thread_t *) malloc( sizeof(aout_thread_t) );
74 /* initialize method-dependent functions */
75 psz_method = main_GetPszVariable( AOUT_METHOD_VAR, AOUT_DEFAULT_METHOD );
77 if( !strcmp(psz_method, "dummy") )
79 p_aout->p_sys_open = aout_DummySysOpen;
80 p_aout->p_sys_reset = aout_DummySysReset;
81 p_aout->p_sys_setformat = aout_DummySysSetFormat;
82 p_aout->p_sys_setchannels = aout_DummySysSetChannels;
83 p_aout->p_sys_setrate = aout_DummySysSetRate;
84 p_aout->p_sys_getbufinfo = aout_DummySysGetBufInfo;
85 p_aout->p_sys_playsamples = aout_DummySysPlaySamples;
86 p_aout->p_sys_close = aout_DummySysClose;
89 else if( !strcmp(psz_method, "dsp") )
91 p_aout->p_sys_open = aout_DspSysOpen;
92 p_aout->p_sys_reset = aout_DspSysReset;
93 p_aout->p_sys_setformat = aout_DspSysSetFormat;
94 p_aout->p_sys_setchannels = aout_DspSysSetChannels;
95 p_aout->p_sys_setrate = aout_DspSysSetRate;
96 p_aout->p_sys_getbufinfo = aout_DspSysGetBufInfo;
97 p_aout->p_sys_playsamples = aout_DspSysPlaySamples;
98 p_aout->p_sys_close = aout_DspSysClose;
102 else if( !strcmp(psz_method, "esd") )
104 p_aout->p_sys_open = aout_EsdSysOpen;
105 p_aout->p_sys_reset = aout_EsdSysReset;
106 p_aout->p_sys_setformat = aout_EsdSysSetFormat;
107 p_aout->p_sys_setchannels = aout_EsdSysSetChannels;
108 p_aout->p_sys_setrate = aout_EsdSysSetRate;
109 p_aout->p_sys_getbufinfo = aout_EsdSysGetBufInfo;
110 p_aout->p_sys_playsamples = aout_EsdSysPlaySamples;
111 p_aout->p_sys_close = aout_EsdSysClose;
116 intf_ErrMsg( "error: requested audio output method not available\n" );
122 * Initialize audio device
124 if ( p_aout->p_sys_open( p_aout ) )
130 p_aout->b_stereo = ( p_aout->i_channels == 2 ) ? 1 : 0; /* XXX only works
131 for i_channels == 1 or 2 */
133 if ( p_aout->p_sys_reset( p_aout ) )
135 p_aout->p_sys_close( p_aout );
139 if ( p_aout->p_sys_setformat( p_aout ) )
141 p_aout->p_sys_close( p_aout );
145 if ( p_aout->p_sys_setchannels( p_aout ) )
147 p_aout->p_sys_close( p_aout );
151 if ( p_aout->p_sys_setrate( p_aout ) )
153 p_aout->p_sys_close( p_aout );
158 //?? maybe it would be cleaner to change SpawnThread prototype
159 //?? see vout to handle status correctly - however, it is not critical since
160 //?? this thread is only called in main and all calls are blocking
161 if( aout_SpawnThread( p_aout ) )
163 p_aout->p_sys_close( p_aout );
171 /*****************************************************************************
173 *****************************************************************************/
174 static int aout_SpawnThread( aout_thread_t * p_aout )
178 void * aout_thread = NULL;
180 intf_DbgMsg("aout debug: spawning audio output thread (%p)\n", p_aout);
182 /* We want the audio output thread to live */
185 /* Initialize the fifos lock */
186 vlc_mutex_init( &p_aout->fifos_lock );
187 /* Initialize audio fifos : set all fifos as empty and initialize locks */
188 for ( i_fifo = 0; i_fifo < AOUT_MAX_FIFOS; i_fifo++ )
190 p_aout->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO;
191 vlc_mutex_init( &p_aout->fifo[i_fifo].data_lock );
192 vlc_cond_init( &p_aout->fifo[i_fifo].data_wait );
195 /* Compute the size (in audio units) of the audio output buffer. Although
196 * AOUT_BUFFER_DURATION is given in microseconds, the output rate is given
197 * in Hz, that's why we need to divide by 10^6 microseconds (1 second) */
198 p_aout->l_units = (long)( ((s64)p_aout->l_rate * AOUT_BUFFER_DURATION) / 1000000 );
199 p_aout->l_msleep = (long)( ((s64)p_aout->l_units * 1000000) / (s64)p_aout->l_rate );
201 /* Make aout_thread point to the right thread function, and compute the
202 * byte size of the audio output buffer */
203 switch ( p_aout->i_channels )
205 /* Audio output is mono */
207 switch ( p_aout->i_format )
210 l_bytes = 1 * sizeof(u8) * p_aout->l_units;
211 aout_thread = (void *)aout_Thread_U8_Mono;
215 l_bytes = 1 * sizeof(s8) * p_aout->l_units;
216 aout_thread = (void *)aout_Thread_S8_Mono;
219 case AOUT_FMT_U16_LE:
220 case AOUT_FMT_U16_BE:
221 l_bytes = 1 * sizeof(u16) * p_aout->l_units;
222 aout_thread = (void *)aout_Thread_U16_Mono;
225 case AOUT_FMT_S16_LE:
226 case AOUT_FMT_S16_BE:
227 l_bytes = 1 * sizeof(s16) * p_aout->l_units;
228 aout_thread = (void *)aout_Thread_S16_Mono;
232 intf_ErrMsg("aout error: unknown audio output format (%i)\n",
238 /* Audio output is stereo */
240 switch ( p_aout->i_format )
243 l_bytes = 2 * sizeof(u8) * p_aout->l_units;
244 aout_thread = (void *)aout_Thread_U8_Stereo;
248 l_bytes = 2 * sizeof(s8) * p_aout->l_units;
249 aout_thread = (void *)aout_Thread_S8_Stereo;
252 case AOUT_FMT_U16_LE:
253 case AOUT_FMT_U16_BE:
254 l_bytes = 2 * sizeof(u16) * p_aout->l_units;
255 aout_thread = (void *)aout_Thread_U16_Stereo;
258 case AOUT_FMT_S16_LE:
259 case AOUT_FMT_S16_BE:
260 l_bytes = 2 * sizeof(s16) * p_aout->l_units;
261 aout_thread = (void *)aout_Thread_S16_Stereo;
265 intf_ErrMsg("aout error: unknown audio output format (%i)\n",
272 intf_ErrMsg("aout error: unknown number of audio channels (%i)\n",
273 p_aout->i_channels );
277 /* Allocate the memory needed by the audio output buffers, and set to zero
278 * the s32 buffer's memory */
279 if ( (p_aout->buffer = malloc(l_bytes)) == NULL )
281 intf_ErrMsg("aout error: not enough memory to create the output buffer\n");
284 if ( (p_aout->s32_buffer = (s32 *)calloc(p_aout->l_units, sizeof(s32) << ( p_aout->b_stereo))) == NULL )
286 intf_ErrMsg("aout error: not enough memory to create the s32 output buffer\n");
287 free( p_aout->buffer );
291 /* Before launching the thread, we try to predict the date of the first
292 * audio unit in the first output buffer */
293 p_aout->date = mdate() - 1000000;
295 /* Launch the thread */
296 if ( vlc_thread_create( &p_aout->thread_id, "audio output", (vlc_thread_func_t)aout_thread, p_aout ) )
298 intf_ErrMsg("aout error: can't spawn audio output thread (%p)\n", p_aout);
299 free( p_aout->buffer );
300 free( p_aout->s32_buffer );
304 intf_DbgMsg("aout debug: audio output thread (%p) spawned\n", p_aout);
308 /*****************************************************************************
310 *****************************************************************************/
311 void aout_DestroyThread( aout_thread_t * p_aout, int *pi_status )
313 //???? pi_status is not handled correctly: check vout how to do!
315 intf_DbgMsg("aout debug: requesting termination of audio output thread (%p)\n", p_aout);
317 /* Ask thread to kill itself and wait until it's done */
319 vlc_thread_join( p_aout->thread_id ); // only if pi_status is NULL
321 /* Free the allocated memory */
322 free( p_aout->buffer );
323 free( p_aout->s32_buffer );
325 /* Free the structure */
326 p_aout->p_sys_close( p_aout );
327 intf_DbgMsg("aout debug: audio device (%s) closed\n", p_aout->psz_device);
331 /*****************************************************************************
333 *****************************************************************************/
334 aout_fifo_t * aout_CreateFifo( aout_thread_t * p_aout, aout_fifo_t * p_fifo )
338 /* Take the fifos lock */
339 vlc_mutex_lock( &p_aout->fifos_lock );
341 /* Looking for a free fifo structure */
342 for ( i_fifo = 0; i_fifo < AOUT_MAX_FIFOS; i_fifo++ )
344 if ( p_aout->fifo[i_fifo].i_type == AOUT_EMPTY_FIFO)
349 if ( i_fifo == AOUT_MAX_FIFOS )
351 intf_ErrMsg("aout error: no empty fifo available\n");
352 vlc_mutex_unlock( &p_aout->fifos_lock );
356 /* Initialize the new fifo structure */
357 switch ( p_aout->fifo[i_fifo].i_type = p_fifo->i_type )
359 case AOUT_INTF_MONO_FIFO:
360 case AOUT_INTF_STEREO_FIFO:
361 p_aout->fifo[i_fifo].b_die = 0;
363 p_aout->fifo[i_fifo].i_channels = p_fifo->i_channels;
364 p_aout->fifo[i_fifo].b_stereo = p_fifo->b_stereo;
365 p_aout->fifo[i_fifo].l_rate = p_fifo->l_rate;
367 p_aout->fifo[i_fifo].buffer = p_fifo->buffer;
369 p_aout->fifo[i_fifo].l_unit = 0;
370 InitializeIncrement( &p_aout->fifo[i_fifo].unit_increment, p_fifo->l_rate, p_aout->l_rate );
371 p_aout->fifo[i_fifo].l_units = p_fifo->l_units;
374 case AOUT_ADEC_MONO_FIFO:
375 case AOUT_ADEC_STEREO_FIFO:
376 p_aout->fifo[i_fifo].b_die = 0;
378 p_aout->fifo[i_fifo].i_channels = p_fifo->i_channels;
379 p_aout->fifo[i_fifo].b_stereo = p_fifo->b_stereo;
380 p_aout->fifo[i_fifo].l_rate = p_fifo->l_rate;
382 p_aout->fifo[i_fifo].l_frame_size = p_fifo->l_frame_size;
383 /* Allocate the memory needed to store the audio frames. As the
384 * fifo is a rotative fifo, we must be able to find out whether the
385 * fifo is full or empty, that's why we must in fact allocate memory
386 * for (AOUT_FIFO_SIZE+1) audio frames. */
387 if ( (p_aout->fifo[i_fifo].buffer = malloc( sizeof(s16)*(AOUT_FIFO_SIZE+1)*p_fifo->l_frame_size )) == NULL )
389 intf_ErrMsg("aout error: not enough memory to create the frames buffer\n");
390 p_aout->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO;
391 vlc_mutex_unlock( &p_aout->fifos_lock );
395 /* Allocate the memory needed to store the dates of the frames */
396 if ( (p_aout->fifo[i_fifo].date = (mtime_t *)malloc( sizeof(mtime_t)*(AOUT_FIFO_SIZE+1) )) == NULL )
398 intf_ErrMsg("aout error: not enough memory to create the dates buffer\n");
399 free( p_aout->fifo[i_fifo].buffer );
400 p_aout->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO;
401 vlc_mutex_unlock( &p_aout->fifos_lock );
405 /* Set the fifo's buffer as empty (the first frame that is to be
406 * played is also the first frame that is not to be played) */
407 p_aout->fifo[i_fifo].l_start_frame = 0;
408 /* p_aout->fifo[i_fifo].l_next_frame = 0; */
409 p_aout->fifo[i_fifo].l_end_frame = 0;
411 /* Waiting for the audio decoder to compute enough frames to work
412 * out the fifo's current rate (as soon as the decoder has decoded
413 * enough frames, the members of the fifo structure that are not
414 * initialized now will be calculated) */
415 p_aout->fifo[i_fifo].b_start_frame = 0;
416 p_aout->fifo[i_fifo].b_next_frame = 0;
420 intf_ErrMsg("aout error: unknown fifo type (%i)\n", p_aout->fifo[i_fifo].i_type);
421 p_aout->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO;
422 vlc_mutex_unlock( &p_aout->fifos_lock );
426 /* Release the fifos lock */
427 vlc_mutex_unlock( &p_aout->fifos_lock );
429 /* Return the pointer to the fifo structure */
430 intf_DbgMsg("aout debug: audio output fifo (%p) allocated\n", &p_aout->fifo[i_fifo]);
431 return( &p_aout->fifo[i_fifo] );
434 /*****************************************************************************
436 *****************************************************************************/
437 void aout_DestroyFifo( aout_fifo_t * p_fifo )
439 intf_DbgMsg("aout debug: requesting destruction of audio output fifo (%p)\n", p_fifo);
443 /* Here are the local macros */
445 #define UPDATE_INCREMENT( increment, integer ) \
446 if ( ((increment).l_remainder += (increment).l_euclidean_remainder) >= 0 )\
448 (integer) += (increment).l_euclidean_integer + 1; \
449 (increment).l_remainder -= (increment).l_euclidean_denominator; \
453 (integer) += (increment).l_euclidean_integer; \
456 /* Following functions are local */
458 /*****************************************************************************
459 * InitializeIncrement
460 *****************************************************************************/
461 static __inline__ void InitializeIncrement( aout_increment_t * p_increment, long l_numerator, long l_denominator )
463 p_increment->l_remainder = -l_denominator;
465 p_increment->l_euclidean_integer = 0;
466 while ( l_numerator >= l_denominator )
468 p_increment->l_euclidean_integer++;
469 l_numerator -= l_denominator;
472 p_increment->l_euclidean_remainder = l_numerator;
474 p_increment->l_euclidean_denominator = l_denominator;
477 /*****************************************************************************
479 *****************************************************************************/
480 static __inline__ int NextFrame( aout_thread_t * p_aout, aout_fifo_t * p_fifo, mtime_t aout_date )
482 long l_units, l_rate;
484 /* We take the lock */
485 vlc_mutex_lock( &p_fifo->data_lock );
487 /* Are we looking for a dated start frame ? */
488 if ( !p_fifo->b_start_frame )
490 while ( p_fifo->l_start_frame != p_fifo->l_end_frame )
492 if ( p_fifo->date[p_fifo->l_start_frame] != LAST_MDATE )
494 p_fifo->b_start_frame = 1;
495 p_fifo->l_next_frame = (p_fifo->l_start_frame + 1) & AOUT_FIFO_SIZE;
496 p_fifo->l_unit = p_fifo->l_start_frame * (p_fifo->l_frame_size >> (p_fifo->b_stereo));
499 p_fifo->l_start_frame = (p_fifo->l_start_frame + 1) & AOUT_FIFO_SIZE;
502 if ( p_fifo->l_start_frame == p_fifo->l_end_frame )
504 vlc_mutex_unlock( &p_fifo->data_lock );
509 /* We are looking for the next dated frame */
510 /* FIXME : is the output fifo full ? */
511 while ( !p_fifo->b_next_frame )
513 while ( p_fifo->l_next_frame != p_fifo->l_end_frame )
515 if ( p_fifo->date[p_fifo->l_next_frame] != LAST_MDATE )
517 p_fifo->b_next_frame = 1;
520 p_fifo->l_next_frame = (p_fifo->l_next_frame + 1) & AOUT_FIFO_SIZE;
523 while ( p_fifo->l_next_frame == p_fifo->l_end_frame )
525 vlc_cond_wait( &p_fifo->data_wait, &p_fifo->data_lock );
528 vlc_mutex_unlock( &p_fifo->data_lock );
534 l_units = ((p_fifo->l_next_frame - p_fifo->l_start_frame) & AOUT_FIFO_SIZE) * (p_fifo->l_frame_size >> (p_fifo->b_stereo));
536 l_rate = p_fifo->l_rate + ((aout_date - p_fifo->date[p_fifo->l_start_frame]) / 256);
537 // fprintf( stderr, "aout debug: %lli (%li);\n", aout_date - p_fifo->date[p_fifo->l_start_frame], l_rate );
539 InitializeIncrement( &p_fifo->unit_increment, l_rate, p_aout->l_rate );
541 p_fifo->l_units = (((l_units - (p_fifo->l_unit -
542 (p_fifo->l_start_frame * (p_fifo->l_frame_size >> (p_fifo->b_stereo)))))
543 * p_aout->l_rate) / l_rate) + 1;
545 /* We release the lock before leaving */
546 vlc_mutex_unlock( &p_fifo->data_lock );
550 void aout_Thread_S8_Mono( aout_thread_t * p_aout )
554 void aout_Thread_S8_Stereo( aout_thread_t * p_aout )
558 void aout_Thread_U8_Mono( aout_thread_t * p_aout )
562 void aout_Thread_U8_Stereo( aout_thread_t * p_aout )
565 long l_buffer, l_buffer_limit;
566 long l_units, l_bytes;
568 intf_DbgMsg("adec debug: ********aout_Thread_U8_Stereo********\n");
569 intf_DbgMsg("adec debug: running audio output thread (%p) (pid == %i)\n", p_aout, getpid());
571 /* As the s32_buffer was created with calloc(), we don't have to set this
572 * memory to zero and we can immediately jump into the thread's loop */
573 while ( !p_aout->b_die )
575 vlc_mutex_lock( &p_aout->fifos_lock );
576 for ( i_fifo = 0; i_fifo < AOUT_MAX_FIFOS; i_fifo++ )
578 switch ( p_aout->fifo[i_fifo].i_type )
580 case AOUT_EMPTY_FIFO:
583 case AOUT_INTF_MONO_FIFO:
584 if ( p_aout->fifo[i_fifo].l_units > p_aout->l_units )
587 while ( l_buffer < (p_aout->l_units << 1) ) /* p_aout->b_stereo == 1 */
589 p_aout->s32_buffer[l_buffer++] +=
590 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[p_aout->fifo[i_fifo].l_unit] );
591 p_aout->s32_buffer[l_buffer++] +=
592 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[p_aout->fifo[i_fifo].l_unit] );
593 UPDATE_INCREMENT( p_aout->fifo[i_fifo].unit_increment, p_aout->fifo[i_fifo].l_unit )
595 p_aout->fifo[i_fifo].l_units -= p_aout->l_units;
600 while ( l_buffer < (p_aout->fifo[i_fifo].l_units << 1) ) /* p_aout->b_stereo == 1 */
602 p_aout->s32_buffer[l_buffer++] +=
603 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[p_aout->fifo[i_fifo].l_unit] );
604 p_aout->s32_buffer[l_buffer++] +=
605 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[p_aout->fifo[i_fifo].l_unit] );
606 UPDATE_INCREMENT( p_aout->fifo[i_fifo].unit_increment, p_aout->fifo[i_fifo].l_unit )
608 free( p_aout->fifo[i_fifo].buffer ); /* !! */
609 p_aout->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO; /* !! */
610 intf_DbgMsg("aout debug: audio output fifo (%p) destroyed\n", &p_aout->fifo[i_fifo]); /* !! */
614 case AOUT_INTF_STEREO_FIFO:
615 if ( p_aout->fifo[i_fifo].l_units > p_aout->l_units )
618 while ( l_buffer < (p_aout->l_units << 1) ) /* p_aout->b_stereo == 1 */
620 p_aout->s32_buffer[l_buffer++] +=
621 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[2*p_aout->fifo[i_fifo].l_unit] );
622 p_aout->s32_buffer[l_buffer++] +=
623 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[2*p_aout->fifo[i_fifo].l_unit+1] );
624 UPDATE_INCREMENT( p_aout->fifo[i_fifo].unit_increment, p_aout->fifo[i_fifo].l_unit )
626 p_aout->fifo[i_fifo].l_units -= p_aout->l_units;
631 while ( l_buffer < (p_aout->fifo[i_fifo].l_units << 1) ) /* p_aout->b_stereo == 1 */
633 p_aout->s32_buffer[l_buffer++] +=
634 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[2*p_aout->fifo[i_fifo].l_unit] );
635 p_aout->s32_buffer[l_buffer++] +=
636 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[2*p_aout->fifo[i_fifo].l_unit+1] );
637 UPDATE_INCREMENT( p_aout->fifo[i_fifo].unit_increment, p_aout->fifo[i_fifo].l_unit )
639 free( p_aout->fifo[i_fifo].buffer ); /* !! */
640 p_aout->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO; /* !! */
641 intf_DbgMsg("aout debug: audio output fifo (%p) destroyed\n", &p_aout->fifo[i_fifo]); /* !! */
645 case AOUT_ADEC_MONO_FIFO:
646 if ( p_aout->fifo[i_fifo].b_die )
648 free( p_aout->fifo[i_fifo].buffer );
649 free( p_aout->fifo[i_fifo].date );
650 p_aout->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO; /* !! */
651 intf_DbgMsg("aout debug: audio output fifo (%p) destroyed\n", &p_aout->fifo[i_fifo]);
655 l_units = p_aout->l_units;
657 while ( l_units > 0 )
659 if ( !p_aout->fifo[i_fifo].b_next_frame )
661 if ( NextFrame(p_aout, &p_aout->fifo[i_fifo], p_aout->date + ((((mtime_t)(l_buffer >> 1)) * 1000000) / ((mtime_t)p_aout->l_rate))) )
667 if ( p_aout->fifo[i_fifo].l_units > l_units )
669 l_buffer_limit = p_aout->l_units << 1; /* p_aout->b_stereo == 1 */
670 while ( l_buffer < l_buffer_limit )
672 p_aout->s32_buffer[l_buffer++] +=
673 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[p_aout->fifo[i_fifo].l_unit] );
674 p_aout->s32_buffer[l_buffer++] +=
675 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[p_aout->fifo[i_fifo].l_unit] );
677 UPDATE_INCREMENT( p_aout->fifo[i_fifo].unit_increment, p_aout->fifo[i_fifo].l_unit )
678 if ( p_aout->fifo[i_fifo].l_unit >= /* p_aout->fifo[i_fifo].b_stereo == 0 */
679 ((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 0)) )
681 p_aout->fifo[i_fifo].l_unit -= /* p_aout->fifo[i_fifo].b_stereo == 0 */
682 ((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 0));
685 p_aout->fifo[i_fifo].l_units -= l_units;
690 l_buffer_limit = l_buffer + (p_aout->fifo[i_fifo].l_units << 1);
691 /* p_aout->b_stereo == 1 */
692 while ( l_buffer < l_buffer_limit )
694 p_aout->s32_buffer[l_buffer++] +=
695 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[p_aout->fifo[i_fifo].l_unit] );
696 p_aout->s32_buffer[l_buffer++] +=
697 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[p_aout->fifo[i_fifo].l_unit] );
699 UPDATE_INCREMENT( p_aout->fifo[i_fifo].unit_increment, p_aout->fifo[i_fifo].l_unit )
700 if ( p_aout->fifo[i_fifo].l_unit >= /* p_aout->fifo[i_fifo].b_stereo == 0 */
701 ((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 0)) )
703 p_aout->fifo[i_fifo].l_unit -= /* p_aout->fifo[i_fifo].b_stereo == 0 */
704 ((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 0));
707 l_units -= p_aout->fifo[i_fifo].l_units;
709 vlc_mutex_lock( &p_aout->fifo[i_fifo].data_lock );
710 p_aout->fifo[i_fifo].l_start_frame = p_aout->fifo[i_fifo].l_next_frame;
711 vlc_cond_signal( &p_aout->fifo[i_fifo].data_wait );
712 vlc_mutex_unlock( &p_aout->fifo[i_fifo].data_lock );
714 /* p_aout->fifo[i_fifo].b_start_frame = 1; */
715 p_aout->fifo[i_fifo].l_next_frame += 1;
716 p_aout->fifo[i_fifo].l_next_frame &= AOUT_FIFO_SIZE;
717 p_aout->fifo[i_fifo].b_next_frame = 0;
722 case AOUT_ADEC_STEREO_FIFO:
723 if ( p_aout->fifo[i_fifo].b_die )
725 free( p_aout->fifo[i_fifo].buffer );
726 free( p_aout->fifo[i_fifo].date );
727 p_aout->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO; /* !! */
728 intf_DbgMsg("aout debug: audio output fifo (%p) destroyed\n", &p_aout->fifo[i_fifo]);
732 l_units = p_aout->l_units;
734 while ( l_units > 0 )
736 if ( !p_aout->fifo[i_fifo].b_next_frame )
738 if ( NextFrame(p_aout, &p_aout->fifo[i_fifo], p_aout->date + ((((mtime_t)(l_buffer >> 1)) * 1000000) / ((mtime_t)p_aout->l_rate))) )
744 if ( p_aout->fifo[i_fifo].l_units > l_units )
746 l_buffer_limit = p_aout->l_units << 1; /* p_aout->b_stereo == 1 */
747 while ( l_buffer < l_buffer_limit )
749 p_aout->s32_buffer[l_buffer++] +=
750 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[2*p_aout->fifo[i_fifo].l_unit] );
751 p_aout->s32_buffer[l_buffer++] +=
752 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[2*p_aout->fifo[i_fifo].l_unit+1] );
754 UPDATE_INCREMENT( p_aout->fifo[i_fifo].unit_increment, p_aout->fifo[i_fifo].l_unit )
755 if ( p_aout->fifo[i_fifo].l_unit >= /* p_aout->fifo[i_fifo].b_stereo == 1 */
756 ((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 1)) )
758 p_aout->fifo[i_fifo].l_unit -= /* p_aout->fifo[i_fifo].b_stereo == 1 */
759 ((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 1));
762 p_aout->fifo[i_fifo].l_units -= l_units;
767 l_buffer_limit = l_buffer + (p_aout->fifo[i_fifo].l_units << 1);
768 /* p_aout->b_stereo == 1 */
769 while ( l_buffer < l_buffer_limit )
771 p_aout->s32_buffer[l_buffer++] +=
772 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[2*p_aout->fifo[i_fifo].l_unit] );
773 p_aout->s32_buffer[l_buffer++] +=
774 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[2*p_aout->fifo[i_fifo].l_unit+1] );
776 UPDATE_INCREMENT( p_aout->fifo[i_fifo].unit_increment, p_aout->fifo[i_fifo].l_unit )
777 if ( p_aout->fifo[i_fifo].l_unit >= /* p_aout->fifo[i_fifo].b_stereo == 1 */
778 ((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 1)) )
780 p_aout->fifo[i_fifo].l_unit -= /* p_aout->fifo[i_fifo].b_stereo == 1 */
781 ((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 1));
784 l_units -= p_aout->fifo[i_fifo].l_units;
786 vlc_mutex_lock( &p_aout->fifo[i_fifo].data_lock );
787 p_aout->fifo[i_fifo].l_start_frame = p_aout->fifo[i_fifo].l_next_frame;
788 vlc_cond_signal( &p_aout->fifo[i_fifo].data_wait );
789 vlc_mutex_unlock( &p_aout->fifo[i_fifo].data_lock );
791 /* p_aout->fifo[i_fifo].b_start_frame = 1; */
792 p_aout->fifo[i_fifo].l_next_frame += 1;
793 p_aout->fifo[i_fifo].l_next_frame &= AOUT_FIFO_SIZE;
794 p_aout->fifo[i_fifo].b_next_frame = 0;
800 intf_DbgMsg("aout debug: unknown fifo type (%i)\n", p_aout->fifo[i_fifo].i_type);
804 vlc_mutex_unlock( &p_aout->fifos_lock );
806 l_buffer_limit = p_aout->l_units << 1 ; /* p_aout->b_stereo == 1 */
808 for ( l_buffer = 0; l_buffer < l_buffer_limit; l_buffer++ )
810 ((u8 *)p_aout->buffer)[l_buffer] = (u8)( (p_aout->s32_buffer[l_buffer] / 256) + 128 );
811 p_aout->s32_buffer[l_buffer] = 0;
813 l_bytes = p_aout->p_sys_getbufinfo( p_aout, l_buffer_limit );
814 p_aout->date = mdate() + ((((mtime_t)(l_bytes / 2 )) * 1000000) / ((mtime_t)p_aout->l_rate)); /* sizeof(u8) << (p_aout->b_stereo) == 2 */
815 p_aout->p_sys_playsamples( p_aout, (byte_t *)p_aout->buffer, l_buffer_limit * sizeof(u8) );
816 if ( l_bytes > (l_buffer_limit * sizeof(u8)) )
818 msleep( p_aout->l_msleep );
822 vlc_mutex_lock( &p_aout->fifos_lock );
823 for ( i_fifo = 0; i_fifo < AOUT_MAX_FIFOS; i_fifo++ )
825 switch ( p_aout->fifo[i_fifo].i_type )
827 case AOUT_EMPTY_FIFO:
830 case AOUT_INTF_MONO_FIFO:
831 case AOUT_INTF_STEREO_FIFO:
832 free( p_aout->fifo[i_fifo].buffer ); /* !! */
833 p_aout->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO; /* !! */
834 intf_DbgMsg("aout debug: audio output fifo (%p) destroyed\n", &p_aout->fifo[i_fifo]);
837 case AOUT_ADEC_MONO_FIFO:
838 case AOUT_ADEC_STEREO_FIFO:
839 free( p_aout->fifo[i_fifo].buffer );
840 free( p_aout->fifo[i_fifo].date );
841 p_aout->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO; /* !! */
842 intf_DbgMsg("aout debug: audio output fifo (%p) destroyed\n", &p_aout->fifo[i_fifo]);
849 vlc_mutex_unlock( &p_aout->fifos_lock );
853 void aout_Thread_S16_Mono( aout_thread_t * p_aout )
857 void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
860 long l_buffer, l_buffer_limit;
861 long l_units, l_bytes;
863 intf_DbgMsg("adec debug: ********aout_Thread_S16_Stereo********\n");
864 intf_DbgMsg("adec debug: running audio output thread (%p) (pid == %i)\n", p_aout, getpid());
866 /* As the s32_buffer was created with calloc(), we don't have to set this
867 * memory to zero and we can immediately jump into the thread's loop */
868 while ( !p_aout->b_die )
870 vlc_mutex_lock( &p_aout->fifos_lock );
871 for ( i_fifo = 0; i_fifo < AOUT_MAX_FIFOS; i_fifo++ )
873 switch ( p_aout->fifo[i_fifo].i_type )
875 case AOUT_EMPTY_FIFO:
878 case AOUT_INTF_MONO_FIFO:
879 if ( p_aout->fifo[i_fifo].l_units > p_aout->l_units )
882 while ( l_buffer < (p_aout->l_units << 1) ) /* p_aout->b_stereo == 1 */
884 p_aout->s32_buffer[l_buffer++] +=
885 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[p_aout->fifo[i_fifo].l_unit] );
886 p_aout->s32_buffer[l_buffer++] +=
887 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[p_aout->fifo[i_fifo].l_unit] );
888 UPDATE_INCREMENT( p_aout->fifo[i_fifo].unit_increment, p_aout->fifo[i_fifo].l_unit )
890 p_aout->fifo[i_fifo].l_units -= p_aout->l_units;
895 while ( l_buffer < (p_aout->fifo[i_fifo].l_units << 1) ) /* p_aout->b_stereo == 1 */
897 p_aout->s32_buffer[l_buffer++] +=
898 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[p_aout->fifo[i_fifo].l_unit] );
899 p_aout->s32_buffer[l_buffer++] +=
900 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[p_aout->fifo[i_fifo].l_unit] );
901 UPDATE_INCREMENT( p_aout->fifo[i_fifo].unit_increment, p_aout->fifo[i_fifo].l_unit )
903 free( p_aout->fifo[i_fifo].buffer ); /* !! */
904 p_aout->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO; /* !! */
905 intf_DbgMsg("aout debug: audio output fifo (%p) destroyed\n", &p_aout->fifo[i_fifo]); /* !! */
909 case AOUT_INTF_STEREO_FIFO:
910 if ( p_aout->fifo[i_fifo].l_units > p_aout->l_units )
913 while ( l_buffer < (p_aout->l_units << 1) ) /* p_aout->b_stereo == 1 */
915 p_aout->s32_buffer[l_buffer++] +=
916 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[2*p_aout->fifo[i_fifo].l_unit] );
917 p_aout->s32_buffer[l_buffer++] +=
918 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[2*p_aout->fifo[i_fifo].l_unit+1] );
919 UPDATE_INCREMENT( p_aout->fifo[i_fifo].unit_increment, p_aout->fifo[i_fifo].l_unit )
921 p_aout->fifo[i_fifo].l_units -= p_aout->l_units;
926 while ( l_buffer < (p_aout->fifo[i_fifo].l_units << 1) ) /* p_aout->b_stereo == 1 */
928 p_aout->s32_buffer[l_buffer++] +=
929 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[2*p_aout->fifo[i_fifo].l_unit] );
930 p_aout->s32_buffer[l_buffer++] +=
931 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[2*p_aout->fifo[i_fifo].l_unit+1] );
932 UPDATE_INCREMENT( p_aout->fifo[i_fifo].unit_increment, p_aout->fifo[i_fifo].l_unit )
934 free( p_aout->fifo[i_fifo].buffer ); /* !! */
935 p_aout->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO; /* !! */
936 intf_DbgMsg("aout debug: audio output fifo (%p) destroyed\n", &p_aout->fifo[i_fifo]); /* !! */
940 case AOUT_ADEC_MONO_FIFO:
941 if ( p_aout->fifo[i_fifo].b_die )
943 free( p_aout->fifo[i_fifo].buffer );
944 free( p_aout->fifo[i_fifo].date );
945 p_aout->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO; /* !! */
946 intf_DbgMsg("aout debug: audio output fifo (%p) destroyed\n", &p_aout->fifo[i_fifo]);
950 l_units = p_aout->l_units;
952 while ( l_units > 0 )
954 if ( !p_aout->fifo[i_fifo].b_next_frame )
956 if ( NextFrame(p_aout, &p_aout->fifo[i_fifo], p_aout->date + ((((mtime_t)(l_buffer >> 1)) * 1000000) / ((mtime_t)p_aout->l_rate))) )
962 if ( p_aout->fifo[i_fifo].l_units > l_units )
964 l_buffer_limit = p_aout->l_units << 1; /* p_aout->b_stereo == 1 */
965 while ( l_buffer < l_buffer_limit )
967 p_aout->s32_buffer[l_buffer++] +=
968 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[p_aout->fifo[i_fifo].l_unit] );
969 p_aout->s32_buffer[l_buffer++] +=
970 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[p_aout->fifo[i_fifo].l_unit] );
972 UPDATE_INCREMENT( p_aout->fifo[i_fifo].unit_increment, p_aout->fifo[i_fifo].l_unit )
973 if ( p_aout->fifo[i_fifo].l_unit >= /* p_aout->fifo[i_fifo].b_stereo == 0 */
974 ((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 0)) )
976 p_aout->fifo[i_fifo].l_unit -= /* p_aout->fifo[i_fifo].b_stereo == 0 */
977 ((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 0));
980 p_aout->fifo[i_fifo].l_units -= l_units;
985 l_buffer_limit = l_buffer + (p_aout->fifo[i_fifo].l_units << 1);
986 /* p_aout->b_stereo == 1 */
987 while ( l_buffer < l_buffer_limit )
989 p_aout->s32_buffer[l_buffer++] +=
990 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[p_aout->fifo[i_fifo].l_unit] );
991 p_aout->s32_buffer[l_buffer++] +=
992 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[p_aout->fifo[i_fifo].l_unit] );
994 UPDATE_INCREMENT( p_aout->fifo[i_fifo].unit_increment, p_aout->fifo[i_fifo].l_unit )
995 if ( p_aout->fifo[i_fifo].l_unit >= /* p_aout->fifo[i_fifo].b_stereo == 0 */
996 ((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 0)) )
998 p_aout->fifo[i_fifo].l_unit -= /* p_aout->fifo[i_fifo].b_stereo == 0 */
999 ((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 0));
1002 l_units -= p_aout->fifo[i_fifo].l_units;
1004 vlc_mutex_lock( &p_aout->fifo[i_fifo].data_lock );
1005 p_aout->fifo[i_fifo].l_start_frame = p_aout->fifo[i_fifo].l_next_frame;
1006 vlc_cond_signal( &p_aout->fifo[i_fifo].data_wait );
1007 vlc_mutex_unlock( &p_aout->fifo[i_fifo].data_lock );
1009 /* p_aout->fifo[i_fifo].b_start_frame = 1; */
1010 p_aout->fifo[i_fifo].l_next_frame += 1;
1011 p_aout->fifo[i_fifo].l_next_frame &= AOUT_FIFO_SIZE;
1012 p_aout->fifo[i_fifo].b_next_frame = 0;
1017 case AOUT_ADEC_STEREO_FIFO:
1018 if ( p_aout->fifo[i_fifo].b_die )
1020 free( p_aout->fifo[i_fifo].buffer );
1021 free( p_aout->fifo[i_fifo].date );
1022 p_aout->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO; /* !! */
1023 intf_DbgMsg("aout debug: audio output fifo (%p) destroyed\n", &p_aout->fifo[i_fifo]);
1027 l_units = p_aout->l_units;
1029 while ( l_units > 0 )
1031 if ( !p_aout->fifo[i_fifo].b_next_frame )
1033 if ( NextFrame(p_aout, &p_aout->fifo[i_fifo], p_aout->date + ((((mtime_t)(l_buffer >> 1)) * 1000000) / ((mtime_t)p_aout->l_rate))) )
1039 if ( p_aout->fifo[i_fifo].l_units > l_units )
1041 l_buffer_limit = p_aout->l_units << 1; /* p_aout->b_stereo == 1 */
1042 while ( l_buffer < l_buffer_limit )
1044 p_aout->s32_buffer[l_buffer++] +=
1045 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[2*p_aout->fifo[i_fifo].l_unit] );
1046 p_aout->s32_buffer[l_buffer++] +=
1047 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[2*p_aout->fifo[i_fifo].l_unit+1] );
1049 UPDATE_INCREMENT( p_aout->fifo[i_fifo].unit_increment, p_aout->fifo[i_fifo].l_unit )
1050 if ( p_aout->fifo[i_fifo].l_unit >= /* p_aout->fifo[i_fifo].b_stereo == 1 */
1051 ((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 1)) )
1053 p_aout->fifo[i_fifo].l_unit -= /* p_aout->fifo[i_fifo].b_stereo == 1 */
1054 ((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 1));
1057 p_aout->fifo[i_fifo].l_units -= l_units;
1062 l_buffer_limit = l_buffer + (p_aout->fifo[i_fifo].l_units << 1);
1063 /* p_aout->b_stereo == 1 */
1064 while ( l_buffer < l_buffer_limit )
1066 p_aout->s32_buffer[l_buffer++] +=
1067 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[2*p_aout->fifo[i_fifo].l_unit] );
1068 p_aout->s32_buffer[l_buffer++] +=
1069 (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[2*p_aout->fifo[i_fifo].l_unit+1] );
1071 UPDATE_INCREMENT( p_aout->fifo[i_fifo].unit_increment, p_aout->fifo[i_fifo].l_unit )
1072 if ( p_aout->fifo[i_fifo].l_unit >= /* p_aout->fifo[i_fifo].b_stereo == 1 */
1073 ((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 1)) )
1075 p_aout->fifo[i_fifo].l_unit -= /* p_aout->fifo[i_fifo].b_stereo == 1 */
1076 ((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 1));
1079 l_units -= p_aout->fifo[i_fifo].l_units;
1081 vlc_mutex_lock( &p_aout->fifo[i_fifo].data_lock );
1082 p_aout->fifo[i_fifo].l_start_frame = p_aout->fifo[i_fifo].l_next_frame;
1083 vlc_cond_signal( &p_aout->fifo[i_fifo].data_wait );
1084 vlc_mutex_unlock( &p_aout->fifo[i_fifo].data_lock );
1086 /* p_aout->fifo[i_fifo].b_start_frame = 1; */
1087 p_aout->fifo[i_fifo].l_next_frame += 1;
1088 p_aout->fifo[i_fifo].l_next_frame &= AOUT_FIFO_SIZE;
1089 p_aout->fifo[i_fifo].b_next_frame = 0;
1095 intf_DbgMsg("aout debug: unknown fifo type (%i)\n", p_aout->fifo[i_fifo].i_type);
1099 vlc_mutex_unlock( &p_aout->fifos_lock );
1101 l_buffer_limit = p_aout->l_units << 1; /* p_aout->b_stereo == 1 */
1103 for ( l_buffer = 0; l_buffer < l_buffer_limit; l_buffer++ )
1105 ((s16 *)p_aout->buffer)[l_buffer] = (s16)( p_aout->s32_buffer[l_buffer] / AOUT_MAX_FIFOS );
1106 p_aout->s32_buffer[l_buffer] = 0;
1109 l_bytes = p_aout->p_sys_getbufinfo( p_aout, l_buffer_limit );
1110 p_aout->date = -1000000 + mdate() + ((((mtime_t)(l_bytes / 4)) * 1000000) / ((mtime_t)p_aout->l_rate)); /* sizeof(s16) << (p_aout->b_stereo) == 4 */
1111 p_aout->p_sys_playsamples( p_aout, (byte_t *)p_aout->buffer, l_buffer_limit * sizeof(s16) );
1112 if ( l_bytes > (l_buffer_limit * sizeof(s16)) )
1114 msleep( p_aout->l_msleep );
1118 vlc_mutex_lock( &p_aout->fifos_lock );
1119 for ( i_fifo = 0; i_fifo < AOUT_MAX_FIFOS; i_fifo++ )
1121 switch ( p_aout->fifo[i_fifo].i_type )
1123 case AOUT_EMPTY_FIFO:
1126 case AOUT_INTF_MONO_FIFO:
1127 case AOUT_INTF_STEREO_FIFO:
1128 free( p_aout->fifo[i_fifo].buffer ); /* !! */
1129 p_aout->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO; /* !! */
1130 intf_DbgMsg("aout debug: audio output fifo (%p) destroyed\n", &p_aout->fifo[i_fifo]);
1133 case AOUT_ADEC_MONO_FIFO:
1134 case AOUT_ADEC_STEREO_FIFO:
1135 free( p_aout->fifo[i_fifo].buffer );
1136 free( p_aout->fifo[i_fifo].date );
1137 p_aout->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO; /* !! */
1138 intf_DbgMsg("aout debug: audio output fifo (%p) destroyed\n", &p_aout->fifo[i_fifo]);
1145 vlc_mutex_unlock( &p_aout->fifos_lock );
1148 void aout_Thread_U16_Mono( aout_thread_t * p_aout )
1152 void aout_Thread_U16_Stereo( aout_thread_t * p_aout )