Revision 45faf7fc

View differences:

libavformat/nsvdec.c
737 737
static int nsv_probe(AVProbeData *p)
738 738
{
739 739
    int i;
740
    int score;
741
    int vsize, asize, auxcount;
742
    score = 0;
740 743
    av_dlog(NULL, "nsv_probe(), buf_size %d\n", p->buf_size);
741 744
    /* check file header */
742 745
    /* streamed files might not have any header */
......
749 752
    /* sometimes even the first header is at 9KB or something :^) */
750 753
    for (i = 1; i < p->buf_size - 3; i++) {
751 754
        if (p->buf[i+0] == 'N' && p->buf[i+1] == 'S' &&
752
            p->buf[i+2] == 'V' && p->buf[i+3] == 's')
753
            return AVPROBE_SCORE_MAX-20;
755
            p->buf[i+2] == 'V' && p->buf[i+3] == 's') {
756
            score = AVPROBE_SCORE_MAX/5;
757
            /* Get the chunk size and check if at the end we are getting 0xBEEF */
758
            auxcount = p->buf[i+19];
759
            vsize = p->buf[i+20]  | p->buf[i+21] << 8;
760
            asize = p->buf[i+22]  | p->buf[i+23] << 8;
761
            vsize = (vsize << 4) | (auxcount >> 4);
762
            if ((asize + vsize + i + 23) <  p->buf_size - 2) {
763
                if (p->buf[i+23+asize+vsize+1] == 0xEF &&
764
                    p->buf[i+23+asize+vsize+2] == 0xBE)
765
                    return AVPROBE_SCORE_MAX-20;
766
            }
767
        }
754 768
    }
755 769
    /* so we'll have more luck on extension... */
756 770
    if (av_match_ext(p->filename, "nsv"))
757 771
        return AVPROBE_SCORE_MAX/2;
758 772
    /* FIXME: add mime-type check */
759
    return 0;
773
    return score;
760 774
}
761 775

  
762 776
AVInputFormat ff_nsv_demuxer = {

Also available in: Unified diff