static int vmdaudio_decode_frame(AVCodecContext *avctx,

                                 void *data, int *data_size,

                                 uint8_t *buf, int buf_size)

{

    VmdAudioContext *s = (VmdAudioContext *)avctx->priv_data;

    unsigned int sound_flags;

    unsigned char *output_samples = (unsigned char *)data;



    /* point to the start of the encoded data */

    unsigned char *p = buf + 16;

    unsigned char *p_end = buf + buf_size;



    if (buf_size < 16)

        return buf_size;



    if (buf[6] == 1) {

        /* the chunk contains audio */

        *data_size = vmdaudio_loadsound(s, output_samples, p, 0);

    } else if (buf[6] == 2) {

        /* the chunk contains audio and silence mixed together */

        sound_flags = LE_32(p);

        p += 4;



        /* do something with extrabufs here? */



        while (p < p_end) {

            if (sound_flags & 0x01)

                /* silence */

                *data_size += vmdaudio_loadsound(s, output_samples, p, 1);

            else {

                /* audio */

                *data_size += vmdaudio_loadsound(s, output_samples, p, 0);

                p += s->block_align;

            }

            output_samples += (s->block_align * s->bits / 8);

            sound_flags >>= 1;

        }

    } else if (buf[6] == 3) {

        /* silent chunk */

        *data_size = vmdaudio_loadsound(s, output_samples, p, 1);

    }



    return buf_size;

}

static int vmdaudio_decode_frame(AVCodecContext *avctx,

                                 void *data, int *data_size,

                                 uint8_t *buf, int buf_size)

{

    VmdAudioContext *s = (VmdAudioContext *)avctx->priv_data;

    unsigned int sound_flags;

    unsigned char *output_samples = (unsigned char *)data;



    

    unsigned char *p = buf + 16;

    unsigned char *p_end = buf + buf_size;



    if (buf_size < 16)

        return buf_size;



    if (buf[6] == 1) {

        

        *data_size = vmdaudio_loadsound(s, output_samples, p, 0);

    } else if (buf[6] == 2) {

        

        sound_flags = LE_32(p);

        p += 4;



        



        while (p < p_end) {

            if (sound_flags & 0x01)

                

                *data_size += vmdaudio_loadsound(s, output_samples, p, 1);

            else {

                

                *data_size += vmdaudio_loadsound(s, output_samples, p, 0);

                p += s->block_align;

            }

            output_samples += (s->block_align * s->bits / 8);

            sound_flags >>= 1;

        }

    } else if (buf[6] == 3) {

        

        *data_size = vmdaudio_loadsound(s, output_samples, p, 1);

    }



    return buf_size;

}

    unsigned int sound_flags;     unsigned char *p_end = buf + buf_size;         sound_flags = LE_32(p);         while (p < p_end) {             if (sound_flags & 0x01)                 *data_size += vmdaudio_loadsound(s, output_samples, p, 1);             else {                 *data_size += vmdaudio_loadsound(s, output_samples, p, 0);                 p += s->block_align;             output_samples += (s->block_align * s->bits / 8);             sound_flags >>= 1;
static int FUNC_0(AVCodecContext *VAR_0,

                                 void *VAR_1, int *VAR_2,

                                 uint8_t *VAR_3, int VAR_4)

{

    VmdAudioContext *s = (VmdAudioContext *)VAR_0->priv_data;

    unsigned int VAR_5;

    unsigned char *VAR_6 = (unsigned char *)VAR_1;



    

    unsigned char *VAR_7 = VAR_3 + 16;

    unsigned char *VAR_8 = VAR_3 + VAR_4;



    if (VAR_4 < 16)

        return VAR_4;



    if (VAR_3[6] == 1) {

        

        *VAR_2 = vmdaudio_loadsound(s, VAR_6, VAR_7, 0);

    } else if (VAR_3[6] == 2) {

        

        VAR_5 = LE_32(VAR_7);

        VAR_7 += 4;



        



        while (VAR_7 < VAR_8) {

            if (VAR_5 & 0x01)

                

                *VAR_2 += vmdaudio_loadsound(s, VAR_6, VAR_7, 1);

            else {

                

                *VAR_2 += vmdaudio_loadsound(s, VAR_6, VAR_7, 0);

                VAR_7 += s->block_align;

            }

            VAR_6 += (s->block_align * s->bits / 8);

            VAR_5 >>= 1;

        }

    } else if (VAR_3[6] == 3) {

        

        *VAR_2 = vmdaudio_loadsound(s, VAR_6, VAR_7, 1);

    }



    return VAR_4;

}

static int FUNC_0(AVCodecContext *VAR_0,
void *VAR_1, int *VAR_2,
uint8_t *VAR_3, int VAR_4)
{ VmdAudioContext *s = (VmdAudioContext *)VAR_0->priv_data; unsigned int VAR_5; unsigned char *VAR_6 = (unsigned char *)VAR_1; unsigned char *VAR_7 = VAR_3 + 16; unsigned char *VAR_8 = VAR_3 + VAR_4; if (VAR_4 < 16)
return VAR_4; if (VAR_3[6] == 1) { *VAR_2 = vmdaudio_loadsound(s, VAR_6, VAR_7, 0); } else if (VAR_3[6] == 2) { VAR_5 = LE_32(VAR_7); VAR_7 += 4; while (VAR_7 < VAR_8) { if (VAR_5 & 0x01)
*VAR_2 += vmdaudio_loadsound(s, VAR_6, VAR_7, 1); else { *VAR_2 += vmdaudio_loadsound(s, VAR_6, VAR_7, 0); VAR_7 += s->block_align; } VAR_6 += (s->block_align * s->bits / 8); VAR_5 >>= 1; } } else if (VAR_3[6] == 3) { *VAR_2 = vmdaudio_loadsound(s, VAR_6, VAR_7, 1); } return VAR_4; }