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