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