1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-03 05:31:34 +00:00

Add direct rendering method 2

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@6757 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
albeu 2002-07-20 13:53:53 +00:00
parent d05326c4bc
commit 3f558f2e9b
2 changed files with 44 additions and 3 deletions

View File

@ -137,6 +137,9 @@
#ifdef USE_LIBAVCODEC
{"lavdopts", lavc_decode_opts_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
#endif
#ifdef HAVE_XVID
{"xvidopts", xvid_dec_opts, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
#endif
// ------------------------- subtitles options --------------------
#ifdef USE_SUB
@ -259,4 +262,8 @@ extern char** vo_plugin_args;
extern struct config lavc_decode_opts_conf[];
#endif
#ifdef HAVE_XVID
extern struct config xvid_dec_opts[];
#endif
#endif

View File

@ -7,10 +7,14 @@
#ifdef HAVE_XVID
#include "vd_internal.h"
#include "cfgparser.h"
#include <divx4.h>
#include <xvid.h>
#ifndef XVID_CSP_EXTERN
#error "You need lastest XviD CVS"
#endif
static vd_info_t info =
{
@ -26,10 +30,19 @@ LIBVD_EXTERN(xvid)
typedef struct {
int cs;
unsigned char img_type;
void* hdl;
mp_image_t* mpi;
} priv_t;
static int do_dr2 = 0;
struct config xvid_dec_opts[] = {
{ "dr2", &do_dr2, CONF_TYPE_FLAG, 0, 0, 1, NULL},
{ "nodr2", &do_dr2, CONF_TYPE_FLAG, 0, 1, 0, NULL},
{NULL, NULL, 0, 0, 0, 0, NULL}
};
// to set/get/query special features/parameters
static int control(sh_video_t *sh,int cmd,void* arg,...){
return CONTROL_UNKNOWN;
@ -50,7 +63,7 @@ static int init(sh_video_t *sh){
switch(sh->codec->outfmt[sh->outfmtidx]){
case IMGFMT_YV12:
cs= XVID_CSP_USER;
cs= do_dr2 ? XVID_CSP_EXTERN : XVID_CSP_USER;
break;
case IMGFMT_YUY2:
cs=XVID_CSP_YUY2;
@ -106,6 +119,18 @@ static int init(sh_video_t *sh){
p->hdl = dec_p.handle;
sh->context = p;
switch(cs) {
case XVID_CSP_EXTERN:
p->img_type = MP_IMGTYPE_STATIC;
break;
case XVID_CSP_USER:
p->img_type = MP_IMGTYPE_EXPORT;
break;
default:
p->img_type = MP_IMGTYPE_TEMP;
break;
}
return 1;
}
@ -122,10 +147,10 @@ static void uninit(sh_video_t *sh){
static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
XVID_DEC_FRAME dec;
DEC_PICTURE d4_pic;
XVID_DEC_PICTURE pic;
priv_t* p = sh->context;
mp_image_t* mpi = mpcodecs_get_image(sh, p->cs == XVID_CSP_USER ?
MP_IMGTYPE_EXPORT : MP_IMGTYPE_TEMP,
mp_image_t* mpi = mpcodecs_get_image(sh, p->img_type,
MP_IMGFLAG_ACCEPT_STRIDE,
sh->disp_w,sh->disp_h);
@ -140,6 +165,15 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
case XVID_CSP_USER:
dec.image = &d4_pic;
break;
case XVID_CSP_EXTERN:
pic.y = mpi->planes[0];
pic.u = mpi->planes[1];
pic.v = mpi->planes[2];
pic.stride_y = mpi->stride[0];
pic.stride_u = mpi->stride[1];
pic.stride_v = mpi->stride[2];
dec.image = &pic;
break;
default:
dec.image = mpi->planes[0];
if(IMGFMT_IS_BGR(mpi->imgfmt) || IMGFMT_IS_RGB(mpi->imgfmt))