2008-05-14 17:22:53 +00:00
|
|
|
/*
|
|
|
|
* JPEG Renderer for MPlayer
|
2002-04-16 11:21:59 +00:00
|
|
|
*
|
2007-11-29 14:36:59 +00:00
|
|
|
* Copyright (C) 2002 by Pontscho <pontscho@makacs.poliod.hu>
|
|
|
|
* Copyright (C) 2003 by Alex
|
|
|
|
* Copyright (C) 2004, 2005 by Ivo van Poorten <ivop@euronet.nl>
|
|
|
|
*
|
2008-05-14 17:22:53 +00:00
|
|
|
* This file is part of MPlayer.
|
2007-11-29 14:36:59 +00:00
|
|
|
*
|
2008-05-14 17:22:53 +00:00
|
|
|
* MPlayer is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* MPlayer is distributed in the hope that it will be useful,
|
2007-11-29 14:36:59 +00:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
2008-05-14 17:22:53 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with MPlayer; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2002-04-16 11:21:59 +00:00
|
|
|
*/
|
|
|
|
|
2004-09-01 02:31:24 +00:00
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
/* Global Includes */
|
|
|
|
|
2002-04-16 11:21:59 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <jpeglib.h>
|
2004-09-01 02:31:24 +00:00
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
/* Local Includes */
|
2002-04-16 11:21:59 +00:00
|
|
|
|
|
|
|
#include "config.h"
|
2005-01-15 23:54:49 +00:00
|
|
|
#include "subopt-helper.h"
|
2004-08-26 22:18:25 +00:00
|
|
|
#include "mp_msg.h"
|
2002-04-16 11:21:59 +00:00
|
|
|
#include "video_out.h"
|
|
|
|
#include "video_out_internal.h"
|
2004-08-26 22:18:25 +00:00
|
|
|
#include "mplayer.h" /* for exit_player() */
|
|
|
|
#include "help_mp.h"
|
|
|
|
|
2004-09-01 02:31:24 +00:00
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
/* Defines */
|
2004-08-26 22:18:25 +00:00
|
|
|
|
|
|
|
/* Used for temporary buffers to store file- and pathnames */
|
|
|
|
#define BUFLENGTH 512
|
2002-04-16 11:21:59 +00:00
|
|
|
|
2004-09-01 02:31:24 +00:00
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
/* Info */
|
|
|
|
|
2007-12-02 14:06:03 +00:00
|
|
|
static const vo_info_t info=
|
2002-04-16 11:21:59 +00:00
|
|
|
{
|
|
|
|
"JPEG file",
|
|
|
|
"jpeg",
|
|
|
|
"Zoltan Ponekker (pontscho@makacs.poliod.hu)",
|
|
|
|
""
|
|
|
|
};
|
|
|
|
|
2007-12-02 14:39:15 +00:00
|
|
|
const LIBVO_EXTERN (jpeg)
|
2002-11-11 15:22:10 +00:00
|
|
|
|
2004-09-01 02:31:24 +00:00
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
/* Global Variables */
|
|
|
|
|
2002-04-16 11:21:59 +00:00
|
|
|
static int image_width;
|
|
|
|
static int image_height;
|
2006-01-20 01:37:15 +00:00
|
|
|
static int image_d_width;
|
|
|
|
static int image_d_height;
|
2002-04-16 11:21:59 +00:00
|
|
|
|
|
|
|
int jpeg_baseline = 1;
|
|
|
|
int jpeg_progressive_mode = 0;
|
|
|
|
int jpeg_optimize = 100;
|
|
|
|
int jpeg_smooth = 0;
|
|
|
|
int jpeg_quality = 75;
|
2006-01-20 01:37:15 +00:00
|
|
|
int jpeg_dpi = 72; /** Screen resolution = 72 dpi */
|
2004-09-11 19:59:31 +00:00
|
|
|
char *jpeg_outdir = NULL;
|
2004-09-01 02:31:24 +00:00
|
|
|
char *jpeg_subdirs = NULL;
|
|
|
|
int jpeg_maxfiles = 1000;
|
2002-04-16 11:21:59 +00:00
|
|
|
|
2004-09-01 02:31:24 +00:00
|
|
|
static int framenum = 0;
|
2002-04-16 11:21:59 +00:00
|
|
|
|
2004-09-01 02:31:24 +00:00
|
|
|
/* ------------------------------------------------------------------------- */
|
2004-08-26 22:18:25 +00:00
|
|
|
|
2004-09-08 01:11:16 +00:00
|
|
|
/** \brief Create a directory.
|
|
|
|
*
|
|
|
|
* This function creates a directory. If it already exists, it tests if
|
|
|
|
* it's a directory and not something else, and if it is, it tests whether
|
|
|
|
* the directory is writable or not.
|
|
|
|
*
|
|
|
|
* \param buf Pointer to directory name.
|
|
|
|
* \param verbose Verbose on success. If verbose is non-zero, it will print
|
|
|
|
* a message if it was successful in creating the directory.
|
|
|
|
*
|
|
|
|
* \return nothing In case anything fails, the player will exit. If it
|
|
|
|
* returns, everything went well.
|
|
|
|
*/
|
|
|
|
|
2006-07-08 15:26:36 +00:00
|
|
|
static void jpeg_mkdir(char *buf, int verbose) {
|
2004-09-01 02:31:24 +00:00
|
|
|
struct stat stat_p;
|
2004-08-26 22:18:25 +00:00
|
|
|
|
2004-09-15 15:17:06 +00:00
|
|
|
#ifndef __MINGW32__
|
2004-09-01 02:31:24 +00:00
|
|
|
if ( mkdir(buf, 0755) < 0 ) {
|
2004-09-15 15:17:06 +00:00
|
|
|
#else
|
|
|
|
if ( mkdir(buf) < 0 ) {
|
|
|
|
#endif
|
2004-09-01 02:31:24 +00:00
|
|
|
switch (errno) { /* use switch in case other errors need to be caught
|
|
|
|
and handled in the future */
|
|
|
|
case EEXIST:
|
|
|
|
if ( stat(buf, &stat_p ) < 0 ) {
|
|
|
|
mp_msg(MSGT_VO, MSGL_ERR, "%s: %s: %s\n", info.short_name,
|
2004-09-08 03:51:37 +00:00
|
|
|
MSGTR_VO_GenericError, strerror(errno) );
|
2004-09-01 02:31:24 +00:00
|
|
|
mp_msg(MSGT_VO, MSGL_ERR, "%s: %s %s\n", info.short_name,
|
2004-09-08 03:51:37 +00:00
|
|
|
MSGTR_VO_UnableToAccess,buf);
|
2004-09-01 02:31:24 +00:00
|
|
|
exit_player(MSGTR_Exit_error);
|
|
|
|
}
|
|
|
|
if ( !S_ISDIR(stat_p.st_mode) ) {
|
|
|
|
mp_msg(MSGT_VO, MSGL_ERR, "%s: %s %s\n", info.short_name,
|
2004-09-08 03:51:37 +00:00
|
|
|
buf, MSGTR_VO_ExistsButNoDirectory);
|
2004-09-01 02:31:24 +00:00
|
|
|
exit_player(MSGTR_Exit_error);
|
|
|
|
}
|
|
|
|
if ( !(stat_p.st_mode & S_IWUSR) ) {
|
2004-09-08 01:11:16 +00:00
|
|
|
mp_msg(MSGT_VO, MSGL_ERR, "%s: %s - %s\n", info.short_name,
|
2004-09-08 03:51:37 +00:00
|
|
|
buf, MSGTR_VO_DirExistsButNotWritable);
|
2004-09-01 02:31:24 +00:00
|
|
|
exit_player(MSGTR_Exit_error);
|
|
|
|
}
|
|
|
|
|
2004-09-08 01:11:16 +00:00
|
|
|
mp_msg(MSGT_VO, MSGL_INFO, "%s: %s - %s\n", info.short_name,
|
2004-09-08 03:51:37 +00:00
|
|
|
buf, MSGTR_VO_DirExistsAndIsWritable);
|
2004-09-01 02:31:24 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
mp_msg(MSGT_VO, MSGL_ERR, "%s: %s: %s\n", info.short_name,
|
2004-09-08 03:51:37 +00:00
|
|
|
MSGTR_VO_GenericError, strerror(errno) );
|
2004-09-08 01:11:16 +00:00
|
|
|
mp_msg(MSGT_VO, MSGL_ERR, "%s: %s - %s\n", info.short_name,
|
2004-09-08 03:51:37 +00:00
|
|
|
buf, MSGTR_VO_CantCreateDirectory);
|
2004-09-01 02:31:24 +00:00
|
|
|
exit_player(MSGTR_Exit_error);
|
|
|
|
} /* end switch */
|
2004-09-08 01:11:16 +00:00
|
|
|
} else if ( verbose ) {
|
|
|
|
mp_msg(MSGT_VO, MSGL_INFO, "%s: %s - %s\n", info.short_name,
|
2004-09-08 03:51:37 +00:00
|
|
|
buf, MSGTR_VO_DirectoryCreateSuccess);
|
2004-09-01 02:31:24 +00:00
|
|
|
} /* end if */
|
2004-09-08 01:11:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
|
2005-08-05 01:24:37 +00:00
|
|
|
static int config(uint32_t width, uint32_t height, uint32_t d_width,
|
2005-04-18 15:52:38 +00:00
|
|
|
uint32_t d_height, uint32_t flags, char *title,
|
2004-09-08 01:11:16 +00:00
|
|
|
uint32_t format)
|
|
|
|
{
|
|
|
|
char buf[BUFLENGTH];
|
|
|
|
|
|
|
|
/* Create outdir. */
|
|
|
|
|
|
|
|
snprintf(buf, BUFLENGTH, "%s", jpeg_outdir);
|
|
|
|
|
|
|
|
jpeg_mkdir(buf, 1); /* This function only returns if creation was
|
|
|
|
successful. If not, the player will exit. */
|
2004-09-01 02:31:24 +00:00
|
|
|
|
|
|
|
image_height = height;
|
|
|
|
image_width = width;
|
2006-01-20 01:37:15 +00:00
|
|
|
/* Save for JFIF-Header PAR */
|
|
|
|
image_d_width = d_width;
|
|
|
|
image_d_height = d_height;
|
2004-09-01 02:31:24 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
static uint32_t jpeg_write(uint8_t * name, uint8_t * buffer)
|
|
|
|
{
|
|
|
|
FILE *outfile;
|
|
|
|
struct jpeg_compress_struct cinfo;
|
|
|
|
struct jpeg_error_mgr jerr;
|
|
|
|
JSAMPROW row_pointer[1];
|
|
|
|
int row_stride;
|
|
|
|
|
|
|
|
if ( !buffer ) return 1;
|
|
|
|
if ( (outfile = fopen(name, "wb") ) == NULL ) {
|
2004-09-05 17:54:09 +00:00
|
|
|
mp_msg(MSGT_VO, MSGL_ERR, "\n%s: %s\n", info.short_name,
|
2004-09-08 03:51:37 +00:00
|
|
|
MSGTR_VO_CantCreateFile);
|
2004-09-05 17:54:09 +00:00
|
|
|
mp_msg(MSGT_VO, MSGL_ERR, "%s: %s: %s\n",
|
2004-09-08 03:51:37 +00:00
|
|
|
info.short_name, MSGTR_VO_GenericError,
|
2004-09-05 17:54:09 +00:00
|
|
|
strerror(errno) );
|
|
|
|
exit_player(MSGTR_Exit_error);
|
2004-08-26 22:18:25 +00:00
|
|
|
}
|
2004-09-01 02:31:24 +00:00
|
|
|
|
|
|
|
cinfo.err = jpeg_std_error(&jerr);
|
|
|
|
jpeg_create_compress(&cinfo);
|
|
|
|
jpeg_stdio_dest(&cinfo, outfile);
|
|
|
|
|
|
|
|
cinfo.image_width = image_width;
|
|
|
|
cinfo.image_height = image_height;
|
|
|
|
cinfo.input_components = 3;
|
|
|
|
cinfo.in_color_space = JCS_RGB;
|
2006-01-20 01:37:15 +00:00
|
|
|
|
2004-09-01 02:31:24 +00:00
|
|
|
jpeg_set_defaults(&cinfo);
|
2006-01-20 01:37:15 +00:00
|
|
|
/* Important: Header info must be set AFTER jpeg_set_defaults() */
|
|
|
|
cinfo.write_JFIF_header = TRUE;
|
|
|
|
cinfo.JFIF_major_version = 1;
|
|
|
|
cinfo.JFIF_minor_version = 2;
|
|
|
|
cinfo.density_unit = 1; /* 0=unknown, 1=dpi, 2=dpcm */
|
|
|
|
/* Image DPI is determined by Y_density, so we leave that at
|
|
|
|
jpeg_dpi if possible and crunch X_density instead (PAR > 1) */
|
|
|
|
cinfo.X_density = jpeg_dpi*image_width/image_d_width;
|
|
|
|
cinfo.Y_density = jpeg_dpi*image_height/image_d_height;
|
|
|
|
cinfo.write_Adobe_marker = TRUE;
|
|
|
|
|
2004-09-01 02:31:24 +00:00
|
|
|
jpeg_set_quality(&cinfo,jpeg_quality, jpeg_baseline);
|
|
|
|
cinfo.optimize_coding = jpeg_optimize;
|
|
|
|
cinfo.smoothing_factor = jpeg_smooth;
|
|
|
|
|
|
|
|
if ( jpeg_progressive_mode ) {
|
|
|
|
jpeg_simple_progression(&cinfo);
|
2004-08-26 22:18:25 +00:00
|
|
|
}
|
2004-09-01 02:31:24 +00:00
|
|
|
|
|
|
|
jpeg_start_compress(&cinfo, TRUE);
|
|
|
|
|
|
|
|
row_stride = image_width * 3;
|
|
|
|
while (cinfo.next_scanline < cinfo.image_height) {
|
|
|
|
row_pointer[0] = &buffer[cinfo.next_scanline * row_stride];
|
|
|
|
(void)jpeg_write_scanlines(&cinfo, row_pointer,1);
|
2004-08-26 22:18:25 +00:00
|
|
|
}
|
|
|
|
|
2004-09-01 02:31:24 +00:00
|
|
|
jpeg_finish_compress(&cinfo);
|
|
|
|
fclose(outfile);
|
|
|
|
jpeg_destroy_compress(&cinfo);
|
2002-04-16 11:21:59 +00:00
|
|
|
|
2004-09-01 02:31:24 +00:00
|
|
|
return 0;
|
2002-04-16 11:21:59 +00:00
|
|
|
}
|
|
|
|
|
2004-09-01 02:31:24 +00:00
|
|
|
/* ------------------------------------------------------------------------- */
|
2002-04-16 11:21:59 +00:00
|
|
|
|
2005-08-05 01:24:37 +00:00
|
|
|
static int draw_frame(uint8_t *src[])
|
2002-04-16 11:21:59 +00:00
|
|
|
{
|
2005-02-28 00:26:53 +00:00
|
|
|
static int framecounter = 0, subdircounter = 0;
|
2004-09-01 02:31:24 +00:00
|
|
|
char buf[BUFLENGTH];
|
|
|
|
static char subdirname[BUFLENGTH] = "";
|
|
|
|
|
|
|
|
/* Start writing to new subdirectory after a certain amount of frames */
|
|
|
|
if ( framecounter == jpeg_maxfiles ) {
|
|
|
|
framecounter = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If framecounter is zero (or reset to zero), increment subdirectory
|
|
|
|
* number and create the subdirectory.
|
|
|
|
* If jpeg_subdirs is not set, do nothing and resort to old behaviour. */
|
|
|
|
if ( !framecounter && jpeg_subdirs ) {
|
2004-09-10 01:15:24 +00:00
|
|
|
subdircounter++;
|
|
|
|
snprintf(subdirname, BUFLENGTH, "%s%08d", jpeg_subdirs, subdircounter);
|
2004-09-01 02:31:24 +00:00
|
|
|
snprintf(buf, BUFLENGTH, "%s/%s", jpeg_outdir, subdirname);
|
2004-09-08 01:11:16 +00:00
|
|
|
jpeg_mkdir(buf, 0); /* This function only returns if creation was
|
|
|
|
successful. If not, the player will exit. */
|
|
|
|
}
|
2004-09-01 02:31:24 +00:00
|
|
|
|
|
|
|
framenum++;
|
|
|
|
|
|
|
|
/* snprintf the full pathname of the outputfile */
|
|
|
|
snprintf(buf, BUFLENGTH, "%s/%s/%08d.jpg", jpeg_outdir, subdirname,
|
|
|
|
framenum);
|
|
|
|
|
|
|
|
framecounter++;
|
|
|
|
|
|
|
|
return jpeg_write(buf, src[0]);
|
2002-04-16 11:21:59 +00:00
|
|
|
}
|
|
|
|
|
2004-09-01 02:31:24 +00:00
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
|
2002-04-16 11:21:59 +00:00
|
|
|
static void draw_osd(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2004-09-01 02:31:24 +00:00
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
|
2002-04-16 11:21:59 +00:00
|
|
|
static void flip_page (void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2004-09-01 02:31:24 +00:00
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
|
2005-08-05 01:24:37 +00:00
|
|
|
static int draw_slice(uint8_t *src[], int stride[], int w, int h,
|
2004-09-01 02:31:24 +00:00
|
|
|
int x, int y)
|
2002-04-16 11:21:59 +00:00
|
|
|
{
|
2004-09-01 02:31:24 +00:00
|
|
|
return 0;
|
2002-04-16 11:21:59 +00:00
|
|
|
}
|
|
|
|
|
2004-09-01 02:31:24 +00:00
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
|
2005-08-05 01:24:37 +00:00
|
|
|
static int query_format(uint32_t format)
|
2002-04-16 11:21:59 +00:00
|
|
|
{
|
2004-09-01 02:31:24 +00:00
|
|
|
if (format == IMGFMT_RGB24) {
|
|
|
|
return VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW;
|
|
|
|
}
|
|
|
|
|
2003-04-25 20:37:26 +00:00
|
|
|
return 0;
|
2002-04-16 11:21:59 +00:00
|
|
|
}
|
|
|
|
|
2004-09-01 02:31:24 +00:00
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
|
2002-04-16 11:21:59 +00:00
|
|
|
static void uninit(void)
|
|
|
|
{
|
2004-09-11 19:59:31 +00:00
|
|
|
if (jpeg_subdirs) {
|
|
|
|
free(jpeg_subdirs);
|
|
|
|
jpeg_subdirs = NULL;
|
|
|
|
}
|
|
|
|
if (jpeg_outdir) {
|
|
|
|
free(jpeg_outdir);
|
|
|
|
jpeg_outdir = NULL;
|
|
|
|
}
|
2002-04-16 11:21:59 +00:00
|
|
|
}
|
|
|
|
|
2004-09-01 02:31:24 +00:00
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
|
2002-04-16 11:21:59 +00:00
|
|
|
static void check_events(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2004-09-01 02:31:24 +00:00
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
|
2005-01-15 23:54:49 +00:00
|
|
|
/** \brief Validation function for values [0-100]
|
2004-09-11 19:59:31 +00:00
|
|
|
*/
|
|
|
|
|
2005-01-15 23:54:49 +00:00
|
|
|
static int int_zero_hundred(int *val)
|
|
|
|
{
|
|
|
|
if ( (*val >=0) && (*val<=100) )
|
|
|
|
return 1;
|
|
|
|
return 0;
|
2004-09-11 19:59:31 +00:00
|
|
|
}
|
|
|
|
|
2005-08-05 01:24:37 +00:00
|
|
|
static int preinit(const char *arg)
|
2002-04-16 11:21:59 +00:00
|
|
|
{
|
2005-01-15 23:54:49 +00:00
|
|
|
opt_t subopts[] = {
|
2005-02-28 00:26:53 +00:00
|
|
|
{"progressive", OPT_ARG_BOOL, &jpeg_progressive_mode, NULL, 0},
|
|
|
|
{"baseline", OPT_ARG_BOOL, &jpeg_baseline, NULL, 0},
|
2005-01-15 23:54:49 +00:00
|
|
|
{"optimize", OPT_ARG_INT, &jpeg_optimize,
|
2005-02-28 00:26:53 +00:00
|
|
|
(opt_test_f)int_zero_hundred, 0},
|
2005-01-15 23:54:49 +00:00
|
|
|
{"smooth", OPT_ARG_INT, &jpeg_smooth,
|
2005-02-28 00:26:53 +00:00
|
|
|
(opt_test_f)int_zero_hundred, 0},
|
2005-01-15 23:54:49 +00:00
|
|
|
{"quality", OPT_ARG_INT, &jpeg_quality,
|
2005-02-28 00:26:53 +00:00
|
|
|
(opt_test_f)int_zero_hundred, 0},
|
2006-01-20 01:37:15 +00:00
|
|
|
{"dpi", OPT_ARG_INT, &jpeg_dpi, NULL, 0},
|
2005-02-28 00:26:53 +00:00
|
|
|
{"outdir", OPT_ARG_MSTRZ, &jpeg_outdir, NULL, 0},
|
|
|
|
{"subdirs", OPT_ARG_MSTRZ, &jpeg_subdirs, NULL, 0},
|
|
|
|
{"maxfiles", OPT_ARG_INT, &jpeg_maxfiles, (opt_test_f)int_pos, 0},
|
|
|
|
{NULL, 0, NULL, NULL, 0}
|
2005-01-15 23:54:49 +00:00
|
|
|
};
|
|
|
|
const char *info_message = NULL;
|
2004-09-04 22:59:33 +00:00
|
|
|
|
|
|
|
mp_msg(MSGT_VO, MSGL_INFO, "%s: %s\n", info.short_name,
|
2004-09-08 03:51:37 +00:00
|
|
|
MSGTR_VO_ParsingSuboptions);
|
2005-01-15 23:54:49 +00:00
|
|
|
|
|
|
|
jpeg_progressive_mode = 0;
|
|
|
|
jpeg_baseline = 1;
|
|
|
|
jpeg_optimize = 100;
|
|
|
|
jpeg_smooth = 0;
|
|
|
|
jpeg_quality = 75;
|
|
|
|
jpeg_maxfiles = 1000;
|
2005-01-19 17:10:20 +00:00
|
|
|
jpeg_outdir = strdup(".");
|
|
|
|
jpeg_subdirs = NULL;
|
2005-01-15 23:54:49 +00:00
|
|
|
|
|
|
|
if (subopt_parse(arg, subopts) != 0) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (jpeg_progressive_mode) info_message = MSGTR_VO_JPEG_ProgressiveJPEG;
|
|
|
|
else info_message = MSGTR_VO_JPEG_NoProgressiveJPEG;
|
|
|
|
mp_msg(MSGT_VO, MSGL_INFO, "%s: %s\n", info.short_name, info_message);
|
|
|
|
|
|
|
|
if (jpeg_baseline) info_message = MSGTR_VO_JPEG_BaselineJPEG;
|
|
|
|
else info_message = MSGTR_VO_JPEG_NoBaselineJPEG;
|
|
|
|
mp_msg(MSGT_VO, MSGL_INFO, "%s: %s\n", info.short_name, info_message);
|
|
|
|
|
|
|
|
mp_msg(MSGT_VO, MSGL_V, "%s: optimize --> %d\n", info.short_name,
|
|
|
|
jpeg_optimize);
|
|
|
|
mp_msg(MSGT_VO, MSGL_V, "%s: smooth --> %d\n", info.short_name,
|
|
|
|
jpeg_smooth);
|
|
|
|
mp_msg(MSGT_VO, MSGL_V, "%s: quality --> %d\n", info.short_name,
|
|
|
|
jpeg_quality);
|
2006-01-20 01:37:15 +00:00
|
|
|
mp_msg(MSGT_VO, MSGL_V, "%s: dpi --> %d\n", info.short_name,
|
|
|
|
jpeg_dpi);
|
2005-01-15 23:54:49 +00:00
|
|
|
mp_msg(MSGT_VO, MSGL_V, "%s: outdir --> %s\n", info.short_name,
|
|
|
|
jpeg_outdir);
|
|
|
|
if (jpeg_subdirs) {
|
|
|
|
mp_msg(MSGT_VO, MSGL_V, "%s: subdirs --> %s\n", info.short_name,
|
|
|
|
jpeg_subdirs);
|
|
|
|
mp_msg(MSGT_VO, MSGL_V, "%s: maxfiles --> %d\n", info.short_name,
|
|
|
|
jpeg_maxfiles);
|
2004-09-11 19:59:31 +00:00
|
|
|
}
|
|
|
|
|
2004-09-04 22:59:33 +00:00
|
|
|
mp_msg(MSGT_VO, MSGL_INFO, "%s: %s\n", info.short_name,
|
2004-09-08 03:51:37 +00:00
|
|
|
MSGTR_VO_SuboptionsParsedOK);
|
2004-09-01 02:31:24 +00:00
|
|
|
return 0;
|
2002-04-16 11:21:59 +00:00
|
|
|
}
|
|
|
|
|
2004-09-01 02:31:24 +00:00
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
|
2005-08-05 01:24:37 +00:00
|
|
|
static int control(uint32_t request, void *data, ...)
|
2002-04-16 11:21:59 +00:00
|
|
|
{
|
2004-09-01 02:31:24 +00:00
|
|
|
switch (request) {
|
|
|
|
case VOCTRL_QUERY_FORMAT:
|
|
|
|
return query_format(*((uint32_t*)data));
|
|
|
|
}
|
|
|
|
return VO_NOTIMPL;
|
2002-04-16 11:21:59 +00:00
|
|
|
}
|
2004-08-26 22:18:25 +00:00
|
|
|
|
2004-09-01 02:31:24 +00:00
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
|
2004-08-26 22:18:25 +00:00
|
|
|
#undef BUFLENGTH
|
|
|
|
|
2004-09-01 02:31:24 +00:00
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
|