summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLynne <dev@lynne.ee>2020-09-07 02:41:19 +0200
committerLynne <dev@lynne.ee>2020-10-02 17:43:15 +0200
commit45070eec4c089b06947f07e25cdb1bc8b2102553 (patch)
tree3759869b0aa1413e3e430939481b296bc106b29b
parentd9e812797c84be0f03aa1e95905da1f2cb2ed81e (diff)
libwavpackenc: remove libwavpackenc wrapper
The manual states "there is virtually no reason to use that encoder.". It supports less sample formats than the native encoder, is less efficient than the native encoder and is also slower and pretty much remains untested. libwavpack also isn't being fuzzed, which given that we plug the parameters without any sanitizing them looks concerning.
-rw-r--r--Changelog1
-rwxr-xr-xconfigure11
-rw-r--r--doc/encoders.texi53
-rw-r--r--doc/general_contents.texi8
-rw-r--r--libavcodec/Makefile1
-rw-r--r--libavcodec/allcodecs.c1
-rw-r--r--libavcodec/libwavpackenc.c195
7 files changed, 4 insertions, 266 deletions
diff --git a/Changelog b/Changelog
index 358cbaaf94..f37326627e 100644
--- a/Changelog
+++ b/Changelog
@@ -30,6 +30,7 @@ version <next>:
- IPU decoder, parser and demuxer
- Intel QSV-accelerated AV1 decoding
- Argonaut Games Video decoder
+- libwavpack encoder removed
version 4.3:
diff --git a/configure b/configure
index b8de64ccae..3ce4644cb4 100755
--- a/configure
+++ b/configure
@@ -190,9 +190,9 @@ External library support:
Using any of the following switches will allow FFmpeg to link to the
corresponding external library. All the components depending on that library
will become enabled, if all their other dependencies are met and they are not
- explicitly disabled. E.g. --enable-libwavpack will enable linking to
- libwavpack and allow the libwavpack encoder to be built, unless it is
- specifically disabled with --disable-encoder=libwavpack.
+ explicitly disabled. E.g. --enable-libopus will enable linking to
+ libopus and allow the libopus encoder to be built, unless it is
+ specifically disabled with --disable-encoder=libopus.
Note that only the system libraries are auto-detected. All the other external
libraries must be explicitly enabled.
@@ -284,7 +284,6 @@ External library support:
--enable-libvorbis enable Vorbis en/decoding via libvorbis,
native implementation exists [no]
--enable-libvpx enable VP8 and VP9 de/encoding via libvpx [no]
- --enable-libwavpack enable wavpack encoding via libwavpack [no]
--enable-libwebp enable WebP encoding via libwebp [no]
--enable-libx264 enable H.264 encoding via x264 [no]
--enable-libx265 enable HEVC encoding via x265 [no]
@@ -1815,7 +1814,6 @@ EXTERNAL_LIBRARY_LIST="
libvmaf
libvorbis
libvpx
- libwavpack
libwebp
libxml2
libzimg
@@ -3265,8 +3263,6 @@ libvpx_vp8_decoder_deps="libvpx"
libvpx_vp8_encoder_deps="libvpx"
libvpx_vp9_decoder_deps="libvpx"
libvpx_vp9_encoder_deps="libvpx"
-libwavpack_encoder_deps="libwavpack"
-libwavpack_encoder_select="audio_frame_queue"
libwebp_encoder_deps="libwebp"
libwebp_anim_encoder_deps="libwebp"
libx262_encoder_deps="libx262"
@@ -6439,7 +6435,6 @@ enabled libvpx && {
fi
}
-enabled libwavpack && require libwavpack wavpack/wavpack.h WavpackOpenFileOutput -lwavpack
enabled libwebp && {
enabled libwebp_encoder && require_pkg_config libwebp "libwebp >= 0.2.0" webp/encode.h WebPGetEncoderVersion
enabled libwebp_anim_encoder && check_pkg_config libwebp_anim_encoder "libwebpmux >= 0.4.0" webp/mux.h WebPAnimEncoderOptionsInit; }
diff --git a/doc/encoders.texi b/doc/encoders.texi
index a48b15eb1b..0b1c69e982 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -1185,53 +1185,6 @@ transient response is a higher bitrate.
@end table
-@anchor{libwavpack}
-@section libwavpack
-
-A wrapper providing WavPack encoding through libwavpack.
-
-Only lossless mode using 32-bit integer samples is supported currently.
-
-Requires the presence of the libwavpack headers and library during
-configuration. You need to explicitly configure the build with
-@code{--enable-libwavpack}.
-
-Note that a libavcodec-native encoder for the WavPack codec exists so users can
-encode audios with this codec without using this encoder. See @ref{wavpackenc}.
-
-@subsection Options
-
-@command{wavpack} command line utility's corresponding options are listed in
-parentheses, if any.
-
-@table @option
-@item frame_size (@emph{--blocksize})
-Default is 32768.
-
-@item compression_level
-Set speed vs. compression tradeoff. Acceptable arguments are listed below:
-
-@table @samp
-@item 0 (@emph{-f})
-Fast mode.
-
-@item 1
-Normal (default) settings.
-
-@item 2 (@emph{-h})
-High quality.
-
-@item 3 (@emph{-hh})
-Very high quality.
-
-@item 4-8 (@emph{-hh -x}@var{EXTRAPROC})
-Same as @samp{3}, but with extra processing enabled.
-
-@samp{4} is the same as @option{-x2} and @samp{8} is the same as @option{-x6}.
-
-@end table
-@end table
-
@anchor{mjpegenc}
@section mjpeg
@@ -1258,11 +1211,6 @@ Compute and use optimal huffman tables.
WavPack lossless audio encoder.
-This is a libavcodec-native WavPack encoder. There is also an encoder based on
-libwavpack, but there is virtually no reason to use that encoder.
-
-See also @ref{libwavpack}.
-
@subsection Options
The equivalent options for @command{wavpack} command line utility are listed in
@@ -1283,7 +1231,6 @@ For the complete formula of calculating default, see
@file{libavcodec/wavpackenc.c}.
@item compression_level (@emph{-f}, @emph{-h}, @emph{-hh}, and @emph{-x})
-This option's syntax is consistent with @ref{libwavpack}'s.
@end table
@subsubsection Private options
diff --git a/doc/general_contents.texi b/doc/general_contents.texi
index c125fd0c21..598e0e74da 100644
--- a/doc/general_contents.texi
+++ b/doc/general_contents.texi
@@ -278,14 +278,6 @@ Due to security concerns, Vapoursynth scripts will not
be autodetected so the input format has to be forced. For ff* CLI tools,
add @code{-f vapoursynth} before the input @code{-i yourscript.vpy}.
-@section WavPack
-
-FFmpeg can make use of the libwavpack library for WavPack encoding.
-
-Go to @url{http://www.wavpack.com/} and follow the instructions for
-installing the library. Then pass @code{--enable-libwavpack} to configure to
-enable it.
-
@section x264
FFmpeg can make use of the x264 library for H.264 encoding.
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 816d87ba60..0d2f7960a9 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -1048,7 +1048,6 @@ OBJS-$(CONFIG_LIBVPX_VP8_DECODER) += libvpxdec.o
OBJS-$(CONFIG_LIBVPX_VP8_ENCODER) += libvpxenc.o
OBJS-$(CONFIG_LIBVPX_VP9_DECODER) += libvpxdec.o libvpx.o
OBJS-$(CONFIG_LIBVPX_VP9_ENCODER) += libvpxenc.o libvpx.o
-OBJS-$(CONFIG_LIBWAVPACK_ENCODER) += libwavpackenc.o
OBJS-$(CONFIG_LIBWEBP_ENCODER) += libwebpenc_common.o libwebpenc.o
OBJS-$(CONFIG_LIBWEBP_ANIM_ENCODER) += libwebpenc_common.o libwebpenc_animencoder.o
OBJS-$(CONFIG_LIBX262_ENCODER) += libx264.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 2b580b66cf..1953cd86c1 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -746,7 +746,6 @@ extern AVCodec ff_libvpx_vp8_encoder;
extern AVCodec ff_libvpx_vp8_decoder;
extern AVCodec ff_libvpx_vp9_encoder;
extern AVCodec ff_libvpx_vp9_decoder;
-extern AVCodec ff_libwavpack_encoder;
/* preferred over libwebp */
extern AVCodec ff_libwebp_anim_encoder;
extern AVCodec ff_libwebp_encoder;
diff --git a/libavcodec/libwavpackenc.c b/libavcodec/libwavpackenc.c
deleted file mode 100644
index e84b074893..0000000000
--- a/libavcodec/libwavpackenc.c
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * 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
- */
-
-#include <wavpack/wavpack.h>
-#include <string.h>
-
-#include "libavutil/attributes.h"
-#include "libavutil/opt.h"
-#include "libavutil/samplefmt.h"
-
-#include "audio_frame_queue.h"
-#include "avcodec.h"
-#include "internal.h"
-
-#define WV_DEFAULT_BLOCK_SIZE 32768
-
-typedef struct LibWavpackContext {
- const AVClass *class;
- WavpackContext *wv;
- AudioFrameQueue afq;
-
- AVPacket *pkt;
- int user_size;
-
- int got_output;
-} LibWavpackContext;
-
-static int wavpack_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
- const AVFrame *frame, int *got_output)
-{
- LibWavpackContext *s = avctx->priv_data;
- int ret;
-
- s->got_output = 0;
- s->pkt = pkt;
- s->user_size = pkt->size;
-
- if (frame) {
- ret = ff_af_queue_add(&s->afq, frame);
- if (ret < 0)
- return ret;
-
- ret = WavpackPackSamples(s->wv, (int32_t*)frame->data[0], frame->nb_samples);
- if (!ret) {
- av_log(avctx, AV_LOG_ERROR, "Error encoding a frame: %s\n",
- WavpackGetErrorMessage(s->wv));
- return AVERROR_UNKNOWN;
- }
- }
-
- if (!s->got_output &&
- (!frame || frame->nb_samples < avctx->frame_size)) {
- ret = WavpackFlushSamples(s->wv);
- if (!ret) {
- av_log(avctx, AV_LOG_ERROR, "Error flushing the encoder: %s\n",
- WavpackGetErrorMessage(s->wv));
- return AVERROR_UNKNOWN;
- }
- }
-
- if (s->got_output) {
- ff_af_queue_remove(&s->afq, avctx->frame_size, &pkt->pts, &pkt->duration);
- *got_output = 1;
- }
-
- return 0;
-}
-
-static int encode_callback(void *id, void *data, int32_t count)
-{
- AVCodecContext *avctx = id;
- LibWavpackContext *s = avctx->priv_data;
- int ret, offset = s->pkt->size;
-
- if (s->user_size) {
- if (s->user_size - count < s->pkt->size) {
- av_log(avctx, AV_LOG_ERROR, "Provided packet too small.\n");
- return 0;
- }
- s->pkt->size += count;
- } else {
- ret = av_grow_packet(s->pkt, count);
- if (ret < 0) {
- av_log(avctx, AV_LOG_ERROR, "Error allocating output packet.\n");
- return 0;
- }
- }
-
- memcpy(s->pkt->data + offset, data, count);
-
- s->got_output = 1;
-
- return 1;
-}
-
-static av_cold int wavpack_encode_init(AVCodecContext *avctx)
-{
- LibWavpackContext *s = avctx->priv_data;
- WavpackConfig config = { 0 };
- int ret;
-
- s->wv = WavpackOpenFileOutput(encode_callback, avctx, NULL);
- if (!s->wv) {
- av_log(avctx, AV_LOG_ERROR, "Error allocating the encoder.\n");
- return AVERROR(ENOMEM);
- }
-
- if (!avctx->frame_size)
- avctx->frame_size = WV_DEFAULT_BLOCK_SIZE;
-
- config.bytes_per_sample = 4;
- config.bits_per_sample = 32;
- config.block_samples = avctx->frame_size;
- config.channel_mask = avctx->channel_layout;
- config.num_channels = avctx->channels;
- config.sample_rate = avctx->sample_rate;
-
- if (avctx->compression_level != FF_COMPRESSION_DEFAULT) {
- if (avctx->compression_level >= 3) {
- config.flags |= CONFIG_VERY_HIGH_FLAG;
-
- if (avctx->compression_level >= 8)
- config.xmode = 6;
- else if (avctx->compression_level >= 7)
- config.xmode = 5;
- else if (avctx->compression_level >= 6)
- config.xmode = 4;
- else if (avctx->compression_level >= 5)
- config.xmode = 3;
- else if (avctx->compression_level >= 4)
- config.xmode = 2;
- } else if (avctx->compression_level >= 2)
- config.flags |= CONFIG_HIGH_FLAG;
- else if (avctx->compression_level < 1)
- config.flags |= CONFIG_FAST_FLAG;
- }
-
- ret = WavpackSetConfiguration(s->wv, &config, -1);
- if (!ret)
- goto fail;
-
- ret = WavpackPackInit(s->wv);
- if (!ret)
- goto fail;
-
- ff_af_queue_init(avctx, &s->afq);
-
- return 0;
-
-fail:
- av_log(avctx, AV_LOG_ERROR, "Error configuring the encoder: %s.\n",
- WavpackGetErrorMessage(s->wv));
- WavpackCloseFile(s->wv);
- return AVERROR_UNKNOWN;
-}
-
-static av_cold int wavpack_encode_close(AVCodecContext *avctx)
-{
- LibWavpackContext *s = avctx->priv_data;
-
- WavpackCloseFile(s->wv);
-
- ff_af_queue_close(&s->afq);
-
- return 0;
-}
-
-AVCodec ff_libwavpack_encoder = {
- .name = "libwavpack",
- .type = AVMEDIA_TYPE_AUDIO,
- .id = AV_CODEC_ID_WAVPACK,
- .priv_data_size = sizeof(LibWavpackContext),
- .init = wavpack_encode_init,
- .encode2 = wavpack_encode_frame,
- .close = wavpack_encode_close,
- .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SMALL_LAST_FRAME,
- .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S32,
- AV_SAMPLE_FMT_NONE },
- .wrapper_name = "libwavpack",
-};