Diffstat (limited to 'noncore/multimedia/opieplayer2/nullvideo.c') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/nullvideo.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/noncore/multimedia/opieplayer2/nullvideo.c b/noncore/multimedia/opieplayer2/nullvideo.c index f356e76..63d5752 100644 --- a/noncore/multimedia/opieplayer2/nullvideo.c +++ b/noncore/multimedia/opieplayer2/nullvideo.c | |||
@@ -59,55 +59,54 @@ struct opie_frame_s { | |||
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 | ||
79 | static uint32_t null_get_capabilities(vo_driver_t *self ){ | 79 | static 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 | ||
85 | static void null_frame_copy (vo_frame_t *vo_img, uint8_t **src) { | 85 | static 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->output->m_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 | |||
98 | } | 97 | } |
99 | 98 | ||
100 | frame->rgb_dst += frame->stripe_inc; | 99 | frame->rgb_dst += frame->stripe_inc; |
101 | printf("returning\n"); | 100 | printf("returning\n"); |
102 | } | 101 | } |
103 | 102 | ||
104 | static void null_frame_field (vo_frame_t *vo_img, int which_field) { | 103 | static void null_frame_field (vo_frame_t *vo_img, int which_field) { |
105 | 104 | ||
106 | opie_frame_t *frame = (opie_frame_t *) vo_img ; | 105 | opie_frame_t *frame = (opie_frame_t *) vo_img ; |
107 | printf("field\n\n"); | 106 | printf("field\n\n"); |
108 | 107 | ||
109 | switch (which_field) { | 108 | switch (which_field) { |
110 | case VO_TOP_FIELD: | 109 | case VO_TOP_FIELD: |
111 | frame->rgb_dst = (uint8_t *)frame->data; | 110 | frame->rgb_dst = (uint8_t *)frame->data; |
112 | frame->stripe_inc = 2*frame->stripe_height * frame->bytes_per_line; | 111 | frame->stripe_inc = 2*frame->stripe_height * frame->bytes_per_line; |
113 | break; | 112 | break; |
@@ -132,53 +131,53 @@ static void null_frame_dispose( vo_frame_t* vo_img){ | |||
132 | } | 131 | } |
133 | 132 | ||
134 | /* end take care of frames*/ | 133 | /* end take care of frames*/ |
135 | 134 | ||
136 | static vo_frame_t* null_alloc_frame( vo_driver_t* self ){ | 135 | static vo_frame_t* null_alloc_frame( vo_driver_t* self ){ |
137 | null_driver_t* this = (null_driver_t*)self; | 136 | null_driver_t* this = (null_driver_t*)self; |
138 | opie_frame_t* frame; | 137 | opie_frame_t* frame; |
139 | frame = (opie_frame_t*)malloc ( sizeof(opie_frame_t) ); | 138 | frame = (opie_frame_t*)malloc ( sizeof(opie_frame_t) ); |
140 | 139 | ||
141 | memset( frame, 0, sizeof( opie_frame_t) ); | 140 | memset( frame, 0, sizeof( opie_frame_t) ); |
142 | pthread_mutex_init (&frame->frame.mutex, NULL); | 141 | pthread_mutex_init (&frame->frame.mutex, NULL); |
143 | 142 | ||
144 | printf("alloc_frame\n"); | 143 | printf("alloc_frame\n"); |
145 | frame->name = "opie\0"; | 144 | frame->name = "opie\0"; |
146 | frame->version = 1; | 145 | frame->version = 1; |
147 | frame->output = this; | 146 | frame->output = this; |
148 | frame->show_video = this->m_show_video; | 147 | // frame->show_video = this->m_show_video; |
149 | /* initialize the frame*/ | 148 | /* initialize the frame*/ |
150 | frame->frame.driver = self; | 149 | frame->frame.driver = self; |
151 | /*frame.frame.free = null_frame_free;*/ | 150 | /*frame.frame.free = null_frame_free;*/ |
152 | frame->frame.copy = null_frame_copy; | 151 | frame->frame.copy = null_frame_copy; |
153 | frame->frame.field = null_frame_field; | 152 | frame->frame.field = null_frame_field; |
154 | frame->frame.dispose = null_frame_dispose; | 153 | frame->frame.dispose = null_frame_dispose; |
155 | frame->yuv2rgb = 0; | 154 | frame->yuv2rgb = 0; |
156 | /* | 155 | /* |
157 | * colorspace converter for this frame | 156 | * colorspace converter for this frame |
158 | */ | 157 | */ |
159 | frame->yuv2rgb = this->yuv2rgb_factory->create_converter (this->yuv2rgb_factory); | 158 | frame->yuv2rgb = this->yuv2rgb_factory->create_converter (this->yuv2rgb_factory); |
160 | 159 | ||
161 | 160 | ||
162 | return (vo_frame_t*) frame; | 161 | return (vo_frame_t*) frame; |
163 | } | 162 | } |
164 | 163 | ||
165 | // size specific | 164 | // size specific |
166 | static void null_compute_ideal_size (null_driver_t *this, opie_frame_t *frame) { | 165 | static void null_compute_ideal_size (null_driver_t *this, opie_frame_t *frame) { |
167 | 166 | ||
168 | if (!this->m_is_scaling || !this->m_show_video) { | 167 | if (!this->m_is_scaling /*|| !this->m_show_video*/) { |
169 | printf("Not scaling\n"); | 168 | printf("Not scaling\n"); |
170 | frame->ideal_width = frame->width; | 169 | frame->ideal_width = frame->width; |
171 | frame->ideal_height = frame->height; | 170 | frame->ideal_height = frame->height; |
172 | frame->ratio_factor = 1.0; | 171 | frame->ratio_factor = 1.0; |
173 | 172 | ||
174 | } else { | 173 | } else { |
175 | 174 | ||
176 | double image_ratio, desired_ratio, corr_factor; | 175 | double image_ratio, desired_ratio, corr_factor; |
177 | 176 | ||
178 | image_ratio = (double) frame->width / (double) frame->height; | 177 | image_ratio = (double) frame->width / (double) frame->height; |
179 | 178 | ||
180 | switch (frame->user_ratio) { | 179 | switch (frame->user_ratio) { |
181 | case ASPECT_AUTO: | 180 | case ASPECT_AUTO: |
182 | switch (frame->ratio_code) { | 181 | switch (frame->ratio_code) { |
183 | case XINE_ASPECT_RATIO_ANAMORPHIC: /* anamorphic */ | 182 | case XINE_ASPECT_RATIO_ANAMORPHIC: /* anamorphic */ |
184 | desired_ratio = 16.0 /9.0; | 183 | desired_ratio = 16.0 /9.0; |
@@ -288,33 +287,33 @@ static void null_update_frame_format( vo_driver_t* self, vo_frame_t* img, | |||
288 | 287 | ||
289 | if ((width != frame->width) | 288 | if ((width != frame->width) |
290 | || (height != frame->height) | 289 | || (height != frame->height) |
291 | || (ratio_code != frame->ratio_code) | 290 | || (ratio_code != frame->ratio_code) |
292 | || (flags != frame->flags) | 291 | || (flags != frame->flags) |
293 | || (format != frame->format) | 292 | || (format != frame->format) |
294 | || (this->user_ratio != frame->user_ratio) | 293 | || (this->user_ratio != frame->user_ratio) |
295 | || this->gui_changed ) { | 294 | || this->gui_changed ) { |
296 | 295 | ||
297 | frame->width = width; | 296 | frame->width = width; |
298 | frame->height = height; | 297 | frame->height = height; |
299 | frame->ratio_code = ratio_code; | 298 | frame->ratio_code = ratio_code; |
300 | frame->flags = flags; | 299 | frame->flags = flags; |
301 | frame->format = format; | 300 | frame->format = format; |
302 | frame->user_ratio = this->user_ratio; | 301 | frame->user_ratio = this->user_ratio; |
303 | this->gui_changed = 0; | 302 | this->gui_changed = 0; |
304 | frame->show_video = this->m_show_video; | 303 | //frame->show_video = this->m_show_video; |
305 | 304 | ||
306 | 305 | ||
307 | null_compute_ideal_size (this, frame); | 306 | null_compute_ideal_size (this, frame); |
308 | null_compute_rgb_size (this, frame); | 307 | null_compute_rgb_size (this, frame); |
309 | 308 | ||
310 | /* | 309 | /* |
311 | * (re-) allocate | 310 | * (re-) allocate |
312 | */ | 311 | */ |
313 | if( frame->data ) { | 312 | if( frame->data ) { |
314 | if(frame->chunk[0] ){ | 313 | if(frame->chunk[0] ){ |
315 | free( frame->chunk[0] ); | 314 | free( frame->chunk[0] ); |
316 | frame->chunk[0] = NULL; | 315 | frame->chunk[0] = NULL; |
317 | } | 316 | } |
318 | if(frame->chunk[1] ){ | 317 | if(frame->chunk[1] ){ |
319 | free ( frame->chunk[1] ); | 318 | free ( frame->chunk[1] ); |
320 | frame->chunk[1] = NULL; | 319 | frame->chunk[1] = NULL; |
@@ -342,33 +341,33 @@ static void null_update_frame_format( vo_driver_t* self, vo_frame_t* img, | |||
342 | frame->frame.base[0] = xine_xmalloc_aligned(16, image_size, | 341 | frame->frame.base[0] = xine_xmalloc_aligned(16, image_size, |
343 | (void **)&frame->chunk[0] ); | 342 | (void **)&frame->chunk[0] ); |
344 | frame->chunk[1] = NULL; | 343 | frame->chunk[1] = NULL; |
345 | frame->chunk[2] = NULL; | 344 | frame->chunk[2] = NULL; |
346 | } | 345 | } |
347 | 346 | ||
348 | frame->format = format; | 347 | frame->format = format; |
349 | frame->width = width; | 348 | frame->width = width; |
350 | frame->height = height; | 349 | frame->height = height; |
351 | 350 | ||
352 | frame->stripe_height = 16 * frame->output_height / frame->height; | 351 | frame->stripe_height = 16 * frame->output_height / frame->height; |
353 | frame->bytes_per_line = frame->output_width * this->bytes_per_pixel; | 352 | frame->bytes_per_line = frame->output_width * this->bytes_per_pixel; |
354 | 353 | ||
355 | /* | 354 | /* |
356 | * set up colorspace converter | 355 | * set up colorspace converter |
357 | */ | 356 | */ |
358 | if(this->m_show_video ){ | 357 | if(1 /*this->m_show_video*/ ){ |
359 | printf("showing video\n"); | 358 | printf("showing video\n"); |
360 | 359 | ||
361 | switch (flags) { | 360 | switch (flags) { |
362 | case VO_TOP_FIELD: | 361 | case VO_TOP_FIELD: |
363 | case VO_BOTTOM_FIELD: | 362 | case VO_BOTTOM_FIELD: |
364 | frame->yuv2rgb->configure (frame->yuv2rgb, | 363 | frame->yuv2rgb->configure (frame->yuv2rgb, |
365 | frame->width, | 364 | frame->width, |
366 | 16, | 365 | 16, |
367 | frame->width*2, | 366 | frame->width*2, |
368 | frame->width, | 367 | frame->width, |
369 | frame->output_width, | 368 | frame->output_width, |
370 | frame->stripe_height, | 369 | frame->stripe_height, |
371 | frame->bytes_per_line*2); | 370 | frame->bytes_per_line*2); |
372 | frame->yuv_stride = frame->bytes_per_line*2; | 371 | frame->yuv_stride = frame->bytes_per_line*2; |
373 | break; | 372 | break; |
374 | case VO_BOTH_FIELDS: | 373 | case VO_BOTH_FIELDS: |
@@ -401,41 +400,41 @@ static void null_update_frame_format( vo_driver_t* self, vo_frame_t* img, | |||
401 | frame->stripe_inc = 2 * frame->stripe_height * frame->bytes_per_line; | 400 | frame->stripe_inc = 2 * frame->stripe_height * frame->bytes_per_line; |
402 | break; | 401 | break; |
403 | case VO_BOTH_FIELDS: | 402 | case VO_BOTH_FIELDS: |
404 | frame->rgb_dst = (uint8_t *)frame->data; | 403 | frame->rgb_dst = (uint8_t *)frame->data; |
405 | frame->stripe_inc = frame->stripe_height * frame->bytes_per_line; | 404 | frame->stripe_inc = frame->stripe_height * frame->bytes_per_line; |
406 | break; | 405 | break; |
407 | } | 406 | } |
408 | } | 407 | } |
409 | printf("done\n"); | 408 | printf("done\n"); |
410 | } | 409 | } |
411 | static void null_display_frame( vo_driver_t* self, vo_frame_t *frame_gen ){ | 410 | static void null_display_frame( vo_driver_t* self, vo_frame_t *frame_gen ){ |
412 | null_driver_t* this = (null_driver_t*) self; | 411 | null_driver_t* this = (null_driver_t*) self; |
413 | opie_frame_t* frame = (opie_frame_t*)frame_gen; | 412 | opie_frame_t* frame = (opie_frame_t*)frame_gen; |
414 | display_xine_frame_t display = this->frameDis; | 413 | display_xine_frame_t display = this->frameDis; |
415 | 414 | ||
416 | printf("display frame\n"); | 415 | printf("display frame\n"); |
417 | // if( this->m_show_video ) { // return if not displaying | 416 | // if( this->m_show_video ) { // return if not displaying |
418 | printf("calling home aye\n" ); | 417 | printf("calling home aye\n" ); |
419 | if( display != NULL ) { | 418 | if( display != NULL ) { |
420 | (*display)(this->caller, frame->data, | 419 | (*display)(this->caller, frame->data, |
421 | frame->output_width, frame->output_height, | 420 | frame->output_width, frame->output_height, |
422 | frame->bytes_per_line ); | 421 | frame->bytes_per_line ); |
423 | printf("display done hope you enyoyed the frame"); | 422 | printf("display done hope you enyoyed the frame"); |
424 | } | 423 | } |
425 | // } | 424 | // } |
426 | 425 | ||
427 | frame->frame.displayed (&frame->frame); | 426 | frame->frame.displayed (&frame->frame); |
428 | } | 427 | } |
429 | 428 | ||
430 | 429 | ||
431 | // blending related | 430 | // blending related |
432 | 431 | ||
433 | 432 | ||
434 | static void null_overlay_clut_yuv2rgb(null_driver_t *this, vo_overlay_t *overlay, | 433 | static void null_overlay_clut_yuv2rgb(null_driver_t *this, vo_overlay_t *overlay, |
435 | opie_frame_t *frame) { | 434 | opie_frame_t *frame) { |
436 | int i; | 435 | int i; |
437 | clut_t* clut = (clut_t*) overlay->color; | 436 | clut_t* clut = (clut_t*) overlay->color; |
438 | if (!overlay->rgb_clut) { | 437 | if (!overlay->rgb_clut) { |
439 | for (i = 0; i < sizeof(overlay->color)/sizeof(overlay->color[0]); i++) { | 438 | for (i = 0; i < sizeof(overlay->color)/sizeof(overlay->color[0]); i++) { |
440 | *((uint32_t *)&clut[i]) = | 439 | *((uint32_t *)&clut[i]) = |
441 | frame->yuv2rgb->yuv2rgb_single_pixel_fun (frame->yuv2rgb, | 440 | frame->yuv2rgb->yuv2rgb_single_pixel_fun (frame->yuv2rgb, |