comparison libvo/vo_gl.c @ 13237:f85c105bfeaa

improved suboption parsing, fixes also compiler warnings
author reimar
date Fri, 03 Sep 2004 12:12:17 +0000
parents 6e8d1ac141fc
children d3ef52aafb54
comparison
equal deleted inserted replaced
13236:97a6f049c9f8 13237:f85c105bfeaa
52 static int int_pause; 52 static int int_pause;
53 53
54 static uint32_t texture_width; 54 static uint32_t texture_width;
55 static uint32_t texture_height; 55 static uint32_t texture_height;
56 56
57 static int slice_height=1; 57 static unsigned int slice_height = 1;
58 58
59 static void resize(int x,int y){ 59 static void resize(int x,int y){
60 mp_msg(MSGT_VO, MSGL_V, "[gl] Resize: %dx%d\n",x,y); 60 mp_msg(MSGT_VO, MSGL_V, "[gl] Resize: %dx%d\n",x,y);
61 glViewport( 0, 0, x, y ); 61 glViewport( 0, 0, x, y );
62 62
312 312
313 313
314 static uint32_t 314 static uint32_t
315 draw_frame(uint8_t *src[]) 315 draw_frame(uint8_t *src[])
316 { 316 {
317 int i; 317 unsigned int i;
318 uint8_t *ImageData=src[0]; 318 uint8_t *ImageData=src[0];
319 319
320 if (slice_height == 0) 320 if (slice_height == 0)
321 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, image_width, image_height, 321 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, image_width, image_height,
322 gl_format, gl_type, ImageData); 322 gl_format, gl_type, ImageData);
356 } 356 }
357 357
358 static uint32_t preinit(const char *arg) 358 static uint32_t preinit(const char *arg)
359 { 359 {
360 int parse_err = 0; 360 int parse_err = 0;
361 unsigned int parse_pos = 0;
361 many_fmts = 0; 362 many_fmts = 0;
362 slice_height = 4; 363 slice_height = 4;
363 if(arg) 364 if(arg)
364 { 365 {
365 char *parse_pos = (char *)&arg[0]; 366 while (arg[parse_pos] && !parse_err) {
366 while (parse_pos[0] && !parse_err) { 367 if (strncmp (&arg[parse_pos], "manyfmts", 8) == 0) {
367 if (strncmp (parse_pos, "manyfmts", 8) == 0) { 368 parse_pos += 8;
368 parse_pos = &parse_pos[8];
369 many_fmts = 1; 369 many_fmts = 1;
370 } else if (strncmp (parse_pos, "slice-height=", 13) == 0) { 370 } else if (strncmp (&arg[parse_pos], "nomanyfmts", 10) == 0) {
371 parse_pos = &parse_pos[13]; 371 parse_pos += 10;
372 slice_height = strtol(parse_pos, &parse_pos, 0); 372 many_fmts = 0;
373 if (slice_height < 0) parse_err = 1; 373 } else if (strncmp (&arg[parse_pos], "slice-height=", 13) == 0) {
374 int val;
375 char *end;
376 parse_pos += 13;
377 val = strtol(&arg[parse_pos], &end, 0);
378 if (val < 0) parse_err = 1;
379 else {
380 slice_height = val;
381 parse_pos = end - arg;
382 }
374 } 383 }
375 if (parse_pos[0] == ':') parse_pos = &parse_pos[1]; 384 if (arg[parse_pos] == ':') parse_pos++;
376 else if (parse_pos[0]) parse_err = 1; 385 else if (arg[parse_pos]) parse_err = 1;
377 } 386 }
378 } 387 }
379 if (parse_err) { 388 if (parse_err) {
380 mp_msg(MSGT_VO, MSGL_ERR, 389 unsigned int i;
390 mp_msg(MSGT_VO, MSGL_FATAL, "Could not parse arguments:\n%s\n", arg);
391 for (i = 0; i < parse_pos; i++)
392 mp_msg(MSGT_VO, MSGL_FATAL, " ");
393 mp_msg(MSGT_VO, MSGL_FATAL, "^\n");
394 mp_msg(MSGT_VO, MSGL_FATAL,
381 "\n-vo gl command line help:\n" 395 "\n-vo gl command line help:\n"
382 "Example: mplayer -vo gl:slice-height=4\n" 396 "Example: mplayer -vo gl:slice-height=4\n"
383 "\nOptions:\n" 397 "\nOptions:\n"
384 " manyfmts\n" 398 " manyfmts\n"
385 " Enable extended color formats for OpenGL 1.2 and later\n" 399 " Enable extended color formats for OpenGL 1.2 and later\n"