changeset 19218:950f60b90cf5

Handle frames with stride correctly (e.g. the "Version" source of current AVS).
author reimar
date Fri, 28 Jul 2006 17:04:43 +0000
parents 054441794c95
children 7b6e341b72f5
files libmpdemux/demux_avs.c
diffstat 1 files changed, 16 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_avs.c	Fri Jul 28 17:03:08 2006 +0000
+++ b/libmpdemux/demux_avs.c	Fri Jul 28 17:04:43 2006 +0000
@@ -29,6 +29,7 @@
 #include "stream.h"
 #include "demuxer.h"
 #include "stheader.h"
+#include "libvo/fastmemcpy.h"
 
 #include "wine/windef.h"
 
@@ -176,6 +177,8 @@
 
     if (avs_has_video(AVS->video_info))
     {
+        char *dst;
+        int w, h;
         if (AVS->video_info->num_frames < AVS->frameno) return 0; // EOF
 
         curr_frame = AVS->avs_get_frame(AVS->clip, AVS->frameno);
@@ -184,12 +187,23 @@
             mp_msg(MSGT_DEMUX, MSGL_V, "AVS: error getting frame -- EOF??\n");
             return 0;
         }
+        w = curr_frame->row_size;
+        h = curr_frame->height;
 
-        dp = new_demux_packet(curr_frame->vfb->data_size);
+        dp = new_demux_packet(w * h + 2 * (w / 2) * (h / 2));
 
         dp->pts=AVS->frameno / sh_video->fps;
 
-        memcpy(dp->buffer, curr_frame->vfb->data + curr_frame->offset, curr_frame->vfb->data_size);
+        dst = dp->buffer;
+        memcpy_pic(dst, curr_frame->vfb->data + curr_frame->offset,
+                   w, h, w, curr_frame->pitch);
+        dst += w * h;
+        w /= 2; h /= 2;
+        memcpy_pic(dst, curr_frame->vfb->data + curr_frame->offsetU,
+                   w, h, w, curr_frame->pitchUV);
+        dst += w * h;
+        memcpy_pic(dst, curr_frame->vfb->data + curr_frame->offsetV,
+                   w, h, w, curr_frame->pitchUV);
         ds_add_packet(demuxer->video, dp);
 
         AVS->frameno++;