Revision 462b2620 libavformat/wav.c

View differences:

libavformat/wav.c
183 183
                           AVFormatParameters *ap)
184 184
{
185 185
    int64_t size, av_uninit(data_size);
186
    int64_t sample_count=0;
186 187
    int rf64;
187 188
    unsigned int tag;
188 189
    ByteIOContext *pb = s->pb;
......
208 209
            return -1;
209 210
        get_le64(pb); /* RIFF size */
210 211
        data_size = get_le64(pb);
212
        sample_count = get_le64(pb);
211 213
        url_fskip(pb, size - 16); /* skip rest of ds64 chunk */
212 214
    }
213 215

  
......
233 235
        wav->data_end = INT64_MAX;
234 236
    } else
235 237
        wav->data_end= url_ftell(pb) + size;
238

  
239
    if (!sample_count && st->codec->channels && av_get_bits_per_sample(st->codec->codec_id))
240
        sample_count = (size<<3) / (st->codec->channels * (uint64_t)av_get_bits_per_sample(st->codec->codec_id));
241
    if (sample_count)
242
        st->duration = sample_count;
236 243
    return 0;
237 244
}
238 245

  

Also available in: Unified diff