On Sat, 26 Nov 2011 17:07:08 -0500, Justin Ruggles <[email protected]> 
wrote:
> ---
>  libavcodec/api-example.c |   18 +++++++++---------
>  1 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/libavcodec/api-example.c b/libavcodec/api-example.c
> index ec71b0d..d9472b9 100644
> --- a/libavcodec/api-example.c
> +++ b/libavcodec/api-example.c
> @@ -118,9 +118,8 @@ static void audio_decode_example(const char *outfilename, 
> const char *filename)
>  {
>      AVCodec *codec;
>      AVCodecContext *c= NULL;
> -    int out_size, len;
> +    int len;
>      FILE *f, *outfile;
> -    uint8_t *outbuf;
>      uint8_t inbuf[AUDIO_INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE];
>      AVPacket avpkt;
>  
> @@ -143,8 +142,6 @@ static void audio_decode_example(const char *outfilename, 
> const char *filename)
>          exit(1);
>      }
>  
> -    outbuf = malloc(AVCODEC_MAX_AUDIO_FRAME_SIZE);
> -
>      f = fopen(filename, "rb");
>      if (!f) {
>          fprintf(stderr, "could not open %s\n", filename);
> @@ -161,15 +158,19 @@ static void audio_decode_example(const char 
> *outfilename, const char *filename)
>      avpkt.size = fread(inbuf, 1, AUDIO_INBUF_SIZE, f);
>  
>      while (avpkt.size > 0) {
> -        out_size = AVCODEC_MAX_AUDIO_FRAME_SIZE;
> -        len = avcodec_decode_audio3(c, (short *)outbuf, &out_size, &avpkt);
> +        AVFrame decoded_frame;

Please allocate the frame properly, sizeof(AVFrame) isn't part of the
ABI so our examples shouldn't pretend it is.

-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to