author | sandman <sandman> | 2002-08-01 01:33:23 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-08-01 01:33:23 (UTC) |
commit | 32b7fdb0e9e5ec6cb6f791962efe68c40564b178 (patch) (unidiff) | |
tree | 86044a8b3884536f65d38b32d3e0552c30f13a81 | |
parent | ba034bf4cb91b83654056945fc27313a28528015 (diff) | |
download | opie-32b7fdb0e9e5ec6cb6f791962efe68c40564b178.zip opie-32b7fdb0e9e5ec6cb6f791962efe68c40564b178.tar.gz opie-32b7fdb0e9e5ec6cb6f791962efe68c40564b178.tar.bz2 |
Fixed video output (frames allocated before video was enabled via
show_video flag have never been displayes thereafter)
Also optimized the video widget
-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/nullvideo.c | 17 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinevideowidget.cpp | 79 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinevideowidget.h | 3 |
4 files changed, 49 insertions, 52 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp index aa37cd7..ac5cdd5 100644 --- a/noncore/multimedia/opieplayer2/lib.cpp +++ b/noncore/multimedia/opieplayer2/lib.cpp | |||
@@ -175,35 +175,35 @@ void Lib::showVideoFullScreen( bool fullScreen ) { | |||
175 | } | 175 | } |
176 | bool Lib::isVideoFullScreen() { | 176 | bool Lib::isVideoFullScreen() { |
177 | return ::null_is_fullscreen( m_videoOutput ); | 177 | return ::null_is_fullscreen( m_videoOutput ); |
178 | } | 178 | } |
179 | void Lib::setScaling( bool scale ) { | 179 | void Lib::setScaling( bool scale ) { |
180 | ::null_set_scaling( m_videoOutput, scale ); | 180 | ::null_set_scaling( m_videoOutput, scale ); |
181 | } | 181 | } |
182 | bool Lib::isScaling() { | 182 | bool Lib::isScaling() { |
183 | return ::null_is_scaling( m_videoOutput ); | 183 | return ::null_is_scaling( m_videoOutput ); |
184 | } | 184 | } |
185 | void Lib::xine_event_handler( void* user_data, xine_event_t* t ) { | 185 | void Lib::xine_event_handler( void* user_data, xine_event_t* t ) { |
186 | ((Lib*)user_data)->handleXineEvent( t ); | 186 | ((Lib*)user_data)->handleXineEvent( t ); |
187 | } | 187 | } |
188 | void Lib::xine_display_frame( void* user_data, uint8_t *frame, | 188 | void Lib::xine_display_frame( void* user_data, uint8_t *frame, |
189 | int width, int height, int bytes ) { | 189 | int width, int height, int bytes ) { |
190 | printf("display x frame"); | 190 | printf("display x frame"); |
191 | ((Lib*)user_data)->drawFrame( frame, width, height, bytes ); | 191 | ((Lib*)user_data)->drawFrame( frame, width, height, bytes ); |
192 | printf("displayed x frame\n"); | 192 | printf("displayed x frame\n"); |
193 | } | 193 | } |
194 | void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { | 194 | void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { |
195 | if (!m_video ) { | 195 | if (!m_video ) { |
196 | qWarning("not showing video now"); | 196 | qWarning("not showing video now"); |
197 | return; | 197 | return; |
198 | } | 198 | } |
199 | qWarning("called draw frame %d %d", width, height); | 199 | qWarning("called draw frame %d %d", width, height); |
200 | 200 | ||
201 | QSize size = m_wid->size(); | 201 | QSize size = m_wid->size(); |
202 | int xoffset = (size.width() - width) / 2; | 202 | int xoffset = (size.width() - width) / 2; |
203 | int yoffset = (size.height() - height) / 2; | 203 | int yoffset = (size.height() - height) / 2; |
204 | int linestep = qt_screen->linestep(); | 204 | int linestep = qt_screen->linestep(); |
205 | 205 | ||
206 | m_wid->setImage( frame, yoffset, xoffset, width, height, linestep, bytes, m_bytes_per_pixel ); | 206 | m_wid->setImage( frame, yoffset, xoffset, width, height, linestep, bytes, m_bytes_per_pixel ); |
207 | m_wid->repaint(); | 207 | // m_wid->repaint(false); |
208 | 208 | ||
209 | } | 209 | } |
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 | |||
@@ -43,158 +43,157 @@ struct null_driver_s { | |||
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 | }; |
49 | typedef struct opie_frame_s opie_frame_t; | 49 | typedef struct opie_frame_s opie_frame_t; |
50 | struct opie_frame_s { | 50 | struct 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 | ||
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; |
114 | case VO_BOTTOM_FIELD: | 113 | case VO_BOTTOM_FIELD: |
115 | frame->rgb_dst = (uint8_t *)frame->data + frame->bytes_per_line ; | 114 | frame->rgb_dst = (uint8_t *)frame->data + frame->bytes_per_line ; |
116 | frame->stripe_inc = 2*frame->stripe_height * frame->bytes_per_line; | 115 | frame->stripe_inc = 2*frame->stripe_height * frame->bytes_per_line; |
117 | break; | 116 | break; |
118 | case VO_BOTH_FIELDS: | 117 | case VO_BOTH_FIELDS: |
119 | frame->rgb_dst = (uint8_t *)frame->data; | 118 | frame->rgb_dst = (uint8_t *)frame->data; |
120 | break; | 119 | break; |
121 | } | 120 | } |
122 | } | 121 | } |
123 | 122 | ||
124 | 123 | ||
125 | /* take care of the frame*/ | 124 | /* take care of the frame*/ |
126 | static void null_frame_dispose( vo_frame_t* vo_img){ | 125 | static void null_frame_dispose( vo_frame_t* vo_img){ |
127 | opie_frame_t* frame = (opie_frame_t*)vo_img; | 126 | opie_frame_t* frame = (opie_frame_t*)vo_img; |
128 | printf("frame_dispose\n"); | 127 | printf("frame_dispose\n"); |
129 | if( frame->data ) | 128 | if( frame->data ) |
130 | free( frame->data ); | 129 | free( frame->data ); |
131 | free (frame); | 130 | free (frame); |
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; |
185 | break; | 184 | break; |
186 | case XINE_ASPECT_RATIO_211_1: /* 2.11:1 */ | 185 | case XINE_ASPECT_RATIO_211_1: /* 2.11:1 */ |
187 | desired_ratio = 2.11/1.0; | 186 | desired_ratio = 2.11/1.0; |
188 | break; | 187 | break; |
189 | case XINE_ASPECT_RATIO_SQUARE: /* square pels */ | 188 | case XINE_ASPECT_RATIO_SQUARE: /* square pels */ |
190 | case XINE_ASPECT_RATIO_DONT_TOUCH: /* probably non-mpeg stream => don't touch aspect ratio */ | 189 | case XINE_ASPECT_RATIO_DONT_TOUCH: /* probably non-mpeg stream => don't touch aspect ratio */ |
191 | desired_ratio = image_ratio; | 190 | desired_ratio = image_ratio; |
192 | break; | 191 | break; |
193 | case 0: /* forbidden -> 4:3 */ | 192 | case 0: /* forbidden -> 4:3 */ |
194 | printf ("video_out_fb: invalid ratio, using 4:3\n"); | 193 | printf ("video_out_fb: invalid ratio, using 4:3\n"); |
195 | default: | 194 | default: |
196 | printf ("video_out_fb: unknown aspect ratio (%d) in stream => using 4:3\n", | 195 | printf ("video_out_fb: unknown aspect ratio (%d) in stream => using 4:3\n", |
197 | frame->ratio_code); | 196 | frame->ratio_code); |
198 | case XINE_ASPECT_RATIO_4_3: /* 4:3 */ | 197 | case XINE_ASPECT_RATIO_4_3: /* 4:3 */ |
199 | desired_ratio = 4.0 / 3.0; | 198 | desired_ratio = 4.0 / 3.0; |
200 | break; | 199 | break; |
@@ -272,186 +271,186 @@ static void null_compute_rgb_size (null_driver_t *this, opie_frame_t *frame) { | |||
272 | 271 | ||
273 | // size specific | 272 | // size specific |
274 | 273 | ||
275 | 274 | ||
276 | static void null_update_frame_format( vo_driver_t* self, vo_frame_t* img, | 275 | static void null_update_frame_format( vo_driver_t* self, vo_frame_t* img, |
277 | uint32_t width, uint32_t height, | 276 | uint32_t width, uint32_t height, |
278 | int ratio_code, int format, int flags ){ | 277 | int ratio_code, int format, int flags ){ |
279 | null_driver_t* this = (null_driver_t*) self; | 278 | null_driver_t* this = (null_driver_t*) self; |
280 | opie_frame_t* frame = (opie_frame_t*)img; | 279 | opie_frame_t* frame = (opie_frame_t*)img; |
281 | /* not needed now */ | 280 | /* not needed now */ |
282 | printf("update_frame_format\n"); | 281 | printf("update_frame_format\n"); |
283 | printf("al crash aye?\n"); | 282 | printf("al crash aye?\n"); |
284 | 283 | ||
285 | flags &= VO_BOTH_FIELDS; | 284 | flags &= VO_BOTH_FIELDS; |
286 | 285 | ||
287 | /* find out if we need to adapt this frame */ | 286 | /* find out if we need to adapt this frame */ |
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; |
321 | } | 320 | } |
322 | if(frame->chunk[2] ){ | 321 | if(frame->chunk[2] ){ |
323 | free ( frame->chunk[2] ); | 322 | free ( frame->chunk[2] ); |
324 | frame->chunk[2] = NULL; | 323 | frame->chunk[2] = NULL; |
325 | } | 324 | } |
326 | free ( frame->data ); | 325 | free ( frame->data ); |
327 | } | 326 | } |
328 | printf("after freeing\n"); | 327 | printf("after freeing\n"); |
329 | frame->data = xine_xmalloc (frame->output_width * frame->output_height * | 328 | frame->data = xine_xmalloc (frame->output_width * frame->output_height * |
330 | this->bytes_per_pixel ); | 329 | this->bytes_per_pixel ); |
331 | 330 | ||
332 | if( format == IMGFMT_YV12 ) { | 331 | if( format == IMGFMT_YV12 ) { |
333 | int image_size = width * height; /* cast ouch*/ | 332 | int image_size = width * height; /* cast ouch*/ |
334 | frame->frame.base[0] = xine_xmalloc_aligned(16, image_size, | 333 | frame->frame.base[0] = xine_xmalloc_aligned(16, image_size, |
335 | (void **)&frame->chunk[0] ); | 334 | (void **)&frame->chunk[0] ); |
336 | frame->frame.base[1] = xine_xmalloc_aligned(16, image_size, | 335 | frame->frame.base[1] = xine_xmalloc_aligned(16, image_size, |
337 | (void **)&frame->chunk[1] ); | 336 | (void **)&frame->chunk[1] ); |
338 | frame->frame.base[2] = xine_xmalloc_aligned(16, image_size, | 337 | frame->frame.base[2] = xine_xmalloc_aligned(16, image_size, |
339 | (void **)&frame->chunk[2] ); | 338 | (void **)&frame->chunk[2] ); |
340 | }else{ | 339 | }else{ |
341 | int image_size = width * height; /* cast ouch*/ | 340 | int image_size = width * height; /* cast ouch*/ |
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: |
375 | frame->yuv2rgb->configure (frame->yuv2rgb, | 374 | frame->yuv2rgb->configure (frame->yuv2rgb, |
376 | frame->width, | 375 | frame->width, |
377 | 16, | 376 | 16, |
378 | frame->width, | 377 | frame->width, |
379 | frame->width/2, | 378 | frame->width/2, |
380 | frame->output_width, | 379 | frame->output_width, |
381 | frame->stripe_height, | 380 | frame->stripe_height, |
382 | frame->bytes_per_line); | 381 | frame->bytes_per_line); |
383 | frame->yuv_stride = frame->bytes_per_line; | 382 | frame->yuv_stride = frame->bytes_per_line; |
384 | break; | 383 | break; |
385 | } | 384 | } |
386 | } | 385 | } |
387 | } | 386 | } |
388 | printf("after gui changed\n"); | 387 | printf("after gui changed\n"); |
389 | /* | 388 | /* |
390 | * reset dest pointers | 389 | * reset dest pointers |
391 | */ | 390 | */ |
392 | 391 | ||
393 | if (frame->data) { | 392 | if (frame->data) { |
394 | switch (flags) { | 393 | switch (flags) { |
395 | case VO_TOP_FIELD: | 394 | case VO_TOP_FIELD: |
396 | frame->rgb_dst = (uint8_t *)frame->data; | 395 | frame->rgb_dst = (uint8_t *)frame->data; |
397 | frame->stripe_inc = 2 * frame->stripe_height * frame->bytes_per_line; | 396 | frame->stripe_inc = 2 * frame->stripe_height * frame->bytes_per_line; |
398 | break; | 397 | break; |
399 | case VO_BOTTOM_FIELD: | 398 | case VO_BOTTOM_FIELD: |
400 | frame->rgb_dst = (uint8_t *)frame->data + frame->bytes_per_line ; | 399 | frame->rgb_dst = (uint8_t *)frame->data + frame->bytes_per_line ; |
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, |
442 | clut[i].y, clut[i].cb, clut[i].cr); | 441 | clut[i].y, clut[i].cb, clut[i].cr); |
443 | } | 442 | } |
444 | overlay->rgb_clut++; | 443 | overlay->rgb_clut++; |
445 | } | 444 | } |
446 | if (!overlay->clip_rgb_clut) { | 445 | if (!overlay->clip_rgb_clut) { |
447 | clut = (clut_t*) overlay->clip_color; | 446 | clut = (clut_t*) overlay->clip_color; |
448 | 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++) { |
449 | *((uint32_t *)&clut[i]) = | 448 | *((uint32_t *)&clut[i]) = |
450 | frame->yuv2rgb->yuv2rgb_single_pixel_fun(frame->yuv2rgb, | 449 | frame->yuv2rgb->yuv2rgb_single_pixel_fun(frame->yuv2rgb, |
451 | clut[i].y, clut[i].cb, clut[i].cr); | 450 | clut[i].y, clut[i].cb, clut[i].cr); |
452 | } | 451 | } |
453 | overlay->clip_rgb_clut++; | 452 | overlay->clip_rgb_clut++; |
454 | } | 453 | } |
455 | } | 454 | } |
456 | 455 | ||
457 | static void null_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay) { | 456 | static void null_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay) { |
diff --git a/noncore/multimedia/opieplayer2/xinevideowidget.cpp b/noncore/multimedia/opieplayer2/xinevideowidget.cpp index d665f16..b5a714e 100644 --- a/noncore/multimedia/opieplayer2/xinevideowidget.cpp +++ b/noncore/multimedia/opieplayer2/xinevideowidget.cpp | |||
@@ -17,114 +17,109 @@ | |||
17 | .%`+i> _;_. | 17 | .%`+i> _;_. |
18 | .i_,=:_. -<s. This program is distributed in the hope that | 18 | .i_,=:_. -<s. This program is distributed in the hope that |
19 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 19 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
20 | : .. .:, . . . without even the implied warranty of | 20 | : .. .:, . . . without even the implied warranty of |
21 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 21 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
22 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 22 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
23 | ..}^=.= = ; Library General Public License for more | 23 | ..}^=.= = ; Library General Public License for more |
24 | ++= -. .` .: details. | 24 | ++= -. .` .: details. |
25 | : = ...= . :.=- | 25 | : = ...= . :.=- |
26 | -. .:....=;==+<; You should have received a copy of the GNU | 26 | -. .:....=;==+<; You should have received a copy of the GNU |
27 | -_. . . )=. = Library General Public License along with | 27 | -_. . . )=. = Library General Public License along with |
28 | -- :-=` this library; see the file COPYING.LIB. | 28 | -- :-=` this library; see the file COPYING.LIB. |
29 | If not, write to the Free Software Foundation, | 29 | If not, write to the Free Software Foundation, |
30 | Inc., 59 Temple Place - Suite 330, | 30 | Inc., 59 Temple Place - Suite 330, |
31 | Boston, MA 02111-1307, USA. | 31 | Boston, MA 02111-1307, USA. |
32 | 32 | ||
33 | */ | 33 | */ |
34 | 34 | ||
35 | #include <qimage.h> | 35 | #include <qimage.h> |
36 | #include <qpainter.h> | 36 | #include <qpainter.h> |
37 | #include <qgfx_qws.h> | 37 | #include <qgfx_qws.h> |
38 | #include <qdirectpainter_qws.h> | 38 | #include <qdirectpainter_qws.h> |
39 | #include <qsize.h> | 39 | #include <qsize.h> |
40 | 40 | ||
41 | #include <qpe/resource.h> | 41 | #include <qpe/resource.h> |
42 | 42 | ||
43 | #include "xinevideowidget.h" | 43 | #include "xinevideowidget.h" |
44 | 44 | ||
45 | XineVideoWidget::XineVideoWidget( int width, | 45 | XineVideoWidget::XineVideoWidget( int width, |
46 | int height, | 46 | int height, |
47 | QWidget* parent, | 47 | QWidget* parent, |
48 | const char* name ) | 48 | const char* name ) |
49 | : QWidget( parent, name ) | 49 | : QWidget( parent, name, WRepaintNoErase | WResizeNoErase ) |
50 | { | 50 | { |
51 | m_image = new QImage( width, height, qt_screen->depth() ); | 51 | m_image = new QImage( width, height, qt_screen->depth() ); |
52 | m_buff = 0; | 52 | m_buff = 0; |
53 | setBackgroundMode( NoBackground); | 53 | setBackgroundMode( NoBackground); |
54 | /* QImage image = Resource::loadImage("SoundPlayer"); | 54 | /* QImage image = Resource::loadImage("SoundPlayer"); |
55 | image = image.smoothScale( width, height ); | 55 | image = image.smoothScale( width, height ); |
56 | 56 | ||
57 | m_image = new QImage( image );*/ | 57 | m_image = new QImage( image );*/ |
58 | } | 58 | } |
59 | XineVideoWidget::~XineVideoWidget() { | 59 | XineVideoWidget::~XineVideoWidget() { |
60 | delete m_image; | 60 | delete m_image; |
61 | } | 61 | } |
62 | void XineVideoWidget::clear() { | 62 | void XineVideoWidget::clear() { |
63 | m_buff = 0; | 63 | m_buff = 0; |
64 | repaint(); | 64 | repaint(false); |
65 | } | 65 | } |
66 | void XineVideoWidget::paintEvent( QPaintEvent* e ) { | 66 | void XineVideoWidget::paintEvent( QPaintEvent* e ) { |
67 | qWarning("painting"); | 67 | qWarning("painting"); |
68 | QPainter p(this ); | 68 | if (m_buff == 0 ) { |
69 | p.setBrush( QBrush( Qt::black ) ); | 69 | QPainter p(this ); |
70 | p.drawRect( rect() ); | 70 | p.fillRect( rect(), black ); |
71 | if (m_buff == 0 ) | ||
72 | p.drawImage( 0, 0, *m_image ); | 71 | p.drawImage( 0, 0, *m_image ); |
73 | else { | 72 | qWarning ( "logo\n" ); |
73 | } | ||
74 | else { | ||
74 | qWarning("paitnevent\n"); | 75 | qWarning("paitnevent\n"); |
75 | 76 | { | |
76 | QDirectPainter dp( this ); | 77 | |
77 | uchar* dst = dp.frameBuffer() + (m_yOff + dp.yOffset() ) * linestep + | 78 | if (( m_thisframe & m_lastframe ) != m_lastframe ) { |
78 | (m_xOff + dp.xOffset() ) * m_bytes_per_pixel; | 79 | QPainter p ( this ); |
79 | uchar* frame = m_buff; | 80 | p. fillRect ( m_lastframe, black ); |
80 | for(int y = 0; y < m_Height; y++ ) { | 81 | } |
81 | memcpy( dst, frame, m_bytes ); | 82 | } |
82 | frame += m_bytes; | 83 | { |
83 | dst += linestep; | 84 | QDirectPainter dp ( this ); |
85 | |||
86 | uchar* dst = dp.frameBuffer() + (m_thisframe. y ( ) + dp.yOffset() ) * linestep + | ||
87 | (m_thisframe. x ( ) + dp.xOffset() ) * m_bytes_per_pixel; | ||
88 | uchar* frame = m_buff; | ||
89 | for(int y = 0; y < m_thisframe. height ( ); y++ ) { | ||
90 | memcpy( dst, frame, m_bytes ); | ||
91 | frame += m_bytes; | ||
92 | dst += linestep; | ||
93 | } | ||
84 | } | 94 | } |
85 | // QVFB hack by MArtin Jones | 95 | { |
86 | // QPainter dp2(this); | 96 | // QVFB hack by MArtin Jones |
87 | // dp2.fillRect( rect(), QBrush( NoBrush ) ); | 97 | QPainter p ( this ); |
98 | p. fillRect ( m_thisframe, QBrush ( NoBrush )); | ||
99 | } | ||
88 | } | 100 | } |
89 | // QWidget::paintEvent( e ); | ||
90 | } | 101 | } |
91 | int XineVideoWidget::height() const{ | 102 | int XineVideoWidget::height() const{ |
92 | return m_image->height(); | 103 | return m_image->height(); |
93 | } | 104 | } |
94 | int XineVideoWidget::width() const{ | 105 | int XineVideoWidget::width() const{ |
95 | return m_image->width(); | 106 | return m_image->width(); |
96 | } | 107 | } |
97 | void XineVideoWidget::setImage( QImage* image ) { | 108 | void XineVideoWidget::setImage( QImage* image ) { |
98 | delete m_image; | 109 | delete m_image; |
99 | m_image = image; | 110 | m_image = image; |
100 | } | 111 | } |
101 | void XineVideoWidget::setImage( uchar* image, int yoffsetXLine, | 112 | void XineVideoWidget::setImage( uchar* image, int yoffsetXLine, |
102 | int xoffsetXBytes, int width, | 113 | int xoffsetXBytes, int width, |
103 | int height, int linestep, int bytes, int bpp ) { | 114 | int height, int linestep, int bytes, int bpp ) { |
104 | /* if (m_buff != 0 ) | 115 | |
105 | free(m_buff ); | 116 | m_lastframe = m_thisframe; |
106 | */ | 117 | m_thisframe. setRect ( xoffsetXBytes, yoffsetXLine, width, height ); |
118 | |||
107 | m_buff = image; | 119 | m_buff = image; |
108 | m_yOff = yoffsetXLine; | ||
109 | m_xOff = xoffsetXBytes; | ||
110 | m_Width = width; | ||
111 | m_Height = height; | ||
112 | this->linestep = linestep; | 120 | this->linestep = linestep; |
113 | m_bytes = bytes; | 121 | m_bytes = bytes; |
114 | m_bytes_per_pixel = bpp; | 122 | m_bytes_per_pixel = bpp; |
115 | //// | 123 | |
116 | qWarning("width %d %d", width, height ); | 124 | repaint ( false ); |
117 | /* QDirectPainter dp( this ); | ||
118 | uchar* dst = dp.frameBuffer() + (m_yOff + dp.yOffset() ) * linestep + | ||
119 | (m_xOff + dp.xOffset() ) * m_bytes_per_pixel; | ||
120 | uchar* frame = m_buff; | ||
121 | for(int y = 0; y < m_Height; y++ ) { | ||
122 | memcpy( dst, frame, m_bytes ); | ||
123 | frame += m_bytes; | ||
124 | dst += linestep; | ||
125 | } | ||
126 | // QVFB hack | ||
127 | QPainter dp2(this); | ||
128 | dp2.fillRect( rect(), QBrush( NoBrush ) ); | ||
129 | */ | ||
130 | } | 125 | } |
diff --git a/noncore/multimedia/opieplayer2/xinevideowidget.h b/noncore/multimedia/opieplayer2/xinevideowidget.h index b670fa0..5656194 100644 --- a/noncore/multimedia/opieplayer2/xinevideowidget.h +++ b/noncore/multimedia/opieplayer2/xinevideowidget.h | |||
@@ -22,43 +22,46 @@ | |||
22 | ..}^=.= = ; Library General Public License for more | 22 | ..}^=.= = ; Library General Public License for more |
23 | ++= -. .` .: details. | 23 | ++= -. .` .: details. |
24 | : = ...= . :.=- | 24 | : = ...= . :.=- |
25 | -. .:....=;==+<; You should have received a copy of the GNU | 25 | -. .:....=;==+<; You should have received a copy of the GNU |
26 | -_. . . )=. = Library General Public License along with | 26 | -_. . . )=. = Library General Public License along with |
27 | -- :-=` this library; see the file COPYING.LIB. | 27 | -- :-=` this library; see the file COPYING.LIB. |
28 | If not, write to the Free Software Foundation, | 28 | If not, write to the Free Software Foundation, |
29 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | 31 | ||
32 | */ | 32 | */ |
33 | 33 | ||
34 | 34 | ||
35 | 35 | ||
36 | #include <qwidget.h> | 36 | #include <qwidget.h> |
37 | 37 | ||
38 | class QImage; | 38 | class QImage; |
39 | class XineVideoWidget : public QWidget { | 39 | class XineVideoWidget : public QWidget { |
40 | Q_OBJECT | 40 | Q_OBJECT |
41 | public: | 41 | public: |
42 | XineVideoWidget( int width, int height, QWidget* parent, const char* name ); | 42 | XineVideoWidget( int width, int height, QWidget* parent, const char* name ); |
43 | ~XineVideoWidget(); | 43 | ~XineVideoWidget(); |
44 | QImage *image() { return m_image; }; | 44 | QImage *image() { return m_image; }; |
45 | void setImage( QImage* image ); | 45 | void setImage( QImage* image ); |
46 | void setImage( uchar* image, int yoffsetXLine, int xoffsetXBytes, | 46 | void setImage( uchar* image, int yoffsetXLine, int xoffsetXBytes, |
47 | int width, int height, int linestep, int bytes, int bpp); | 47 | int width, int height, int linestep, int bytes, int bpp); |
48 | int width() const; | 48 | int width() const; |
49 | int height() const; | 49 | int height() const; |
50 | void clear() ; | 50 | void clear() ; |
51 | protected: | 51 | protected: |
52 | void paintEvent( QPaintEvent* p ); | 52 | void paintEvent( QPaintEvent* p ); |
53 | private: | 53 | private: |
54 | QRect m_lastframe; | ||
55 | QRect m_thisframe; | ||
56 | |||
54 | int m_wid; | 57 | int m_wid; |
55 | int m_height; | 58 | int m_height; |
56 | int m_yOff, m_xOff; | 59 | int m_yOff, m_xOff; |
57 | uchar* m_buff; | 60 | uchar* m_buff; |
58 | int m_Width, m_Height, linestep; | 61 | int m_Width, m_Height, linestep; |
59 | int m_bytes; | 62 | int m_bytes; |
60 | int m_bytes_per_pixel; | 63 | int m_bytes_per_pixel; |
61 | QImage* m_image; | 64 | QImage* m_image; |
62 | 65 | ||
63 | }; | 66 | }; |
64 | 67 | ||