static int au_read_header(AVFormatContext *s)

{

    int size;

    unsigned int tag;

    AVIOContext *pb = s->pb;

    unsigned int id, channels, rate;

    enum AVCodecID codec;

    AVStream *st;



    /* check ".snd" header */

    tag = avio_rl32(pb);

    if (tag != MKTAG('.', 's', 'n', 'd'))

        return -1;

    size = avio_rb32(pb); /* header size */

    avio_rb32(pb); /* data size */



    id = avio_rb32(pb);

    rate = avio_rb32(pb);

    channels = avio_rb32(pb);



    codec = ff_codec_get_id(codec_au_tags, id);



    if (!av_get_bits_per_sample(codec)) {

        av_log_ask_for_sample(s, "could not determine bits per sample\n");

        return AVERROR_PATCHWELCOME;

    }



    if (channels == 0 || channels > 64) {

        av_log(s, AV_LOG_ERROR, "Invalid number of channels %d\n", channels);

        return AVERROR_INVALIDDATA;

    }



    if (size >= 24) {

        /* skip unused data */

        avio_skip(pb, size - 24);

    }



    /* now we are ready: build format streams */

    st = avformat_new_stream(s, NULL);

    if (!st)

        return -1;

    st->codec->codec_type = AVMEDIA_TYPE_AUDIO;

    st->codec->codec_tag = id;

    st->codec->codec_id = codec;

    st->codec->channels = channels;

    st->codec->sample_rate = rate;

    avpriv_set_pts_info(st, 64, 1, rate);

    return 0;

}

static int au_read_header(AVFormatContext *s)

{

    int size;

    unsigned int tag;

    AVIOContext *pb = s->pb;

    unsigned int id, channels, rate;

    enum AVCodecID codec;

    AVStream *st;



    

    tag = avio_rl32(pb);

    if (tag != MKTAG('.', 's', 'n', 'd'))

        return -1;

    size = avio_rb32(pb); 

    avio_rb32(pb); 



    id = avio_rb32(pb);

    rate = avio_rb32(pb);

    channels = avio_rb32(pb);



    codec = ff_codec_get_id(codec_au_tags, id);



    if (!av_get_bits_per_sample(codec)) {

        av_log_ask_for_sample(s, "could not determine bits per sample\n");

        return AVERROR_PATCHWELCOME;

    }



    if (channels == 0 || channels > 64) {

        av_log(s, AV_LOG_ERROR, "Invalid number of channels %d\n", channels);

        return AVERROR_INVALIDDATA;

    }



    if (size >= 24) {

        

        avio_skip(pb, size - 24);

    }



    

    st = avformat_new_stream(s, NULL);

    if (!st)

        return -1;

    st->codec->codec_type = AVMEDIA_TYPE_AUDIO;

    st->codec->codec_tag = id;

    st->codec->codec_id = codec;

    st->codec->channels = channels;

    st->codec->sample_rate = rate;

    avpriv_set_pts_info(st, 64, 1, rate);

    return 0;

}

static int FUNC_0(AVFormatContext *VAR_0)

{

    int VAR_1;

    unsigned int VAR_2;

    AVIOContext *pb = VAR_0->pb;

    unsigned int VAR_3, VAR_4, VAR_5;

    enum AVCodecID VAR_6;

    AVStream *st;



    

    VAR_2 = avio_rl32(pb);

    if (VAR_2 != MKTAG('.', 'VAR_0', 'n', 'd'))

        return -1;

    VAR_1 = avio_rb32(pb); 

    avio_rb32(pb); 



    VAR_3 = avio_rb32(pb);

    VAR_5 = avio_rb32(pb);

    VAR_4 = avio_rb32(pb);



    VAR_6 = ff_codec_get_id(codec_au_tags, VAR_3);



    if (!av_get_bits_per_sample(VAR_6)) {

        av_log_ask_for_sample(VAR_0, "could not determine bits per sample\n");

        return AVERROR_PATCHWELCOME;

    }



    if (VAR_4 == 0 || VAR_4 > 64) {

        av_log(VAR_0, AV_LOG_ERROR, "Invalid number of VAR_4 %d\n", VAR_4);

        return AVERROR_INVALIDDATA;

    }



    if (VAR_1 >= 24) {

        

        avio_skip(pb, VAR_1 - 24);

    }



    

    st = avformat_new_stream(VAR_0, NULL);

    if (!st)

        return -1;

    st->VAR_6->codec_type = AVMEDIA_TYPE_AUDIO;

    st->VAR_6->codec_tag = VAR_3;

    st->VAR_6->codec_id = VAR_6;

    st->VAR_6->VAR_4 = VAR_4;

    st->VAR_6->sample_rate = VAR_5;

    avpriv_set_pts_info(st, 64, 1, VAR_5);

    return 0;

}

static int FUNC_0(AVFormatContext *VAR_0)
{ int VAR_1; unsigned int VAR_2; AVIOContext *pb = VAR_0->pb; unsigned int VAR_3, VAR_4, VAR_5; enum AVCodecID VAR_6; AVStream *st; VAR_2 = avio_rl32(pb); if (VAR_2 != MKTAG('.', 'VAR_0', 'n', 'd'))
return -1; VAR_1 = avio_rb32(pb); avio_rb32(pb); VAR_3 = avio_rb32(pb); VAR_5 = avio_rb32(pb); VAR_4 = avio_rb32(pb); VAR_6 = ff_codec_get_id(codec_au_tags, VAR_3); if (!av_get_bits_per_sample(VAR_6)) { av_log_ask_for_sample(VAR_0, "could not determine bits per sample\n"); return AVERROR_PATCHWELCOME; } if (VAR_4 == 0 || VAR_4 > 64) { av_log(VAR_0, AV_LOG_ERROR, "Invalid number of VAR_4 %d\n", VAR_4); return AVERROR_INVALIDDATA; } if (VAR_1 >= 24) { avio_skip(pb, VAR_1 - 24); } st = avformat_new_stream(VAR_0, NULL); if (!st)
return -1; st->VAR_6->codec_type = AVMEDIA_TYPE_AUDIO; st->VAR_6->codec_tag = VAR_3; st->VAR_6->codec_id = VAR_6; st->VAR_6->VAR_4 = VAR_4; st->VAR_6->sample_rate = VAR_5; avpriv_set_pts_info(st, 64, 1, VAR_5); return 0; }