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