summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-08-04 00:52:55 (UTC)
committer harlekin <harlekin>2002-08-04 00:52:55 (UTC)
commit549df674d7af9fe1347751e6a63d6ed8249d2503 (patch) (unidiff)
treeb7a2e9499eca9ca7d20655bc51bc645e1f501d27
parent0cecd08dba036f39e414e34a2b7c070008ee3884 (diff)
downloadopie-549df674d7af9fe1347751e6a63d6ed8249d2503.zip
opie-549df674d7af9fe1347751e6a63d6ed8249d2503.tar.gz
opie-549df674d7af9fe1347751e6a63d6ed8249d2503.tar.bz2
change due to xine 0.9.13 changes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/nullvideo.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/noncore/multimedia/opieplayer2/nullvideo.c b/noncore/multimedia/opieplayer2/nullvideo.c
index 5ee8d5d..79337c2 100644
--- a/noncore/multimedia/opieplayer2/nullvideo.c
+++ b/noncore/multimedia/opieplayer2/nullvideo.c
@@ -1,639 +1,643 @@
1 1
2/*#include <xine.h>*/ 2/*#include <xine.h>*/
3#include <stdlib.h> 3#include <stdlib.h>
4#include <stdio.h> 4#include <stdio.h>
5 5
6#include <math.h> 6#include <math.h>
7 7
8#include <xine/video_out.h> 8#include <xine/video_out.h>
9#include <xine/xine_internal.h> 9#include <xine/xine_internal.h>
10#include <xine/xineutils.h> 10#include <xine/xineutils.h>
11#include <xine/configfile.h> 11#include <xine/configfile.h>
12 12
13#include <pthread.h> 13#include <pthread.h>
14#include "alphablend.h" 14#include "alphablend.h"
15#include "yuv2rgb.h" 15#include "yuv2rgb.h"
16 16
17#define printf(x,...) 17#define printf(x,...)
18 18
19/* the caller for our event draw handler */ 19/* the caller for our event draw handler */
20typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame, 20typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame,
21 int width, int height,int bytes ); 21 int width, int height,int bytes );
22 22
23typedef struct null_driver_s null_driver_t; 23typedef struct null_driver_s null_driver_t;
24 24
25struct null_driver_s { 25struct null_driver_s {
26 vo_driver_t vo_driver; 26 vo_driver_t vo_driver;
27 uint32_t m_capabilities; 27 uint32_t m_capabilities;
28 int m_show_video; 28 int m_show_video;
29 int m_video_fullscreen; 29 int m_video_fullscreen;
30 int m_is_scaling; 30 int m_is_scaling;
31 int depth, bpp, bytes_per_pixel; 31 int depth, bpp, bytes_per_pixel;
32 int yuv2rgb_mode; 32 int yuv2rgb_mode;
33 int yuv2rgb_swap; 33 int yuv2rgb_swap;
34 int zuv2rgb_gamma; 34 int zuv2rgb_gamma;
35 uint8_t *yuv2rgb_cmap; 35 uint8_t *yuv2rgb_cmap;
36 yuv2rgb_factory_t *yuv2rgb_factory; 36 yuv2rgb_factory_t *yuv2rgb_factory;
37 vo_overlay_t *overlay; 37 vo_overlay_t *overlay;
38 int user_ratio; 38 int user_ratio;
39 double output_scale_factor; 39 double output_scale_factor;
40 int last_frame_output_width; 40 int last_frame_output_width;
41 int last_frame_output_height; 41 int last_frame_output_height;
42 int gui_width; 42 int gui_width;
43 int gui_height; 43 int gui_height;
44 int gui_changed; 44 int gui_changed;
45 double display_ratio; 45 double display_ratio;
46 void* caller; 46 void* caller;
47 display_xine_frame_t frameDis; 47 display_xine_frame_t frameDis;
48 48
49 49
50}; 50};
51typedef struct opie_frame_s opie_frame_t; 51typedef struct opie_frame_s opie_frame_t;
52struct opie_frame_s { 52struct opie_frame_s {
53 vo_frame_t frame; 53 vo_frame_t frame;
54 char* name; 54 char* name;
55 int version; 55 int version;
56 int width; 56 int width;
57 int height; 57 int height;
58 int ratio_code; 58 int ratio_code;
59 int format; 59 int format;
60 int flags; 60 int flags;
61 int user_ratio; 61 int user_ratio;
62 62
63 double ratio_factor; 63 double ratio_factor;
64 int ideal_width; 64 int ideal_width;
65 int ideal_height; 65 int ideal_height;
66 int output_width, output_height; 66 int output_width, output_height;
67 int gui_width, gui_height; 67 int gui_width, gui_height;
68 uint8_t *chunk[3]; 68 uint8_t *chunk[3];
69 69
70 yuv2rgb_t *yuv2rgb; 70 yuv2rgb_t *yuv2rgb;
71 uint8_t *rgb_dst; 71 uint8_t *rgb_dst;
72 int yuv_stride; 72 int yuv_stride;
73 int stripe_height, stripe_inc; 73 int stripe_height, stripe_inc;
74 74
75 int bytes_per_line; 75 int bytes_per_line;
76 uint8_t *data; 76 uint8_t *data;
77 77
78// int show_video; 78// int show_video;
79 null_driver_t *output; 79 null_driver_t *output;
80}; 80};
81 81
82static uint32_t null_get_capabilities(vo_driver_t *self ){ 82static uint32_t null_get_capabilities(vo_driver_t *self ){
83 null_driver_t* this = (null_driver_t*)self; 83 null_driver_t* this = (null_driver_t*)self;
84 printf("capabilities\n"); 84 printf("capabilities\n");
85 return this->m_capabilities; 85 return this->m_capabilities;
86} 86}
87 87
88static void null_frame_copy (vo_frame_t *vo_img, uint8_t **src) { 88static void null_frame_copy (vo_frame_t *vo_img, uint8_t **src) {
89 opie_frame_t *frame = (opie_frame_t *) vo_img ; 89 opie_frame_t *frame = (opie_frame_t *) vo_img ;
90 printf("frame copy\n"); 90 printf("frame copy\n");
91 if(!frame->output->m_show_video ){ printf("no video\n"); return; } // no video 91 if(!frame->output->m_show_video ){ printf("no video\n"); return; } // no video
92 92
93 if (frame->format == IMGFMT_YV12) { 93 if (frame->format == IMGFMT_YV12) {
94 frame->yuv2rgb->yuv2rgb_fun (frame->yuv2rgb, frame->rgb_dst, 94 frame->yuv2rgb->yuv2rgb_fun (frame->yuv2rgb, frame->rgb_dst,
95 src[0], src[1], src[2]); 95 src[0], src[1], src[2]);
96 } else { 96 } else {
97 97
98 frame->yuv2rgb->yuy22rgb_fun (frame->yuv2rgb, frame->rgb_dst, 98 frame->yuv2rgb->yuy22rgb_fun (frame->yuv2rgb, frame->rgb_dst,
99 src[0]); 99 src[0]);
100 } 100 }
101 101
102 frame->rgb_dst += frame->stripe_inc; 102 frame->rgb_dst += frame->stripe_inc;
103 printf("returning\n"); 103 printf("returning\n");
104} 104}
105 105
106static void null_frame_field (vo_frame_t *vo_img, int which_field) { 106static void null_frame_field (vo_frame_t *vo_img, int which_field) {
107 107
108 opie_frame_t *frame = (opie_frame_t *) vo_img ; 108 opie_frame_t *frame = (opie_frame_t *) vo_img ;
109 printf("field\n\n"); 109 printf("field\n\n");
110 110
111 switch (which_field) { 111 switch (which_field) {
112 case VO_TOP_FIELD: 112 case VO_TOP_FIELD:
113 frame->rgb_dst = (uint8_t *)frame->data; 113 frame->rgb_dst = (uint8_t *)frame->data;
114 frame->stripe_inc = 2*frame->stripe_height * frame->bytes_per_line; 114 frame->stripe_inc = 2*frame->stripe_height * frame->bytes_per_line;
115 break; 115 break;
116 case VO_BOTTOM_FIELD: 116 case VO_BOTTOM_FIELD:
117 frame->rgb_dst = (uint8_t *)frame->data + frame->bytes_per_line ; 117 frame->rgb_dst = (uint8_t *)frame->data + frame->bytes_per_line ;
118 frame->stripe_inc = 2*frame->stripe_height * frame->bytes_per_line; 118 frame->stripe_inc = 2*frame->stripe_height * frame->bytes_per_line;
119 break; 119 break;
120 case VO_BOTH_FIELDS: 120 case VO_BOTH_FIELDS:
121 frame->rgb_dst = (uint8_t *)frame->data; 121 frame->rgb_dst = (uint8_t *)frame->data;
122 break; 122 break;
123 } 123 }
124} 124}
125 125
126 126
127/* take care of the frame*/ 127/* take care of the frame*/
128static void null_frame_dispose( vo_frame_t* vo_img){ 128static void null_frame_dispose( vo_frame_t* vo_img){
129 opie_frame_t* frame = (opie_frame_t*)vo_img; 129 opie_frame_t* frame = (opie_frame_t*)vo_img;
130 printf("frame_dispose\n"); 130 printf("frame_dispose\n");
131 if( frame->data ) 131 if( frame->data )
132 free( frame->data ); 132 free( frame->data );
133 free (frame); 133 free (frame);
134} 134}
135 135
136/* end take care of frames*/ 136/* end take care of frames*/
137 137
138static vo_frame_t* null_alloc_frame( vo_driver_t* self ){ 138static vo_frame_t* null_alloc_frame( vo_driver_t* self ){
139 null_driver_t* this = (null_driver_t*)self; 139 null_driver_t* this = (null_driver_t*)self;
140 opie_frame_t* frame; 140 opie_frame_t* frame;
141 frame = (opie_frame_t*)malloc ( sizeof(opie_frame_t) ); 141 frame = (opie_frame_t*)malloc ( sizeof(opie_frame_t) );
142 142
143 memset( frame, 0, sizeof( opie_frame_t) ); 143 memset( frame, 0, sizeof( opie_frame_t) );
144 pthread_mutex_init (&frame->frame.mutex, NULL); 144 pthread_mutex_init (&frame->frame.mutex, NULL);
145 145
146 printf("alloc_frame\n"); 146 printf("alloc_frame\n");
147 frame->name = "opie\0"; 147 frame->name = "opie\0";
148 frame->version = 1; 148 frame->version = 1;
149 frame->output = this; 149 frame->output = this;
150// frame->show_video = this->m_show_video; 150// frame->show_video = this->m_show_video;
151 /* initialize the frame*/ 151 /* initialize the frame*/
152 frame->frame.driver = self; 152 frame->frame.driver = self;
153 /*frame.frame.free = null_frame_free;*/ 153 /*frame.frame.free = null_frame_free;*/
154 frame->frame.copy = null_frame_copy; 154 frame->frame.copy = null_frame_copy;
155 frame->frame.field = null_frame_field; 155 frame->frame.field = null_frame_field;
156 frame->frame.dispose = null_frame_dispose; 156 frame->frame.dispose = null_frame_dispose;
157 frame->yuv2rgb = 0; 157 frame->yuv2rgb = 0;
158 /* 158 /*
159 * colorspace converter for this frame 159 * colorspace converter for this frame
160 */ 160 */
161 frame->yuv2rgb = this->yuv2rgb_factory->create_converter (this->yuv2rgb_factory); 161 frame->yuv2rgb = this->yuv2rgb_factory->create_converter (this->yuv2rgb_factory);
162 162
163 163
164 return (vo_frame_t*) frame; 164 return (vo_frame_t*) frame;
165} 165}
166 166
167// size specific 167// size specific
168static void null_compute_ideal_size (null_driver_t *this, opie_frame_t *frame) { 168static void null_compute_ideal_size (null_driver_t *this, opie_frame_t *frame) {
169 169
170 if (!this->m_is_scaling /*|| !this->m_show_video*/) { 170 if (!this->m_is_scaling /*|| !this->m_show_video*/) {
171 printf("Not scaling\n"); 171 printf("Not scaling\n");
172 frame->ideal_width = frame->width; 172 frame->ideal_width = frame->width;
173 frame->ideal_height = frame->height; 173 frame->ideal_height = frame->height;
174 frame->ratio_factor = 1.0; 174 frame->ratio_factor = 1.0;
175 175
176 } else { 176 } else {
177 177
178 double image_ratio, desired_ratio, corr_factor; 178 double image_ratio, desired_ratio, corr_factor;
179 179
180 image_ratio = (double) frame->width / (double) frame->height; 180 image_ratio = (double) frame->width / (double) frame->height;
181 181
182 switch (frame->user_ratio) { 182 switch (frame->user_ratio) {
183 case ASPECT_AUTO: 183 case ASPECT_AUTO:
184 switch (frame->ratio_code) { 184 switch (frame->ratio_code) {
185 case XINE_ASPECT_RATIO_ANAMORPHIC: /* anamorphic */ 185 case XINE_ASPECT_RATIO_ANAMORPHIC: /* anamorphic */
186 case XINE_ASPECT_RATIO_PAN_SCAN:
186 desired_ratio = 16.0 /9.0; 187 desired_ratio = 16.0 /9.0;
187 break; 188 break;
188 case XINE_ASPECT_RATIO_211_1: /* 2.11:1 */ 189 case XINE_ASPECT_RATIO_211_1: /* 2.11:1 */
189 desired_ratio = 2.11/1.0; 190 desired_ratio = 2.11/1.0;
190 break; 191 break;
191 case XINE_ASPECT_RATIO_SQUARE: /* square pels */ 192 case XINE_ASPECT_RATIO_SQUARE: /* square pels */
192 case XINE_ASPECT_RATIO_DONT_TOUCH: /* probably non-mpeg stream => don't touch aspect ratio */ 193 case XINE_ASPECT_RATIO_DONT_TOUCH: /* probably non-mpeg stream => don't touch aspect ratio */
193 desired_ratio = image_ratio; 194 desired_ratio = image_ratio;
194 break; 195 break;
195 case 0: /* forbidden -> 4:3 */ 196 case 0: /* forbidden -> 4:3 */
196 printf ("video_out_fb: invalid ratio, using 4:3\n"); 197 printf ("video_out_fb: invalid ratio, using 4:3\n");
197 default: 198 default:
198 printf ("video_out_fb: unknown aspect ratio (%d) in stream => using 4:3\n", 199 printf ("video_out_fb: unknown aspect ratio (%d) in stream => using 4:3\n",
199 frame->ratio_code); 200 frame->ratio_code);
200 case XINE_ASPECT_RATIO_4_3: /* 4:3 */ 201 case XINE_ASPECT_RATIO_4_3: /* 4:3 */
201 desired_ratio = 4.0 / 3.0; 202 desired_ratio = 4.0 / 3.0;
202 break; 203 break;
203 } 204 }
204 break; 205 break;
205 case ASPECT_ANAMORPHIC: 206 case ASPECT_ANAMORPHIC:
206 desired_ratio = 16.0 / 9.0; 207 desired_ratio = 16.0 / 9.0;
207 break; 208 break;
208 case ASPECT_DVB: 209 case ASPECT_DVB:
209 desired_ratio = 2.0 / 1.0; 210 desired_ratio = 2.0 / 1.0;
210 break; 211 break;
211 case ASPECT_SQUARE: 212 case ASPECT_SQUARE:
212 desired_ratio = image_ratio; 213 desired_ratio = image_ratio;
213 break; 214 break;
214 case ASPECT_FULL: 215 case ASPECT_FULL:
215 default: 216 default:
216 desired_ratio = 4.0 / 3.0; 217 desired_ratio = 4.0 / 3.0;
217 } 218 }
218 219
219 frame->ratio_factor = this->display_ratio * desired_ratio; 220 frame->ratio_factor = this->display_ratio * desired_ratio;
220 221
221 corr_factor = frame->ratio_factor / image_ratio ; 222 corr_factor = frame->ratio_factor / image_ratio ;
222 223
223 if (fabs(corr_factor - 1.0) < 0.005) { 224 if (fabs(corr_factor - 1.0) < 0.005) {
224 frame->ideal_width = frame->width; 225 frame->ideal_width = frame->width;
225 frame->ideal_height = frame->height; 226 frame->ideal_height = frame->height;
226 227
227 } else { 228 } else {
228 229
229 if (corr_factor >= 1.0) { 230 if (corr_factor >= 1.0) {
230 frame->ideal_width = frame->width * corr_factor + 0.5; 231 frame->ideal_width = frame->width * corr_factor + 0.5;
231 frame->ideal_height = frame->height; 232 frame->ideal_height = frame->height;
232 } else { 233 } else {
233 frame->ideal_width = frame->width; 234 frame->ideal_width = frame->width;
234 frame->ideal_height = frame->height / corr_factor + 0.5; 235 frame->ideal_height = frame->height / corr_factor + 0.5;
235 } 236 }
236 237
237 } 238 }
238 } 239 }
239 printf("return from helper\n"); 240 printf("return from helper\n");
240} 241}
241 242
242static void null_compute_rgb_size (null_driver_t *this, opie_frame_t *frame) { 243static void null_compute_rgb_size (null_driver_t *this, opie_frame_t *frame) {
243 244
244 double x_factor, y_factor; 245 double x_factor, y_factor;
245 246
246 /* 247 /*
247 * make the frame fit into the given destination area 248 * make the frame fit into the given destination area
248 */ 249 */
249 250
250 x_factor = (double) this->gui_width / (double) frame->ideal_width; 251 x_factor = (double) this->gui_width / (double) frame->ideal_width;
251 y_factor = (double) this->gui_height / (double) frame->ideal_height; 252 y_factor = (double) this->gui_height / (double) frame->ideal_height;
252 253
253 if ( x_factor < y_factor ) { 254 if ( x_factor < y_factor ) {
254 frame->output_width = (double) frame->ideal_width * x_factor ; 255 frame->output_width = (double) frame->ideal_width * x_factor ;
255 frame->output_height = (double) frame->ideal_height * x_factor ; 256 frame->output_height = (double) frame->ideal_height * x_factor ;
256 } else { 257 } else {
257 frame->output_width = (double) frame->ideal_width * y_factor ; 258 frame->output_width = (double) frame->ideal_width * y_factor ;
258 frame->output_height = (double) frame->ideal_height * y_factor ; 259 frame->output_height = (double) frame->ideal_height * y_factor ;
259 } 260 }
260 261
261#define LOG 1 262#define LOG 1
262#ifdef LOG 263#ifdef LOG
263 printf("video_out_fb: frame source %d x %d => screen output %d x %d%s\n", 264 printf("video_out_fb: frame source %d x %d => screen output %d x %d%s\n",
264 frame->width, frame->height, 265 frame->width, frame->height,
265 frame->output_width, frame->output_height, 266 frame->output_width, frame->output_height,
266 ( frame->width != frame->output_width 267 ( frame->width != frame->output_width
267 || frame->height != frame->output_height 268 || frame->height != frame->output_height
268 ? ", software scaling" 269 ? ", software scaling"
269 : "" ) 270 : "" )
270 ); 271 );
271#endif 272#endif
272} 273}
273 274
274 275
275// size specific 276// size specific
276 277
277 278
278static void null_update_frame_format( vo_driver_t* self, vo_frame_t* img, 279static void null_update_frame_format( vo_driver_t* self, vo_frame_t* img,
279 uint32_t width, uint32_t height, 280 uint32_t width, uint32_t height,
280 int ratio_code, int format, int flags ){ 281 int ratio_code, int format, int flags ){
281 null_driver_t* this = (null_driver_t*) self; 282 null_driver_t* this = (null_driver_t*) self;
282 opie_frame_t* frame = (opie_frame_t*)img; 283 opie_frame_t* frame = (opie_frame_t*)img;
283 /* not needed now */ 284 /* not needed now */
284 printf("update_frame_format\n"); 285 printf("update_frame_format\n");
285 printf("al crash aye?\n"); 286 printf("al crash aye?\n");
286 287
287 flags &= VO_BOTH_FIELDS; 288 flags &= VO_BOTH_FIELDS;
288 289
289 /* find out if we need to adapt this frame */ 290 /* find out if we need to adapt this frame */
290 291
291 if ((width != frame->width) 292 if ((width != frame->width)
292 || (height != frame->height) 293 || (height != frame->height)
293 || (ratio_code != frame->ratio_code) 294 || (ratio_code != frame->ratio_code)
294 || (flags != frame->flags) 295 || (flags != frame->flags)
295 || (format != frame->format) 296 || (format != frame->format)
296 || (this->user_ratio != frame->user_ratio) 297 || (this->user_ratio != frame->user_ratio)
297 || (this->gui_width != frame-> gui_width ) 298 || (this->gui_width != frame-> gui_width )
298 || (this-> gui_height != frame-> gui_height)) { 299 || (this-> gui_height != frame-> gui_height)) {
299 300
300 frame->width = width; 301 frame->width = width;
301 frame->height = height; 302 frame->height = height;
302 frame->ratio_code = ratio_code; 303 frame->ratio_code = ratio_code;
303 frame->flags = flags; 304 frame->flags = flags;
304 frame->format = format; 305 frame->format = format;
305 frame->user_ratio = this->user_ratio; 306 frame->user_ratio = this->user_ratio;
306 this->gui_changed = 0; 307 this->gui_changed = 0;
307 //frame->show_video = this->m_show_video; 308 //frame->show_video = this->m_show_video;
308 frame->gui_width = this->gui_width; 309 frame->gui_width = this->gui_width;
309 frame->gui_height = this->gui_height; 310 frame->gui_height = this->gui_height;
310 311
311 null_compute_ideal_size (this, frame); 312 null_compute_ideal_size (this, frame);
312 null_compute_rgb_size (this, frame); 313 null_compute_rgb_size (this, frame);
313 314
314 /* 315 /*
315 * (re-) allocate 316 * (re-) allocate
316 */ 317 */
317 if( frame->data ) { 318 if( frame->data ) {
318 if(frame->chunk[0] ){ 319 if(frame->chunk[0] ){
319 free( frame->chunk[0] ); 320 free( frame->chunk[0] );
320 frame->chunk[0] = NULL; 321 frame->chunk[0] = NULL;
321 } 322 }
322 if(frame->chunk[1] ){ 323 if(frame->chunk[1] ){
323 free ( frame->chunk[1] ); 324 free ( frame->chunk[1] );
324 frame->chunk[1] = NULL; 325 frame->chunk[1] = NULL;
325 } 326 }
326 if(frame->chunk[2] ){ 327 if(frame->chunk[2] ){
327 free ( frame->chunk[2] ); 328 free ( frame->chunk[2] );
328 frame->chunk[2] = NULL; 329 frame->chunk[2] = NULL;
329 } 330 }
330 free ( frame->data ); 331 free ( frame->data );
331 } 332 }
332 printf("after freeing\n"); 333 printf("after freeing\n");
333 frame->data = xine_xmalloc (frame->output_width * frame->output_height * 334 frame->data = xine_xmalloc (frame->output_width * frame->output_height *
334 this->bytes_per_pixel ); 335 this->bytes_per_pixel );
335 336
336 if( format == IMGFMT_YV12 ) { 337 if( format == IMGFMT_YV12 ) {
337 int image_size = width * height; /* cast ouch*/ 338 frame->frame.pitches[0] = 8*((width + 7) / 8);
338 frame->frame.base[0] = xine_xmalloc_aligned(16, image_size, 339 frame->frame.pitches[1] = 8*((width + 15) / 16);
339 (void **)&frame->chunk[0] ); 340 frame->frame.pitches[2] = 8*((width + 15) / 16);
340 frame->frame.base[1] = xine_xmalloc_aligned(16, image_size, 341 frame->frame.base[0] = xine_xmalloc_aligned (16, frame->frame.pitches[0] * height,(void **)&frame->chunk[0]);
341 (void **)&frame->chunk[1] ); 342 frame->frame.base[1] = xine_xmalloc_aligned (16, frame->frame.pitches[1] * ((height+ 1)/2), (void **)&frame->chunk[1]);
342 frame->frame.base[2] = xine_xmalloc_aligned(16, image_size, 343 frame->frame.base[2] = xine_xmalloc_aligned (16, frame->frame.pitches[2] * ((height+ 1)/2), (void **)&frame->chunk[2]);
343 (void **)&frame->chunk[2] ); 344
344 }else{ 345 }else{
345 int image_size = width * height; /* cast ouch*/ 346 frame->frame.pitches[0] = 8*((width + 3) / 4);
346 frame->frame.base[0] = xine_xmalloc_aligned(16, image_size, 347 frame->frame.pitches[1] = 8*((width + 3) / 4);
347 (void **)&frame->chunk[0] ); 348 frame->frame.pitches[2] = 8*((width + 3) / 4);
349
350 frame->frame.base[0] = xine_xmalloc_aligned (16, frame->frame.pitches[0] * height,
351 (void **)&frame->chunk[0]);
348 frame->chunk[1] = NULL; 352 frame->chunk[1] = NULL;
349 frame->chunk[2] = NULL; 353 frame->chunk[2] = NULL;
350 } 354 }
351 355
352 frame->format = format; 356 frame->format = format;
353 frame->width = width; 357 frame->width = width;
354 frame->height = height; 358 frame->height = height;
355 359
356 frame->stripe_height = 16 * frame->output_height / frame->height; 360 frame->stripe_height = 16 * frame->output_height / frame->height;
357 frame->bytes_per_line = frame->output_width * this->bytes_per_pixel; 361 frame->bytes_per_line = frame->output_width * this->bytes_per_pixel;
358 362
359 /* 363 /*
360 * set up colorspace converter 364 * set up colorspace converter
361 */ 365 */
362 if(1 /*this->m_show_video*/ ){ 366 if(1 /*this->m_show_video*/ ){
363 printf("showing video\n"); 367 printf("showing video\n");
364 368
365 switch (flags) { 369 switch (flags) {
366 case VO_TOP_FIELD: 370 case VO_TOP_FIELD:
367 case VO_BOTTOM_FIELD: 371 case VO_BOTTOM_FIELD:
368 frame->yuv2rgb->configure (frame->yuv2rgb, 372 frame->yuv2rgb->configure (frame->yuv2rgb,
369 frame->width, 373 frame->width,
370 16, 374 16,
371 frame->width*2, 375 2*frame->frame.pitches[0],
372 frame->width, 376 2*frame->frame.pitches[1],
373 frame->output_width, 377 frame->output_width,
374 frame->stripe_height, 378 frame->stripe_height,
375 frame->bytes_per_line*2); 379 frame->bytes_per_line*2);
376 frame->yuv_stride = frame->bytes_per_line*2; 380 frame->yuv_stride = frame->bytes_per_line*2;
377 break; 381 break;
378 case VO_BOTH_FIELDS: 382 case VO_BOTH_FIELDS:
379 frame->yuv2rgb->configure (frame->yuv2rgb, 383 frame->yuv2rgb->configure (frame->yuv2rgb,
380 frame->width, 384 frame->width,
381 16, 385 16,
382 frame->width, 386 frame->frame.pitches[0],
383 frame->width/2, 387 frame->frame.pitches[1],
384 frame->output_width, 388 frame->output_width,
385 frame->stripe_height, 389 frame->stripe_height,
386 frame->bytes_per_line); 390 frame->bytes_per_line);
387 frame->yuv_stride = frame->bytes_per_line; 391 frame->yuv_stride = frame->bytes_per_line;
388 break; 392 break;
389 } 393 }
390 } 394 }
391 } 395 }
392 printf("after gui changed\n"); 396 printf("after gui changed\n");
393 /* 397 /*
394 * reset dest pointers 398 * reset dest pointers
395 */ 399 */
396 400
397 if (frame->data) { 401 if (frame->data) {
398 switch (flags) { 402 switch (flags) {
399 case VO_TOP_FIELD: 403 case VO_TOP_FIELD:
400 frame->rgb_dst = (uint8_t *)frame->data; 404 frame->rgb_dst = (uint8_t *)frame->data;
401 frame->stripe_inc = 2 * frame->stripe_height * frame->bytes_per_line; 405 frame->stripe_inc = 2 * frame->stripe_height * frame->bytes_per_line;
402 break; 406 break;
403 case VO_BOTTOM_FIELD: 407 case VO_BOTTOM_FIELD:
404 frame->rgb_dst = (uint8_t *)frame->data + frame->bytes_per_line ; 408 frame->rgb_dst = (uint8_t *)frame->data + frame->bytes_per_line ;
405 frame->stripe_inc = 2 * frame->stripe_height * frame->bytes_per_line; 409 frame->stripe_inc = 2 * frame->stripe_height * frame->bytes_per_line;
406 break; 410 break;
407 case VO_BOTH_FIELDS: 411 case VO_BOTH_FIELDS:
408 frame->rgb_dst = (uint8_t *)frame->data; 412 frame->rgb_dst = (uint8_t *)frame->data;
409 frame->stripe_inc = frame->stripe_height * frame->bytes_per_line; 413 frame->stripe_inc = frame->stripe_height * frame->bytes_per_line;
410 break; 414 break;
411 } 415 }
412 } 416 }
413 printf("done\n"); 417 printf("done\n");
414} 418}
415static void null_display_frame( vo_driver_t* self, vo_frame_t *frame_gen ){ 419static void null_display_frame( vo_driver_t* self, vo_frame_t *frame_gen ){
416 null_driver_t* this = (null_driver_t*) self; 420 null_driver_t* this = (null_driver_t*) self;
417 opie_frame_t* frame = (opie_frame_t*)frame_gen; 421 opie_frame_t* frame = (opie_frame_t*)frame_gen;
418 display_xine_frame_t display = this->frameDis; 422 display_xine_frame_t display = this->frameDis;
419 423
420 printf("display frame\n"); 424 printf("display frame\n");
421 // if( this->m_show_video ) { // return if not displaying 425 // if( this->m_show_video ) { // return if not displaying
422 printf("calling home aye\n" ); 426 printf("calling home aye\n" );
423 if( display != NULL ) { 427 if( display != NULL ) {
424 (*display)(this->caller, frame->data, 428 (*display)(this->caller, frame->data,
425 frame->output_width, frame->output_height, 429 frame->output_width, frame->output_height,
426 frame->bytes_per_line ); 430 frame->bytes_per_line );
427 printf("display done hope you enyoyed the frame"); 431 printf("display done hope you enyoyed the frame");
428 } 432 }
429// } 433// }
430 434
431 frame->frame.displayed (&frame->frame); 435 frame->frame.displayed (&frame->frame);
432} 436}
433 437
434 438
435// blending related 439// blending related
436 440
437 441
438static void null_overlay_clut_yuv2rgb(null_driver_t *this, vo_overlay_t *overlay, 442static void null_overlay_clut_yuv2rgb(null_driver_t *this, vo_overlay_t *overlay,
439 opie_frame_t *frame) { 443 opie_frame_t *frame) {
440 int i; 444 int i;
441 clut_t* clut = (clut_t*) overlay->color; 445 clut_t* clut = (clut_t*) overlay->color;
442 if (!overlay->rgb_clut) { 446 if (!overlay->rgb_clut) {
443 for (i = 0; i < sizeof(overlay->color)/sizeof(overlay->color[0]); i++) { 447 for (i = 0; i < sizeof(overlay->color)/sizeof(overlay->color[0]); i++) {
444 *((uint32_t *)&clut[i]) = 448 *((uint32_t *)&clut[i]) =
445 frame->yuv2rgb->yuv2rgb_single_pixel_fun (frame->yuv2rgb, 449 frame->yuv2rgb->yuv2rgb_single_pixel_fun (frame->yuv2rgb,
446 clut[i].y, clut[i].cb, clut[i].cr); 450 clut[i].y, clut[i].cb, clut[i].cr);
447 } 451 }
448 overlay->rgb_clut++; 452 overlay->rgb_clut++;
449 } 453 }
450 if (!overlay->clip_rgb_clut) { 454 if (!overlay->clip_rgb_clut) {
451 clut = (clut_t*) overlay->clip_color; 455 clut = (clut_t*) overlay->clip_color;
452 for (i = 0; i < sizeof(overlay->color)/sizeof(overlay->color[0]); i++) { 456 for (i = 0; i < sizeof(overlay->color)/sizeof(overlay->color[0]); i++) {
453 *((uint32_t *)&clut[i]) = 457 *((uint32_t *)&clut[i]) =
454 frame->yuv2rgb->yuv2rgb_single_pixel_fun(frame->yuv2rgb, 458 frame->yuv2rgb->yuv2rgb_single_pixel_fun(frame->yuv2rgb,
455 clut[i].y, clut[i].cb, clut[i].cr); 459 clut[i].y, clut[i].cb, clut[i].cr);
456 } 460 }
457 overlay->clip_rgb_clut++; 461 overlay->clip_rgb_clut++;
458 } 462 }
459} 463}
460 464
461static void null_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay) { 465static void null_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay) {
462 null_driver_t *this = (null_driver_t *) this_gen; 466 null_driver_t *this = (null_driver_t *) this_gen;
463 opie_frame_t *frame = (opie_frame_t *) frame_gen; 467 opie_frame_t *frame = (opie_frame_t *) frame_gen;
464 468
465 printf("overlay blend\n"); 469 printf("overlay blend\n");
466 if(!this->m_show_video || frame->output_width == 0 || frame->output_height== 0) 470 if(!this->m_show_video || frame->output_width == 0 || frame->output_height== 0)
467 return; 471 return;
468 472
469 /* Alpha Blend here */ 473 /* Alpha Blend here */
470 if (overlay->rle) { 474 if (overlay->rle) {
471 if( !overlay->rgb_clut || !overlay->clip_rgb_clut) 475 if( !overlay->rgb_clut || !overlay->clip_rgb_clut)
472 null_overlay_clut_yuv2rgb(this,overlay,frame); 476 null_overlay_clut_yuv2rgb(this,overlay,frame);
473 477
474 switch(this->bpp) { 478 switch(this->bpp) {
475 case 16: 479 case 16:
476 blend_rgb16( (uint8_t *)frame->data, overlay, 480 blend_rgb16( (uint8_t *)frame->data, overlay,
477 frame->output_width, frame->output_height, 481 frame->output_width, frame->output_height,
478 frame->width, frame->height); 482 frame->width, frame->height);
479 break; 483 break;
480 case 24: 484 case 24:
481 blend_rgb24( (uint8_t *)frame->data, overlay, 485 blend_rgb24( (uint8_t *)frame->data, overlay,
482 frame->output_width, frame->output_height, 486 frame->output_width, frame->output_height,
483 frame->width, frame->height); 487 frame->width, frame->height);
484 break; 488 break;
485 case 32: 489 case 32:
486 blend_rgb32( (uint8_t *)frame->data, overlay, 490 blend_rgb32( (uint8_t *)frame->data, overlay,
487 frame->output_width, frame->output_height, 491 frame->output_width, frame->output_height,
488 frame->width, frame->height); 492 frame->width, frame->height);
489 break; 493 break;
490 default: 494 default:
491 /* It should never get here */ 495 /* It should never get here */
492 break; 496 break;
493 } 497 }
494 } 498 }
495} 499}
496 500
497 501
498static int null_get_property( vo_driver_t* self, 502static int null_get_property( vo_driver_t* self,
499 int property ){ 503 int property ){
500 printf("property get\n"); 504 printf("property get\n");
501 return 0; 505 return 0;
502} 506}
503static int null_set_property( vo_driver_t* self, 507static int null_set_property( vo_driver_t* self,
504 int property, 508 int property,
505 int value ){ 509 int value ){
506 printf("set property\n"); 510 printf("set property\n");
507 return value; 511 return value;
508} 512}
509static void null_get_property_min_max( vo_driver_t* self, 513static void null_get_property_min_max( vo_driver_t* self,
510 int property, int *min, 514 int property, int *min,
511 int *max ){ 515 int *max ){
512 printf("min max\n"); 516 printf("min max\n");
513 *max = 0; 517 *max = 0;
514 *min = 0; 518 *min = 0;
515} 519}
516static int null_gui_data_exchange( vo_driver_t* self, 520static int null_gui_data_exchange( vo_driver_t* self,
517 int data_type, 521 int data_type,
518 void *data ){ 522 void *data ){
519 return 0; 523 return 0;
520} 524}
521static void null_exit( vo_driver_t* self ){ 525static void null_exit( vo_driver_t* self ){
522 null_driver_t* this = (null_driver_t*)self; 526 null_driver_t* this = (null_driver_t*)self;
523 free ( this ); 527 free ( this );
524} 528}
525static int null_redraw_needed( vo_driver_t* self ){ 529static int null_redraw_needed( vo_driver_t* self ){
526 return 0; 530 return 0;
527} 531}
528 532
529 533
530vo_driver_t* init_video_out_plugin( config_values_t* conf, 534vo_driver_t* init_video_out_plugin( config_values_t* conf,
531 void* video ){ 535 void* video ){
532 null_driver_t *vo; 536 null_driver_t *vo;
533 vo = (null_driver_t*)malloc( sizeof(null_driver_t ) ); 537 vo = (null_driver_t*)malloc( sizeof(null_driver_t ) );
534 538
535 /* memset? */ 539 /* memset? */
536 memset(vo,0, sizeof(null_driver_t ) ); 540 memset(vo,0, sizeof(null_driver_t ) );
537 vo->m_show_video = 0; // false 541 vo->m_show_video = 0; // false
538 vo->m_video_fullscreen = 0; 542 vo->m_video_fullscreen = 0;
539 vo->m_is_scaling = 0; 543 vo->m_is_scaling = 0;
540 vo->user_ratio = ASPECT_AUTO; 544 vo->user_ratio = ASPECT_AUTO;
541 vo->display_ratio = 1.0; 545 vo->display_ratio = 1.0;
542 vo->gui_width = 16; 546 vo->gui_width = 16;
543 vo->gui_height = 8; 547 vo->gui_height = 8;
544 vo->frameDis = NULL; 548 vo->frameDis = NULL;
545 549
546 /* install callback handlers*/ 550 /* install callback handlers*/
547 vo->vo_driver.get_capabilities = null_get_capabilities; 551 vo->vo_driver.get_capabilities = null_get_capabilities;
548 vo->vo_driver.alloc_frame = null_alloc_frame; 552 vo->vo_driver.alloc_frame = null_alloc_frame;
549 vo->vo_driver.update_frame_format = null_update_frame_format; 553 vo->vo_driver.update_frame_format = null_update_frame_format;
550 vo->vo_driver.display_frame = null_display_frame; 554 vo->vo_driver.display_frame = null_display_frame;
551 vo->vo_driver.overlay_blend = null_overlay_blend; 555 vo->vo_driver.overlay_blend = null_overlay_blend;
552 vo->vo_driver.get_property = null_get_property; 556 vo->vo_driver.get_property = null_get_property;
553 vo->vo_driver.set_property = null_set_property; 557 vo->vo_driver.set_property = null_set_property;
554 vo->vo_driver.get_property_min_max = null_get_property_min_max; 558 vo->vo_driver.get_property_min_max = null_get_property_min_max;
555 vo->vo_driver.gui_data_exchange = null_gui_data_exchange; 559 vo->vo_driver.gui_data_exchange = null_gui_data_exchange;
556 vo->vo_driver.exit = null_exit; 560 vo->vo_driver.exit = null_exit;
557 vo->vo_driver.redraw_needed = null_redraw_needed; 561 vo->vo_driver.redraw_needed = null_redraw_needed;
558 562
559 563
560 /* capabilities */ 564 /* capabilities */
561 vo->m_capabilities = VO_CAP_COPIES_IMAGE | VO_CAP_YUY2 | VO_CAP_YV12; 565 vo->m_capabilities = VO_CAP_COPIES_IMAGE | VO_CAP_YUY2 | VO_CAP_YV12;
562 vo->yuv2rgb_factory = yuv2rgb_factory_init (MODE_16_RGB, vo->yuv2rgb_swap, 566 vo->yuv2rgb_factory = yuv2rgb_factory_init (MODE_16_RGB, vo->yuv2rgb_swap,
563 vo->yuv2rgb_cmap); 567 vo->yuv2rgb_cmap);
564 printf("done initialisation\n"); 568 printf("done initialisation\n");
565 return (vo_driver_t*) vo; 569 return (vo_driver_t*) vo;
566} 570}
567 571
568static vo_info_t vo_info_null = { 572static vo_info_t vo_info_null = {
569 5, 573 5,
570 "null plugin", 574 "null plugin",
571 NULL, 575 NULL,
572 VISUAL_TYPE_FB, 576 VISUAL_TYPE_FB,
573 5 577 5
574}; 578};
575 579
576vo_info_t *get_video_out_plugin_info(){ 580vo_info_t *get_video_out_plugin_info(){
577 vo_info_null.description = _("xine video output plugin using null device"); 581 vo_info_null.description = _("xine video output plugin using null device");
578 return &vo_info_null; 582 return &vo_info_null;
579} 583}
580 584
581/* this is special for this device */ 585/* this is special for this device */
582/** 586/**
583 * We know that we will be controled by the XINE LIB++ 587 * We know that we will be controled by the XINE LIB++
584 */ 588 */
585 589
586/** 590/**
587 * 591 *
588 */ 592 */
589int null_is_showing_video( vo_driver_t* self ){ 593int null_is_showing_video( vo_driver_t* self ){
590 null_driver_t* this = (null_driver_t*)self; 594 null_driver_t* this = (null_driver_t*)self;
591 return this->m_show_video; 595 return this->m_show_video;
592} 596}
593void null_set_show_video( vo_driver_t* self, int show ) { 597void null_set_show_video( vo_driver_t* self, int show ) {
594 ((null_driver_t*)self)->m_show_video = show; 598 ((null_driver_t*)self)->m_show_video = show;
595} 599}
596 600
597int null_is_fullscreen( vo_driver_t* self ){ 601int null_is_fullscreen( vo_driver_t* self ){
598 return ((null_driver_t*)self)->m_video_fullscreen; 602 return ((null_driver_t*)self)->m_video_fullscreen;
599} 603}
600void null_set_fullscreen( vo_driver_t* self, int screen ){ 604void null_set_fullscreen( vo_driver_t* self, int screen ){
601 ((null_driver_t*)self)->m_video_fullscreen = screen; 605 ((null_driver_t*)self)->m_video_fullscreen = screen;
602} 606}
603int null_is_scaling( vo_driver_t* self ){ 607int null_is_scaling( vo_driver_t* self ){
604 return ((null_driver_t*)self)->m_is_scaling; 608 return ((null_driver_t*)self)->m_is_scaling;
605} 609}
606void null_set_scaling( vo_driver_t* self, int scale ){ 610void null_set_scaling( vo_driver_t* self, int scale ){
607 ((null_driver_t*)self)->m_is_scaling = scale; 611 ((null_driver_t*)self)->m_is_scaling = scale;
608} 612}
609 613
610void null_set_gui_width( vo_driver_t* self, int width ){ 614void null_set_gui_width( vo_driver_t* self, int width ){
611 ((null_driver_t*)self)->gui_width = width; 615 ((null_driver_t*)self)->gui_width = width;
612} 616}
613void null_set_gui_height( vo_driver_t* self, int height ){ 617void null_set_gui_height( vo_driver_t* self, int height ){
614 ((null_driver_t*)self)->gui_height = height; 618 ((null_driver_t*)self)->gui_height = height;
615} 619}
616void null_set_mode( vo_driver_t* self, int depth, int rgb ){ 620void null_set_mode( vo_driver_t* self, int depth, int rgb ){
617 null_driver_t* this = (null_driver_t*)self; 621 null_driver_t* this = (null_driver_t*)self;
618 622
619 this->bytes_per_pixel = (depth + 7 ) / 8; 623 this->bytes_per_pixel = (depth + 7 ) / 8;
620 this->bpp = this->bytes_per_pixel * 8; 624 this->bpp = this->bytes_per_pixel * 8;
621 this->depth = depth; 625 this->depth = depth;
622 printf("depth %d %d\n", depth, this->bpp); 626 printf("depth %d %d\n", depth, this->bpp);
623 printf("pixeltype %d\n", rgb ); 627 printf("pixeltype %d\n", rgb );
624 switch ( this->depth ){ 628 switch ( this->depth ){
625 case 32: 629 case 32:
626 if( rgb == 0 ) 630 if( rgb == 0 )
627 this->yuv2rgb_mode = MODE_32_RGB; 631 this->yuv2rgb_mode = MODE_32_RGB;
628 else 632 else
629 this->yuv2rgb_mode = MODE_32_BGR; 633 this->yuv2rgb_mode = MODE_32_BGR;
630 case 24: 634 case 24:
631 if( this->bpp == 32 ) { 635 if( this->bpp == 32 ) {
632 if(rgb == 0 ) 636 if(rgb == 0 )
633 this->yuv2rgb_mode = MODE_32_RGB; 637 this->yuv2rgb_mode = MODE_32_RGB;
634 else 638 else
635 this->yuv2rgb_mode = MODE_32_BGR; 639 this->yuv2rgb_mode = MODE_32_BGR;
636 }else{ 640 }else{
637 if( rgb == 0 ) 641 if( rgb == 0 )
638 this->yuv2rgb_mode = MODE_24_RGB; 642 this->yuv2rgb_mode = MODE_24_RGB;
639 else 643 else