# HG changeset patch # User michaelni # Date 1059735665 0 # Node ID 951a4448c05a10f890310a1b233456f6f8414553 # Parent ba99a78bcb3780d0e52159be78ddefc6c93f4309 FF_INPUT_BUFFER_PADDING_SIZE diff -r ba99a78bcb37 -r 951a4448c05a apiexample.c --- a/apiexample.c Fri Aug 01 11:00:03 2003 +0000 +++ b/apiexample.c Fri Aug 01 11:01:05 2003 +0000 @@ -98,9 +98,12 @@ int out_size, size, len; FILE *f, *outfile; uint8_t *outbuf; - uint8_t inbuf[INBUF_SIZE], *inbuf_ptr; + uint8_t inbuf[INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE], *inbuf_ptr; printf("Audio decoding\n"); + + /* set end of buffer to 0 (this ensures that no overreading happens for damaged mpeg streams) */ + memset(inbuf + INBUF_SIZE, 0, FF_INPUT_BUFFER_PADDING_SIZE); /* find the mpeg audio decoder */ codec = avcodec_find_decoder(CODEC_ID_MP2); @@ -297,9 +300,12 @@ int frame, size, got_picture, len; FILE *f; AVFrame *picture; - uint8_t inbuf[INBUF_SIZE], *inbuf_ptr; + uint8_t inbuf[INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE], *inbuf_ptr; char buf[1024]; + /* set end of buffer to 0 (this ensures that no overreading happens for damaged mpeg streams) */ + memset(inbuf + INBUF_SIZE, 0, FF_INPUT_BUFFER_PADDING_SIZE); + printf("Video decoding\n"); /* find the mpeg1 video decoder */