+//enum mad_flow libmad_output(void *data, struct mad_header const *p_libmad_header, struct mad_pcm *p_libmad_pcm)
+//{
+// mad_adec_thread_t *p_mad_adec= (mad_adec_thread_t *) data;
+// byte_t *buffer=NULL;
+// mad_fixed_t const *left_ch = p_libmad_pcm->samples[0], *right_ch = p_libmad_pcm->samples[1];
+// register int nsamples = p_libmad_pcm->length;
+// mad_fixed_t sample;
+// static struct audio_dither dither;
+//
+// /* Creating the audio output fifo.
+// * Assume the samplerate and nr of channels from the first decoded frame is right for the entire audio track.
+// */
+// if (p_mad_adec->p_aout_fifo==NULL)
+// {
+// p_mad_adec->p_aout_fifo = aout_CreateFifo(
+// p_mad_adec->p_fifo,
+// AOUT_FIFO_PCM, /* fifo type */
+// 2, /*p_libmad_pcm->channels,*/ /* nr. of channels */
+// p_libmad_pcm->samplerate, /* frame rate in Hz ?*/
+// p_libmad_pcm->length*2, /* length of output buffer *2 channels*/
+// NULL ); /* buffer */
+//
+// if ( p_mad_adec->p_aout_fifo == NULL )
+// {
+// return MAD_FLOW_BREAK;
+// }
+//
+// msg_Dbg( p_mad_adec->p_fifo, "aout fifo created");
+// }
+//
+// if (p_mad_adec->p_aout_fifo->i_rate != p_libmad_pcm->samplerate)
+// {
+// msg_Warn( p_mad_adec->p_fifo, "samplerate is changing from [%d] Hz "
+// "to [%d] Hz, sample size [%d], error_code [%0x]",
+// p_mad_adec->p_aout_fifo->i_rate, p_libmad_pcm->samplerate,
+// p_libmad_pcm->length,
+// p_mad_adec->libmad_decoder->sync->stream.error );
+// p_mad_adec->p_aout_fifo->i_rate = p_libmad_pcm->samplerate;
+// }
+//
+// if( p_mad_adec->i_current_pts )
+// {
+// p_mad_adec->p_aout_fifo->date[p_mad_adec->p_aout_fifo->i_end_frame]
+// = p_mad_adec->i_current_pts;
+// }
+// else
+// {
+// p_mad_adec->p_aout_fifo->date[p_mad_adec->p_aout_fifo->i_end_frame]
+// = LAST_MDATE;
+// }
+//// mad_timer_add(&p_mad_adec->libmad_timer,p_libmad_header->duration);
+//
+// buffer = ((byte_t *)p_mad_adec->p_aout_fifo->buffer) + (p_mad_adec->p_aout_fifo->i_end_frame * (p_libmad_pcm->length*4));
+//
+// while (nsamples--)
+// {
+// switch (p_mad_adec->audio_scaling)
+// {
+// case MPG321_SCALING:
+// sample = mpg321_s24_to_s16_pcm(16, *left_ch++, &dither);
+// break;
+// case FAST_SCALING: /* intended fall through */
+// default:
+// sample = s24_to_s16_pcm(*left_ch++);
+// break;
+// }
+//
+// /* left audio channel */
+//#ifndef WORDS_BIGENDIAN
+// *buffer++ = (byte_t) (sample >> 0);
+// *buffer++ = (byte_t) (sample >> 8);
+//#else
+// *buffer++ = (byte_t) (sample >> 8);
+// *buffer++ = (byte_t) (sample >> 0);
+//#endif
+// if (p_libmad_pcm->channels == 2)
+// {
+// /* right audio channel */
+// switch (p_mad_adec->audio_scaling)
+// {
+// case MPG321_SCALING:
+// sample = mpg321_s24_to_s16_pcm(16, *right_ch++, &dither);
+// break;
+// case FAST_SCALING: /* intended fall through */
+// default:
+// sample = s24_to_s16_pcm(*right_ch++);
+// break;
+// }
+// }
+// /* else reuse left_ch */
+//#ifndef WORDS_BIGENDIAN
+// *buffer++ = (byte_t) (sample >> 0);
+// *buffer++ = (byte_t) (sample >> 8);
+//#else
+// *buffer++ = (byte_t) (sample >> 8);
+// *buffer++ = (byte_t) (sample >> 0);
+//#endif
+// }
+//
+// /* DEBUG */
+// /*
+// if (p_libmad_pcm->channels == 1) {
+// msg_Dbg( p_mad_adec->p_fifo, "libmad_output channels [%d]", p_libmad_pcm->channels);
+// }
+// */
+//
+// vlc_mutex_lock (&p_mad_adec->p_aout_fifo->data_lock);
+// p_mad_adec->p_aout_fifo->i_end_frame = (p_mad_adec->p_aout_fifo->i_end_frame + 1) & AOUT_FIFO_SIZE;
+// vlc_cond_signal (&p_mad_adec->p_aout_fifo->data_wait);
+// vlc_mutex_unlock (&p_mad_adec->p_aout_fifo->data_lock);
+//
+// return MAD_FLOW_CONTINUE;
+//}
+
+/*****************************************************************************
+ * libmad_ouput3: this function is called just after the frame is decoded
+ *****************************************************************************/
+enum mad_flow libmad_output3(void *data, struct mad_header const *p_libmad_header, struct mad_pcm *p_libmad_pcm)