1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-27 17:42:17 +00:00

vf control codes added, autoq support

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@5520 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
arpi 2002-04-07 17:42:31 +00:00
parent 76756940e4
commit 0c93924494
6 changed files with 41 additions and 4 deletions

View File

@ -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

View File

@ -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;

View File

@ -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));
}

View File

@ -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);

View File

@ -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));

View File

@ -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){