From 0c9392449485c088d8aa25cb8b510c1489050537 Mon Sep 17 00:00:00 2001 From: arpi Date: Sun, 7 Apr 2002 17:42:31 +0000 Subject: [PATCH] vf control codes added, autoq support git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@5520 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/Makefile | 2 +- libmpcodecs/ad.c | 1 + libmpcodecs/dec_video.c | 21 +++++++++++++++++++-- libmpcodecs/vf.h | 7 +++++++ libmpcodecs/vf_pp.c | 12 ++++++++++++ libmpcodecs/vf_vo.c | 2 +- 6 files changed, 41 insertions(+), 4 deletions(-) diff --git a/libmpcodecs/Makefile b/libmpcodecs/Makefile index 2cc414b091..27e90b739b 100644 --- a/libmpcodecs/Makefile +++ b/libmpcodecs/Makefile @@ -3,7 +3,7 @@ include ../config.mak LIBNAME = libmpcodecs.a -AUDIO_SRCS=dec_audio.c ad.c ad_a52.c ad_acm.c ad_alaw.c ad_dk3adpcm.c ad_dshow.c ad_dvdpcm.c ad_ffmpeg.c ad_hwac3.c ad_imaadpcm.c ad_mp3.c ad_msadpcm.c ad_pcm.c ad_roqaudio.c ad_msgsm.c ad_faad.c ad_vorbis.c ad_libmad.c +AUDIO_SRCS=dec_audio.c ad.c ad_a52.c ad_acm.c ad_alaw.c ad_dk3adpcm.c ad_dk4adpcm.c ad_dshow.c ad_dvdpcm.c ad_ffmpeg.c ad_hwac3.c ad_imaadpcm.c ad_mp3.c ad_msadpcm.c ad_pcm.c ad_roqaudio.c ad_msgsm.c ad_faad.c ad_vorbis.c ad_libmad.c VIDEO_SRCS=dec_video.c vd.c vd_null.c vd_cinepak.c vd_qtrpza.c vd_ffmpeg.c vd_dshow.c vd_vfw.c vd_odivx.c vd_divx4.c vd_raw.c vd_xanim.c vd_msvidc.c vd_fli.c vd_qtrle.c vd_qtsmc.c vd_roqvideo.c vd_cyuv.c vd_nuv.c vd_libmpeg2.c vd_msrle.c vd_huffyuv.c vd_zlib.c vd_mpegpes.c VFILTER_SRCS=vf.c vf_vo.c vf_crop.c vf_expand.c vf_pp.c diff --git a/libmpcodecs/ad.c b/libmpcodecs/ad.c index d60d428886..e2c7569f6d 100644 --- a/libmpcodecs/ad.c +++ b/libmpcodecs/ad.c @@ -26,6 +26,7 @@ extern ad_functions_t mpcodecs_ad_alaw; extern ad_functions_t mpcodecs_ad_imaadpcm; extern ad_functions_t mpcodecs_ad_msadpcm; extern ad_functions_t mpcodecs_ad_dk3adpcm; +extern ad_functions_t mpcodecs_ad_dk4adpcm; extern ad_functions_t mpcodecs_ad_roqaudio; extern ad_functions_t mpcodecs_ad_dshow; extern ad_functions_t mpcodecs_ad_acm; diff --git a/libmpcodecs/dec_video.c b/libmpcodecs/dec_video.c index 936be20e22..cb6186534d 100644 --- a/libmpcodecs/dec_video.c +++ b/libmpcodecs/dec_video.c @@ -45,14 +45,31 @@ int divx_quality=0; vd_functions_t* mpvdec=NULL; int get_video_quality_max(sh_video_t *sh_video){ + vf_instance_t* vf=sh_video->vfilter; + if(vf){ + int ret=vf->control(vf,VFCTRL_QUERY_MAX_PP_LEVEL,NULL); + if(ret>0){ + mp_msg(MSGT_DECVIDEO,MSGL_INFO,"[PP] Using external postprocessing filter, max q = %d\n",ret); + return ret; + } + } if(mpvdec){ int ret=mpvdec->control(sh_video,VDCTRL_QUERY_MAX_PP_LEVEL,NULL); - if(ret>=0) return ret; + if(ret>0){ + mp_msg(MSGT_DECVIDEO,MSGL_INFO,"[PP] Using codec's postprocessing, max q = %d\n",ret); + return ret; + } } - return 0; + mp_msg(MSGT_DECVIDEO,MSGL_INFO,"[PP] Sorry, postprocessing is not available\n"); + return 0; } void set_video_quality(sh_video_t *sh_video,int quality){ + vf_instance_t* vf=sh_video->vfilter; + if(vf){ + int ret=vf->control(vf,VFCTRL_SET_PP_LEVEL, (void*)(&quality)); + if(ret==CONTROL_TRUE) return; // success + } if(mpvdec) mpvdec->control(sh_video,VDCTRL_SET_PP_LEVEL, (void*)(&quality)); } diff --git a/libmpcodecs/vf.h b/libmpcodecs/vf.h index 861393fc72..27ac46bd4e 100644 --- a/libmpcodecs/vf.h +++ b/libmpcodecs/vf.h @@ -40,6 +40,13 @@ typedef struct vf_instance_s { struct vf_priv_s* priv; } vf_instance_t; +// control codes: +#include "mpc_info.h" + +#define VFCTRL_QUERY_MAX_PP_LEVEL 4 /* test for postprocessing support (max level) */ +#define VFCTRL_SET_PP_LEVEL 5 /* set postprocessing level */ +#define VFCTRL_SET_EQUALIZER 6 /* set color options (brightness,contrast etc) */ + // functions: mp_image_t* vf_get_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype, int mp_imgflag, int w, int h); vf_instance_t* vf_open_filter(vf_instance_t* next, char *name, char *args); diff --git a/libmpcodecs/vf_pp.c b/libmpcodecs/vf_pp.c index 12939e8740..546da060b6 100644 --- a/libmpcodecs/vf_pp.c +++ b/libmpcodecs/vf_pp.c @@ -28,6 +28,17 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt){ return 0; } +static int control(struct vf_instance_s* vf, int request, void* data){ + switch(request){ + case VFCTRL_QUERY_MAX_PP_LEVEL: + return GET_PP_QUALITY_MAX; + case VFCTRL_SET_PP_LEVEL: + vf->priv->pp=getPpModeForQuality(*((unsigned int*)data)); + return CONTROL_TRUE; + } + return vf_next_control(vf,request,data); +} + static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){ if(vf->priv->pp&0xFFFF) return; // non-local filters enabled if((mpi->type==MP_IMGTYPE_IPB || vf->priv->pp) && @@ -74,6 +85,7 @@ extern int divx_quality; static int open(vf_instance_t *vf, char* args){ char *endptr; vf->query_format=query_format; + vf->control=control; vf->get_image=get_image; vf->put_image=put_image; vf->priv=malloc(sizeof(struct vf_priv_s)); diff --git a/libmpcodecs/vf_vo.c b/libmpcodecs/vf_vo.c index d2fb9e2672..b0c876c731 100644 --- a/libmpcodecs/vf_vo.c +++ b/libmpcodecs/vf_vo.c @@ -26,7 +26,7 @@ static int config(struct vf_instance_s* vf, static int control(struct vf_instance_s* vf, int request, void* data){ // return video_out->control(request,data); - return -3; + return CONTROL_UNKNOWN; } static int query_format(struct vf_instance_s* vf, unsigned int fmt){