Revision 3c6a9f66 libavformat/ffmdec.c

View differences:

libavformat/ffmdec.c
100 100
            get_be16(pb); /* PACKET_ID */
101 101
            fill_size = get_be16(pb);
102 102
            ffm->pts = get_be64(pb);
103
            ffm->first_frame_in_packet = 1;
104 103
            frame_offset = get_be16(pb);
105 104
            get_buffer(pb, ffm->packet, ffm->packet_size - FFM_HEADER_SIZE);
106 105
            ffm->packet_end = ffm->packet + (ffm->packet_size - FFM_HEADER_SIZE - fill_size);
......
361 360

  
362 361
    switch(ffm->read_state) {
363 362
    case READ_HEADER:
364
        if (!ffm_is_avail_data(s, FRAME_HEADER_SIZE)) {
363
        if (!ffm_is_avail_data(s, FRAME_HEADER_SIZE+4)) {
365 364
            return AVERROR(EAGAIN);
366 365
        }
367 366
        dprintf(s, "pos=%08"PRIx64" spos=%"PRIx64", write_index=%"PRIx64" size=%"PRIx64"\n",
......
369 368
        if (ffm_read_data(s, ffm->header, FRAME_HEADER_SIZE, 1) !=
370 369
            FRAME_HEADER_SIZE)
371 370
            return AVERROR(EAGAIN);
371
        if (ffm->header[1] & FLAG_DTS)
372
            if (ffm_read_data(s, ffm->header+16, 4, 1) != 4)
373
                return AVERROR(EAGAIN);
372 374
#if 0
373 375
        av_hexdump_log(s, AV_LOG_DEBUG, ffm->header, FRAME_HEADER_SIZE);
374 376
#endif
......
400 402
            av_free_packet(pkt);
401 403
            return AVERROR(EAGAIN);
402 404
        }
403
        if (ffm->first_frame_in_packet)
404
        {
405
            pkt->pts = ffm->pts;
406
            ffm->first_frame_in_packet = 0;
407
        }
405
        pkt->pts = AV_RB64(ffm->header+8);
406
        if (ffm->header[1] & FLAG_DTS)
407
            pkt->dts = pkt->pts - AV_RB32(ffm->header+16);
408
        else
409
            pkt->dts = pkt->pts;
408 410
        pkt->duration = duration;
409 411
        break;
410 412
    }

Also available in: Unified diff