aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip Gladstone <philipjsg@users.sourceforge.net>2002-11-20 02:57:42 +0000
committerPhilip Gladstone <philipjsg@users.sourceforge.net>2002-11-20 02:57:42 +0000
commit86f2b9d0c7cee327b1952b8471a0cc2d57a32191 (patch)
tree44a4c75e8cd0e46f094d278b24cd9b4d9ae68896
parentb13a517f95176df88e5948ce685bfb01adfd98ad (diff)
downloadffmpeg-86f2b9d0c7cee327b1952b8471a0cc2d57a32191.tar.gz
Set the pkt->pts field so that we have a chance of doing frame rate reduction
correctly in ffmpeg.c Originally committed as revision 1242 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libav/grab.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libav/grab.c b/libav/grab.c
index 9bb9e93be9..910616fc86 100644
--- a/libav/grab.c
+++ b/libav/grab.c
@@ -32,6 +32,7 @@ typedef struct {
int width, height;
int frame_rate;
INT64 time_frame;
+ INT64 time_frame_start;
int frame_size;
struct video_capability video_cap;
struct video_audio audio_saved;
@@ -239,6 +240,8 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
st->codec.width = width;
st->codec.height = height;
st->codec.frame_rate = frame_rate;
+
+ s->time_frame_start = s->time_frame;
av_set_pts_info(s1, 48, 1, 1000000); /* 48 bits pts in us */
@@ -312,6 +315,10 @@ static int grab_read_packet(AVFormatContext *s1, AVPacket *pkt)
if (dropped)
pkt->flags |= PKT_FLAG_DROPPED_FRAME;
+ pkt->pts = (s->time_frame - s->time_frame_start) * s1->pts_den / ((INT64)s1->pts_num * 1000000);
+
+ //printf("setting pkt->pts=%lld (time_frame=%lld)\n", pkt->pts, s->time_frame);
+
/* read one frame */
if (s->aiw_enabled) {
return aiw_read_picture(s, pkt->data);