Revision 6eb2de74 libavformat/avidec.c

View differences:

libavformat/avidec.c
289 289
            print_tag("strh", tag1, -1);
290 290
#endif
291 291
            if(tag1 == MKTAG('i', 'a', 'v', 's') || tag1 == MKTAG('i', 'v', 'a', 's')){
292
                int64_t dv_dur;
293

  
292 294
                /*
293 295
                 * After some consideration -- I don't think we
294 296
                 * have to support anything but DV in a type1 AVIs.
......
314 316
                url_fskip(pb, 3 * 4);
315 317
                ast->scale = get_le32(pb);
316 318
                ast->rate = get_le32(pb);
319
                url_fskip(pb, 4);  /* start time */
320

  
321
                dv_dur = get_le32(pb);
322
                if (ast->scale > 0 && ast->rate > 0 && dv_dur > 0) {
323
                    dv_dur *= AV_TIME_BASE;
324
                    s->duration = av_rescale(dv_dur, ast->scale, ast->rate);
325
                }
326
                /*
327
                 * else, leave duration alone; timing estimation in utils.c
328
                 *      will make a guess based on bit rate.
329
                 */
330

  
317 331
                stream_index = s->nb_streams - 1;
318
                url_fskip(pb, size - 7*4);
332
                url_fskip(pb, size - 9*4);
319 333
                break;
320 334
            }
321 335

  
......
903 917

  
904 918
//    av_log(NULL, AV_LOG_DEBUG, "XX %"PRId64" %d %"PRId64"\n", timestamp, index, st->index_entries[index].timestamp);
905 919

  
920
    if (ENABLE_DV_DEMUXER && avi->dv_demux) {
921
        /* One and only one real stream for DV in AVI, and it has video  */
922
        /* offsets. Calling with other stream indices should have failed */
923
        /* the av_index_search_timestamp call above.                     */
924
        assert(stream_index == 0);
925

  
926
        /* Feed the DV video stream version of the timestamp to the */
927
        /* DV demux so it can synth correct timestamps              */
928
        dv_offset_reset(avi->dv_demux, timestamp);
929

  
930
        url_fseek(&s->pb, pos, SEEK_SET);
931
        avi->stream_index= -1;
932
        return 0;
933
    }
934

  
906 935
    for(i = 0; i < s->nb_streams; i++) {
907 936
        AVStream *st2 = s->streams[i];
908 937
        AVIStream *ast2 = st2->priv_data;
......
937 966
            ast2->frame_offset *=ast2->sample_size;
938 967
    }
939 968

  
940
    if (ENABLE_DV_DEMUXER && avi->dv_demux)
941
        dv_flush_audio_packets(avi->dv_demux);
942 969
    /* do the seek */
943 970
    url_fseek(&s->pb, pos, SEEK_SET);
944 971
    avi->stream_index= -1;

Also available in: Unified diff