Mercurial > mplayer.hg
annotate libvo/vosub_vidix.c @ 27488:92479ee7ad6e
Remove workaround for rgb/bgr mess.
author | michael |
---|---|
date | Thu, 04 Sep 2008 20:16:41 +0000 |
parents | 1861074aef60 |
children | d97a607821f1 |
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 | |
25531
071132904566
Relicense files marked as GPL v2 to GPL v2 or later.
diego
parents:
25213
diff
changeset
|
8 * of GNU General Public licence v2 or later. |
4010 | 9 * |
10 * This file contains vidix interface to any mplayer's VO plugin. | |
11 * (Partly based on vesa_lvo.c from mplayer's package) | |
12 */ | |
13 | |
14 #include <inttypes.h> | |
15 #include <unistd.h> | |
16 #include <fcntl.h> | |
10981 | 17 #ifndef __MINGW32__ |
18 #include <sys/ioctl.h> | |
4010 | 19 #include <sys/mman.h> |
10981 | 20 #endif |
4010 | 21 #include <stdio.h> |
22 #include <stdlib.h> | |
23 #include <string.h> | |
4372 | 24 #include <errno.h> |
4010 | 25 |
26 #include "config.h" | |
17932 | 27 #include "mp_msg.h" |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17988
diff
changeset
|
28 #include "help_mp.h" |
4010 | 29 |
27079 | 30 #include "vidix/vidix.h" |
4010 | 31 #include "fastmemcpy.h" |
32 #include "osd.h" | |
33 #include "video_out.h" | |
6550
991e03ca5ceb
added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents:
6531
diff
changeset
|
34 #include "sub.h" |
25212
ca7a751f5481
Use proper type for vidix_preinit parameter instead of void *
reimar
parents:
24817
diff
changeset
|
35 #include "vosub_vidix.h" |
4991 | 36 |
13787
e047e70a9767
Handle "xxx.h" vs "../xxx.h" include paths in a consistent way.
diego
parents:
11865
diff
changeset
|
37 #include "libmpcodecs/vfcap.h" |
e047e70a9767
Handle "xxx.h" vs "../xxx.h" include paths in a consistent way.
diego
parents:
11865
diff
changeset
|
38 #include "libmpcodecs/mp_image.h" |
4010 | 39 |
4929 | 40 #define NUM_FRAMES VID_PLAY_MAXFRAMES /* Temporary: driver will overwrite it */ |
4010 | 41 |
27084 | 42 static VDXContext *vidix_handler = NULL; |
4010 | 43 static uint8_t *vidix_mem = NULL; |
44 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
|
45 static unsigned image_Bpp,image_height,image_width,src_format,forced_fourcc=0; |
4372 | 46 static int video_on=0; |
4010 | 47 |
48 static vidix_capability_t vidix_cap; | |
49 static vidix_playback_t vidix_play; | |
50 static vidix_fourcc_t vidix_fourcc; | |
4454 | 51 static vo_functions_t * vo_server; |
4999 | 52 static vidix_yuv_t dstrides; |
8254
772d6d27fd66
warning patch by (Dominik Mierzejewski <dominik at rangers dot eu dot org>)
michael
parents:
7694
diff
changeset
|
53 /*static uint32_t (*server_control)(uint32_t request, void *data, ...);*/ |
4739 | 54 |
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
|
55 int vidix_start(void) |
4198
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
56 { |
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
57 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
|
58 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
|
59 { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17988
diff
changeset
|
60 mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_SUB_VIDIX_CantStartPlayback,strerror(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
|
61 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
|
62 } |
4379 | 63 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
|
64 return 0; |
4198
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
65 } |
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
66 |
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
|
67 int vidix_stop(void) |
4198
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
68 { |
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
69 int err; |
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
70 if((err=vdlPlaybackOff(vidix_handler))!=0) |
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
71 { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17988
diff
changeset
|
72 mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_SUB_VIDIX_CantStopPlayback,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
|
73 return -1; |
4198
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
74 } |
4372 | 75 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
|
76 return 0; |
4198
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 |
4010 | 79 void vidix_term( void ) |
80 { | |
17932 | 81 if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17988
diff
changeset
|
82 mp_msg(MSGT_VO,MSGL_DBG2, "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
|
83 vidix_stop(); |
4010 | 84 vdlClose(vidix_handler); |
25213 | 85 // vo_server->control=server_control; |
4010 | 86 } |
87 | |
4430 | 88 static uint32_t vidix_draw_slice_420(uint8_t *image[], int stride[], int w,int h,int x,int y) |
4010 | 89 { |
90 uint8_t *src; | |
91 uint8_t *dest; | |
92 int i; | |
4324
09f15844c960
don't render UV planes if interleaved (also add support later)
alex
parents:
4317
diff
changeset
|
93 |
09f15844c960
don't render UV planes if interleaved (also add support later)
alex
parents:
4317
diff
changeset
|
94 /* Plane Y */ |
4032 | 95 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y; |
4999 | 96 dest += dstrides.y*y + x; |
4010 | 97 src = image[0]; |
98 for(i=0;i<h;i++){ | |
99 memcpy(dest,src,w); | |
100 src+=stride[0]; | |
4999 | 101 dest += dstrides.y; |
4010 | 102 } |
103 | |
4324
09f15844c960
don't render UV planes if interleaved (also add support later)
alex
parents:
4317
diff
changeset
|
104 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
|
105 { |
4744
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
106 int hi,wi; |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
107 uint8_t *src2; |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
108 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.v; |
4999 | 109 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
|
110 h/=2; |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
111 w/=2; |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
112 src = image[1]; |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
113 src2 = image[2]; |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
114 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
|
115 { |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
116 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
|
117 { |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
118 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
|
119 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
|
120 } |
4999 | 121 dest += dstrides.y; |
4744
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
122 src += stride[1]; |
4999 | 123 src2+= stride[2]; |
124 } | |
125 } | |
126 else | |
127 { | |
4744
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
128 /* Plane V */ |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
129 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.v; |
4999 | 130 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
|
131 src = image[1]; |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
132 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
|
133 memcpy(dest,src,w/2); |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
134 src+=stride[1]; |
4999 | 135 dest+=dstrides.v/2; |
4744
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
136 } |
4324
09f15844c960
don't render UV planes if interleaved (also add support later)
alex
parents:
4317
diff
changeset
|
137 |
4744
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
138 /* Plane U */ |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
139 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.u; |
4999 | 140 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
|
141 src = image[2]; |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
142 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
|
143 memcpy(dest,src,w/2); |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
144 src+=stride[2]; |
4999 | 145 dest += dstrides.u/2; |
4744
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
146 } |
da595f0e882e
vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents:
4741
diff
changeset
|
147 return 0; |
4999 | 148 } |
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
|
149 return -1; |
4010 | 150 } |
151 | |
6482
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
152 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
|
153 { |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
154 uint8_t *src; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
155 uint8_t *dest; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
156 int i; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
157 |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
158 /* Plane Y */ |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
159 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
|
160 dest += dstrides.y*y + x; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
161 src = image[0]; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
162 for(i=0;i<h;i++){ |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
163 memcpy(dest,src,w); |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
164 src+=stride[0]; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
165 dest += dstrides.y; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
166 } |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
167 |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
168 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
|
169 { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17988
diff
changeset
|
170 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_SUB_VIDIX_InterleavedUvForYuv410pNotSupported); |
6482
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 else |
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 /* Plane V */ |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
175 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
|
176 dest += dstrides.v*y/8 + x; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
177 src = image[1]; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
178 for(i=0;i<h/4;i++){ |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
179 memcpy(dest,src,w/4); |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
180 src+=stride[1]; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
181 dest+=dstrides.v/4; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
182 } |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
183 |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
184 /* Plane U */ |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
185 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
|
186 dest += dstrides.u*y/8 + x; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
187 src = image[2]; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
188 for(i=0;i<h/4;i++){ |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
189 memcpy(dest,src,w/4); |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
190 src+=stride[2]; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
191 dest += dstrides.u/4; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
192 } |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
193 return 0; |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
194 } |
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
|
195 return -1; |
6482
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
196 } |
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
197 |
4999 | 198 static uint32_t vidix_draw_slice_packed(uint8_t *image[], int stride[], int w,int h,int x,int y) |
4010 | 199 { |
200 uint8_t *src; | |
201 uint8_t *dest; | |
202 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
|
203 |
4032 | 204 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y; |
4999 | 205 dest += dstrides.y*y + x; |
4010 | 206 src = image[0]; |
207 for(i=0;i<h;i++){ | |
4999 | 208 memcpy(dest,src,w*image_Bpp); |
4010 | 209 src+=stride[0]; |
4999 | 210 dest += dstrides.y; |
4010 | 211 } |
4240 | 212 return 0; |
4010 | 213 } |
214 | |
27398 | 215 static uint32_t vidix_draw_slice_nv12(uint8_t *image[], int stride[], int w,int h,int x,int y) |
216 { | |
217 uint8_t *src; | |
218 uint8_t *dest; | |
219 int i; | |
220 | |
221 /* Plane Y */ | |
222 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y; | |
223 dest += dstrides.y*y + x; | |
224 src = image[0]; | |
225 for(i=0;i<h;i++){ | |
226 memcpy(dest,src,w); | |
227 src+=stride[0]; | |
228 dest += dstrides.y; | |
229 } | |
230 | |
231 /* Plane UV */ | |
232 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.u; | |
233 dest += dstrides.u*y/2 + x; | |
234 src = image[1]; | |
235 for(i=0;i<h/2;i++){ | |
236 memcpy(dest,src,w); | |
237 src+=stride[1]; | |
238 dest+=dstrides.u; | |
239 } | |
240 return 0; | |
241 } | |
242 | |
26982 | 243 static uint32_t vidix_draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y) |
4010 | 244 { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17988
diff
changeset
|
245 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_SUB_VIDIX_DummyVidixdrawsliceWasCalled); |
10605 | 246 return -1; |
4010 | 247 } |
248 | |
7685 | 249 static uint32_t vidix_draw_image(mp_image_t *mpi){ |
17932 | 250 if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17988
diff
changeset
|
251 mp_msg(MSGT_VO,MSGL_DBG2, "vosub_vidix: vidix_draw_image() was called\n"); } |
7685 | 252 |
253 // if -dr or -slices then do nothing: | |
254 if(mpi->flags&(MP_IMGFLAG_DIRECT|MP_IMGFLAG_DRAW_CALLBACK)) return VO_TRUE; | |
255 | |
256 vo_server->draw_slice(mpi->planes,mpi->stride, | |
257 vidix_play.src.w,vidix_play.src.h,vidix_play.src.x,vidix_play.src.y); | |
258 return VO_TRUE; | |
259 } | |
260 | |
26982 | 261 static uint32_t vidix_draw_frame(uint8_t *image[]) |
4010 | 262 { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17988
diff
changeset
|
263 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_SUB_VIDIX_DummyVidixdrawframeWasCalled); |
7685 | 264 return -1; |
4010 | 265 } |
266 | |
26982 | 267 static void vidix_flip_page(void) |
4010 | 268 { |
17932 | 269 if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17988
diff
changeset
|
270 mp_msg(MSGT_VO,MSGL_DBG2, "vosub_vidix: vidix_flip_page() was called\n"); } |
4010 | 271 if(vo_doublebuffering) |
272 { | |
4032 | 273 vdlPlaybackFrameSelect(vidix_handler,next_frame); |
4010 | 274 next_frame=(next_frame+1)%vidix_play.num_frames; |
275 } | |
276 } | |
277 | |
278 static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride) | |
279 { | |
4032 | 280 uint32_t apitch,bespitch; |
24817 | 281 char *lvo_mem; |
4032 | 282 lvo_mem = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y; |
283 apitch = vidix_play.dest.pitch.y-1; | |
4010 | 284 switch(vidix_play.fourcc){ |
27398 | 285 case IMGFMT_NV12: |
4010 | 286 case IMGFMT_YV12: |
287 case IMGFMT_IYUV: | |
288 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
|
289 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
|
290 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
|
291 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
|
292 case IMGFMT_Y800: |
4745
398e3663ed71
Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents:
4744
diff
changeset
|
293 bespitch = (vidix_play.src.w + apitch) & (~apitch); |
4010 | 294 vo_draw_alpha_yv12(w,h,src,srca,stride,lvo_mem+bespitch*y0+x0,bespitch); |
295 break; | |
296 case IMGFMT_YUY2: | |
4745
398e3663ed71
Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents:
4744
diff
changeset
|
297 bespitch = (vidix_play.src.w*2 + apitch) & (~apitch); |
398e3663ed71
Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents:
4744
diff
changeset
|
298 vo_draw_alpha_yuy2(w,h,src,srca,stride,lvo_mem+bespitch*y0+2*x0,bespitch); |
4010 | 299 break; |
300 case IMGFMT_UYVY: | |
4745
398e3663ed71
Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents:
4744
diff
changeset
|
301 bespitch = (vidix_play.src.w*2 + apitch) & (~apitch); |
398e3663ed71
Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents:
4744
diff
changeset
|
302 vo_draw_alpha_yuy2(w,h,src,srca,stride,lvo_mem+bespitch*y0+2*x0+1,bespitch); |
4010 | 303 break; |
4430 | 304 case IMGFMT_RGB32: |
305 case IMGFMT_BGR32: | |
4745
398e3663ed71
Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents:
4744
diff
changeset
|
306 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
|
307 vo_draw_alpha_rgb32(w,h,src,srca,stride,lvo_mem+y0*bespitch+4*x0,bespitch); |
4430 | 308 break; |
309 case IMGFMT_RGB24: | |
310 case IMGFMT_BGR24: | |
4745
398e3663ed71
Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents:
4744
diff
changeset
|
311 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
|
312 vo_draw_alpha_rgb24(w,h,src,srca,stride,lvo_mem+y0*bespitch+3*x0,bespitch); |
4430 | 313 break; |
314 case IMGFMT_RGB16: | |
315 case IMGFMT_BGR16: | |
4745
398e3663ed71
Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents:
4744
diff
changeset
|
316 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
|
317 vo_draw_alpha_rgb16(w,h,src,srca,stride,lvo_mem+y0*bespitch+2*x0,bespitch); |
4430 | 318 break; |
319 case IMGFMT_RGB15: | |
320 case IMGFMT_BGR15: | |
4745
398e3663ed71
Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents:
4744
diff
changeset
|
321 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
|
322 vo_draw_alpha_rgb15(w,h,src,srca,stride,lvo_mem+y0*bespitch+2*x0,bespitch); |
4430 | 323 break; |
4010 | 324 default: |
6786 | 325 return; |
4010 | 326 } |
327 } | |
328 | |
26982 | 329 static void vidix_draw_osd(void) |
4010 | 330 { |
17932 | 331 if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17988
diff
changeset
|
332 mp_msg(MSGT_VO,MSGL_DBG2, "vosub_vidix: vidix_draw_osd() was called\n"); } |
4010 | 333 /* TODO: hw support */ |
334 vo_draw_text(vidix_play.src.w,vidix_play.src.h,draw_alpha); | |
335 } | |
336 | |
337 uint32_t vidix_query_fourcc(uint32_t format) | |
338 { | |
17932 | 339 if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17988
diff
changeset
|
340 mp_msg(MSGT_VO,MSGL_DBG2, "vosub_vidix: query_format was called: %x (%s)\n",format,vo_format_name(format)); } |
4010 | 341 vidix_fourcc.fourcc = format; |
342 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
|
343 if (vidix_fourcc.depth == VID_DEPTH_NONE) |
5566 | 344 return 0; |
7694
b64f14fdadfb
also set VFCAP_ACCEPT_STRIDE when draw_image() is implemented
arpi
parents:
7685
diff
changeset
|
345 return VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW|VFCAP_HWSCALE_UP|VFCAP_HWSCALE_DOWN|VFCAP_OSD|VFCAP_ACCEPT_STRIDE; |
4010 | 346 } |
4240 | 347 |
4255 | 348 int vidix_grkey_support(void) |
349 { | |
26755
46f0b4d34fa1
cosmetics: Remove useless parentheses from from return statements.
diego
parents:
25531
diff
changeset
|
350 return vidix_fourcc.flags & VID_CAP_COLORKEY; |
4255 | 351 } |
352 | |
4240 | 353 int vidix_grkey_get(vidix_grkey_t *gr_key) |
354 { | |
26755
46f0b4d34fa1
cosmetics: Remove useless parentheses from from return statements.
diego
parents:
25531
diff
changeset
|
355 return vdlGetGrKeys(vidix_handler, gr_key); |
4240 | 356 } |
357 | |
358 int vidix_grkey_set(const vidix_grkey_t *gr_key) | |
359 { | |
26755
46f0b4d34fa1
cosmetics: Remove useless parentheses from from return statements.
diego
parents:
25531
diff
changeset
|
360 return vdlSetGrKeys(vidix_handler, gr_key); |
4240 | 361 } |
4372 | 362 |
4379 | 363 |
5028 | 364 static int is_422_planes_eq=0; |
4454 | 365 int vidix_init(unsigned src_width,unsigned src_height, |
366 unsigned x_org,unsigned y_org,unsigned dst_width, | |
367 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
|
368 unsigned vid_w,unsigned vid_h) |
4454 | 369 { |
17128
34f870d8e8a8
really clear frames to black instead of grey, and make sure one of those
reimar
parents:
13787
diff
changeset
|
370 void *tmp, *tmpa; |
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
|
371 size_t i; |
5028 | 372 int err; |
4999 | 373 uint32_t sstride,apitch; |
17932 | 374 if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17988
diff
changeset
|
375 mp_msg(MSGT_VO,MSGL_DBG2, "vosub_vidix: vidix_init() was called\n" |
4454 | 376 "src_w=%u src_h=%u dest_x_y_w_h = %u %u %u %u\n" |
377 "format=%s dest_bpp=%u vid_w=%u vid_h=%u\n" | |
378 ,src_width,src_height,x_org,y_org,dst_width,dst_height | |
379 ,vo_format_name(format),dest_bpp,vid_w,vid_h); | |
380 | |
7026
a3126e9099b4
should solve -vo vesa:vidix problem 'vosub_vidix: video server has
arpi
parents:
6806
diff
changeset
|
381 if(vidix_query_fourcc(format) == 0) |
a3126e9099b4
should solve -vo vesa:vidix problem 'vosub_vidix: video server has
arpi
parents:
6806
diff
changeset
|
382 { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17988
diff
changeset
|
383 mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_SUB_VIDIX_UnsupportedFourccForThisVidixDriver, |
7026
a3126e9099b4
should solve -vo vesa:vidix problem 'vosub_vidix: video server has
arpi
parents:
6806
diff
changeset
|
384 format,vo_format_name(format)); |
a3126e9099b4
should solve -vo vesa:vidix problem 'vosub_vidix: video server has
arpi
parents:
6806
diff
changeset
|
385 return -1; |
a3126e9099b4
should solve -vo vesa:vidix problem 'vosub_vidix: video server has
arpi
parents:
6806
diff
changeset
|
386 } |
a3126e9099b4
should solve -vo vesa:vidix problem 'vosub_vidix: video server has
arpi
parents:
6806
diff
changeset
|
387 |
4454 | 388 if(((vidix_cap.maxwidth != -1) && (vid_w > vidix_cap.maxwidth)) || |
389 ((vidix_cap.minwidth != -1) && (vid_w < vidix_cap.minwidth)) || | |
390 ((vidix_cap.maxheight != -1) && (vid_h > vidix_cap.maxheight)) || | |
391 ((vidix_cap.minwidth != -1 ) && (vid_h < vidix_cap.minheight))) | |
392 { | |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17988
diff
changeset
|
393 mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_SUB_VIDIX_VideoServerHasUnsupportedResolution, |
4454 | 394 vid_w, vid_h, vidix_cap.minwidth, vidix_cap.minheight, |
395 vidix_cap.maxwidth, vidix_cap.maxheight); | |
396 return -1; | |
397 } | |
398 | |
399 err = 0; | |
400 switch(dest_bpp) | |
401 { | |
402 case 1: err = ((vidix_fourcc.depth & VID_DEPTH_1BPP) != VID_DEPTH_1BPP); break; | |
403 case 2: err = ((vidix_fourcc.depth & VID_DEPTH_2BPP) != VID_DEPTH_2BPP); break; | |
404 case 4: err = ((vidix_fourcc.depth & VID_DEPTH_4BPP) != VID_DEPTH_4BPP); break; | |
405 case 8: err = ((vidix_fourcc.depth & VID_DEPTH_8BPP) != VID_DEPTH_8BPP); break; | |
406 case 12:err = ((vidix_fourcc.depth & VID_DEPTH_12BPP) != VID_DEPTH_12BPP); break; | |
4540 | 407 case 15:err = ((vidix_fourcc.depth & VID_DEPTH_15BPP) != VID_DEPTH_15BPP); break; |
4454 | 408 case 16:err = ((vidix_fourcc.depth & VID_DEPTH_16BPP) != VID_DEPTH_16BPP); break; |
409 case 24:err = ((vidix_fourcc.depth & VID_DEPTH_24BPP) != VID_DEPTH_24BPP); break; | |
410 case 32:err = ((vidix_fourcc.depth & VID_DEPTH_32BPP) != VID_DEPTH_32BPP); break; | |
411 default: err=1; break; | |
412 } | |
413 if(err) | |
414 { | |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17988
diff
changeset
|
415 mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_SUB_VIDIX_VideoServerHasUnsupportedColorDepth |
4454 | 416 ,vidix_fourcc.depth); |
417 return -1; | |
418 } | |
419 if((dst_width > src_width || dst_height > src_height) && (vidix_cap.flags & FLAG_UPSCALER) != FLAG_UPSCALER) | |
420 { | |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17988
diff
changeset
|
421 mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_SUB_VIDIX_DriverCantUpscaleImage, |
4454 | 422 src_width, src_height, dst_width, dst_height); |
423 return -1; | |
424 } | |
425 if((dst_width > src_width || dst_height > src_height) && (vidix_cap.flags & FLAG_DOWNSCALER) != FLAG_DOWNSCALER) | |
426 { | |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17988
diff
changeset
|
427 mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_SUB_VIDIX_DriverCantDownscaleImage, |
4454 | 428 src_width, src_height, dst_width, dst_height); |
429 return -1; | |
430 } | |
431 image_width = src_width; | |
432 image_height = src_height; | |
433 src_format = format; | |
5052
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
434 if(forced_fourcc) format = forced_fourcc; |
4454 | 435 memset(&vidix_play,0,sizeof(vidix_playback_t)); |
436 vidix_play.fourcc = format; | |
437 vidix_play.capability = vidix_cap.flags; /* every ;) */ | |
438 vidix_play.blend_factor = 0; /* for now */ | |
439 /* display the full picture. | |
440 Nick: we could implement here zooming to a specified area -- alex */ | |
441 vidix_play.src.x = vidix_play.src.y = 0; | |
442 vidix_play.src.w = src_width; | |
443 vidix_play.src.h = src_height; | |
444 vidix_play.dest.x = x_org; | |
445 vidix_play.dest.y = y_org; | |
446 vidix_play.dest.w = dst_width; | |
447 vidix_play.dest.h = dst_height; | |
8459
2ce7bbdcee15
this isn't mplayerxp...3 buffers are enough for double(triple)buffering (instead of 28 buffers ;)
alex
parents:
8254
diff
changeset
|
448 // vidix_play.num_frames=vo_doublebuffering?NUM_FRAMES-1:1; |
2ce7bbdcee15
this isn't mplayerxp...3 buffers are enough for double(triple)buffering (instead of 28 buffers ;)
alex
parents:
8254
diff
changeset
|
449 /* we aren't mad...3 buffers are more than enough */ |
2ce7bbdcee15
this isn't mplayerxp...3 buffers are enough for double(triple)buffering (instead of 28 buffers ;)
alex
parents:
8254
diff
changeset
|
450 vidix_play.num_frames=vo_doublebuffering?3:1; |
4454 | 451 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
|
452 |
4454 | 453 if((err=vdlConfigPlayback(vidix_handler,&vidix_play))!=0) |
454 { | |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17988
diff
changeset
|
455 mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_SUB_VIDIX_CantConfigurePlayback,strerror(err)); |
4454 | 456 return -1; |
457 } | |
17932 | 458 if ( mp_msg_test(MSGT_VO,MSGL_V) ) { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17988
diff
changeset
|
459 mp_msg(MSGT_VO,MSGL_V, "vosub_vidix: using %d buffer(s)\n", vidix_play.num_frames); } |
4454 | 460 |
461 vidix_mem = vidix_play.dga_addr; | |
462 | |
17128
34f870d8e8a8
really clear frames to black instead of grey, and make sure one of those
reimar
parents:
13787
diff
changeset
|
463 tmp = calloc(image_width, image_height); |
34f870d8e8a8
really clear frames to black instead of grey, and make sure one of those
reimar
parents:
13787
diff
changeset
|
464 tmpa = malloc(image_width * image_height); |
34f870d8e8a8
really clear frames to black instead of grey, and make sure one of those
reimar
parents:
13787
diff
changeset
|
465 memset(tmpa, 1, image_width * image_height); |
4454 | 466 /* clear every frame with correct address and frame_size */ |
17128
34f870d8e8a8
really clear frames to black instead of grey, and make sure one of those
reimar
parents:
13787
diff
changeset
|
467 /* HACK: use draw_alpha to clear Y component */ |
34f870d8e8a8
really clear frames to black instead of grey, and make sure one of those
reimar
parents:
13787
diff
changeset
|
468 for (i = 0; i < vidix_play.num_frames; i++) { |
34f870d8e8a8
really clear frames to black instead of grey, and make sure one of those
reimar
parents:
13787
diff
changeset
|
469 next_frame = i; |
4454 | 470 memset(vidix_mem + vidix_play.offsets[i], 0x80, |
471 vidix_play.frame_size); | |
17128
34f870d8e8a8
really clear frames to black instead of grey, and make sure one of those
reimar
parents:
13787
diff
changeset
|
472 draw_alpha(0, 0, image_width, image_height, tmp, tmpa, image_width); |
34f870d8e8a8
really clear frames to black instead of grey, and make sure one of those
reimar
parents:
13787
diff
changeset
|
473 } |
34f870d8e8a8
really clear frames to black instead of grey, and make sure one of those
reimar
parents:
13787
diff
changeset
|
474 free(tmp); |
34f870d8e8a8
really clear frames to black instead of grey, and make sure one of those
reimar
parents:
13787
diff
changeset
|
475 free(tmpa); |
34f870d8e8a8
really clear frames to black instead of grey, and make sure one of those
reimar
parents:
13787
diff
changeset
|
476 /* show one of the "clear" frames */ |
34f870d8e8a8
really clear frames to black instead of grey, and make sure one of those
reimar
parents:
13787
diff
changeset
|
477 vidix_flip_page(); |
34f870d8e8a8
really clear frames to black instead of grey, and make sure one of those
reimar
parents:
13787
diff
changeset
|
478 |
4999 | 479 switch(format) |
480 { | |
27398 | 481 case IMGFMT_NV12: |
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
|
482 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
|
483 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
|
484 case IMGFMT_IYUV: |
6482
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
485 case IMGFMT_YVU9: |
4999 | 486 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
|
487 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
|
488 case IMGFMT_Y8: |
4999 | 489 apitch = vidix_play.dest.pitch.y-1; |
490 dstrides.y = (image_width + apitch) & ~apitch; | |
491 apitch = vidix_play.dest.pitch.v-1; | |
492 dstrides.v = (image_width + apitch) & ~apitch; | |
493 apitch = vidix_play.dest.pitch.u-1; | |
494 dstrides.u = (image_width + apitch) & ~apitch; | |
495 image_Bpp=1; | |
496 break; | |
497 case IMGFMT_RGB32: | |
498 case IMGFMT_BGR32: | |
499 apitch = vidix_play.dest.pitch.y-1; | |
500 dstrides.y = (image_width*4 + apitch) & ~apitch; | |
501 dstrides.u = dstrides.v = 0; | |
502 image_Bpp=4; | |
503 break; | |
504 case IMGFMT_RGB24: | |
505 case IMGFMT_BGR24: | |
506 apitch = vidix_play.dest.pitch.y-1; | |
507 dstrides.y = (image_width*3 + apitch) & ~apitch; | |
508 dstrides.u = dstrides.v = 0; | |
509 image_Bpp=3; | |
510 break; | |
511 default: | |
512 apitch = vidix_play.dest.pitch.y-1; | |
513 dstrides.y = (image_width*2 + apitch) & ~apitch; | |
514 dstrides.u = dstrides.v = 0; | |
515 image_Bpp=2; | |
516 break; | |
517 } | |
4454 | 518 /* tune some info here */ |
6482
528216496060
YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents:
6018
diff
changeset
|
519 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
|
520 if(!forced_fourcc) |
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
521 { |
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
522 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
|
523 |
5052
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
524 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
|
525 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
|
526 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
|
527 vo_server->draw_slice = vidix_draw_slice_410; |
27398 | 528 else if (src_format == IMGFMT_NV12) |
529 vo_server->draw_slice = vidix_draw_slice_nv12; | |
7685 | 530 else vo_server->draw_slice = vidix_draw_slice_packed; |
5052
6f28d6ccbd91
Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents:
5028
diff
changeset
|
531 } |
4454 | 532 return 0; |
533 } | |
534 | |
4991 | 535 static uint32_t vidix_get_image(mp_image_t *mpi) |
536 { | |
537 if(mpi->type==MP_IMGTYPE_STATIC && vidix_play.num_frames>1) return VO_FALSE; | |
538 if(mpi->flags&MP_IMGFLAG_READABLE) return VO_FALSE; /* slow video ram */ | |
7685 | 539 if(( (mpi->stride[0]==dstrides.y && (!(mpi->flags&MP_IMGFLAG_PLANAR) || |
540 (mpi->stride[1]==dstrides.u && mpi->stride[2]==dstrides.v)) ) | |
541 || (mpi->flags&(MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_ACCEPT_WIDTH))) && | |
6550
991e03ca5ceb
added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents:
6531
diff
changeset
|
542 (!forced_fourcc && !(vidix_play.flags & VID_PLAY_INTERLEAVED_UV))) |
4991 | 543 { |
5373 | 544 if(mpi->flags&MP_IMGFLAG_ACCEPT_WIDTH){ |
545 // check if only width is enough to represent strides: | |
546 if(mpi->flags&MP_IMGFLAG_PLANAR){ | |
547 if((dstrides.y>>1)!=dstrides.v || dstrides.v!=dstrides.u) return VO_FALSE; | |
548 } else { | |
549 if(dstrides.y % (mpi->bpp/8)) return VO_FALSE; | |
550 } | |
551 } | |
5028 | 552 mpi->planes[0]=vidix_mem+vidix_play.offsets[next_frame]+vidix_play.offset.y; |
5373 | 553 mpi->width=mpi->stride[0]=dstrides.y; |
5028 | 554 if(mpi->flags&MP_IMGFLAG_PLANAR) |
555 { | |
11553 | 556 mpi->planes[1]=vidix_mem+vidix_play.offsets[next_frame]+vidix_play.offset.v; |
557 mpi->stride[1]=dstrides.v >> mpi->chroma_x_shift; | |
558 mpi->planes[2]=vidix_mem+vidix_play.offsets[next_frame]+vidix_play.offset.u; | |
559 mpi->stride[2]=dstrides.u >> mpi->chroma_x_shift; | |
5373 | 560 } else |
561 mpi->width/=mpi->bpp/8; | |
5028 | 562 mpi->flags|=MP_IMGFLAG_DIRECT; |
5373 | 563 return VO_TRUE; |
4991 | 564 } |
5373 | 565 return VO_FALSE; |
4991 | 566 } |
567 | |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4540
diff
changeset
|
568 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
|
569 { |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4540
diff
changeset
|
570 switch (request) { |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4540
diff
changeset
|
571 case VOCTRL_QUERY_FORMAT: |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4540
diff
changeset
|
572 return vidix_query_fourcc(*((uint32_t*)data)); |
4991 | 573 case VOCTRL_GET_IMAGE: |
574 return vidix_get_image(data); | |
7685 | 575 case VOCTRL_DRAW_IMAGE: |
576 return vidix_draw_image(data); | |
5002 | 577 case VOCTRL_GET_FRAME_NUM: |
578 *(uint32_t *)data = next_frame; | |
579 return VO_TRUE; | |
580 case VOCTRL_SET_FRAME_NUM: | |
581 next_frame = *(uint32_t *)data; | |
582 return VO_TRUE; | |
583 case VOCTRL_GET_NUM_FRAMES: | |
584 *(uint32_t *)data = vidix_play.num_frames; | |
585 return VO_TRUE; | |
6786 | 586 case VOCTRL_SET_EQUALIZER: |
587 { | |
588 va_list ap; | |
589 int value; | |
590 vidix_video_eq_t info; | |
591 | |
592 if(!video_on) return VO_FALSE; | |
593 va_start(ap, data); | |
594 value = va_arg(ap, int); | |
595 va_end(ap); | |
596 | |
6806 | 597 // printf("vidix seteq %s -> %d \n",data,value); |
598 | |
6786 | 599 /* vidix eq ranges are -1000..1000 */ |
600 if (!strcasecmp(data, "brightness")) | |
601 { | |
602 info.brightness = value*10; | |
6806 | 603 info.cap = VEQ_CAP_BRIGHTNESS; |
6786 | 604 } |
605 else if (!strcasecmp(data, "contrast")) | |
606 { | |
607 info.contrast = value*10; | |
6806 | 608 info.cap = VEQ_CAP_CONTRAST; |
6786 | 609 } |
610 else if (!strcasecmp(data, "saturation")) | |
611 { | |
612 info.saturation = value*10; | |
6806 | 613 info.cap = VEQ_CAP_SATURATION; |
6786 | 614 } |
615 else if (!strcasecmp(data, "hue")) | |
616 { | |
617 info.hue = value*10; | |
6806 | 618 info.cap = VEQ_CAP_HUE; |
6786 | 619 } |
620 | |
621 if (vdlPlaybackSetEq(vidix_handler, &info) == 0) | |
622 return VO_TRUE; | |
623 return VO_FALSE; | |
624 } | |
625 case VOCTRL_GET_EQUALIZER: | |
626 { | |
627 va_list ap; | |
628 int *value; | |
629 vidix_video_eq_t info; | |
630 | |
631 if(!video_on) return VO_FALSE; | |
6806 | 632 if (vdlPlaybackGetEq(vidix_handler, &info) != 0) |
6786 | 633 return VO_FALSE; |
634 | |
635 va_start(ap, data); | |
6806 | 636 value = va_arg(ap, int*); |
6786 | 637 va_end(ap); |
638 | |
639 /* vidix eq ranges are -1000..1000 */ | |
640 if (!strcasecmp(data, "brightness")) | |
641 { | |
642 if (info.cap & VEQ_CAP_BRIGHTNESS) | |
643 *value = info.brightness/10; | |
644 } | |
645 else if (!strcasecmp(data, "contrast")) | |
646 { | |
647 if (info.cap & VEQ_CAP_CONTRAST) | |
648 *value = info.contrast/10; | |
649 } | |
650 else if (!strcasecmp(data, "saturation")) | |
651 { | |
652 if (info.cap & VEQ_CAP_SATURATION) | |
653 *value = info.saturation/10; | |
654 } | |
655 else if (!strcasecmp(data, "hue")) | |
656 { | |
657 if (info.cap & VEQ_CAP_HUE) | |
658 *value = info.hue/10; | |
659 } | |
660 | |
661 return VO_TRUE; | |
662 } | |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4540
diff
changeset
|
663 } |
6531 | 664 return VO_NOTIMPL; |
5319 | 665 // WARNING: we drop extra parameters (...) here! |
6531 | 666 // return server_control(request,data); //VO_NOTIMPL; |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4540
diff
changeset
|
667 } |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4540
diff
changeset
|
668 |
25212
ca7a751f5481
Use proper type for vidix_preinit parameter instead of void *
reimar
parents:
24817
diff
changeset
|
669 int vidix_preinit(const char *drvname,vo_functions_t *server) |
4454 | 670 { |
671 int err; | |
17932 | 672 if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17988
diff
changeset
|
673 mp_msg(MSGT_VO,MSGL_DBG2, "vosub_vidix: vidix_preinit(%s) was called\n",drvname); } |
26976 | 674 |
26975 | 675 vidix_handler = vdlOpen(drvname ? drvname[0] == ':' ? &drvname[1] : drvname[0] ? drvname : NULL : NULL, |
4454 | 676 TYPE_OUTPUT, |
677 verbose); | |
11239 | 678 |
4454 | 679 if(vidix_handler == NULL) |
680 { | |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17988
diff
changeset
|
681 mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_SUB_VIDIX_CouldntFindWorkingVidixDriver); |
4454 | 682 return -1; |
683 } | |
684 if((err=vdlGetCapability(vidix_handler,&vidix_cap)) != 0) | |
685 { | |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17988
diff
changeset
|
686 mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_SUB_VIDIX_CouldntGetCapability,strerror(err)); |
4454 | 687 return -1; |
688 } | |
27008 | 689 mp_msg(MSGT_VO,MSGL_V, "[VO_SUB_VIDIX] Description: %s.\n", vidix_cap.name); |
690 mp_msg(MSGT_VO,MSGL_V, "[VO_SUB_VIDIX] Author: %s.\n", vidix_cap.author); | |
4454 | 691 /* we are able to tune up this stuff depend on fourcc format */ |
25213 | 692 server->draw_slice=vidix_draw_slice; |
693 server->draw_frame=vidix_draw_frame; | |
694 server->flip_page=vidix_flip_page; | |
695 server->draw_osd=vidix_draw_osd; | |
696 // server_control = server->control; | |
697 // server->control=vidix_control; | |
4454 | 698 vo_server = server; |
699 return 0; | |
700 } |