annotate libvo/vo_cvidix.c @ 36868:6104326789e6

Remove unnecessary #includes. The header file contains nothing but #defines. This reverts r36953 and parts of r36954.
author ib
date Sun, 02 Mar 2014 18:44:33 +0000
parents 5d3f93051de9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10979
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
1 /*
28446
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 27768
diff changeset
2 * VIDIX-accelerated overlay on (black) background
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 27768
diff changeset
3 *
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 27768
diff changeset
4 * should work on any OS
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 27768
diff changeset
5 *
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 27768
diff changeset
6 * copyright (C) 2003 Sascha Sommer
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 27768
diff changeset
7 *
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 27768
diff changeset
8 * This file is part of MPlayer.
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 27768
diff changeset
9 *
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 27768
diff changeset
10 * MPlayer is free software; you can redistribute it and/or modify
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 27768
diff changeset
11 * it under the terms of the GNU General Public License as published by
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 27768
diff changeset
12 * the Free Software Foundation; either version 2 of the License, or
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 27768
diff changeset
13 * (at your option) any later version.
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 27768
diff changeset
14 *
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 27768
diff changeset
15 * MPlayer is distributed in the hope that it will be useful,
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 27768
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 27768
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 27768
diff changeset
18 * GNU General Public License for more details.
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 27768
diff changeset
19 *
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 27768
diff changeset
20 * You should have received a copy of the GNU General Public License along
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 27768
diff changeset
21 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 27768
diff changeset
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 27768
diff changeset
23 */
10979
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
24
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
25 #include <stdio.h>
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
26 #include <stdlib.h>
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
27 #include <string.h>
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
28 #include <math.h>
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
29 #include <errno.h>
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
30
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
31 #include "config.h"
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
32 #include "video_out.h"
36517
5d3f93051de9 Remove empty draw_slice and draw_frame stubs.
reimar
parents: 33305
diff changeset
33 #define NO_DRAW_FRAME
10979
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
34 #include "video_out_internal.h"
11232
147a4c50214d added aspect && geometry support
faust3
parents: 11216
diff changeset
35 #include "aspect.h"
147a4c50214d added aspect && geometry support
faust3
parents: 11216
diff changeset
36 #include "geometry.h"
10979
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
37
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
38 #include "mp_msg.h"
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
39
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
40 #include "vosub_vidix.h"
27079
df448e1248b2 remove now useless vidixlib.h file
ben
parents: 26755
diff changeset
41 #include "vidix/vidix.h"
10979
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
42
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
43
25216
3aee342be929 Make vo info structs const
reimar
parents: 20110
diff changeset
44 static const vo_info_t info = {
12783
d4739143fe2e output wording
diego
parents: 12769
diff changeset
45 "console VIDIX",
11017
afdf982f0673 consolevidix -> cvidix
faust3
parents: 10979
diff changeset
46 "cvidix",
10979
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
47 "Sascha Sommer",
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
48 ""
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
49 };
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
50
11017
afdf982f0673 consolevidix -> cvidix
faust3
parents: 10979
diff changeset
51 LIBVO_EXTERN(cvidix)
10979
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
52
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
53 /* VIDIX related */
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
54 static char *vidix_name;
11232
147a4c50214d added aspect && geometry support
faust3
parents: 11216
diff changeset
55 static uint32_t swidth,sheight,sformat;
13360
1f09ac7b543a center the image when screenw & height are set
faust3
parents: 13355
diff changeset
56 /// center video only when screenw & height are set
1f09ac7b543a center the image when screenw & height are set
faust3
parents: 13355
diff changeset
57 static uint32_t center=0;
10979
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
58 static vidix_grkey_t gr_key;
11232
147a4c50214d added aspect && geometry support
faust3
parents: 11216
diff changeset
59
147a4c50214d added aspect && geometry support
faust3
parents: 11216
diff changeset
60
17566
f580a7755ac5 Patch by Stefan Huehner / stefan % huehner ! org \
rathann
parents: 16388
diff changeset
61 static uint32_t setup_vidix(void){
11232
147a4c50214d added aspect && geometry support
faust3
parents: 11216
diff changeset
62 int x=vo_dx,y=vo_dy;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28446
diff changeset
63 aspect(&vo_dwidth,&vo_dheight,vo_fs ? A_ZOOM : A_NOZOOM);
13360
1f09ac7b543a center the image when screenw & height are set
faust3
parents: 13355
diff changeset
64 if(vo_fs || center){
11232
147a4c50214d added aspect && geometry support
faust3
parents: 11216
diff changeset
65 if(vo_dwidth <= vo_screenwidth)x = (vo_screenwidth - vo_dwidth)/2;
147a4c50214d added aspect && geometry support
faust3
parents: 11216
diff changeset
66 else x=0;
147a4c50214d added aspect && geometry support
faust3
parents: 11216
diff changeset
67 if(vo_dheight <= vo_screenheight)y = (vo_screenheight - vo_dheight)/2;
147a4c50214d added aspect && geometry support
faust3
parents: 11216
diff changeset
68 else y=0;
147a4c50214d added aspect && geometry support
faust3
parents: 11216
diff changeset
69 }
147a4c50214d added aspect && geometry support
faust3
parents: 11216
diff changeset
70 if(vo_config_count)vidix_stop();
147a4c50214d added aspect && geometry support
faust3
parents: 11216
diff changeset
71 if(vidix_init(swidth, sheight, x, y, vo_dwidth, vo_dheight, sformat, 32, vo_screenwidth,vo_screenheight)){
147a4c50214d added aspect && geometry support
faust3
parents: 11216
diff changeset
72 mp_msg(MSGT_VO, MSGL_FATAL, "Can't setup VIDIX driver: %s\n", strerror(errno));
147a4c50214d added aspect && geometry support
faust3
parents: 11216
diff changeset
73 return 1;
147a4c50214d added aspect && geometry support
faust3
parents: 11216
diff changeset
74 }
10979
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
75 vidix_start();
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
76 if(vidix_grkey_support()){
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
77 vidix_grkey_get(&gr_key);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
78 gr_key.key_op = KEYS_PUT;
11232
147a4c50214d added aspect && geometry support
faust3
parents: 11216
diff changeset
79 if (!vo_fs && !(vo_colorkey & 0xff000000)){
147a4c50214d added aspect && geometry support
faust3
parents: 11216
diff changeset
80 gr_key.ckey.op = CKEY_TRUE;
147a4c50214d added aspect && geometry support
faust3
parents: 11216
diff changeset
81 gr_key.ckey.red = (vo_colorkey & 0x00FF0000) >> 16;
147a4c50214d added aspect && geometry support
faust3
parents: 11216
diff changeset
82 gr_key.ckey.green = (vo_colorkey & 0x0000FF00) >> 8;
147a4c50214d added aspect && geometry support
faust3
parents: 11216
diff changeset
83 gr_key.ckey.blue = vo_colorkey & 0x000000FF;
11158
85f4534d1edb Colorkeying can be disabled. Fbdev, svga and vesa vidix colorkeying support
alex
parents: 11019
diff changeset
84 }
11232
147a4c50214d added aspect && geometry support
faust3
parents: 11216
diff changeset
85 else gr_key.ckey.op = CKEY_FALSE;
10979
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
86 vidix_grkey_set(&gr_key);
11232
147a4c50214d added aspect && geometry support
faust3
parents: 11216
diff changeset
87 }
10979
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
88 return 0;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
89 }
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
90
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
91 static int config(uint32_t width, uint32_t height, uint32_t d_width,uint32_t d_height, uint32_t flags, char *title, uint32_t format){
15212
05aa13cdf92f replace VO and VF numeric flags with #defined identifiers
henry
parents: 14041
diff changeset
92 vo_fs = flags & VOFLAG_FULLSCREEN;
13360
1f09ac7b543a center the image when screenw & height are set
faust3
parents: 13355
diff changeset
93 if(!vo_config_count){
14041
928b03a98062 10l initial patch by Oded Shimon <ods15 at ods15.dyndns.org>
faust3
parents: 13787
diff changeset
94 if(vo_screenwidth && vo_screenheight){
928b03a98062 10l initial patch by Oded Shimon <ods15 at ods15.dyndns.org>
faust3
parents: 13787
diff changeset
95 if(!vo_geometry)center=1;
928b03a98062 10l initial patch by Oded Shimon <ods15 at ods15.dyndns.org>
faust3
parents: 13787
diff changeset
96 }
13360
1f09ac7b543a center the image when screenw & height are set
faust3
parents: 13355
diff changeset
97 }
27768
ffd1bd7043e6 Improve error message when screen width and height are not set.
diego
parents: 27079
diff changeset
98 if(!vo_screenwidth){
ffd1bd7043e6 Improve error message when screen width and height are not set.
diego
parents: 27079
diff changeset
99 mp_msg(MSGT_VO, MSGL_WARN, "vo_cvidix: Screen width not set (see -screenw), assuming 640 pixels.\n");
ffd1bd7043e6 Improve error message when screen width and height are not set.
diego
parents: 27079
diff changeset
100 vo_screenwidth = 640;
ffd1bd7043e6 Improve error message when screen width and height are not set.
diego
parents: 27079
diff changeset
101 }
ffd1bd7043e6 Improve error message when screen width and height are not set.
diego
parents: 27079
diff changeset
102 if(!vo_screenheight){
ffd1bd7043e6 Improve error message when screen width and height are not set.
diego
parents: 27079
diff changeset
103 mp_msg(MSGT_VO, MSGL_WARN, "vo_cvidix: Screen height not set (see -screenh), assuming 480 pixels.\n");
ffd1bd7043e6 Improve error message when screen width and height are not set.
diego
parents: 27079
diff changeset
104 vo_screenheight = 480;
ffd1bd7043e6 Improve error message when screen width and height are not set.
diego
parents: 27079
diff changeset
105 }
11232
147a4c50214d added aspect && geometry support
faust3
parents: 11216
diff changeset
106 swidth = width;
147a4c50214d added aspect && geometry support
faust3
parents: 11216
diff changeset
107 sheight = height;
147a4c50214d added aspect && geometry support
faust3
parents: 11216
diff changeset
108 sformat = format;
147a4c50214d added aspect && geometry support
faust3
parents: 11216
diff changeset
109 vo_dwidth=d_width;
147a4c50214d added aspect && geometry support
faust3
parents: 11216
diff changeset
110 vo_dheight=d_height;
147a4c50214d added aspect && geometry support
faust3
parents: 11216
diff changeset
111 aspect_save_orig(width,height);
147a4c50214d added aspect && geometry support
faust3
parents: 11216
diff changeset
112 aspect_save_prescale(d_width,d_height);
147a4c50214d added aspect && geometry support
faust3
parents: 11216
diff changeset
113 aspect_save_screenres(vo_screenwidth,vo_screenheight);
147a4c50214d added aspect && geometry support
faust3
parents: 11216
diff changeset
114 if(!vo_geometry){
147a4c50214d added aspect && geometry support
faust3
parents: 11216
diff changeset
115 vo_dx=0;
147a4c50214d added aspect && geometry support
faust3
parents: 11216
diff changeset
116 vo_dy=0;
147a4c50214d added aspect && geometry support
faust3
parents: 11216
diff changeset
117 }
147a4c50214d added aspect && geometry support
faust3
parents: 11216
diff changeset
118 else geometry(&vo_dx, &vo_dy, &vo_dwidth, &vo_dheight,vo_screenwidth,vo_screenheight);
147a4c50214d added aspect && geometry support
faust3
parents: 11216
diff changeset
119 return setup_vidix();
147a4c50214d added aspect && geometry support
faust3
parents: 11216
diff changeset
120 }
147a4c50214d added aspect && geometry support
faust3
parents: 11216
diff changeset
121
10979
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
122 static void check_events(void){
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
123 }
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
124
36517
5d3f93051de9 Remove empty draw_slice and draw_frame stubs.
reimar
parents: 33305
diff changeset
125 /* draw_osd, flip_page, draw_slice should be
10979
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
126 overwritten with vidix functions (vosub_vidix.c) */
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
127 static void draw_osd(void){
11019
69daa4fb97d9 consolevidix -> cvidix
faust3
parents: 11017
diff changeset
128 mp_msg(MSGT_VO, MSGL_FATAL, "vo_cvidix: error: didn't use vidix draw_osd!\n");
10979
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
129 return;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
130 }
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
131
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
132 static void flip_page(void){
11019
69daa4fb97d9 consolevidix -> cvidix
faust3
parents: 11017
diff changeset
133 mp_msg(MSGT_VO, MSGL_FATAL, "vo_cvidix: error: didn't use vidix flip_page!\n");
10979
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
134 return;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
135 }
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
136
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
137 static int draw_slice(uint8_t *src[], int stride[],int w, int h, int x, int y){
11019
69daa4fb97d9 consolevidix -> cvidix
faust3
parents: 11017
diff changeset
138 mp_msg(MSGT_VO, MSGL_FATAL, "vo_cvidix: error: didn't use vidix draw_slice!\n");
10979
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
139 return -1;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
140 }
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
141
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
142 static int query_format(uint32_t format){
26755
46f0b4d34fa1 cosmetics: Remove useless parentheses from from return statements.
diego
parents: 25216
diff changeset
143 return vidix_query_fourcc(format);
10979
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
144 }
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
145
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
146 static void uninit(void){
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
147 if(!vo_config_count) return;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
148 vidix_term();
32537
8fa2f43cb760 Remove most of the NULL pointer check before free all over the code
cboesch
parents: 32336
diff changeset
149 free(vidix_name);
8fa2f43cb760 Remove most of the NULL pointer check before free all over the code
cboesch
parents: 32336
diff changeset
150 vidix_name = NULL;
10979
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
151 }
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
152
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
153 static int preinit(const char *arg){
10979
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
154 if(arg)vidix_name = strdup(arg);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
155 else {
11462
2e367138d4b5 message expanded with hint to use -v option
gabucino
parents: 11232
diff changeset
156 mp_msg(MSGT_VO, MSGL_INFO, "vo_cvidix: No vidix driver name provided, probing available ones (-v option for details)!\n");
10979
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
157 vidix_name = NULL;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
158 }
11019
69daa4fb97d9 consolevidix -> cvidix
faust3
parents: 11017
diff changeset
159 if(vidix_preinit(vidix_name, &video_out_cvidix))return 1;
10979
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
160 return 0;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
161 }
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
162
33305
ddb45e9443ec Remove the variable arguments from the libvo control() functions.
iive
parents: 33301
diff changeset
163 static int control(uint32_t request, void *data){
10979
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
164 switch (request) {
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
165 case VOCTRL_QUERY_FORMAT:
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
166 return query_format(*((uint32_t*)data));
11232
147a4c50214d added aspect && geometry support
faust3
parents: 11216
diff changeset
167 case VOCTRL_FULLSCREEN:
147a4c50214d added aspect && geometry support
faust3
parents: 11216
diff changeset
168 if(vo_fs)vo_fs=0;
147a4c50214d added aspect && geometry support
faust3
parents: 11216
diff changeset
169 else vo_fs=1;
147a4c50214d added aspect && geometry support
faust3
parents: 11216
diff changeset
170 setup_vidix();
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28446
diff changeset
171 return VO_TRUE;
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28446
diff changeset
172 }
10979
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
173 return vidix_control(request, data);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
174 }