Mercurial > mplayer.hg
annotate libvo/vosub_vidix.c @ 5063:be67d073f23b
Added soft clipping for software volume control
author | anders |
---|---|
date | Wed, 13 Mar 2002 12:32:42 +0000 |
parents | 6f28d6ccbd91 |
children | 83e6e16e9670 |
rev | line source |
---|---|
4010 | 1 /* |
2 * vosub_vidix.c | |
3 * | |
4 * Copyright (C) Nick Kurshev <nickols_k@mail.ru> - 2002 | |
4280 | 5 * Copyright (C) Alex Beregszaszi |
4010 | 6 * |
7 * You can redistribute this file under terms and conditions | |
8 * of GNU General Public licence v2. | |
9 * | |
10 * This file contains vidix interface to any mplayer's VO plugin. | |
11 * (Partly based on vesa_lvo.c from mplayer's package) | |
12 */ | |
13 | |
14 #include <inttypes.h> | |
15 #include <sys/ioctl.h> | |
16 #include <unistd.h> | |
17 #include <fcntl.h> | |
18 #include <sys/mman.h> | |
19 #include <stdio.h> | |
20 #include <stdlib.h> | |
21 #include <string.h> | |
4372 | 22 #include <errno.h> |
4010 | 23 |
24 #include "config.h" | |
25 | |
26 #include "vosub_vidix.h" | |
27 #include "../vidix/vidixlib.h" | |
5052
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
28 #include "../postproc/rgb2rgb.h" |
4010 | 29 #include "fastmemcpy.h" |
30 #include "osd.h" | |
31 #include "video_out.h" | |
4991 | 32 #include "../mp_image.h" |
33 | |
4010 | 34 |
4929 | 35 #define NUM_FRAMES VID_PLAY_MAXFRAMES /* Temporary: driver will overwrite it */ |
4010 | 36 #define UNUSED(x) ((void)(x)) /* Removes warning about unused arguments */ |
37 | |
38 static VDL_HANDLE vidix_handler = NULL; | |
39 static uint8_t *vidix_mem = NULL; | |
40 static uint8_t next_frame; | |
5052
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
41 static unsigned image_Bpp,image_height,image_width,src_format,forced_fourcc=0; |
4010 | 42 extern int verbose; |
4372 | 43 static int video_on=0; |
4010 | 44 |
45 static vidix_capability_t vidix_cap; | |
46 static vidix_playback_t vidix_play; | |
47 static vidix_fourcc_t vidix_fourcc; | |
4454 | 48 static vo_functions_t * vo_server; |
4999 | 49 static vidix_yuv_t dstrides; |
4739 | 50 static uint32_t (*server_control)(uint32_t request, void *data, ...); |
51 | |
4372 | 52 static int vidix_get_bes_da(bes_da_t *); |
4379 | 53 static int vidix_get_video_eq(vidix_video_eq_t *info); |
54 static int vidix_set_video_eq(const vidix_video_eq_t *info); | |
55 static int vidix_get_num_fx(unsigned *info); | |
56 static int vidix_get_oem_fx(vidix_oem_fx_t *info); | |
57 static int vidix_set_oem_fx(const vidix_oem_fx_t *info); | |
58 static int vidix_set_deint(const vidix_deinterlace_t *info); | |
4372 | 59 |
60 static void vidix_query_vaa(vo_vaa_t *vaa) | |
61 { | |
62 memset(vaa,0,sizeof(vo_vaa_t)); | |
63 vaa->query_bes_da=vidix_get_bes_da; | |
4379 | 64 vaa->get_video_eq=vidix_get_video_eq; |
65 vaa->set_video_eq=vidix_set_video_eq; | |
66 vaa->get_num_fx=vidix_get_num_fx; | |
67 vaa->get_oem_fx=vidix_get_oem_fx; | |
68 vaa->set_oem_fx=vidix_set_oem_fx; | |
69 vaa->set_deint=vidix_set_deint; | |
4372 | 70 } |
71 | |
4229 | 72 extern int vo_gamma_brightness; |
73 extern int vo_gamma_saturation; | |
74 extern int vo_gamma_contrast; | |
75 extern int vo_gamma_hue; | |
4317 | 76 extern int vo_gamma_red_intensity; |
77 extern int vo_gamma_green_intensity; | |
78 extern int vo_gamma_blue_intensity; | |
4229 | 79 |
4240 | 80 static vidix_video_eq_t vid_eq; |
4229 | 81 |
4234
0ec1d81c8f94
sorry, i really wanted to add vidix_start and stop as int, to detect if something went into the wrong way (also implement check in vo_xvidix)
alex
parents:
4231
diff
changeset
|
82 int vidix_start(void) |
4198
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
83 { |
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
84 int err; |
4270
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
85 if((err=vdlPlaybackOn(vidix_handler))!=0) |
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
86 { |
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
87 printf("vosub_vidix: Can't start playback: %s\n",strerror(err)); |
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
88 return -1; |
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
89 } |
4379 | 90 video_on=1; |
4270
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
91 if (vidix_cap.flags & FLAG_EQUALIZER) |
4229 | 92 { |
4270
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
93 if(verbose > 1) |
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
94 { |
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
95 printf("vosub_vidix: vo_gamma_brightness=%i\n" |
4229 | 96 "vosub_vidix: vo_gamma_saturation=%i\n" |
97 "vosub_vidix: vo_gamma_contrast=%i\n" | |
98 "vosub_vidix: vo_gamma_hue=%i\n" | |
4317 | 99 "vosub_vidix: vo_gamma_red_intensity=%i\n" |
100 "vosub_vidix: vo_gamma_green_intensity=%i\n" | |
101 "vosub_vidix: vo_gamma_blue_intensity=%i\n" | |
4229 | 102 ,vo_gamma_brightness |
103 ,vo_gamma_saturation | |
104 ,vo_gamma_contrast | |
105 ,vo_gamma_hue | |
4317 | 106 ,vo_gamma_red_intensity |
107 ,vo_gamma_green_intensity | |
108 ,vo_gamma_blue_intensity); | |
4270
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
109 } |
4317 | 110 /* To use full set of vid_eq.cap */ |
4379 | 111 if(vidix_get_video_eq(&vid_eq) == 0) |
4317 | 112 { |
113 vid_eq.brightness = vo_gamma_brightness; | |
114 vid_eq.saturation = vo_gamma_saturation; | |
115 vid_eq.contrast = vo_gamma_contrast; | |
116 vid_eq.hue = vo_gamma_hue; | |
117 vid_eq.red_intensity = vo_gamma_red_intensity; | |
118 vid_eq.green_intensity = vo_gamma_green_intensity; | |
119 vid_eq.blue_intensity = vo_gamma_blue_intensity; | |
120 vid_eq.flags = VEQ_FLG_ITU_R_BT_601; | |
4379 | 121 vidix_set_video_eq(&vid_eq); |
4317 | 122 } |
4198
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
123 } |
4234
0ec1d81c8f94
sorry, i really wanted to add vidix_start and stop as int, to detect if something went into the wrong way (also implement check in vo_xvidix)
alex
parents:
4231
diff
changeset
|
124 return 0; |
4198
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
125 } |
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
126 |
4234
0ec1d81c8f94
sorry, i really wanted to add vidix_start and stop as int, to detect if something went into the wrong way (also implement check in vo_xvidix)
alex
parents:
4231
diff
changeset
|
127 int vidix_stop(void) |
4198
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
128 { |
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
129 int err; |
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
130 if((err=vdlPlaybackOff(vidix_handler))!=0) |
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
131 { |
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
132 printf("vosub_vidix: Can't stop playback: %s\n",strerror(err)); |
4234
0ec1d81c8f94
sorry, i really wanted to add vidix_start and stop as int, to detect if something went into the wrong way (also implement check in vo_xvidix)
alex
parents:
4231
diff
changeset
|
133 return -1; |
4198
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
134 } |
4372 | 135 video_on=0; |
4234
0ec1d81c8f94
sorry, i really wanted to add vidix_start and stop as int, to detect if something went into the wrong way (also implement check in vo_xvidix)
alex
parents:
4231
diff
changeset
|
136 return 0; |
4198
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
137 } |
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
138 |
4010 | 139 void vidix_term( void ) |
140 { | |
141 if(verbose > 1) printf("vosub_vidix: vidix_term() was called\n"); | |
4198
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
142 vidix_stop(); |
4010 | 143 vdlClose(vidix_handler); |
144 } | |
145 | |
5052
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
146 static uint32_t vidix_draw_slice_swYV12(uint8_t *image[], int stride[], int w,int h,int x,int y) |
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
147 { |
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
148 uint8_t *dest; |
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
149 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y; |
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
150 dest += dstrides.y*y + x; |
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
151 yv12toyuy2(image[0], image[1], image[2], dest, w, h, stride[0], stride[1],dstrides.y); |
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
152 return 0; |
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
153 } |
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
154 |
4430 | 155 static uint32_t vidix_draw_slice_420(uint8_t *image[], int stride[], int w,int h,int x,int y) |
4010 | 156 { |
157 uint8_t *src; | |
158 uint8_t *dest; | |
159 int i; | |
4324
09f15844c960
don't render UV planes if interleaved (also add support later)
alex
parents:
4317
diff
changeset
|
160 |
09f15844c960
don't render UV planes if interleaved (also add support later)
alex
parents:
4317
diff
changeset
|
161 /* Plane Y */ |
4032 | 162 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y; |
4999 | 163 dest += dstrides.y*y + x; |
4010 | 164 src = image[0]; |
165 for(i=0;i<h;i++){ | |
166 memcpy(dest,src,w); | |
167 src+=stride[0]; | |
4999 | 168 dest += dstrides.y; |
4010 | 169 } |
170 | |
4324
09f15844c960
don't render UV planes if interleaved (also add support later)
alex
parents:
4317
diff
changeset
|
171 if (vidix_play.flags & VID_PLAY_INTERLEAVED_UV) |
09f15844c960
don't render UV planes if interleaved (also add support later)
alex
parents:
4317
diff
changeset
|
172 { |
4744
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
173 int hi,wi; |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
174 uint8_t *src2; |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
175 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.v; |
4999 | 176 dest += dstrides.y*y/2 + x; // <- is this correct ? |
4744
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
177 h/=2; |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
178 w/=2; |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
179 src = image[1]; |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
180 src2 = image[2]; |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
181 for(hi = 0; hi < h; hi++) |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
182 { |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
183 for(wi = 0; wi < w; wi++) |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
184 { |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
185 dest[2*wi+0] = src[wi]; |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
186 dest[2*wi+1] = src2[wi]; |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
187 } |
4999 | 188 dest += dstrides.y; |
4744
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
189 src += stride[1]; |
4999 | 190 src2+= stride[2]; |
191 } | |
192 } | |
193 else | |
194 { | |
4744
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
195 /* Plane V */ |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
196 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.v; |
4999 | 197 dest += dstrides.v*y/4 + x; |
4744
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
198 src = image[1]; |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
199 for(i=0;i<h/2;i++){ |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
200 memcpy(dest,src,w/2); |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
201 src+=stride[1]; |
4999 | 202 dest+=dstrides.v/2; |
4744
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
203 } |
4324
09f15844c960
don't render UV planes if interleaved (also add support later)
alex
parents:
4317
diff
changeset
|
204 |
4744
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
205 /* Plane U */ |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
206 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.u; |
4999 | 207 dest += dstrides.u*y/4 + x; |
4744
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
208 src = image[2]; |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
209 for(i=0;i<h/2;i++){ |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
210 memcpy(dest,src,w/2); |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
211 src+=stride[2]; |
4999 | 212 dest += dstrides.u/2; |
4744
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
213 } |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
214 return 0; |
4999 | 215 } |
4010 | 216 } |
217 | |
4999 | 218 static uint32_t vidix_draw_slice_packed(uint8_t *image[], int stride[], int w,int h,int x,int y) |
4010 | 219 { |
220 uint8_t *src; | |
221 uint8_t *dest; | |
222 int i; | |
4032 | 223 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y; |
4999 | 224 dest += dstrides.y*y + x; |
4010 | 225 src = image[0]; |
226 for(i=0;i<h;i++){ | |
4999 | 227 memcpy(dest,src,w*image_Bpp); |
4010 | 228 src+=stride[0]; |
4999 | 229 dest += dstrides.y; |
4010 | 230 } |
4240 | 231 return 0; |
4010 | 232 } |
233 | |
4999 | 234 static uint32_t vidix_draw_slice_packed_fast(uint8_t *image[], int stride[], int w,int h,int x,int y) |
4454 | 235 { |
236 uint8_t *src; | |
237 uint8_t *dest; | |
238 int i; | |
239 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y; | |
4999 | 240 dest += dstrides.y*y + x; |
4430 | 241 src = image[0]; |
4999 | 242 memcpy(dest,src,h*dstrides.y); |
4454 | 243 return 0; |
244 } | |
245 | |
4010 | 246 uint32_t vidix_draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y) |
247 { | |
4454 | 248 printf("vosub_vidix: Error unoptimized draw_slice was called\nExiting..."); |
249 vidix_term(); | |
250 exit( EXIT_FAILURE ); | |
251 return 0; | |
4010 | 252 } |
253 | |
254 uint32_t vidix_draw_frame(uint8_t *image[]) | |
255 { | |
4454 | 256 int stride[1]; |
4010 | 257 if(verbose > 1) printf("vosub_vidix: vidix_draw_frame() was called\n"); |
258 /* Note it's very strange but sometime for YUY2 draw_frame is called */ | |
259 if(src_format == IMGFMT_YV12 || src_format == IMGFMT_I420 || src_format == IMGFMT_IYUV) | |
4442
49c410f359e0
return error if unknown depth given. more informative error messages. dont exit if draw_frame was called with Planar YUV, only warn the user
alex
parents:
4434
diff
changeset
|
260 printf("vosub_vidix: draw_frame for YUV420 called, frame cannot be written\n"); |
4010 | 261 else |
4430 | 262 if(src_format == IMGFMT_RGB32 || src_format == IMGFMT_BGR32) |
263 stride[0] = vidix_play.src.w*4; | |
264 else | |
265 if(src_format == IMGFMT_RGB24 || src_format == IMGFMT_BGR24) | |
266 stride[0] = vidix_play.src.w*3; | |
267 else | |
4010 | 268 stride[0] = vidix_play.src.w*2; |
4454 | 269 return vo_server->draw_slice(image,stride,vidix_play.src.w,vidix_play.src.h, |
270 vidix_play.src.x,vidix_play.src.y); | |
4010 | 271 } |
272 | |
273 void vidix_flip_page(void) | |
274 { | |
275 if(verbose > 1) printf("vosub_vidix: vidix_flip_page() was called\n"); | |
276 if(vo_doublebuffering) | |
277 { | |
4032 | 278 vdlPlaybackFrameSelect(vidix_handler,next_frame); |
4010 | 279 next_frame=(next_frame+1)%vidix_play.num_frames; |
280 } | |
281 } | |
282 | |
283 static void draw_alpha_null(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride) | |
284 { | |
285 UNUSED(x0); | |
286 UNUSED(y0); | |
287 UNUSED(w); | |
288 UNUSED(h); | |
289 UNUSED(src); | |
290 UNUSED(srca); | |
291 UNUSED(stride); | |
292 } | |
293 | |
294 static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride) | |
295 { | |
4032 | 296 uint32_t apitch,bespitch; |
4010 | 297 void *lvo_mem; |
4032 | 298 lvo_mem = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y; |
299 apitch = vidix_play.dest.pitch.y-1; | |
4010 | 300 switch(vidix_play.fourcc){ |
301 case IMGFMT_YV12: | |
302 case IMGFMT_IYUV: | |
303 case IMGFMT_I420: | |
4745
398e3663ed71
Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents:
4744
diff
changeset
|
304 bespitch = (vidix_play.src.w + apitch) & (~apitch); |
4010 | 305 vo_draw_alpha_yv12(w,h,src,srca,stride,lvo_mem+bespitch*y0+x0,bespitch); |
306 break; | |
307 case IMGFMT_YUY2: | |
4745
398e3663ed71
Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents:
4744
diff
changeset
|
308 bespitch = (vidix_play.src.w*2 + apitch) & (~apitch); |
398e3663ed71
Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents:
4744
diff
changeset
|
309 vo_draw_alpha_yuy2(w,h,src,srca,stride,lvo_mem+bespitch*y0+2*x0,bespitch); |
4010 | 310 break; |
311 case IMGFMT_UYVY: | |
4745
398e3663ed71
Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents:
4744
diff
changeset
|
312 bespitch = (vidix_play.src.w*2 + apitch) & (~apitch); |
398e3663ed71
Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents:
4744
diff
changeset
|
313 vo_draw_alpha_yuy2(w,h,src,srca,stride,lvo_mem+bespitch*y0+2*x0+1,bespitch); |
4010 | 314 break; |
4430 | 315 case IMGFMT_RGB32: |
316 case IMGFMT_BGR32: | |
4745
398e3663ed71
Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents:
4744
diff
changeset
|
317 bespitch = (vidix_play.src.w*4 + apitch) & (~apitch); |
398e3663ed71
Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents:
4744
diff
changeset
|
318 vo_draw_alpha_rgb32(w,h,src,srca,stride,lvo_mem+y0*bespitch+4*x0,bespitch); |
4430 | 319 break; |
320 case IMGFMT_RGB24: | |
321 case IMGFMT_BGR24: | |
4745
398e3663ed71
Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents:
4744
diff
changeset
|
322 bespitch = (vidix_play.src.w*3 + apitch) & (~apitch); |
398e3663ed71
Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents:
4744
diff
changeset
|
323 vo_draw_alpha_rgb24(w,h,src,srca,stride,lvo_mem+y0*bespitch+3*x0,bespitch); |
4430 | 324 break; |
325 case IMGFMT_RGB16: | |
326 case IMGFMT_BGR16: | |
4745
398e3663ed71
Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents:
4744
diff
changeset
|
327 bespitch = (vidix_play.src.w*2 + apitch) & (~apitch); |
398e3663ed71
Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents:
4744
diff
changeset
|
328 vo_draw_alpha_rgb16(w,h,src,srca,stride,lvo_mem+y0*bespitch+2*x0,bespitch); |
4430 | 329 break; |
330 case IMGFMT_RGB15: | |
331 case IMGFMT_BGR15: | |
4745
398e3663ed71
Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents:
4744
diff
changeset
|
332 bespitch = (vidix_play.src.w*2 + apitch) & (~apitch); |
398e3663ed71
Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents:
4744
diff
changeset
|
333 vo_draw_alpha_rgb15(w,h,src,srca,stride,lvo_mem+y0*bespitch+2*x0,bespitch); |
4430 | 334 break; |
4010 | 335 default: |
336 draw_alpha_null(x0,y0,w,h,src,srca,stride); | |
337 } | |
338 } | |
339 | |
340 void vidix_draw_osd(void) | |
341 { | |
342 if(verbose > 1) printf("vosub_vidix: vidix_draw_osd() was called\n"); | |
343 /* TODO: hw support */ | |
344 vo_draw_text(vidix_play.src.w,vidix_play.src.h,draw_alpha); | |
345 } | |
346 | |
347 uint32_t vidix_query_fourcc(uint32_t format) | |
348 { | |
349 if(verbose > 1) printf("vosub_vidix: query_format was called: %x (%s)\n",format,vo_format_name(format)); | |
350 vidix_fourcc.fourcc = format; | |
351 vdlQueryFourcc(vidix_handler,&vidix_fourcc); | |
5052
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
352 if (vidix_fourcc.depth == VID_DEPTH_NONE) |
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
353 { |
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
354 if(format == IMGFMT_YV12) |
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
355 { |
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
356 vidix_fourcc.fourcc = IMGFMT_YUY2; |
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
357 vdlQueryFourcc(vidix_handler,&vidix_fourcc); |
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
358 if (vidix_fourcc.depth == VID_DEPTH_NONE) return 0; |
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
359 else |
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
360 { |
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
361 vo_server->draw_slice = vidix_draw_slice_swYV12; |
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
362 forced_fourcc=IMGFMT_YUY2; |
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
363 printf("vosub_vidix: WARNING!!! Using YV12 to YUY2 SW convertion\n"); |
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
364 return 0x02; |
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
365 } |
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
366 } |
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
367 return 0 ; |
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
368 } |
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
369 return 0x2; /* hw support without conversion */ |
4010 | 370 } |
4240 | 371 |
4255 | 372 int vidix_grkey_support(void) |
373 { | |
4270
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
374 return(vidix_fourcc.flags & VID_CAP_COLORKEY); |
4255 | 375 } |
376 | |
4240 | 377 int vidix_grkey_get(vidix_grkey_t *gr_key) |
378 { | |
379 return(vdlGetGrKeys(vidix_handler, gr_key)); | |
380 } | |
381 | |
382 int vidix_grkey_set(const vidix_grkey_t *gr_key) | |
383 { | |
384 return(vdlSetGrKeys(vidix_handler, gr_key)); | |
385 } | |
4372 | 386 |
387 static int vidix_get_bes_da(bes_da_t *info) | |
388 { | |
389 if(!video_on) return EPERM; | |
390 info->dest.x = vidix_play.src.x; | |
391 info->dest.y = vidix_play.src.y; | |
392 info->dest.w = vidix_play.src.w; | |
393 info->dest.h = vidix_play.src.h; | |
394 info->dest.pitch.y = vidix_play.dest.pitch.y; | |
395 info->dest.pitch.u = vidix_play.dest.pitch.u; | |
396 info->dest.pitch.v = vidix_play.dest.pitch.v; | |
397 info->flags = vidix_play.flags; | |
398 info->frame_size = vidix_play.frame_size; | |
399 info->num_frames = vidix_play.num_frames; | |
400 memcpy(info->offsets,vidix_play.offsets,sizeof(unsigned)*vidix_play.num_frames); | |
401 memcpy(&info->offset,&vidix_play.offset,sizeof(vidix_yuv_t)); | |
402 info->dga_addr = vidix_play.dga_addr; | |
403 return 0; | |
404 } | |
4379 | 405 |
406 static int vidix_get_video_eq(vidix_video_eq_t *info) | |
407 { | |
408 if(!video_on) return EPERM; | |
409 return vdlPlaybackGetEq(vidix_handler, info); | |
410 } | |
411 | |
412 static int vidix_set_video_eq(const vidix_video_eq_t *info) | |
413 { | |
414 if(!video_on) return EPERM; | |
415 return vdlPlaybackSetEq(vidix_handler, info); | |
416 } | |
417 | |
418 static int vidix_get_num_fx(unsigned *info) | |
419 { | |
420 if(!video_on) return EPERM; | |
421 return vdlQueryNumOemEffects(vidix_handler, info); | |
422 } | |
423 | |
424 static int vidix_get_oem_fx(vidix_oem_fx_t *info) | |
425 { | |
426 if(!video_on) return EPERM; | |
427 return vdlGetOemEffect(vidix_handler, info); | |
428 } | |
429 | |
430 static int vidix_set_oem_fx(const vidix_oem_fx_t *info) | |
431 { | |
432 if(!video_on) return EPERM; | |
433 return vdlSetOemEffect(vidix_handler, info); | |
434 } | |
435 | |
436 static int vidix_set_deint(const vidix_deinterlace_t *info) | |
437 { | |
438 if(!video_on) return EPERM; | |
439 return vdlPlaybackSetDeint(vidix_handler, info); | |
440 } | |
4454 | 441 |
5028 | 442 static int is_422_planes_eq=0; |
4454 | 443 int vidix_init(unsigned src_width,unsigned src_height, |
444 unsigned x_org,unsigned y_org,unsigned dst_width, | |
445 unsigned dst_height,unsigned format,unsigned dest_bpp, | |
446 unsigned vid_w,unsigned vid_h,const void *info) | |
447 { | |
448 size_t i,awidth; | |
5028 | 449 int err; |
4999 | 450 uint32_t sstride,apitch; |
4454 | 451 if(verbose > 1) |
452 printf("vosub_vidix: vidix_init() was called\n" | |
453 "src_w=%u src_h=%u dest_x_y_w_h = %u %u %u %u\n" | |
454 "format=%s dest_bpp=%u vid_w=%u vid_h=%u\n" | |
455 ,src_width,src_height,x_org,y_org,dst_width,dst_height | |
456 ,vo_format_name(format),dest_bpp,vid_w,vid_h); | |
457 | |
458 if(((vidix_cap.maxwidth != -1) && (vid_w > vidix_cap.maxwidth)) || | |
459 ((vidix_cap.minwidth != -1) && (vid_w < vidix_cap.minwidth)) || | |
460 ((vidix_cap.maxheight != -1) && (vid_h > vidix_cap.maxheight)) || | |
461 ((vidix_cap.minwidth != -1 ) && (vid_h < vidix_cap.minheight))) | |
462 { | |
463 printf("vosub_vidix: video server has unsupported resolution (%dx%d), supported: %dx%d-%dx%d\n", | |
464 vid_w, vid_h, vidix_cap.minwidth, vidix_cap.minheight, | |
465 vidix_cap.maxwidth, vidix_cap.maxheight); | |
466 return -1; | |
467 } | |
468 | |
469 err = 0; | |
470 switch(dest_bpp) | |
471 { | |
472 case 1: err = ((vidix_fourcc.depth & VID_DEPTH_1BPP) != VID_DEPTH_1BPP); break; | |
473 case 2: err = ((vidix_fourcc.depth & VID_DEPTH_2BPP) != VID_DEPTH_2BPP); break; | |
474 case 4: err = ((vidix_fourcc.depth & VID_DEPTH_4BPP) != VID_DEPTH_4BPP); break; | |
475 case 8: err = ((vidix_fourcc.depth & VID_DEPTH_8BPP) != VID_DEPTH_8BPP); break; | |
476 case 12:err = ((vidix_fourcc.depth & VID_DEPTH_12BPP) != VID_DEPTH_12BPP); break; | |
4540 | 477 case 15:err = ((vidix_fourcc.depth & VID_DEPTH_15BPP) != VID_DEPTH_15BPP); break; |
4454 | 478 case 16:err = ((vidix_fourcc.depth & VID_DEPTH_16BPP) != VID_DEPTH_16BPP); break; |
479 case 24:err = ((vidix_fourcc.depth & VID_DEPTH_24BPP) != VID_DEPTH_24BPP); break; | |
480 case 32:err = ((vidix_fourcc.depth & VID_DEPTH_32BPP) != VID_DEPTH_32BPP); break; | |
481 default: err=1; break; | |
482 } | |
483 if(err) | |
484 { | |
485 printf("vosub_vidix: video server has unsupported color depth by vidix (%d)\n" | |
486 ,vidix_fourcc.depth); | |
487 return -1; | |
488 } | |
489 if((dst_width > src_width || dst_height > src_height) && (vidix_cap.flags & FLAG_UPSCALER) != FLAG_UPSCALER) | |
490 { | |
491 printf("vosub_vidix: vidix driver can't upscale image (%d%d -> %d%d)\n", | |
492 src_width, src_height, dst_width, dst_height); | |
493 return -1; | |
494 } | |
495 if((dst_width > src_width || dst_height > src_height) && (vidix_cap.flags & FLAG_DOWNSCALER) != FLAG_DOWNSCALER) | |
496 { | |
497 printf("vosub_vidix: vidix driver can't downscale image (%d%d -> %d%d)\n", | |
498 src_width, src_height, dst_width, dst_height); | |
499 return -1; | |
500 } | |
501 image_width = src_width; | |
502 image_height = src_height; | |
503 src_format = format; | |
5052
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
504 if(forced_fourcc) format = forced_fourcc; |
4454 | 505 memset(&vidix_play,0,sizeof(vidix_playback_t)); |
506 vidix_play.fourcc = format; | |
507 vidix_play.capability = vidix_cap.flags; /* every ;) */ | |
508 vidix_play.blend_factor = 0; /* for now */ | |
509 /* display the full picture. | |
510 Nick: we could implement here zooming to a specified area -- alex */ | |
511 vidix_play.src.x = vidix_play.src.y = 0; | |
512 vidix_play.src.w = src_width; | |
513 vidix_play.src.h = src_height; | |
514 vidix_play.dest.x = x_org; | |
515 vidix_play.dest.y = y_org; | |
516 vidix_play.dest.w = dst_width; | |
517 vidix_play.dest.h = dst_height; | |
4929 | 518 vidix_play.num_frames=vo_doublebuffering?NUM_FRAMES-1:1; |
4454 | 519 vidix_play.src.pitch.y = vidix_play.src.pitch.u = vidix_play.src.pitch.v = 0; |
520 if(info) | |
521 { | |
522 switch(((const vo_tune_info_t *)info)->pitch[0]) | |
523 { | |
524 case 2: | |
525 case 4: | |
526 case 8: | |
527 case 16: | |
528 case 32: | |
529 case 64: | |
530 case 128: | |
531 case 256: vidix_play.src.pitch.y = ((const vo_tune_info_t *)info)->pitch[0]; | |
532 break; | |
533 default: break; | |
534 } | |
535 switch(((const vo_tune_info_t *)info)->pitch[1]) | |
536 { | |
537 case 2: | |
538 case 4: | |
539 case 8: | |
540 case 16: | |
541 case 32: | |
542 case 64: | |
543 case 128: | |
544 case 256: vidix_play.src.pitch.u = ((const vo_tune_info_t *)info)->pitch[1]; | |
545 break; | |
546 default: break; | |
547 } | |
548 switch(((const vo_tune_info_t *)info)->pitch[2]) | |
549 { | |
550 case 2: | |
551 case 4: | |
552 case 8: | |
553 case 16: | |
554 case 32: | |
555 case 64: | |
556 case 128: | |
557 case 256: vidix_play.src.pitch.v = ((const vo_tune_info_t *)info)->pitch[2]; | |
558 break; | |
559 default: break; | |
560 } | |
561 } | |
562 if((err=vdlConfigPlayback(vidix_handler,&vidix_play))!=0) | |
563 { | |
564 printf("vosub_vidix: Can't configure playback: %s\n",strerror(err)); | |
565 return -1; | |
566 } | |
4895 | 567 printf("vosub_vidix: using %d buffers\n", vidix_play.num_frames); |
4454 | 568 |
569 vidix_mem = vidix_play.dga_addr; | |
570 | |
571 /* select first frame */ | |
572 next_frame = 0; | |
573 // vdlPlaybackFrameSelect(vidix_handler,next_frame); | |
574 | |
575 /* clear every frame with correct address and frame_size */ | |
576 for (i = 0; i < vidix_play.num_frames; i++) | |
577 memset(vidix_mem + vidix_play.offsets[i], 0x80, | |
578 vidix_play.frame_size); | |
4999 | 579 switch(format) |
580 { | |
581 /* | |
582 case IMGFMT_YV09: | |
583 case IMGFMT_IF09: | |
584 */ | |
585 case IMGFMT_I420: | |
586 case IMGFMT_IYUV: | |
587 case IMGFMT_YV12: | |
588 apitch = vidix_play.dest.pitch.y-1; | |
589 dstrides.y = (image_width + apitch) & ~apitch; | |
590 apitch = vidix_play.dest.pitch.v-1; | |
591 dstrides.v = (image_width + apitch) & ~apitch; | |
592 apitch = vidix_play.dest.pitch.u-1; | |
593 dstrides.u = (image_width + apitch) & ~apitch; | |
594 image_Bpp=1; | |
595 break; | |
596 case IMGFMT_RGB32: | |
597 case IMGFMT_BGR32: | |
598 apitch = vidix_play.dest.pitch.y-1; | |
599 dstrides.y = (image_width*4 + apitch) & ~apitch; | |
600 dstrides.u = dstrides.v = 0; | |
601 image_Bpp=4; | |
602 break; | |
603 case IMGFMT_RGB24: | |
604 case IMGFMT_BGR24: | |
605 apitch = vidix_play.dest.pitch.y-1; | |
606 dstrides.y = (image_width*3 + apitch) & ~apitch; | |
607 dstrides.u = dstrides.v = 0; | |
608 image_Bpp=3; | |
609 break; | |
610 default: | |
611 apitch = vidix_play.dest.pitch.y-1; | |
612 dstrides.y = (image_width*2 + apitch) & ~apitch; | |
613 dstrides.u = dstrides.v = 0; | |
614 image_Bpp=2; | |
615 break; | |
616 } | |
4454 | 617 /* tune some info here */ |
4745
398e3663ed71
Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents:
4744
diff
changeset
|
618 sstride = src_width*2; |
5052
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
619 if(!forced_fourcc) |
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
620 { |
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
621 is_422_planes_eq = sstride == dstrides.y; |
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
622 if(src_format == IMGFMT_YV12 || src_format == IMGFMT_I420 || src_format == IMGFMT_IYUV) |
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
623 vo_server->draw_slice = vidix_draw_slice_420; |
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
624 else vo_server->draw_slice = |
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
625 is_422_planes_eq ? |
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
626 vidix_draw_slice_packed_fast: |
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
627 vidix_draw_slice_packed; |
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
628 } |
4454 | 629 return 0; |
630 } | |
631 | |
4991 | 632 static uint32_t vidix_get_image(mp_image_t *mpi) |
633 { | |
634 if(mpi->type==MP_IMGTYPE_STATIC && vidix_play.num_frames>1) return VO_FALSE; | |
635 if(mpi->flags&MP_IMGFLAG_READABLE) return VO_FALSE; /* slow video ram */ | |
5052
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
636 if((is_422_planes_eq || (mpi->flags&(MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_ACCEPT_WIDTH)) && |
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
637 !forced_fourcc && !(vidix_play.flags & VID_PLAY_INTERLEAVED_UV))) |
4991 | 638 { |
5028 | 639 mpi->planes[0]=vidix_mem+vidix_play.offsets[next_frame]+vidix_play.offset.y; |
640 mpi->stride[0]=dstrides.y; | |
641 if(mpi->flags&MP_IMGFLAG_PLANAR) | |
642 { | |
643 mpi->planes[2]=vidix_mem+vidix_play.offsets[next_frame]+vidix_play.offset.v; | |
644 mpi->stride[2]=dstrides.v; | |
645 mpi->planes[1]=vidix_mem+vidix_play.offsets[next_frame]+vidix_play.offset.u; | |
646 mpi->stride[1]=dstrides.u; | |
647 } | |
648 mpi->flags|=MP_IMGFLAG_DIRECT; | |
4991 | 649 } |
650 return VO_TRUE; | |
651 } | |
652 | |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4540
diff
changeset
|
653 uint32_t vidix_control(uint32_t request, void *data, ...) |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4540
diff
changeset
|
654 { |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4540
diff
changeset
|
655 switch (request) { |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4540
diff
changeset
|
656 case VOCTRL_QUERY_VAA: |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4540
diff
changeset
|
657 vidix_query_vaa((vo_vaa_t*)data); |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4540
diff
changeset
|
658 return VO_TRUE; |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4540
diff
changeset
|
659 case VOCTRL_QUERY_FORMAT: |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4540
diff
changeset
|
660 return vidix_query_fourcc(*((uint32_t*)data)); |
4739 | 661 case VOCTRL_SCREENSHOT: |
662 return (*server_control)(request,data); | |
4991 | 663 case VOCTRL_GET_IMAGE: |
664 return vidix_get_image(data); | |
5002 | 665 case VOCTRL_GET_FRAME_NUM: |
666 *(uint32_t *)data = next_frame; | |
667 return VO_TRUE; | |
668 case VOCTRL_SET_FRAME_NUM: | |
669 next_frame = *(uint32_t *)data; | |
670 return VO_TRUE; | |
671 case VOCTRL_GET_NUM_FRAMES: | |
672 *(uint32_t *)data = vidix_play.num_frames; | |
673 return VO_TRUE; | |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4540
diff
changeset
|
674 } |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4540
diff
changeset
|
675 return VO_NOTIMPL; |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4540
diff
changeset
|
676 } |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4540
diff
changeset
|
677 |
4454 | 678 int vidix_preinit(const char *drvname,void *server) |
679 { | |
680 int err; | |
681 if(verbose > 1) printf("vosub_vidix: vidix_preinit(%s) was called\n",drvname); | |
682 if(vdlGetVersion() != VIDIX_VERSION) | |
683 { | |
684 printf("vosub_vidix: You have wrong version of VIDIX library\n"); | |
685 return -1; | |
686 } | |
687 vidix_handler = vdlOpen(LIBDIR"/vidix/", | |
688 drvname ? drvname[0] == ':' ? &drvname[1] : drvname[0] ? drvname : NULL : NULL, | |
689 TYPE_OUTPUT, | |
690 verbose); | |
691 if(vidix_handler == NULL) | |
692 { | |
693 printf("vosub_vidix: Couldn't find working VIDIX driver\n"); | |
694 return -1; | |
695 } | |
696 if((err=vdlGetCapability(vidix_handler,&vidix_cap)) != 0) | |
697 { | |
698 printf("vosub_vidix: Couldn't get capability: %s\n",strerror(err)); | |
699 return -1; | |
700 } | |
701 printf("vosub_vidix: Using: %s by %s\n",vidix_cap.name,vidix_cap.author); | |
702 /* we are able to tune up this stuff depend on fourcc format */ | |
703 ((vo_functions_t *)server)->draw_slice=vidix_draw_slice; | |
704 ((vo_functions_t *)server)->draw_frame=vidix_draw_frame; | |
705 ((vo_functions_t *)server)->flip_page=vidix_flip_page; | |
706 ((vo_functions_t *)server)->draw_osd=vidix_draw_osd; | |
4739 | 707 server_control = ((vo_functions_t *)server)->control; |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4540
diff
changeset
|
708 ((vo_functions_t *)server)->control=vidix_control; |
4454 | 709 vo_server = server; |
710 return 0; | |
711 } |