From 4c310efc475adc19904fef35c1f1f3486fecb64f Mon Sep 17 00:00:00 2001 From: Ali Gholami Rudi Date: Tue, 22 Sep 2009 20:51:18 +0330 Subject: [PATCH] frame dropping with -d arg --- fbff.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/fbff.c b/fbff.c index 71c91a9..4a0f4af 100644 --- a/fbff.c +++ b/fbff.c @@ -38,6 +38,7 @@ static uint64_t pts; static int zoom = 1; static int magnify = 0; +static int drop = 0; static void init_streams(void) { @@ -224,6 +225,7 @@ static void read_frames(void) AVPacket pkt; uint8_t *buf; int n = AUDIOBUFSIZE; + int video_chain = 0; if (vcc) n = avpicture_get_size(PIX_FMT_RGB24, vcc->width * zoom, vcc->height * zoom); @@ -235,9 +237,12 @@ static void read_frames(void) if (pts < pkt.pts && pkt.pts < (1ull << 60)) pts = pkt.pts; if (vcc && pkt.stream_index == vsi) - decode_video_frame(main_frame, &pkt); - if (acc && pkt.stream_index == asi) + if (!drop || !video_chain++) + decode_video_frame(main_frame, &pkt); + if (acc && pkt.stream_index == asi) { decode_audio_frame(&pkt); + video_chain = 0; + } av_free_packet(&pkt); switch (execkey()) { case FF_PLAY: @@ -294,6 +299,8 @@ static void read_args(int argc, char *argv[]) magnify = atoi(argv[++i]); if (!strcmp(argv[i], "-z")) zoom = atoi(argv[++i]); + if (!strcmp(argv[i], "-d")) + drop = 1; i++; } } @@ -301,7 +308,8 @@ static void read_args(int argc, char *argv[]) int main(int argc, char *argv[]) { if (argc < 2) { - printf("usage: %s [-z zoom] [-m magnify] filename\n", argv[0]); + printf("usage: %s [-z zoom] [-m magnify] [-d] filename\n", + argv[0]); return 1; } read_args(argc, argv); -- 2.11.4.GIT