]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/libfaac.c
Fix a crash when decoding tiff by moving check
[ffmpeg] / libavcodec / libfaac.c
index be262a95c42e879042e108da068294f4d8dfb34f..b220b1714e4559818043788a53bb8b2b3334dff3 100644 (file)
@@ -20,7 +20,7 @@
  */
 
 /**
- * @file libfaac.c
+ * @file
  * Interface to libfaac for aac encoding.
  */
 
@@ -38,8 +38,10 @@ static av_cold int Faac_encode_init(AVCodecContext *avctx)
     unsigned long samples_input, max_bytes_output;
 
     /* number of channels */
-    if (avctx->channels < 1 || avctx->channels > 6)
+    if (avctx->channels < 1 || avctx->channels > 6) {
+        av_log(avctx, AV_LOG_ERROR, "encoding %d channel(s) is not allowed\n", avctx->channels);
         return -1;
+    }
 
     s->faac_handle = faacEncOpen(avctx->sample_rate,
                                  avctx->channels,
@@ -145,11 +147,12 @@ static av_cold int Faac_encode_close(AVCodecContext *avctx)
 
 AVCodec libfaac_encoder = {
     "libfaac",
-    CODEC_TYPE_AUDIO,
+    AVMEDIA_TYPE_AUDIO,
     CODEC_ID_AAC,
     sizeof(FaacAudioContext),
     Faac_encode_init,
     Faac_encode_frame,
     Faac_encode_close,
-    .long_name = "libfaac AAC (Advanced Audio Codec)",
+    .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
+    .long_name = NULL_IF_CONFIG_SMALL("libfaac AAC (Advanced Audio Codec)"),
 };