Mercurial > mplayer.hg
annotate libvo/vo_cvidix.c @ 12019:6ede5366bc47
fix compilation with sdl on mingw patch by Nehal <nehalmistry at gmx.net>
author | faust3 |
---|---|
date | Sat, 13 Mar 2004 16:25:08 +0000 |
parents | 2e367138d4b5 |
children | c857885bf049 |
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" | |
26 #include "../vidix/vidixlib.h" | |
27 | |
28 | |
29 static vo_info_t info = { | |
30 "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; |
10979 | 43 |
44 static vidix_grkey_t gr_key; | |
11232 | 45 |
46 | |
47 static uint32_t setup_vidix(){ | |
48 int x=vo_dx,y=vo_dy; | |
49 aspect(&vo_dwidth,&vo_dheight,vo_fs ? A_ZOOM : A_NOZOOM); | |
50 if(vo_fs){ | |
51 if(vo_dwidth <= vo_screenwidth)x = (vo_screenwidth - vo_dwidth)/2; | |
52 else x=0; | |
53 if(vo_dheight <= vo_screenheight)y = (vo_screenheight - vo_dheight)/2; | |
54 else y=0; | |
55 } | |
56 if(vo_config_count)vidix_stop(); | |
57 if(vidix_init(swidth, sheight, x, y, vo_dwidth, vo_dheight, sformat, 32, vo_screenwidth,vo_screenheight)){ | |
58 mp_msg(MSGT_VO, MSGL_FATAL, "Can't setup VIDIX driver: %s\n", strerror(errno)); | |
59 return 1; | |
60 } | |
10979 | 61 vidix_start(); |
62 if(vidix_grkey_support()){ | |
63 vidix_grkey_get(&gr_key); | |
64 gr_key.key_op = KEYS_PUT; | |
11232 | 65 if (!vo_fs && !(vo_colorkey & 0xff000000)){ |
66 gr_key.ckey.op = CKEY_TRUE; | |
67 gr_key.ckey.red = (vo_colorkey & 0x00FF0000) >> 16; | |
68 gr_key.ckey.green = (vo_colorkey & 0x0000FF00) >> 8; | |
69 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
|
70 } |
11232 | 71 else gr_key.ckey.op = CKEY_FALSE; |
10979 | 72 vidix_grkey_set(&gr_key); |
11232 | 73 } |
10979 | 74 return 0; |
75 } | |
76 | |
11232 | 77 static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width,uint32_t d_height, uint32_t flags, char *title, uint32_t format){ |
78 vo_fs = flags & 0x01; | |
79 if(!vo_screenwidth)vo_screenwidth=640; | |
80 if(!vo_screenheight)vo_screenheight=480; | |
81 swidth = width; | |
82 sheight = height; | |
83 sformat = format; | |
84 vo_dwidth=d_width; | |
85 vo_dheight=d_height; | |
86 aspect_save_orig(width,height); | |
87 aspect_save_prescale(d_width,d_height); | |
88 aspect_save_screenres(vo_screenwidth,vo_screenheight); | |
89 if(!vo_geometry){ | |
90 vo_dx=0; | |
91 vo_dy=0; | |
92 } | |
93 else geometry(&vo_dx, &vo_dy, &vo_dwidth, &vo_dheight,vo_screenwidth,vo_screenheight); | |
94 return setup_vidix(); | |
95 } | |
96 | |
10979 | 97 static void check_events(void){ |
98 } | |
99 | |
100 /* draw_osd, flip_page, draw_slice, draw_frame should be | |
101 overwritten with vidix functions (vosub_vidix.c) */ | |
102 static void draw_osd(void){ | |
11019 | 103 mp_msg(MSGT_VO, MSGL_FATAL, "vo_cvidix: error: didn't use vidix draw_osd!\n"); |
10979 | 104 return; |
105 } | |
106 | |
107 static void flip_page(void){ | |
11019 | 108 mp_msg(MSGT_VO, MSGL_FATAL, "vo_cvidix: error: didn't use vidix flip_page!\n"); |
10979 | 109 return; |
110 } | |
111 | |
112 static uint32_t draw_slice(uint8_t *src[], int stride[],int w, int h, int x, int y){ | |
113 UNUSED(src); | |
114 UNUSED(stride); | |
115 UNUSED(w); | |
116 UNUSED(h); | |
117 UNUSED(x); | |
118 UNUSED(y); | |
11019 | 119 mp_msg(MSGT_VO, MSGL_FATAL, "vo_cvidix: error: didn't use vidix draw_slice!\n"); |
10979 | 120 return -1; |
121 } | |
122 | |
123 static uint32_t draw_frame(uint8_t *src[]){ | |
124 UNUSED(src); | |
11019 | 125 mp_msg(MSGT_VO, MSGL_FATAL, "vo_cvidix: error: didn't use vidix draw_frame!\n"); |
10979 | 126 return -1; |
127 } | |
128 | |
129 static uint32_t query_format(uint32_t format){ | |
130 return(vidix_query_fourcc(format)); | |
131 } | |
132 | |
133 static void uninit(void){ | |
134 if(!vo_config_count) return; | |
135 vidix_term(); | |
136 if(vidix_name){ | |
137 free(vidix_name); | |
138 vidix_name = NULL; | |
139 } | |
140 } | |
141 | |
142 static uint32_t preinit(const char *arg){ | |
143 if(arg)vidix_name = strdup(arg); | |
144 else { | |
11462 | 145 mp_msg(MSGT_VO, MSGL_INFO, "vo_cvidix: No vidix driver name provided, probing available ones (-v option for details)!\n"); |
10979 | 146 vidix_name = NULL; |
147 } | |
11019 | 148 if(vidix_preinit(vidix_name, &video_out_cvidix))return 1; |
10979 | 149 return 0; |
150 } | |
151 | |
152 static uint32_t control(uint32_t request, void *data, ...){ | |
153 switch (request) { | |
154 case VOCTRL_QUERY_FORMAT: | |
155 return query_format(*((uint32_t*)data)); | |
11232 | 156 case VOCTRL_FULLSCREEN: |
157 if(vo_fs)vo_fs=0; | |
158 else vo_fs=1; | |
159 setup_vidix(); | |
160 return VO_TRUE; | |
161 } | |
10979 | 162 return vidix_control(request, data); |
163 } |