annotate libvo/vo_pnm.c @ 36920:40ad45360c8a

Replace old item 'potmeter' by new item 'pimage'. Recent versions of the X11/GTK GUI didn't allow to control a potmeter, because that didn't seem to make any sense. In order to get rid of the confusing potmeter that doesn't distinguish from a hpotmeter and in order to allow the more useful behaviour recent versions of the X11/GTK GUI have been utilized (and because we're still supporting item 'potmeter' for reasons of compatibility with old skins), introduce new item 'pimage' that reuses most of the current potmeter code. Additionally, remove remaining code and documentation of 'potmeter'.
author ib
date Mon, 17 Mar 2014 12:29:46 +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 * PPM/PGM/PGMYUV video output driver
13394
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
3 *
27507
25b896bc75f3 license header cosmetics
diego
parents: 26739
diff changeset
4 * copyright (C) 2004, 2005 Ivo van Poorten
25173
3e7c196c27d3 Proper license header.
ivo
parents: 25172
diff changeset
5 *
26739
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
6 * This file is part of MPlayer.
25173
3e7c196c27d3 Proper license header.
ivo
parents: 25172
diff changeset
7 *
26739
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
8 * MPlayer is free software; you can redistribute it and/or modify
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
9 * 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
10 * the Free Software Foundation; either version 2 of the License, or
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
11 * (at your option) any later version.
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
12 *
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
13 * MPlayer is distributed in the hope that it will be useful,
25173
3e7c196c27d3 Proper license header.
ivo
parents: 25172
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
3e7c196c27d3 Proper license header.
ivo
parents: 25172
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3e7c196c27d3 Proper license header.
ivo
parents: 25172
diff changeset
16 * GNU General Public License for more details.
3e7c196c27d3 Proper license header.
ivo
parents: 25172
diff changeset
17 *
26739
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
18 * 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
19 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
13394
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
21 */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
22
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
23 /* ------------------------------------------------------------------------- */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
24
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
25 /* Global Includes */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
26
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
27 #include <stdio.h>
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
28 #include <stdlib.h>
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
29 #include <string.h>
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
30 #include <errno.h>
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
31 #include <sys/stat.h>
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
32
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
33 /* ------------------------------------------------------------------------- */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
34
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
35 /* Local Includes */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
36
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
37 #include "config.h"
14504
e394a9cfaf3f Transition of suboption parser to subopt-helper parser.
ivo
parents: 13394
diff changeset
38 #include "subopt-helper.h"
13394
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
39 #include "mp_msg.h"
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
40 #include "video_out.h"
36517
5d3f93051de9 Remove empty draw_slice and draw_frame stubs.
reimar
parents: 36375
diff changeset
41 #define NO_DRAW_FRAME
5d3f93051de9 Remove empty draw_slice and draw_frame stubs.
reimar
parents: 36375
diff changeset
42 #define NO_DRAW_SLICE
13394
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
43 #include "video_out_internal.h"
30516
f4e017b6921a Fix exit_player() usage throughout the codebase.
diego
parents: 30122
diff changeset
44 #include "mp_core.h" /* for exit_player() */
13394
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
45 #include "help_mp.h"
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
46
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
47 /* ------------------------------------------------------------------------- */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
48
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
49 /* Defines */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
50
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
51 /* Used for temporary buffers to store file- and pathnames */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
52 #define BUFLENGTH 512
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
53
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
54 #define PNM_ASCII_MODE 0
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
55 #define PNM_RAW_MODE 1
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
56 #define PNM_TYPE_PPM 0
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
57 #define PNM_TYPE_PGM 1
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
58 #define PNM_TYPE_PGMYUV 2
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
59
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
60 #define PNM_LINE_OF_ASCII "%03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d\n"
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
61 #define PNM_LINE15(a,b) a[b], a[b+1], a[b+2], a[b+3], a[b+4], a[b+5], a[b+6], \
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
62 a[b+7], a[b+8], a[b+9], a[b+10], a[b+11], a[b+12], \
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
63 a[b+13], a[b+14]
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
64
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
65 /* ------------------------------------------------------------------------- */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
66
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
67 /* Info */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
68
25216
3aee342be929 Make vo info structs const
reimar
parents: 25173
diff changeset
69 static const vo_info_t info=
13394
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
70 {
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
71 "PPM/PGM/PGMYUV file",
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
72 "pnm",
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
73 "Ivo van Poorten (ivop@euronet.nl)",
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
74 ""
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
75 };
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
76
25220
c9e9ac2008c2 Mark the vo_functions_t definitions as const where possible.
reimar
parents: 25216
diff changeset
77 const LIBVO_EXTERN (pnm)
13394
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
78
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
79 /* ------------------------------------------------------------------------- */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
80
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
81 /* Global Variables */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
82
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
83 int pnm_type = PNM_TYPE_PPM;
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
84 int pnm_mode = PNM_RAW_MODE;
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
85
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
86 char *pnm_outdir = NULL;
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
87 char *pnm_subdirs = NULL;
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
88 int pnm_maxfiles = 1000;
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
89 char *pnm_file_extension = NULL;
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
90
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
91 /* ------------------------------------------------------------------------- */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
92
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
93 /** \brief An error occured while writing to a file.
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
94 *
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
95 * The program failed to write data to a file.
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
96 * It displays a message and exits the player.
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
97 *
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
98 * \return nothing It does not return.
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
99 */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
100
18950
a943bc3f26c8 Make some functions static.
uau
parents: 16171
diff changeset
101 static void pnm_write_error(void) {
13394
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
102 mp_msg(MSGT_VO, MSGL_ERR, MSGTR_ErrorWritingFile, info.short_name);
30516
f4e017b6921a Fix exit_player() usage throughout the codebase.
diego
parents: 30122
diff changeset
103 exit_player(EXIT_ERROR);
13394
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
104 }
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
105
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
106 /* ------------------------------------------------------------------------- */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
107
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
108 /** \brief Pre-initialisation.
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
109 *
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
110 * This function is called before initialising the video output driver. It
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
111 * parses all suboptions and sets variables accordingly. If an error occurs
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
112 * (like an option being out of range, not having any value or an unknown
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
113 * option is stumbled upon) the player will exit.
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
114 *
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
115 * \param arg A string containing all the suboptions passed to the video
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
116 * output driver.
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
117 *
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
118 * \return 0 All went well.
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
119 */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
120
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
121 static int preinit(const char *arg)
13394
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
122 {
14504
e394a9cfaf3f Transition of suboption parser to subopt-helper parser.
ivo
parents: 13394
diff changeset
123 int ppm_type = 0, pgm_type = 0, pgmyuv_type = 0,
14506
f5ef32b4bdd3 1l. parser can work with pnm_maxfiles directly
ivo
parents: 14504
diff changeset
124 raw_mode = 0, ascii_mode = 0;
28828
56eee6ffba9b Make data related to suboption parsing const in libvo
reimar
parents: 27507
diff changeset
125 const opt_t subopts[] = {
28922
9dd905e52639 Remove obsolete extra elements from opt_t struct initialization.
diego
parents: 28828
diff changeset
126 {"ppm", OPT_ARG_BOOL, &ppm_type, NULL},
9dd905e52639 Remove obsolete extra elements from opt_t struct initialization.
diego
parents: 28828
diff changeset
127 {"pgm", OPT_ARG_BOOL, &pgm_type, NULL},
9dd905e52639 Remove obsolete extra elements from opt_t struct initialization.
diego
parents: 28828
diff changeset
128 {"pgmyuv", OPT_ARG_BOOL, &pgmyuv_type, NULL},
9dd905e52639 Remove obsolete extra elements from opt_t struct initialization.
diego
parents: 28828
diff changeset
129 {"raw", OPT_ARG_BOOL, &raw_mode, NULL},
9dd905e52639 Remove obsolete extra elements from opt_t struct initialization.
diego
parents: 28828
diff changeset
130 {"ascii", OPT_ARG_BOOL, &ascii_mode, NULL},
9dd905e52639 Remove obsolete extra elements from opt_t struct initialization.
diego
parents: 28828
diff changeset
131 {"outdir", OPT_ARG_MSTRZ, &pnm_outdir, NULL},
9dd905e52639 Remove obsolete extra elements from opt_t struct initialization.
diego
parents: 28828
diff changeset
132 {"subdirs", OPT_ARG_MSTRZ, &pnm_subdirs, NULL},
30122
1772a5171ac7 Fix function declarations to avoid casting function pointers.
reimar
parents: 29263
diff changeset
133 {"maxfiles", OPT_ARG_INT, &pnm_maxfiles, int_pos},
28922
9dd905e52639 Remove obsolete extra elements from opt_t struct initialization.
diego
parents: 28828
diff changeset
134 {NULL, 0, NULL, NULL}
14504
e394a9cfaf3f Transition of suboption parser to subopt-helper parser.
ivo
parents: 13394
diff changeset
135 };
e394a9cfaf3f Transition of suboption parser to subopt-helper parser.
ivo
parents: 13394
diff changeset
136 const char *info_message = NULL;
13394
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
137
31287
168e89b341b1 Reduce verbosity about suboption parsing in vo drivers.
diego
parents: 30633
diff changeset
138 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
139 "Parsing suboptions.");
14504
e394a9cfaf3f Transition of suboption parser to subopt-helper parser.
ivo
parents: 13394
diff changeset
140
14506
f5ef32b4bdd3 1l. parser can work with pnm_maxfiles directly
ivo
parents: 14504
diff changeset
141 pnm_maxfiles = 1000;
14538
00c3c4111017 New suboption type: malloc'ed, zero terminated string
reimar
parents: 14506
diff changeset
142 pnm_outdir = strdup(".");
00c3c4111017 New suboption type: malloc'ed, zero terminated string
reimar
parents: 14506
diff changeset
143 pnm_subdirs = NULL;
14506
f5ef32b4bdd3 1l. parser can work with pnm_maxfiles directly
ivo
parents: 14504
diff changeset
144
14504
e394a9cfaf3f Transition of suboption parser to subopt-helper parser.
ivo
parents: 13394
diff changeset
145 if (subopt_parse(arg, subopts) != 0) {
e394a9cfaf3f Transition of suboption parser to subopt-helper parser.
ivo
parents: 13394
diff changeset
146 return -1;
e394a9cfaf3f Transition of suboption parser to subopt-helper parser.
ivo
parents: 13394
diff changeset
147 }
e394a9cfaf3f Transition of suboption parser to subopt-helper parser.
ivo
parents: 13394
diff changeset
148
e394a9cfaf3f Transition of suboption parser to subopt-helper parser.
ivo
parents: 13394
diff changeset
149 pnm_type = PNM_TYPE_PPM;
e394a9cfaf3f Transition of suboption parser to subopt-helper parser.
ivo
parents: 13394
diff changeset
150 pnm_mode = PNM_RAW_MODE;
e394a9cfaf3f Transition of suboption parser to subopt-helper parser.
ivo
parents: 13394
diff changeset
151
e394a9cfaf3f Transition of suboption parser to subopt-helper parser.
ivo
parents: 13394
diff changeset
152 if (pgmyuv_type) pnm_type = PNM_TYPE_PGMYUV;
e394a9cfaf3f Transition of suboption parser to subopt-helper parser.
ivo
parents: 13394
diff changeset
153 if (pgm_type) pnm_type = PNM_TYPE_PGM;
e394a9cfaf3f Transition of suboption parser to subopt-helper parser.
ivo
parents: 13394
diff changeset
154 if (ppm_type) pnm_type = PNM_TYPE_PPM;
e394a9cfaf3f Transition of suboption parser to subopt-helper parser.
ivo
parents: 13394
diff changeset
155 if (ascii_mode) pnm_mode = PNM_ASCII_MODE;
e394a9cfaf3f Transition of suboption parser to subopt-helper parser.
ivo
parents: 13394
diff changeset
156 if (raw_mode) pnm_mode = PNM_RAW_MODE;
e394a9cfaf3f Transition of suboption parser to subopt-helper parser.
ivo
parents: 13394
diff changeset
157
e394a9cfaf3f Transition of suboption parser to subopt-helper parser.
ivo
parents: 13394
diff changeset
158 switch (pnm_mode) {
e394a9cfaf3f Transition of suboption parser to subopt-helper parser.
ivo
parents: 13394
diff changeset
159 case PNM_ASCII_MODE:
e394a9cfaf3f Transition of suboption parser to subopt-helper parser.
ivo
parents: 13394
diff changeset
160 info_message = MSGTR_VO_PNM_ASCIIMode;
e394a9cfaf3f Transition of suboption parser to subopt-helper parser.
ivo
parents: 13394
diff changeset
161 break;
e394a9cfaf3f Transition of suboption parser to subopt-helper parser.
ivo
parents: 13394
diff changeset
162 case PNM_RAW_MODE:
e394a9cfaf3f Transition of suboption parser to subopt-helper parser.
ivo
parents: 13394
diff changeset
163 info_message = MSGTR_VO_PNM_RawMode;
e394a9cfaf3f Transition of suboption parser to subopt-helper parser.
ivo
parents: 13394
diff changeset
164 break;
13394
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
165 }
14504
e394a9cfaf3f Transition of suboption parser to subopt-helper parser.
ivo
parents: 13394
diff changeset
166 mp_msg(MSGT_VO, MSGL_INFO, "%s: %s\n", info.short_name, info_message);
e394a9cfaf3f Transition of suboption parser to subopt-helper parser.
ivo
parents: 13394
diff changeset
167
e394a9cfaf3f Transition of suboption parser to subopt-helper parser.
ivo
parents: 13394
diff changeset
168 switch (pnm_type) {
e394a9cfaf3f Transition of suboption parser to subopt-helper parser.
ivo
parents: 13394
diff changeset
169 case PNM_TYPE_PPM:
e394a9cfaf3f Transition of suboption parser to subopt-helper parser.
ivo
parents: 13394
diff changeset
170 info_message = MSGTR_VO_PNM_PPMType;
e394a9cfaf3f Transition of suboption parser to subopt-helper parser.
ivo
parents: 13394
diff changeset
171 break;
e394a9cfaf3f Transition of suboption parser to subopt-helper parser.
ivo
parents: 13394
diff changeset
172 case PNM_TYPE_PGM:
e394a9cfaf3f Transition of suboption parser to subopt-helper parser.
ivo
parents: 13394
diff changeset
173 info_message = MSGTR_VO_PNM_PGMType;
e394a9cfaf3f Transition of suboption parser to subopt-helper parser.
ivo
parents: 13394
diff changeset
174 break;
e394a9cfaf3f Transition of suboption parser to subopt-helper parser.
ivo
parents: 13394
diff changeset
175 case PNM_TYPE_PGMYUV:
e394a9cfaf3f Transition of suboption parser to subopt-helper parser.
ivo
parents: 13394
diff changeset
176 info_message = MSGTR_VO_PNM_PGMYUVType;
e394a9cfaf3f Transition of suboption parser to subopt-helper parser.
ivo
parents: 13394
diff changeset
177 break;
e394a9cfaf3f Transition of suboption parser to subopt-helper parser.
ivo
parents: 13394
diff changeset
178 }
e394a9cfaf3f Transition of suboption parser to subopt-helper parser.
ivo
parents: 13394
diff changeset
179 mp_msg(MSGT_VO, MSGL_INFO, "%s: %s\n", info.short_name, info_message);
13394
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
180
31287
168e89b341b1 Reduce verbosity about suboption parsing in vo drivers.
diego
parents: 30633
diff changeset
181 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
182 "Suboptions parsed OK.");
13394
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
183 return 0;
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
184 }
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
185
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
186 /* ------------------------------------------------------------------------- */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
187
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
188 /** \brief Create a directory.
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
189 *
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
190 * This function creates a directory. If it already exists, it tests if
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
191 * it's a directory and not something else, and if it is, it tests whether
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
192 * the directory is writable or not.
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
193 *
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
194 * \param buf Pointer to directory name.
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
195 * \param verbose Verbose on success. If verbose is non-zero, it will print
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
196 * a message if it was successful in creating the directory.
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
197 *
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
198 * \return nothing In case anything fails, the player will exit. If it
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
199 * returns, everything went well.
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
200 */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
201
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28922
diff changeset
202 static void pnm_mkdir(char *buf, int verbose) {
13394
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
203 struct stat stat_p;
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
204
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
205 /* Silly MING32 bug workaround */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
206 #ifndef __MINGW32__
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
207 if ( mkdir(buf, 0755) < 0 ) {
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
208 #else
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
209 if ( mkdir(buf) < 0 ) {
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
210 #endif
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
211 switch (errno) { /* use switch in case other errors need to be caught
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
212 and handled in the future */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
213 case EEXIST:
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
214 if ( stat(buf, &stat_p ) < 0 ) {
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
215 mp_msg(MSGT_VO, MSGL_ERR, "%s: %s: %s\n", info.short_name,
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
216 MSGTR_VO_GenericError, strerror(errno) );
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
217 mp_msg(MSGT_VO, MSGL_ERR, "%s: %s %s\n", info.short_name,
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
218 MSGTR_VO_UnableToAccess,buf);
30516
f4e017b6921a Fix exit_player() usage throughout the codebase.
diego
parents: 30122
diff changeset
219 exit_player(EXIT_ERROR);
13394
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
220 }
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
221 if ( !S_ISDIR(stat_p.st_mode) ) {
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
222 mp_msg(MSGT_VO, MSGL_ERR, "%s: %s %s\n", info.short_name,
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
223 buf, MSGTR_VO_ExistsButNoDirectory);
30516
f4e017b6921a Fix exit_player() usage throughout the codebase.
diego
parents: 30122
diff changeset
224 exit_player(EXIT_ERROR);
13394
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
225 }
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
226 if ( !(stat_p.st_mode & S_IWUSR) ) {
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
227 mp_msg(MSGT_VO, MSGL_ERR, "%s: %s - %s\n", info.short_name,
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
228 buf, MSGTR_VO_DirExistsButNotWritable);
30516
f4e017b6921a Fix exit_player() usage throughout the codebase.
diego
parents: 30122
diff changeset
229 exit_player(EXIT_ERROR);
13394
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
230 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28922
diff changeset
231
36375
3bcbcece8db9 vo pnm: Always print output directory
al
parents: 36374
diff changeset
232 mp_msg(MSGT_VO, MSGL_INFO, "%s: %s: %s\n", info.short_name, MSGTR_VO_OutputDirectory, buf);
13394
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
233 break;
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
234
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
235 default:
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
236 mp_msg(MSGT_VO, MSGL_ERR, "%s: %s: %s\n", info.short_name,
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
237 MSGTR_VO_GenericError, strerror(errno) );
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
238 mp_msg(MSGT_VO, MSGL_ERR, "%s: %s - %s\n", info.short_name,
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
239 buf, MSGTR_VO_CantCreateDirectory);
30516
f4e017b6921a Fix exit_player() usage throughout the codebase.
diego
parents: 30122
diff changeset
240 exit_player(EXIT_ERROR);
13394
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
241 } /* end switch */
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28922
diff changeset
242 } else if ( verbose ) {
13394
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
243 mp_msg(MSGT_VO, MSGL_INFO, "%s: %s - %s\n", info.short_name,
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
244 buf, MSGTR_VO_DirectoryCreateSuccess);
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
245 } /* end if */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
246 }
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
247
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
248 /* ------------------------------------------------------------------------- */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
249
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
250 /** \brief Configure the video output driver.
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
251 *
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
252 * This functions configures the video output driver. It determines the
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
253 * width and height of the image(s) and creates the output directory.
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
254 *
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
255 * \return 0 All went well.
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
256 */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
257
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
258 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: 14852
diff changeset
259 uint32_t d_height, uint32_t flags, char *title,
13394
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
260 uint32_t format)
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
261 {
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
262 char buf[BUFLENGTH];
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
263
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
264 if (vo_config_count > 0 ) { /* Already configured */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
265 return 0;
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
266 }
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
267
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
268 /* Create outdir. */
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28922
diff changeset
269
13394
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
270 snprintf(buf, BUFLENGTH, "%s", pnm_outdir);
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
271 pnm_mkdir(buf, 1); /* This function only returns if creation was
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
272 successful. If not, the player will exit. */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
273
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
274 if (pnm_type == PNM_TYPE_PPM) {
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
275 pnm_file_extension = strdup("ppm");
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
276 } else if (pnm_type == PNM_TYPE_PGM) {
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
277 pnm_file_extension = strdup("pgm");
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
278 } else if (pnm_type == PNM_TYPE_PGMYUV) {
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
279 pnm_file_extension = strdup("pgmyuv");
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
280 }
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
281
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
282 return 0;
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
283 }
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
284
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
285 /* ------------------------------------------------------------------------- */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
286
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
287 /** \brief Write PNM file to output file
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
288 *
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
289 * This function writes PPM, PGM or PGMYUV data to an output file, depending
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
290 * on which type was selected on the commandline. pnm_type and pnm_mode are
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
291 * global variables. Depending on which mode was selected, it will write
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
292 * a RAW or an ASCII file.
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
293 *
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
294 * \param outfile Filedescriptor of output file.
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
295 * \param mpi The image to write.
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
296 *
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
297 * \return none The player will exit if anything goes wrong.
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
298 */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
299
18950
a943bc3f26c8 Make some functions static.
uau
parents: 16171
diff changeset
300 static void pnm_write_pnm(FILE *outfile, mp_image_t *mpi)
13394
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
301 {
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
302 uint32_t w = mpi->w;
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
303 uint32_t h = mpi->h;
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
304 uint8_t *rgbimage = mpi->planes[0];
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
305 uint8_t *planeY = mpi->planes[0];
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
306 uint8_t *planeU = mpi->planes[1];
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
307 uint8_t *planeV = mpi->planes[2];
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
308 uint8_t *curline;
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
309 uint32_t strideY = mpi->stride[0];
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
310 uint32_t strideU = mpi->stride[1];
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
311 uint32_t strideV = mpi->stride[2];
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
312
14850
ba555409718b Fix compile warnings
ivo
parents: 14736
diff changeset
313 unsigned int i, j;
13394
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
314
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
315 if (pnm_mode == PNM_RAW_MODE) {
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
316
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
317 if (pnm_type == PNM_TYPE_PPM) {
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
318 if ( fprintf(outfile, "P6\n%d %d\n255\n", w, h) < 0 )
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
319 pnm_write_error();
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
320 if ( fwrite(rgbimage, w * 3, h, outfile) < h ) pnm_write_error();
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
321 } else if (pnm_type == PNM_TYPE_PGM) {
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
322 if ( fprintf(outfile, "P5\n%d %d\n255\n", w, h) < 0 )
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
323 pnm_write_error();
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
324 for (i=0; i<h; i++) {
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
325 if ( fwrite(planeY + i * strideY, w, 1, outfile) < 1 )
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
326 pnm_write_error();
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
327 }
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
328 } else if (pnm_type == PNM_TYPE_PGMYUV) {
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
329 if ( fprintf(outfile, "P5\n%d %d\n255\n", w, h*3/2) < 0 )
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
330 pnm_write_error();
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
331 for (i=0; i<h; i++) {
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
332 if ( fwrite(planeY + i * strideY, w, 1, outfile) < 1 )
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
333 pnm_write_error();
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
334 }
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
335 w = w / 2;
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
336 h = h / 2;
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
337 for (i=0; i<h; i++) {
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
338 if ( fwrite(planeU + i * strideU, w, 1, outfile) < 1 )
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
339 pnm_write_error();
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
340 if ( fwrite(planeV + i * strideV, w, 1, outfile) < 1 )
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
341 pnm_write_error();
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
342 }
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
343 } /* end if pnm_type */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
344
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
345 } else if (pnm_mode == PNM_ASCII_MODE) {
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
346
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
347 if (pnm_type == PNM_TYPE_PPM) {
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
348 if ( fprintf(outfile, "P3\n%d %d\n255\n", w, h) < 0 )
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
349 pnm_write_error();
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
350 for (i=0; i <= w * h * 3 - 16 ; i += 15) {
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
351 if ( fprintf(outfile, PNM_LINE_OF_ASCII,
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
352 PNM_LINE15(rgbimage,i) ) < 0 ) pnm_write_error();
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
353 }
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
354 while (i < (w * h * 3) ) {
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
355 if ( fprintf(outfile, "%03d ", rgbimage[i]) < 0 )
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
356 pnm_write_error();
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
357 i++;
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
358 }
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
359 if ( fputc('\n', outfile) < 0 ) pnm_write_error();
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
360 } else if ( (pnm_type == PNM_TYPE_PGM) ||
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
361 (pnm_type == PNM_TYPE_PGMYUV) ) {
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
362
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
363 /* different header for pgm and pgmyuv. pgmyuv is 'higher' */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
364 if (pnm_type == PNM_TYPE_PGM) {
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
365 if ( fprintf(outfile, "P2\n%d %d\n255\n", w, h) < 0 )
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
366 pnm_write_error();
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
367 } else { /* PNM_TYPE_PGMYUV */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
368 if ( fprintf(outfile, "P2\n%d %d\n255\n", w, h*3/2) < 0 )
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
369 pnm_write_error();
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
370 }
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
371
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
372 /* output Y plane for both PGM and PGMYUV */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
373 for (j=0; j<h; j++) {
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
374 curline = planeY + strideY * j;
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
375 for (i=0; i <= w - 16; i+=15) {
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
376 if ( fprintf(outfile, PNM_LINE_OF_ASCII,
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
377 PNM_LINE15(curline,i) ) < 0 ) pnm_write_error();
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
378 }
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
379 while (i < w ) {
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
380 if ( fprintf(outfile, "%03d ", curline[i]) < 0 )
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
381 pnm_write_error();
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
382 i++;
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
383 }
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
384 if ( fputc('\n', outfile) < 0 ) pnm_write_error();
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
385 }
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
386
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
387 /* also output U and V planes fpr PGMYUV */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
388 if (pnm_type == PNM_TYPE_PGMYUV) {
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
389 w = w / 2;
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
390 h = h / 2;
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
391 for (j=0; j<h; j++) {
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
392 curline = planeU + strideU * j;
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
393 for (i=0; i<= w-16; i+=15) {
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
394 if ( fprintf(outfile, PNM_LINE_OF_ASCII,
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
395 PNM_LINE15(curline,i) ) < 0 ) pnm_write_error();
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
396 }
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
397 while (i < w ) {
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
398 if ( fprintf(outfile, "%03d ", curline[i]) < 0 )
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
399 pnm_write_error();
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
400 i++;
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
401 }
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
402 if ( fputc('\n', outfile) < 0 ) pnm_write_error();
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
403
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
404 curline = planeV + strideV * j;
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
405 for (i=0; i<= w-16; i+=15) {
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
406 if ( fprintf(outfile, PNM_LINE_OF_ASCII,
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
407 PNM_LINE15(curline,i) ) < 0 ) pnm_write_error();
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
408 }
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
409 while (i < w ) {
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
410 if ( fprintf(outfile, "%03d ", curline[i]) < 0 )
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
411 pnm_write_error();
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
412 i++;
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
413 }
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
414 if ( fputc('\n', outfile) < 0 ) pnm_write_error();
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
415 }
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
416 }
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
417
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
418 } /* end if pnm_type */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
419 } /* end if pnm_mode */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
420 }
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
421
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
422 /* ------------------------------------------------------------------------- */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
423
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
424 /** \brief Write a PNM image.
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
425 *
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
426 * This function gets called first if a PNM image has to be written to disk.
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
427 * It contains the subdirectory framework and it calls pnm_write_pnm() to
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
428 * actually write the image to disk.
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
429 *
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
430 * \param mpi The image to write.
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
431 *
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
432 * \return none The player will exit if anything goes wrong.
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
433 */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
434
18950
a943bc3f26c8 Make some functions static.
uau
parents: 16171
diff changeset
435 static void pnm_write_image(mp_image_t *mpi)
13394
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
436 {
14850
ba555409718b Fix compile warnings
ivo
parents: 14736
diff changeset
437 static int framenum = 0, framecounter = 0, subdircounter = 0;
13394
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
438 char buf[BUFLENGTH];
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
439 static char subdirname[BUFLENGTH] = "";
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
440 FILE *outfile;
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
441
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
442 if (!mpi) {
31834
64ba1daa147a various spelling fixes, found by the Debian QA tool 'lintian'
siretart
parents: 31287
diff changeset
443 mp_msg(MSGT_VO, MSGL_ERR, "%s: No image data supplied to video output driver\n", info.short_name );
30516
f4e017b6921a Fix exit_player() usage throughout the codebase.
diego
parents: 30122
diff changeset
444 exit_player(EXIT_ERROR);
13394
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
445 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28922
diff changeset
446
13394
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
447 /* Start writing to new subdirectory after a certain amount of frames */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
448 if ( framecounter == pnm_maxfiles ) {
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
449 framecounter = 0;
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
450 }
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
451
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
452 /* If framecounter is zero (or reset to zero), increment subdirectory
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
453 * number and create the subdirectory.
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
454 * If pnm_subdirs is not set, do nothing. */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
455 if ( !framecounter && pnm_subdirs ) {
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
456 subdircounter++;
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
457 snprintf(subdirname, BUFLENGTH, "%s%08d", pnm_subdirs, subdircounter);
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
458 snprintf(buf, BUFLENGTH, "%s/%s", pnm_outdir, subdirname);
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
459 pnm_mkdir(buf, 0); /* This function only returns if creation was
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
460 successful. If not, the player will exit. */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
461 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28922
diff changeset
462
13394
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
463 framenum++;
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
464 framecounter++;
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
465
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
466 /* snprintf the full pathname of the outputfile */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
467 snprintf(buf, BUFLENGTH, "%s/%s/%08d.%s", pnm_outdir, subdirname,
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
468 framenum, pnm_file_extension);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28922
diff changeset
469
13394
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
470 if ( (outfile = fopen(buf, "wb") ) == NULL ) {
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
471 mp_msg(MSGT_VO, MSGL_ERR, "\n%s: %s\n", info.short_name,
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
472 MSGTR_VO_CantCreateFile);
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
473 mp_msg(MSGT_VO, MSGL_ERR, "%s: %s: %s\n",
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
474 info.short_name, MSGTR_VO_GenericError,
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
475 strerror(errno) );
30516
f4e017b6921a Fix exit_player() usage throughout the codebase.
diego
parents: 30122
diff changeset
476 exit_player(EXIT_ERROR);
13394
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
477 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28922
diff changeset
478
13394
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
479 pnm_write_pnm(outfile, mpi);
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
480
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
481 fclose(outfile);
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
482 }
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
483
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
484 /* ------------------------------------------------------------------------- */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
485
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
486 static uint32_t draw_image(mp_image_t *mpi)
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
487 {
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
488 if (mpi->flags & MP_IMGFLAG_PLANAR) { /* Planar */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
489 if (mpi->flags & MP_IMGFLAG_YUV) { /* Planar YUV */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
490 pnm_write_image(mpi);
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
491 return VO_TRUE;
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
492 } else { /* Planar RGB */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
493 return VO_FALSE;
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
494 }
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
495 } else { /* Packed */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
496 if (mpi->flags & MP_IMGFLAG_YUV) { /* Packed YUV */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
497 return VO_FALSE;
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
498 } else { /* Packed RGB */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
499 pnm_write_image(mpi);
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
500 return VO_TRUE;
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
501 }
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
502 }
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
503
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
504 return VO_FALSE;
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
505 }
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
506
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
507 /* ------------------------------------------------------------------------- */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
508
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
509 static int query_format(uint32_t format)
13394
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
510 {
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
511 /* Ensure that for PPM we get Packed RGB and for PGM(YUV) we get
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
512 * Planar YUV */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
513 if (pnm_type == PNM_TYPE_PPM) {
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
514 if (format == IMGFMT_RGB24) {
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
515 return VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW;
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
516 }
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
517 } else if ( (pnm_type == PNM_TYPE_PGM) || (pnm_type == PNM_TYPE_PGMYUV) ) {
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
518 if (format == IMGFMT_YV12) {
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
519 return VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW;
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
520 }
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
521 }
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
522
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
523 return 0;
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
524 }
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
525
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
526 /* ------------------------------------------------------------------------- */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
527
33305
ddb45e9443ec Remove the variable arguments from the libvo control() functions.
iive
parents: 32537
diff changeset
528 static int control(uint32_t request, void *data)
13394
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
529 {
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
530 switch (request) {
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
531 case VOCTRL_QUERY_FORMAT:
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
532 return query_format(*((uint32_t*)data));
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
533 case VOCTRL_DRAW_IMAGE:
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
534 return draw_image(data);
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
535 }
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
536 return VO_NOTIMPL;
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
537 }
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
538
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
539 /* ------------------------------------------------------------------------- */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
540
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
541 static void uninit(void)
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
542 {
32537
8fa2f43cb760 Remove most of the NULL pointer check before free all over the code
cboesch
parents: 31834
diff changeset
543 free(pnm_subdirs);
8fa2f43cb760 Remove most of the NULL pointer check before free all over the code
cboesch
parents: 31834
diff changeset
544 pnm_subdirs = NULL;
8fa2f43cb760 Remove most of the NULL pointer check before free all over the code
cboesch
parents: 31834
diff changeset
545 free(pnm_outdir);
8fa2f43cb760 Remove most of the NULL pointer check before free all over the code
cboesch
parents: 31834
diff changeset
546 pnm_outdir = NULL;
13394
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
547 }
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
548
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
549 /* ------------------------------------------------------------------------- */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
550
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
551 static void check_events(void)
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
552 {
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
553 }
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
554
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
555 /* ------------------------------------------------------------------------- */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
556
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
557 static void draw_osd(void)
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
558 {
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
559 }
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
560
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
561 /* ------------------------------------------------------------------------- */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
562
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
563 static void flip_page (void)
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
564 {
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
565 }
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
566
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
567 /* ------------------------------------------------------------------------- */
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
568
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
569 #undef BUFLENGTH
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
570 #undef PNM_RAW_MODE
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
571 #undef PNM_ASCII_MODE
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
572 #undef PNM_TYPE_PPM
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
573 #undef PNM_TYPE_PGM
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
574 #undef PNM_TYPE_PGMYUV
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
575
455a5056801f New generic 'portable anymap' video output driver. It supports portable
ivo
parents:
diff changeset
576 /* ------------------------------------------------------------------------- */