Mercurial > mplayer.hg
comparison libvo/vo_jpeg.c @ 13247:933b45ad31d5
Removal of -jpeg commandline option.
It's replaced by an options parser in the module itself. Instead of
mplayer -vo jpeg -jpeg options one now has to use mplayer -vo jpeg:options.
author | ivo |
---|---|
date | Sat, 04 Sep 2004 22:59:33 +0000 |
parents | 43fe55f36522 |
children | 7dfd84faaa09 |
comparison
equal
deleted
inserted
replaced
13246:5dea9e3618ba | 13247:933b45ad31d5 |
---|---|
23 #include <errno.h> | 23 #include <errno.h> |
24 #include <jpeglib.h> | 24 #include <jpeglib.h> |
25 #include <sys/stat.h> | 25 #include <sys/stat.h> |
26 #include <sys/types.h> | 26 #include <sys/types.h> |
27 #include <unistd.h> | 27 #include <unistd.h> |
28 #include <math.h> /* for log10() */ | |
28 | 29 |
29 /* ------------------------------------------------------------------------- */ | 30 /* ------------------------------------------------------------------------- */ |
30 | 31 |
31 /* Local Includes */ | 32 /* Local Includes */ |
32 | 33 |
303 | 304 |
304 /* ------------------------------------------------------------------------- */ | 305 /* ------------------------------------------------------------------------- */ |
305 | 306 |
306 static uint32_t preinit(const char *arg) | 307 static uint32_t preinit(const char *arg) |
307 { | 308 { |
309 char *buf; /* buf is used to store parsed string values */ | |
310 int length; /* length is used when calculating the length of buf */ | |
311 int value; /* storage for parsed integer values */ | |
312 | |
313 mp_msg(MSGT_VO, MSGL_INFO, "%s: %s\n", info.short_name, | |
314 MSGTR_VO_JPEG_ParsingSuboptions); | |
315 | |
316 if (arg) { | |
317 | |
318 while (*arg != '\0') { | |
319 if (!strncmp(arg, ":", 1)) { | |
320 arg++; | |
321 continue; /* multiple ':' is not really an error */ | |
322 } if (!strncmp(arg, "progressive", 11)) { | |
323 arg += 11; | |
324 jpeg_progressive_mode = 1; | |
325 mp_msg(MSGT_VO, MSGL_INFO, "%s: %s\n", info.short_name, | |
326 MSGTR_VO_JPEG_ProgressiveJPEG); | |
327 } else if (!strncmp(arg, "noprogressive", 13)) { | |
328 arg += 13; | |
329 jpeg_progressive_mode = 0; | |
330 mp_msg(MSGT_VO, MSGL_INFO, "%s: %s\n", info.short_name, | |
331 MSGTR_VO_JPEG_NoProgressiveJPEG); | |
332 } else if (!strncmp(arg, "baseline", 8)) { | |
333 arg += 8; | |
334 jpeg_baseline = 1; | |
335 mp_msg(MSGT_VO, MSGL_INFO, "%s: %s\n", info.short_name, | |
336 MSGTR_VO_JPEG_BaselineJPEG); | |
337 } else if (!strncmp(arg, "nobaseline", 10)) { | |
338 arg += 10; | |
339 jpeg_baseline = 0; | |
340 mp_msg(MSGT_VO, MSGL_INFO, "%s: %s\n", info.short_name, | |
341 MSGTR_VO_JPEG_NoBaselineJPEG); | |
342 } else if (!strncmp(arg, "optimize=", 9)) { | |
343 arg += 9; | |
344 if (sscanf(arg, "%d", &value) == 1) { | |
345 if ( (value < 0 ) || (value > 100) ) { | |
346 mp_msg(MSGT_VO, MSGL_ERR, "%s: %s - %s %s.\n", | |
347 info.short_name, "optimize", | |
348 MSGTR_VO_JPEG_ValueOutOfRange, "[0-100]"); | |
349 exit_player(MSGTR_Exit_error); | |
350 } else { | |
351 jpeg_optimize = value; | |
352 mp_msg(MSGT_VO, MSGL_INFO, "%s: %s --> %d\n", | |
353 info.short_name, "optimize", value); | |
354 } | |
355 } else { | |
356 mp_msg(MSGT_VO, MSGL_ERR, "%s: %s - %s\n", | |
357 info.short_name, "optimize", | |
358 MSGTR_VO_JPEG_NoValueSpecified); | |
359 exit_player(MSGTR_Exit_error); | |
360 } | |
361 /* only here if value is set and sane */ | |
362 if (value) { | |
363 arg += (int)log10(value) + 1; | |
364 } else { | |
365 arg++; /* log10(0) fails */ | |
366 } | |
367 } else if (!strncmp(arg, "smooth=", 7)) { | |
368 arg += 7; | |
369 if (sscanf(arg, "%d", &value) == 1 ) { | |
370 if ( (value < 0) || (value > 100) ) { | |
371 mp_msg(MSGT_VO, MSGL_ERR, "%s: %s - %s %s.\n", | |
372 info.short_name, "smooth", | |
373 MSGTR_VO_JPEG_ValueOutOfRange, "[0-100]"); | |
374 exit_player(MSGTR_Exit_error); | |
375 } else { | |
376 jpeg_smooth = value; | |
377 mp_msg(MSGT_VO, MSGL_INFO, "%s: %s --> %d\n", | |
378 info.short_name, "smooth", value); | |
379 } | |
380 } else { | |
381 mp_msg(MSGT_VO, MSGL_ERR, "%s: %s - %s\n", | |
382 info.short_name, "smooth", | |
383 MSGTR_VO_JPEG_NoValueSpecified); | |
384 exit_player(MSGTR_Exit_error); | |
385 } | |
386 /* only here if value is set and sane */ | |
387 if (value) { | |
388 arg += (int)log10(value) + 1; | |
389 } else { | |
390 arg++; /* log10(0) fails */ | |
391 } | |
392 } else if (!strncmp(arg, "quality=", 8)) { | |
393 arg += 8; | |
394 if (sscanf(arg, "%d", &value) == 1) { | |
395 if ( (value < 0) || (value > 100) ) { | |
396 mp_msg(MSGT_VO, MSGL_ERR, "%s: %s - %s %s.\n", | |
397 info.short_name, "quality", | |
398 MSGTR_VO_JPEG_ValueOutOfRange, "[0-100]"); | |
399 exit_player(MSGTR_Exit_error); | |
400 } else { | |
401 jpeg_quality = value; | |
402 mp_msg(MSGT_VO, MSGL_INFO, "%s: %s --> %d\n", | |
403 info.short_name, "quality", value); | |
404 } | |
405 } else { | |
406 mp_msg(MSGT_VO, MSGL_ERR, "%s: %s - %s\n", | |
407 info.short_name, "quality", | |
408 MSGTR_VO_JPEG_NoValueSpecified); | |
409 exit_player(MSGTR_Exit_error); | |
410 } | |
411 /* only here if value is set and sane */ | |
412 if (value) { | |
413 arg += (int)log10(value) + 1; | |
414 } else { | |
415 arg++; /* log10(0) fails */ | |
416 } | |
417 } else if (!strncmp(arg, "outdir=", 7)) { | |
418 arg += 7; | |
419 buf = malloc(strlen(arg)+1); /* maximum length possible */ | |
420 if (!buf) { | |
421 mp_msg(MSGT_VO, MSGL_ERR, "%s: %s\n", info.short_name, | |
422 MSGTR_MemAllocFailed); | |
423 exit_player(MSGTR_Exit_error); | |
424 } | |
425 if (sscanf(arg, "%[^:]", buf) == 1) { | |
426 mp_msg(MSGT_VO, MSGL_INFO, "%s: %s --> %s\n", | |
427 info.short_name, "outdir", buf); | |
428 length = strlen(buf); | |
429 arg += length; | |
430 jpeg_outdir = malloc(length+1); | |
431 strncpy(jpeg_outdir, buf, length+1); | |
432 free(buf); | |
433 } else { | |
434 mp_msg(MSGT_VO, MSGL_ERR, "%s: %s - %s\n", | |
435 info.short_name, "outdir", | |
436 MSGTR_VO_JPEG_NoValueSpecified); | |
437 exit_player(MSGTR_Exit_error); | |
438 } | |
439 } else if (!strncmp(arg, "subdirs=", 8)) { | |
440 arg += 8; | |
441 buf = malloc(strlen(arg)+1); /* maximum length possible */ | |
442 if (!buf) { | |
443 mp_msg(MSGT_VO, MSGL_ERR, "%s: %s\n", info.short_name, | |
444 MSGTR_MemAllocFailed); | |
445 exit_player(MSGTR_Exit_error); | |
446 } | |
447 if (sscanf(arg, "%[^:]", buf) == 1) { | |
448 mp_msg(MSGT_VO, MSGL_INFO, "%s: %s --> %s\n", | |
449 info.short_name, "subdirs", buf); | |
450 length = strlen(buf); | |
451 arg += length; | |
452 jpeg_subdirs = malloc(length+1); | |
453 strncpy(jpeg_subdirs, buf, length+1); | |
454 free(buf); | |
455 } else { | |
456 mp_msg(MSGT_VO, MSGL_ERR, "%s: %s - %s\n", | |
457 info.short_name, "subdirs", | |
458 MSGTR_VO_JPEG_NoValueSpecified); | |
459 exit_player(MSGTR_Exit_error); | |
460 } | |
461 } else if (!strncmp(arg, "maxfiles=", 9)) { | |
462 arg += 9; | |
463 if (sscanf(arg, "%d", &value) == 1) { | |
464 if (value < 1) { | |
465 mp_msg(MSGT_VO, MSGL_ERR, "%s: %s - %s %s.\n", | |
466 info.short_name, "maxfiles", | |
467 MSGTR_VO_JPEG_ValueOutOfRange, ">=1"); | |
468 exit_player(MSGTR_Exit_error); | |
469 } else { | |
470 jpeg_maxfiles = value; | |
471 mp_msg(MSGT_VO, MSGL_INFO, "%s: %s --> %d\n", | |
472 info.short_name, "maxfiles", value); | |
473 } | |
474 } else { | |
475 mp_msg(MSGT_VO, MSGL_ERR, "%s: %s - %s\n", | |
476 info.short_name, "maxfiles", | |
477 MSGTR_VO_JPEG_NoValueSpecified); | |
478 exit_player(MSGTR_Exit_error); | |
479 } | |
480 /* only here if value is set and sane */ | |
481 if (value) { | |
482 arg += (int)log10(value) + 1; | |
483 } else { | |
484 arg++; /* log10(0) fails */ | |
485 } | |
486 } else { | |
487 mp_msg(MSGT_VO, MSGL_ERR, "%s: %s %-20s...\n", info.short_name, | |
488 MSGTR_VO_JPEG_UnknownOptions, arg); | |
489 exit_player(MSGTR_Exit_error); | |
490 } | |
491 } /* end while */ | |
492 } /* endif */ | |
493 | |
494 mp_msg(MSGT_VO, MSGL_INFO, "%s: %s\n", info.short_name, | |
495 MSGTR_VO_JPEG_SuboptionsParsedOK); | |
308 return 0; | 496 return 0; |
309 } | 497 } |
310 | 498 |
311 /* ------------------------------------------------------------------------- */ | 499 /* ------------------------------------------------------------------------- */ |
312 | 500 |