From 282980a9ccfaf3986b275cdcd61273c48c2ed855 Mon Sep 17 00:00:00 2001 From: Ali Gholami Rudi Date: Sat, 27 Feb 2010 20:48:55 +0330 Subject: [PATCH] add options for video/audio only playback The -v and -a options can be used to start a video or audio only playback. The -r option can be used to set video playback rate. This is helpful when playing files whose video frames are not followed by exactly one audio frame; the video and audio playback can be done in separate processes. --- fbff.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/fbff.c b/fbff.c index e8ba404..28950f5 100644 --- a/fbff.c +++ b/fbff.c @@ -45,6 +45,9 @@ static int magnify = 0; static int drop = 0; static int jump = 0; static int fullscreen = 0; +static int audio = 1; +static int video = 1; +static int rate = 0; static void init_streams(void) { @@ -246,12 +249,14 @@ static void read_frames(void) } if (pts < pkt.pts && pkt.pts < (1ull << 60)) pts = pkt.pts; - if (vcc && pkt.stream_index == vsi) { + if (video && vcc && pkt.stream_index == vsi) { + if (rate) + usleep(1000000 / rate); decode_video_frame(main_frame, &pkt); vnum++; num++; } - if (acc && pkt.stream_index == asi) { + if (audio && acc && pkt.stream_index == asi) { decode_audio_frame(&pkt); vnum = 0; } @@ -314,6 +319,12 @@ static void read_args(int argc, char *argv[]) drop = 1; if (!strcmp(argv[i], "-f")) fullscreen = 1; + if (!strcmp(argv[i], "-r")) + rate = atoi(argv[++i]); + if (!strcmp(argv[i], "-a")) + video = 0; + if (!strcmp(argv[i], "-v")) + audio = 0; i++; } } -- 2.11.4.GIT