diff --git a/libmpcodecs/ve_divx4.c b/libmpcodecs/ve_divx4.c index c272efbe1f..c990ca4117 100644 --- a/libmpcodecs/ve_divx4.c +++ b/libmpcodecs/ve_divx4.c @@ -72,6 +72,13 @@ static int config(struct vf_instance_s* vf, else if(divx4_param.bitrate<=16000) divx4_param.bitrate*=1000; if(!divx4_param.quality) divx4_param.quality=5; // the quality of compression ( 1 - fastest, 5 - best ) + // set some usefull defaults: + if(!divx4_param.min_quantizer) divx4_param.min_quantizer=2; + if(!divx4_param.max_quantizer) divx4_param.max_quantizer=31; + if(!divx4_param.rc_period) divx4_param.rc_period=2000; + if(!divx4_param.rc_reaction_period) divx4_param.rc_reaction_period=10; + if(!divx4_param.rc_reaction_ratio) divx4_param.rc_reaction_ratio=20; + divx4_param.handle=NULL; encore(NULL,ENC_OPT_INIT,&divx4_param,NULL); vf->priv->enc_handle=divx4_param.handle; @@ -157,7 +164,7 @@ static void put_image(struct vf_instance_s* vf, mp_image_t *mpi){ enc_result.quantizer); } } - mencoder_write_frame(mux_v,vf->priv->enc_frame.length,enc_result.is_key_frame?0x10:0); + mencoder_write_chunk(mux_v,vf->priv->enc_frame.length,enc_result.is_key_frame?0x10:0); } //===========================================================================// diff --git a/libmpcodecs/ve_lavc.c b/libmpcodecs/ve_lavc.c index a29104055a..d50776e697 100644 --- a/libmpcodecs/ve_lavc.c +++ b/libmpcodecs/ve_lavc.c @@ -225,9 +225,14 @@ static void put_image(struct vf_instance_s* vf, mp_image_t *mpi){ mencoder_write_chunk(mux_v,out_size,lavc_venc_context.key_frame?0x10:0); } +static void uninit(struct vf_instance_s* vf){ + avcodec_close(&lavc_venc_context); +} + //===========================================================================// static int vf_open(vf_instance_t *vf, char* args){ + vf->uninit=uninit; vf->config=config; vf->control=control; vf->query_format=query_format; diff --git a/libmpcodecs/ve_rawrgb.c b/libmpcodecs/ve_rawrgb.c index 813c66d3b7..9c8de9c492 100644 --- a/libmpcodecs/ve_rawrgb.c +++ b/libmpcodecs/ve_rawrgb.c @@ -66,6 +66,7 @@ static int vf_open(vf_instance_t *vf, char* args){ mux_v->bih->biHeight=0; mux_v->bih->biCompression=0; mux_v->bih->biPlanes=1; + mux_v->bih->biBitCount=24; return 1; } diff --git a/libmpcodecs/ve_vfw.c b/libmpcodecs/ve_vfw.c index fecf6754ec..71512ec0eb 100644 --- a/libmpcodecs/ve_vfw.c +++ b/libmpcodecs/ve_vfw.c @@ -37,9 +37,12 @@ static int config(struct vf_instance_s* vf, vfw_bih->biWidth=width; vfw_bih->biHeight=height; vfw_bih->biSizeImage=width*height*((vfw_bih->biBitCount+7)/8); - mux_v->bih->biWidth=width; - mux_v->bih->biHeight=height; - mux_v->bih->biSizeImage=width*height*((mux_v->bih->biBitCount+7)/8); + + if(!vfw_start_encoder(vfw_bih, mux_v->bih)) return 0; + +// mux_v->bih->biWidth=width; +// mux_v->bih->biHeight=height; +// mux_v->bih->biSizeImage=width*height*((mux_v->bih->biBitCount+7)/8); return 1; }