static int get_riff(AVFormatContext *s, AVIOContext *pb)

{

    AVIContext *avi = s->priv_data;

    char header[8];

    int i;



    

    avio_read(pb, header, 4);

    avi->riff_end  = avio_rl32(pb); 

    avi->riff_end += avio_tell(pb); 

    avio_read(pb, header + 4, 4);



    for (i = 0; avi_headers[i][0]; i++)

        if (!memcmp(header, avi_headers[i], 8))

            break;

    if (!avi_headers[i][0])

        return AVERROR_INVALIDDATA;



    if (header[7] == 0x19)

        av_log(s, AV_LOG_INFO,

               "This file has been generated by a totally broken muxer.\n");



    return 0;

}
