# HG changeset patch
# User Torsten Jager <t.jager@gmx.de>
# Date 1339485213 -10800
# Node ID 7091bfdc608867993228d380e4146c7f89b39084
# Parent  273564c1debd5c883913d8cd99550d7fb1fec029
Fixed raw yuv decoding: can't change size of _source_ image

diff --git a/src/video_dec/yuv.c b/src/video_dec/yuv.c
--- a/src/video_dec/yuv.c
+++ b/src/video_dec/yuv.c
@@ -97,8 +97,8 @@ static void yuv_decode_data (video_decod
     (this->stream->video_out->open) (this->stream->video_out, this->stream);
 
     bih = (xine_bmiheader *) buf->content;
-    this->width = (bih->biWidth + 3) & ~0x03;
-    this->height = (bih->biHeight + 3) & ~0x03;
+    this->width = bih->biWidth;
+    this->height = bih->biHeight;
 
     if (buf->decoder_flags & BUF_FLAG_ASPECT)
       this->ratio = (double)buf->decoder_info[1] / (double)buf->decoder_info[2];
@@ -121,14 +121,19 @@ static void yuv_decode_data (video_decod
     switch (buf->type) {
 
       case BUF_VIDEO_YUY2:
+        this->width = (this->width + 1) & ~1;
         _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, "Raw YUY2");
         break;
 
       case BUF_VIDEO_YV12:
+        this->width = (this->width + 1) & ~1;
+        this->height = (this->height + 1) & ~1;
         _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, "Raw YV12");
         break;
 
       case BUF_VIDEO_YVU9:
+        this->width = (this->width + 3) & ~3;
+        this->height = (this->height + 3) & ~3;
         _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, "Raw YVU9");
         break;
 
@@ -137,6 +142,8 @@ static void yuv_decode_data (video_decod
         break;
 
       case BUF_VIDEO_I420:
+        this->width = (this->width + 1) & ~1;
+        this->height = (this->height + 1) & ~1;
         _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, "Raw I420");
         break;
 
