annotate libvo/vo_jpeg.c @ 37195:ac6c37d85d65 default tip

configure: Fix initialization of variable def_local_aligned_32 It contiained the #define of HAVE_LOCAL_ALIGNED_16 instead of HAVE_LOCAL_ALIGNED_32.
author al
date Sun, 28 Sep 2014 18:38:41 +0000
parents 5d3f93051de9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26739
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
1 /*
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
2 * JPEG Renderer for MPlayer
5648
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
3 *
25174
3b78fa30a2b7 Remove redundant changelog from comments
ivo
parents: 18950
diff changeset
4 * Copyright (C) 2002 by Pontscho <pontscho@makacs.poliod.hu>
3b78fa30a2b7 Remove redundant changelog from comments
ivo
parents: 18950
diff changeset
5 * Copyright (C) 2003 by Alex
3b78fa30a2b7 Remove redundant changelog from comments
ivo
parents: 18950
diff changeset
6 * Copyright (C) 2004, 2005 by Ivo van Poorten <ivop@euronet.nl>
3b78fa30a2b7 Remove redundant changelog from comments
ivo
parents: 18950
diff changeset
7 *
26739
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
8 * This file is part of MPlayer.
25174
3b78fa30a2b7 Remove redundant changelog from comments
ivo
parents: 18950
diff changeset
9 *
26739
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
10 * MPlayer is free software; you can redistribute it and/or modify
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
11 * it under the terms of the GNU General Public License as published by
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
12 * the Free Software Foundation; either version 2 of the License, or
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
13 * (at your option) any later version.
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
14 *
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
15 * MPlayer is distributed in the hope that it will be useful,
25174
3b78fa30a2b7 Remove redundant changelog from comments
ivo
parents: 18950
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
3b78fa30a2b7 Remove redundant changelog from comments
ivo
parents: 18950
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3b78fa30a2b7 Remove redundant changelog from comments
ivo
parents: 18950
diff changeset
18 * GNU General Public License for more details.
3b78fa30a2b7 Remove redundant changelog from comments
ivo
parents: 18950
diff changeset
19 *
26739
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
20 * You should have received a copy of the GNU General Public License along
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
21 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
5648
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
23 */
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
24
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
25 /* ------------------------------------------------------------------------- */
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
26
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
27 /* Global Includes */
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
28
5648
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
29 #include <stdio.h>
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
30 #include <stdlib.h>
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
31 #include <string.h>
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
32 #include <errno.h>
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
33 #include <jpeglib.h>
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
34 #include <sys/stat.h>
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
35 #include <sys/types.h>
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
36 #include <unistd.h>
5648
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
37
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
38 /* ------------------------------------------------------------------------- */
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
39
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
40 /* Local Includes */
5648
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
41
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
42 #include "config.h"
14508
3673ad04ebfb Replaced suboption parser by call to suboption helper.
ivo
parents: 13347
diff changeset
43 #include "subopt-helper.h"
13158
b872a27aea9e Added output to multiple directories for vo_jpeg.
ivo
parents: 12857
diff changeset
44 #include "mp_msg.h"
5648
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
45 #include "video_out.h"
36517
5d3f93051de9 Remove empty draw_slice and draw_frame stubs.
reimar
parents: 36374
diff changeset
46 #define NO_DRAW_SLICE
5648
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
47 #include "video_out_internal.h"
30516
f4e017b6921a Fix exit_player() usage throughout the codebase.
diego
parents: 30123
diff changeset
48 #include "mp_core.h"
13158
b872a27aea9e Added output to multiple directories for vo_jpeg.
ivo
parents: 12857
diff changeset
49 #include "help_mp.h"
b872a27aea9e Added output to multiple directories for vo_jpeg.
ivo
parents: 12857
diff changeset
50
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
51 /* ------------------------------------------------------------------------- */
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
52
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
53 /* Defines */
13158
b872a27aea9e Added output to multiple directories for vo_jpeg.
ivo
parents: 12857
diff changeset
54
b872a27aea9e Added output to multiple directories for vo_jpeg.
ivo
parents: 12857
diff changeset
55 /* Used for temporary buffers to store file- and pathnames */
b872a27aea9e Added output to multiple directories for vo_jpeg.
ivo
parents: 12857
diff changeset
56 #define BUFLENGTH 512
5648
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
57
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
58 /* ------------------------------------------------------------------------- */
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
59
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
60 /* Info */
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
61
25216
3aee342be929 Make vo info structs const
reimar
parents: 25174
diff changeset
62 static const vo_info_t info=
5648
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
63 {
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
64 "JPEG file",
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
65 "jpeg",
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
66 "Zoltan Ponekker (pontscho@makacs.poliod.hu)",
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
67 ""
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
68 };
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
69
25220
c9e9ac2008c2 Mark the vo_functions_t definitions as const where possible.
reimar
parents: 25216
diff changeset
70 const LIBVO_EXTERN (jpeg)
8148
5b39e79af5fe removed get_info, using the same sheme as in libmpcodecs instead
alex
parents: 7487
diff changeset
71
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
72 /* ------------------------------------------------------------------------- */
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
73
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
74 /* Global Variables */
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
75
5648
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
76 static int image_width;
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
77 static int image_height;
17436
2ab8452b8ce4 Added DPI (Print-Resolution) and Pixel-Aspect awareness to vo_jpeg.
atmos4
parents: 16171
diff changeset
78 static int image_d_width;
2ab8452b8ce4 Added DPI (Print-Resolution) and Pixel-Aspect awareness to vo_jpeg.
atmos4
parents: 16171
diff changeset
79 static int image_d_height;
5648
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
80
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
81 int jpeg_baseline = 1;
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
82 int jpeg_progressive_mode = 0;
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
83 int jpeg_optimize = 100;
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
84 int jpeg_smooth = 0;
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
85 int jpeg_quality = 75;
17436
2ab8452b8ce4 Added DPI (Print-Resolution) and Pixel-Aspect awareness to vo_jpeg.
atmos4
parents: 16171
diff changeset
86 int jpeg_dpi = 72; /** Screen resolution = 72 dpi */
13316
0d17bef9894d * Changed malloc and strncpy to strdup. Less code.
ivo
parents: 13300
diff changeset
87 char *jpeg_outdir = NULL;
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
88 char *jpeg_subdirs = NULL;
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
89 int jpeg_maxfiles = 1000;
5648
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
90
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
91 static int framenum = 0;
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
92
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
93 /* ------------------------------------------------------------------------- */
5648
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
94
13283
858b7e04718c This patch moves the directory creation code to a separate function. I have
ivo
parents: 13252
diff changeset
95 /** \brief Create a directory.
858b7e04718c This patch moves the directory creation code to a separate function. I have
ivo
parents: 13252
diff changeset
96 *
858b7e04718c This patch moves the directory creation code to a separate function. I have
ivo
parents: 13252
diff changeset
97 * This function creates a directory. If it already exists, it tests if
858b7e04718c This patch moves the directory creation code to a separate function. I have
ivo
parents: 13252
diff changeset
98 * it's a directory and not something else, and if it is, it tests whether
858b7e04718c This patch moves the directory creation code to a separate function. I have
ivo
parents: 13252
diff changeset
99 * the directory is writable or not.
858b7e04718c This patch moves the directory creation code to a separate function. I have
ivo
parents: 13252
diff changeset
100 *
858b7e04718c This patch moves the directory creation code to a separate function. I have
ivo
parents: 13252
diff changeset
101 * \param buf Pointer to directory name.
858b7e04718c This patch moves the directory creation code to a separate function. I have
ivo
parents: 13252
diff changeset
102 * \param verbose Verbose on success. If verbose is non-zero, it will print
858b7e04718c This patch moves the directory creation code to a separate function. I have
ivo
parents: 13252
diff changeset
103 * a message if it was successful in creating the directory.
858b7e04718c This patch moves the directory creation code to a separate function. I have
ivo
parents: 13252
diff changeset
104 *
858b7e04718c This patch moves the directory creation code to a separate function. I have
ivo
parents: 13252
diff changeset
105 * \return nothing In case anything fails, the player will exit. If it
858b7e04718c This patch moves the directory creation code to a separate function. I have
ivo
parents: 13252
diff changeset
106 * returns, everything went well.
858b7e04718c This patch moves the directory creation code to a separate function. I have
ivo
parents: 13252
diff changeset
107 */
858b7e04718c This patch moves the directory creation code to a separate function. I have
ivo
parents: 13252
diff changeset
108
33711
bdddbf265c6e Use "const char *" type for paths.
reimar
parents: 33305
diff changeset
109 static void jpeg_mkdir(const char *buf, int verbose) {
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
110 struct stat stat_p;
13158
b872a27aea9e Added output to multiple directories for vo_jpeg.
ivo
parents: 12857
diff changeset
111
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28922
diff changeset
112 #ifndef __MINGW32__
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
113 if ( mkdir(buf, 0755) < 0 ) {
13347
0b4f2d91b27c mingw compile fix
faust3
parents: 13322
diff changeset
114 #else
0b4f2d91b27c mingw compile fix
faust3
parents: 13322
diff changeset
115 if ( mkdir(buf) < 0 ) {
0b4f2d91b27c mingw compile fix
faust3
parents: 13322
diff changeset
116 #endif
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
117 switch (errno) { /* use switch in case other errors need to be caught
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
118 and handled in the future */
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
119 case EEXIST:
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
120 if ( stat(buf, &stat_p ) < 0 ) {
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
121 mp_msg(MSGT_VO, MSGL_ERR, "%s: %s: %s\n", info.short_name,
13284
6370626e902b Renamed some MSGTR_VO_JPEG_* messages to MSGTR_VO_* messages, so they can
ivo
parents: 13283
diff changeset
122 MSGTR_VO_GenericError, strerror(errno) );
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
123 mp_msg(MSGT_VO, MSGL_ERR, "%s: %s %s\n", info.short_name,
13284
6370626e902b Renamed some MSGTR_VO_JPEG_* messages to MSGTR_VO_* messages, so they can
ivo
parents: 13283
diff changeset
124 MSGTR_VO_UnableToAccess,buf);
30516
f4e017b6921a Fix exit_player() usage throughout the codebase.
diego
parents: 30123
diff changeset
125 exit_player(EXIT_ERROR);
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
126 }
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
127 if ( !S_ISDIR(stat_p.st_mode) ) {
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
128 mp_msg(MSGT_VO, MSGL_ERR, "%s: %s %s\n", info.short_name,
13284
6370626e902b Renamed some MSGTR_VO_JPEG_* messages to MSGTR_VO_* messages, so they can
ivo
parents: 13283
diff changeset
129 buf, MSGTR_VO_ExistsButNoDirectory);
30516
f4e017b6921a Fix exit_player() usage throughout the codebase.
diego
parents: 30123
diff changeset
130 exit_player(EXIT_ERROR);
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
131 }
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
132 if ( !(stat_p.st_mode & S_IWUSR) ) {
13283
858b7e04718c This patch moves the directory creation code to a separate function. I have
ivo
parents: 13252
diff changeset
133 mp_msg(MSGT_VO, MSGL_ERR, "%s: %s - %s\n", info.short_name,
13284
6370626e902b Renamed some MSGTR_VO_JPEG_* messages to MSGTR_VO_* messages, so they can
ivo
parents: 13283
diff changeset
134 buf, MSGTR_VO_DirExistsButNotWritable);
30516
f4e017b6921a Fix exit_player() usage throughout the codebase.
diego
parents: 30123
diff changeset
135 exit_player(EXIT_ERROR);
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
136 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28922
diff changeset
137
36374
cd83754e4f3a vo jpeg, png, pnm: Make output directory message less confusing
al
parents: 33711
diff changeset
138 mp_msg(MSGT_VO, MSGL_INFO, "%s: %s: %s\n", info.short_name, MSGTR_VO_OutputDirectory, buf);
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
139 break;
13158
b872a27aea9e Added output to multiple directories for vo_jpeg.
ivo
parents: 12857
diff changeset
140
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
141 default:
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
142 mp_msg(MSGT_VO, MSGL_ERR, "%s: %s: %s\n", info.short_name,
13284
6370626e902b Renamed some MSGTR_VO_JPEG_* messages to MSGTR_VO_* messages, so they can
ivo
parents: 13283
diff changeset
143 MSGTR_VO_GenericError, strerror(errno) );
13283
858b7e04718c This patch moves the directory creation code to a separate function. I have
ivo
parents: 13252
diff changeset
144 mp_msg(MSGT_VO, MSGL_ERR, "%s: %s - %s\n", info.short_name,
13284
6370626e902b Renamed some MSGTR_VO_JPEG_* messages to MSGTR_VO_* messages, so they can
ivo
parents: 13283
diff changeset
145 buf, MSGTR_VO_CantCreateDirectory);
30516
f4e017b6921a Fix exit_player() usage throughout the codebase.
diego
parents: 30123
diff changeset
146 exit_player(EXIT_ERROR);
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
147 } /* end switch */
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28922
diff changeset
148 } else if ( verbose ) {
13283
858b7e04718c This patch moves the directory creation code to a separate function. I have
ivo
parents: 13252
diff changeset
149 mp_msg(MSGT_VO, MSGL_INFO, "%s: %s - %s\n", info.short_name,
13284
6370626e902b Renamed some MSGTR_VO_JPEG_* messages to MSGTR_VO_* messages, so they can
ivo
parents: 13283
diff changeset
150 buf, MSGTR_VO_DirectoryCreateSuccess);
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
151 } /* end if */
13283
858b7e04718c This patch moves the directory creation code to a separate function. I have
ivo
parents: 13252
diff changeset
152 }
858b7e04718c This patch moves the directory creation code to a separate function. I have
ivo
parents: 13252
diff changeset
153
858b7e04718c This patch moves the directory creation code to a separate function. I have
ivo
parents: 13252
diff changeset
154 /* ------------------------------------------------------------------------- */
858b7e04718c This patch moves the directory creation code to a separate function. I have
ivo
parents: 13252
diff changeset
155
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
156 static int config(uint32_t width, uint32_t height, uint32_t d_width,
15212
05aa13cdf92f replace VO and VF numeric flags with #defined identifiers
henry
parents: 14850
diff changeset
157 uint32_t d_height, uint32_t flags, char *title,
13283
858b7e04718c This patch moves the directory creation code to a separate function. I have
ivo
parents: 13252
diff changeset
158 uint32_t format)
858b7e04718c This patch moves the directory creation code to a separate function. I have
ivo
parents: 13252
diff changeset
159 {
858b7e04718c This patch moves the directory creation code to a separate function. I have
ivo
parents: 13252
diff changeset
160 char buf[BUFLENGTH];
858b7e04718c This patch moves the directory creation code to a separate function. I have
ivo
parents: 13252
diff changeset
161
858b7e04718c This patch moves the directory creation code to a separate function. I have
ivo
parents: 13252
diff changeset
162 /* Create outdir. */
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28922
diff changeset
163
13283
858b7e04718c This patch moves the directory creation code to a separate function. I have
ivo
parents: 13252
diff changeset
164 snprintf(buf, BUFLENGTH, "%s", jpeg_outdir);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28922
diff changeset
165
13283
858b7e04718c This patch moves the directory creation code to a separate function. I have
ivo
parents: 13252
diff changeset
166 jpeg_mkdir(buf, 1); /* This function only returns if creation was
858b7e04718c This patch moves the directory creation code to a separate function. I have
ivo
parents: 13252
diff changeset
167 successful. If not, the player will exit. */
13158
b872a27aea9e Added output to multiple directories for vo_jpeg.
ivo
parents: 12857
diff changeset
168
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
169 image_height = height;
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
170 image_width = width;
17436
2ab8452b8ce4 Added DPI (Print-Resolution) and Pixel-Aspect awareness to vo_jpeg.
atmos4
parents: 16171
diff changeset
171 /* Save for JFIF-Header PAR */
2ab8452b8ce4 Added DPI (Print-Resolution) and Pixel-Aspect awareness to vo_jpeg.
atmos4
parents: 16171
diff changeset
172 image_d_width = d_width;
2ab8452b8ce4 Added DPI (Print-Resolution) and Pixel-Aspect awareness to vo_jpeg.
atmos4
parents: 16171
diff changeset
173 image_d_height = d_height;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28922
diff changeset
174
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
175 return 0;
5648
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
176 }
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
177
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
178 /* ------------------------------------------------------------------------- */
5648
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
179
33711
bdddbf265c6e Use "const char *" type for paths.
reimar
parents: 33305
diff changeset
180 static uint32_t jpeg_write(const char * name, uint8_t * buffer)
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
181 {
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
182 FILE *outfile;
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
183 struct jpeg_compress_struct cinfo;
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
184 struct jpeg_error_mgr jerr;
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
185 JSAMPROW row_pointer[1];
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
186 int row_stride;
5648
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
187
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28922
diff changeset
188 if ( !buffer ) return 1;
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
189 if ( (outfile = fopen(name, "wb") ) == NULL ) {
13252
7dfd84faaa09 Some minor vo_jpeg fixes:
ivo
parents: 13247
diff changeset
190 mp_msg(MSGT_VO, MSGL_ERR, "\n%s: %s\n", info.short_name,
13284
6370626e902b Renamed some MSGTR_VO_JPEG_* messages to MSGTR_VO_* messages, so they can
ivo
parents: 13283
diff changeset
191 MSGTR_VO_CantCreateFile);
13252
7dfd84faaa09 Some minor vo_jpeg fixes:
ivo
parents: 13247
diff changeset
192 mp_msg(MSGT_VO, MSGL_ERR, "%s: %s: %s\n",
13284
6370626e902b Renamed some MSGTR_VO_JPEG_* messages to MSGTR_VO_* messages, so they can
ivo
parents: 13283
diff changeset
193 info.short_name, MSGTR_VO_GenericError,
13252
7dfd84faaa09 Some minor vo_jpeg fixes:
ivo
parents: 13247
diff changeset
194 strerror(errno) );
30516
f4e017b6921a Fix exit_player() usage throughout the codebase.
diego
parents: 30123
diff changeset
195 exit_player(EXIT_ERROR);
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
196 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28922
diff changeset
197
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
198 cinfo.err = jpeg_std_error(&jerr);
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
199 jpeg_create_compress(&cinfo);
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
200 jpeg_stdio_dest(&cinfo, outfile);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28922
diff changeset
201
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
202 cinfo.image_width = image_width;
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
203 cinfo.image_height = image_height;
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
204 cinfo.input_components = 3;
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
205 cinfo.in_color_space = JCS_RGB;
17436
2ab8452b8ce4 Added DPI (Print-Resolution) and Pixel-Aspect awareness to vo_jpeg.
atmos4
parents: 16171
diff changeset
206
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
207 jpeg_set_defaults(&cinfo);
17436
2ab8452b8ce4 Added DPI (Print-Resolution) and Pixel-Aspect awareness to vo_jpeg.
atmos4
parents: 16171
diff changeset
208 /* Important: Header info must be set AFTER jpeg_set_defaults() */
2ab8452b8ce4 Added DPI (Print-Resolution) and Pixel-Aspect awareness to vo_jpeg.
atmos4
parents: 16171
diff changeset
209 cinfo.write_JFIF_header = TRUE;
2ab8452b8ce4 Added DPI (Print-Resolution) and Pixel-Aspect awareness to vo_jpeg.
atmos4
parents: 16171
diff changeset
210 cinfo.JFIF_major_version = 1;
2ab8452b8ce4 Added DPI (Print-Resolution) and Pixel-Aspect awareness to vo_jpeg.
atmos4
parents: 16171
diff changeset
211 cinfo.JFIF_minor_version = 2;
2ab8452b8ce4 Added DPI (Print-Resolution) and Pixel-Aspect awareness to vo_jpeg.
atmos4
parents: 16171
diff changeset
212 cinfo.density_unit = 1; /* 0=unknown, 1=dpi, 2=dpcm */
2ab8452b8ce4 Added DPI (Print-Resolution) and Pixel-Aspect awareness to vo_jpeg.
atmos4
parents: 16171
diff changeset
213 /* Image DPI is determined by Y_density, so we leave that at
2ab8452b8ce4 Added DPI (Print-Resolution) and Pixel-Aspect awareness to vo_jpeg.
atmos4
parents: 16171
diff changeset
214 jpeg_dpi if possible and crunch X_density instead (PAR > 1) */
2ab8452b8ce4 Added DPI (Print-Resolution) and Pixel-Aspect awareness to vo_jpeg.
atmos4
parents: 16171
diff changeset
215 cinfo.X_density = jpeg_dpi*image_width/image_d_width;
2ab8452b8ce4 Added DPI (Print-Resolution) and Pixel-Aspect awareness to vo_jpeg.
atmos4
parents: 16171
diff changeset
216 cinfo.Y_density = jpeg_dpi*image_height/image_d_height;
2ab8452b8ce4 Added DPI (Print-Resolution) and Pixel-Aspect awareness to vo_jpeg.
atmos4
parents: 16171
diff changeset
217 cinfo.write_Adobe_marker = TRUE;
2ab8452b8ce4 Added DPI (Print-Resolution) and Pixel-Aspect awareness to vo_jpeg.
atmos4
parents: 16171
diff changeset
218
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
219 jpeg_set_quality(&cinfo,jpeg_quality, jpeg_baseline);
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
220 cinfo.optimize_coding = jpeg_optimize;
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
221 cinfo.smoothing_factor = jpeg_smooth;
5648
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
222
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
223 if ( jpeg_progressive_mode ) {
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
224 jpeg_simple_progression(&cinfo);
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
225 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28922
diff changeset
226
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
227 jpeg_start_compress(&cinfo, TRUE);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28922
diff changeset
228
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
229 row_stride = image_width * 3;
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
230 while (cinfo.next_scanline < cinfo.image_height) {
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
231 row_pointer[0] = &buffer[cinfo.next_scanline * row_stride];
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
232 (void)jpeg_write_scanlines(&cinfo, row_pointer,1);
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
233 }
5648
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
234
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
235 jpeg_finish_compress(&cinfo);
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
236 fclose(outfile);
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
237 jpeg_destroy_compress(&cinfo);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28922
diff changeset
238
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
239 return 0;
5648
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
240 }
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
241
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
242 /* ------------------------------------------------------------------------- */
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
243
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
244 static int draw_frame(uint8_t *src[])
5648
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
245 {
14850
ba555409718b Fix compile warnings
ivo
parents: 14847
diff changeset
246 static int framecounter = 0, subdircounter = 0;
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
247 char buf[BUFLENGTH];
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
248 static char subdirname[BUFLENGTH] = "";
13158
b872a27aea9e Added output to multiple directories for vo_jpeg.
ivo
parents: 12857
diff changeset
249
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
250 /* Start writing to new subdirectory after a certain amount of frames */
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
251 if ( framecounter == jpeg_maxfiles ) {
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
252 framecounter = 0;
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
253 }
13158
b872a27aea9e Added output to multiple directories for vo_jpeg.
ivo
parents: 12857
diff changeset
254
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
255 /* If framecounter is zero (or reset to zero), increment subdirectory
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
256 * number and create the subdirectory.
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
257 * If jpeg_subdirs is not set, do nothing and resort to old behaviour. */
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
258 if ( !framecounter && jpeg_subdirs ) {
13300
47dd02fb02df Removed unused variable (leftover of having two instances of directory creation
ivo
parents: 13284
diff changeset
259 subdircounter++;
47dd02fb02df Removed unused variable (leftover of having two instances of directory creation
ivo
parents: 13284
diff changeset
260 snprintf(subdirname, BUFLENGTH, "%s%08d", jpeg_subdirs, subdircounter);
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
261 snprintf(buf, BUFLENGTH, "%s/%s", jpeg_outdir, subdirname);
13283
858b7e04718c This patch moves the directory creation code to a separate function. I have
ivo
parents: 13252
diff changeset
262 jpeg_mkdir(buf, 0); /* This function only returns if creation was
858b7e04718c This patch moves the directory creation code to a separate function. I have
ivo
parents: 13252
diff changeset
263 successful. If not, the player will exit. */
858b7e04718c This patch moves the directory creation code to a separate function. I have
ivo
parents: 13252
diff changeset
264 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28922
diff changeset
265
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
266 framenum++;
13158
b872a27aea9e Added output to multiple directories for vo_jpeg.
ivo
parents: 12857
diff changeset
267
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
268 /* snprintf the full pathname of the outputfile */
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
269 snprintf(buf, BUFLENGTH, "%s/%s/%08d.jpg", jpeg_outdir, subdirname,
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
270 framenum);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28922
diff changeset
271
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
272 framecounter++;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28922
diff changeset
273
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
274 return jpeg_write(buf, src[0]);
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
275 }
13158
b872a27aea9e Added output to multiple directories for vo_jpeg.
ivo
parents: 12857
diff changeset
276
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
277 /* ------------------------------------------------------------------------- */
5648
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
278
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
279 static void draw_osd(void)
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
280 {
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
281 }
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
282
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
283 /* ------------------------------------------------------------------------- */
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
284
5648
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
285 static void flip_page (void)
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
286 {
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
287 }
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
288
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
289 /* ------------------------------------------------------------------------- */
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
290
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
291 static int query_format(uint32_t format)
5648
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
292 {
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
293 if (format == IMGFMT_RGB24) {
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
294 return VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW;
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
295 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28922
diff changeset
296
9989
98791b90215a Spring cleanup: supporting only RGB24 as input (native jpeg lib supports only that, maybe we could later add nativ YCbCr (YUV) support, but not swscale ones)
alex
parents: 9019
diff changeset
297 return 0;
5648
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
298 }
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
299
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
300 /* ------------------------------------------------------------------------- */
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
301
5648
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
302 static void uninit(void)
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
303 {
32537
8fa2f43cb760 Remove most of the NULL pointer check before free all over the code
cboesch
parents: 31287
diff changeset
304 free(jpeg_subdirs);
8fa2f43cb760 Remove most of the NULL pointer check before free all over the code
cboesch
parents: 31287
diff changeset
305 jpeg_subdirs = NULL;
8fa2f43cb760 Remove most of the NULL pointer check before free all over the code
cboesch
parents: 31287
diff changeset
306 free(jpeg_outdir);
8fa2f43cb760 Remove most of the NULL pointer check before free all over the code
cboesch
parents: 31287
diff changeset
307 jpeg_outdir = NULL;
5648
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
308 }
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
309
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
310 /* ------------------------------------------------------------------------- */
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
311
5648
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
312 static void check_events(void)
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
313 {
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
314 }
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
315
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
316 /* ------------------------------------------------------------------------- */
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
317
14508
3673ad04ebfb Replaced suboption parser by call to suboption helper.
ivo
parents: 13347
diff changeset
318 /** \brief Validation function for values [0-100]
13316
0d17bef9894d * Changed malloc and strncpy to strdup. Less code.
ivo
parents: 13300
diff changeset
319 */
0d17bef9894d * Changed malloc and strncpy to strdup. Less code.
ivo
parents: 13300
diff changeset
320
30122
1772a5171ac7 Fix function declarations to avoid casting function pointers.
reimar
parents: 29263
diff changeset
321 static int int_zero_hundred(void *valp)
14508
3673ad04ebfb Replaced suboption parser by call to suboption helper.
ivo
parents: 13347
diff changeset
322 {
30122
1772a5171ac7 Fix function declarations to avoid casting function pointers.
reimar
parents: 29263
diff changeset
323 int *val = valp;
30123
0f5f75b4a015 Simplify range-checking functions for subopt parsing.
reimar
parents: 30122
diff changeset
324 return *val >= 0 && *val <= 100;
13316
0d17bef9894d * Changed malloc and strncpy to strdup. Less code.
ivo
parents: 13300
diff changeset
325 }
0d17bef9894d * Changed malloc and strncpy to strdup. Less code.
ivo
parents: 13300
diff changeset
326
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
327 static int preinit(const char *arg)
5648
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
328 {
28828
56eee6ffba9b Make data related to suboption parsing const in libvo
reimar
parents: 26739
diff changeset
329 const opt_t subopts[] = {
28922
9dd905e52639 Remove obsolete extra elements from opt_t struct initialization.
diego
parents: 28828
diff changeset
330 {"progressive", OPT_ARG_BOOL, &jpeg_progressive_mode, NULL},
9dd905e52639 Remove obsolete extra elements from opt_t struct initialization.
diego
parents: 28828
diff changeset
331 {"baseline", OPT_ARG_BOOL, &jpeg_baseline, NULL},
14508
3673ad04ebfb Replaced suboption parser by call to suboption helper.
ivo
parents: 13347
diff changeset
332 {"optimize", OPT_ARG_INT, &jpeg_optimize,
30122
1772a5171ac7 Fix function declarations to avoid casting function pointers.
reimar
parents: 29263
diff changeset
333 int_zero_hundred},
14508
3673ad04ebfb Replaced suboption parser by call to suboption helper.
ivo
parents: 13347
diff changeset
334 {"smooth", OPT_ARG_INT, &jpeg_smooth,
30122
1772a5171ac7 Fix function declarations to avoid casting function pointers.
reimar
parents: 29263
diff changeset
335 int_zero_hundred},
14508
3673ad04ebfb Replaced suboption parser by call to suboption helper.
ivo
parents: 13347
diff changeset
336 {"quality", OPT_ARG_INT, &jpeg_quality,
30122
1772a5171ac7 Fix function declarations to avoid casting function pointers.
reimar
parents: 29263
diff changeset
337 int_zero_hundred},
28922
9dd905e52639 Remove obsolete extra elements from opt_t struct initialization.
diego
parents: 28828
diff changeset
338 {"dpi", OPT_ARG_INT, &jpeg_dpi, NULL},
9dd905e52639 Remove obsolete extra elements from opt_t struct initialization.
diego
parents: 28828
diff changeset
339 {"outdir", OPT_ARG_MSTRZ, &jpeg_outdir, NULL},
9dd905e52639 Remove obsolete extra elements from opt_t struct initialization.
diego
parents: 28828
diff changeset
340 {"subdirs", OPT_ARG_MSTRZ, &jpeg_subdirs, NULL},
30122
1772a5171ac7 Fix function declarations to avoid casting function pointers.
reimar
parents: 29263
diff changeset
341 {"maxfiles", OPT_ARG_INT, &jpeg_maxfiles, int_pos},
28922
9dd905e52639 Remove obsolete extra elements from opt_t struct initialization.
diego
parents: 28828
diff changeset
342 {NULL, 0, NULL, NULL}
14508
3673ad04ebfb Replaced suboption parser by call to suboption helper.
ivo
parents: 13347
diff changeset
343 };
3673ad04ebfb Replaced suboption parser by call to suboption helper.
ivo
parents: 13347
diff changeset
344 const char *info_message = NULL;
13247
933b45ad31d5 Removal of -jpeg commandline option.
ivo
parents: 13217
diff changeset
345
31287
168e89b341b1 Reduce verbosity about suboption parsing in vo drivers.
diego
parents: 30633
diff changeset
346 mp_msg(MSGT_VO, MSGL_V, "%s: %s\n", info.short_name,
168e89b341b1 Reduce verbosity about suboption parsing in vo drivers.
diego
parents: 30633
diff changeset
347 "Parsing suboptions.");
14508
3673ad04ebfb Replaced suboption parser by call to suboption helper.
ivo
parents: 13347
diff changeset
348
3673ad04ebfb Replaced suboption parser by call to suboption helper.
ivo
parents: 13347
diff changeset
349 jpeg_progressive_mode = 0;
3673ad04ebfb Replaced suboption parser by call to suboption helper.
ivo
parents: 13347
diff changeset
350 jpeg_baseline = 1;
3673ad04ebfb Replaced suboption parser by call to suboption helper.
ivo
parents: 13347
diff changeset
351 jpeg_optimize = 100;
3673ad04ebfb Replaced suboption parser by call to suboption helper.
ivo
parents: 13347
diff changeset
352 jpeg_smooth = 0;
3673ad04ebfb Replaced suboption parser by call to suboption helper.
ivo
parents: 13347
diff changeset
353 jpeg_quality = 75;
3673ad04ebfb Replaced suboption parser by call to suboption helper.
ivo
parents: 13347
diff changeset
354 jpeg_maxfiles = 1000;
14538
00c3c4111017 New suboption type: malloc'ed, zero terminated string
reimar
parents: 14508
diff changeset
355 jpeg_outdir = strdup(".");
00c3c4111017 New suboption type: malloc'ed, zero terminated string
reimar
parents: 14508
diff changeset
356 jpeg_subdirs = NULL;
14508
3673ad04ebfb Replaced suboption parser by call to suboption helper.
ivo
parents: 13347
diff changeset
357
3673ad04ebfb Replaced suboption parser by call to suboption helper.
ivo
parents: 13347
diff changeset
358 if (subopt_parse(arg, subopts) != 0) {
3673ad04ebfb Replaced suboption parser by call to suboption helper.
ivo
parents: 13347
diff changeset
359 return -1;
3673ad04ebfb Replaced suboption parser by call to suboption helper.
ivo
parents: 13347
diff changeset
360 }
3673ad04ebfb Replaced suboption parser by call to suboption helper.
ivo
parents: 13347
diff changeset
361
3673ad04ebfb Replaced suboption parser by call to suboption helper.
ivo
parents: 13347
diff changeset
362 if (jpeg_progressive_mode) info_message = MSGTR_VO_JPEG_ProgressiveJPEG;
3673ad04ebfb Replaced suboption parser by call to suboption helper.
ivo
parents: 13347
diff changeset
363 else info_message = MSGTR_VO_JPEG_NoProgressiveJPEG;
3673ad04ebfb Replaced suboption parser by call to suboption helper.
ivo
parents: 13347
diff changeset
364 mp_msg(MSGT_VO, MSGL_INFO, "%s: %s\n", info.short_name, info_message);
3673ad04ebfb Replaced suboption parser by call to suboption helper.
ivo
parents: 13347
diff changeset
365
3673ad04ebfb Replaced suboption parser by call to suboption helper.
ivo
parents: 13347
diff changeset
366 if (jpeg_baseline) info_message = MSGTR_VO_JPEG_BaselineJPEG;
3673ad04ebfb Replaced suboption parser by call to suboption helper.
ivo
parents: 13347
diff changeset
367 else info_message = MSGTR_VO_JPEG_NoBaselineJPEG;
3673ad04ebfb Replaced suboption parser by call to suboption helper.
ivo
parents: 13347
diff changeset
368 mp_msg(MSGT_VO, MSGL_INFO, "%s: %s\n", info.short_name, info_message);
3673ad04ebfb Replaced suboption parser by call to suboption helper.
ivo
parents: 13347
diff changeset
369
3673ad04ebfb Replaced suboption parser by call to suboption helper.
ivo
parents: 13347
diff changeset
370 mp_msg(MSGT_VO, MSGL_V, "%s: optimize --> %d\n", info.short_name,
3673ad04ebfb Replaced suboption parser by call to suboption helper.
ivo
parents: 13347
diff changeset
371 jpeg_optimize);
3673ad04ebfb Replaced suboption parser by call to suboption helper.
ivo
parents: 13347
diff changeset
372 mp_msg(MSGT_VO, MSGL_V, "%s: smooth --> %d\n", info.short_name,
3673ad04ebfb Replaced suboption parser by call to suboption helper.
ivo
parents: 13347
diff changeset
373 jpeg_smooth);
3673ad04ebfb Replaced suboption parser by call to suboption helper.
ivo
parents: 13347
diff changeset
374 mp_msg(MSGT_VO, MSGL_V, "%s: quality --> %d\n", info.short_name,
3673ad04ebfb Replaced suboption parser by call to suboption helper.
ivo
parents: 13347
diff changeset
375 jpeg_quality);
17436
2ab8452b8ce4 Added DPI (Print-Resolution) and Pixel-Aspect awareness to vo_jpeg.
atmos4
parents: 16171
diff changeset
376 mp_msg(MSGT_VO, MSGL_V, "%s: dpi --> %d\n", info.short_name,
2ab8452b8ce4 Added DPI (Print-Resolution) and Pixel-Aspect awareness to vo_jpeg.
atmos4
parents: 16171
diff changeset
377 jpeg_dpi);
14508
3673ad04ebfb Replaced suboption parser by call to suboption helper.
ivo
parents: 13347
diff changeset
378 mp_msg(MSGT_VO, MSGL_V, "%s: outdir --> %s\n", info.short_name,
3673ad04ebfb Replaced suboption parser by call to suboption helper.
ivo
parents: 13347
diff changeset
379 jpeg_outdir);
3673ad04ebfb Replaced suboption parser by call to suboption helper.
ivo
parents: 13347
diff changeset
380 if (jpeg_subdirs) {
3673ad04ebfb Replaced suboption parser by call to suboption helper.
ivo
parents: 13347
diff changeset
381 mp_msg(MSGT_VO, MSGL_V, "%s: subdirs --> %s\n", info.short_name,
3673ad04ebfb Replaced suboption parser by call to suboption helper.
ivo
parents: 13347
diff changeset
382 jpeg_subdirs);
3673ad04ebfb Replaced suboption parser by call to suboption helper.
ivo
parents: 13347
diff changeset
383 mp_msg(MSGT_VO, MSGL_V, "%s: maxfiles --> %d\n", info.short_name,
3673ad04ebfb Replaced suboption parser by call to suboption helper.
ivo
parents: 13347
diff changeset
384 jpeg_maxfiles);
13316
0d17bef9894d * Changed malloc and strncpy to strdup. Less code.
ivo
parents: 13300
diff changeset
385 }
0d17bef9894d * Changed malloc and strncpy to strdup. Less code.
ivo
parents: 13300
diff changeset
386
31287
168e89b341b1 Reduce verbosity about suboption parsing in vo drivers.
diego
parents: 30633
diff changeset
387 mp_msg(MSGT_VO, MSGL_V, "%s: %s\n", info.short_name,
168e89b341b1 Reduce verbosity about suboption parsing in vo drivers.
diego
parents: 30633
diff changeset
388 "Suboptions parsed OK.");
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
389 return 0;
5648
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
390 }
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
391
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
392 /* ------------------------------------------------------------------------- */
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
393
33305
ddb45e9443ec Remove the variable arguments from the libvo control() functions.
iive
parents: 32537
diff changeset
394 static int control(uint32_t request, void *data)
5648
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
395 {
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
396 switch (request) {
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
397 case VOCTRL_QUERY_FORMAT:
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
398 return query_format(*((uint32_t*)data));
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
399 }
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
400 return VO_NOTIMPL;
5648
c3ca8f05b3a9 add jpeg support for libvo
pontscho
parents:
diff changeset
401 }
13158
b872a27aea9e Added output to multiple directories for vo_jpeg.
ivo
parents: 12857
diff changeset
402
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
403 /* ------------------------------------------------------------------------- */
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
404
13158
b872a27aea9e Added output to multiple directories for vo_jpeg.
ivo
parents: 12857
diff changeset
405 #undef BUFLENGTH
b872a27aea9e Added output to multiple directories for vo_jpeg.
ivo
parents: 12857
diff changeset
406
13217
43fe55f36522 One-time cosmetics update.
ivo
parents: 13158
diff changeset
407 /* ------------------------------------------------------------------------- */