Revision 09a62866 libavformat/tta.c

View differences:

libavformat/tta.c
40 40
{
41 41
    TTAContext *c = s->priv_data;
42 42
    AVStream *st;
43
    int i, channels, bps, samplerate, datalen, framelen, start;
44

  
45
    start = url_ftell(&s->pb);
43
    int i, channels, bps, samplerate, datalen, framelen;
46 44

  
47 45
    if (get_le32(&s->pb) != ff_get_fourcc("TTA1"))
48 46
        return -1; // not tta file
......
90 88
    st->codec->sample_rate = samplerate;
91 89
    st->codec->bits_per_sample = bps;
92 90

  
93
    st->codec->extradata_size = url_ftell(&s->pb) - start;
91
    st->codec->extradata_size = url_ftell(&s->pb);
94 92
    if(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)st->codec->extradata_size){
95 93
        //this check is redundant as get_buffer should fail
96 94
        av_log(s, AV_LOG_ERROR, "extradata_size too large\n");
97 95
        return -1;
98 96
    }
99 97
    st->codec->extradata = av_mallocz(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE);
100
    url_fseek(&s->pb, start, SEEK_SET); // or SEEK_CUR and -size ? :)
98
    url_fseek(&s->pb, 0, SEEK_SET);
101 99
    get_buffer(&s->pb, st->codec->extradata, st->codec->extradata_size);
102 100

  
103 101
    return 0;

Also available in: Unified diff