From ea02fab31dd66ad0d5d321c65046f0ef9c352848 Mon Sep 17 00:00:00 2001 From: Ewald Snel Date: Wed, 5 Mar 2003 22:12:40 +0000 Subject: Add option to fix alignment problem with some (buggy) XVideo drivers Undo previous change to libreal (bug is general video decoding problem) CVS patchset: 4342 CVS date: 2003/03/05 22:12:40 --- src/libreal/xine_decoder.c | 4 ++-- src/video_out/video_out_xv.c | 21 ++++++++++++++++++++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/libreal/xine_decoder.c b/src/libreal/xine_decoder.c index bf4411089..c98906318 100644 --- a/src/libreal/xine_decoder.c +++ b/src/libreal/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.29 2003/03/05 20:17:12 tmattern Exp $ + * $Id: xine_decoder.c,v 1.30 2003/03/05 22:12:40 esnel Exp $ * * thin layer to use real binary-only codecs in xine * @@ -208,7 +208,7 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) { init_data.w = BE_16(&buf->content[12]); init_data.h = BE_16(&buf->content[14]); - this->width = (init_data.w + 7) & (~7); + this->width = (init_data.w + 1) & (~1); this->height = (init_data.h + 1) & (~1); this->stream->stream_info[XINE_STREAM_INFO_VIDEO_WIDTH] = this->width; diff --git a/src/video_out/video_out_xv.c b/src/video_out/video_out_xv.c index b9f30a551..477e032c8 100644 --- a/src/video_out/video_out_xv.c +++ b/src/video_out/video_out_xv.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_xv.c,v 1.159 2003/02/28 02:51:51 storri Exp $ + * $Id: video_out_xv.c,v 1.160 2003/03/05 22:12:48 esnel Exp $ * * video_out_xv.c, X11 video extension interface for xine * @@ -118,6 +118,7 @@ struct xv_driver_s { int expecting_event; /* completion event handling */ int completion_event; int use_shm; + int use_pitch_alignment; xv_property_t props[VO_NUM_PROPERTIES]; uint32_t capabilities; @@ -244,6 +245,10 @@ static XvImage *create_ximage (xv_driver_t *this, XShmSegmentInfo *shminfo, unsigned int xv_format; XvImage *image=NULL; + if (this->use_pitch_alignment) { + width = (width + 7) & ~0x7; + } + switch (format) { case XINE_IMGFMT_YV12: xv_format = this->xv_format_yv12; @@ -394,6 +399,10 @@ static void xv_update_frame_format (vo_driver_t *this_gen, xv_driver_t *this = (xv_driver_t *) this_gen; xv_frame_t *frame = (xv_frame_t *) frame_gen; + if (this->use_pitch_alignment) { + width = (width + 7) & ~0x7; + } + if ((frame->width != width) || (frame->height != height) || (frame->format != format)) { @@ -1118,6 +1127,12 @@ static void xv_update_XV_DOUBLE_BUFFER(void *this_gen, xine_cfg_entry_t *entry) printf("video_out_xv: double buffering mode = %d\n",xv_double_buffer); } +static void xv_update_xv_pitch_alignment(void *this_gen, xine_cfg_entry_t *entry) { + xv_driver_t *this = (xv_driver_t *) this_gen; + + this->use_pitch_alignment = entry->num_value; +} + static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *visual_gen) { @@ -1314,6 +1329,10 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi else this->completion_event = -1; + this->use_pitch_alignment = config->register_bool (config, "video.xv_pitch_alignment", 0, + _("workaround for some (buggy) XVideo drivers"), + NULL, 10, xv_update_xv_pitch_alignment, this); + this->deinterlace_method = config->register_enum (config, "video.deinterlace_method", 4, deinterlace_methods, _("Software deinterlace method (Key I toggles deinterlacer on/off)"), -- cgit v1.2.3