Index: libmpcodecs/ve_raw.c =================================================================== RCS file: /cvsroot/mplayer/main/libmpcodecs/ve_raw.c,v retrieving revision 1.6 diff -u -r1.6 ve_raw.c --- libmpcodecs/ve_raw.c 18 Nov 2005 14:39:22 -0000 1.6 +++ libmpcodecs/ve_raw.c 13 Dec 2005 14:06:53 -0000 @@ -15,14 +15,16 @@ #include "img_format.h" #include "mp_image.h" #include "vf.h" - +#include "libvo/fastmemcpy.h" //===========================================================================// struct vf_priv_s { muxer_stream_t* mux; + mp_image_t* timg; }; #define mux_v (vf->priv->mux) +#define timg (vf->priv->timg) static int set_format(struct vf_instance_s *vf, unsigned int fmt) { mux_v->bih->biCompression = fmt; @@ -88,6 +90,11 @@ if (!ret) return 0; mux_v->bih->biSizeImage = mux_v->bih->biWidth*mux_v->bih->biHeight*mux_v->bih->biBitCount/8; + + /* Allocate a buffer for a temproary image. */ + timg = vf_get_image(vf, outfmt, MP_IMGTYPE_TEMP, 0, width, height); + if(!timg) return 0; + return 1; } @@ -96,8 +103,11 @@ } static int query_format(struct vf_instance_s *vf, unsigned int fmt) { + const int supported = VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW + | VFCAP_ACCEPT_STRIDE; + if (IMGFMT_IS_RGB(fmt) || IMGFMT_IS_BGR(fmt)) - return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW; + return supported; switch (fmt) { case IMGFMT_I420: case IMGFMT_IYUV: @@ -109,14 +119,32 @@ case IMGFMT_YUY2: case IMGFMT_YVU9: case IMGFMT_IF09: - return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW; + return supported; } return 0; } static int put_image(struct vf_instance_s *vf, mp_image_t *mpi) { - mux_v->buffer = mpi->planes[0]; + /* Pack the frame, if necessary. */ + if((timg->stride[0] != mpi->stride[0]) + || ((mpi->flags & MP_IMGFLAG_PLANAR) && (timg->height != mpi->height))) + { + + memcpy_pic(timg->planes[0], mpi->planes[0], timg->stride[0], + timg->h, timg->stride[0], mpi->stride[0]); + if (mpi->flags & MP_IMGFLAG_PLANAR) { + memcpy_pic(timg->planes[1], mpi->planes[1], timg->stride[1], + timg->chroma_height, timg->stride[1], mpi->stride[1]); + memcpy_pic(timg->planes[2], mpi->planes[2], timg->stride[2], + timg->chroma_height, timg->stride[2], mpi->stride[2]); + } + mux_v->buffer = timg->planes[0]; + } + else + mux_v->buffer = mpi->planes[0]; + + /* Write the packed frame to the muxer */ muxer_write_chunk(mux_v, mpi->width*mpi->height*mux_v->bih->biBitCount/8, 0x10); return 1; } @@ -125,11 +153,10 @@ static int vf_open(vf_instance_t *vf, char* args){ vf->config = config; - vf->default_caps = VFCAP_CONSTANT; + vf->default_caps = VFCAP_ACCEPT_STRIDE; vf->control = control; vf->query_format = query_format; vf->put_image = put_image; - vf->default_caps = 0; vf->priv = malloc(sizeof(struct vf_priv_s)); memset(vf->priv, 0, sizeof(struct vf_priv_s)); vf->priv->mux = (muxer_stream_t*)args;