Mercurial > mplayer.hg
annotate libvo/vo_cvidix.c @ 23659:f15f95c2671a
Fix "control reaches end of non-void function" warnings.
author | diego |
---|---|
date | Wed, 27 Jun 2007 13:04:29 +0000 |
parents | d27e00bb61b8 |
children | 3aee342be929 |
rev | line source |
---|---|
10979 | 1 /* |
11232 | 2 VIDIX accelerated overlay on (black) background |
3 | |
10979 | 4 should work on any OS |
5 | |
6 (C) Sascha Sommer | |
7 | |
8 | |
9 */ | |
10 | |
11 #include <stdio.h> | |
12 #include <stdlib.h> | |
13 #include <string.h> | |
14 #include <math.h> | |
15 #include <errno.h> | |
16 | |
17 #include "config.h" | |
18 #include "video_out.h" | |
19 #include "video_out_internal.h" | |
11232 | 20 #include "aspect.h" |
21 #include "geometry.h" | |
10979 | 22 |
23 #include "mp_msg.h" | |
24 | |
25 #include "vosub_vidix.h" | |
13787
e047e70a9767
Handle "xxx.h" vs "../xxx.h" include paths in a consistent way.
diego
parents:
13360
diff
changeset
|
26 #include "vidix/vidixlib.h" |
10979 | 27 |
28 | |
29 static vo_info_t info = { | |
12783 | 30 "console VIDIX", |
11017 | 31 "cvidix", |
10979 | 32 "Sascha Sommer", |
33 "" | |
34 }; | |
35 | |
11017 | 36 LIBVO_EXTERN(cvidix) |
10979 | 37 |
38 #define UNUSED(x) ((void)(x)) /* Removes warning about unused arguments */ | |
39 | |
40 /* VIDIX related */ | |
41 static char *vidix_name; | |
11232 | 42 static uint32_t swidth,sheight,sformat; |
13360 | 43 /// center video only when screenw & height are set |
44 static uint32_t center=0; | |
10979 | 45 static vidix_grkey_t gr_key; |
11232 | 46 |
47 | |
17566
f580a7755ac5
Patch by Stefan Huehner / stefan % huehner ! org \
rathann
parents:
16388
diff
changeset
|
48 static uint32_t setup_vidix(void){ |
11232 | 49 int x=vo_dx,y=vo_dy; |
50 aspect(&vo_dwidth,&vo_dheight,vo_fs ? A_ZOOM : A_NOZOOM); | |
13360 | 51 if(vo_fs || center){ |
11232 | 52 if(vo_dwidth <= vo_screenwidth)x = (vo_screenwidth - vo_dwidth)/2; |
53 else x=0; | |
54 if(vo_dheight <= vo_screenheight)y = (vo_screenheight - vo_dheight)/2; | |
55 else y=0; | |
56 } | |
57 if(vo_config_count)vidix_stop(); | |
58 if(vidix_init(swidth, sheight, x, y, vo_dwidth, vo_dheight, sformat, 32, vo_screenwidth,vo_screenheight)){ | |
59 mp_msg(MSGT_VO, MSGL_FATAL, "Can't setup VIDIX driver: %s\n", strerror(errno)); | |
60 return 1; | |
61 } | |
10979 | 62 vidix_start(); |
63 if(vidix_grkey_support()){ | |
64 vidix_grkey_get(&gr_key); | |
65 gr_key.key_op = KEYS_PUT; | |
11232 | 66 if (!vo_fs && !(vo_colorkey & 0xff000000)){ |
67 gr_key.ckey.op = CKEY_TRUE; | |
68 gr_key.ckey.red = (vo_colorkey & 0x00FF0000) >> 16; | |
69 gr_key.ckey.green = (vo_colorkey & 0x0000FF00) >> 8; | |
70 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
|
71 } |
11232 | 72 else gr_key.ckey.op = CKEY_FALSE; |
10979 | 73 vidix_grkey_set(&gr_key); |
11232 | 74 } |
10979 | 75 return 0; |
76 } | |
77 | |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15212
diff
changeset
|
78 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
|
79 vo_fs = flags & VOFLAG_FULLSCREEN; |
13360 | 80 if(!vo_config_count){ |
14041
928b03a98062
10l initial patch by Oded Shimon <ods15 at ods15.dyndns.org>
faust3
parents:
13787
diff
changeset
|
81 if(vo_screenwidth && vo_screenheight){ |
928b03a98062
10l initial patch by Oded Shimon <ods15 at ods15.dyndns.org>
faust3
parents:
13787
diff
changeset
|
82 if(!vo_geometry)center=1; |
928b03a98062
10l initial patch by Oded Shimon <ods15 at ods15.dyndns.org>
faust3
parents:
13787
diff
changeset
|
83 } |
13360 | 84 else mp_msg(MSGT_VO, MSGL_WARN, "vo_cvidix: warn: screenwidth and height not set assuming 640x480\n"); |
85 } | |
11232 | 86 if(!vo_screenwidth)vo_screenwidth=640; |
87 if(!vo_screenheight)vo_screenheight=480; | |
88 swidth = width; | |
89 sheight = height; | |
90 sformat = format; | |
91 vo_dwidth=d_width; | |
92 vo_dheight=d_height; | |
93 aspect_save_orig(width,height); | |
94 aspect_save_prescale(d_width,d_height); | |
95 aspect_save_screenres(vo_screenwidth,vo_screenheight); | |
96 if(!vo_geometry){ | |
97 vo_dx=0; | |
98 vo_dy=0; | |
99 } | |
100 else geometry(&vo_dx, &vo_dy, &vo_dwidth, &vo_dheight,vo_screenwidth,vo_screenheight); | |
101 return setup_vidix(); | |
102 } | |
103 | |
10979 | 104 static void check_events(void){ |
105 } | |
106 | |
107 /* draw_osd, flip_page, draw_slice, draw_frame should be | |
108 overwritten with vidix functions (vosub_vidix.c) */ | |
109 static void draw_osd(void){ | |
11019 | 110 mp_msg(MSGT_VO, MSGL_FATAL, "vo_cvidix: error: didn't use vidix draw_osd!\n"); |
10979 | 111 return; |
112 } | |
113 | |
114 static void flip_page(void){ | |
11019 | 115 mp_msg(MSGT_VO, MSGL_FATAL, "vo_cvidix: error: didn't use vidix flip_page!\n"); |
10979 | 116 return; |
117 } | |
118 | |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15212
diff
changeset
|
119 static int draw_slice(uint8_t *src[], int stride[],int w, int h, int x, int y){ |
10979 | 120 UNUSED(src); |
121 UNUSED(stride); | |
122 UNUSED(w); | |
123 UNUSED(h); | |
124 UNUSED(x); | |
125 UNUSED(y); | |
11019 | 126 mp_msg(MSGT_VO, MSGL_FATAL, "vo_cvidix: error: didn't use vidix draw_slice!\n"); |
10979 | 127 return -1; |
128 } | |
129 | |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15212
diff
changeset
|
130 static int draw_frame(uint8_t *src[]){ |
10979 | 131 UNUSED(src); |
11019 | 132 mp_msg(MSGT_VO, MSGL_FATAL, "vo_cvidix: error: didn't use vidix draw_frame!\n"); |
10979 | 133 return -1; |
134 } | |
135 | |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15212
diff
changeset
|
136 static int query_format(uint32_t format){ |
10979 | 137 return(vidix_query_fourcc(format)); |
138 } | |
139 | |
140 static void uninit(void){ | |
141 if(!vo_config_count) return; | |
142 vidix_term(); | |
143 if(vidix_name){ | |
144 free(vidix_name); | |
145 vidix_name = NULL; | |
146 } | |
147 } | |
148 | |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15212
diff
changeset
|
149 static int preinit(const char *arg){ |
10979 | 150 if(arg)vidix_name = strdup(arg); |
151 else { | |
11462 | 152 mp_msg(MSGT_VO, MSGL_INFO, "vo_cvidix: No vidix driver name provided, probing available ones (-v option for details)!\n"); |
10979 | 153 vidix_name = NULL; |
154 } | |
11019 | 155 if(vidix_preinit(vidix_name, &video_out_cvidix))return 1; |
10979 | 156 return 0; |
157 } | |
158 | |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15212
diff
changeset
|
159 static int control(uint32_t request, void *data, ...){ |
10979 | 160 switch (request) { |
161 case VOCTRL_QUERY_FORMAT: | |
162 return query_format(*((uint32_t*)data)); | |
11232 | 163 case VOCTRL_FULLSCREEN: |
164 if(vo_fs)vo_fs=0; | |
165 else vo_fs=1; | |
166 setup_vidix(); | |
167 return VO_TRUE; | |
16388 | 168 case VOCTRL_SET_EQUALIZER: |
169 { | |
170 va_list ap; | |
171 int value; | |
172 va_start(ap, data); | |
173 value = va_arg(ap, int); | |
174 va_end(ap); | |
20110 | 175 return vidix_control(request, data, value); |
16388 | 176 } |
177 case VOCTRL_GET_EQUALIZER: | |
178 { | |
179 va_list ap; | |
180 int *value; | |
181 va_start(ap, data); | |
182 value = va_arg(ap, int *); | |
183 va_end(ap); | |
184 return vidix_control(request, data, value); | |
185 } | |
11232 | 186 } |
10979 | 187 return vidix_control(request, data); |
188 } |