changeset 5519:868c13f78f08

vf control codes added, autoq support
author arpi
date Sun, 07 Apr 2002 17:42:31 +0000
parents 04a40454bdbb
children 25c43bd75e4c
files libmpcodecs/Makefile libmpcodecs/ad.c libmpcodecs/dec_video.c libmpcodecs/vf.h libmpcodecs/vf_pp.c libmpcodecs/vf_vo.c
diffstat 6 files changed, 41 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/Makefile	Sun Apr 07 17:01:15 2002 +0000
+++ b/libmpcodecs/Makefile	Sun Apr 07 17:42:31 2002 +0000
@@ -3,7 +3,7 @@
 
 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
 
--- a/libmpcodecs/ad.c	Sun Apr 07 17:01:15 2002 +0000
+++ b/libmpcodecs/ad.c	Sun Apr 07 17:42:31 2002 +0000
@@ -26,6 +26,7 @@
 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;
--- a/libmpcodecs/dec_video.c	Sun Apr 07 17:01:15 2002 +0000
+++ b/libmpcodecs/dec_video.c	Sun Apr 07 17:42:31 2002 +0000
@@ -45,14 +45,31 @@
 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));
 }
--- a/libmpcodecs/vf.h	Sun Apr 07 17:01:15 2002 +0000
+++ b/libmpcodecs/vf.h	Sun Apr 07 17:42:31 2002 +0000
@@ -40,6 +40,13 @@
     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);
--- a/libmpcodecs/vf_pp.c	Sun Apr 07 17:01:15 2002 +0000
+++ b/libmpcodecs/vf_pp.c	Sun Apr 07 17:42:31 2002 +0000
@@ -28,6 +28,17 @@
     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 @@
 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));
--- a/libmpcodecs/vf_vo.c	Sun Apr 07 17:01:15 2002 +0000
+++ b/libmpcodecs/vf_vo.c	Sun Apr 07 17:42:31 2002 +0000
@@ -26,7 +26,7 @@
 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){