[MPlayer-cvslog] r36423 - trunk/libvo/vo_png.c
al
subversion at mplayerhq.hu
Wed Aug 14 12:16:47 CEST 2013
Author: al
Date: Wed Aug 14 12:16:46 2013
New Revision: 36423
Log:
vo png: Switch to avcodec_encode_video2
The older function is deprecated and the newer function seems to not
have the minimum buffer size limitation.
Patch by Jiang Jiang >gzjjgod at gmail com<
Modified:
trunk/libvo/vo_png.c
Modified: trunk/libvo/vo_png.c
==============================================================================
--- trunk/libvo/vo_png.c Tue Aug 13 22:45:51 2013 (r36422)
+++ trunk/libvo/vo_png.c Wed Aug 14 12:16:46 2013 (r36423)
@@ -146,9 +146,10 @@ config(uint32_t width, uint32_t height,
static uint32_t draw_image(mp_image_t* mpi){
AVFrame pic;
int buffersize;
- int res;
+ int res, got_pkt;
char buf[100];
FILE *outfile;
+ AVPacket pkt;
// if -dr or -slices then do nothing:
if(mpi->flags&(MP_IMGFLAG_DIRECT|MP_IMGFLAG_DRAW_CALLBACK)) return VO_TRUE;
@@ -170,7 +171,10 @@ static uint32_t draw_image(mp_image_t* m
outbuffer = av_malloc(buffersize);
outbuffer_size = buffersize;
}
- res = avcodec_encode_video(avctx, outbuffer, outbuffer_size, &pic);
+ av_init_packet(&pkt);
+ pkt.data = outbuffer;
+ pkt.size = outbuffer_size;
+ res = avcodec_encode_video2(avctx, &pkt, &pic, &got_pkt);
if(res < 0){
mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_PNG_ErrorInCreatePng);
@@ -178,7 +182,7 @@ static uint32_t draw_image(mp_image_t* m
return 1;
}
- fwrite(outbuffer, res, 1, outfile);
+ fwrite(outbuffer, pkt.size, 1, outfile);
fclose(outfile);
return VO_TRUE;
More information about the MPlayer-cvslog
mailing list