1 /*****************************************************************************
2 * adec_test.c: MPEG Layer I-II audio decoder test program
3 *****************************************************************************
4 * Copyright (C) 1999, 2000 VideoLAN
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
21 *****************************************************************************/
26 * - optimiser les NeedBits() et les GetBits() du code là où c'est possible ;
27 * - vlc_cond_signal() / vlc_cond_wait() ;
31 /*****************************************************************************
33 *****************************************************************************/
38 #include "int_types.h"
39 #include "adec_generic.h"
41 #define ADEC_FRAME_SIZE (2*1152)
46 adec_sync_info_t sync_info;
47 adec_byte_stream_t * stream;
48 s16 buffer [ADEC_FRAME_SIZE];
52 memset (&decoder, 0, sizeof (decoder));
53 if (adec_init (&decoder))
58 stream = adec_byte_stream (&decoder);
59 stream->p_byte = NULL;
69 if (adec_sync_frame (&decoder, &sync_info))
73 if (adec_decode_frame (&decoder, buffer))
79 for (i = 0; i < (2*1152); i++)
81 fprintf ( stderr, "%04X\n",(u16)buffer[i] );
89 void adec_byte_stream_next (adec_byte_stream_t * p_byte_stream)
91 static u8 buffer [1024];
96 fd = p_byte_stream->info;
97 size = fread (buffer, 1, 1024, fd);
100 p_byte_stream->p_byte = buffer;
101 p_byte_stream->p_end = buffer + size;
104 { /* end of stream, read dummy zeroes */
105 p_byte_stream->p_byte = &dummy;
106 p_byte_stream->p_end = &dummy + 1;