lavc: remove libfaac wrapper

There is really no need for two aac wrappers, we already have
libfdk-aac which is better. Not to mention that faac doesn't
even support HEv1, or HEv2. It's also under a license which is
unusable for distribution, so it would only be useful to people
who will compile their own ffmpeg, only use it themselves (which
at that point should just use fdk-aac).

Signed-off-by: Josh de Kock <josh@itanimul.li>
pull/231/head
Josh de Kock 8 years ago committed by Rostislav Pehlivanov
parent 449f263f9f
commit dc0f711459
  1. 1
      Changelog
  2. 2
      LICENSE.md
  3. 6
      configure
  4. 105
      doc/encoders.texi
  5. 2
      doc/ffserver.conf
  6. 2
      doc/general.texi
  7. 4
      doc/muxers.texi
  8. 2
      doc/platform.texi
  9. 1
      libavcodec/Makefile
  10. 1
      libavcodec/allcodecs.c
  11. 248
      libavcodec/libfaac.c

@ -36,6 +36,7 @@ version <next>:
- sdl2 support for ffplay
- sdl1 output device and sdl1 support removed
- extended mov edit list support
- libfaac encoder removed
version 3.1:

@ -115,8 +115,6 @@ The Fraunhofer FDK AAC and OpenSSL libraries are under licenses which are
incompatible with the GPLv2 and v3. To the best of our knowledge, they are
compatible with the LGPL.
The FAAC library is incompatible with all versions of GPL and LGPL.
The NVENC library, while its header file is licensed under the compatible MIT
license, requires a proprietary binary blob at run time, and is deemed to be
incompatible with the GPL. We are not certain if it is compatible with the

6
configure vendored

@ -225,7 +225,6 @@ External library support:
and libraw1394 [no]
--enable-libebur128 enable libebur128 for EBU R128 measurement,
needed for loudnorm filter [no]
--enable-libfaac enable AAC encoding via libfaac [no]
--enable-libfdk-aac enable AAC de/encoding via libfdk-aac [no]
--enable-libflite enable flite (voice synthesis) support via libflite [no]
--enable-libfontconfig enable libfontconfig, useful for drawtext filter [no]
@ -1488,7 +1487,6 @@ EXTERNAL_LIBRARY_LIST="
libcelt
libdc1394
libebur128
libfaac
libfdk_aac
libflite
libfontconfig
@ -2773,8 +2771,6 @@ pcm_mulaw_at_encoder_select="audio_frame_queue"
chromaprint_muxer_deps="chromaprint"
h264_videotoolbox_encoder_deps="videotoolbox_encoder pthreads"
libcelt_decoder_deps="libcelt"
libfaac_encoder_deps="libfaac"
libfaac_encoder_select="audio_frame_queue"
libfdk_aac_decoder_deps="libfdk_aac"
libfdk_aac_encoder_deps="libfdk_aac"
libfdk_aac_encoder_select="audio_frame_queue"
@ -5072,7 +5068,6 @@ die_license_disabled gpl x11grab
die_license_disabled nonfree cuda
die_license_disabled nonfree cuvid
die_license_disabled nonfree libfaac
die_license_disabled nonfree libnpp
enabled gpl && die_license_disabled_gpl nonfree libfdk_aac
enabled gpl && die_license_disabled_gpl nonfree openssl
@ -5682,7 +5677,6 @@ enabled libcelt && require libcelt celt/celt.h celt_decode -lcelt0 &&
die "ERROR: libcelt must be installed and version must be >= 0.11.0."; }
enabled libcaca && require_pkg_config caca caca.h caca_create_canvas
enabled libebur128 && require ebur128 ebur128.h ebur128_relative_threshold -lebur128
enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
enabled libfdk_aac && { use_pkg_config fdk-aac "fdk-aac/aacenc_lib.h" aacEncOpen ||
{ require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac &&
warn "using libfdk without pkg-config"; } }

@ -612,111 +612,6 @@ and slightly improves compression.
@end table
@anchor{libfaac}
@section libfaac
libfaac AAC (Advanced Audio Coding) encoder wrapper.
This encoder is of much lower quality and is more unstable than any other AAC
encoders, so it's highly recommended to instead use other encoders, like
@ref{aacenc,,the native FFmpeg AAC encoder}.
This encoder also requires the presence of the libfaac headers and library
during configuration. You need to explicitly configure the build with
@code{--enable-libfaac --enable-nonfree}.
@subsection Options
The following shared FFmpeg codec options are recognized.
The following options are supported by the libfaac wrapper. The
@command{faac}-equivalent of the options are listed in parentheses.
@table @option
@item b (@emph{-b})
Set bit rate in bits/s for ABR (Average Bit Rate) mode. If the bit rate
is not explicitly specified, it is automatically set to a suitable
value depending on the selected profile. @command{faac} bitrate is
expressed in kilobits/s.
Note that libfaac does not support CBR (Constant Bit Rate) but only
ABR (Average Bit Rate).
If VBR mode is enabled this option is ignored.
@item ar (@emph{-R})
Set audio sampling rate (in Hz).
@item ac (@emph{-c})
Set the number of audio channels.
@item cutoff (@emph{-C})
Set cutoff frequency. If not specified (or explicitly set to 0) it
will use a value automatically computed by the library. Default value
is 0.
@item profile
Set audio profile.
The following profiles are recognized:
@table @samp
@item aac_main
Main AAC (Main)
@item aac_low
Low Complexity AAC (LC)
@item aac_ssr
Scalable Sample Rate (SSR)
@item aac_ltp
Long Term Prediction (LTP)
@end table
If not specified it is set to @samp{aac_low}.
@item flags +qscale
Set constant quality VBR (Variable Bit Rate) mode.
@item global_quality
Set quality in VBR mode as an integer number of lambda units.
Only relevant when VBR mode is enabled with @code{flags +qscale}. The
value is converted to QP units by dividing it by @code{FF_QP2LAMBDA},
and used to set the quality value used by libfaac. A reasonable range
for the option value in QP units is [10-500], the higher the value the
higher the quality.
@item q (@emph{-q})
Enable VBR mode when set to a non-negative value, and set constant
quality value as a double floating point value in QP units.
The value sets the quality value used by libfaac. A reasonable range
for the option value is [10-500], the higher the value the higher the
quality.
This option is valid only using the @command{ffmpeg} command-line
tool. For library interface users, use @option{global_quality}.
@end table
@subsection Examples
@itemize
@item
Use @command{ffmpeg} to convert an audio file to ABR 128 kbps AAC in an M4A (MP4)
container:
@example
ffmpeg -i input.wav -codec:a libfaac -b:a 128k -output.m4a
@end example
@item
Use @command{ffmpeg} to convert an audio file to VBR AAC, using the
LTP AAC profile:
@example
ffmpeg -i input.wav -c:a libfaac -profile:a aac_ltp -q:a 100 output.m4a
@end example
@end itemize
@anchor{libfdk-aac-enc}
@section libfdk_aac

@ -317,7 +317,7 @@ StartSendOnKey
#AVPresetVideo baseline
#AVOptionVideo flags +global_header
#
#AudioCodec libfaac
#AudioCodec aac
#AudioBitRate 32
#AudioChannels 2
#AudioSampleRate 22050

@ -887,7 +887,7 @@ following image formats are supported:
@item 8SVX exponential @tab @tab X
@item 8SVX fibonacci @tab @tab X
@item AAC @tab EX @tab X
@tab encoding supported through internal encoder and external libraries libfaac and libfdk-aac
@tab encoding supported through internal encoder and external library libfdk-aac
@item AAC+ @tab E @tab IX
@tab encoding supported through external library libfdk-aac
@item AC-3 @tab IX @tab IX

@ -1437,9 +1437,9 @@ ffmpeg -i in.mkv -codec copy -map 0 -f segment -segment_list out.csv -segment_fr
@item
Convert the @file{in.mkv} to TS segments using the @code{libx264}
and @code{libfaac} encoders:
and @code{aac} encoders:
@example
ffmpeg -i in.mkv -map 0 -codec:v libx264 -codec:a libfaac -f ssegment -segment_list out.list out%03d.ts
ffmpeg -i in.mkv -map 0 -codec:v libx264 -codec:a aac -f ssegment -segment_list out.list out%03d.ts
@end example
@item

@ -314,7 +314,7 @@ These library packages are only available from
@uref{http://sourceware.org/cygwinports/, Cygwin Ports}:
@example
yasm, libSDL-devel, libfaac-devel, libgsm-devel, libmp3lame-devel,
yasm, libSDL-devel, libgsm-devel, libmp3lame-devel,
libschroedinger1.0-devel, speex-devel, libtheora-devel, libxvidcore-devel
@end example

@ -862,7 +862,6 @@ OBJS-$(CONFIG_ILBC_AT_ENCODER) += audiotoolboxenc.o
OBJS-$(CONFIG_PCM_ALAW_AT_ENCODER) += audiotoolboxenc.o
OBJS-$(CONFIG_PCM_MULAW_AT_ENCODER) += audiotoolboxenc.o
OBJS-$(CONFIG_LIBCELT_DECODER) += libcelt_dec.o
OBJS-$(CONFIG_LIBFAAC_ENCODER) += libfaac.o
OBJS-$(CONFIG_LIBFDK_AAC_DECODER) += libfdk-aacdec.o
OBJS-$(CONFIG_LIBFDK_AAC_ENCODER) += libfdk-aacenc.o
OBJS-$(CONFIG_LIBGSM_DECODER) += libgsmdec.o

@ -594,7 +594,6 @@ void avcodec_register_all(void)
REGISTER_DECODER(QDMC_AT, qdmc_at);
REGISTER_DECODER(QDM2_AT, qdm2_at);
REGISTER_DECODER(LIBCELT, libcelt);
REGISTER_ENCODER(LIBFAAC, libfaac);
REGISTER_ENCDEC (LIBFDK_AAC, libfdk_aac);
REGISTER_ENCDEC (LIBGSM, libgsm);
REGISTER_ENCDEC (LIBGSM_MS, libgsm_ms);

@ -1,248 +0,0 @@
/*
* Interface to libfaac for aac encoding
* Copyright (c) 2002 Gildas Bazin <gbazin@netcourrier.com>
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @file
* Interface to libfaac for aac encoding.
*/
#include <faac.h>
#include "libavutil/channel_layout.h"
#include "libavutil/common.h"
#include "avcodec.h"
#include "audio_frame_queue.h"
#include "internal.h"
/* libfaac has an encoder delay of 1024 samples */
#define FAAC_DELAY_SAMPLES 1024
typedef struct FaacAudioContext {
faacEncHandle faac_handle;
AudioFrameQueue afq;
} FaacAudioContext;
static av_cold int Faac_encode_close(AVCodecContext *avctx)
{
FaacAudioContext *s = avctx->priv_data;
av_freep(&avctx->extradata);
ff_af_queue_close(&s->afq);
if (s->faac_handle)
faacEncClose(s->faac_handle);
return 0;
}
static const int channel_maps[][6] = {
{ 2, 0, 1 }, //< C L R
{ 2, 0, 1, 3 }, //< C L R Cs
{ 2, 0, 1, 3, 4 }, //< C L R Ls Rs
{ 2, 0, 1, 4, 5, 3 }, //< C L R Ls Rs LFE
};
static av_cold int Faac_encode_init(AVCodecContext *avctx)
{
FaacAudioContext *s = avctx->priv_data;
faacEncConfigurationPtr faac_cfg;
unsigned long samples_input, max_bytes_output;
int ret;
/* number of channels */
if (avctx->channels < 1 || avctx->channels > 6) {
av_log(avctx, AV_LOG_ERROR, "encoding %d channel(s) is not allowed\n", avctx->channels);
ret = AVERROR(EINVAL);
goto error;
}
s->faac_handle = faacEncOpen(avctx->sample_rate,
avctx->channels,
&samples_input, &max_bytes_output);
if (!s->faac_handle) {
av_log(avctx, AV_LOG_ERROR, "error in faacEncOpen()\n");
ret = AVERROR_UNKNOWN;
goto error;
}
/* check faac version */
faac_cfg = faacEncGetCurrentConfiguration(s->faac_handle);
if (faac_cfg->version != FAAC_CFG_VERSION) {
av_log(avctx, AV_LOG_ERROR, "wrong libfaac version (compiled for: %d, using %d)\n", FAAC_CFG_VERSION, faac_cfg->version);
ret = AVERROR(EINVAL);
goto error;
}
/* put the options in the configuration struct */
switch(avctx->profile) {
case FF_PROFILE_AAC_MAIN:
faac_cfg->aacObjectType = MAIN;
break;
case FF_PROFILE_UNKNOWN:
case FF_PROFILE_AAC_LOW:
faac_cfg->aacObjectType = LOW;
break;
case FF_PROFILE_AAC_SSR:
faac_cfg->aacObjectType = SSR;
break;
case FF_PROFILE_AAC_LTP:
faac_cfg->aacObjectType = LTP;
break;
default:
av_log(avctx, AV_LOG_ERROR, "invalid AAC profile\n");
ret = AVERROR(EINVAL);
goto error;
}
faac_cfg->mpegVersion = MPEG4;
faac_cfg->useTns = 0;
faac_cfg->allowMidside = 1;
faac_cfg->bitRate = avctx->bit_rate / avctx->channels;
faac_cfg->bandWidth = avctx->cutoff;
if(avctx->flags & AV_CODEC_FLAG_QSCALE) {
faac_cfg->bitRate = 0;
faac_cfg->quantqual = avctx->global_quality / FF_QP2LAMBDA;
}
faac_cfg->outputFormat = 1;
faac_cfg->inputFormat = FAAC_INPUT_16BIT;
if (avctx->channels > 2)
memcpy(faac_cfg->channel_map, channel_maps[avctx->channels-3],
avctx->channels * sizeof(int));
avctx->frame_size = samples_input / avctx->channels;
/* Set decoder specific info */
avctx->extradata_size = 0;
if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
unsigned char *buffer = NULL;
unsigned long decoder_specific_info_size;
if (!faacEncGetDecoderSpecificInfo(s->faac_handle, &buffer,
&decoder_specific_info_size)) {
avctx->extradata = av_malloc(decoder_specific_info_size + AV_INPUT_BUFFER_PADDING_SIZE);
if (!avctx->extradata) {
ret = AVERROR(ENOMEM);
goto error;
}
avctx->extradata_size = decoder_specific_info_size;
memcpy(avctx->extradata, buffer, avctx->extradata_size);
faac_cfg->outputFormat = 0;
}
free(buffer);
}
if (!faacEncSetConfiguration(s->faac_handle, faac_cfg)) {
int i;
for (i = avctx->bit_rate/1000; i ; i--) {
faac_cfg->bitRate = 1000*i / avctx->channels;
if (faacEncSetConfiguration(s->faac_handle, faac_cfg))
break;
}
if (!i) {
av_log(avctx, AV_LOG_ERROR, "libfaac doesn't support this output format!\n");
ret = AVERROR(EINVAL);
goto error;
} else {
avctx->bit_rate = 1000*i;
av_log(avctx, AV_LOG_WARNING, "libfaac doesn't support the specified bitrate, using %dkbit/s instead\n", i);
}
}
avctx->initial_padding = FAAC_DELAY_SAMPLES;
ff_af_queue_init(avctx, &s->afq);
return 0;
error:
Faac_encode_close(avctx);
return ret;
}
static int Faac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
const AVFrame *frame, int *got_packet_ptr)
{
FaacAudioContext *s = avctx->priv_data;
int bytes_written, ret;
int num_samples = frame ? frame->nb_samples : 0;
void *samples = frame ? frame->data[0] : NULL;
if ((ret = ff_alloc_packet2(avctx, avpkt, (7 + 768) * avctx->channels, 0)) < 0)
return ret;
bytes_written = faacEncEncode(s->faac_handle, samples,
num_samples * avctx->channels,
avpkt->data, avpkt->size);
if (bytes_written < 0) {
av_log(avctx, AV_LOG_ERROR, "faacEncEncode() error\n");
return bytes_written;
}
/* add current frame to the queue */
if (frame) {
if ((ret = ff_af_queue_add(&s->afq, frame)) < 0)
return ret;
}
if (!bytes_written)
return 0;
/* Get the next frame pts/duration */
ff_af_queue_remove(&s->afq, avctx->frame_size, &avpkt->pts,
&avpkt->duration);
avpkt->size = bytes_written;
*got_packet_ptr = 1;
return 0;
}
static const AVProfile profiles[] = {
{ FF_PROFILE_AAC_MAIN, "Main" },
{ FF_PROFILE_AAC_LOW, "LC" },
{ FF_PROFILE_AAC_SSR, "SSR" },
{ FF_PROFILE_AAC_LTP, "LTP" },
{ FF_PROFILE_UNKNOWN },
};
static const uint64_t faac_channel_layouts[] = {
AV_CH_LAYOUT_MONO,
AV_CH_LAYOUT_STEREO,
AV_CH_LAYOUT_SURROUND,
AV_CH_LAYOUT_4POINT0,
AV_CH_LAYOUT_5POINT0_BACK,
AV_CH_LAYOUT_5POINT1_BACK,
0
};
AVCodec ff_libfaac_encoder = {
.name = "libfaac",
.long_name = NULL_IF_CONFIG_SMALL("libfaac AAC (Advanced Audio Coding)"),
.type = AVMEDIA_TYPE_AUDIO,
.id = AV_CODEC_ID_AAC,
.priv_data_size = sizeof(FaacAudioContext),
.init = Faac_encode_init,
.encode2 = Faac_encode_frame,
.close = Faac_encode_close,
.capabilities = AV_CODEC_CAP_SMALL_LAST_FRAME | AV_CODEC_CAP_DELAY,
.sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16,
AV_SAMPLE_FMT_NONE },
.profiles = NULL_IF_CONFIG_SMALL(profiles),
.channel_layouts = faac_channel_layouts,
};
Loading…
Cancel
Save