[Ffmpeg-devel] ffplay confused about filenames that begin with a dash

Timo Lindfors lindi
Mon Nov 27 01:00:14 CET 2006


Hi,

here's a bug report for ffplay (was going to submit it to a bug
tracker but since there seems to be none I'm assuming it's ok to mail
it here):

Steps to reproduce:
1) svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
2) cd ffmpeg && ./configure && make
3) youtube-dl http://youtube.com/watch?v=-zVCYdrw-1o
4) ffplay -zVCYdrw-1o.flv
5) ffplay -- -zVCYdrw-1o.flv

Expected results:
4 or 5) ffplay opens input file and starts to play it

Actual results:
4) ffplay does not open input file and prints
ffplay: unrecognized option '-zVCYdrw-1o.flv'
5) ffplay does not open input file and prints
ffplay: unrecognized option '--'

More info:
1) Step 3) can be equally well replaced with "touch -- -zVCYdrw-1o.flv"
since the bug depends only on filename and not contents.
2) I was able to play the files with the following fix:

Index: cmdutils.c
===================================================================
--- cmdutils.c  (revision 7172)
+++ cmdutils.c  (working copy)
@@ -59,15 +59,20 @@
 void parse_options(int argc, char **argv, const OptionDef *options)
 {
     const char *opt, *arg;
-    int optindex;
+    int optindex, handleoptions;
     const OptionDef *po;

     /* parse options */
     optindex = 1;
+    handleoptions = 1;
     while (optindex < argc) {
         opt = argv[optindex++];

-        if (opt[0] == '-' && opt[1] != '\0') {
+        if (handleoptions && opt[0] == '-' && opt[1] != '\0') {
+            if (opt[1] == '-' && opt[2] == '\0') {
+                handleoptions = 0;
+                continue;
+            }
             po= find_option(options, opt + 1);
             if (!po->name)
                 po= find_option(options, "default");



Please let me know if you can't reproduce this bug. I'm happy to
provide more info.




best regards,
Timo Lindfors
-------------- next part --------------
Index: cmdutils.c
===================================================================
--- cmdutils.c	(revision 7172)
+++ cmdutils.c	(working copy)
@@ -59,15 +59,20 @@
 void parse_options(int argc, char **argv, const OptionDef *options)
 {
     const char *opt, *arg;
-    int optindex;
+    int optindex, handleoptions;
     const OptionDef *po;
 
     /* parse options */
     optindex = 1;
+    handleoptions = 1;
     while (optindex < argc) {
         opt = argv[optindex++];
 
-        if (opt[0] == '-' && opt[1] != '\0') {
+        if (handleoptions && opt[0] == '-' && opt[1] != '\0') {
+            if (opt[1] == '-' && opt[2] == '\0') {
+                handleoptions = 0;
+                continue;
+            }
             po= find_option(options, opt + 1);
             if (!po->name)
                 po= find_option(options, "default");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20061127/f7df10d1/attachment.pgp>



More information about the ffmpeg-devel mailing list