annotate libvo/vo_matrixview.c @ 36960:1911049add93

Add definition of a default volume. This is just in (the unlikely) case a skin won't define evSetVolume.
author ib
date Mon, 24 Mar 2014 10:51:16 +0000
parents 5d3f93051de9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
30140
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
1 /*
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
2 * MatrixView video output driver for MPlayer
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
3 *
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
4 * by Pigeon <pigeon at pigeond.net>
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
5 *
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
6 * Based on MatrixView the screensaver from http://rss-glx.sf.net/
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
7 *
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
8 * This file is part of MPlayer.
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
9 *
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
10 * MPlayer is free software; you can redistribute it and/or modify
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
11 * it under the terms of the GNU General Public License as published by
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
12 * the Free Software Foundation; either version 2 of the License, or
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
13 * (at your option) any later version.
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
14 *
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
15 * MPlayer is distributed in the hope that it will be useful,
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
18 * GNU General Public License for more details.
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
19 *
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
20 * You should have received a copy of the GNU General Public License along
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
21 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
23 */
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
24
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
25 #include "config.h"
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
26
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
27 #include <stdint.h>
35903
389d43c448b3 Add missing strings.h #includes for strcasecmp().
diego
parents: 33305
diff changeset
28 #include <strings.h>
30140
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
29
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
30 #include "mp_msg.h"
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
31 #include "subopt-helper.h"
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
32 #include "video_out.h"
36517
5d3f93051de9 Remove empty draw_slice and draw_frame stubs.
reimar
parents: 36242
diff changeset
33 #define NO_DRAW_FRAME
30140
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
34 #include "video_out_internal.h"
33301
899d817e56fc Implement control() VOCTRL_SET/GET_EQUALIZER using a vf_equalize struct,
iive
parents: 30925
diff changeset
35 #include "libmpcodecs/vf.h"
30140
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
36 #include "gl_common.h"
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
37 #include "libswscale/swscale.h"
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
38 #include "libmpcodecs/vf_scale.h"
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
39 #include "osdep/timer.h"
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
40
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
41 #include "matrixview.h"
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
42
30153
4e0755091f55 prettyprinting cosmetics
diego
parents: 30140
diff changeset
43 static const vo_info_t info = {
30140
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
44 "MatrixView (OpenGL)",
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
45 "matrixview",
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
46 "Pigeon <pigeon@pigeond.net>",
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
47 "Based on MatrixView from rss-glx.sf.net"
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
48 };
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
49
30925
f8939d5b14b5 Mark some more LIBVO_EXTERN declarations as const where possible.
reimar
parents: 30633
diff changeset
50 const LIBVO_EXTERN(matrixview)
30140
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
51
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
52 static MPGLContext glctx;
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
53
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
54 static int eq_contrast;
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
55 static int eq_brightness;
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
56 static uint32_t image_width;
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
57 static uint32_t image_height;
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
58 static uint32_t image_format;
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
59 static struct SwsContext *sws;
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
60
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
61 static uint8_t *map_image[MP_MAX_PLANES];
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
62 static int map_stride[MP_MAX_PLANES];
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
63
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
64 #define DEFAULT_MATRIX_ROWS 96
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
65 #define DEFAULT_MATRIX_COLS 128
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
66 static int matrix_rows;
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
67 static int matrix_cols;
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
68
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
69 #define DEFAULT_CONTRAST 0.90f
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
70 #define CONTRAST_MULTIPLIER 0.02f
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
71
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
72 #define DEFAULT_BRIGHTNESS 1.0f
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
73 #define BRIGHTNESS_MULTIPLIER 0.02f
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
74
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
75
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
76 static void contrast_set(int value)
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
77 {
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
78 float contrast = value * CONTRAST_MULTIPLIER + DEFAULT_CONTRAST;
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
79 eq_contrast = value;
30153
4e0755091f55 prettyprinting cosmetics
diego
parents: 30140
diff changeset
80 if (contrast < 0)
4e0755091f55 prettyprinting cosmetics
diego
parents: 30140
diff changeset
81 contrast = 0;
30140
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
82 matrixview_contrast_set(contrast);
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
83 }
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
84
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
85
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
86 static void brightness_set(int value)
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
87 {
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
88 float brightness = value * BRIGHTNESS_MULTIPLIER + DEFAULT_BRIGHTNESS;
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
89 eq_brightness = value;
30153
4e0755091f55 prettyprinting cosmetics
diego
parents: 30140
diff changeset
90 if (brightness < 0)
4e0755091f55 prettyprinting cosmetics
diego
parents: 30140
diff changeset
91 brightness = 0;
30140
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
92 matrixview_brightness_set(brightness);
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
93 }
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
94
36229
430a2b6238bb matrixview: redraw image while scaling on OSX.
reimar
parents: 36227
diff changeset
95 static void resize(void)
430a2b6238bb matrixview: redraw image while scaling on OSX.
reimar
parents: 36227
diff changeset
96 {
430a2b6238bb matrixview: redraw image while scaling on OSX.
reimar
parents: 36227
diff changeset
97 matrixview_reshape(vo_dwidth, vo_dheight);
430a2b6238bb matrixview: redraw image while scaling on OSX.
reimar
parents: 36227
diff changeset
98 flip_page();
430a2b6238bb matrixview: redraw image while scaling on OSX.
reimar
parents: 36227
diff changeset
99 }
30140
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
100
30153
4e0755091f55 prettyprinting cosmetics
diego
parents: 30140
diff changeset
101 static int config(uint32_t width, uint32_t height,
4e0755091f55 prettyprinting cosmetics
diego
parents: 30140
diff changeset
102 uint32_t d_width, uint32_t d_height,
4e0755091f55 prettyprinting cosmetics
diego
parents: 30140
diff changeset
103 uint32_t flags, char *title, uint32_t format)
30140
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
104 {
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
105 image_height = height;
30153
4e0755091f55 prettyprinting cosmetics
diego
parents: 30140
diff changeset
106 image_width = width;
30140
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
107 image_format = format;
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
108
36219
673719da1a92 Extract window creation code to common file.
reimar
parents: 35903
diff changeset
109 if (mpglcontext_create_window(&glctx, d_width, d_height, flags, title) < 0)
30153
4e0755091f55 prettyprinting cosmetics
diego
parents: 30140
diff changeset
110 return -1;
30140
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
111 if (glctx.setGlWindow(&glctx) == SET_WINDOW_FAILED)
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
112 return -1;
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
113
30153
4e0755091f55 prettyprinting cosmetics
diego
parents: 30140
diff changeset
114 if (sws)
30140
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
115 sws_freeContext(sws);
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
116
30153
4e0755091f55 prettyprinting cosmetics
diego
parents: 30140
diff changeset
117 sws = sws_getContextFromCmdLine(image_width, image_height, image_format,
4e0755091f55 prettyprinting cosmetics
diego
parents: 30140
diff changeset
118 matrix_cols, matrix_rows, IMGFMT_Y8);
30140
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
119 if (!sws) {
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
120 mp_msg(MSGT_VO, MSGL_ERR, "[matrixview] Cannot create SwsContext context\n");
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
121 return -1;
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
122 }
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
123
30153
4e0755091f55 prettyprinting cosmetics
diego
parents: 30140
diff changeset
124 if (!map_image[0])
30140
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
125 map_image[0] = calloc(matrix_cols, matrix_rows);
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
126
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
127 map_stride[0] = matrix_cols;
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
128
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
129 matrixview_init(vo_dwidth, vo_dheight);
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
130 matrixview_matrix_resize(matrix_cols, matrix_rows);
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
131
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
132 contrast_set(eq_contrast);
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
133 brightness_set(eq_brightness);
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
134 matrixview_reshape(vo_dwidth, vo_dheight);
36229
430a2b6238bb matrixview: redraw image while scaling on OSX.
reimar
parents: 36227
diff changeset
135
430a2b6238bb matrixview: redraw image while scaling on OSX.
reimar
parents: 36227
diff changeset
136 #ifdef CONFIG_GL_OSX
430a2b6238bb matrixview: redraw image while scaling on OSX.
reimar
parents: 36227
diff changeset
137 vo_osx_redraw_func = resize;
430a2b6238bb matrixview: redraw image while scaling on OSX.
reimar
parents: 36227
diff changeset
138 #endif
30140
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
139 return 0;
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
140 }
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
141
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
142
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
143 static void check_events(void)
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
144 {
30153
4e0755091f55 prettyprinting cosmetics
diego
parents: 30140
diff changeset
145 int e = glctx.check_events();
4e0755091f55 prettyprinting cosmetics
diego
parents: 30140
diff changeset
146 if (e & VO_EVENT_RESIZE) {
36229
430a2b6238bb matrixview: redraw image while scaling on OSX.
reimar
parents: 36227
diff changeset
147 resize();
36230
a1e1633fd45b Redraw on expose even if not paused.
reimar
parents: 36229
diff changeset
148 } else if (e & VO_EVENT_EXPOSE)
30153
4e0755091f55 prettyprinting cosmetics
diego
parents: 30140
diff changeset
149 flip_page();
30140
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
150 }
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
151
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
152
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
153 static void draw_osd(void)
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
154 {
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
155 return;
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
156 }
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
157
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
158
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
159 static void flip_page(void)
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
160 {
36227
f73711af11ae Remove unused arguments, add "const"
reimar
parents: 36226
diff changeset
161 matrixview_draw(GetTimer(), map_image[0]);
36226
68cbead2e8a5 Matrixview: fix getting only blank screen on OSX.
reimar
parents: 36219
diff changeset
162 // Needed at least on PPC Mac Mini on OSX. Should not hurt
68cbead2e8a5 Matrixview: fix getting only blank screen on OSX.
reimar
parents: 36219
diff changeset
163 // much to do always.
68cbead2e8a5 Matrixview: fix getting only blank screen on OSX.
reimar
parents: 36219
diff changeset
164 mpglFlush();
30140
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
165 glctx.swapGlBuffers(&glctx);
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
166 }
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
167
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
168
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
169
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
170 static int draw_slice(uint8_t *src[], int stride[], int w, int h, int x, int y)
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
171 {
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
172 sws_scale(sws, src, stride, y, h, map_image, map_stride);
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
173 return 0;
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
174 }
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
175
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
176
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
177 static int query_format(uint32_t format)
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
178 {
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
179 int caps = VFCAP_CSP_SUPPORTED | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN | VFCAP_ACCEPT_STRIDE;
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
180
30153
4e0755091f55 prettyprinting cosmetics
diego
parents: 30140
diff changeset
181 switch (format) {
4e0755091f55 prettyprinting cosmetics
diego
parents: 30140
diff changeset
182 case IMGFMT_YV12:
4e0755091f55 prettyprinting cosmetics
diego
parents: 30140
diff changeset
183 case IMGFMT_BGR32:
4e0755091f55 prettyprinting cosmetics
diego
parents: 30140
diff changeset
184 case IMGFMT_BGR24:
4e0755091f55 prettyprinting cosmetics
diego
parents: 30140
diff changeset
185 case IMGFMT_BGR16:
4e0755091f55 prettyprinting cosmetics
diego
parents: 30140
diff changeset
186 case IMGFMT_BGR15:
4e0755091f55 prettyprinting cosmetics
diego
parents: 30140
diff changeset
187 case IMGFMT_RGB32:
4e0755091f55 prettyprinting cosmetics
diego
parents: 30140
diff changeset
188 case IMGFMT_RGB24:
4e0755091f55 prettyprinting cosmetics
diego
parents: 30140
diff changeset
189 return caps;
4e0755091f55 prettyprinting cosmetics
diego
parents: 30140
diff changeset
190 default:
4e0755091f55 prettyprinting cosmetics
diego
parents: 30140
diff changeset
191 break;
30140
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
192 }
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
193
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
194 return 0;
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
195 }
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
196
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
197
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
198 static void uninit(void)
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
199 {
30153
4e0755091f55 prettyprinting cosmetics
diego
parents: 30140
diff changeset
200 if (!vo_config_count)
4e0755091f55 prettyprinting cosmetics
diego
parents: 30140
diff changeset
201 return;
30140
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
202 uninit_mpglcontext(&glctx);
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
203 free(map_image[0]);
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
204 map_image[0] = NULL;
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
205 sws_freeContext(sws);
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
206 sws = NULL;
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
207 }
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
208
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
209
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
210 static const opt_t subopts[] =
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
211 {
30153
4e0755091f55 prettyprinting cosmetics
diego
parents: 30140
diff changeset
212 { "rows", OPT_ARG_INT, &matrix_rows, int_pos },
4e0755091f55 prettyprinting cosmetics
diego
parents: 30140
diff changeset
213 { "cols", OPT_ARG_INT, &matrix_cols, int_pos },
30140
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
214 { NULL }
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
215 };
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
216
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
217
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
218 static int preinit(const char *arg)
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
219 {
36219
673719da1a92 Extract window creation code to common file.
reimar
parents: 35903
diff changeset
220 enum MPGLType gltype = GLTYPE_AUTO;
30153
4e0755091f55 prettyprinting cosmetics
diego
parents: 30140
diff changeset
221 if (!init_mpglcontext(&glctx, gltype))
4e0755091f55 prettyprinting cosmetics
diego
parents: 30140
diff changeset
222 return -1;
30140
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
223
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
224 matrix_rows = DEFAULT_MATRIX_ROWS;
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
225 matrix_cols = DEFAULT_MATRIX_COLS;
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
226
30153
4e0755091f55 prettyprinting cosmetics
diego
parents: 30140
diff changeset
227 if (subopt_parse(arg, subopts) != 0) {
30140
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
228 mp_msg(MSGT_VO, MSGL_FATAL,
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
229 "\n-vo matrixview command line help:\n"
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
230 "Example: mplayer -vo matrixview:cols=320:rows=240\n"
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
231 "\n"
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
232 "Options:\n"
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
233 "\n"
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
234 " cols=<12-320>\n"
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
235 " Specify the number of columns of the matrix view, default %d\n"
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
236 "\n"
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
237 " rows=<12-240>\n"
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
238 " Specify the number of rows of the matrix view, default %d\n"
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
239 "\n"
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
240 ,
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
241 DEFAULT_MATRIX_COLS, DEFAULT_MATRIX_ROWS
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
242 );
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
243 return -1;
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
244 }
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
245
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
246 return 0;
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
247 }
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
248
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
249
33305
ddb45e9443ec Remove the variable arguments from the libvo control() functions.
iive
parents: 33301
diff changeset
250 static int control(uint32_t request, void *data)
30140
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
251 {
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
252 switch (request) {
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
253 case VOCTRL_QUERY_FORMAT:
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
254 return query_format(*(uint32_t*)data);
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
255 case VOCTRL_ONTOP:
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
256 glctx.ontop();
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
257 return VO_TRUE;
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
258 case VOCTRL_FULLSCREEN:
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
259 glctx.fullscreen();
36229
430a2b6238bb matrixview: redraw image while scaling on OSX.
reimar
parents: 36227
diff changeset
260 resize();
30140
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
261 return VO_TRUE;
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
262 case VOCTRL_BORDER:
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
263 glctx.border();
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
264 return VO_TRUE;
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
265 case VOCTRL_GET_EQUALIZER:
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
266 {
33301
899d817e56fc Implement control() VOCTRL_SET/GET_EQUALIZER using a vf_equalize struct,
iive
parents: 30925
diff changeset
267 vf_equalizer_t *eq=data;
899d817e56fc Implement control() VOCTRL_SET/GET_EQUALIZER using a vf_equalize struct,
iive
parents: 30925
diff changeset
268
899d817e56fc Implement control() VOCTRL_SET/GET_EQUALIZER using a vf_equalize struct,
iive
parents: 30925
diff changeset
269 if (strcasecmp(eq->item, "contrast") == 0) {
899d817e56fc Implement control() VOCTRL_SET/GET_EQUALIZER using a vf_equalize struct,
iive
parents: 30925
diff changeset
270 eq->value = eq_contrast;
899d817e56fc Implement control() VOCTRL_SET/GET_EQUALIZER using a vf_equalize struct,
iive
parents: 30925
diff changeset
271 } else if (strcasecmp(eq->item, "brightness") == 0) {
899d817e56fc Implement control() VOCTRL_SET/GET_EQUALIZER using a vf_equalize struct,
iive
parents: 30925
diff changeset
272 eq->value = eq_brightness;
30140
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
273 }
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
274 }
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
275 return VO_TRUE;
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
276 case VOCTRL_SET_EQUALIZER:
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
277 {
33301
899d817e56fc Implement control() VOCTRL_SET/GET_EQUALIZER using a vf_equalize struct,
iive
parents: 30925
diff changeset
278 vf_equalizer_t *eq=data;
899d817e56fc Implement control() VOCTRL_SET/GET_EQUALIZER using a vf_equalize struct,
iive
parents: 30925
diff changeset
279 if (strcasecmp(eq->item, "contrast") == 0) {
899d817e56fc Implement control() VOCTRL_SET/GET_EQUALIZER using a vf_equalize struct,
iive
parents: 30925
diff changeset
280 contrast_set(eq->value);
899d817e56fc Implement control() VOCTRL_SET/GET_EQUALIZER using a vf_equalize struct,
iive
parents: 30925
diff changeset
281 } else if (strcasecmp(eq->item, "brightness") == 0) {
899d817e56fc Implement control() VOCTRL_SET/GET_EQUALIZER using a vf_equalize struct,
iive
parents: 30925
diff changeset
282 brightness_set(eq->value);
30140
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
283 }
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
284 }
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
285 return VO_TRUE;
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
286 case VOCTRL_UPDATE_SCREENINFO:
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
287 glctx.update_xinerama_info();
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
288 return VO_TRUE;
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
289 }
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
290 return VO_NOTIMPL;
12a49e9ca30e Finally add matrixview vo.
reimar
parents:
diff changeset
291 }