[MPlayer-cvslog] CVS: main/libmpcodecs ve_lavc.c,1.135,1.136

Michael Niedermayer CVS syncmail at mplayerhq.hu
Tue Mar 21 23:12:51 CET 2006


CVS change done by Michael Niedermayer CVS

Update of /cvsroot/mplayer/main/libmpcodecs
In directory mail:/var2/tmp/cvs-serv6245

Modified Files:
	ve_lavc.c 
Log Message:
10l (null pointer dereference)


Index: ve_lavc.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/ve_lavc.c,v
retrieving revision 1.135
retrieving revision 1.136
diff -u -r1.135 -r1.136
--- ve_lavc.c	21 Mar 2006 21:26:40 -0000	1.135
+++ ve_lavc.c	21 Mar 2006 22:12:48 -0000	1.136
@@ -854,6 +854,7 @@
 static int encode_frame(struct vf_instance_s* vf, AVFrame *pic, double pts){
     const char pict_type_char[5]= {'?', 'I', 'P', 'B', 'S'};
     int out_size;
+    double dts;
 
     if(pic){
         pic->opaque= malloc(sizeof(pts));
@@ -862,15 +863,24 @@
 	out_size = avcodec_encode_video(lavc_venc_context, mux_v->buffer, mux_v->buffer_size,
 	    pic);
 
+    if(pts != MP_NOPTS_VALUE) 
+        dts= pts - lavc_venc_context->delay * av_q2d(lavc_venc_context->time_base);
+    else
+        dts= MP_NOPTS_VALUE;
+
+    pts= lavc_venc_context->coded_frame->opaque ?
+           *(double*)lavc_venc_context->coded_frame->opaque
+         : MP_NOPTS_VALUE;
+
     if(out_size == 0) {
         ++mux_v->encoder_delay;
         return 0;
     }
            
     muxer_write_chunk(mux_v,out_size,lavc_venc_context->coded_frame->key_frame?0x10:0, 
-                      pts, 
-                      *(double*)lavc_venc_context->coded_frame->opaque);
+                      dts, pts);
     free(lavc_venc_context->coded_frame->opaque);
+    lavc_venc_context->coded_frame->opaque= NULL;
         
 #if LIBAVCODEC_BUILD >= 4643
     /* store psnr / pict size / type / qscale */




More information about the MPlayer-cvslog mailing list