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