annotate libvo/vo_caca.c @ 37050:3555aa94b881

Relocate code added in r37121.
author ib
date Wed, 09 Apr 2014 13:30:50 +0000
parents 5d3f93051de9
children
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"
36517
5d3f93051de9 Remove empty draw_slice and draw_frame stubs.
reimar
parents: 34275
diff changeset
38 #define NO_DRAW_SLICE
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
39 #include "video_out_internal.h"
32467
fbe5c829c69b Move libvo/sub.[ch] from libvo to sub.
cigaes
parents: 32176
diff changeset
40 #include "sub/sub.h"
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
41
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
42 #include "osdep/keycodes.h"
34271
abe845d0691f caca: support mouse events and more keys.
reimar
parents: 34250
diff changeset
43 #include "input/input.h"
abe845d0691f caca: support mouse events and more keys.
reimar
parents: 34250
diff changeset
44 #include "input/mouse.h"
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
45 #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
46 #include "mp_fifo.h"
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
47
25216
3aee342be929 Make vo info structs const
reimar
parents: 24046
diff changeset
48 static const vo_info_t info = {
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
49 "libcaca",
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
50 "caca",
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
51 "Pigeon <pigeon@pigeond.net>",
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
52 ""
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
53 };
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
54
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
55 const LIBVO_EXTERN(caca)
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
56
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
57 /* caca stuff */
34250
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
58 static caca_canvas_t *canvas;
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
59 static caca_display_t *display;
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
60 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
61 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
62 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
63 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
64 static const char *dither_algo = "none";
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
65
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
66 /* image infos */
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
67 static int image_format;
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
68 static int image_width;
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
69 static int image_height;
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
70
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
71 static int screen_w, screen_h;
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
72
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
73 /* We want 24bpp always for now */
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
74 static unsigned int bpp = 24;
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
75 static unsigned int depth = 3;
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
76 static unsigned int rmask = 0xff0000;
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
77 static unsigned int gmask = 0x00ff00;
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
78 static unsigned int bmask = 0x0000ff;
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
79 static unsigned int amask = 0;
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
80
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
81 #define MESSAGE_SIZE 512
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
82 #define MESSAGE_DURATION 5
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
83
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
84 static time_t stoposd = 0;
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
85 static int showosdmessage = 0;
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
86 static char osdmessagetext[MESSAGE_SIZE];
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
87 static char posbar[MESSAGE_SIZE];
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
88
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
89 static int osdx = 0, osdy = 0;
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
90 static int posbary = 2;
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
91
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
92 static void osdmessage(int duration, const char *fmt, ...)
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
93 {
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
94 /* 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
95 va_list ar;
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
96 char m[MESSAGE_SIZE];
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
97
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
98 va_start(ar, fmt);
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
99 vsprintf(m, fmt, ar);
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
100 va_end(ar);
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
101 strcpy(osdmessagetext, m);
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
102
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
103 showosdmessage = 1;
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
104 stoposd = time(NULL) + duration;
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
105 osdx = (screen_w - strlen(osdmessagetext)) / 2;
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
106 posbar[0] = '\0';
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
107 }
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
108
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
109 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
110 const char *desc, const char *unit)
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
111 {
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
112 /* prints a bar for setting values */
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
113 float step;
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
114 int where, i;
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
115
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
116 step = (float)screen_w / (float)(max - min);
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
117 where = (val - min) * step;
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
118 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
119 posbar[0] = '|';
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
120 posbar[screen_w - 1] = '|';
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
121
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
122 for (i = 0; i < screen_w; i++) {
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
123 if (i == where)
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
124 posbar[i] = '#';
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
125 else
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
126 posbar[i] = '-';
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
127 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 29212
diff changeset
128
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
129 if (where != 0)
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
130 posbar[0] = '|';
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
131
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
132 if (where != (screen_w - 1))
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
133 posbar[screen_w - 1] = '|';
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
134
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
135 posbar[screen_w] = '\0';
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
136 }
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
137
29212
eda346733b8c Add missing 'void' to parameterless function declarations.
diego
parents: 28446
diff changeset
138 static int resize(void)
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
139 {
34250
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
140 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
141 screen_h = caca_get_canvas_height(canvas);
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
142
34250
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
143 caca_free_dither(dither);
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
144
34250
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
145 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
146 depth * image_width,
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
147 rmask, gmask, bmask, amask);
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
148 if (dither == NULL) {
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
149 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
150 return ENOSYS;
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
151 }
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
152
34250
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
153 /* Default libcaca features */
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
154 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
155 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
156 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
157 caca_set_dither_algorithm(dither, dither_algo);
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
158
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
159 return 0;
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
160 }
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
161
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
162 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
163 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
164 uint32_t format)
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
165 {
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
166 image_height = height;
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
167 image_width = width;
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
168 image_format = format;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 29212
diff changeset
169
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
170 showosdmessage = 0;
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
171 posbar[0] = '\0';
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
172
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
173 return resize();
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
174 }
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
175
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
176 static int draw_frame(uint8_t *src[])
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
177 {
34250
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
178 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
179 return 0;
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
180 }
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
181
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
182 static void flip_page(void)
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
183 {
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
184 if (showosdmessage) {
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
185 if (time(NULL) >= stoposd) {
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
186 showosdmessage = 0;
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
187 if (*posbar)
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
188 posbar[0] = '\0';
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
189 } else {
34250
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
190 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
191 if (*posbar)
34250
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
192 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
193 }
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
194 }
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
195
34250
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
196 caca_refresh_display(display);
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
197 }
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
198
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
199 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
200 const char **msg)
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 int ind;
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
203 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
204 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
205 if (list[ind + 2] == NULL)
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
206 ind = -2;
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
207 *str = list[ind + 2];
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
208 *msg = list[ind + 3];
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
209 return;
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
210 }
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
211 }
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
212
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
213 *str = list[0];
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
214 *msg = list[1];
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
215 }
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
216
34275
4d92281ea02b Use lookup_keymap_table instead of a large number of switch cases.
reimar
parents: 34274
diff changeset
217 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
218 {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
219 {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
220 {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
221 {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
222 {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
223 {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
224 {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
225 {CACA_KEY_PAUSE, KEY_PAUSE},
4d92281ea02b Use lookup_keymap_table instead of a large number of switch cases.
reimar
parents: 34274
diff changeset
226 {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
227 {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
228 {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
229 {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
230 {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
231 {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
232 {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
233 {CACA_KEY_F15, KEY_F+15},
4d92281ea02b Use lookup_keymap_table instead of a large number of switch cases.
reimar
parents: 34274
diff changeset
234 {0, 0}
4d92281ea02b Use lookup_keymap_table instead of a large number of switch cases.
reimar
parents: 34274
diff changeset
235 };
4d92281ea02b Use lookup_keymap_table instead of a large number of switch cases.
reimar
parents: 34274
diff changeset
236
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
237 static void check_events(void)
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
238 {
34250
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
239 caca_event_t cev;
34273
3e8cb5ef9ac7 caca: process all pending events instead of exactly one per check_events.
reimar
parents: 34272
diff changeset
240 while (caca_get_event(display, CACA_EVENT_ANY, &cev, 0)) {
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
241
34274
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
242 switch (cev.type) {
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
243 case CACA_EVENT_RESIZE:
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
244 caca_refresh_display(display);
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
245 resize();
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
246 break;
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
247 case CACA_EVENT_QUIT:
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
248 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
249 break;
34274
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
250 case CACA_EVENT_MOUSE_MOTION:
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
251 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
252 break;
34274
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
253 case CACA_EVENT_MOUSE_PRESS:
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
254 if (!vo_nomouse_input)
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
255 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
256 break;
34274
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
257 case CACA_EVENT_MOUSE_RELEASE:
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);
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_KEY_PRESS:
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
262 {
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
263 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
264 int mpkey = lookup_keymap_table(keysym_map, key);
34274
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
265 const char *msg_name;
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
266
34275
4d92281ea02b Use lookup_keymap_table instead of a large number of switch cases.
reimar
parents: 34274
diff changeset
267 if (mpkey)
4d92281ea02b Use lookup_keymap_table instead of a large number of switch cases.
reimar
parents: 34274
diff changeset
268 mplayer_put_key(mpkey);
4d92281ea02b Use lookup_keymap_table instead of a large number of switch cases.
reimar
parents: 34274
diff changeset
269 else
34274
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
270 switch (key) {
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
271 case 'd':
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
272 case 'D':
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
273 /* Toggle dithering algorithm */
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
274 set_next_str(caca_get_dither_algorithm_list(dither), &dither_algo, &msg_name);
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
275 caca_set_dither_algorithm(dither, dither_algo);
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
276 osdmessage(MESSAGE_DURATION, "Using %s", msg_name);
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
277 break;
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
278
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
279 case 'a':
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
280 case 'A':
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
281 /* Toggle antialiasing method */
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
282 set_next_str(caca_get_dither_antialias_list(dither), &dither_antialias, &msg_name);
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
283 caca_set_dither_antialias(dither, dither_antialias);
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
284 osdmessage(MESSAGE_DURATION, "Using %s", msg_name);
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
285 break;
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
286
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
287 case 'h':
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
288 case 'H':
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
289 /* Toggle charset method */
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
290 set_next_str(caca_get_dither_charset_list(dither), &dither_charset, &msg_name);
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
291 caca_set_dither_charset(dither, dither_charset);
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
292 osdmessage(MESSAGE_DURATION, "Using %s", msg_name);
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
293 break;
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
294
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
295 case 'c':
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
296 case 'C':
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
297 /* Toggle color method */
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
298 set_next_str(caca_get_dither_color_list(dither), &dither_color, &msg_name);
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
299 caca_set_dither_color(dither, dither_color);
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
300 osdmessage(MESSAGE_DURATION, "Using %s", msg_name);
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
301 break;
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
302
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
303 default:
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
304 if (key <= 255)
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
305 mplayer_put_key(key);
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
306 break;
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
307 }
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
308 }
34274
38d22d3f56fe Reindent.
reimar
parents: 34273
diff changeset
309 }
34273
3e8cb5ef9ac7 caca: process all pending events instead of exactly one per check_events.
reimar
parents: 34272
diff changeset
310 }
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
311 }
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
312
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
313 static void uninit(void)
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
314 {
34250
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
315 caca_free_dither(dither);
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
316 dither = NULL;
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
317 caca_free_display(display);
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
318 caca_free_canvas(canvas);
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
319 }
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
320
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
321
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
322 static void draw_osd(void)
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 if (vo_osd_progbar_type != -1)
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
325 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
326 sub_osd_names[vo_osd_progbar_type], "");
12129
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
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
329 static int preinit(const char *arg)
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
330 {
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
331 if (arg) {
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
332 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
333 return ENOSYS;
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
334 }
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
335
34250
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
336 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
337 if (canvas == NULL) {
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
338 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
339 return ENOSYS;
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
340 }
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
341
34250
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
342 display = caca_create_display(canvas);
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
343
34250
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
344 if (display == NULL) {
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
345 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
346 caca_free_canvas(canvas);
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
347 return ENOSYS;
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
348 }
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
349
94905e65a560 vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
diego
parents: 34249
diff changeset
350 caca_set_display_title(display, "MPlayer");
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
351
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
352 return 0;
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
353 }
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
354
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
355 static int query_format(uint32_t format)
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
356 {
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
357 if (format == IMGFMT_BGR24)
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
358 return VFCAP_OSD | VFCAP_CSP_SUPPORTED;
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
359
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
360 return 0;
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
361 }
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
362
33305
ddb45e9443ec Remove the variable arguments from the libvo control() functions.
iive
parents: 32467
diff changeset
363 static int control(uint32_t request, void *data)
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
364 {
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
365 switch (request) {
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
366 case VOCTRL_QUERY_FORMAT:
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
367 return query_format(*((uint32_t *)data));
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
368 default:
34249
edee96cf6d71 vo_caca: reformat and prettyprint as K&R, shorten some lines
diego
parents: 33305
diff changeset
369 return VO_NOTIMPL;
12129
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
370 }
c1aff21286dd libcaca video output driver by Howell Tam
alex
parents:
diff changeset
371 }