[Ffmpeg-devel] [PATCH] fix ffplay can't play yuv420 file

Limin Wang lance.lmwang
Fri Feb 9 14:08:29 CET 2007


Hi,

The patch try to fix that ffplay can't play yuv420 file. In addition,
one extra option is added to control frame rate. Please review it.
The limitation is yuv420 is supported only, maybe we can add format
option like mplayer so that we can support other yuv format.


Thanks,
Limin
-------------- next part --------------
Index: ffplay.c
===================================================================
--- ffplay.c	(revision 7888)
+++ ffplay.c	(working copy)
@@ -186,6 +186,8 @@
 static int fs_screen_height;
 static int screen_width = 0;
 static int screen_height = 0;
+static int frame_rate = 25;
+static int frame_rate_base = 1;
 static int audio_disable;
 static int video_disable;
 static int wanted_audio_stream= 0;
@@ -1865,7 +1867,12 @@
     memset(ap, 0, sizeof(*ap));
     ap->initial_pause = 1; /* we force a pause when starting an RTSP
                               stream */
+    ap->width = screen_width;
+    ap->height = screen_height;
+    ap->time_base.den = frame_rate;
+    ap->time_base.num = frame_rate_base;
 
+    printf( "frame_rate: %d \n", frame_rate );
     err = av_open_input_file(&ic, is->filename, is->iformat, 0, ap);
     if (err < 0) {
         print_error(is->filename, err);
@@ -2358,6 +2365,15 @@
     }
 }
 
+void opt_framerate(const char *arg)
+{
+    frame_rate = atoi(arg);
+    if(frame_rate<=0){
+        fprintf(stderr, "invalid frame_rate\n");
+        exit(1);
+    }
+}
+
 #ifdef CONFIG_NETWORK
 void opt_rtp_tcp(void)
 {
@@ -2414,6 +2430,7 @@
     { "bytes", OPT_BOOL, {(void*)&seek_by_bytes}, "seek by bytes" },
     { "nodisp", OPT_BOOL, {(void*)&display_disable}, "disable graphical display" },
     { "f", HAS_ARG, {(void*)opt_format}, "force format", "fmt" },
+    { "fps", HAS_ARG, {(void*)opt_framerate}, "force frame rate", "fps" },
     { "stats", OPT_BOOL | OPT_EXPERT, {(void*)&show_status}, "show status", "" },
     { "debug", HAS_ARG | OPT_EXPERT, {(void*)opt_debug}, "print specific debug info", "" },
     { "bug", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&workaround_bugs}, "workaround bugs", "" },
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 481 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070209/756bed4b/attachment.pgp>



More information about the ffmpeg-devel mailing list