]> git.sesse.net Git - ffmpeg/commitdiff
Merge commit '2a9e1c122eed66be1b26b747342b848300b226c7'
authorJames Almer <jamrial@gmail.com>
Fri, 14 Sep 2018 02:16:18 +0000 (23:16 -0300)
committerJames Almer <jamrial@gmail.com>
Fri, 14 Sep 2018 02:16:18 +0000 (23:16 -0300)
* commit '2a9e1c122eed66be1b26b747342b848300b226c7':
  libfdk-aac: Don't use defined() in a #define

Merged-by: James Almer <jamrial@gmail.com>
1  2 
libavcodec/libfdk-aacdec.c
libavcodec/libfdk-aacenc.c

index 86f973b0c9025a603aa64738eabbb2f6ef0a36f9,63856232d9e14c2cd8d8ca5454d2d477852b0fe6..1abe1d8438d43797ebc45ebf0422fd7818514d1e
@@@ -2,7 -2,7 +2,7 @@@
   * AAC decoder wrapper
   * Copyright (c) 2012 Martin Storsjo
   *
 - * This file is part of Libav.
 + * This file is part of FFmpeg.
   *
   * Permission to use, copy, modify, and/or distribute this software for any
   * purpose with or without fee is hereby granted, provided that the above
  #include "avcodec.h"
  #include "internal.h"
  
+ #ifdef AACDECODER_LIB_VL0
  #define FDKDEC_VER_AT_LEAST(vl0, vl1) \
-     (defined(AACDECODER_LIB_VL0) && \
-         ((AACDECODER_LIB_VL0 > vl0) || \
-          (AACDECODER_LIB_VL0 == vl0 && AACDECODER_LIB_VL1 >= vl1)))
+     ((AACDECODER_LIB_VL0 > vl0) || \
+      (AACDECODER_LIB_VL0 == vl0 && AACDECODER_LIB_VL1 >= vl1))
+ #else
+ #define FDKDEC_VER_AT_LEAST(vl0, vl1) 0
+ #endif
  
  #if !FDKDEC_VER_AT_LEAST(2, 5) // < 2.5.10
  #define AAC_PCM_MAX_OUTPUT_CHANNELS AAC_PCM_OUTPUT_CHANNELS
@@@ -47,7 -50,7 +50,7 @@@ typedef struct FDKAACDecContext 
      uint8_t *decoder_buffer;
      int decoder_buffer_size;
      uint8_t *anc_buffer;
 -    enum ConcealMethod conceal_method;
 +    int conceal_method;
      int drc_level;
      int drc_boost;
      int drc_heavy;
@@@ -90,7 -93,7 +93,7 @@@ static const AVClass fdk_aac_dec_class 
      .class_name = "libfdk-aac decoder",
      .item_name  = av_default_item_name,
      .option     = fdk_aac_dec_options,
 -    .version    = LIBAVUTIL_VERSION_INT
 +    .version    = LIBAVUTIL_VERSION_INT,
  };
  
  static int get_stream_info(AVCodecContext *avctx)
@@@ -210,8 -213,8 +213,8 @@@ static av_cold int fdk_aac_decode_close
  
      if (s->handle)
          aacDecoder_Close(s->handle);
 -    av_free(s->decoder_buffer);
 -    av_free(s->anc_buffer);
 +    av_freep(&s->decoder_buffer);
 +    av_freep(&s->anc_buffer);
  
      return 0;
  }
@@@ -361,9 -364,10 +364,9 @@@ static int fdk_aac_decode_frame(AVCodec
          goto end;
      frame->nb_samples = avctx->frame_size;
  
 -    if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) {
 -        av_log(avctx, AV_LOG_ERROR, "ff_get_buffer() failed\n");
 +    if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
          goto end;
 -    }
 +
      memcpy(frame->extended_data[0], s->decoder_buffer,
             avctx->channels * avctx->frame_size *
             av_get_bytes_per_sample(avctx->sample_fmt));
index 2d989803c5ab08883ecb017fd9e46d4f97c0b982,3b492ef8f48f65ca70cb6be3ac106ae117b546be..5620bb595118c859dcdabf79a5456869437d8d4e
@@@ -2,7 -2,7 +2,7 @@@
   * AAC encoder wrapper
   * Copyright (c) 2012 Martin Storsjo
   *
 - * This file is part of Libav.
 + * This file is part of FFmpeg.
   *
   * Permission to use, copy, modify, and/or distribute this software for any
   * purpose with or without fee is hereby granted, provided that the above
  #include "audio_frame_queue.h"
  #include "internal.h"
  
+ #ifdef AACENCODER_LIB_VL0
  #define FDKENC_VER_AT_LEAST(vl0, vl1) \
-     (defined(AACENCODER_LIB_VL0) && \
-         ((AACENCODER_LIB_VL0 > vl0) || \
-          (AACENCODER_LIB_VL0 == vl0 && AACENCODER_LIB_VL1 >= vl1)))
+     ((AACENCODER_LIB_VL0 > vl0) || \
+      (AACENCODER_LIB_VL0 == vl0 && AACENCODER_LIB_VL1 >= vl1))
+ #else
+ #define FDKENC_VER_AT_LEAST(vl0, vl1) 0
+ #endif
  
  typedef struct AACContext {
      const AVClass *class;
@@@ -248,7 -251,7 +251,7 @@@ static av_cold int aac_encode_init(AVCo
          }
          if ((err = aacEncoder_SetParam(s->handle, AACENC_BITRATE,
                                         avctx->bit_rate)) != AACENC_OK) {
 -            av_log(avctx, AV_LOG_ERROR, "Unable to set the bitrate %d: %s\n",
 +            av_log(avctx, AV_LOG_ERROR, "Unable to set the bitrate %"PRId64": %s\n",
                     avctx->bit_rate, aac_get_error(err));
              goto error;
          }
@@@ -387,8 -390,10 +390,8 @@@ static int aac_encode_frame(AVCodecCont
      in_buf.bufElSizes        = &in_buffer_element_size;
  
      /* The maximum packet size is 6144 bits aka 768 bytes per channel. */
 -    if ((ret = ff_alloc_packet(avpkt, FFMAX(8192, 768 * avctx->channels)))) {
 -        av_log(avctx, AV_LOG_ERROR, "Error getting output packet\n");
 +    if ((ret = ff_alloc_packet2(avctx, avpkt, FFMAX(8192, 768 * avctx->channels), 0)) < 0)
          return ret;
 -    }
  
      out_ptr                   = avpkt->data;
      out_buffer_size           = avpkt->size;