summaryrefslogtreecommitdiff
path: root/libavformat/ffm.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2006-01-19 00:54:10 +0000
committerMichael Niedermayer <michaelni@gmx.at>2006-01-19 00:54:10 +0000
commitd271481f1a308a36b139a03d145b2cd4e994f09f (patch)
tree9815d6438a517a37c7b5bf764438fd5b8416fd62 /libavformat/ffm.c
parent950c2790a2e1826ab08ac6369e21458252b2cead (diff)
pts fix by (Bryan Mayland / bmayland O leoninedev o com)
Originally committed as revision 4867 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/ffm.c')
-rw-r--r--libavformat/ffm.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libavformat/ffm.c b/libavformat/ffm.c
index 338e51e6f4..db9c2c7fd7 100644
--- a/libavformat/ffm.c
+++ b/libavformat/ffm.c
@@ -44,6 +44,7 @@ typedef struct FFMContext {
/* read and write */
int first_packet; /* true if first packet, needed to set the discontinuity tag */
+ int first_frame_in_packet; /* true if first frame in packet, needed to know if PTS information is valid */
int packet_size;
int frame_offset;
int64_t pts;
@@ -347,6 +348,7 @@ static int ffm_read_data(AVFormatContext *s,
get_be16(pb); /* PACKET_ID */
fill_size = get_be16(pb);
ffm->pts = get_be64(pb);
+ ffm->first_frame_in_packet = 1;
frame_offset = get_be16(pb);
get_buffer(pb, ffm->packet, ffm->packet_size - FFM_HEADER_SIZE);
ffm->packet_end = ffm->packet + (ffm->packet_size - FFM_HEADER_SIZE - fill_size);
@@ -614,7 +616,11 @@ static int ffm_read_packet(AVFormatContext *s, AVPacket *pkt)
av_free_packet(pkt);
return -EAGAIN;
}
- pkt->pts = ffm->pts;
+ if (ffm->first_frame_in_packet)
+ {
+ pkt->pts = ffm->pts;
+ ffm->first_frame_in_packet = 0;
+ }
pkt->duration = duration;
break;
}