[MPlayer-cvslog] r28165 - trunk/libvo/vo_macosx.m
gpoirier
subversion at mplayerhq.hu
Fri Dec 19 21:33:54 CET 2008
Author: gpoirier
Date: Fri Dec 19 21:33:54 2008
New Revision: 28165
Log:
Replace vo_macosx's custom options parsing with a subopt_parse()-based one
(in the same way as vo_gl).
Patch by Adrian Stutz %adrian A sttz P ch%
Original thread:
date: Tue, Dec 9, 2008 at 3:20 PM
subject: Re: [MPlayer-dev-eng] [PATCH] vo_macosx: option to set shared buffer name to allow multiple instances
Modified:
trunk/libvo/vo_macosx.m
Modified: trunk/libvo/vo_macosx.m
==============================================================================
--- trunk/libvo/vo_macosx.m (original)
+++ trunk/libvo/vo_macosx.m Fri Dec 19 21:33:54 2008
@@ -28,6 +28,7 @@
#include "m_option.h"
#include "mp_fifo.h"
#include "libvo/sub.h"
+#include "subopt-helper.h"
#include "input/input.h"
#include "input/mouse.h"
@@ -315,30 +316,31 @@ static void uninit(void)
}
}
+static opt_t subopts[] = {
+{"device_id", OPT_ARG_INT, &screen_id, (opt_test_f)int_non_neg},
+{"shared_buffer", OPT_ARG_BOOL, &shared_buffer, NULL},
+{NULL}
+};
+
static int preinit(const char *arg)
{
- int parse_err = 0;
-
- if(arg)
- {
- char *parse_pos = (char *)&arg[0];
- while (parse_pos[0] && !parse_err)
- {
- if (strncmp (parse_pos, "device_id=", 10) == 0)
- {
- parse_pos = &parse_pos[10];
- screen_id = strtol(parse_pos, &parse_pos, 0);
- screen_force = YES;
- }
- if (strncmp (parse_pos, "shared_buffer", 13) == 0)
- {
- parse_pos = &parse_pos[13];
- shared_buffer = YES;
- }
- if (parse_pos[0] == ':') parse_pos = &parse_pos[1];
- else if (parse_pos[0]) parse_err = 1;
- }
- }
+
+ // set defaults
+ screen_id = 0;
+ shared_buffer = false;
+
+ if (subopt_parse(arg, subopts) != 0) {
+ mp_msg(MSGT_VO, MSGL_FATAL,
+ "\n-vo macosx command line help:\n"
+ "Example: mplayer -vo macosx:device_id=1:shared_buffer\n"
+ "\nOptions:\n"
+ " device_id=<0-...>\n"
+ " Set screen device id for fullscreen.\n"
+ " shared_buffer\n"
+ " Write output to a shared memory buffer instead of displaying it.\n"
+ "\n" );
+ return -1;
+ }
NSApplicationLoad();
autoreleasepool = [[NSAutoreleasePool alloc] init];
More information about the MPlayer-cvslog
mailing list