diff options
author | michael <michael@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-03-21 22:12:48 +0000 |
---|---|---|
committer | michael <michael@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-03-21 22:12:48 +0000 |
commit | 565af71e4f3bc346dc8ade02d1965e51829b4462 (patch) | |
tree | d606dc6045ef264dd70ea520257dc742a1883658 /libmpcodecs | |
parent | 02b199e5e93926cc106774068eb3e883826c3ae4 (diff) |
10l (null pointer dereference)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17908 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs')
-rw-r--r-- | libmpcodecs/ve_lavc.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/libmpcodecs/ve_lavc.c b/libmpcodecs/ve_lavc.c index d08d4c4a25..afca8612cd 100644 --- a/libmpcodecs/ve_lavc.c +++ b/libmpcodecs/ve_lavc.c @@ -854,6 +854,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){ 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 @@ static int encode_frame(struct vf_instance_s* vf, AVFrame *pic, double pts){ 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 */ |