Handle frames with stride correctly (e.g. the "Version" source of current AVS).

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@19223 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2006-07-28 17:04:43 +00:00
parent 79cccca643
commit 6ff2c1e486
1 changed files with 16 additions and 2 deletions

View File

@ -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 @@ static int demux_avs_fill_buffer(demuxer_t *demuxer, demux_stream_t *ds)
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 @@ static int demux_avs_fill_buffer(demuxer_t *demuxer, demux_stream_t *ds)
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++;