Mercurial > mplayer.hg
annotate libvo/vosub_vidix.c @ 6834:2d7dfcc79651
Fix overall frametime overflow, hopefully long long int is portable. (untested, will test tomorrow)
author | atmos4 |
---|---|
date | Sun, 28 Jul 2002 22:09:03 +0000 |
parents | 994d3729b0d1 |
children | a3126e9099b4 |
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 | |
463 if(((vidix_cap.maxwidth != -1) && (vid_w > vidix_cap.maxwidth)) || | |
464 ((vidix_cap.minwidth != -1) && (vid_w < vidix_cap.minwidth)) || | |
465 ((vidix_cap.maxheight != -1) && (vid_h > vidix_cap.maxheight)) || | |
466 ((vidix_cap.minwidth != -1 ) && (vid_h < vidix_cap.minheight))) | |
467 { | |
468 printf("vosub_vidix: video server has unsupported resolution (%dx%d), supported: %dx%d-%dx%d\n", | |
469 vid_w, vid_h, vidix_cap.minwidth, vidix_cap.minheight, | |
470 vidix_cap.maxwidth, vidix_cap.maxheight); | |
471 return -1; | |
472 } | |
473 | |
474 err = 0; | |
475 switch(dest_bpp) | |
476 { | |
477 case 1: err = ((vidix_fourcc.depth & VID_DEPTH_1BPP) != VID_DEPTH_1BPP); break; | |
478 case 2: err = ((vidix_fourcc.depth & VID_DEPTH_2BPP) != VID_DEPTH_2BPP); break; | |
479 case 4: err = ((vidix_fourcc.depth & VID_DEPTH_4BPP) != VID_DEPTH_4BPP); break; | |
480 case 8: err = ((vidix_fourcc.depth & VID_DEPTH_8BPP) != VID_DEPTH_8BPP); break; | |
481 case 12:err = ((vidix_fourcc.depth & VID_DEPTH_12BPP) != VID_DEPTH_12BPP); break; | |
4540 | 482 case 15:err = ((vidix_fourcc.depth & VID_DEPTH_15BPP) != VID_DEPTH_15BPP); break; |
4454 | 483 case 16:err = ((vidix_fourcc.depth & VID_DEPTH_16BPP) != VID_DEPTH_16BPP); break; |
484 case 24:err = ((vidix_fourcc.depth & VID_DEPTH_24BPP) != VID_DEPTH_24BPP); break; | |
485 case 32:err = ((vidix_fourcc.depth & VID_DEPTH_32BPP) != VID_DEPTH_32BPP); break; | |
486 default: err=1; break; | |
487 } | |
488 if(err) | |
489 { | |
490 printf("vosub_vidix: video server has unsupported color depth by vidix (%d)\n" | |
491 ,vidix_fourcc.depth); | |
492 return -1; | |
493 } | |
494 if((dst_width > src_width || dst_height > src_height) && (vidix_cap.flags & FLAG_UPSCALER) != FLAG_UPSCALER) | |
495 { | |
496 printf("vosub_vidix: vidix driver can't upscale image (%d%d -> %d%d)\n", | |
497 src_width, src_height, dst_width, dst_height); | |
498 return -1; | |
499 } | |
500 if((dst_width > src_width || dst_height > src_height) && (vidix_cap.flags & FLAG_DOWNSCALER) != FLAG_DOWNSCALER) | |
501 { | |
502 printf("vosub_vidix: vidix driver can't downscale image (%d%d -> %d%d)\n", | |
503 src_width, src_height, dst_width, dst_height); | |
504 return -1; | |
505 } | |
506 image_width = src_width; | |
507 image_height = src_height; | |
508 src_format = format; | |
5052
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
509 if(forced_fourcc) format = forced_fourcc; |
4454 | 510 memset(&vidix_play,0,sizeof(vidix_playback_t)); |
511 vidix_play.fourcc = format; | |
512 vidix_play.capability = vidix_cap.flags; /* every ;) */ | |
513 vidix_play.blend_factor = 0; /* for now */ | |
514 /* display the full picture. | |
515 Nick: we could implement here zooming to a specified area -- alex */ | |
516 vidix_play.src.x = vidix_play.src.y = 0; | |
517 vidix_play.src.w = src_width; | |
518 vidix_play.src.h = src_height; | |
519 vidix_play.dest.x = x_org; | |
520 vidix_play.dest.y = y_org; | |
521 vidix_play.dest.w = dst_width; | |
522 vidix_play.dest.h = dst_height; | |
4929 | 523 vidix_play.num_frames=vo_doublebuffering?NUM_FRAMES-1:1; |
4454 | 524 vidix_play.src.pitch.y = vidix_play.src.pitch.u = vidix_play.src.pitch.v = 0; |
525 if(info) | |
526 { | |
527 switch(((const vo_tune_info_t *)info)->pitch[0]) | |
528 { | |
529 case 2: | |
530 case 4: | |
531 case 8: | |
532 case 16: | |
533 case 32: | |
534 case 64: | |
535 case 128: | |
536 case 256: vidix_play.src.pitch.y = ((const vo_tune_info_t *)info)->pitch[0]; | |
537 break; | |
538 default: break; | |
539 } | |
540 switch(((const vo_tune_info_t *)info)->pitch[1]) | |
541 { | |
542 case 2: | |
543 case 4: | |
544 case 8: | |
545 case 16: | |
546 case 32: | |
547 case 64: | |
548 case 128: | |
549 case 256: vidix_play.src.pitch.u = ((const vo_tune_info_t *)info)->pitch[1]; | |
550 break; | |
551 default: break; | |
552 } | |
553 switch(((const vo_tune_info_t *)info)->pitch[2]) | |
554 { | |
555 case 2: | |
556 case 4: | |
557 case 8: | |
558 case 16: | |
559 case 32: | |
560 case 64: | |
561 case 128: | |
562 case 256: vidix_play.src.pitch.v = ((const vo_tune_info_t *)info)->pitch[2]; | |
563 break; | |
564 default: break; | |
565 } | |
566 } | |
567 if((err=vdlConfigPlayback(vidix_handler,&vidix_play))!=0) | |
568 { | |
569 printf("vosub_vidix: Can't configure playback: %s\n",strerror(err)); | |
570 return -1; | |
571 } | |
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
|
572 if (verbose) printf("vosub_vidix: using %d buffer(s)\n", vidix_play.num_frames); |
4454 | 573 |
574 vidix_mem = vidix_play.dga_addr; | |
575 | |
576 /* select first frame */ | |
577 next_frame = 0; | |
578 // vdlPlaybackFrameSelect(vidix_handler,next_frame); | |
579 | |
580 /* clear every frame with correct address and frame_size */ | |
581 for (i = 0; i < vidix_play.num_frames; i++) | |
582 memset(vidix_mem + vidix_play.offsets[i], 0x80, | |
583 vidix_play.frame_size); | |
4999 | 584 switch(format) |
585 { | |
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
|
586 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
|
587 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
|
588 case IMGFMT_IYUV: |
6482
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
589 case IMGFMT_YVU9: |
4999 | 590 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
|
591 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
|
592 case IMGFMT_Y8: |
4999 | 593 apitch = vidix_play.dest.pitch.y-1; |
594 dstrides.y = (image_width + apitch) & ~apitch; | |
595 apitch = vidix_play.dest.pitch.v-1; | |
596 dstrides.v = (image_width + apitch) & ~apitch; | |
597 apitch = vidix_play.dest.pitch.u-1; | |
598 dstrides.u = (image_width + apitch) & ~apitch; | |
599 image_Bpp=1; | |
600 break; | |
601 case IMGFMT_RGB32: | |
602 case IMGFMT_BGR32: | |
603 apitch = vidix_play.dest.pitch.y-1; | |
604 dstrides.y = (image_width*4 + apitch) & ~apitch; | |
605 dstrides.u = dstrides.v = 0; | |
606 image_Bpp=4; | |
607 break; | |
608 case IMGFMT_RGB24: | |
609 case IMGFMT_BGR24: | |
610 apitch = vidix_play.dest.pitch.y-1; | |
611 dstrides.y = (image_width*3 + apitch) & ~apitch; | |
612 dstrides.u = dstrides.v = 0; | |
613 image_Bpp=3; | |
614 break; | |
615 default: | |
616 apitch = vidix_play.dest.pitch.y-1; | |
617 dstrides.y = (image_width*2 + apitch) & ~apitch; | |
618 dstrides.u = dstrides.v = 0; | |
619 image_Bpp=2; | |
620 break; | |
621 } | |
4454 | 622 /* tune some info here */ |
6482
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
623 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
|
624 if(!forced_fourcc) |
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
625 { |
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
626 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
|
627 |
5052
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
628 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
|
629 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
|
630 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
|
631 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
|
632 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
|
633 is_422_planes_eq ? |
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
634 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
|
635 vidix_draw_slice_packed; |
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
636 } |
4454 | 637 return 0; |
638 } | |
639 | |
4991 | 640 static uint32_t vidix_get_image(mp_image_t *mpi) |
641 { | |
642 if(mpi->type==MP_IMGTYPE_STATIC && vidix_play.num_frames>1) return VO_FALSE; | |
643 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
|
644 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
|
645 (!forced_fourcc && !(vidix_play.flags & VID_PLAY_INTERLEAVED_UV))) |
4991 | 646 { |
5373 | 647 if(mpi->flags&MP_IMGFLAG_ACCEPT_WIDTH){ |
648 // check if only width is enough to represent strides: | |
649 if(mpi->flags&MP_IMGFLAG_PLANAR){ | |
650 if((dstrides.y>>1)!=dstrides.v || dstrides.v!=dstrides.u) return VO_FALSE; | |
651 } else { | |
652 if(dstrides.y % (mpi->bpp/8)) return VO_FALSE; | |
653 } | |
654 } | |
5028 | 655 mpi->planes[0]=vidix_mem+vidix_play.offsets[next_frame]+vidix_play.offset.y; |
5373 | 656 mpi->width=mpi->stride[0]=dstrides.y; |
5028 | 657 if(mpi->flags&MP_IMGFLAG_PLANAR) |
658 { | |
659 mpi->planes[2]=vidix_mem+vidix_play.offsets[next_frame]+vidix_play.offset.v; | |
660 mpi->stride[2]=dstrides.v; | |
661 mpi->planes[1]=vidix_mem+vidix_play.offsets[next_frame]+vidix_play.offset.u; | |
662 mpi->stride[1]=dstrides.u; | |
5373 | 663 } else |
664 mpi->width/=mpi->bpp/8; | |
5028 | 665 mpi->flags|=MP_IMGFLAG_DIRECT; |
5373 | 666 return VO_TRUE; |
4991 | 667 } |
5373 | 668 return VO_FALSE; |
4991 | 669 } |
670 | |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4540
diff
changeset
|
671 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
|
672 { |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4540
diff
changeset
|
673 switch (request) { |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4540
diff
changeset
|
674 case VOCTRL_QUERY_FORMAT: |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4540
diff
changeset
|
675 return vidix_query_fourcc(*((uint32_t*)data)); |
4991 | 676 case VOCTRL_GET_IMAGE: |
677 return vidix_get_image(data); | |
5002 | 678 case VOCTRL_GET_FRAME_NUM: |
679 *(uint32_t *)data = next_frame; | |
680 return VO_TRUE; | |
681 case VOCTRL_SET_FRAME_NUM: | |
682 next_frame = *(uint32_t *)data; | |
683 return VO_TRUE; | |
684 case VOCTRL_GET_NUM_FRAMES: | |
685 *(uint32_t *)data = vidix_play.num_frames; | |
686 return VO_TRUE; | |
6786 | 687 case VOCTRL_SET_EQUALIZER: |
688 { | |
689 va_list ap; | |
690 int value; | |
691 vidix_video_eq_t info; | |
692 | |
693 if(!video_on) return VO_FALSE; | |
694 va_start(ap, data); | |
695 value = va_arg(ap, int); | |
696 va_end(ap); | |
697 | |
6806 | 698 // printf("vidix seteq %s -> %d \n",data,value); |
699 | |
6786 | 700 /* vidix eq ranges are -1000..1000 */ |
701 if (!strcasecmp(data, "brightness")) | |
702 { | |
703 info.brightness = value*10; | |
6806 | 704 info.cap = VEQ_CAP_BRIGHTNESS; |
6786 | 705 } |
706 else if (!strcasecmp(data, "contrast")) | |
707 { | |
708 info.contrast = value*10; | |
6806 | 709 info.cap = VEQ_CAP_CONTRAST; |
6786 | 710 } |
711 else if (!strcasecmp(data, "saturation")) | |
712 { | |
713 info.saturation = value*10; | |
6806 | 714 info.cap = VEQ_CAP_SATURATION; |
6786 | 715 } |
716 else if (!strcasecmp(data, "hue")) | |
717 { | |
718 info.hue = value*10; | |
6806 | 719 info.cap = VEQ_CAP_HUE; |
6786 | 720 } |
721 | |
722 if (vdlPlaybackSetEq(vidix_handler, &info) == 0) | |
723 return VO_TRUE; | |
724 return VO_FALSE; | |
725 } | |
726 case VOCTRL_GET_EQUALIZER: | |
727 { | |
728 va_list ap; | |
729 int *value; | |
730 vidix_video_eq_t info; | |
731 | |
732 if(!video_on) return VO_FALSE; | |
6806 | 733 if (vdlPlaybackGetEq(vidix_handler, &info) != 0) |
6786 | 734 return VO_FALSE; |
735 | |
736 va_start(ap, data); | |
6806 | 737 value = va_arg(ap, int*); |
6786 | 738 va_end(ap); |
739 | |
740 /* vidix eq ranges are -1000..1000 */ | |
741 if (!strcasecmp(data, "brightness")) | |
742 { | |
743 if (info.cap & VEQ_CAP_BRIGHTNESS) | |
744 *value = info.brightness/10; | |
745 } | |
746 else if (!strcasecmp(data, "contrast")) | |
747 { | |
748 if (info.cap & VEQ_CAP_CONTRAST) | |
749 *value = info.contrast/10; | |
750 } | |
751 else if (!strcasecmp(data, "saturation")) | |
752 { | |
753 if (info.cap & VEQ_CAP_SATURATION) | |
754 *value = info.saturation/10; | |
755 } | |
756 else if (!strcasecmp(data, "hue")) | |
757 { | |
758 if (info.cap & VEQ_CAP_HUE) | |
759 *value = info.hue/10; | |
760 } | |
761 | |
762 return VO_TRUE; | |
763 } | |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4540
diff
changeset
|
764 } |
6531 | 765 return VO_NOTIMPL; |
5319 | 766 // WARNING: we drop extra parameters (...) here! |
6531 | 767 // return server_control(request,data); //VO_NOTIMPL; |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4540
diff
changeset
|
768 } |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4540
diff
changeset
|
769 |
4454 | 770 int vidix_preinit(const char *drvname,void *server) |
771 { | |
772 int err; | |
773 if(verbose > 1) printf("vosub_vidix: vidix_preinit(%s) was called\n",drvname); | |
774 if(vdlGetVersion() != VIDIX_VERSION) | |
775 { | |
776 printf("vosub_vidix: You have wrong version of VIDIX library\n"); | |
777 return -1; | |
778 } | |
5814 | 779 vidix_handler = vdlOpen(LIBDIR"/mplayer/vidix/", |
4454 | 780 drvname ? drvname[0] == ':' ? &drvname[1] : drvname[0] ? drvname : NULL : NULL, |
781 TYPE_OUTPUT, | |
782 verbose); | |
783 if(vidix_handler == NULL) | |
784 { | |
785 printf("vosub_vidix: Couldn't find working VIDIX driver\n"); | |
786 return -1; | |
787 } | |
788 if((err=vdlGetCapability(vidix_handler,&vidix_cap)) != 0) | |
789 { | |
790 printf("vosub_vidix: Couldn't get capability: %s\n",strerror(err)); | |
791 return -1; | |
792 } | |
6786 | 793 printf("VIDIX: Description: %s\n", vidix_cap.name); |
794 printf("VIDIX: Author: %s\n", vidix_cap.author); | |
4454 | 795 /* we are able to tune up this stuff depend on fourcc format */ |
796 ((vo_functions_t *)server)->draw_slice=vidix_draw_slice; | |
797 ((vo_functions_t *)server)->draw_frame=vidix_draw_frame; | |
798 ((vo_functions_t *)server)->flip_page=vidix_flip_page; | |
799 ((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
|
800 // 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
|
801 // ((vo_functions_t *)server)->control=vidix_control; |
4454 | 802 vo_server = server; |
803 return 0; | |
804 } |