Mercurial > mplayer.hg
comparison libmpcodecs/vf_lavc.c @ 6019:5c3b0b165f3a
FPS autodetection, accept args: quality:fps
author | arpi |
---|---|
date | Wed, 08 May 2002 22:11:14 +0000 |
parents | 5ebafc7f5efe |
children | 8eff71f38685 |
comparison
equal
deleted
inserted
replaced
6018:978e650f16f4 | 6019:5c3b0b165f3a |
---|---|
40 unsigned int flags, unsigned int outfmt){ | 40 unsigned int flags, unsigned int outfmt){ |
41 if(vf_next_query_format(vf,IMGFMT_MPEGPES)<=0) return 0; | 41 if(vf_next_query_format(vf,IMGFMT_MPEGPES)<=0) return 0; |
42 | 42 |
43 lavc_venc_context.width = width; | 43 lavc_venc_context.width = width; |
44 lavc_venc_context.height = height; | 44 lavc_venc_context.height = height; |
45 | |
46 if(!lavc_venc_context.frame_rate){ | |
47 // guess FPS: | |
48 switch(height){ | |
49 case 240: | |
50 case 480: | |
51 lavc_venc_context.frame_rate=29.97*FRAME_RATE_BASE; // NTSC | |
52 break; | |
53 case 576: | |
54 case 288: | |
55 default: | |
56 lavc_venc_context.frame_rate=25*FRAME_RATE_BASE; // PAL | |
57 break; | |
58 // lavc_venc_context.frame_rate=vo_fps*FRAME_RATE_BASE; // same as src | |
59 } | |
60 } | |
45 | 61 |
46 if(vf->priv->outbuf) free(vf->priv->outbuf); | 62 if(vf->priv->outbuf) free(vf->priv->outbuf); |
47 | 63 |
48 vf->priv->outbuf_size=10000+width*height; // must be enough! | 64 vf->priv->outbuf_size=10000+width*height; // must be enough! |
49 if(vf->priv->outbuf) free(vf->priv->outbuf); | 65 if(vf->priv->outbuf) free(vf->priv->outbuf); |
104 } | 120 } |
105 return 0; | 121 return 0; |
106 } | 122 } |
107 | 123 |
108 static int open(vf_instance_t *vf, char* args){ | 124 static int open(vf_instance_t *vf, char* args){ |
125 int p_quality=0; | |
126 float p_fps=0; | |
127 | |
109 vf->config=config; | 128 vf->config=config; |
110 vf->put_image=put_image; | 129 vf->put_image=put_image; |
111 vf->query_format=query_format; | 130 vf->query_format=query_format; |
112 vf->priv=malloc(sizeof(struct vf_priv_s)); | 131 vf->priv=malloc(sizeof(struct vf_priv_s)); |
113 memset(vf->priv,0,sizeof(struct vf_priv_s)); | 132 memset(vf->priv,0,sizeof(struct vf_priv_s)); |
123 mp_msg(MSGT_MENCODER,MSGL_ERR,MSGTR_MissingLAVCcodec, "mpeg1video"); | 142 mp_msg(MSGT_MENCODER,MSGL_ERR,MSGTR_MissingLAVCcodec, "mpeg1video"); |
124 return 0; | 143 return 0; |
125 } | 144 } |
126 | 145 |
127 // TODO: parse args -> | 146 // TODO: parse args -> |
128 lavc_venc_context.bit_rate = 8000000; | 147 if(args) sscanf(args, "%d:%f", &p_quality, &p_fps); |
129 lavc_venc_context.frame_rate = 25 * FRAME_RATE_BASE; | 148 |
149 if(p_quality<32){ | |
150 // fixed qscale | |
151 lavc_venc_context.flags = CODEC_FLAG_QSCALE; | |
152 lavc_venc_context.quality = (p_quality<1) ? 1 : p_quality; | |
153 } else { | |
154 // fixed bitrate (in kbits) | |
155 lavc_venc_context.bit_rate = 1000*p_quality; | |
156 } | |
157 lavc_venc_context.frame_rate = (p_fps<1.0) ? 0 : (p_fps * FRAME_RATE_BASE); | |
130 lavc_venc_context.qmin= 1; | 158 lavc_venc_context.qmin= 1; |
131 lavc_venc_context.gop_size = 0; // I-only | 159 lavc_venc_context.gop_size = 0; // I-only |
132 lavc_venc_context.flags = CODEC_FLAG_QSCALE; | |
133 lavc_venc_context.quality = 1; | |
134 | 160 |
135 return 1; | 161 return 1; |
136 } | 162 } |
137 | 163 |
138 vf_info_t vf_info_lavc = { | 164 vf_info_t vf_info_lavc = { |