$OpenBSD: patch-src_xine-engine_video_out_c,v 1.10 2011/05/11 09:05:55 dcoppa Exp $ - Disable decoder flush from video out to avoid decoding errors. - Fixes two issues of video out standard cropping feature. Resulting left and right cropping parameters should be multiple of 2. Left cropping offset calculation to YUY2 frames fixed. --- src/xine-engine/video_out.c.orig Mon May 9 21:02:46 2011 +++ src/xine-engine/video_out.c Mon May 9 21:10:23 2011 @@ -533,8 +533,8 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream xine_list_iterator_t ite; /* add cropping requested by frontend */ - img->crop_left += this->crop_left; - img->crop_right += this->crop_right; + img->crop_left = (img->crop_left + this->crop_left) & ~1; + img->crop_right = (img->crop_right + this->crop_right) & ~1; img->crop_top += this->crop_top; img->crop_bottom += this->crop_bottom; @@ -1124,6 +1124,11 @@ static void paused_loop( vos_t *this, int64_t vpts ) pthread_mutex_unlock( &this->free_img_buf_queue->mutex ); } +static void video_out_update_disable_flush_from_video_out(void *disable_decoder_flush_from_video_out, xine_cfg_entry_t *entry) +{ + *(int *)disable_decoder_flush_from_video_out = entry->num_value; +} + static void *video_out_loop (void *this_gen) { int64_t vpts, diff; @@ -1131,6 +1136,7 @@ static void *video_out_loop (void *this_gen) { vos_t *this = (vos_t *) this_gen; int64_t next_frame_vpts = 0; int64_t usec_to_sleep; + int disable_decoder_flush_from_video_out; #ifndef WIN32 /* nice(-value) will fail silently for normal users. @@ -1141,6 +1147,16 @@ static void *video_out_loop (void *this_gen) { nice(-2); #endif /* WIN32 */ + disable_decoder_flush_from_video_out = this->xine->config->register_bool(this->xine->config, "engine.decoder.disable_flush_from_video_out", 0, + _("disable decoder flush from video out"), + _("video out causes a decoder flush when video out runs out of frames for displaying,\n" + "because the decoder hasn't deliverd new frames for quite a while.\n" + "flushing the decoder causes decoding errors for images decoded after the flush.\n" + "to avoid the decoding errors, decoder flush at video out should be disabled.\n\n" + "WARNING: as the flush was introduced to fix some issues when playing DVD still images, it is\n" + "likely that these issues may reappear in case they haven't been fixed differently meanwhile.\n"), + 20, video_out_update_disable_flush_from_video_out, &disable_decoder_flush_from_video_out); + /* * here it is - the heart of xine (or rather: one of the hearts * of xine) : the video output loop @@ -1191,7 +1207,7 @@ static void *video_out_loop (void *this_gen) { ite = xine_list_next(this->streams, ite)) { xine_stream_t *stream = xine_list_get_value(this->streams, ite); if (stream == XINE_ANON_STREAM) continue; - if (stream->video_decoder_plugin && stream->video_fifo) { + if (stream->video_decoder_plugin && stream->video_fifo && !disable_decoder_flush_from_video_out) { buf_element_t *buf; lprintf ("flushing current video decoder plugin\n"); @@ -1741,7 +1757,7 @@ static vo_frame_t * crop_frame( xine_video_port_t *thi yuy2_to_yuy2( /* src */ img->base[0] + img->crop_top * img->pitches[0] + - img->crop_left/2, img->pitches[0], + img->crop_left*2, img->pitches[0], /* dst */ dupl->base[0], dupl->pitches[0], /* width x height */