annotate libvo/vo_caca.c @ 35640:5cc5f1acfc4f

Make variable static that is only used inside the file.
author ib
date Fri, 11 Jan 2013 23:55:47 +0000
parents 4d92281ea02b
children 5d3f93051de9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
1 /*
28446
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 25220
diff changeset
2 * video output driver for libcaca
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 25220
diff changeset
3 *
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
4 * by Pigeon <pigeon@pigeond.net>
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
5 *
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
6 * Some functions/codes/ideas are from x11 and aalib vo
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
7 *
28446
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 25220
diff changeset
8 * TODO: support draw_alpha?
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 25220
diff changeset
9 *
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 25220
diff changeset
10 * This file is part of MPlayer.
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 25220
diff changeset
11 *
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 25220
diff changeset
12 * MPlayer is free software; you can redistribute it and/or modify
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 25220
diff changeset
13 * it under the terms of the GNU General Public License as published by
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 25220
diff changeset
14 * the Free Software Foundation; either version 2 of the License, or
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 25220
diff changeset
15 * (at your option) any later version.
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 25220
diff changeset
16 *
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 25220
diff changeset
17 * MPlayer is distributed in the hope that it will be useful,
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 25220
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 25220
diff changeset
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 25220
diff changeset
20 * GNU General Public License for more details.
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 25220
diff changeset
21 *
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 25220
diff changeset
22 * You should have received a copy of the GNU General Public License along
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 25220
diff changeset
23 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 25220
diff changeset
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
25 */
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
26
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
27 #include <stdio.h>
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
28 #include <stdlib.h>
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
29 #include <sys/stat.h>
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
30 #include <unistd.h>
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
31 #include <string.h>
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
32 #include <time.h>
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
33 #include <errno.h>
34250
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
34 #include <caca.h>
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
35
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
36 #include "config.h"
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
37 #include "video_out.h"
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
38 #include "video_out_internal.h"
32467
fbe5c829c69b Move libvo/sub.[ch] from libvo to sub.
cigaes
parents: 32176
diff changeset
39 #include "sub/sub.h"
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
40
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
41 #include "osdep/keycodes.h"
34271
abe845d0691f caca: support mouse events and more keys.
reimar
parents: 34250
diff changeset
42 #include "input/input.h"
abe845d0691f caca: support mouse events and more keys.
reimar
parents: 34250
diff changeset
43 #include "input/mouse.h"
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
44 #include "mp_msg.h"
22823
98eaf29b5dee Code cleanup: don't include a .c file in mplayer.c and fix a few
rathann
parents: 21161
diff changeset
45 #include "mp_fifo.h"
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
46
25216
3aee342be929 Make vo info structs const
reimar
parents: 24046
diff changeset
47 static const vo_info_t info = {
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
48 "libcaca",
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
49 "caca",
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
50 "Pigeon <pigeon@pigeond.net>",
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
51 ""
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
52 };
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
53
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
54 const LIBVO_EXTERN(caca)
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
55
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
56 /* caca stuff */
34250
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
57 static caca_canvas_t *canvas;
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
58 static caca_display_t *display;
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
59 static caca_dither_t *dither = NULL;
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
60 static const char *dither_antialias = "default";
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
61 static const char *dither_charset = "default";
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
62 static const char *dither_color = "default";
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
63 static const char *dither_algo = "none";
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
64
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
65 /* image infos */
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
66 static int image_format;
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
67 static int image_width;
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
68 static int image_height;
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
69
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
70 static int screen_w, screen_h;
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
71
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
72 /* We want 24bpp always for now */
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
73 static unsigned int bpp = 24;
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
74 static unsigned int depth = 3;
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
75 static unsigned int rmask = 0xff0000;
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
76 static unsigned int gmask = 0x00ff00;
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
77 static unsigned int bmask = 0x0000ff;
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
78 static unsigned int amask = 0;
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
79
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
80 #define MESSAGE_SIZE 512
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
81 #define MESSAGE_DURATION 5
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
82
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
83 static time_t stoposd = 0;
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
84 static int showosdmessage = 0;
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
85 static char osdmessagetext[MESSAGE_SIZE];
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
86 static char posbar[MESSAGE_SIZE];
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
87
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
88 static int osdx = 0, osdy = 0;
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
89 static int posbary = 2;
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
90
19053
75327b24e06f marks several string parameters as const, as they are not modified inside the function, Patch by Stefan Huehner, stefan AT huehner-org
reynaldo
parents: 16171
diff changeset
91 static void osdmessage(int duration, const char *fmt, ...)
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
92 {
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
93 /* for outputting a centered string at the window bottom for a while */
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
94 va_list ar;
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
95 char m[MESSAGE_SIZE];
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
96
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
97 va_start(ar, fmt);
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
98 vsprintf(m, fmt, ar);
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
99 va_end(ar);
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
100 strcpy(osdmessagetext, m);
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
101
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
102 showosdmessage = 1;
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
103 stoposd = time(NULL) + duration;
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
104 osdx = (screen_w - strlen(osdmessagetext)) / 2;
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
105 posbar[0] = '\0';
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
106 }
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
107
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
108 static void osdpercent(int duration, int min, int max, int val,
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
109 const char *desc, const char *unit)
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
110 {
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
111 /* prints a bar for setting values */
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
112 float step;
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
113 int where, i;
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
114
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
115 step = (float)screen_w / (float)(max - min);
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
116 where = (val - min) * step;
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
117 osdmessage(duration, "%s: %i%s", desc, val, unit);
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
118 posbar[0] = '|';
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
119 posbar[screen_w - 1] = '|';
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
120
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
121 for (i = 0; i < screen_w; i++) {
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
122 if (i == where)
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
123 posbar[i] = '#';
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
124 else
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
125 posbar[i] = '-';
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
126 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 29212
diff changeset
127
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
128 if (where != 0)
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
129 posbar[0] = '|';
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
130
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
131 if (where != (screen_w - 1))
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
132 posbar[screen_w - 1] = '|';
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
133
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
134 posbar[screen_w] = '\0';
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
135 }
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
136
29212
eda346733b8c Add missing 'void' to parameterless function declarations.
diego
parents: 28446
diff changeset
137 static int resize(void)
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
138 {
34250
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
139 screen_w = caca_get_canvas_width(canvas);
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
140 screen_h = caca_get_canvas_height(canvas);
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
141
34250
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
142 caca_free_dither(dither);
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
143
34250
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
144 dither = caca_create_dither(bpp, image_width, image_height,
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
145 depth * image_width,
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
146 rmask, gmask, bmask, amask);
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
147 if (dither == NULL) {
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
148 mp_msg(MSGT_VO, MSGL_FATAL, "vo_caca: caca_create_dither failed!\n");
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
149 return ENOSYS;
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
150 }
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
151
34250
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
152 /* Default libcaca features */
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
153 caca_set_dither_antialias(dither, dither_antialias);
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
154 caca_set_dither_charset(dither, dither_charset);
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
155 caca_set_dither_color(dither, dither_color);
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
156 caca_set_dither_algorithm(dither, dither_algo);
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
157
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
158 return 0;
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
159 }
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
160
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
161 static int config(uint32_t width, uint32_t height, uint32_t d_width,
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
162 uint32_t d_height, uint32_t flags, char *title,
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
163 uint32_t format)
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
164 {
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
165 image_height = height;
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
166 image_width = width;
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
167 image_format = format;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 29212
diff changeset
168
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
169 showosdmessage = 0;
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
170 posbar[0] = '\0';
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
171
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
172 return resize();
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
173 }
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
174
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
175 static int draw_frame(uint8_t *src[])
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
176 {
34250
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
177 caca_dither_bitmap(canvas, 0, 0, screen_w, screen_h, dither, src[0]);
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
178 return 0;
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
179 }
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
180
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
181 static int draw_slice(uint8_t *src[], int stride[], int w, int h, int x, int y)
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
182 {
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
183 return 0;
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
184 }
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
185
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
186 static void flip_page(void)
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
187 {
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
188 if (showosdmessage) {
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
189 if (time(NULL) >= stoposd) {
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
190 showosdmessage = 0;
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
191 if (*posbar)
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
192 posbar[0] = '\0';
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
193 } else {
34250
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
194 caca_put_str(canvas, osdx, osdy, osdmessagetext);
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
195 if (*posbar)
34250
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
196 caca_put_str(canvas, 0, posbary, posbar);
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
197 }
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
198 }
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
199
34250
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
200 caca_refresh_display(display);
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
201 }
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
202
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
203 static void set_next_str(const char * const *list, const char **str,
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
204 const char **msg)
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
205 {
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
206 int ind;
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
207 for (ind = 0; list[ind]; ind += 2) {
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
208 if (strcmp(list[ind], *str) == 0) {
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
209 if (list[ind + 2] == NULL)
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
210 ind = -2;
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
211 *str = list[ind + 2];
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
212 *msg = list[ind + 3];
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
213 return;
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
214 }
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
215 }
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
216
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
217 *str = list[0];
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
218 *msg = list[1];
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
219 }
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
220
34275
4d92281ea02b Use lookup_keymap_table instead of a large number of switch cases.
reimar
parents: 34274
diff changeset
221 static const struct mp_keymap keysym_map[] = {
4d92281ea02b Use lookup_keymap_table instead of a large number of switch cases.
reimar
parents: 34274
diff changeset
222 {CACA_KEY_RETURN, KEY_ENTER}, {CACA_KEY_ESCAPE, KEY_ESC},
4d92281ea02b Use lookup_keymap_table instead of a large number of switch cases.
reimar
parents: 34274
diff changeset
223 {CACA_KEY_UP, KEY_DOWN}, {CACA_KEY_DOWN, KEY_DOWN},
4d92281ea02b Use lookup_keymap_table instead of a large number of switch cases.
reimar
parents: 34274
diff changeset
224 {CACA_KEY_LEFT, KEY_LEFT}, {CACA_KEY_RIGHT, KEY_RIGHT},
4d92281ea02b Use lookup_keymap_table instead of a large number of switch cases.
reimar
parents: 34274
diff changeset
225 {CACA_KEY_PAGEUP, KEY_PAGE_UP}, {CACA_KEY_PAGEDOWN, KEY_PAGE_DOWN},
4d92281ea02b Use lookup_keymap_table instead of a large number of switch cases.
reimar
parents: 34274
diff changeset
226 {CACA_KEY_HOME, KEY_HOME}, {CACA_KEY_END, KEY_END},
4d92281ea02b Use lookup_keymap_table instead of a large number of switch cases.
reimar
parents: 34274
diff changeset
227 {CACA_KEY_INSERT, KEY_INSERT}, {CACA_KEY_DELETE, KEY_DELETE},
4d92281ea02b Use lookup_keymap_table instead of a large number of switch cases.
reimar
parents: 34274
diff changeset
228 {CACA_KEY_BACKSPACE, KEY_BACKSPACE}, {CACA_KEY_TAB, KEY_TAB},
4d92281ea02b Use lookup_keymap_table instead of a large number of switch cases.
reimar
parents: 34274
diff changeset
229 {CACA_KEY_PAUSE, KEY_PAUSE},
4d92281ea02b Use lookup_keymap_table instead of a large number of switch cases.
reimar
parents: 34274
diff changeset
230 {CACA_KEY_F1, KEY_F+1}, {CACA_KEY_F2, KEY_F+2},
4d92281ea02b Use lookup_keymap_table instead of a large number of switch cases.
reimar
parents: 34274
diff changeset
231 {CACA_KEY_F3, KEY_F+3}, {CACA_KEY_F4, KEY_F+4},
4d92281ea02b Use lookup_keymap_table instead of a large number of switch cases.
reimar
parents: 34274
diff changeset
232 {CACA_KEY_F5, KEY_F+5}, {CACA_KEY_F6, KEY_F+6},
4d92281ea02b Use lookup_keymap_table instead of a large number of switch cases.
reimar
parents: 34274
diff changeset
233 {CACA_KEY_F7, KEY_F+7}, {CACA_KEY_F8, KEY_F+8},
4d92281ea02b Use lookup_keymap_table instead of a large number of switch cases.
reimar
parents: 34274
diff changeset
234 {CACA_KEY_F9, KEY_F+9}, {CACA_KEY_F10, KEY_F+10},
4d92281ea02b Use lookup_keymap_table instead of a large number of switch cases.
reimar
parents: 34274
diff changeset
235 {CACA_KEY_F11, KEY_F+11}, {CACA_KEY_F12, KEY_F+12},
4d92281ea02b Use lookup_keymap_table instead of a large number of switch cases.
reimar
parents: 34274
diff changeset
236 {CACA_KEY_F13, KEY_F+13}, {CACA_KEY_F14, KEY_F+14},
4d92281ea02b Use lookup_keymap_table instead of a large number of switch cases.
reimar
parents: 34274
diff changeset
237 {CACA_KEY_F15, KEY_F+15},
4d92281ea02b Use lookup_keymap_table instead of a large number of switch cases.
reimar
parents: 34274
diff changeset
238 {0, 0}
4d92281ea02b Use lookup_keymap_table instead of a large number of switch cases.
reimar
parents: 34274
diff changeset
239 };
4d92281ea02b Use lookup_keymap_table instead of a large number of switch cases.
reimar
parents: 34274
diff changeset
240
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
241 static void check_events(void)
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
242 {
34250
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
243 caca_event_t cev;
34273
3e8cb5ef9ac7 caca: process all pending events instead of exactly one per check_events.
reimar
parents: 34272
diff changeset
244 while (caca_get_event(display, CACA_EVENT_ANY, &cev, 0)) {
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
245
34274
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
246 switch (cev.type) {
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
247 case CACA_EVENT_RESIZE:
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
248 caca_refresh_display(display);
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
249 resize();
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
250 break;
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
251 case CACA_EVENT_QUIT:
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
252 mplayer_put_key(KEY_CLOSE_WIN);
34250
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
253 break;
34274
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
254 case CACA_EVENT_MOUSE_MOTION:
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
255 vo_mouse_movement(cev.data.mouse.x, cev.data.mouse.y);
34250
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
256 break;
34274
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
257 case CACA_EVENT_MOUSE_PRESS:
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
258 if (!vo_nomouse_input)
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
259 mplayer_put_key((MOUSE_BTN0 + cev.data.mouse.button - 1) | MP_KEY_DOWN);
34250
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
260 break;
34274
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
261 case CACA_EVENT_MOUSE_RELEASE:
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
262 if (!vo_nomouse_input)
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
263 mplayer_put_key(MOUSE_BTN0 + cev.data.mouse.button - 1);
34250
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
264 break;
34274
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
265 case CACA_EVENT_KEY_PRESS:
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
266 {
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
267 int key = cev.data.key.ch;
34275
4d92281ea02b Use lookup_keymap_table instead of a large number of switch cases.
reimar
parents: 34274
diff changeset
268 int mpkey = lookup_keymap_table(keysym_map, key);
34274
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
269 const char *msg_name;
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
270
34275
4d92281ea02b Use lookup_keymap_table instead of a large number of switch cases.
reimar
parents: 34274
diff changeset
271 if (mpkey)
4d92281ea02b Use lookup_keymap_table instead of a large number of switch cases.
reimar
parents: 34274
diff changeset
272 mplayer_put_key(mpkey);
4d92281ea02b Use lookup_keymap_table instead of a large number of switch cases.
reimar
parents: 34274
diff changeset
273 else
34274
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
274 switch (key) {
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
275 case 'd':
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
276 case 'D':
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
277 /* Toggle dithering algorithm */
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
278 set_next_str(caca_get_dither_algorithm_list(dither), &dither_algo, &msg_name);
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
279 caca_set_dither_algorithm(dither, dither_algo);
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
280 osdmessage(MESSAGE_DURATION, "Using %s", msg_name);
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
281 break;
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
282
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
283 case 'a':
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
284 case 'A':
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
285 /* Toggle antialiasing method */
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
286 set_next_str(caca_get_dither_antialias_list(dither), &dither_antialias, &msg_name);
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
287 caca_set_dither_antialias(dither, dither_antialias);
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
288 osdmessage(MESSAGE_DURATION, "Using %s", msg_name);
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
289 break;
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
290
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
291 case 'h':
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
292 case 'H':
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
293 /* Toggle charset method */
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
294 set_next_str(caca_get_dither_charset_list(dither), &dither_charset, &msg_name);
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
295 caca_set_dither_charset(dither, dither_charset);
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
296 osdmessage(MESSAGE_DURATION, "Using %s", msg_name);
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
297 break;
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
298
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
299 case 'c':
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
300 case 'C':
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
301 /* Toggle color method */
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
302 set_next_str(caca_get_dither_color_list(dither), &dither_color, &msg_name);
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
303 caca_set_dither_color(dither, dither_color);
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
304 osdmessage(MESSAGE_DURATION, "Using %s", msg_name);
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
305 break;
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
306
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
307 default:
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
308 if (key <= 255)
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
309 mplayer_put_key(key);
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
310 break;
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
311 }
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
312 }
34274
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
313 }
34273
3e8cb5ef9ac7 caca: process all pending events instead of exactly one per check_events.
reimar
parents: 34272
diff changeset
314 }
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
315 }
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
316
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
317 static void uninit(void)
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
318 {
34250
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
319 caca_free_dither(dither);
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
320 dither = NULL;
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
321 caca_free_display(display);
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
322 caca_free_canvas(canvas);
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
323 }
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
324
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
325
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
326 static void draw_osd(void)
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
327 {
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
328 if (vo_osd_progbar_type != -1)
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
329 osdpercent(MESSAGE_DURATION, 0, 255, vo_osd_progbar_value,
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
330 sub_osd_names[vo_osd_progbar_type], "");
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
331 }
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
332
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
333 static int preinit(const char *arg)
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
334 {
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
335 if (arg) {
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
336 mp_msg(MSGT_VO, MSGL_ERR, "vo_caca: Unknown subdevice: %s\n", arg);
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
337 return ENOSYS;
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
338 }
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
339
34250
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
340 canvas = caca_create_canvas(0, 0);
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
341 if (canvas == NULL) {
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
342 mp_msg(MSGT_VO, MSGL_ERR, "vo_caca: failed to create canvas\n");
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
343 return ENOSYS;
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
344 }
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
345
34250
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
346 display = caca_create_display(canvas);
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
347
34250
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
348 if (display == NULL) {
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
349 mp_msg(MSGT_VO, MSGL_ERR, "vo_caca: failed to create display\n");
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
350 caca_free_canvas(canvas);
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
351 return ENOSYS;
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
352 }
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
353
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
354 caca_set_display_title(display, "MPlayer");
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
355
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
356 return 0;
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
357 }
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
358
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
359 static int query_format(uint32_t format)
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
360 {
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
361 if (format == IMGFMT_BGR24)
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
362 return VFCAP_OSD | VFCAP_CSP_SUPPORTED;
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
363
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
364 return 0;
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
365 }
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
366
33305
ddb45e9443ec Remove the variable arguments from the libvo control() functions.
iive
parents: 32467
diff changeset
367 static int control(uint32_t request, void *data)
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
368 {
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
369 switch (request) {
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
370 case VOCTRL_QUERY_FORMAT:
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
371 return query_format(*((uint32_t *)data));
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
372 default:
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
373 return VO_NOTIMPL;
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
374 }
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
375 }