comparison apiexample.c @ 1394:951a4448c05a libavcodec

FF_INPUT_BUFFER_PADDING_SIZE
author michaelni
date Fri, 01 Aug 2003 11:01:05 +0000
parents b47a402bbe7f
children 3a6d613c88d8
comparison
equal deleted inserted replaced
1393:ba99a78bcb37 1394:951a4448c05a
96 AVCodec *codec; 96 AVCodec *codec;
97 AVCodecContext *c= NULL; 97 AVCodecContext *c= NULL;
98 int out_size, size, len; 98 int out_size, size, len;
99 FILE *f, *outfile; 99 FILE *f, *outfile;
100 uint8_t *outbuf; 100 uint8_t *outbuf;
101 uint8_t inbuf[INBUF_SIZE], *inbuf_ptr; 101 uint8_t inbuf[INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE], *inbuf_ptr;
102 102
103 printf("Audio decoding\n"); 103 printf("Audio decoding\n");
104
105 /* set end of buffer to 0 (this ensures that no overreading happens for damaged mpeg streams) */
106 memset(inbuf + INBUF_SIZE, 0, FF_INPUT_BUFFER_PADDING_SIZE);
104 107
105 /* find the mpeg audio decoder */ 108 /* find the mpeg audio decoder */
106 codec = avcodec_find_decoder(CODEC_ID_MP2); 109 codec = avcodec_find_decoder(CODEC_ID_MP2);
107 if (!codec) { 110 if (!codec) {
108 fprintf(stderr, "codec not found\n"); 111 fprintf(stderr, "codec not found\n");
295 AVCodec *codec; 298 AVCodec *codec;
296 AVCodecContext *c= NULL; 299 AVCodecContext *c= NULL;
297 int frame, size, got_picture, len; 300 int frame, size, got_picture, len;
298 FILE *f; 301 FILE *f;
299 AVFrame *picture; 302 AVFrame *picture;
300 uint8_t inbuf[INBUF_SIZE], *inbuf_ptr; 303 uint8_t inbuf[INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE], *inbuf_ptr;
301 char buf[1024]; 304 char buf[1024];
305
306 /* set end of buffer to 0 (this ensures that no overreading happens for damaged mpeg streams) */
307 memset(inbuf + INBUF_SIZE, 0, FF_INPUT_BUFFER_PADDING_SIZE);
302 308
303 printf("Video decoding\n"); 309 printf("Video decoding\n");
304 310
305 /* find the mpeg1 video decoder */ 311 /* find the mpeg1 video decoder */
306 codec = avcodec_find_decoder(CODEC_ID_MPEG1VIDEO); 312 codec = avcodec_find_decoder(CODEC_ID_MPEG1VIDEO);