Mercurial > libavformat.hg
comparison ffm.c @ 901:c1a07d63a66d libavformat
pts fix by (Bryan Mayland / bmayland O leoninedev o com)
author | michael |
---|---|
date | Thu, 19 Jan 2006 00:54:10 +0000 |
parents | edbe5c3717f9 |
children | dbc0145bbf11 |
comparison
equal
deleted
inserted
replaced
900:04509c9a1b7a | 901:c1a07d63a66d |
---|---|
42 int read_state; | 42 int read_state; |
43 uint8_t header[FRAME_HEADER_SIZE]; | 43 uint8_t header[FRAME_HEADER_SIZE]; |
44 | 44 |
45 /* read and write */ | 45 /* read and write */ |
46 int first_packet; /* true if first packet, needed to set the discontinuity tag */ | 46 int first_packet; /* true if first packet, needed to set the discontinuity tag */ |
47 int first_frame_in_packet; /* true if first frame in packet, needed to know if PTS information is valid */ | |
47 int packet_size; | 48 int packet_size; |
48 int frame_offset; | 49 int frame_offset; |
49 int64_t pts; | 50 int64_t pts; |
50 uint8_t *packet_ptr, *packet_end; | 51 uint8_t *packet_ptr, *packet_end; |
51 uint8_t packet[FFM_PACKET_SIZE]; | 52 uint8_t packet[FFM_PACKET_SIZE]; |
345 url_fseek(pb, ffm->packet_size, SEEK_SET); | 346 url_fseek(pb, ffm->packet_size, SEEK_SET); |
346 retry_read: | 347 retry_read: |
347 get_be16(pb); /* PACKET_ID */ | 348 get_be16(pb); /* PACKET_ID */ |
348 fill_size = get_be16(pb); | 349 fill_size = get_be16(pb); |
349 ffm->pts = get_be64(pb); | 350 ffm->pts = get_be64(pb); |
351 ffm->first_frame_in_packet = 1; | |
350 frame_offset = get_be16(pb); | 352 frame_offset = get_be16(pb); |
351 get_buffer(pb, ffm->packet, ffm->packet_size - FFM_HEADER_SIZE); | 353 get_buffer(pb, ffm->packet, ffm->packet_size - FFM_HEADER_SIZE); |
352 ffm->packet_end = ffm->packet + (ffm->packet_size - FFM_HEADER_SIZE - fill_size); | 354 ffm->packet_end = ffm->packet + (ffm->packet_size - FFM_HEADER_SIZE - fill_size); |
353 if (ffm->packet_end < ffm->packet) | 355 if (ffm->packet_end < ffm->packet) |
354 return -1; | 356 return -1; |
612 if (ffm_read_data(s, pkt->data, size, 0) != size) { | 614 if (ffm_read_data(s, pkt->data, size, 0) != size) { |
613 /* bad case: desynchronized packet. we cancel all the packet loading */ | 615 /* bad case: desynchronized packet. we cancel all the packet loading */ |
614 av_free_packet(pkt); | 616 av_free_packet(pkt); |
615 return -EAGAIN; | 617 return -EAGAIN; |
616 } | 618 } |
617 pkt->pts = ffm->pts; | 619 if (ffm->first_frame_in_packet) |
620 { | |
621 pkt->pts = ffm->pts; | |
622 ffm->first_frame_in_packet = 0; | |
623 } | |
618 pkt->duration = duration; | 624 pkt->duration = duration; |
619 break; | 625 break; |
620 } | 626 } |
621 return 0; | 627 return 0; |
622 } | 628 } |