annotate libvo/vosub_vidix.c @ 7031:a1ff955aa49b

importing libmpdvdkit files
author arpi
date Fri, 16 Aug 2002 22:43:44 +0000
parents a3126e9099b4
children eca7dbad0166
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4010
938d37ad4f85 preliminary version
nick
parents:
diff changeset
1 /*
938d37ad4f85 preliminary version
nick
parents:
diff changeset
2 * vosub_vidix.c
938d37ad4f85 preliminary version
nick
parents:
diff changeset
3 *
938d37ad4f85 preliminary version
nick
parents:
diff changeset
4 * Copyright (C) Nick Kurshev <nickols_k@mail.ru> - 2002
4280
a5f11106ef5e added support for unlimited video resolution (-1)
alex
parents: 4270
diff changeset
5 * Copyright (C) Alex Beregszaszi
4010
938d37ad4f85 preliminary version
nick
parents:
diff changeset
6 *
938d37ad4f85 preliminary version
nick
parents:
diff changeset
7 * You can redistribute this file under terms and conditions
938d37ad4f85 preliminary version
nick
parents:
diff changeset
8 * of GNU General Public licence v2.
938d37ad4f85 preliminary version
nick
parents:
diff changeset
9 *
938d37ad4f85 preliminary version
nick
parents:
diff changeset
10 * This file contains vidix interface to any mplayer's VO plugin.
938d37ad4f85 preliminary version
nick
parents:
diff changeset
11 * (Partly based on vesa_lvo.c from mplayer's package)
938d37ad4f85 preliminary version
nick
parents:
diff changeset
12 */
938d37ad4f85 preliminary version
nick
parents:
diff changeset
13
938d37ad4f85 preliminary version
nick
parents:
diff changeset
14 #include <inttypes.h>
938d37ad4f85 preliminary version
nick
parents:
diff changeset
15 #include <sys/ioctl.h>
938d37ad4f85 preliminary version
nick
parents:
diff changeset
16 #include <unistd.h>
938d37ad4f85 preliminary version
nick
parents:
diff changeset
17 #include <fcntl.h>
938d37ad4f85 preliminary version
nick
parents:
diff changeset
18 #include <sys/mman.h>
938d37ad4f85 preliminary version
nick
parents:
diff changeset
19 #include <stdio.h>
938d37ad4f85 preliminary version
nick
parents:
diff changeset
20 #include <stdlib.h>
938d37ad4f85 preliminary version
nick
parents:
diff changeset
21 #include <string.h>
4372
9b6430df4de5 improvements
nick
parents: 4362
diff changeset
22 #include <errno.h>
4010
938d37ad4f85 preliminary version
nick
parents:
diff changeset
23
938d37ad4f85 preliminary version
nick
parents:
diff changeset
24 #include "config.h"
938d37ad4f85 preliminary version
nick
parents:
diff changeset
25
938d37ad4f85 preliminary version
nick
parents:
diff changeset
26 #include "vosub_vidix.h"
938d37ad4f85 preliminary version
nick
parents:
diff changeset
27 #include "../vidix/vidixlib.h"
5052
6f28d6ccbd91 Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents: 5028
diff changeset
28 #include "../postproc/rgb2rgb.h"
4010
938d37ad4f85 preliminary version
nick
parents:
diff changeset
29 #include "fastmemcpy.h"
938d37ad4f85 preliminary version
nick
parents:
diff changeset
30 #include "osd.h"
938d37ad4f85 preliminary version
nick
parents:
diff changeset
31 #include "video_out.h"
6550
991e03ca5ceb added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents: 6531
diff changeset
32 #include "sub.h"
4991
ad943b99610a VOCTRL_GET_IMAGE (untested but should work)
nick
parents: 4929
diff changeset
33
5566
e01c664def74 VFCAP added
arpi
parents: 5373
diff changeset
34 #include "../libmpcodecs/vfcap.h"
5607
1972c3475d93 mp_image.h and img_format.h moved to libmpcodecs
arpi
parents: 5566
diff changeset
35 #include "../libmpcodecs/mp_image.h"
4010
938d37ad4f85 preliminary version
nick
parents:
diff changeset
36
4929
939eacee89ab Use as much buffers as possible
nick
parents: 4895
diff changeset
37 #define NUM_FRAMES VID_PLAY_MAXFRAMES /* Temporary: driver will overwrite it */
4010
938d37ad4f85 preliminary version
nick
parents:
diff changeset
38 #define UNUSED(x) ((void)(x)) /* Removes warning about unused arguments */
938d37ad4f85 preliminary version
nick
parents:
diff changeset
39
938d37ad4f85 preliminary version
nick
parents:
diff changeset
40 static VDL_HANDLE vidix_handler = NULL;
938d37ad4f85 preliminary version
nick
parents:
diff changeset
41 static uint8_t *vidix_mem = NULL;
938d37ad4f85 preliminary version
nick
parents:
diff changeset
42 static uint8_t next_frame;
5052
6f28d6ccbd91 Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents: 5028
diff changeset
43 static unsigned image_Bpp,image_height,image_width,src_format,forced_fourcc=0;
4010
938d37ad4f85 preliminary version
nick
parents:
diff changeset
44 extern int verbose;
4372
9b6430df4de5 improvements
nick
parents: 4362
diff changeset
45 static int video_on=0;
4010
938d37ad4f85 preliminary version
nick
parents:
diff changeset
46
938d37ad4f85 preliminary version
nick
parents:
diff changeset
47 static vidix_capability_t vidix_cap;
938d37ad4f85 preliminary version
nick
parents:
diff changeset
48 static vidix_playback_t vidix_play;
938d37ad4f85 preliminary version
nick
parents:
diff changeset
49 static vidix_fourcc_t vidix_fourcc;
4454
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
50 static vo_functions_t * vo_server;
4999
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
51 static vidix_yuv_t dstrides;
4739
a2df307ed979 Screenshot on the fly
nick
parents: 4654
diff changeset
52 static uint32_t (*server_control)(uint32_t request, void *data, ...);
a2df307ed979 Screenshot on the fly
nick
parents: 4654
diff changeset
53
4372
9b6430df4de5 improvements
nick
parents: 4362
diff changeset
54 static int vidix_get_bes_da(bes_da_t *);
4379
7a4837091398 provide full vaa interface
nick
parents: 4372
diff changeset
55 static int vidix_get_video_eq(vidix_video_eq_t *info);
7a4837091398 provide full vaa interface
nick
parents: 4372
diff changeset
56 static int vidix_set_video_eq(const vidix_video_eq_t *info);
7a4837091398 provide full vaa interface
nick
parents: 4372
diff changeset
57 static int vidix_get_num_fx(unsigned *info);
7a4837091398 provide full vaa interface
nick
parents: 4372
diff changeset
58 static int vidix_get_oem_fx(vidix_oem_fx_t *info);
7a4837091398 provide full vaa interface
nick
parents: 4372
diff changeset
59 static int vidix_set_oem_fx(const vidix_oem_fx_t *info);
7a4837091398 provide full vaa interface
nick
parents: 4372
diff changeset
60 static int vidix_set_deint(const vidix_deinterlace_t *info);
4372
9b6430df4de5 improvements
nick
parents: 4362
diff changeset
61
4234
0ec1d81c8f94 sorry, i really wanted to add vidix_start and stop as int, to detect if something went into the wrong way (also implement check in vo_xvidix)
alex
parents: 4231
diff changeset
62 int vidix_start(void)
4198
7e2bf04c9a7c added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents: 4138
diff changeset
63 {
7e2bf04c9a7c added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents: 4138
diff changeset
64 int err;
4270
178c84b1090e clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents: 4255
diff changeset
65 if((err=vdlPlaybackOn(vidix_handler))!=0)
178c84b1090e clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents: 4255
diff changeset
66 {
178c84b1090e clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents: 4255
diff changeset
67 printf("vosub_vidix: Can't start playback: %s\n",strerror(err));
178c84b1090e clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents: 4255
diff changeset
68 return -1;
178c84b1090e clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents: 4255
diff changeset
69 }
4379
7a4837091398 provide full vaa interface
nick
parents: 4372
diff changeset
70 video_on=1;
4234
0ec1d81c8f94 sorry, i really wanted to add vidix_start and stop as int, to detect if something went into the wrong way (also implement check in vo_xvidix)
alex
parents: 4231
diff changeset
71 return 0;
4198
7e2bf04c9a7c added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents: 4138
diff changeset
72 }
7e2bf04c9a7c added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents: 4138
diff changeset
73
4234
0ec1d81c8f94 sorry, i really wanted to add vidix_start and stop as int, to detect if something went into the wrong way (also implement check in vo_xvidix)
alex
parents: 4231
diff changeset
74 int vidix_stop(void)
4198
7e2bf04c9a7c added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents: 4138
diff changeset
75 {
7e2bf04c9a7c added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents: 4138
diff changeset
76 int err;
7e2bf04c9a7c added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents: 4138
diff changeset
77 if((err=vdlPlaybackOff(vidix_handler))!=0)
7e2bf04c9a7c added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents: 4138
diff changeset
78 {
7e2bf04c9a7c added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents: 4138
diff changeset
79 printf("vosub_vidix: Can't stop playback: %s\n",strerror(err));
4234
0ec1d81c8f94 sorry, i really wanted to add vidix_start and stop as int, to detect if something went into the wrong way (also implement check in vo_xvidix)
alex
parents: 4231
diff changeset
80 return -1;
4198
7e2bf04c9a7c added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents: 4138
diff changeset
81 }
4372
9b6430df4de5 improvements
nick
parents: 4362
diff changeset
82 video_on=0;
4234
0ec1d81c8f94 sorry, i really wanted to add vidix_start and stop as int, to detect if something went into the wrong way (also implement check in vo_xvidix)
alex
parents: 4231
diff changeset
83 return 0;
4198
7e2bf04c9a7c added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents: 4138
diff changeset
84 }
7e2bf04c9a7c added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents: 4138
diff changeset
85
4010
938d37ad4f85 preliminary version
nick
parents:
diff changeset
86 void vidix_term( void )
938d37ad4f85 preliminary version
nick
parents:
diff changeset
87 {
938d37ad4f85 preliminary version
nick
parents:
diff changeset
88 if(verbose > 1) printf("vosub_vidix: vidix_term() was called\n");
4198
7e2bf04c9a7c added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents: 4138
diff changeset
89 vidix_stop();
4010
938d37ad4f85 preliminary version
nick
parents:
diff changeset
90 vdlClose(vidix_handler);
6550
991e03ca5ceb added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents: 6531
diff changeset
91 // ((vo_functions_t *)vo_server)->control=server_control;
4010
938d37ad4f85 preliminary version
nick
parents:
diff changeset
92 }
938d37ad4f85 preliminary version
nick
parents:
diff changeset
93
4430
b4cc68c448db IMGFMT_RGBxx experimental support
nick
parents: 4379
diff changeset
94 static uint32_t vidix_draw_slice_420(uint8_t *image[], int stride[], int w,int h,int x,int y)
4010
938d37ad4f85 preliminary version
nick
parents:
diff changeset
95 {
938d37ad4f85 preliminary version
nick
parents:
diff changeset
96 uint8_t *src;
938d37ad4f85 preliminary version
nick
parents:
diff changeset
97 uint8_t *dest;
938d37ad4f85 preliminary version
nick
parents:
diff changeset
98 int i;
4324
09f15844c960 don't render UV planes if interleaved (also add support later)
alex
parents: 4317
diff changeset
99
09f15844c960 don't render UV planes if interleaved (also add support later)
alex
parents: 4317
diff changeset
100 /* Plane Y */
4032
076c6c29e693 OSD support
nick
parents: 4031
diff changeset
101 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y;
4999
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
102 dest += dstrides.y*y + x;
4010
938d37ad4f85 preliminary version
nick
parents:
diff changeset
103 src = image[0];
938d37ad4f85 preliminary version
nick
parents:
diff changeset
104 for(i=0;i<h;i++){
938d37ad4f85 preliminary version
nick
parents:
diff changeset
105 memcpy(dest,src,w);
938d37ad4f85 preliminary version
nick
parents:
diff changeset
106 src+=stride[0];
4999
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
107 dest += dstrides.y;
4010
938d37ad4f85 preliminary version
nick
parents:
diff changeset
108 }
938d37ad4f85 preliminary version
nick
parents:
diff changeset
109
4324
09f15844c960 don't render UV planes if interleaved (also add support later)
alex
parents: 4317
diff changeset
110 if (vidix_play.flags & VID_PLAY_INTERLEAVED_UV)
09f15844c960 don't render UV planes if interleaved (also add support later)
alex
parents: 4317
diff changeset
111 {
4744
da595f0e882e vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents: 4741
diff changeset
112 int hi,wi;
da595f0e882e vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents: 4741
diff changeset
113 uint8_t *src2;
da595f0e882e vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents: 4741
diff changeset
114 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.v;
4999
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
115 dest += dstrides.y*y/2 + x; // <- is this correct ?
4744
da595f0e882e vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents: 4741
diff changeset
116 h/=2;
da595f0e882e vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents: 4741
diff changeset
117 w/=2;
da595f0e882e vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents: 4741
diff changeset
118 src = image[1];
da595f0e882e vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents: 4741
diff changeset
119 src2 = image[2];
da595f0e882e vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents: 4741
diff changeset
120 for(hi = 0; hi < h; hi++)
da595f0e882e vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents: 4741
diff changeset
121 {
da595f0e882e vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents: 4741
diff changeset
122 for(wi = 0; wi < w; wi++)
da595f0e882e vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents: 4741
diff changeset
123 {
da595f0e882e vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents: 4741
diff changeset
124 dest[2*wi+0] = src[wi];
da595f0e882e vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents: 4741
diff changeset
125 dest[2*wi+1] = src2[wi];
da595f0e882e vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents: 4741
diff changeset
126 }
4999
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
127 dest += dstrides.y;
4744
da595f0e882e vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents: 4741
diff changeset
128 src += stride[1];
4999
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
129 src2+= stride[2];
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
130 }
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
131 }
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
132 else
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
133 {
4744
da595f0e882e vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents: 4741
diff changeset
134 /* Plane V */
da595f0e882e vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents: 4741
diff changeset
135 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.v;
4999
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
136 dest += dstrides.v*y/4 + x;
4744
da595f0e882e vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents: 4741
diff changeset
137 src = image[1];
da595f0e882e vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents: 4741
diff changeset
138 for(i=0;i<h/2;i++){
da595f0e882e vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents: 4741
diff changeset
139 memcpy(dest,src,w/2);
da595f0e882e vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents: 4741
diff changeset
140 src+=stride[1];
4999
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
141 dest+=dstrides.v/2;
4744
da595f0e882e vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents: 4741
diff changeset
142 }
4324
09f15844c960 don't render UV planes if interleaved (also add support later)
alex
parents: 4317
diff changeset
143
4744
da595f0e882e vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents: 4741
diff changeset
144 /* Plane U */
da595f0e882e vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents: 4741
diff changeset
145 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.u;
4999
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
146 dest += dstrides.u*y/4 + x;
4744
da595f0e882e vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents: 4741
diff changeset
147 src = image[2];
da595f0e882e vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents: 4741
diff changeset
148 for(i=0;i<h/2;i++){
da595f0e882e vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents: 4741
diff changeset
149 memcpy(dest,src,w/2);
da595f0e882e vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents: 4741
diff changeset
150 src+=stride[2];
4999
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
151 dest += dstrides.u/2;
4744
da595f0e882e vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents: 4741
diff changeset
152 }
da595f0e882e vidix interleaved U V planes (for g200) by Attila Kinali <kinali@gmx.net>
nick
parents: 4741
diff changeset
153 return 0;
4999
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
154 }
6550
991e03ca5ceb added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents: 6531
diff changeset
155 return -1;
4010
938d37ad4f85 preliminary version
nick
parents:
diff changeset
156 }
938d37ad4f85 preliminary version
nick
parents:
diff changeset
157
6482
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
158 static uint32_t vidix_draw_slice_410(uint8_t *image[], int stride[], int w,int h,int x,int y)
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
159 {
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
160 uint8_t *src;
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
161 uint8_t *dest;
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
162 int i;
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
163
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
164 /* Plane Y */
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
165 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y;
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
166 dest += dstrides.y*y + x;
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
167 src = image[0];
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
168 for(i=0;i<h;i++){
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
169 memcpy(dest,src,w);
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
170 src+=stride[0];
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
171 dest += dstrides.y;
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
172 }
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
173
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
174 if (vidix_play.flags & VID_PLAY_INTERLEAVED_UV)
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
175 {
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
176 printf("vosub_vidix: interleaved uv for yuv410p not supported\n");
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
177 }
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
178 else
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
179 {
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
180 /* Plane V */
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
181 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.v;
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
182 dest += dstrides.v*y/8 + x;
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
183 src = image[1];
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
184 for(i=0;i<h/4;i++){
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
185 memcpy(dest,src,w/4);
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
186 src+=stride[1];
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
187 dest+=dstrides.v/4;
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
188 }
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
189
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
190 /* Plane U */
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
191 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.u;
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
192 dest += dstrides.u*y/8 + x;
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
193 src = image[2];
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
194 for(i=0;i<h/4;i++){
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
195 memcpy(dest,src,w/4);
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
196 src+=stride[2];
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
197 dest += dstrides.u/4;
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
198 }
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
199 return 0;
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
200 }
6550
991e03ca5ceb added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents: 6531
diff changeset
201 return -1;
6482
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
202 }
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
203
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
204 static uint32_t vidix_draw_slice_410_fast(uint8_t *image[], int stride[], int w, int h, int x, int y)
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
205 {
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
206 uint8_t *src;
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
207 uint8_t *dest;
6550
991e03ca5ceb added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents: 6531
diff changeset
208
6482
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
209 UNUSED(w);
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
210 UNUSED(stride);
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
211 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y;
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
212 dest += dstrides.y*y + x;
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
213 src = image[0];
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
214 memcpy(dest, src, dstrides.y*h*9/8);
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
215 return 0;
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
216 }
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
217
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
218 static uint32_t vidix_draw_slice_400(uint8_t *image[], int stride[], int w,int h,int x,int y)
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
219 {
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
220 uint8_t *src;
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
221 uint8_t *dest;
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
222 int i;
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
223
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
224 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y;
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
225 dest += dstrides.y*y + x;
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
226 src = image[0];
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
227 for(i=0;i<h;i++){
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
228 memcpy(dest,src,w);
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
229 src+=stride[0];
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
230 dest += dstrides.y;
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
231 }
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
232 return 0;
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
233 }
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
234
4999
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
235 static uint32_t vidix_draw_slice_packed(uint8_t *image[], int stride[], int w,int h,int x,int y)
4010
938d37ad4f85 preliminary version
nick
parents:
diff changeset
236 {
938d37ad4f85 preliminary version
nick
parents:
diff changeset
237 uint8_t *src;
938d37ad4f85 preliminary version
nick
parents:
diff changeset
238 uint8_t *dest;
938d37ad4f85 preliminary version
nick
parents:
diff changeset
239 int i;
6550
991e03ca5ceb added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents: 6531
diff changeset
240
4032
076c6c29e693 OSD support
nick
parents: 4031
diff changeset
241 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y;
4999
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
242 dest += dstrides.y*y + x;
4010
938d37ad4f85 preliminary version
nick
parents:
diff changeset
243 src = image[0];
938d37ad4f85 preliminary version
nick
parents:
diff changeset
244 for(i=0;i<h;i++){
4999
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
245 memcpy(dest,src,w*image_Bpp);
4010
938d37ad4f85 preliminary version
nick
parents:
diff changeset
246 src+=stride[0];
4999
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
247 dest += dstrides.y;
4010
938d37ad4f85 preliminary version
nick
parents:
diff changeset
248 }
4240
a7d6ea555c2e added colorkey handling
alex
parents: 4234
diff changeset
249 return 0;
4010
938d37ad4f85 preliminary version
nick
parents:
diff changeset
250 }
938d37ad4f85 preliminary version
nick
parents:
diff changeset
251
4999
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
252 static uint32_t vidix_draw_slice_packed_fast(uint8_t *image[], int stride[], int w,int h,int x,int y)
4454
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
253 {
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
254 uint8_t *src;
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
255 uint8_t *dest;
6550
991e03ca5ceb added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents: 6531
diff changeset
256
991e03ca5ceb added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents: 6531
diff changeset
257 UNUSED(w);
991e03ca5ceb added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents: 6531
diff changeset
258 UNUSED(stride);
4454
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
259 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y;
4999
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
260 dest += dstrides.y*y + x;
4430
b4cc68c448db IMGFMT_RGBxx experimental support
nick
parents: 4379
diff changeset
261 src = image[0];
4999
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
262 memcpy(dest,src,h*dstrides.y);
4454
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
263 return 0;
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
264 }
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
265
4010
938d37ad4f85 preliminary version
nick
parents:
diff changeset
266 uint32_t vidix_draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y)
938d37ad4f85 preliminary version
nick
parents:
diff changeset
267 {
6550
991e03ca5ceb added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents: 6531
diff changeset
268 UNUSED(image);
991e03ca5ceb added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents: 6531
diff changeset
269 UNUSED(stride);
991e03ca5ceb added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents: 6531
diff changeset
270 UNUSED(w);
991e03ca5ceb added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents: 6531
diff changeset
271 UNUSED(h);
991e03ca5ceb added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents: 6531
diff changeset
272 UNUSED(x);
991e03ca5ceb added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents: 6531
diff changeset
273 UNUSED(y);
4454
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
274 printf("vosub_vidix: Error unoptimized draw_slice was called\nExiting...");
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
275 vidix_term();
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
276 exit( EXIT_FAILURE );
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
277 return 0;
4010
938d37ad4f85 preliminary version
nick
parents:
diff changeset
278 }
938d37ad4f85 preliminary version
nick
parents:
diff changeset
279
938d37ad4f85 preliminary version
nick
parents:
diff changeset
280 uint32_t vidix_draw_frame(uint8_t *image[])
938d37ad4f85 preliminary version
nick
parents:
diff changeset
281 {
4454
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
282 int stride[1];
4010
938d37ad4f85 preliminary version
nick
parents:
diff changeset
283 if(verbose > 1) printf("vosub_vidix: vidix_draw_frame() was called\n");
938d37ad4f85 preliminary version
nick
parents:
diff changeset
284 /* Note it's very strange but sometime for YUY2 draw_frame is called */
6482
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
285 if(src_format == IMGFMT_YV12 || src_format == IMGFMT_I420 || src_format == IMGFMT_IYUV
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
286 || src_format == IMGFMT_YVU9 || src_format == IMGFMT_IF09)
4442
49c410f359e0 return error if unknown depth given. more informative error messages. dont exit if draw_frame was called with Planar YUV, only warn the user
alex
parents: 4434
diff changeset
287 printf("vosub_vidix: draw_frame for YUV420 called, frame cannot be written\n");
4010
938d37ad4f85 preliminary version
nick
parents:
diff changeset
288 else
4430
b4cc68c448db IMGFMT_RGBxx experimental support
nick
parents: 4379
diff changeset
289 if(src_format == IMGFMT_RGB32 || src_format == IMGFMT_BGR32)
b4cc68c448db IMGFMT_RGBxx experimental support
nick
parents: 4379
diff changeset
290 stride[0] = vidix_play.src.w*4;
b4cc68c448db IMGFMT_RGBxx experimental support
nick
parents: 4379
diff changeset
291 else
b4cc68c448db IMGFMT_RGBxx experimental support
nick
parents: 4379
diff changeset
292 if(src_format == IMGFMT_RGB24 || src_format == IMGFMT_BGR24)
b4cc68c448db IMGFMT_RGBxx experimental support
nick
parents: 4379
diff changeset
293 stride[0] = vidix_play.src.w*3;
b4cc68c448db IMGFMT_RGBxx experimental support
nick
parents: 4379
diff changeset
294 else
4010
938d37ad4f85 preliminary version
nick
parents:
diff changeset
295 stride[0] = vidix_play.src.w*2;
4454
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
296 return vo_server->draw_slice(image,stride,vidix_play.src.w,vidix_play.src.h,
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
297 vidix_play.src.x,vidix_play.src.y);
4010
938d37ad4f85 preliminary version
nick
parents:
diff changeset
298 }
938d37ad4f85 preliminary version
nick
parents:
diff changeset
299
938d37ad4f85 preliminary version
nick
parents:
diff changeset
300 void vidix_flip_page(void)
938d37ad4f85 preliminary version
nick
parents:
diff changeset
301 {
938d37ad4f85 preliminary version
nick
parents:
diff changeset
302 if(verbose > 1) printf("vosub_vidix: vidix_flip_page() was called\n");
938d37ad4f85 preliminary version
nick
parents:
diff changeset
303 if(vo_doublebuffering)
938d37ad4f85 preliminary version
nick
parents:
diff changeset
304 {
4032
076c6c29e693 OSD support
nick
parents: 4031
diff changeset
305 vdlPlaybackFrameSelect(vidix_handler,next_frame);
4010
938d37ad4f85 preliminary version
nick
parents:
diff changeset
306 next_frame=(next_frame+1)%vidix_play.num_frames;
938d37ad4f85 preliminary version
nick
parents:
diff changeset
307 }
938d37ad4f85 preliminary version
nick
parents:
diff changeset
308 }
938d37ad4f85 preliminary version
nick
parents:
diff changeset
309
938d37ad4f85 preliminary version
nick
parents:
diff changeset
310 static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)
938d37ad4f85 preliminary version
nick
parents:
diff changeset
311 {
4032
076c6c29e693 OSD support
nick
parents: 4031
diff changeset
312 uint32_t apitch,bespitch;
4010
938d37ad4f85 preliminary version
nick
parents:
diff changeset
313 void *lvo_mem;
4032
076c6c29e693 OSD support
nick
parents: 4031
diff changeset
314 lvo_mem = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y;
076c6c29e693 OSD support
nick
parents: 4031
diff changeset
315 apitch = vidix_play.dest.pitch.y-1;
4010
938d37ad4f85 preliminary version
nick
parents:
diff changeset
316 switch(vidix_play.fourcc){
938d37ad4f85 preliminary version
nick
parents:
diff changeset
317 case IMGFMT_YV12:
938d37ad4f85 preliminary version
nick
parents:
diff changeset
318 case IMGFMT_IYUV:
938d37ad4f85 preliminary version
nick
parents:
diff changeset
319 case IMGFMT_I420:
6550
991e03ca5ceb added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents: 6531
diff changeset
320 case IMGFMT_YVU9:
991e03ca5ceb added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents: 6531
diff changeset
321 case IMGFMT_IF09:
991e03ca5ceb added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents: 6531
diff changeset
322 case IMGFMT_Y8:
991e03ca5ceb added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents: 6531
diff changeset
323 case IMGFMT_Y800:
4745
398e3663ed71 Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents: 4744
diff changeset
324 bespitch = (vidix_play.src.w + apitch) & (~apitch);
4010
938d37ad4f85 preliminary version
nick
parents:
diff changeset
325 vo_draw_alpha_yv12(w,h,src,srca,stride,lvo_mem+bespitch*y0+x0,bespitch);
938d37ad4f85 preliminary version
nick
parents:
diff changeset
326 break;
938d37ad4f85 preliminary version
nick
parents:
diff changeset
327 case IMGFMT_YUY2:
4745
398e3663ed71 Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents: 4744
diff changeset
328 bespitch = (vidix_play.src.w*2 + apitch) & (~apitch);
398e3663ed71 Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents: 4744
diff changeset
329 vo_draw_alpha_yuy2(w,h,src,srca,stride,lvo_mem+bespitch*y0+2*x0,bespitch);
4010
938d37ad4f85 preliminary version
nick
parents:
diff changeset
330 break;
938d37ad4f85 preliminary version
nick
parents:
diff changeset
331 case IMGFMT_UYVY:
4745
398e3663ed71 Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents: 4744
diff changeset
332 bespitch = (vidix_play.src.w*2 + apitch) & (~apitch);
398e3663ed71 Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents: 4744
diff changeset
333 vo_draw_alpha_yuy2(w,h,src,srca,stride,lvo_mem+bespitch*y0+2*x0+1,bespitch);
4010
938d37ad4f85 preliminary version
nick
parents:
diff changeset
334 break;
4430
b4cc68c448db IMGFMT_RGBxx experimental support
nick
parents: 4379
diff changeset
335 case IMGFMT_RGB32:
b4cc68c448db IMGFMT_RGBxx experimental support
nick
parents: 4379
diff changeset
336 case IMGFMT_BGR32:
4745
398e3663ed71 Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents: 4744
diff changeset
337 bespitch = (vidix_play.src.w*4 + apitch) & (~apitch);
398e3663ed71 Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents: 4744
diff changeset
338 vo_draw_alpha_rgb32(w,h,src,srca,stride,lvo_mem+y0*bespitch+4*x0,bespitch);
4430
b4cc68c448db IMGFMT_RGBxx experimental support
nick
parents: 4379
diff changeset
339 break;
b4cc68c448db IMGFMT_RGBxx experimental support
nick
parents: 4379
diff changeset
340 case IMGFMT_RGB24:
b4cc68c448db IMGFMT_RGBxx experimental support
nick
parents: 4379
diff changeset
341 case IMGFMT_BGR24:
4745
398e3663ed71 Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents: 4744
diff changeset
342 bespitch = (vidix_play.src.w*3 + apitch) & (~apitch);
398e3663ed71 Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents: 4744
diff changeset
343 vo_draw_alpha_rgb24(w,h,src,srca,stride,lvo_mem+y0*bespitch+3*x0,bespitch);
4430
b4cc68c448db IMGFMT_RGBxx experimental support
nick
parents: 4379
diff changeset
344 break;
b4cc68c448db IMGFMT_RGBxx experimental support
nick
parents: 4379
diff changeset
345 case IMGFMT_RGB16:
b4cc68c448db IMGFMT_RGBxx experimental support
nick
parents: 4379
diff changeset
346 case IMGFMT_BGR16:
4745
398e3663ed71 Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents: 4744
diff changeset
347 bespitch = (vidix_play.src.w*2 + apitch) & (~apitch);
398e3663ed71 Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents: 4744
diff changeset
348 vo_draw_alpha_rgb16(w,h,src,srca,stride,lvo_mem+y0*bespitch+2*x0,bespitch);
4430
b4cc68c448db IMGFMT_RGBxx experimental support
nick
parents: 4379
diff changeset
349 break;
b4cc68c448db IMGFMT_RGBxx experimental support
nick
parents: 4379
diff changeset
350 case IMGFMT_RGB15:
b4cc68c448db IMGFMT_RGBxx experimental support
nick
parents: 4379
diff changeset
351 case IMGFMT_BGR15:
4745
398e3663ed71 Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents: 4744
diff changeset
352 bespitch = (vidix_play.src.w*2 + apitch) & (~apitch);
398e3663ed71 Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents: 4744
diff changeset
353 vo_draw_alpha_rgb15(w,h,src,srca,stride,lvo_mem+y0*bespitch+2*x0,bespitch);
4430
b4cc68c448db IMGFMT_RGBxx experimental support
nick
parents: 4379
diff changeset
354 break;
4010
938d37ad4f85 preliminary version
nick
parents:
diff changeset
355 default:
6786
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
356 return;
4010
938d37ad4f85 preliminary version
nick
parents:
diff changeset
357 }
938d37ad4f85 preliminary version
nick
parents:
diff changeset
358 }
938d37ad4f85 preliminary version
nick
parents:
diff changeset
359
938d37ad4f85 preliminary version
nick
parents:
diff changeset
360 void vidix_draw_osd(void)
938d37ad4f85 preliminary version
nick
parents:
diff changeset
361 {
938d37ad4f85 preliminary version
nick
parents:
diff changeset
362 if(verbose > 1) printf("vosub_vidix: vidix_draw_osd() was called\n");
938d37ad4f85 preliminary version
nick
parents:
diff changeset
363 /* TODO: hw support */
938d37ad4f85 preliminary version
nick
parents:
diff changeset
364 vo_draw_text(vidix_play.src.w,vidix_play.src.h,draw_alpha);
938d37ad4f85 preliminary version
nick
parents:
diff changeset
365 }
938d37ad4f85 preliminary version
nick
parents:
diff changeset
366
938d37ad4f85 preliminary version
nick
parents:
diff changeset
367 uint32_t vidix_query_fourcc(uint32_t format)
938d37ad4f85 preliminary version
nick
parents:
diff changeset
368 {
938d37ad4f85 preliminary version
nick
parents:
diff changeset
369 if(verbose > 1) printf("vosub_vidix: query_format was called: %x (%s)\n",format,vo_format_name(format));
938d37ad4f85 preliminary version
nick
parents:
diff changeset
370 vidix_fourcc.fourcc = format;
938d37ad4f85 preliminary version
nick
parents:
diff changeset
371 vdlQueryFourcc(vidix_handler,&vidix_fourcc);
5052
6f28d6ccbd91 Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents: 5028
diff changeset
372 if (vidix_fourcc.depth == VID_DEPTH_NONE)
5566
e01c664def74 VFCAP added
arpi
parents: 5373
diff changeset
373 return 0;
6550
991e03ca5ceb added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents: 6531
diff changeset
374 return VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW|VFCAP_HWSCALE_UP|VFCAP_HWSCALE_DOWN|VFCAP_OSD;
4010
938d37ad4f85 preliminary version
nick
parents:
diff changeset
375 }
4240
a7d6ea555c2e added colorkey handling
alex
parents: 4234
diff changeset
376
4255
5a4a4b272d10 vidix_grkey_support checking for colorkeying
alex
parents: 4240
diff changeset
377 int vidix_grkey_support(void)
5a4a4b272d10 vidix_grkey_support checking for colorkeying
alex
parents: 4240
diff changeset
378 {
4270
178c84b1090e clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents: 4255
diff changeset
379 return(vidix_fourcc.flags & VID_CAP_COLORKEY);
4255
5a4a4b272d10 vidix_grkey_support checking for colorkeying
alex
parents: 4240
diff changeset
380 }
5a4a4b272d10 vidix_grkey_support checking for colorkeying
alex
parents: 4240
diff changeset
381
4240
a7d6ea555c2e added colorkey handling
alex
parents: 4234
diff changeset
382 int vidix_grkey_get(vidix_grkey_t *gr_key)
a7d6ea555c2e added colorkey handling
alex
parents: 4234
diff changeset
383 {
a7d6ea555c2e added colorkey handling
alex
parents: 4234
diff changeset
384 return(vdlGetGrKeys(vidix_handler, gr_key));
a7d6ea555c2e added colorkey handling
alex
parents: 4234
diff changeset
385 }
a7d6ea555c2e added colorkey handling
alex
parents: 4234
diff changeset
386
a7d6ea555c2e added colorkey handling
alex
parents: 4234
diff changeset
387 int vidix_grkey_set(const vidix_grkey_t *gr_key)
a7d6ea555c2e added colorkey handling
alex
parents: 4234
diff changeset
388 {
a7d6ea555c2e added colorkey handling
alex
parents: 4234
diff changeset
389 return(vdlSetGrKeys(vidix_handler, gr_key));
a7d6ea555c2e added colorkey handling
alex
parents: 4234
diff changeset
390 }
4372
9b6430df4de5 improvements
nick
parents: 4362
diff changeset
391
9b6430df4de5 improvements
nick
parents: 4362
diff changeset
392 static int vidix_get_bes_da(bes_da_t *info)
9b6430df4de5 improvements
nick
parents: 4362
diff changeset
393 {
9b6430df4de5 improvements
nick
parents: 4362
diff changeset
394 if(!video_on) return EPERM;
9b6430df4de5 improvements
nick
parents: 4362
diff changeset
395 info->dest.x = vidix_play.src.x;
9b6430df4de5 improvements
nick
parents: 4362
diff changeset
396 info->dest.y = vidix_play.src.y;
9b6430df4de5 improvements
nick
parents: 4362
diff changeset
397 info->dest.w = vidix_play.src.w;
9b6430df4de5 improvements
nick
parents: 4362
diff changeset
398 info->dest.h = vidix_play.src.h;
9b6430df4de5 improvements
nick
parents: 4362
diff changeset
399 info->dest.pitch.y = vidix_play.dest.pitch.y;
9b6430df4de5 improvements
nick
parents: 4362
diff changeset
400 info->dest.pitch.u = vidix_play.dest.pitch.u;
9b6430df4de5 improvements
nick
parents: 4362
diff changeset
401 info->dest.pitch.v = vidix_play.dest.pitch.v;
9b6430df4de5 improvements
nick
parents: 4362
diff changeset
402 info->flags = vidix_play.flags;
9b6430df4de5 improvements
nick
parents: 4362
diff changeset
403 info->frame_size = vidix_play.frame_size;
9b6430df4de5 improvements
nick
parents: 4362
diff changeset
404 info->num_frames = vidix_play.num_frames;
9b6430df4de5 improvements
nick
parents: 4362
diff changeset
405 memcpy(info->offsets,vidix_play.offsets,sizeof(unsigned)*vidix_play.num_frames);
9b6430df4de5 improvements
nick
parents: 4362
diff changeset
406 memcpy(&info->offset,&vidix_play.offset,sizeof(vidix_yuv_t));
9b6430df4de5 improvements
nick
parents: 4362
diff changeset
407 info->dga_addr = vidix_play.dga_addr;
9b6430df4de5 improvements
nick
parents: 4362
diff changeset
408 return 0;
9b6430df4de5 improvements
nick
parents: 4362
diff changeset
409 }
4379
7a4837091398 provide full vaa interface
nick
parents: 4372
diff changeset
410
7a4837091398 provide full vaa interface
nick
parents: 4372
diff changeset
411 static int vidix_get_video_eq(vidix_video_eq_t *info)
7a4837091398 provide full vaa interface
nick
parents: 4372
diff changeset
412 {
7a4837091398 provide full vaa interface
nick
parents: 4372
diff changeset
413 if(!video_on) return EPERM;
7a4837091398 provide full vaa interface
nick
parents: 4372
diff changeset
414 return vdlPlaybackGetEq(vidix_handler, info);
7a4837091398 provide full vaa interface
nick
parents: 4372
diff changeset
415 }
7a4837091398 provide full vaa interface
nick
parents: 4372
diff changeset
416
7a4837091398 provide full vaa interface
nick
parents: 4372
diff changeset
417 static int vidix_set_video_eq(const vidix_video_eq_t *info)
7a4837091398 provide full vaa interface
nick
parents: 4372
diff changeset
418 {
7a4837091398 provide full vaa interface
nick
parents: 4372
diff changeset
419 if(!video_on) return EPERM;
7a4837091398 provide full vaa interface
nick
parents: 4372
diff changeset
420 return vdlPlaybackSetEq(vidix_handler, info);
7a4837091398 provide full vaa interface
nick
parents: 4372
diff changeset
421 }
7a4837091398 provide full vaa interface
nick
parents: 4372
diff changeset
422
7a4837091398 provide full vaa interface
nick
parents: 4372
diff changeset
423 static int vidix_get_num_fx(unsigned *info)
7a4837091398 provide full vaa interface
nick
parents: 4372
diff changeset
424 {
7a4837091398 provide full vaa interface
nick
parents: 4372
diff changeset
425 if(!video_on) return EPERM;
7a4837091398 provide full vaa interface
nick
parents: 4372
diff changeset
426 return vdlQueryNumOemEffects(vidix_handler, info);
7a4837091398 provide full vaa interface
nick
parents: 4372
diff changeset
427 }
7a4837091398 provide full vaa interface
nick
parents: 4372
diff changeset
428
7a4837091398 provide full vaa interface
nick
parents: 4372
diff changeset
429 static int vidix_get_oem_fx(vidix_oem_fx_t *info)
7a4837091398 provide full vaa interface
nick
parents: 4372
diff changeset
430 {
7a4837091398 provide full vaa interface
nick
parents: 4372
diff changeset
431 if(!video_on) return EPERM;
7a4837091398 provide full vaa interface
nick
parents: 4372
diff changeset
432 return vdlGetOemEffect(vidix_handler, info);
7a4837091398 provide full vaa interface
nick
parents: 4372
diff changeset
433 }
7a4837091398 provide full vaa interface
nick
parents: 4372
diff changeset
434
7a4837091398 provide full vaa interface
nick
parents: 4372
diff changeset
435 static int vidix_set_oem_fx(const vidix_oem_fx_t *info)
7a4837091398 provide full vaa interface
nick
parents: 4372
diff changeset
436 {
7a4837091398 provide full vaa interface
nick
parents: 4372
diff changeset
437 if(!video_on) return EPERM;
7a4837091398 provide full vaa interface
nick
parents: 4372
diff changeset
438 return vdlSetOemEffect(vidix_handler, info);
7a4837091398 provide full vaa interface
nick
parents: 4372
diff changeset
439 }
7a4837091398 provide full vaa interface
nick
parents: 4372
diff changeset
440
7a4837091398 provide full vaa interface
nick
parents: 4372
diff changeset
441 static int vidix_set_deint(const vidix_deinterlace_t *info)
7a4837091398 provide full vaa interface
nick
parents: 4372
diff changeset
442 {
7a4837091398 provide full vaa interface
nick
parents: 4372
diff changeset
443 if(!video_on) return EPERM;
7a4837091398 provide full vaa interface
nick
parents: 4372
diff changeset
444 return vdlPlaybackSetDeint(vidix_handler, info);
7a4837091398 provide full vaa interface
nick
parents: 4372
diff changeset
445 }
4454
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
446
5028
ddc28e9aa726 fixed strides for packed fourccs
nick
parents: 5002
diff changeset
447 static int is_422_planes_eq=0;
4454
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
448 int vidix_init(unsigned src_width,unsigned src_height,
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
449 unsigned x_org,unsigned y_org,unsigned dst_width,
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
450 unsigned dst_height,unsigned format,unsigned dest_bpp,
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
451 unsigned vid_w,unsigned vid_h,const void *info)
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
452 {
6550
991e03ca5ceb added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents: 6531
diff changeset
453 size_t i;
5028
ddc28e9aa726 fixed strides for packed fourccs
nick
parents: 5002
diff changeset
454 int err;
4999
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
455 uint32_t sstride,apitch;
4454
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
456 if(verbose > 1)
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
457 printf("vosub_vidix: vidix_init() was called\n"
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
458 "src_w=%u src_h=%u dest_x_y_w_h = %u %u %u %u\n"
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
459 "format=%s dest_bpp=%u vid_w=%u vid_h=%u\n"
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
460 ,src_width,src_height,x_org,y_org,dst_width,dst_height
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
461 ,vo_format_name(format),dest_bpp,vid_w,vid_h);
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
462
7026
a3126e9099b4 should solve -vo vesa:vidix problem 'vosub_vidix: video server has
arpi
parents: 6806
diff changeset
463 if(vidix_query_fourcc(format) == 0)
a3126e9099b4 should solve -vo vesa:vidix problem 'vosub_vidix: video server has
arpi
parents: 6806
diff changeset
464 {
a3126e9099b4 should solve -vo vesa:vidix problem 'vosub_vidix: video server has
arpi
parents: 6806
diff changeset
465 printf("vosub_vidix: unsupported fourcc for this vidix driver: %x (%s)\n",
a3126e9099b4 should solve -vo vesa:vidix problem 'vosub_vidix: video server has
arpi
parents: 6806
diff changeset
466 format,vo_format_name(format));
a3126e9099b4 should solve -vo vesa:vidix problem 'vosub_vidix: video server has
arpi
parents: 6806
diff changeset
467 return -1;
a3126e9099b4 should solve -vo vesa:vidix problem 'vosub_vidix: video server has
arpi
parents: 6806
diff changeset
468 }
a3126e9099b4 should solve -vo vesa:vidix problem 'vosub_vidix: video server has
arpi
parents: 6806
diff changeset
469
4454
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
470 if(((vidix_cap.maxwidth != -1) && (vid_w > vidix_cap.maxwidth)) ||
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
471 ((vidix_cap.minwidth != -1) && (vid_w < vidix_cap.minwidth)) ||
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
472 ((vidix_cap.maxheight != -1) && (vid_h > vidix_cap.maxheight)) ||
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
473 ((vidix_cap.minwidth != -1 ) && (vid_h < vidix_cap.minheight)))
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
474 {
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
475 printf("vosub_vidix: video server has unsupported resolution (%dx%d), supported: %dx%d-%dx%d\n",
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
476 vid_w, vid_h, vidix_cap.minwidth, vidix_cap.minheight,
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
477 vidix_cap.maxwidth, vidix_cap.maxheight);
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
478 return -1;
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
479 }
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
480
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
481 err = 0;
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
482 switch(dest_bpp)
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
483 {
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
484 case 1: err = ((vidix_fourcc.depth & VID_DEPTH_1BPP) != VID_DEPTH_1BPP); break;
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
485 case 2: err = ((vidix_fourcc.depth & VID_DEPTH_2BPP) != VID_DEPTH_2BPP); break;
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
486 case 4: err = ((vidix_fourcc.depth & VID_DEPTH_4BPP) != VID_DEPTH_4BPP); break;
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
487 case 8: err = ((vidix_fourcc.depth & VID_DEPTH_8BPP) != VID_DEPTH_8BPP); break;
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
488 case 12:err = ((vidix_fourcc.depth & VID_DEPTH_12BPP) != VID_DEPTH_12BPP); break;
4540
cb255a42aa5e Enable 15bpp on server
nick
parents: 4454
diff changeset
489 case 15:err = ((vidix_fourcc.depth & VID_DEPTH_15BPP) != VID_DEPTH_15BPP); break;
4454
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
490 case 16:err = ((vidix_fourcc.depth & VID_DEPTH_16BPP) != VID_DEPTH_16BPP); break;
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
491 case 24:err = ((vidix_fourcc.depth & VID_DEPTH_24BPP) != VID_DEPTH_24BPP); break;
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
492 case 32:err = ((vidix_fourcc.depth & VID_DEPTH_32BPP) != VID_DEPTH_32BPP); break;
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
493 default: err=1; break;
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
494 }
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
495 if(err)
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
496 {
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
497 printf("vosub_vidix: video server has unsupported color depth by vidix (%d)\n"
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
498 ,vidix_fourcc.depth);
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
499 return -1;
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
500 }
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
501 if((dst_width > src_width || dst_height > src_height) && (vidix_cap.flags & FLAG_UPSCALER) != FLAG_UPSCALER)
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
502 {
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
503 printf("vosub_vidix: vidix driver can't upscale image (%d%d -> %d%d)\n",
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
504 src_width, src_height, dst_width, dst_height);
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
505 return -1;
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
506 }
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
507 if((dst_width > src_width || dst_height > src_height) && (vidix_cap.flags & FLAG_DOWNSCALER) != FLAG_DOWNSCALER)
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
508 {
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
509 printf("vosub_vidix: vidix driver can't downscale image (%d%d -> %d%d)\n",
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
510 src_width, src_height, dst_width, dst_height);
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
511 return -1;
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
512 }
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
513 image_width = src_width;
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
514 image_height = src_height;
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
515 src_format = format;
5052
6f28d6ccbd91 Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents: 5028
diff changeset
516 if(forced_fourcc) format = forced_fourcc;
4454
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
517 memset(&vidix_play,0,sizeof(vidix_playback_t));
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
518 vidix_play.fourcc = format;
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
519 vidix_play.capability = vidix_cap.flags; /* every ;) */
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
520 vidix_play.blend_factor = 0; /* for now */
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
521 /* display the full picture.
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
522 Nick: we could implement here zooming to a specified area -- alex */
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
523 vidix_play.src.x = vidix_play.src.y = 0;
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
524 vidix_play.src.w = src_width;
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
525 vidix_play.src.h = src_height;
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
526 vidix_play.dest.x = x_org;
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
527 vidix_play.dest.y = y_org;
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
528 vidix_play.dest.w = dst_width;
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
529 vidix_play.dest.h = dst_height;
4929
939eacee89ab Use as much buffers as possible
nick
parents: 4895
diff changeset
530 vidix_play.num_frames=vo_doublebuffering?NUM_FRAMES-1:1;
4454
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
531 vidix_play.src.pitch.y = vidix_play.src.pitch.u = vidix_play.src.pitch.v = 0;
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
532 if(info)
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
533 {
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
534 switch(((const vo_tune_info_t *)info)->pitch[0])
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
535 {
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
536 case 2:
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
537 case 4:
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
538 case 8:
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
539 case 16:
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
540 case 32:
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
541 case 64:
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
542 case 128:
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
543 case 256: vidix_play.src.pitch.y = ((const vo_tune_info_t *)info)->pitch[0];
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
544 break;
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
545 default: break;
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
546 }
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
547 switch(((const vo_tune_info_t *)info)->pitch[1])
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
548 {
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
549 case 2:
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
550 case 4:
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
551 case 8:
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
552 case 16:
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
553 case 32:
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
554 case 64:
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
555 case 128:
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
556 case 256: vidix_play.src.pitch.u = ((const vo_tune_info_t *)info)->pitch[1];
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
557 break;
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
558 default: break;
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
559 }
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
560 switch(((const vo_tune_info_t *)info)->pitch[2])
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
561 {
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
562 case 2:
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
563 case 4:
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
564 case 8:
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
565 case 16:
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
566 case 32:
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
567 case 64:
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
568 case 128:
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
569 case 256: vidix_play.src.pitch.v = ((const vo_tune_info_t *)info)->pitch[2];
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
570 break;
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
571 default: break;
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
572 }
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
573 }
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
574 if((err=vdlConfigPlayback(vidix_handler,&vidix_play))!=0)
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
575 {
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
576 printf("vosub_vidix: Can't configure playback: %s\n",strerror(err));
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
577 return -1;
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
578 }
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
579 if (verbose) printf("vosub_vidix: using %d buffer(s)\n", vidix_play.num_frames);
4454
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
580
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
581 vidix_mem = vidix_play.dga_addr;
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
582
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
583 /* select first frame */
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
584 next_frame = 0;
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
585 // vdlPlaybackFrameSelect(vidix_handler,next_frame);
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
586
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
587 /* clear every frame with correct address and frame_size */
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
588 for (i = 0; i < vidix_play.num_frames; i++)
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
589 memset(vidix_mem + vidix_play.offsets[i], 0x80,
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
590 vidix_play.frame_size);
4999
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
591 switch(format)
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
592 {
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
593 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
594 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
595 case IMGFMT_IYUV:
6482
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
596 case IMGFMT_YVU9:
4999
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
597 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
598 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
599 case IMGFMT_Y8:
4999
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
600 apitch = vidix_play.dest.pitch.y-1;
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
601 dstrides.y = (image_width + apitch) & ~apitch;
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
602 apitch = vidix_play.dest.pitch.v-1;
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
603 dstrides.v = (image_width + apitch) & ~apitch;
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
604 apitch = vidix_play.dest.pitch.u-1;
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
605 dstrides.u = (image_width + apitch) & ~apitch;
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
606 image_Bpp=1;
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
607 break;
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
608 case IMGFMT_RGB32:
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
609 case IMGFMT_BGR32:
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
610 apitch = vidix_play.dest.pitch.y-1;
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
611 dstrides.y = (image_width*4 + apitch) & ~apitch;
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
612 dstrides.u = dstrides.v = 0;
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
613 image_Bpp=4;
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
614 break;
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
615 case IMGFMT_RGB24:
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
616 case IMGFMT_BGR24:
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
617 apitch = vidix_play.dest.pitch.y-1;
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
618 dstrides.y = (image_width*3 + apitch) & ~apitch;
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
619 dstrides.u = dstrides.v = 0;
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
620 image_Bpp=3;
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
621 break;
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
622 default:
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
623 apitch = vidix_play.dest.pitch.y-1;
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
624 dstrides.y = (image_width*2 + apitch) & ~apitch;
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
625 dstrides.u = dstrides.v = 0;
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
626 image_Bpp=2;
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
627 break;
7f1fa1db24b4 Optimization and get_image fixes (still untested)
nick
parents: 4991
diff changeset
628 }
4454
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
629 /* tune some info here */
6482
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
630 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
631 if(!forced_fourcc)
6f28d6ccbd91 Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents: 5028
diff changeset
632 {
6f28d6ccbd91 Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents: 5028
diff changeset
633 is_422_planes_eq = sstride == dstrides.y;
6482
528216496060 YVU9,IF09,Y800 and Y8 support - and syªªnced with mpxp
alex
parents: 6018
diff changeset
634
5052
6f28d6ccbd91 Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents: 5028
diff changeset
635 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
636 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
637 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
638 vo_server->draw_slice = vidix_draw_slice_410;
5052
6f28d6ccbd91 Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents: 5028
diff changeset
639 else vo_server->draw_slice =
6f28d6ccbd91 Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents: 5028
diff changeset
640 is_422_planes_eq ?
6f28d6ccbd91 Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents: 5028
diff changeset
641 vidix_draw_slice_packed_fast:
6f28d6ccbd91 Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents: 5028
diff changeset
642 vidix_draw_slice_packed;
6f28d6ccbd91 Using yv12_to_yuy2 sw convertor for cards which have no native yv12 support
nick
parents: 5028
diff changeset
643 }
4454
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
644 return 0;
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
645 }
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
646
4991
ad943b99610a VOCTRL_GET_IMAGE (untested but should work)
nick
parents: 4929
diff changeset
647 static uint32_t vidix_get_image(mp_image_t *mpi)
ad943b99610a VOCTRL_GET_IMAGE (untested but should work)
nick
parents: 4929
diff changeset
648 {
ad943b99610a VOCTRL_GET_IMAGE (untested but should work)
nick
parents: 4929
diff changeset
649 if(mpi->type==MP_IMGTYPE_STATIC && vidix_play.num_frames>1) return VO_FALSE;
ad943b99610a VOCTRL_GET_IMAGE (untested but should work)
nick
parents: 4929
diff changeset
650 if(mpi->flags&MP_IMGFLAG_READABLE) return VO_FALSE; /* slow video ram */
6550
991e03ca5ceb added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents: 6531
diff changeset
651 if((is_422_planes_eq || (mpi->flags&(MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_ACCEPT_WIDTH))) &&
991e03ca5ceb added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents: 6531
diff changeset
652 (!forced_fourcc && !(vidix_play.flags & VID_PLAY_INTERLEAVED_UV)))
4991
ad943b99610a VOCTRL_GET_IMAGE (untested but should work)
nick
parents: 4929
diff changeset
653 {
5373
b476f5d1c91e 10l to nick - ACCEPT_WIDTH fixed
arpi
parents: 5319
diff changeset
654 if(mpi->flags&MP_IMGFLAG_ACCEPT_WIDTH){
b476f5d1c91e 10l to nick - ACCEPT_WIDTH fixed
arpi
parents: 5319
diff changeset
655 // check if only width is enough to represent strides:
b476f5d1c91e 10l to nick - ACCEPT_WIDTH fixed
arpi
parents: 5319
diff changeset
656 if(mpi->flags&MP_IMGFLAG_PLANAR){
b476f5d1c91e 10l to nick - ACCEPT_WIDTH fixed
arpi
parents: 5319
diff changeset
657 if((dstrides.y>>1)!=dstrides.v || dstrides.v!=dstrides.u) return VO_FALSE;
b476f5d1c91e 10l to nick - ACCEPT_WIDTH fixed
arpi
parents: 5319
diff changeset
658 } else {
b476f5d1c91e 10l to nick - ACCEPT_WIDTH fixed
arpi
parents: 5319
diff changeset
659 if(dstrides.y % (mpi->bpp/8)) return VO_FALSE;
b476f5d1c91e 10l to nick - ACCEPT_WIDTH fixed
arpi
parents: 5319
diff changeset
660 }
b476f5d1c91e 10l to nick - ACCEPT_WIDTH fixed
arpi
parents: 5319
diff changeset
661 }
5028
ddc28e9aa726 fixed strides for packed fourccs
nick
parents: 5002
diff changeset
662 mpi->planes[0]=vidix_mem+vidix_play.offsets[next_frame]+vidix_play.offset.y;
5373
b476f5d1c91e 10l to nick - ACCEPT_WIDTH fixed
arpi
parents: 5319
diff changeset
663 mpi->width=mpi->stride[0]=dstrides.y;
5028
ddc28e9aa726 fixed strides for packed fourccs
nick
parents: 5002
diff changeset
664 if(mpi->flags&MP_IMGFLAG_PLANAR)
ddc28e9aa726 fixed strides for packed fourccs
nick
parents: 5002
diff changeset
665 {
ddc28e9aa726 fixed strides for packed fourccs
nick
parents: 5002
diff changeset
666 mpi->planes[2]=vidix_mem+vidix_play.offsets[next_frame]+vidix_play.offset.v;
ddc28e9aa726 fixed strides for packed fourccs
nick
parents: 5002
diff changeset
667 mpi->stride[2]=dstrides.v;
ddc28e9aa726 fixed strides for packed fourccs
nick
parents: 5002
diff changeset
668 mpi->planes[1]=vidix_mem+vidix_play.offsets[next_frame]+vidix_play.offset.u;
ddc28e9aa726 fixed strides for packed fourccs
nick
parents: 5002
diff changeset
669 mpi->stride[1]=dstrides.u;
5373
b476f5d1c91e 10l to nick - ACCEPT_WIDTH fixed
arpi
parents: 5319
diff changeset
670 } else
b476f5d1c91e 10l to nick - ACCEPT_WIDTH fixed
arpi
parents: 5319
diff changeset
671 mpi->width/=mpi->bpp/8;
5028
ddc28e9aa726 fixed strides for packed fourccs
nick
parents: 5002
diff changeset
672 mpi->flags|=MP_IMGFLAG_DIRECT;
5373
b476f5d1c91e 10l to nick - ACCEPT_WIDTH fixed
arpi
parents: 5319
diff changeset
673 return VO_TRUE;
4991
ad943b99610a VOCTRL_GET_IMAGE (untested but should work)
nick
parents: 4929
diff changeset
674 }
5373
b476f5d1c91e 10l to nick - ACCEPT_WIDTH fixed
arpi
parents: 5319
diff changeset
675 return VO_FALSE;
4991
ad943b99610a VOCTRL_GET_IMAGE (untested but should work)
nick
parents: 4929
diff changeset
676 }
ad943b99610a VOCTRL_GET_IMAGE (untested but should work)
nick
parents: 4929
diff changeset
677
4592
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4540
diff changeset
678 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
679 {
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4540
diff changeset
680 switch (request) {
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4540
diff changeset
681 case VOCTRL_QUERY_FORMAT:
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4540
diff changeset
682 return vidix_query_fourcc(*((uint32_t*)data));
4991
ad943b99610a VOCTRL_GET_IMAGE (untested but should work)
nick
parents: 4929
diff changeset
683 case VOCTRL_GET_IMAGE:
ad943b99610a VOCTRL_GET_IMAGE (untested but should work)
nick
parents: 4929
diff changeset
684 return vidix_get_image(data);
5002
70751bbd6404 voctls for decoding ahead
nick
parents: 4999
diff changeset
685 case VOCTRL_GET_FRAME_NUM:
70751bbd6404 voctls for decoding ahead
nick
parents: 4999
diff changeset
686 *(uint32_t *)data = next_frame;
70751bbd6404 voctls for decoding ahead
nick
parents: 4999
diff changeset
687 return VO_TRUE;
70751bbd6404 voctls for decoding ahead
nick
parents: 4999
diff changeset
688 case VOCTRL_SET_FRAME_NUM:
70751bbd6404 voctls for decoding ahead
nick
parents: 4999
diff changeset
689 next_frame = *(uint32_t *)data;
70751bbd6404 voctls for decoding ahead
nick
parents: 4999
diff changeset
690 return VO_TRUE;
70751bbd6404 voctls for decoding ahead
nick
parents: 4999
diff changeset
691 case VOCTRL_GET_NUM_FRAMES:
70751bbd6404 voctls for decoding ahead
nick
parents: 4999
diff changeset
692 *(uint32_t *)data = vidix_play.num_frames;
70751bbd6404 voctls for decoding ahead
nick
parents: 4999
diff changeset
693 return VO_TRUE;
6786
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
694 case VOCTRL_SET_EQUALIZER:
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
695 {
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
696 va_list ap;
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
697 int value;
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
698 vidix_video_eq_t info;
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
699
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
700 if(!video_on) return VO_FALSE;
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
701 va_start(ap, data);
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
702 value = va_arg(ap, int);
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
703 va_end(ap);
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
704
6806
994d3729b0d1 10l bug fixed (info.cap |= -> = )
arpi
parents: 6786
diff changeset
705 // printf("vidix seteq %s -> %d \n",data,value);
994d3729b0d1 10l bug fixed (info.cap |= -> = )
arpi
parents: 6786
diff changeset
706
6786
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
707 /* vidix eq ranges are -1000..1000 */
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
708 if (!strcasecmp(data, "brightness"))
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
709 {
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
710 info.brightness = value*10;
6806
994d3729b0d1 10l bug fixed (info.cap |= -> = )
arpi
parents: 6786
diff changeset
711 info.cap = VEQ_CAP_BRIGHTNESS;
6786
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
712 }
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
713 else if (!strcasecmp(data, "contrast"))
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
714 {
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
715 info.contrast = value*10;
6806
994d3729b0d1 10l bug fixed (info.cap |= -> = )
arpi
parents: 6786
diff changeset
716 info.cap = VEQ_CAP_CONTRAST;
6786
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
717 }
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
718 else if (!strcasecmp(data, "saturation"))
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
719 {
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
720 info.saturation = value*10;
6806
994d3729b0d1 10l bug fixed (info.cap |= -> = )
arpi
parents: 6786
diff changeset
721 info.cap = VEQ_CAP_SATURATION;
6786
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
722 }
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
723 else if (!strcasecmp(data, "hue"))
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
724 {
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
725 info.hue = value*10;
6806
994d3729b0d1 10l bug fixed (info.cap |= -> = )
arpi
parents: 6786
diff changeset
726 info.cap = VEQ_CAP_HUE;
6786
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
727 }
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
728
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
729 if (vdlPlaybackSetEq(vidix_handler, &info) == 0)
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
730 return VO_TRUE;
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
731 return VO_FALSE;
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
732 }
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
733 case VOCTRL_GET_EQUALIZER:
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
734 {
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
735 va_list ap;
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
736 int *value;
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
737 vidix_video_eq_t info;
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
738
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
739 if(!video_on) return VO_FALSE;
6806
994d3729b0d1 10l bug fixed (info.cap |= -> = )
arpi
parents: 6786
diff changeset
740 if (vdlPlaybackGetEq(vidix_handler, &info) != 0)
6786
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
741 return VO_FALSE;
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
742
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
743 va_start(ap, data);
6806
994d3729b0d1 10l bug fixed (info.cap |= -> = )
arpi
parents: 6786
diff changeset
744 value = va_arg(ap, int*);
6786
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
745 va_end(ap);
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
746
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
747 /* vidix eq ranges are -1000..1000 */
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
748 if (!strcasecmp(data, "brightness"))
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
749 {
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
750 if (info.cap & VEQ_CAP_BRIGHTNESS)
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
751 *value = info.brightness/10;
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
752 }
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
753 else if (!strcasecmp(data, "contrast"))
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
754 {
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
755 if (info.cap & VEQ_CAP_CONTRAST)
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
756 *value = info.contrast/10;
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
757 }
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
758 else if (!strcasecmp(data, "saturation"))
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
759 {
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
760 if (info.cap & VEQ_CAP_SATURATION)
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
761 *value = info.saturation/10;
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
762 }
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
763 else if (!strcasecmp(data, "hue"))
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
764 {
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
765 if (info.cap & VEQ_CAP_HUE)
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
766 *value = info.hue/10;
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
767 }
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
768
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
769 return VO_TRUE;
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
770 }
4592
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4540
diff changeset
771 }
6531
7bd342baa785 yvu9,if09,y8,y800 support and multifile fix
alex
parents: 6482
diff changeset
772 return VO_NOTIMPL;
5319
83e6e16e9670 fallback to server's control() - patch by KotH
arpi
parents: 5052
diff changeset
773 // WARNING: we drop extra parameters (...) here!
6531
7bd342baa785 yvu9,if09,y8,y800 support and multifile fix
alex
parents: 6482
diff changeset
774 // return server_control(request,data); //VO_NOTIMPL;
4592
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4540
diff changeset
775 }
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4540
diff changeset
776
4454
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
777 int vidix_preinit(const char *drvname,void *server)
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
778 {
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
779 int err;
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
780 if(verbose > 1) printf("vosub_vidix: vidix_preinit(%s) was called\n",drvname);
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
781 if(vdlGetVersion() != VIDIX_VERSION)
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
782 {
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
783 printf("vosub_vidix: You have wrong version of VIDIX library\n");
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
784 return -1;
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
785 }
5814
16186e365197 libdir changed
arpi
parents: 5607
diff changeset
786 vidix_handler = vdlOpen(LIBDIR"/mplayer/vidix/",
4454
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
787 drvname ? drvname[0] == ':' ? &drvname[1] : drvname[0] ? drvname : NULL : NULL,
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
788 TYPE_OUTPUT,
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
789 verbose);
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
790 if(vidix_handler == NULL)
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
791 {
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
792 printf("vosub_vidix: Couldn't find working VIDIX driver\n");
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
793 return -1;
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
794 }
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
795 if((err=vdlGetCapability(vidix_handler,&vidix_cap)) != 0)
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
796 {
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
797 printf("vosub_vidix: Couldn't get capability: %s\n",strerror(err));
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
798 return -1;
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
799 }
6786
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
800 printf("VIDIX: Description: %s\n", vidix_cap.name);
b16cb6cbff5a eq reworked
alex
parents: 6755
diff changeset
801 printf("VIDIX: Author: %s\n", vidix_cap.author);
4454
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
802 /* we are able to tune up this stuff depend on fourcc format */
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
803 ((vo_functions_t *)server)->draw_slice=vidix_draw_slice;
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
804 ((vo_functions_t *)server)->draw_frame=vidix_draw_frame;
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
805 ((vo_functions_t *)server)->flip_page=vidix_flip_page;
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
806 ((vo_functions_t *)server)->draw_osd=vidix_draw_osd;
6550
991e03ca5ceb added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents: 6531
diff changeset
807 // server_control = ((vo_functions_t *)server)->control;
991e03ca5ceb added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
alex
parents: 6531
diff changeset
808 // ((vo_functions_t *)server)->control=vidix_control;
4454
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
809 vo_server = server;
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
810 return 0;
c58106c9e2af Optimizing with use new tune info
nick
parents: 4442
diff changeset
811 }