Commit 7b171594 authored by philipjsg's avatar philipjsg

Set the pkt->pts field so that we have a chance of doing frame rate reduction

correctly in ffmpeg.c


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@1242 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent b3d85039
...@@ -32,6 +32,7 @@ typedef struct { ...@@ -32,6 +32,7 @@ typedef struct {
int width, height; int width, height;
int frame_rate; int frame_rate;
INT64 time_frame; INT64 time_frame;
INT64 time_frame_start;
int frame_size; int frame_size;
struct video_capability video_cap; struct video_capability video_cap;
struct video_audio audio_saved; struct video_audio audio_saved;
...@@ -239,6 +240,8 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap) ...@@ -239,6 +240,8 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
st->codec.width = width; st->codec.width = width;
st->codec.height = height; st->codec.height = height;
st->codec.frame_rate = frame_rate; 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 */ 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) ...@@ -312,6 +315,10 @@ static int grab_read_packet(AVFormatContext *s1, AVPacket *pkt)
if (dropped) if (dropped)
pkt->flags |= PKT_FLAG_DROPPED_FRAME; 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 */ /* read one frame */
if (s->aiw_enabled) { if (s->aiw_enabled) {
return aiw_read_picture(s, pkt->data); return aiw_read_picture(s, pkt->data);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment