[Mplayer-cvslog] CVS: main/libmpcodecs vf_lavc.c,1.2,1.3
Arpi of Ize
arpi at mplayerhq.hu
Thu May 9 00:11:17 CEST 2002
Update of /cvsroot/mplayer/main/libmpcodecs
In directory mail:/var/tmp.root/cvs-serv2339
Modified Files:
vf_lavc.c
Log Message:
FPS autodetection, accept args: quality:fps
Index: vf_lavc.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vf_lavc.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- vf_lavc.c 28 Apr 2002 00:16:22 -0000 1.2
+++ vf_lavc.c 8 May 2002 22:11:14 -0000 1.3
@@ -42,6 +42,22 @@
lavc_venc_context.width = width;
lavc_venc_context.height = height;
+
+ if(!lavc_venc_context.frame_rate){
+ // guess FPS:
+ switch(height){
+ case 240:
+ case 480:
+ lavc_venc_context.frame_rate=29.97*FRAME_RATE_BASE; // NTSC
+ break;
+ case 576:
+ case 288:
+ default:
+ lavc_venc_context.frame_rate=25*FRAME_RATE_BASE; // PAL
+ break;
+// lavc_venc_context.frame_rate=vo_fps*FRAME_RATE_BASE; // same as src
+ }
+ }
if(vf->priv->outbuf) free(vf->priv->outbuf);
@@ -106,6 +122,9 @@
}
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;
@@ -125,12 +144,19 @@
}
// TODO: parse args ->
- lavc_venc_context.bit_rate = 8000000;
- lavc_venc_context.frame_rate = 25 * FRAME_RATE_BASE;
+ if(args) sscanf(args, "%d:%f", &p_quality, &p_fps);
+
+ if(p_quality<32){
+ // fixed qscale
+ lavc_venc_context.flags = CODEC_FLAG_QSCALE;
+ lavc_venc_context.quality = (p_quality<1) ? 1 : p_quality;
+ } else {
+ // fixed bitrate (in kbits)
+ lavc_venc_context.bit_rate = 1000*p_quality;
+ }
+ lavc_venc_context.frame_rate = (p_fps<1.0) ? 0 : (p_fps * FRAME_RATE_BASE);
lavc_venc_context.qmin= 1;
lavc_venc_context.gop_size = 0; // I-only
- lavc_venc_context.flags = CODEC_FLAG_QSCALE;
- lavc_venc_context.quality = 1;
return 1;
}
More information about the MPlayer-cvslog
mailing list