Mercurial > mplayer.hg
annotate libvo/vosub_vidix.c @ 11680:f2f7c22847b3
added capital letter at the beginning of the sentence
author | paszczi |
---|---|
date | Wed, 24 Dec 2003 23:59:50 +0000 |
parents | 656932ca58ab |
children | e49a62a6e3cb |
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 <unistd.h> | |
16 #include <fcntl.h> | |
10981 | 17 #ifndef __MINGW32__ |
18 #include <sys/ioctl.h> | |
4010 | 19 #include <sys/mman.h> |
10981 | 20 #endif |
4010 | 21 #include <stdio.h> |
22 #include <stdlib.h> | |
23 #include <string.h> | |
4372 | 24 #include <errno.h> |
4010 | 25 |
26 #include "config.h" | |
27 | |
28 #include "vosub_vidix.h" | |
29 #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
|
30 #include "../postproc/rgb2rgb.h" |
4010 | 31 #include "fastmemcpy.h" |
32 #include "osd.h" | |
33 #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
|
34 #include "sub.h" |
4991 | 35 |
5566 | 36 #include "../libmpcodecs/vfcap.h" |
5607 | 37 #include "../libmpcodecs/mp_image.h" |
4010 | 38 |
4929 | 39 #define NUM_FRAMES VID_PLAY_MAXFRAMES /* Temporary: driver will overwrite it */ |
4010 | 40 |
41 static VDL_HANDLE vidix_handler = NULL; | |
42 static uint8_t *vidix_mem = NULL; | |
43 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
|
44 static unsigned image_Bpp,image_height,image_width,src_format,forced_fourcc=0; |
4010 | 45 extern int verbose; |
4372 | 46 static int video_on=0; |
4010 | 47 |
48 static vidix_capability_t vidix_cap; | |
49 static vidix_playback_t vidix_play; | |
50 static vidix_fourcc_t vidix_fourcc; | |
4454 | 51 static vo_functions_t * vo_server; |
4999 | 52 static vidix_yuv_t dstrides; |
8254
772d6d27fd66
warning patch by (Dominik Mierzejewski <dominik at rangers dot eu dot org>)
michael
parents:
7694
diff
changeset
|
53 /*static uint32_t (*server_control)(uint32_t request, void *data, ...);*/ |
4739 | 54 |
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 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
|
210 dest += dstrides.y*y + x; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
211 src = image[0]; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
212 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
|
213 return 0; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
214 } |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
215 |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
216 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
|
217 { |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
218 uint8_t *src; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
219 uint8_t *dest; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
220 int i; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
221 |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
222 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
|
223 dest += dstrides.y*y + x; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
224 src = image[0]; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
225 for(i=0;i<h;i++){ |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
226 memcpy(dest,src,w); |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
227 src+=stride[0]; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
228 dest += dstrides.y; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
229 } |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
230 return 0; |
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 |
4999 | 233 static uint32_t vidix_draw_slice_packed(uint8_t *image[], int stride[], int w,int h,int x,int y) |
4010 | 234 { |
235 uint8_t *src; | |
236 uint8_t *dest; | |
237 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
|
238 |
4032 | 239 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y; |
4999 | 240 dest += dstrides.y*y + x; |
4010 | 241 src = image[0]; |
242 for(i=0;i<h;i++){ | |
4999 | 243 memcpy(dest,src,w*image_Bpp); |
4010 | 244 src+=stride[0]; |
4999 | 245 dest += dstrides.y; |
4010 | 246 } |
4240 | 247 return 0; |
4010 | 248 } |
249 | |
250 uint32_t vidix_draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y) | |
251 { | |
10605 | 252 printf("vosub_vidix: dummy vidix_draw_slice() was called\n"); |
253 return -1; | |
4010 | 254 } |
255 | |
7685 | 256 static uint32_t vidix_draw_image(mp_image_t *mpi){ |
257 if(verbose > 1) printf("vosub_vidix: vidix_draw_image() was called\n"); | |
258 | |
259 // if -dr or -slices then do nothing: | |
260 if(mpi->flags&(MP_IMGFLAG_DIRECT|MP_IMGFLAG_DRAW_CALLBACK)) return VO_TRUE; | |
261 | |
262 vo_server->draw_slice(mpi->planes,mpi->stride, | |
263 vidix_play.src.w,vidix_play.src.h,vidix_play.src.x,vidix_play.src.y); | |
264 return VO_TRUE; | |
265 } | |
266 | |
4010 | 267 uint32_t vidix_draw_frame(uint8_t *image[]) |
268 { | |
10605 | 269 printf("vosub_vidix: dummy vidix_draw_frame() was called\n"); |
7685 | 270 return -1; |
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(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride) | |
284 { | |
4032 | 285 uint32_t apitch,bespitch; |
4010 | 286 void *lvo_mem; |
4032 | 287 lvo_mem = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y; |
288 apitch = vidix_play.dest.pitch.y-1; | |
4010 | 289 switch(vidix_play.fourcc){ |
290 case IMGFMT_YV12: | |
291 case IMGFMT_IYUV: | |
292 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
|
293 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
|
294 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
|
295 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
|
296 case IMGFMT_Y800: |
4745
398e3663ed71
Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents:
4744
diff
changeset
|
297 bespitch = (vidix_play.src.w + apitch) & (~apitch); |
4010 | 298 vo_draw_alpha_yv12(w,h,src,srca,stride,lvo_mem+bespitch*y0+x0,bespitch); |
299 break; | |
300 case IMGFMT_YUY2: | |
4745
398e3663ed71
Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents:
4744
diff
changeset
|
301 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
|
302 vo_draw_alpha_yuy2(w,h,src,srca,stride,lvo_mem+bespitch*y0+2*x0,bespitch); |
4010 | 303 break; |
304 case IMGFMT_UYVY: | |
4745
398e3663ed71
Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents:
4744
diff
changeset
|
305 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
|
306 vo_draw_alpha_yuy2(w,h,src,srca,stride,lvo_mem+bespitch*y0+2*x0+1,bespitch); |
4010 | 307 break; |
4430 | 308 case IMGFMT_RGB32: |
309 case IMGFMT_BGR32: | |
4745
398e3663ed71
Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents:
4744
diff
changeset
|
310 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
|
311 vo_draw_alpha_rgb32(w,h,src,srca,stride,lvo_mem+y0*bespitch+4*x0,bespitch); |
4430 | 312 break; |
313 case IMGFMT_RGB24: | |
314 case IMGFMT_BGR24: | |
4745
398e3663ed71
Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents:
4744
diff
changeset
|
315 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
|
316 vo_draw_alpha_rgb24(w,h,src,srca,stride,lvo_mem+y0*bespitch+3*x0,bespitch); |
4430 | 317 break; |
318 case IMGFMT_RGB16: | |
319 case IMGFMT_BGR16: | |
4745
398e3663ed71
Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents:
4744
diff
changeset
|
320 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
|
321 vo_draw_alpha_rgb16(w,h,src,srca,stride,lvo_mem+y0*bespitch+2*x0,bespitch); |
4430 | 322 break; |
323 case IMGFMT_RGB15: | |
324 case IMGFMT_BGR15: | |
4745
398e3663ed71
Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents:
4744
diff
changeset
|
325 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
|
326 vo_draw_alpha_rgb15(w,h,src,srca,stride,lvo_mem+y0*bespitch+2*x0,bespitch); |
4430 | 327 break; |
4010 | 328 default: |
6786 | 329 return; |
4010 | 330 } |
331 } | |
332 | |
333 void vidix_draw_osd(void) | |
334 { | |
335 if(verbose > 1) printf("vosub_vidix: vidix_draw_osd() was called\n"); | |
336 /* TODO: hw support */ | |
337 vo_draw_text(vidix_play.src.w,vidix_play.src.h,draw_alpha); | |
338 } | |
339 | |
340 uint32_t vidix_query_fourcc(uint32_t format) | |
341 { | |
342 if(verbose > 1) printf("vosub_vidix: query_format was called: %x (%s)\n",format,vo_format_name(format)); | |
343 vidix_fourcc.fourcc = format; | |
344 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
|
345 if (vidix_fourcc.depth == VID_DEPTH_NONE) |
5566 | 346 return 0; |
7694
b64f14fdadfb
also set VFCAP_ACCEPT_STRIDE when draw_image() is implemented
arpi
parents:
7685
diff
changeset
|
347 return VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW|VFCAP_HWSCALE_UP|VFCAP_HWSCALE_DOWN|VFCAP_OSD|VFCAP_ACCEPT_STRIDE; |
4010 | 348 } |
4240 | 349 |
4255 | 350 int vidix_grkey_support(void) |
351 { | |
4270
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
352 return(vidix_fourcc.flags & VID_CAP_COLORKEY); |
4255 | 353 } |
354 | |
4240 | 355 int vidix_grkey_get(vidix_grkey_t *gr_key) |
356 { | |
357 return(vdlGetGrKeys(vidix_handler, gr_key)); | |
358 } | |
359 | |
360 int vidix_grkey_set(const vidix_grkey_t *gr_key) | |
361 { | |
362 return(vdlSetGrKeys(vidix_handler, gr_key)); | |
363 } | |
4372 | 364 |
4379 | 365 |
366 static int vidix_get_video_eq(vidix_video_eq_t *info) | |
367 { | |
368 if(!video_on) return EPERM; | |
369 return vdlPlaybackGetEq(vidix_handler, info); | |
370 } | |
371 | |
372 static int vidix_set_video_eq(const vidix_video_eq_t *info) | |
373 { | |
374 if(!video_on) return EPERM; | |
375 return vdlPlaybackSetEq(vidix_handler, info); | |
376 } | |
377 | |
378 static int vidix_get_num_fx(unsigned *info) | |
379 { | |
380 if(!video_on) return EPERM; | |
381 return vdlQueryNumOemEffects(vidix_handler, info); | |
382 } | |
383 | |
384 static int vidix_get_oem_fx(vidix_oem_fx_t *info) | |
385 { | |
386 if(!video_on) return EPERM; | |
387 return vdlGetOemEffect(vidix_handler, info); | |
388 } | |
389 | |
390 static int vidix_set_oem_fx(const vidix_oem_fx_t *info) | |
391 { | |
392 if(!video_on) return EPERM; | |
393 return vdlSetOemEffect(vidix_handler, info); | |
394 } | |
395 | |
396 static int vidix_set_deint(const vidix_deinterlace_t *info) | |
397 { | |
398 if(!video_on) return EPERM; | |
399 return vdlPlaybackSetDeint(vidix_handler, info); | |
400 } | |
4454 | 401 |
5028 | 402 static int is_422_planes_eq=0; |
4454 | 403 int vidix_init(unsigned src_width,unsigned src_height, |
404 unsigned x_org,unsigned y_org,unsigned dst_width, | |
405 unsigned dst_height,unsigned format,unsigned dest_bpp, | |
7124
eca7dbad0166
finally removed query_vaa, bes_da and vo_tune_info - the obsoleted libvo api
alex
parents:
7026
diff
changeset
|
406 unsigned vid_w,unsigned vid_h) |
4454 | 407 { |
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
|
408 size_t i; |
5028 | 409 int err; |
4999 | 410 uint32_t sstride,apitch; |
4454 | 411 if(verbose > 1) |
412 printf("vosub_vidix: vidix_init() was called\n" | |
413 "src_w=%u src_h=%u dest_x_y_w_h = %u %u %u %u\n" | |
414 "format=%s dest_bpp=%u vid_w=%u vid_h=%u\n" | |
415 ,src_width,src_height,x_org,y_org,dst_width,dst_height | |
416 ,vo_format_name(format),dest_bpp,vid_w,vid_h); | |
417 | |
7026
a3126e9099b4
should solve -vo vesa:vidix problem 'vosub_vidix: video server has
arpi
parents:
6806
diff
changeset
|
418 if(vidix_query_fourcc(format) == 0) |
a3126e9099b4
should solve -vo vesa:vidix problem 'vosub_vidix: video server has
arpi
parents:
6806
diff
changeset
|
419 { |
a3126e9099b4
should solve -vo vesa:vidix problem 'vosub_vidix: video server has
arpi
parents:
6806
diff
changeset
|
420 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
|
421 format,vo_format_name(format)); |
a3126e9099b4
should solve -vo vesa:vidix problem 'vosub_vidix: video server has
arpi
parents:
6806
diff
changeset
|
422 return -1; |
a3126e9099b4
should solve -vo vesa:vidix problem 'vosub_vidix: video server has
arpi
parents:
6806
diff
changeset
|
423 } |
a3126e9099b4
should solve -vo vesa:vidix problem 'vosub_vidix: video server has
arpi
parents:
6806
diff
changeset
|
424 |
4454 | 425 if(((vidix_cap.maxwidth != -1) && (vid_w > vidix_cap.maxwidth)) || |
426 ((vidix_cap.minwidth != -1) && (vid_w < vidix_cap.minwidth)) || | |
427 ((vidix_cap.maxheight != -1) && (vid_h > vidix_cap.maxheight)) || | |
428 ((vidix_cap.minwidth != -1 ) && (vid_h < vidix_cap.minheight))) | |
429 { | |
430 printf("vosub_vidix: video server has unsupported resolution (%dx%d), supported: %dx%d-%dx%d\n", | |
431 vid_w, vid_h, vidix_cap.minwidth, vidix_cap.minheight, | |
432 vidix_cap.maxwidth, vidix_cap.maxheight); | |
433 return -1; | |
434 } | |
435 | |
436 err = 0; | |
437 switch(dest_bpp) | |
438 { | |
439 case 1: err = ((vidix_fourcc.depth & VID_DEPTH_1BPP) != VID_DEPTH_1BPP); break; | |
440 case 2: err = ((vidix_fourcc.depth & VID_DEPTH_2BPP) != VID_DEPTH_2BPP); break; | |
441 case 4: err = ((vidix_fourcc.depth & VID_DEPTH_4BPP) != VID_DEPTH_4BPP); break; | |
442 case 8: err = ((vidix_fourcc.depth & VID_DEPTH_8BPP) != VID_DEPTH_8BPP); break; | |
443 case 12:err = ((vidix_fourcc.depth & VID_DEPTH_12BPP) != VID_DEPTH_12BPP); break; | |
4540 | 444 case 15:err = ((vidix_fourcc.depth & VID_DEPTH_15BPP) != VID_DEPTH_15BPP); break; |
4454 | 445 case 16:err = ((vidix_fourcc.depth & VID_DEPTH_16BPP) != VID_DEPTH_16BPP); break; |
446 case 24:err = ((vidix_fourcc.depth & VID_DEPTH_24BPP) != VID_DEPTH_24BPP); break; | |
447 case 32:err = ((vidix_fourcc.depth & VID_DEPTH_32BPP) != VID_DEPTH_32BPP); break; | |
448 default: err=1; break; | |
449 } | |
450 if(err) | |
451 { | |
452 printf("vosub_vidix: video server has unsupported color depth by vidix (%d)\n" | |
453 ,vidix_fourcc.depth); | |
454 return -1; | |
455 } | |
456 if((dst_width > src_width || dst_height > src_height) && (vidix_cap.flags & FLAG_UPSCALER) != FLAG_UPSCALER) | |
457 { | |
458 printf("vosub_vidix: vidix driver can't upscale image (%d%d -> %d%d)\n", | |
459 src_width, src_height, dst_width, dst_height); | |
460 return -1; | |
461 } | |
462 if((dst_width > src_width || dst_height > src_height) && (vidix_cap.flags & FLAG_DOWNSCALER) != FLAG_DOWNSCALER) | |
463 { | |
464 printf("vosub_vidix: vidix driver can't downscale image (%d%d -> %d%d)\n", | |
465 src_width, src_height, dst_width, dst_height); | |
466 return -1; | |
467 } | |
468 image_width = src_width; | |
469 image_height = src_height; | |
470 src_format = format; | |
5052
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
471 if(forced_fourcc) format = forced_fourcc; |
4454 | 472 memset(&vidix_play,0,sizeof(vidix_playback_t)); |
473 vidix_play.fourcc = format; | |
474 vidix_play.capability = vidix_cap.flags; /* every ;) */ | |
475 vidix_play.blend_factor = 0; /* for now */ | |
476 /* display the full picture. | |
477 Nick: we could implement here zooming to a specified area -- alex */ | |
478 vidix_play.src.x = vidix_play.src.y = 0; | |
479 vidix_play.src.w = src_width; | |
480 vidix_play.src.h = src_height; | |
481 vidix_play.dest.x = x_org; | |
482 vidix_play.dest.y = y_org; | |
483 vidix_play.dest.w = dst_width; | |
484 vidix_play.dest.h = dst_height; | |
8459
2ce7bbdcee15
this isn't mplayerxp...3 buffers are enough for double(triple)buffering (instead of 28 buffers ;)
alex
parents:
8254
diff
changeset
|
485 // vidix_play.num_frames=vo_doublebuffering?NUM_FRAMES-1:1; |
2ce7bbdcee15
this isn't mplayerxp...3 buffers are enough for double(triple)buffering (instead of 28 buffers ;)
alex
parents:
8254
diff
changeset
|
486 /* we aren't mad...3 buffers are more than enough */ |
2ce7bbdcee15
this isn't mplayerxp...3 buffers are enough for double(triple)buffering (instead of 28 buffers ;)
alex
parents:
8254
diff
changeset
|
487 vidix_play.num_frames=vo_doublebuffering?3:1; |
4454 | 488 vidix_play.src.pitch.y = vidix_play.src.pitch.u = vidix_play.src.pitch.v = 0; |
7124
eca7dbad0166
finally removed query_vaa, bes_da and vo_tune_info - the obsoleted libvo api
alex
parents:
7026
diff
changeset
|
489 |
4454 | 490 if((err=vdlConfigPlayback(vidix_handler,&vidix_play))!=0) |
491 { | |
492 printf("vosub_vidix: Can't configure playback: %s\n",strerror(err)); | |
493 return -1; | |
494 } | |
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
|
495 if (verbose) printf("vosub_vidix: using %d buffer(s)\n", vidix_play.num_frames); |
4454 | 496 |
497 vidix_mem = vidix_play.dga_addr; | |
498 | |
499 /* select first frame */ | |
500 next_frame = 0; | |
501 // vdlPlaybackFrameSelect(vidix_handler,next_frame); | |
502 | |
503 /* clear every frame with correct address and frame_size */ | |
504 for (i = 0; i < vidix_play.num_frames; i++) | |
505 memset(vidix_mem + vidix_play.offsets[i], 0x80, | |
506 vidix_play.frame_size); | |
4999 | 507 switch(format) |
508 { | |
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
|
509 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
|
510 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
|
511 case IMGFMT_IYUV: |
6482
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
512 case IMGFMT_YVU9: |
4999 | 513 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
|
514 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
|
515 case IMGFMT_Y8: |
4999 | 516 apitch = vidix_play.dest.pitch.y-1; |
517 dstrides.y = (image_width + apitch) & ~apitch; | |
518 apitch = vidix_play.dest.pitch.v-1; | |
519 dstrides.v = (image_width + apitch) & ~apitch; | |
520 apitch = vidix_play.dest.pitch.u-1; | |
521 dstrides.u = (image_width + apitch) & ~apitch; | |
522 image_Bpp=1; | |
523 break; | |
524 case IMGFMT_RGB32: | |
525 case IMGFMT_BGR32: | |
526 apitch = vidix_play.dest.pitch.y-1; | |
527 dstrides.y = (image_width*4 + apitch) & ~apitch; | |
528 dstrides.u = dstrides.v = 0; | |
529 image_Bpp=4; | |
530 break; | |
531 case IMGFMT_RGB24: | |
532 case IMGFMT_BGR24: | |
533 apitch = vidix_play.dest.pitch.y-1; | |
534 dstrides.y = (image_width*3 + apitch) & ~apitch; | |
535 dstrides.u = dstrides.v = 0; | |
536 image_Bpp=3; | |
537 break; | |
538 default: | |
539 apitch = vidix_play.dest.pitch.y-1; | |
540 dstrides.y = (image_width*2 + apitch) & ~apitch; | |
541 dstrides.u = dstrides.v = 0; | |
542 image_Bpp=2; | |
543 break; | |
544 } | |
4454 | 545 /* tune some info here */ |
6482
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
546 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
|
547 if(!forced_fourcc) |
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
548 { |
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
549 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
|
550 |
5052
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
551 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
|
552 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
|
553 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
|
554 vo_server->draw_slice = vidix_draw_slice_410; |
7685 | 555 else vo_server->draw_slice = vidix_draw_slice_packed; |
5052
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
556 } |
4454 | 557 return 0; |
558 } | |
559 | |
4991 | 560 static uint32_t vidix_get_image(mp_image_t *mpi) |
561 { | |
562 if(mpi->type==MP_IMGTYPE_STATIC && vidix_play.num_frames>1) return VO_FALSE; | |
563 if(mpi->flags&MP_IMGFLAG_READABLE) return VO_FALSE; /* slow video ram */ | |
7685 | 564 if(( (mpi->stride[0]==dstrides.y && (!(mpi->flags&MP_IMGFLAG_PLANAR) || |
565 (mpi->stride[1]==dstrides.u && mpi->stride[2]==dstrides.v)) ) | |
566 || (mpi->flags&(MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_ACCEPT_WIDTH))) && | |
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
|
567 (!forced_fourcc && !(vidix_play.flags & VID_PLAY_INTERLEAVED_UV))) |
4991 | 568 { |
5373 | 569 if(mpi->flags&MP_IMGFLAG_ACCEPT_WIDTH){ |
570 // check if only width is enough to represent strides: | |
571 if(mpi->flags&MP_IMGFLAG_PLANAR){ | |
572 if((dstrides.y>>1)!=dstrides.v || dstrides.v!=dstrides.u) return VO_FALSE; | |
573 } else { | |
574 if(dstrides.y % (mpi->bpp/8)) return VO_FALSE; | |
575 } | |
576 } | |
5028 | 577 mpi->planes[0]=vidix_mem+vidix_play.offsets[next_frame]+vidix_play.offset.y; |
5373 | 578 mpi->width=mpi->stride[0]=dstrides.y; |
5028 | 579 if(mpi->flags&MP_IMGFLAG_PLANAR) |
580 { | |
11553 | 581 mpi->planes[1]=vidix_mem+vidix_play.offsets[next_frame]+vidix_play.offset.v; |
582 mpi->stride[1]=dstrides.v >> mpi->chroma_x_shift; | |
583 mpi->planes[2]=vidix_mem+vidix_play.offsets[next_frame]+vidix_play.offset.u; | |
584 mpi->stride[2]=dstrides.u >> mpi->chroma_x_shift; | |
5373 | 585 } else |
586 mpi->width/=mpi->bpp/8; | |
5028 | 587 mpi->flags|=MP_IMGFLAG_DIRECT; |
5373 | 588 return VO_TRUE; |
4991 | 589 } |
5373 | 590 return VO_FALSE; |
4991 | 591 } |
592 | |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4540
diff
changeset
|
593 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
|
594 { |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4540
diff
changeset
|
595 switch (request) { |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4540
diff
changeset
|
596 case VOCTRL_QUERY_FORMAT: |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4540
diff
changeset
|
597 return vidix_query_fourcc(*((uint32_t*)data)); |
4991 | 598 case VOCTRL_GET_IMAGE: |
599 return vidix_get_image(data); | |
7685 | 600 case VOCTRL_DRAW_IMAGE: |
601 return vidix_draw_image(data); | |
5002 | 602 case VOCTRL_GET_FRAME_NUM: |
603 *(uint32_t *)data = next_frame; | |
604 return VO_TRUE; | |
605 case VOCTRL_SET_FRAME_NUM: | |
606 next_frame = *(uint32_t *)data; | |
607 return VO_TRUE; | |
608 case VOCTRL_GET_NUM_FRAMES: | |
609 *(uint32_t *)data = vidix_play.num_frames; | |
610 return VO_TRUE; | |
6786 | 611 case VOCTRL_SET_EQUALIZER: |
612 { | |
613 va_list ap; | |
614 int value; | |
615 vidix_video_eq_t info; | |
616 | |
617 if(!video_on) return VO_FALSE; | |
618 va_start(ap, data); | |
619 value = va_arg(ap, int); | |
620 va_end(ap); | |
621 | |
6806 | 622 // printf("vidix seteq %s -> %d \n",data,value); |
623 | |
6786 | 624 /* vidix eq ranges are -1000..1000 */ |
625 if (!strcasecmp(data, "brightness")) | |
626 { | |
627 info.brightness = value*10; | |
6806 | 628 info.cap = VEQ_CAP_BRIGHTNESS; |
6786 | 629 } |
630 else if (!strcasecmp(data, "contrast")) | |
631 { | |
632 info.contrast = value*10; | |
6806 | 633 info.cap = VEQ_CAP_CONTRAST; |
6786 | 634 } |
635 else if (!strcasecmp(data, "saturation")) | |
636 { | |
637 info.saturation = value*10; | |
6806 | 638 info.cap = VEQ_CAP_SATURATION; |
6786 | 639 } |
640 else if (!strcasecmp(data, "hue")) | |
641 { | |
642 info.hue = value*10; | |
6806 | 643 info.cap = VEQ_CAP_HUE; |
6786 | 644 } |
645 | |
646 if (vdlPlaybackSetEq(vidix_handler, &info) == 0) | |
647 return VO_TRUE; | |
648 return VO_FALSE; | |
649 } | |
650 case VOCTRL_GET_EQUALIZER: | |
651 { | |
652 va_list ap; | |
653 int *value; | |
654 vidix_video_eq_t info; | |
655 | |
656 if(!video_on) return VO_FALSE; | |
6806 | 657 if (vdlPlaybackGetEq(vidix_handler, &info) != 0) |
6786 | 658 return VO_FALSE; |
659 | |
660 va_start(ap, data); | |
6806 | 661 value = va_arg(ap, int*); |
6786 | 662 va_end(ap); |
663 | |
664 /* vidix eq ranges are -1000..1000 */ | |
665 if (!strcasecmp(data, "brightness")) | |
666 { | |
667 if (info.cap & VEQ_CAP_BRIGHTNESS) | |
668 *value = info.brightness/10; | |
669 } | |
670 else if (!strcasecmp(data, "contrast")) | |
671 { | |
672 if (info.cap & VEQ_CAP_CONTRAST) | |
673 *value = info.contrast/10; | |
674 } | |
675 else if (!strcasecmp(data, "saturation")) | |
676 { | |
677 if (info.cap & VEQ_CAP_SATURATION) | |
678 *value = info.saturation/10; | |
679 } | |
680 else if (!strcasecmp(data, "hue")) | |
681 { | |
682 if (info.cap & VEQ_CAP_HUE) | |
683 *value = info.hue/10; | |
684 } | |
685 | |
686 return VO_TRUE; | |
687 } | |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4540
diff
changeset
|
688 } |
6531 | 689 return VO_NOTIMPL; |
5319 | 690 // WARNING: we drop extra parameters (...) here! |
6531 | 691 // return server_control(request,data); //VO_NOTIMPL; |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4540
diff
changeset
|
692 } |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4540
diff
changeset
|
693 |
4454 | 694 int vidix_preinit(const char *drvname,void *server) |
695 { | |
696 int err; | |
697 if(verbose > 1) printf("vosub_vidix: vidix_preinit(%s) was called\n",drvname); | |
698 if(vdlGetVersion() != VIDIX_VERSION) | |
699 { | |
700 printf("vosub_vidix: You have wrong version of VIDIX library\n"); | |
701 return -1; | |
702 } | |
11239 | 703 #ifndef __MINGW32__ |
10272
7b0bc557987b
renames: DATADIR->MPLAYER_DATADIR, CONFDIR->MPLAYER_CONFDIR, LIBDIR->MPLAYER_LIBDIR
arpi
parents:
8459
diff
changeset
|
704 vidix_handler = vdlOpen(MPLAYER_LIBDIR "/mplayer/vidix/", |
4454 | 705 drvname ? drvname[0] == ':' ? &drvname[1] : drvname[0] ? drvname : NULL : NULL, |
706 TYPE_OUTPUT, | |
707 verbose); | |
11239 | 708 #else |
709 vidix_handler = vdlOpen(get_path("vidix/"), | |
710 drvname ? drvname[0] == ':' ? &drvname[1] : drvname[0] ? drvname : NULL : NULL, | |
711 TYPE_OUTPUT, | |
712 verbose); | |
713 #endif | |
714 | |
4454 | 715 if(vidix_handler == NULL) |
716 { | |
717 printf("vosub_vidix: Couldn't find working VIDIX driver\n"); | |
718 return -1; | |
719 } | |
720 if((err=vdlGetCapability(vidix_handler,&vidix_cap)) != 0) | |
721 { | |
722 printf("vosub_vidix: Couldn't get capability: %s\n",strerror(err)); | |
723 return -1; | |
724 } | |
6786 | 725 printf("VIDIX: Description: %s\n", vidix_cap.name); |
726 printf("VIDIX: Author: %s\n", vidix_cap.author); | |
4454 | 727 /* we are able to tune up this stuff depend on fourcc format */ |
728 ((vo_functions_t *)server)->draw_slice=vidix_draw_slice; | |
729 ((vo_functions_t *)server)->draw_frame=vidix_draw_frame; | |
730 ((vo_functions_t *)server)->flip_page=vidix_flip_page; | |
731 ((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
|
732 // 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
|
733 // ((vo_functions_t *)server)->control=vidix_control; |
4454 | 734 vo_server = server; |
735 return 0; | |
736 } |