Mercurial > mplayer.hg
annotate libvo/vosub_vidix.c @ 7031:a1ff955aa49b
importing libmpdvdkit files
author | arpi |
---|---|
date | Fri, 16 Aug 2002 22:43:44 +0000 |
parents | a3126e9099b4 |
children | eca7dbad0166 |
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" | |
6550
991e03ca5ceb
added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents:
6531
diff
changeset
|
32 #include "sub.h" |
4991 | 33 |
5566 | 34 #include "../libmpcodecs/vfcap.h" |
5607 | 35 #include "../libmpcodecs/mp_image.h" |
4010 | 36 |
4929 | 37 #define NUM_FRAMES VID_PLAY_MAXFRAMES /* Temporary: driver will overwrite it */ |
4010 | 38 #define UNUSED(x) ((void)(x)) /* Removes warning about unused arguments */ |
39 | |
40 static VDL_HANDLE vidix_handler = NULL; | |
41 static uint8_t *vidix_mem = NULL; | |
42 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
|
43 static unsigned image_Bpp,image_height,image_width,src_format,forced_fourcc=0; |
4010 | 44 extern int verbose; |
4372 | 45 static int video_on=0; |
4010 | 46 |
47 static vidix_capability_t vidix_cap; | |
48 static vidix_playback_t vidix_play; | |
49 static vidix_fourcc_t vidix_fourcc; | |
4454 | 50 static vo_functions_t * vo_server; |
4999 | 51 static vidix_yuv_t dstrides; |
4739 | 52 static uint32_t (*server_control)(uint32_t request, void *data, ...); |
53 | |
4372 | 54 static int vidix_get_bes_da(bes_da_t *); |
4379 | 55 static int vidix_get_video_eq(vidix_video_eq_t *info); |
56 static int vidix_set_video_eq(const vidix_video_eq_t *info); | |
57 static int vidix_get_num_fx(unsigned *info); | |
58 static int vidix_get_oem_fx(vidix_oem_fx_t *info); | |
59 static int vidix_set_oem_fx(const vidix_oem_fx_t *info); | |
60 static int vidix_set_deint(const vidix_deinterlace_t *info); | |
4372 | 61 |
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
|
62 int vidix_start(void) |
4198
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
63 { |
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
64 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
|
65 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
|
66 { |
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
67 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
|
68 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
|
69 } |
4379 | 70 video_on=1; |
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
|
71 return 0; |
4198
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
72 } |
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
73 |
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
|
74 int vidix_stop(void) |
4198
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
75 { |
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
76 int err; |
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
77 if((err=vdlPlaybackOff(vidix_handler))!=0) |
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
78 { |
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
79 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
|
80 return -1; |
4198
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
81 } |
4372 | 82 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
|
83 return 0; |
4198
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
84 } |
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
85 |
4010 | 86 void vidix_term( void ) |
87 { | |
88 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
|
89 vidix_stop(); |
4010 | 90 vdlClose(vidix_handler); |
6550
991e03ca5ceb
added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents:
6531
diff
changeset
|
91 // ((vo_functions_t *)vo_server)->control=server_control; |
4010 | 92 } |
93 | |
4430 | 94 static uint32_t vidix_draw_slice_420(uint8_t *image[], int stride[], int w,int h,int x,int y) |
4010 | 95 { |
96 uint8_t *src; | |
97 uint8_t *dest; | |
98 int i; | |
4324
09f15844c960
don't render UV planes if interleaved (also add support later)
alex
parents:
4317
diff
changeset
|
99 |
09f15844c960
don't render UV planes if interleaved (also add support later)
alex
parents:
4317
diff
changeset
|
100 /* Plane Y */ |
4032 | 101 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y; |
4999 | 102 dest += dstrides.y*y + x; |
4010 | 103 src = image[0]; |
104 for(i=0;i<h;i++){ | |
105 memcpy(dest,src,w); | |
106 src+=stride[0]; | |
4999 | 107 dest += dstrides.y; |
4010 | 108 } |
109 | |
4324
09f15844c960
don't render UV planes if interleaved (also add support later)
alex
parents:
4317
diff
changeset
|
110 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
|
111 { |
4744
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
112 int hi,wi; |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
113 uint8_t *src2; |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
114 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.v; |
4999 | 115 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
|
116 h/=2; |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
117 w/=2; |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
118 src = image[1]; |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
119 src2 = image[2]; |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
120 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
|
121 { |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
122 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
|
123 { |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
124 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
|
125 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
|
126 } |
4999 | 127 dest += dstrides.y; |
4744
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
128 src += stride[1]; |
4999 | 129 src2+= stride[2]; |
130 } | |
131 } | |
132 else | |
133 { | |
4744
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
134 /* Plane V */ |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
135 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.v; |
4999 | 136 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
|
137 src = image[1]; |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
138 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
|
139 memcpy(dest,src,w/2); |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
140 src+=stride[1]; |
4999 | 141 dest+=dstrides.v/2; |
4744
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
142 } |
4324
09f15844c960
don't render UV planes if interleaved (also add support later)
alex
parents:
4317
diff
changeset
|
143 |
4744
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
144 /* Plane U */ |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
145 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.u; |
4999 | 146 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
|
147 src = image[2]; |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
148 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
|
149 memcpy(dest,src,w/2); |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
150 src+=stride[2]; |
4999 | 151 dest += dstrides.u/2; |
4744
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
152 } |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
153 return 0; |
4999 | 154 } |
6550
991e03ca5ceb
added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents:
6531
diff
changeset
|
155 return -1; |
4010 | 156 } |
157 | |
6482
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
158 static uint32_t vidix_draw_slice_410(uint8_t *image[], int stride[], int w,int h,int x,int y) |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
159 { |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
160 uint8_t *src; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
161 uint8_t *dest; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
162 int i; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
163 |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
164 /* Plane Y */ |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
165 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
166 dest += dstrides.y*y + x; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
167 src = image[0]; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
168 for(i=0;i<h;i++){ |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
169 memcpy(dest,src,w); |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
170 src+=stride[0]; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
171 dest += dstrides.y; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
172 } |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
173 |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
174 if (vidix_play.flags & VID_PLAY_INTERLEAVED_UV) |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
175 { |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
176 printf("vosub_vidix: interleaved uv for yuv410p not supported\n"); |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
177 } |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
178 else |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
179 { |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
180 /* Plane V */ |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
181 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.v; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
182 dest += dstrides.v*y/8 + x; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
183 src = image[1]; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
184 for(i=0;i<h/4;i++){ |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
185 memcpy(dest,src,w/4); |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
186 src+=stride[1]; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
187 dest+=dstrides.v/4; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
188 } |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
189 |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
190 /* Plane U */ |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
191 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.u; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
192 dest += dstrides.u*y/8 + x; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
193 src = image[2]; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
194 for(i=0;i<h/4;i++){ |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
195 memcpy(dest,src,w/4); |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
196 src+=stride[2]; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
197 dest += dstrides.u/4; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
198 } |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
199 return 0; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
200 } |
6550
991e03ca5ceb
added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents:
6531
diff
changeset
|
201 return -1; |
6482
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
202 } |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
203 |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
204 static uint32_t vidix_draw_slice_410_fast(uint8_t *image[], int stride[], int w, int h, int x, int y) |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
205 { |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
206 uint8_t *src; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
207 uint8_t *dest; |
6550
991e03ca5ceb
added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents:
6531
diff
changeset
|
208 |
6482
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
209 UNUSED(w); |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
210 UNUSED(stride); |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
211 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
212 dest += dstrides.y*y + x; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
213 src = image[0]; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
214 memcpy(dest, src, dstrides.y*h*9/8); |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
215 return 0; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
216 } |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
217 |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
218 static uint32_t vidix_draw_slice_400(uint8_t *image[], int stride[], int w,int h,int x,int y) |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
219 { |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
220 uint8_t *src; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
221 uint8_t *dest; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
222 int i; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
223 |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
224 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
225 dest += dstrides.y*y + x; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
226 src = image[0]; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
227 for(i=0;i<h;i++){ |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
228 memcpy(dest,src,w); |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
229 src+=stride[0]; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
230 dest += dstrides.y; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
231 } |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
232 return 0; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
233 } |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
234 |
4999 | 235 static uint32_t vidix_draw_slice_packed(uint8_t *image[], int stride[], int w,int h,int x,int y) |
4010 | 236 { |
237 uint8_t *src; | |
238 uint8_t *dest; | |
239 int i; | |
6550
991e03ca5ceb
added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents:
6531
diff
changeset
|
240 |
4032 | 241 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y; |
4999 | 242 dest += dstrides.y*y + x; |
4010 | 243 src = image[0]; |
244 for(i=0;i<h;i++){ | |
4999 | 245 memcpy(dest,src,w*image_Bpp); |
4010 | 246 src+=stride[0]; |
4999 | 247 dest += dstrides.y; |
4010 | 248 } |
4240 | 249 return 0; |
4010 | 250 } |
251 | |
4999 | 252 static uint32_t vidix_draw_slice_packed_fast(uint8_t *image[], int stride[], int w,int h,int x,int y) |
4454 | 253 { |
254 uint8_t *src; | |
255 uint8_t *dest; | |
6550
991e03ca5ceb
added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents:
6531
diff
changeset
|
256 |
991e03ca5ceb
added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents:
6531
diff
changeset
|
257 UNUSED(w); |
991e03ca5ceb
added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents:
6531
diff
changeset
|
258 UNUSED(stride); |
4454 | 259 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y; |
4999 | 260 dest += dstrides.y*y + x; |
4430 | 261 src = image[0]; |
4999 | 262 memcpy(dest,src,h*dstrides.y); |
4454 | 263 return 0; |
264 } | |
265 | |
4010 | 266 uint32_t vidix_draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y) |
267 { | |
6550
991e03ca5ceb
added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents:
6531
diff
changeset
|
268 UNUSED(image); |
991e03ca5ceb
added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents:
6531
diff
changeset
|
269 UNUSED(stride); |
991e03ca5ceb
added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents:
6531
diff
changeset
|
270 UNUSED(w); |
991e03ca5ceb
added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents:
6531
diff
changeset
|
271 UNUSED(h); |
991e03ca5ceb
added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents:
6531
diff
changeset
|
272 UNUSED(x); |
991e03ca5ceb
added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents:
6531
diff
changeset
|
273 UNUSED(y); |
4454 | 274 printf("vosub_vidix: Error unoptimized draw_slice was called\nExiting..."); |
275 vidix_term(); | |
276 exit( EXIT_FAILURE ); | |
277 return 0; | |
4010 | 278 } |
279 | |
280 uint32_t vidix_draw_frame(uint8_t *image[]) | |
281 { | |
4454 | 282 int stride[1]; |
4010 | 283 if(verbose > 1) printf("vosub_vidix: vidix_draw_frame() was called\n"); |
284 /* Note it's very strange but sometime for YUY2 draw_frame is called */ | |
6482
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
285 if(src_format == IMGFMT_YV12 || src_format == IMGFMT_I420 || src_format == IMGFMT_IYUV |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
286 || src_format == IMGFMT_YVU9 || src_format == IMGFMT_IF09) |
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
|
287 printf("vosub_vidix: draw_frame for YUV420 called, frame cannot be written\n"); |
4010 | 288 else |
4430 | 289 if(src_format == IMGFMT_RGB32 || src_format == IMGFMT_BGR32) |
290 stride[0] = vidix_play.src.w*4; | |
291 else | |
292 if(src_format == IMGFMT_RGB24 || src_format == IMGFMT_BGR24) | |
293 stride[0] = vidix_play.src.w*3; | |
294 else | |
4010 | 295 stride[0] = vidix_play.src.w*2; |
4454 | 296 return vo_server->draw_slice(image,stride,vidix_play.src.w,vidix_play.src.h, |
297 vidix_play.src.x,vidix_play.src.y); | |
4010 | 298 } |
299 | |
300 void vidix_flip_page(void) | |
301 { | |
302 if(verbose > 1) printf("vosub_vidix: vidix_flip_page() was called\n"); | |
303 if(vo_doublebuffering) | |
304 { | |
4032 | 305 vdlPlaybackFrameSelect(vidix_handler,next_frame); |
4010 | 306 next_frame=(next_frame+1)%vidix_play.num_frames; |
307 } | |
308 } | |
309 | |
310 static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride) | |
311 { | |
4032 | 312 uint32_t apitch,bespitch; |
4010 | 313 void *lvo_mem; |
4032 | 314 lvo_mem = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y; |
315 apitch = vidix_play.dest.pitch.y-1; | |
4010 | 316 switch(vidix_play.fourcc){ |
317 case IMGFMT_YV12: | |
318 case IMGFMT_IYUV: | |
319 case IMGFMT_I420: | |
6550
991e03ca5ceb
added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents:
6531
diff
changeset
|
320 case IMGFMT_YVU9: |
991e03ca5ceb
added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents:
6531
diff
changeset
|
321 case IMGFMT_IF09: |
991e03ca5ceb
added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents:
6531
diff
changeset
|
322 case IMGFMT_Y8: |
991e03ca5ceb
added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents:
6531
diff
changeset
|
323 case IMGFMT_Y800: |
4745
398e3663ed71
Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents:
4744
diff
changeset
|
324 bespitch = (vidix_play.src.w + apitch) & (~apitch); |
4010 | 325 vo_draw_alpha_yv12(w,h,src,srca,stride,lvo_mem+bespitch*y0+x0,bespitch); |
326 break; | |
327 case IMGFMT_YUY2: | |
4745
398e3663ed71
Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents:
4744
diff
changeset
|
328 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
|
329 vo_draw_alpha_yuy2(w,h,src,srca,stride,lvo_mem+bespitch*y0+2*x0,bespitch); |
4010 | 330 break; |
331 case IMGFMT_UYVY: | |
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_yuy2(w,h,src,srca,stride,lvo_mem+bespitch*y0+2*x0+1,bespitch); |
4010 | 334 break; |
4430 | 335 case IMGFMT_RGB32: |
336 case IMGFMT_BGR32: | |
4745
398e3663ed71
Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents:
4744
diff
changeset
|
337 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
|
338 vo_draw_alpha_rgb32(w,h,src,srca,stride,lvo_mem+y0*bespitch+4*x0,bespitch); |
4430 | 339 break; |
340 case IMGFMT_RGB24: | |
341 case IMGFMT_BGR24: | |
4745
398e3663ed71
Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents:
4744
diff
changeset
|
342 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
|
343 vo_draw_alpha_rgb24(w,h,src,srca,stride,lvo_mem+y0*bespitch+3*x0,bespitch); |
4430 | 344 break; |
345 case IMGFMT_RGB16: | |
346 case IMGFMT_BGR16: | |
4745
398e3663ed71
Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents:
4744
diff
changeset
|
347 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
|
348 vo_draw_alpha_rgb16(w,h,src,srca,stride,lvo_mem+y0*bespitch+2*x0,bespitch); |
4430 | 349 break; |
350 case IMGFMT_RGB15: | |
351 case IMGFMT_BGR15: | |
4745
398e3663ed71
Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents:
4744
diff
changeset
|
352 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
|
353 vo_draw_alpha_rgb15(w,h,src,srca,stride,lvo_mem+y0*bespitch+2*x0,bespitch); |
4430 | 354 break; |
4010 | 355 default: |
6786 | 356 return; |
4010 | 357 } |
358 } | |
359 | |
360 void vidix_draw_osd(void) | |
361 { | |
362 if(verbose > 1) printf("vosub_vidix: vidix_draw_osd() was called\n"); | |
363 /* TODO: hw support */ | |
364 vo_draw_text(vidix_play.src.w,vidix_play.src.h,draw_alpha); | |
365 } | |
366 | |
367 uint32_t vidix_query_fourcc(uint32_t format) | |
368 { | |
369 if(verbose > 1) printf("vosub_vidix: query_format was called: %x (%s)\n",format,vo_format_name(format)); | |
370 vidix_fourcc.fourcc = format; | |
371 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
|
372 if (vidix_fourcc.depth == VID_DEPTH_NONE) |
5566 | 373 return 0; |
6550
991e03ca5ceb
added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents:
6531
diff
changeset
|
374 return VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW|VFCAP_HWSCALE_UP|VFCAP_HWSCALE_DOWN|VFCAP_OSD; |
4010 | 375 } |
4240 | 376 |
4255 | 377 int vidix_grkey_support(void) |
378 { | |
4270
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
379 return(vidix_fourcc.flags & VID_CAP_COLORKEY); |
4255 | 380 } |
381 | |
4240 | 382 int vidix_grkey_get(vidix_grkey_t *gr_key) |
383 { | |
384 return(vdlGetGrKeys(vidix_handler, gr_key)); | |
385 } | |
386 | |
387 int vidix_grkey_set(const vidix_grkey_t *gr_key) | |
388 { | |
389 return(vdlSetGrKeys(vidix_handler, gr_key)); | |
390 } | |
4372 | 391 |
392 static int vidix_get_bes_da(bes_da_t *info) | |
393 { | |
394 if(!video_on) return EPERM; | |
395 info->dest.x = vidix_play.src.x; | |
396 info->dest.y = vidix_play.src.y; | |
397 info->dest.w = vidix_play.src.w; | |
398 info->dest.h = vidix_play.src.h; | |
399 info->dest.pitch.y = vidix_play.dest.pitch.y; | |
400 info->dest.pitch.u = vidix_play.dest.pitch.u; | |
401 info->dest.pitch.v = vidix_play.dest.pitch.v; | |
402 info->flags = vidix_play.flags; | |
403 info->frame_size = vidix_play.frame_size; | |
404 info->num_frames = vidix_play.num_frames; | |
405 memcpy(info->offsets,vidix_play.offsets,sizeof(unsigned)*vidix_play.num_frames); | |
406 memcpy(&info->offset,&vidix_play.offset,sizeof(vidix_yuv_t)); | |
407 info->dga_addr = vidix_play.dga_addr; | |
408 return 0; | |
409 } | |
4379 | 410 |
411 static int vidix_get_video_eq(vidix_video_eq_t *info) | |
412 { | |
413 if(!video_on) return EPERM; | |
414 return vdlPlaybackGetEq(vidix_handler, info); | |
415 } | |
416 | |
417 static int vidix_set_video_eq(const vidix_video_eq_t *info) | |
418 { | |
419 if(!video_on) return EPERM; | |
420 return vdlPlaybackSetEq(vidix_handler, info); | |
421 } | |
422 | |
423 static int vidix_get_num_fx(unsigned *info) | |
424 { | |
425 if(!video_on) return EPERM; | |
426 return vdlQueryNumOemEffects(vidix_handler, info); | |
427 } | |
428 | |
429 static int vidix_get_oem_fx(vidix_oem_fx_t *info) | |
430 { | |
431 if(!video_on) return EPERM; | |
432 return vdlGetOemEffect(vidix_handler, info); | |
433 } | |
434 | |
435 static int vidix_set_oem_fx(const vidix_oem_fx_t *info) | |
436 { | |
437 if(!video_on) return EPERM; | |
438 return vdlSetOemEffect(vidix_handler, info); | |
439 } | |
440 | |
441 static int vidix_set_deint(const vidix_deinterlace_t *info) | |
442 { | |
443 if(!video_on) return EPERM; | |
444 return vdlPlaybackSetDeint(vidix_handler, info); | |
445 } | |
4454 | 446 |
5028 | 447 static int is_422_planes_eq=0; |
4454 | 448 int vidix_init(unsigned src_width,unsigned src_height, |
449 unsigned x_org,unsigned y_org,unsigned dst_width, | |
450 unsigned dst_height,unsigned format,unsigned dest_bpp, | |
451 unsigned vid_w,unsigned vid_h,const void *info) | |
452 { | |
6550
991e03ca5ceb
added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents:
6531
diff
changeset
|
453 size_t i; |
5028 | 454 int err; |
4999 | 455 uint32_t sstride,apitch; |
4454 | 456 if(verbose > 1) |
457 printf("vosub_vidix: vidix_init() was called\n" | |
458 "src_w=%u src_h=%u dest_x_y_w_h = %u %u %u %u\n" | |
459 "format=%s dest_bpp=%u vid_w=%u vid_h=%u\n" | |
460 ,src_width,src_height,x_org,y_org,dst_width,dst_height | |
461 ,vo_format_name(format),dest_bpp,vid_w,vid_h); | |
462 | |
7026
a3126e9099b4
should solve -vo vesa:vidix problem 'vosub_vidix: video server has
arpi
parents:
6806
diff
changeset
|
463 if(vidix_query_fourcc(format) == 0) |
a3126e9099b4
should solve -vo vesa:vidix problem 'vosub_vidix: video server has
arpi
parents:
6806
diff
changeset
|
464 { |
a3126e9099b4
should solve -vo vesa:vidix problem 'vosub_vidix: video server has
arpi
parents:
6806
diff
changeset
|
465 printf("vosub_vidix: unsupported fourcc for this vidix driver: %x (%s)\n", |
a3126e9099b4
should solve -vo vesa:vidix problem 'vosub_vidix: video server has
arpi
parents:
6806
diff
changeset
|
466 format,vo_format_name(format)); |
a3126e9099b4
should solve -vo vesa:vidix problem 'vosub_vidix: video server has
arpi
parents:
6806
diff
changeset
|
467 return -1; |
a3126e9099b4
should solve -vo vesa:vidix problem 'vosub_vidix: video server has
arpi
parents:
6806
diff
changeset
|
468 } |
a3126e9099b4
should solve -vo vesa:vidix problem 'vosub_vidix: video server has
arpi
parents:
6806
diff
changeset
|
469 |
4454 | 470 if(((vidix_cap.maxwidth != -1) && (vid_w > vidix_cap.maxwidth)) || |
471 ((vidix_cap.minwidth != -1) && (vid_w < vidix_cap.minwidth)) || | |
472 ((vidix_cap.maxheight != -1) && (vid_h > vidix_cap.maxheight)) || | |
473 ((vidix_cap.minwidth != -1 ) && (vid_h < vidix_cap.minheight))) | |
474 { | |
475 printf("vosub_vidix: video server has unsupported resolution (%dx%d), supported: %dx%d-%dx%d\n", | |
476 vid_w, vid_h, vidix_cap.minwidth, vidix_cap.minheight, | |
477 vidix_cap.maxwidth, vidix_cap.maxheight); | |
478 return -1; | |
479 } | |
480 | |
481 err = 0; | |
482 switch(dest_bpp) | |
483 { | |
484 case 1: err = ((vidix_fourcc.depth & VID_DEPTH_1BPP) != VID_DEPTH_1BPP); break; | |
485 case 2: err = ((vidix_fourcc.depth & VID_DEPTH_2BPP) != VID_DEPTH_2BPP); break; | |
486 case 4: err = ((vidix_fourcc.depth & VID_DEPTH_4BPP) != VID_DEPTH_4BPP); break; | |
487 case 8: err = ((vidix_fourcc.depth & VID_DEPTH_8BPP) != VID_DEPTH_8BPP); break; | |
488 case 12:err = ((vidix_fourcc.depth & VID_DEPTH_12BPP) != VID_DEPTH_12BPP); break; | |
4540 | 489 case 15:err = ((vidix_fourcc.depth & VID_DEPTH_15BPP) != VID_DEPTH_15BPP); break; |
4454 | 490 case 16:err = ((vidix_fourcc.depth & VID_DEPTH_16BPP) != VID_DEPTH_16BPP); break; |
491 case 24:err = ((vidix_fourcc.depth & VID_DEPTH_24BPP) != VID_DEPTH_24BPP); break; | |
492 case 32:err = ((vidix_fourcc.depth & VID_DEPTH_32BPP) != VID_DEPTH_32BPP); break; | |
493 default: err=1; break; | |
494 } | |
495 if(err) | |
496 { | |
497 printf("vosub_vidix: video server has unsupported color depth by vidix (%d)\n" | |
498 ,vidix_fourcc.depth); | |
499 return -1; | |
500 } | |
501 if((dst_width > src_width || dst_height > src_height) && (vidix_cap.flags & FLAG_UPSCALER) != FLAG_UPSCALER) | |
502 { | |
503 printf("vosub_vidix: vidix driver can't upscale image (%d%d -> %d%d)\n", | |
504 src_width, src_height, dst_width, dst_height); | |
505 return -1; | |
506 } | |
507 if((dst_width > src_width || dst_height > src_height) && (vidix_cap.flags & FLAG_DOWNSCALER) != FLAG_DOWNSCALER) | |
508 { | |
509 printf("vosub_vidix: vidix driver can't downscale image (%d%d -> %d%d)\n", | |
510 src_width, src_height, dst_width, dst_height); | |
511 return -1; | |
512 } | |
513 image_width = src_width; | |
514 image_height = src_height; | |
515 src_format = format; | |
5052
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
516 if(forced_fourcc) format = forced_fourcc; |
4454 | 517 memset(&vidix_play,0,sizeof(vidix_playback_t)); |
518 vidix_play.fourcc = format; | |
519 vidix_play.capability = vidix_cap.flags; /* every ;) */ | |
520 vidix_play.blend_factor = 0; /* for now */ | |
521 /* display the full picture. | |
522 Nick: we could implement here zooming to a specified area -- alex */ | |
523 vidix_play.src.x = vidix_play.src.y = 0; | |
524 vidix_play.src.w = src_width; | |
525 vidix_play.src.h = src_height; | |
526 vidix_play.dest.x = x_org; | |
527 vidix_play.dest.y = y_org; | |
528 vidix_play.dest.w = dst_width; | |
529 vidix_play.dest.h = dst_height; | |
4929 | 530 vidix_play.num_frames=vo_doublebuffering?NUM_FRAMES-1:1; |
4454 | 531 vidix_play.src.pitch.y = vidix_play.src.pitch.u = vidix_play.src.pitch.v = 0; |
532 if(info) | |
533 { | |
534 switch(((const vo_tune_info_t *)info)->pitch[0]) | |
535 { | |
536 case 2: | |
537 case 4: | |
538 case 8: | |
539 case 16: | |
540 case 32: | |
541 case 64: | |
542 case 128: | |
543 case 256: vidix_play.src.pitch.y = ((const vo_tune_info_t *)info)->pitch[0]; | |
544 break; | |
545 default: break; | |
546 } | |
547 switch(((const vo_tune_info_t *)info)->pitch[1]) | |
548 { | |
549 case 2: | |
550 case 4: | |
551 case 8: | |
552 case 16: | |
553 case 32: | |
554 case 64: | |
555 case 128: | |
556 case 256: vidix_play.src.pitch.u = ((const vo_tune_info_t *)info)->pitch[1]; | |
557 break; | |
558 default: break; | |
559 } | |
560 switch(((const vo_tune_info_t *)info)->pitch[2]) | |
561 { | |
562 case 2: | |
563 case 4: | |
564 case 8: | |
565 case 16: | |
566 case 32: | |
567 case 64: | |
568 case 128: | |
569 case 256: vidix_play.src.pitch.v = ((const vo_tune_info_t *)info)->pitch[2]; | |
570 break; | |
571 default: break; | |
572 } | |
573 } | |
574 if((err=vdlConfigPlayback(vidix_handler,&vidix_play))!=0) | |
575 { | |
576 printf("vosub_vidix: Can't configure playback: %s\n",strerror(err)); | |
577 return -1; | |
578 } | |
6550
991e03ca5ceb
added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents:
6531
diff
changeset
|
579 if (verbose) printf("vosub_vidix: using %d buffer(s)\n", vidix_play.num_frames); |
4454 | 580 |
581 vidix_mem = vidix_play.dga_addr; | |
582 | |
583 /* select first frame */ | |
584 next_frame = 0; | |
585 // vdlPlaybackFrameSelect(vidix_handler,next_frame); | |
586 | |
587 /* clear every frame with correct address and frame_size */ | |
588 for (i = 0; i < vidix_play.num_frames; i++) | |
589 memset(vidix_mem + vidix_play.offsets[i], 0x80, | |
590 vidix_play.frame_size); | |
4999 | 591 switch(format) |
592 { | |
6550
991e03ca5ceb
added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents:
6531
diff
changeset
|
593 case IMGFMT_YV12: |
991e03ca5ceb
added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents:
6531
diff
changeset
|
594 case IMGFMT_I420: |
991e03ca5ceb
added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents:
6531
diff
changeset
|
595 case IMGFMT_IYUV: |
6482
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
596 case IMGFMT_YVU9: |
4999 | 597 case IMGFMT_IF09: |
6550
991e03ca5ceb
added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents:
6531
diff
changeset
|
598 case IMGFMT_Y800: |
991e03ca5ceb
added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents:
6531
diff
changeset
|
599 case IMGFMT_Y8: |
4999 | 600 apitch = vidix_play.dest.pitch.y-1; |
601 dstrides.y = (image_width + apitch) & ~apitch; | |
602 apitch = vidix_play.dest.pitch.v-1; | |
603 dstrides.v = (image_width + apitch) & ~apitch; | |
604 apitch = vidix_play.dest.pitch.u-1; | |
605 dstrides.u = (image_width + apitch) & ~apitch; | |
606 image_Bpp=1; | |
607 break; | |
608 case IMGFMT_RGB32: | |
609 case IMGFMT_BGR32: | |
610 apitch = vidix_play.dest.pitch.y-1; | |
611 dstrides.y = (image_width*4 + apitch) & ~apitch; | |
612 dstrides.u = dstrides.v = 0; | |
613 image_Bpp=4; | |
614 break; | |
615 case IMGFMT_RGB24: | |
616 case IMGFMT_BGR24: | |
617 apitch = vidix_play.dest.pitch.y-1; | |
618 dstrides.y = (image_width*3 + apitch) & ~apitch; | |
619 dstrides.u = dstrides.v = 0; | |
620 image_Bpp=3; | |
621 break; | |
622 default: | |
623 apitch = vidix_play.dest.pitch.y-1; | |
624 dstrides.y = (image_width*2 + apitch) & ~apitch; | |
625 dstrides.u = dstrides.v = 0; | |
626 image_Bpp=2; | |
627 break; | |
628 } | |
4454 | 629 /* tune some info here */ |
6482
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
630 sstride = src_width*image_Bpp; |
5052
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
631 if(!forced_fourcc) |
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
632 { |
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
633 is_422_planes_eq = sstride == dstrides.y; |
6482
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
634 |
5052
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
635 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
|
636 vo_server->draw_slice = vidix_draw_slice_420; |
6482
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
637 else if (src_format == IMGFMT_YVU9 || src_format == IMGFMT_IF09) |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
638 vo_server->draw_slice = vidix_draw_slice_410; |
5052
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
639 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
|
640 is_422_planes_eq ? |
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
641 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
|
642 vidix_draw_slice_packed; |
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
643 } |
4454 | 644 return 0; |
645 } | |
646 | |
4991 | 647 static uint32_t vidix_get_image(mp_image_t *mpi) |
648 { | |
649 if(mpi->type==MP_IMGTYPE_STATIC && vidix_play.num_frames>1) return VO_FALSE; | |
650 if(mpi->flags&MP_IMGFLAG_READABLE) return VO_FALSE; /* slow video ram */ | |
6550
991e03ca5ceb
added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents:
6531
diff
changeset
|
651 if((is_422_planes_eq || (mpi->flags&(MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_ACCEPT_WIDTH))) && |
991e03ca5ceb
added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents:
6531
diff
changeset
|
652 (!forced_fourcc && !(vidix_play.flags & VID_PLAY_INTERLEAVED_UV))) |
4991 | 653 { |
5373 | 654 if(mpi->flags&MP_IMGFLAG_ACCEPT_WIDTH){ |
655 // check if only width is enough to represent strides: | |
656 if(mpi->flags&MP_IMGFLAG_PLANAR){ | |
657 if((dstrides.y>>1)!=dstrides.v || dstrides.v!=dstrides.u) return VO_FALSE; | |
658 } else { | |
659 if(dstrides.y % (mpi->bpp/8)) return VO_FALSE; | |
660 } | |
661 } | |
5028 | 662 mpi->planes[0]=vidix_mem+vidix_play.offsets[next_frame]+vidix_play.offset.y; |
5373 | 663 mpi->width=mpi->stride[0]=dstrides.y; |
5028 | 664 if(mpi->flags&MP_IMGFLAG_PLANAR) |
665 { | |
666 mpi->planes[2]=vidix_mem+vidix_play.offsets[next_frame]+vidix_play.offset.v; | |
667 mpi->stride[2]=dstrides.v; | |
668 mpi->planes[1]=vidix_mem+vidix_play.offsets[next_frame]+vidix_play.offset.u; | |
669 mpi->stride[1]=dstrides.u; | |
5373 | 670 } else |
671 mpi->width/=mpi->bpp/8; | |
5028 | 672 mpi->flags|=MP_IMGFLAG_DIRECT; |
5373 | 673 return VO_TRUE; |
4991 | 674 } |
5373 | 675 return VO_FALSE; |
4991 | 676 } |
677 | |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4540
diff
changeset
|
678 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
|
679 { |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4540
diff
changeset
|
680 switch (request) { |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4540
diff
changeset
|
681 case VOCTRL_QUERY_FORMAT: |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4540
diff
changeset
|
682 return vidix_query_fourcc(*((uint32_t*)data)); |
4991 | 683 case VOCTRL_GET_IMAGE: |
684 return vidix_get_image(data); | |
5002 | 685 case VOCTRL_GET_FRAME_NUM: |
686 *(uint32_t *)data = next_frame; | |
687 return VO_TRUE; | |
688 case VOCTRL_SET_FRAME_NUM: | |
689 next_frame = *(uint32_t *)data; | |
690 return VO_TRUE; | |
691 case VOCTRL_GET_NUM_FRAMES: | |
692 *(uint32_t *)data = vidix_play.num_frames; | |
693 return VO_TRUE; | |
6786 | 694 case VOCTRL_SET_EQUALIZER: |
695 { | |
696 va_list ap; | |
697 int value; | |
698 vidix_video_eq_t info; | |
699 | |
700 if(!video_on) return VO_FALSE; | |
701 va_start(ap, data); | |
702 value = va_arg(ap, int); | |
703 va_end(ap); | |
704 | |
6806 | 705 // printf("vidix seteq %s -> %d \n",data,value); |
706 | |
6786 | 707 /* vidix eq ranges are -1000..1000 */ |
708 if (!strcasecmp(data, "brightness")) | |
709 { | |
710 info.brightness = value*10; | |
6806 | 711 info.cap = VEQ_CAP_BRIGHTNESS; |
6786 | 712 } |
713 else if (!strcasecmp(data, "contrast")) | |
714 { | |
715 info.contrast = value*10; | |
6806 | 716 info.cap = VEQ_CAP_CONTRAST; |
6786 | 717 } |
718 else if (!strcasecmp(data, "saturation")) | |
719 { | |
720 info.saturation = value*10; | |
6806 | 721 info.cap = VEQ_CAP_SATURATION; |
6786 | 722 } |
723 else if (!strcasecmp(data, "hue")) | |
724 { | |
725 info.hue = value*10; | |
6806 | 726 info.cap = VEQ_CAP_HUE; |
6786 | 727 } |
728 | |
729 if (vdlPlaybackSetEq(vidix_handler, &info) == 0) | |
730 return VO_TRUE; | |
731 return VO_FALSE; | |
732 } | |
733 case VOCTRL_GET_EQUALIZER: | |
734 { | |
735 va_list ap; | |
736 int *value; | |
737 vidix_video_eq_t info; | |
738 | |
739 if(!video_on) return VO_FALSE; | |
6806 | 740 if (vdlPlaybackGetEq(vidix_handler, &info) != 0) |
6786 | 741 return VO_FALSE; |
742 | |
743 va_start(ap, data); | |
6806 | 744 value = va_arg(ap, int*); |
6786 | 745 va_end(ap); |
746 | |
747 /* vidix eq ranges are -1000..1000 */ | |
748 if (!strcasecmp(data, "brightness")) | |
749 { | |
750 if (info.cap & VEQ_CAP_BRIGHTNESS) | |
751 *value = info.brightness/10; | |
752 } | |
753 else if (!strcasecmp(data, "contrast")) | |
754 { | |
755 if (info.cap & VEQ_CAP_CONTRAST) | |
756 *value = info.contrast/10; | |
757 } | |
758 else if (!strcasecmp(data, "saturation")) | |
759 { | |
760 if (info.cap & VEQ_CAP_SATURATION) | |
761 *value = info.saturation/10; | |
762 } | |
763 else if (!strcasecmp(data, "hue")) | |
764 { | |
765 if (info.cap & VEQ_CAP_HUE) | |
766 *value = info.hue/10; | |
767 } | |
768 | |
769 return VO_TRUE; | |
770 } | |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4540
diff
changeset
|
771 } |
6531 | 772 return VO_NOTIMPL; |
5319 | 773 // WARNING: we drop extra parameters (...) here! |
6531 | 774 // return server_control(request,data); //VO_NOTIMPL; |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4540
diff
changeset
|
775 } |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4540
diff
changeset
|
776 |
4454 | 777 int vidix_preinit(const char *drvname,void *server) |
778 { | |
779 int err; | |
780 if(verbose > 1) printf("vosub_vidix: vidix_preinit(%s) was called\n",drvname); | |
781 if(vdlGetVersion() != VIDIX_VERSION) | |
782 { | |
783 printf("vosub_vidix: You have wrong version of VIDIX library\n"); | |
784 return -1; | |
785 } | |
5814 | 786 vidix_handler = vdlOpen(LIBDIR"/mplayer/vidix/", |
4454 | 787 drvname ? drvname[0] == ':' ? &drvname[1] : drvname[0] ? drvname : NULL : NULL, |
788 TYPE_OUTPUT, | |
789 verbose); | |
790 if(vidix_handler == NULL) | |
791 { | |
792 printf("vosub_vidix: Couldn't find working VIDIX driver\n"); | |
793 return -1; | |
794 } | |
795 if((err=vdlGetCapability(vidix_handler,&vidix_cap)) != 0) | |
796 { | |
797 printf("vosub_vidix: Couldn't get capability: %s\n",strerror(err)); | |
798 return -1; | |
799 } | |
6786 | 800 printf("VIDIX: Description: %s\n", vidix_cap.name); |
801 printf("VIDIX: Author: %s\n", vidix_cap.author); | |
4454 | 802 /* we are able to tune up this stuff depend on fourcc format */ |
803 ((vo_functions_t *)server)->draw_slice=vidix_draw_slice; | |
804 ((vo_functions_t *)server)->draw_frame=vidix_draw_frame; | |
805 ((vo_functions_t *)server)->flip_page=vidix_flip_page; | |
806 ((vo_functions_t *)server)->draw_osd=vidix_draw_osd; | |
6550
991e03ca5ceb
added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents:
6531
diff
changeset
|
807 // server_control = ((vo_functions_t *)server)->control; |
991e03ca5ceb
added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents:
6531
diff
changeset
|
808 // ((vo_functions_t *)server)->control=vidix_control; |
4454 | 809 vo_server = server; |
810 return 0; | |
811 } |