changeset 33558:cc3071a7c057

vo_mng: add output sub-option. This also makes it consistent with vo_gif. Patch by Stefan Schuermans, stefan on blinkenarea dot org.
author cboesch
date Sat, 18 Jun 2011 20:50:55 +0000
parents 71ec25d1da10
children 0d4edb3f75c6
files DOCS/man/de/mplayer.1 DOCS/man/en/mplayer.1 libvo/vo_mng.c
diffstat 3 files changed, 23 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/DOCS/man/de/mplayer.1	Sat Jun 18 16:35:37 2011 +0000
+++ b/DOCS/man/de/mplayer.1	Sat Jun 18 20:50:55 2011 +0000
@@ -4586,8 +4586,8 @@
 in verlustfreier Kompression aus.
 .PD 0
 .RSs
-.IPs <output>
-Gibt den Ausgabedateinamen an (zwingend erforderlich).
+.IPs output=<Dateiname>
+Gibt den Ausgabedateinamen an (Standard: out.mng).
 .REss
 .PD 1
 .RS
@@ -4596,7 +4596,7 @@
 .RE
 .PD 0
 .RSs
-mplayer video.mkv \-vo mng:output.mng
+mplayer video.mkv \-vo mng:output=test.mng
 .RE
 .PD 1
 .
--- a/DOCS/man/en/mplayer.1	Sat Jun 18 16:35:37 2011 +0000
+++ b/DOCS/man/en/mplayer.1	Sat Jun 18 20:50:55 2011 +0000
@@ -4788,8 +4788,8 @@
 with lossless compression.
 .PD 0
 .RSs
-.IPs <output>
-Specify the output filename (mandatory).
+.IPs output=<filename>
+Specify the output filename (default: out.mng).
 .REss
 .PD 1
 .RS
@@ -4798,7 +4798,7 @@
 .RE
 .PD 0
 .RSs
-mplayer video.mkv \-vo mng:output.mng
+mplayer video.mkv \-vo mng:output=test.mng
 .RE
 .PD 1
 .
--- a/libvo/vo_mng.c	Sat Jun 18 16:35:37 2011 +0000
+++ b/libvo/vo_mng.c	Sat Jun 18 20:50:55 2011 +0000
@@ -40,6 +40,7 @@
 #include "video_out.h"
 #include "video_out_internal.h"
 #include "mp_msg.h"
+#include "subopt-helper.h"
 
 #define VOMNG_DEFAULT_DELAY_MS (100) /* default delay of a frame */
 
@@ -566,6 +567,12 @@
     return 0;
 }
 
+/** list of suboptions */
+static const opt_t subopts[] = {
+    {"output", OPT_ARG_MSTRZ, &vomng.out_file_name, NULL},
+    {NULL,     0,             NULL,                 NULL}
+};
+
 /**
  * @brief pre-initialize MNG vo module
  * @param[in] *arg arguments passed to MNG vo module (output file name)
@@ -573,19 +580,19 @@
  */
 static int preinit(const char *arg)
 {
-    /* get name of output file */
-    if (!arg || !*arg) {
-        mp_msg(MSGT_VO, MSGL_ERR, "vomng: MNG output file must be given,"
-                                  " example: -vo mng:output.mng\n");
+    if (subopt_parse(arg, subopts)) {
+        mp_msg(MSGT_VO, MSGL_ERR,
+               "\n-vo mng command line help:\n"
+               "Example: mplayer -vo mng:output=file.mng\n"
+               "\nOptions:\n"
+               "  output=<filename>\n"
+               "    Specify the output file.  The default is out.mng.\n"
+               "\n");
         vomng_prop_cleanup();
         return 1;
     }
-    vomng.out_file_name = strdup(arg);
-    if (!vomng.out_file_name) {
-        mp_msg(MSGT_VO, MSGL_ERR, "vomng: out of memory\n");
-        vomng_prop_cleanup();
-        return 1;
-    }
+    if (!vomng.out_file_name)
+        vomng.out_file_name = strdup("out.mng");
 
     return 0;
 }