[MPlayer-cvslog] CVS: main/libmpcodecs ve_lavc.c,1.105,1.106
Loren Merritt CVS
syncmail at mplayerhq.hu
Wed Dec 1 21:32:07 CET 2004
- Previous message: [MPlayer-cvslog] CVS: main/libvo gl_common.c, 1.2, 1.3 gl_common.h, 1.3, 1.4 vo_gl2.c, 1.58, 1.59 vo_gl.c, 1.59, 1.60
- Next message: [MPlayer-cvslog] CVS: main/libvo vo_quartz.c,1.43,1.44
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
CVS change done by Loren Merritt CVS
Update of /cvsroot/mplayer/main/libmpcodecs
In directory mail:/var2/tmp/cvs-serv31850
Modified Files:
ve_lavc.c
Log Message:
suppress dummy frames due to B-frame delay.
flush delayed frames.
Index: ve_lavc.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/ve_lavc.c,v
retrieving revision 1.105
retrieving revision 1.106
diff -u -r1.105 -r1.106
--- ve_lavc.c 28 Nov 2004 18:37:49 -0000 1.105
+++ ve_lavc.c 1 Dec 2004 20:32:05 -0000 1.106
@@ -324,6 +324,8 @@
#define FF_QP2LAMBDA 1
#endif
+static int encode_frame(struct vf_instance_s* vf, AVFrame *pic);
+
static int config(struct vf_instance_s* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
@@ -740,7 +742,14 @@
static int control(struct vf_instance_s* vf, int request, void* data){
- return CONTROL_UNKNOWN;
+ switch(request){
+ case VFCTRL_FLUSH_FRAMES:
+ if(vf->priv->codec->capabilities & CODEC_CAP_DELAY)
+ while(encode_frame(vf, NULL) > 0);
+ return CONTROL_TRUE;
+ default:
+ return CONTROL_UNKNOWN;
+ }
}
static int query_format(struct vf_instance_s* vf, unsigned int fmt){
@@ -781,8 +790,6 @@
}
static int put_image(struct vf_instance_s* vf, mp_image_t *mpi){
- const char pict_type_char[5]= {'?', 'I', 'P', 'B', 'S'};
- int out_size;
AVFrame *pic= vf->priv->pic;
pic->data[0]=mpi->planes[0];
@@ -804,9 +811,18 @@
}
#endif
+ return (encode_frame(vf, pic) >= 0);
+}
+
+static int encode_frame(struct vf_instance_s* vf, AVFrame *pic){
+ const char pict_type_char[5]= {'?', 'I', 'P', 'B', 'S'};
+ int out_size;
+
out_size = avcodec_encode_video(lavc_venc_context, mux_v->buffer, mux_v->buffer_size,
pic);
+ if(out_size == 0)
+ return 0;
muxer_write_chunk(mux_v,out_size,lavc_venc_context->coded_frame->key_frame?0x10:0);
@@ -835,7 +851,7 @@
perror("fopen");
lavc_param_psnr=0; // disable block
mp_msg(MSGT_MENCODER,MSGL_ERR,"Can't open %s for writing. Check its permissions.\n",filename);
- return 0;
+ return -1;
/*exit(1);*/
}
}
@@ -870,7 +886,7 @@
/* store stats if there are any */
if(lavc_venc_context->stats_out && stats_file)
fprintf(stats_file, "%s", lavc_venc_context->stats_out);
- return 1;
+ return out_size;
}
static void uninit(struct vf_instance_s* vf){
- Previous message: [MPlayer-cvslog] CVS: main/libvo gl_common.c, 1.2, 1.3 gl_common.h, 1.3, 1.4 vo_gl2.c, 1.58, 1.59 vo_gl.c, 1.59, 1.60
- Next message: [MPlayer-cvslog] CVS: main/libvo vo_quartz.c,1.43,1.44
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the MPlayer-cvslog
mailing list