From 7b25afd7423e9056782993cbd1b32ead64ac1462 Mon Sep 17 00:00:00 2001 From: reimar Date: Fri, 17 Nov 2006 18:16:21 +0000 Subject: [PATCH] Add deinterlace property, patch by Carl Eugen Hoyos (cehoyos [at] rainbow studorg tuwien ac at) with small modifications by me. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@20989 b3059339-0415-0410-9bf9-f77b7e298cf2 --- input/input.c | 1 + libmpcodecs/vf.h | 2 ++ libmpcodecs/vf_vo.c | 12 ++++++++++++ libvo/video_out.h | 3 +++ libvo/vo_xvmc.c | 9 +++++++++ mplayer.c | 25 +++++++++++++++++++++++++ 6 files changed, 52 insertions(+) diff --git a/input/input.c b/input/input.c index b3caf5b366..80acd21213 100644 --- a/input/input.c +++ b/input/input.c @@ -371,6 +371,7 @@ static mp_cmd_bind_t def_cmd_binds[] = { { { '7', 0 }, "saturation -1" }, { { '8', 0 }, "saturation 1" }, { { 'd', 0 }, "frame_drop" }, + { { 'D', 0 }, "step_property deinterlace" }, { { 'r', 0 }, "sub_pos -1" }, { { 't', 0 }, "sub_pos +1" }, { { 'a', 0 }, "sub_alignment" }, diff --git a/libmpcodecs/vf.h b/libmpcodecs/vf.h index 6984ee94d5..e03a3e59a6 100644 --- a/libmpcodecs/vf.h +++ b/libmpcodecs/vf.h @@ -80,6 +80,8 @@ typedef struct vf_seteq_s #define VFCTRL_INIT_EOSD 15 /* Select EOSD renderer */ #define VFCTRL_DRAW_EOSD 16 /* Render EOSD */ #define VFCTRL_GET_PTS 17 /* Return last pts value that reached vf_vo*/ +#define VFCTRL_SET_DEINTERLACE 18 /* Set deinterlacing status */ +#define VFCTRL_GET_DEINTERLACE 19 /* Get deinterlacing status */ #include "vfcap.h" diff --git a/libmpcodecs/vf_vo.c b/libmpcodecs/vf_vo.c index a7b2c48918..75e4c08a0e 100644 --- a/libmpcodecs/vf_vo.c +++ b/libmpcodecs/vf_vo.c @@ -76,6 +76,18 @@ static int config(struct vf_instance_s* vf, static int control(struct vf_instance_s* vf, int request, void* data) { switch(request){ + case VFCTRL_GET_DEINTERLACE: + { + if(!video_out) return CONTROL_FALSE; // vo not configured? + return(video_out->control(VOCTRL_GET_DEINTERLACE, data) + == VO_TRUE) ? CONTROL_TRUE : CONTROL_FALSE; + } + case VFCTRL_SET_DEINTERLACE: + { + if(!video_out) return CONTROL_FALSE; // vo not configured? + return(video_out->control(VOCTRL_SET_DEINTERLACE, data) + == VO_TRUE) ? CONTROL_TRUE : CONTROL_FALSE; + } #ifdef USE_OSD case VFCTRL_DRAW_OSD: if(!vo_config_count) return CONTROL_FALSE; // vo not configured? diff --git a/libvo/video_out.h b/libvo/video_out.h index 5c74c7e49d..b2e7dadc57 100644 --- a/libvo/video_out.h +++ b/libvo/video_out.h @@ -65,6 +65,9 @@ typedef struct { int mt, mb, ml, mr; // borders (top, bottom, left, right) } mp_eosd_res_t; +#define VOCTRL_SET_DEINTERLACE 30 +#define VOCTRL_GET_DEINTERLACE 31 + // Vo can be used by xover #define VOCTRL_XOVERLAY_SUPPORT 22 diff --git a/libvo/vo_xvmc.c b/libvo/vo_xvmc.c index de86e0facd..a9cc9884e8 100644 --- a/libvo/vo_xvmc.c +++ b/libvo/vo_xvmc.c @@ -1379,6 +1379,15 @@ return VO_TRUE; static int control(uint32_t request, void *data, ... ) { switch (request){ + case VOCTRL_GET_DEINTERLACE: + *(int*)data = bob_deinterlace; + return VO_TRUE; + case VOCTRL_SET_DEINTERLACE: + if (*(int*)data == -1) + bob_deinterlace = !bob_deinterlace; + else + bob_deinterlace = *(int*)data; + return VO_TRUE; case VOCTRL_QUERY_FORMAT: return query_format(*((uint32_t*)data)); case VOCTRL_DRAW_IMAGE: diff --git a/mplayer.c b/mplayer.c index 013ac487ab..a266175f31 100644 --- a/mplayer.c +++ b/mplayer.c @@ -1926,6 +1926,29 @@ static int mp_property_fullscreen(m_option_t* prop,int action,void* arg) { } } +static int mp_property_deinterlace(m_option_t* prop,int action,void* arg) { + int toggle = -1; + vf_instance_t *vf; + if (!sh_video || !sh_video->vfilter) return M_PROPERTY_UNAVAILABLE; + vf = sh_video->vfilter; + switch(action) { + case M_PROPERTY_GET: + if(!arg) return M_PROPERTY_ERROR; + vf->control(sh_video->vfilter, VFCTRL_GET_DEINTERLACE, arg); + return M_PROPERTY_OK; + case M_PROPERTY_SET: + if(!arg) return M_PROPERTY_ERROR; + M_PROPERTY_CLAMP(prop,*(int*)arg); + vf->control(sh_video->vfilter, VFCTRL_SET_DEINTERLACE, arg); + return M_PROPERTY_OK; + case M_PROPERTY_STEP_UP: + case M_PROPERTY_STEP_DOWN: + vf->control(sh_video->vfilter, VFCTRL_SET_DEINTERLACE, &toggle); + return M_PROPERTY_OK; + } + return M_PROPERTY_NOT_IMPLEMENTED; +} + /// Panscan (RW) static int mp_property_panscan(m_option_t* prop,int action,void* arg) { @@ -2470,6 +2493,8 @@ static m_option_t mp_properties[] = { // Video { "fullscreen", mp_property_fullscreen, CONF_TYPE_FLAG, M_OPT_RANGE, 0, 1, NULL }, + { "deinterlace", mp_property_deinterlace, CONF_TYPE_FLAG, + M_OPT_RANGE, 0, 1, NULL }, { "ontop", mp_property_ontop, CONF_TYPE_FLAG, M_OPT_RANGE, 0, 1, NULL }, { "rootwin", mp_property_rootwin, CONF_TYPE_FLAG,