[Mplayer-cvslog] CVS: main/libmpcodecs vf_fame.c,1.6,1.7

Arpi of Ize arpi at mplayerhq.hu
Sat Jun 1 22:57:29 CEST 2002


Update of /cvsroot/mplayer/main/libmpcodecs
In directory mail:/var/tmp.root/cvs-serv7679

Modified Files:
	vf_fame.c 
Log Message:
fame=quality:fps args support, small fixes for 0.9.0 api


Index: vf_fame.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vf_fame.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- vf_fame.c	1 Jun 2002 20:27:14 -0000	1.6
+++ vf_fame.c	1 Jun 2002 20:57:26 -0000	1.7
@@ -47,7 +47,6 @@
 
 static void put_image(struct vf_instance_s* vf, mp_image_t *mpi){
     fame_yuv_t yuv;
-    fame_frame_statistics_t stats;
     mp_image_t *dmpi;
     int out_size;
 
@@ -61,7 +60,7 @@
 //    out_size = fame_encode_frame(vf->priv->ctx, &yuv, NULL);
     fame_start_frame(vf->priv->ctx, &yuv, NULL);
     out_size = fame_encode_slice(vf->priv->ctx);
-    fame_end_frame(vf->priv->ctx, &stats);
+    fame_end_frame(vf->priv->ctx, NULL);
     
     if(out_size<=0) return;
 
@@ -93,11 +92,13 @@
 }
 
 static int open(vf_instance_t *vf, char* args){
+    int p_quality=0;
+    float p_fps=0;
+
     vf->config=config;
     vf->put_image=put_image;
     vf->query_format=query_format;
     vf->priv=malloc(sizeof(struct vf_priv_s));
-    vf->default_caps=0;
     memset(vf->priv,0,sizeof(struct vf_priv_s));
 
     vf->priv->ctx=fame_open();
@@ -107,13 +108,30 @@
     }
 
     // TODO: parse args ->
+    if(args) sscanf(args, "%d:%f", &p_quality, &p_fps);
+
+    if(p_quality<=100){
+	// fixed quality
+	vf->priv->params.quality=p_quality?p_quality:QUALITY;
+	vf->priv->params.bitrate=0;
+    } else {
+	// fixed bitrate (in kbits)
+	vf->priv->params.quality=QUALITY;
+	vf->priv->params.bitrate=1000*p_quality;
+    }
+
+    if(p_fps<1) p_fps=25.0;
+    if(p_fps == ((int)p_fps)){
+	vf->priv->params.frame_rate_num=p_fps;
+	vf->priv->params.frame_rate_den=1;
+    } else {
+	vf->priv->params.frame_rate_num=p_fps*1001;
+	vf->priv->params.frame_rate_den=1001;
+    }
+
     vf->priv->params.coding="I";
-    vf->priv->params.quality=QUALITY;
-    vf->priv->params.bitrate=0;
     vf->priv->params.slices_per_frame=1;
-    vf->priv->params.frames_per_sequence=25; //0xffffffff;
-    vf->priv->params.frame_rate_num=25;
-    vf->priv->params.frame_rate_den=1;
+    vf->priv->params.frames_per_sequence=(int)p_fps;
     vf->priv->params.shape_quality=100;
     vf->priv->params.search_range=8; // for "IPPP" only
     vf->priv->params.verbose=0;




More information about the MPlayer-cvslog mailing list