From b9e8f3cc44aed3b6da71c7510c6287bf7bbbc66b Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Wed, 14 Jun 2023 15:13:45 +0100 Subject: gentoo auto-resync : 14:06:2023 - 15:13:45 --- media-libs/Manifest.gz | Bin 68441 -> 68445 bytes media-libs/chromaprint/Manifest | 2 + media-libs/chromaprint/chromaprint-1.5.1-r3.ebuild | 52 ++ media-libs/chromaprint/files/ffmpeg-5.patch | 580 +++++++++++++++++++++ media-libs/libjpeg-turbo/Manifest | 2 +- .../libjpeg-turbo/libjpeg-turbo-2.1.5.1.ebuild | 2 +- media-libs/svt-av1/Manifest | 2 +- media-libs/svt-av1/svt-av1-1.5.0-r1.ebuild | 46 ++ media-libs/svt-av1/svt-av1-1.5.0.ebuild | 45 -- 9 files changed, 683 insertions(+), 48 deletions(-) create mode 100644 media-libs/chromaprint/chromaprint-1.5.1-r3.ebuild create mode 100644 media-libs/chromaprint/files/ffmpeg-5.patch create mode 100644 media-libs/svt-av1/svt-av1-1.5.0-r1.ebuild delete mode 100644 media-libs/svt-av1/svt-av1-1.5.0.ebuild (limited to 'media-libs') diff --git a/media-libs/Manifest.gz b/media-libs/Manifest.gz index d78468930bdf..46b9f10d5e92 100644 Binary files a/media-libs/Manifest.gz and b/media-libs/Manifest.gz differ diff --git a/media-libs/chromaprint/Manifest b/media-libs/chromaprint/Manifest index 2eaf8c80d506..1698f316ed99 100644 --- a/media-libs/chromaprint/Manifest +++ b/media-libs/chromaprint/Manifest @@ -1,4 +1,6 @@ +AUX ffmpeg-5.patch 18698 BLAKE2B 9000187da3e0c486a432578a3e87fc40c48ce1ebd259e3b051ddab83c45cd7eb5a0bc5586daeb18c3867cdf26d1a36c4b61b9c2110758ec7a84007a072dc01c4 SHA512 d093f251fb2e7c9d98298a814434bc91e72387a2c214ceba561282a561ffcd256a44d51230bcc2f9f459403b76d0f589d5a4f1e26d5666d007e4babd38b3e702 DIST chromaprint-1.5.1.tar.gz 1581159 BLAKE2B 9f7f030e97d3114cf679df298d313ea826c0fb05e7e7d8a10090d0a27ed0811b380b81b29fce973e0493826c478964367396311fd0484619cb2fc4c2d8e0d4c0 SHA512 ea16e4d2b879c15b1d9b9ec93878da8b893f1834c70942663e1d2d106c2e0a661094fe2dd3bae7a6c2a1f9d5d8fab5e0b0ba493561090cf57b2228606fad1e66 DIST gtest-1.10.0.tar.gz 904227 BLAKE2B 96b97b06730a9f55505a4d40bd4861560503a1437d29dadc6e8d3c743ccde020e61b3f96082fb9bda0666d739e69d3990bad06161e9c531c40021dc0826f5547 SHA512 7ebf5b4a80f364564066ccc7ce2e2092b12942a754c4854afd97380f19811e0fd45c300d423234cda0e05966ddbdaebcb1625e856ce55b0c81b0bae0dd971532 EBUILD chromaprint-1.5.1-r2.ebuild 1746 BLAKE2B f2ed63e16160d85e99a7737d03f865aae0d9fb25749d8f4176d34cada498a851478dc632005ac67b28dc0c213bce786658d676f84aea56a89be2e6959d364a9b SHA512 94a9b5a1f0c91717f78902ac009af6fe1aec81c50c2f166702d663915280b65377d78172678bdcfd54620df2b4569ba3b5f6043ee49c1c9502543a0376390c44 +EBUILD chromaprint-1.5.1-r3.ebuild 1688 BLAKE2B d0679ab571fc3be6d823826c090d4d20fdf491c65fcf1b8ef356c856ce85a2ee15cb1f1cad600695a65ca5ad1d34af5159fa848c4c7a1f84b200ac5b8b442048 SHA512 8a6d4cc802dcf9446eb9152d54cd6eb1fb9f38cd2500e9e9f977ee9e2a1a78160acf3fccc64d918f96f63d603a0e7eecf8deb5e34f72a3d016d16db791d90736 MISC metadata.xml 503 BLAKE2B badb1250c59d72306e528508fe7016028a5aec5f349ad050437ba4c818ed0fc9d63efcdab5774b5ad94956067fe4243f6f4aff5423e25a2ac9685e147590d976 SHA512 b10104402e9b04d904a9ef4e6876bb52764ccf4a0b38b1f5ef7b5b9534737e64b285bfafdb3e9f7582fc21d0204f52014cd7eea6e22c8097ac46f15c111971c3 diff --git a/media-libs/chromaprint/chromaprint-1.5.1-r3.ebuild b/media-libs/chromaprint/chromaprint-1.5.1-r3.ebuild new file mode 100644 index 000000000000..c18875469243 --- /dev/null +++ b/media-libs/chromaprint/chromaprint-1.5.1-r3.ebuild @@ -0,0 +1,52 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +GTEST_VERSION="1.10.0" +GTEST_DIR_VERSION="1.10.x" +inherit cmake-multilib + +DESCRIPTION="Library implementing a custom algorithm for extracting audio fingerprints" +HOMEPAGE="https://acoustid.org/chromaprint" +SRC_URI="https://github.com/acoustid/${PN}/releases/download/v${PV}/${P}.tar.gz + test? ( https://github.com/google/googletest/archive/v$(ver_cut 1-2 ${GTEST_VERSION}).x.tar.gz -> gtest-${GTEST_VERSION}.tar.gz ) +" + +LICENSE="LGPL-2.1" +SLOT="0/1" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86" +IUSE="test tools" +RESTRICT="!test? ( test )" + +# - Default to fftw to avoid awkward circular dependency w/ ffmpeg +# See bug #833821 for an example +RDEPEND="tools? ( >=media-video/ffmpeg-5:=[${MULTILIB_USEDEP}] ) + !tools? ( sci-libs/fftw:=[${MULTILIB_USEDEP}] )" +DEPEND="${RDEPEND} + test? ( dev-cpp/gtest[${MULTILIB_USEDEP}] )" + +DOCS=( NEWS.txt README.md ) +PATCHES=( "${FILESDIR}"/ffmpeg-5.patch ) + +multilib_src_configure() { + export GTEST_ROOT="${WORKDIR}/googletest-${GTEST_DIR_VERSION}/googletest/" + + local mycmakeargs=( + -DBUILD_TESTS=$(usex test) + + -DBUILD_TOOLS=$(multilib_native_usex tools) + -DFFT_LIB=$(usex tools 'avfft' 'fftw3') + $(multilib_native_usex tools '-DAUDIO_PROCESSOR_LIB=swresample' '') + # Automagicallyish looks for ffmpeg, but there's no point + # even doing the check unless we're building with tools + # (=> without fftw3, and with ffmpeg). + -DCMAKE_DISABLE_FIND_PACKAGE_FFmpeg=$(multilib_native_usex !tools) + ) + + cmake_src_configure +} + +multilib_src_test() { + cd tests && (./all_tests || die "Tests failed") +} diff --git a/media-libs/chromaprint/files/ffmpeg-5.patch b/media-libs/chromaprint/files/ffmpeg-5.patch new file mode 100644 index 000000000000..a88ce7204f73 --- /dev/null +++ b/media-libs/chromaprint/files/ffmpeg-5.patch @@ -0,0 +1,580 @@ +From 8ccad6937177b1b92e40ab8f4447ea27bac009a7 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Lalinsk=C3=BD?= +Date: Fri, 4 Nov 2022 21:47:38 +0100 +Subject: [PATCH] Use FFmpeg 5.x (#120) + +* Use FFmpeg 5.1.2 for CI builds + +* Build on Ubuntu 20.04 + +* Upgrade code to FFmpeg 5.x APIs + +* Only set FFmpeg include dirs if building tools + +* No longer needed + +* Use ubuntu 20.04 +--- + .github/workflows/build.yml | 6 +- + CMakeLists.txt | 16 -- + src/audio/ffmpeg_audio_processor.h | 2 - + src/audio/ffmpeg_audio_processor_avresample.h | 72 ------- + src/audio/ffmpeg_audio_processor_swresample.h | 18 +- + src/audio/ffmpeg_audio_reader.h | 197 +++++++++--------- + tests/CMakeLists.txt | 6 + + 8 files changed, 122 insertions(+), 199 deletions(-) + delete mode 100644 src/audio/ffmpeg_audio_processor_avresample.h + +diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml +index 92761d9..baf67b7 100644 +--- a/.github/workflows/build.yml ++++ b/.github/workflows/build.yml +@@ -6,7 +6,7 @@ on: + + jobs: + test-linux: +- runs-on: ubuntu-18.04 ++ runs-on: ubuntu-20.04 + strategy: + matrix: + fft: +@@ -50,7 +50,7 @@ jobs: + make check VERBOSE=1 + + package-linux: +- runs-on: ubuntu-18.04 ++ runs-on: ubuntu-20.04 + strategy: + matrix: + arch: +@@ -71,7 +71,7 @@ jobs: + path: artifacts/ + + package-windows: +- runs-on: ubuntu-18.04 ++ runs-on: ubuntu-20.04 + strategy: + matrix: + arch: +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f8d6a32..4da2405 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -84,9 +84,6 @@ find_package(FFmpeg) + if(FFMPEG_LIBRARIES) + cmake_push_check_state(RESET) + set(CMAKE_REQUIRED_LIBRARIES ${FFMPEG_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} -lm) +- check_function_exists(av_packet_unref HAVE_AV_PACKET_UNREF) +- check_function_exists(av_frame_alloc HAVE_AV_FRAME_ALLOC) +- check_function_exists(av_frame_free HAVE_AV_FRAME_FREE) + cmake_pop_check_state() + endif() + +@@ -163,14 +160,11 @@ message(STATUS "Using ${FFT_LIB} for FFT calculations") + if(NOT AUDIO_PROCESSOR_LIB) + if(FFMPEG_LIBSWRESAMPLE_FOUND) + set(AUDIO_PROCESSOR_LIB "swresample") +- elseif(FFMPEG_LIBAVRESAMPLE_FOUND) +- set(AUDIO_PROCESSOR_LIB "avresample") + endif() + endif() + + if(AUDIO_PROCESSOR_LIB STREQUAL "swresample") + if(FFMPEG_LIBSWRESAMPLE_FOUND) +- set(USE_AVRESAMPLE OFF) + set(USE_SWRESAMPLE ON) + set(AUDIO_PROCESSOR_LIBRARIES ${FFMPEG_LIBSWRESAMPLE_LIBRARIES}) + set(AUDIO_PROCESSOR_INCLUDE_DIRS ${FFMPEG_LIBSWRESAMPLE_INCLUDE_DIRS}) +@@ -178,16 +172,6 @@ if(AUDIO_PROCESSOR_LIB STREQUAL "swresample") + message(FATAL_ERROR "Selected ${AUDIO_PROCESSOR_LIB} for audio processing, but the library is not found") + endif() + message(STATUS "Using ${AUDIO_PROCESSOR_LIB} for audio conversion") +-elseif(AUDIO_PROCESSOR_LIB STREQUAL "avresample") +- if(FFMPEG_LIBAVRESAMPLE_FOUND) +- set(USE_AVRESAMPLE ON) +- set(USE_SWRESAMPLE OFF) +- set(AUDIO_PROCESSOR_LIBRARIES ${FFMPEG_LIBAVRESAMPLE_LIBRARIES}) +- set(AUDIO_PROCESSOR_INCLUDE_DIRS ${FFMPEG_LIBAVRESAMPLE_INCLUDE_DIRS}) +- else() +- message(FATAL_ERROR "Selected ${AUDIO_PROCESSOR_LIB} for audio processing, but the library is not found") +- endif() +- message(STATUS "Using ${AUDIO_PROCESSOR_LIB} for audio conversion") + else() + message(STATUS "Building without audio conversion support, please install FFmpeg with libswresample") + endif() +diff --git a/src/audio/ffmpeg_audio_processor.h b/src/audio/ffmpeg_audio_processor.h +index 7628fc7..39f4f6d 100644 +--- a/src/audio/ffmpeg_audio_processor.h ++++ b/src/audio/ffmpeg_audio_processor.h +@@ -10,8 +10,6 @@ + + #if defined(USE_SWRESAMPLE) + #include "audio/ffmpeg_audio_processor_swresample.h" +-#elif defined(USE_AVRESAMPLE) +-#include "audio/ffmpeg_audio_processor_avresample.h" + #else + #error "no audio processing library" + #endif +diff --git a/src/audio/ffmpeg_audio_processor_avresample.h b/src/audio/ffmpeg_audio_processor_avresample.h +deleted file mode 100644 +index bd85f92..0000000 +--- a/src/audio/ffmpeg_audio_processor_avresample.h ++++ /dev/null +@@ -1,72 +0,0 @@ +-// Copyright (C) 2016 Lukas Lalinsky +-// Distributed under the MIT license, see the LICENSE file for details. +- +-#ifndef CHROMAPRINT_AUDIO_FFMPEG_AUDIO_PROCESSOR_AVRESAMPLE_H_ +-#define CHROMAPRINT_AUDIO_FFMPEG_AUDIO_PROCESSOR_AVRESAMPLE_H_ +- +-extern "C" { +-#include +-} +- +-namespace chromaprint { +- +-class FFmpegAudioProcessor { +-public: +- FFmpegAudioProcessor() { +- m_resample_ctx = avresample_alloc_context(); +- } +- +- ~FFmpegAudioProcessor() { +- avresample_free(&m_resample_ctx); +- } +- +- void SetCompatibleMode() { +- av_opt_set_int(m_resample_ctx, "filter_size", 16, 0); +- av_opt_set_int(m_resample_ctx, "phase_shift", 8, 0); +- av_opt_set_int(m_resample_ctx, "linear_interp", 1, 0); +- av_opt_set_double(m_resample_ctx, "cutoff", 0.8, 0); +- } +- +- void SetInputChannelLayout(int64_t channel_layout) { +- av_opt_set_int(m_resample_ctx, "in_channel_layout", channel_layout, 0); +- } +- +- void SetInputSampleFormat(AVSampleFormat sample_format) { +- av_opt_set_int(m_resample_ctx, "in_sample_fmt", sample_format, 0); +- } +- +- void SetInputSampleRate(int sample_rate) { +- av_opt_set_int(m_resample_ctx, "in_sample_rate", sample_rate, 0); +- } +- +- void SetOutputChannelLayout(int64_t channel_layout) { +- av_opt_set_int(m_resample_ctx, "out_channel_layout", channel_layout, 0); +- } +- +- void SetOutputSampleFormat(AVSampleFormat sample_format) { +- av_opt_set_int(m_resample_ctx, "out_sample_fmt", sample_format, 0); +- } +- +- void SetOutputSampleRate(int sample_rate) { +- av_opt_set_int(m_resample_ctx, "out_sample_fmt", sample_rate, 0); +- } +- +- int Init() { +- return avresample_open(m_resample_ctx); +- } +- +- int Convert(uint8_t **out, int out_count, const uint8_t **in, int in_count) { +- return avresample_convert(m_resample_ctx, out, 0, out_count, (uint8_t **) in, 0, in_count); +- } +- +- int Flush(uint8_t **out, int out_count) { +- return avresample_read(m_resample_ctx, out, out_count); +- } +- +-private: +- AVAudioResampleContext *m_resample_ctx = nullptr; +-}; +- +-}; // namespace chromaprint +- +-#endif +diff --git a/src/audio/ffmpeg_audio_processor_swresample.h b/src/audio/ffmpeg_audio_processor_swresample.h +index b86266b..b1d4bea 100644 +--- a/src/audio/ffmpeg_audio_processor_swresample.h ++++ b/src/audio/ffmpeg_audio_processor_swresample.h +@@ -28,30 +28,28 @@ class FFmpegAudioProcessor { + av_opt_set_double(m_swr_ctx, "cutoff", 0.8, 0); + } + +- void SetInputChannelLayout(int64_t channel_layout) { +- av_opt_set_int(m_swr_ctx, "icl", channel_layout, 0); +- av_opt_set_int(m_swr_ctx, "ich", av_get_channel_layout_nb_channels(channel_layout), 0); ++ void SetInputChannelLayout(AVChannelLayout *channel_layout) { ++ av_opt_set_int(m_swr_ctx, "in_channel_layout", channel_layout->u.mask, 0); + } + + void SetInputSampleFormat(AVSampleFormat sample_format) { +- av_opt_set_int(m_swr_ctx, "isf", sample_format, 0); ++ av_opt_set_sample_fmt(m_swr_ctx, "in_sample_fmt", sample_format, 0); + } + + void SetInputSampleRate(int sample_rate) { +- av_opt_set_int(m_swr_ctx, "isr", sample_rate, 0); ++ av_opt_set_int(m_swr_ctx, "in_sample_rate", sample_rate, 0); + } + +- void SetOutputChannelLayout(int64_t channel_layout) { +- av_opt_set_int(m_swr_ctx, "ocl", channel_layout, 0); +- av_opt_set_int(m_swr_ctx, "och", av_get_channel_layout_nb_channels(channel_layout), 0); ++ void SetOutputChannelLayout(AVChannelLayout *channel_layout) { ++ av_opt_set_int(m_swr_ctx, "out_channel_layout", channel_layout->u.mask, 0); + } + + void SetOutputSampleFormat(AVSampleFormat sample_format) { +- av_opt_set_int(m_swr_ctx, "osf", sample_format, 0); ++ av_opt_set_sample_fmt(m_swr_ctx, "out_sample_fmt", sample_format, 0); + } + + void SetOutputSampleRate(int sample_rate) { +- av_opt_set_int(m_swr_ctx, "osr", sample_rate, 0); ++ av_opt_set_int(m_swr_ctx, "out_sample_rate", sample_rate, 0); + } + + int Init() { +diff --git a/src/audio/ffmpeg_audio_reader.h b/src/audio/ffmpeg_audio_reader.h +index 5550164..1c6b346 100644 +--- a/src/audio/ffmpeg_audio_reader.h ++++ b/src/audio/ffmpeg_audio_reader.h +@@ -62,7 +62,7 @@ class FFmpegAudioReader { + bool Read(const int16_t **data, size_t *size); + + bool IsOpen() const { return m_opened; } +- bool IsFinished() const { return m_finished && !m_got_frame; } ++ bool IsFinished() const { return !m_has_more_packets && !m_has_more_frames; } + + std::string GetError() const { return m_error; } + int GetErrorCode() const { return m_error_code; } +@@ -74,20 +74,19 @@ class FFmpegAudioReader { + uint8_t *m_convert_buffer[1] = { nullptr }; + int m_convert_buffer_nb_samples = 0; + +- AVInputFormat *m_input_fmt = nullptr; ++ const AVInputFormat *m_input_fmt = nullptr; + AVDictionary *m_input_opts = nullptr; + + AVFormatContext *m_format_ctx = nullptr; + AVCodecContext *m_codec_ctx = nullptr; +- AVFrame *m_frame = nullptr; + int m_stream_index = -1; + std::string m_error; + int m_error_code = 0; +- bool m_finished = false; + bool m_opened = false; +- int m_got_frame = 0; +- AVPacket m_packet; +- AVPacket m_packet0; ++ bool m_has_more_packets = true; ++ bool m_has_more_frames = true; ++ AVPacket *m_packet = nullptr; ++ AVFrame *m_frame = nullptr; + + int m_output_sample_rate = 0; + int m_output_channels = 0; +@@ -98,19 +97,12 @@ class FFmpegAudioReader { + + inline FFmpegAudioReader::FFmpegAudioReader() { + av_log_set_level(AV_LOG_QUIET); +- +- av_init_packet(&m_packet); +- m_packet.data = nullptr; +- m_packet.size = 0; +- +- m_packet0 = m_packet; + } + + inline FFmpegAudioReader::~FFmpegAudioReader() { + Close(); + av_dict_free(&m_input_opts); + av_freep(&m_convert_buffer[0]); +- av_packet_unref(&m_packet0); + } + + inline bool FFmpegAudioReader::SetInputFormat(const char *name) { +@@ -135,11 +127,10 @@ inline bool FFmpegAudioReader::Open(const std::string &file_name) { + + Close(); + +- av_init_packet(&m_packet); +- m_packet.data = nullptr; +- m_packet.size = 0; +- +- m_packet0 = m_packet; ++ m_packet = av_packet_alloc(); ++ if (!m_packet) { ++ return false; ++ } + + ret = avformat_open_input(&m_format_ctx, file_name.c_str(), m_input_fmt, &m_input_opts); + if (ret < 0) { +@@ -153,26 +144,31 @@ inline bool FFmpegAudioReader::Open(const std::string &file_name) { + return false; + } + +- AVCodec *codec; ++ const AVCodec *codec; + ret = av_find_best_stream(m_format_ctx, AVMEDIA_TYPE_AUDIO, -1, -1, &codec, 0); + if (ret < 0) { + SetError("Could not find any audio stream in the file", ret); + return false; + } + m_stream_index = ret; ++ auto stream = m_format_ctx->streams[m_stream_index]; + +- m_codec_ctx = m_format_ctx->streams[m_stream_index]->codec; ++ m_codec_ctx = avcodec_alloc_context3(codec); + m_codec_ctx->request_sample_fmt = AV_SAMPLE_FMT_S16; + ++ ret = avcodec_parameters_to_context(m_codec_ctx, stream->codecpar); ++ if (ret < 0) { ++ SetError("Could not copy the stream parameters", ret); ++ return false; ++ } ++ + ret = avcodec_open2(m_codec_ctx, codec, nullptr); + if (ret < 0) { + SetError("Could not open the codec", ret); + return false; + } + +- if (!m_codec_ctx->channel_layout) { +- m_codec_ctx->channel_layout = av_get_default_channel_layout(m_codec_ctx->channels); +- } ++ av_dump_format(m_format_ctx, 0, "foo", 0); + + m_frame = av_frame_alloc(); + if (!m_frame) { +@@ -183,19 +179,23 @@ inline bool FFmpegAudioReader::Open(const std::string &file_name) { + m_output_sample_rate = m_codec_ctx->sample_rate; + } + +- if (!m_output_channels) { +- m_output_channels = m_codec_ctx->channels; ++ AVChannelLayout output_channel_layout; ++ if (m_output_channels) { ++ av_channel_layout_default(&output_channel_layout, m_output_channels); ++ } else { ++ m_output_channels = m_codec_ctx->ch_layout.nb_channels; ++ av_channel_layout_default(&output_channel_layout, m_output_channels); + } + +- if (m_codec_ctx->sample_fmt != AV_SAMPLE_FMT_S16 || m_codec_ctx->channels != m_output_channels || m_codec_ctx->sample_rate != m_output_sample_rate) { ++ if (m_codec_ctx->sample_fmt != AV_SAMPLE_FMT_S16 || m_codec_ctx->ch_layout.nb_channels != m_output_channels || m_codec_ctx->sample_rate != m_output_sample_rate) { + m_converter.reset(new FFmpegAudioProcessor()); + m_converter->SetCompatibleMode(); + m_converter->SetInputSampleFormat(m_codec_ctx->sample_fmt); + m_converter->SetInputSampleRate(m_codec_ctx->sample_rate); +- m_converter->SetInputChannelLayout(m_codec_ctx->channel_layout); ++ m_converter->SetInputChannelLayout(&(m_codec_ctx->ch_layout)); + m_converter->SetOutputSampleFormat(AV_SAMPLE_FMT_S16); + m_converter->SetOutputSampleRate(m_output_sample_rate); +- m_converter->SetOutputChannelLayout(av_get_default_channel_layout(m_output_channels)); ++ m_converter->SetOutputChannelLayout(&output_channel_layout); + auto ret = m_converter->Init(); + if (ret != 0) { + SetError("Could not create an audio converter instance", ret); +@@ -203,10 +203,11 @@ inline bool FFmpegAudioReader::Open(const std::string &file_name) { + } + } + ++ av_channel_layout_uninit(&output_channel_layout); ++ + m_opened = true; +- m_finished = false; +- m_got_frame = 0; +- m_nb_packets = 0; ++ m_has_more_packets = true; ++ m_has_more_frames = true; + m_decode_error = 0; + + return true; +@@ -214,6 +215,7 @@ inline bool FFmpegAudioReader::Open(const std::string &file_name) { + + inline void FFmpegAudioReader::Close() { + av_frame_free(&m_frame); ++ av_packet_free(&m_packet); + + m_stream_index = -1; + +@@ -252,91 +254,98 @@ inline bool FFmpegAudioReader::Read(const int16_t **data, size_t *size) { + return false; + } + ++ *data = nullptr; ++ *size = 0; ++ + int ret; ++ bool needs_packet = false; + while (true) { +- while (m_packet.size <= 0) { +- av_packet_unref(&m_packet0); +- av_init_packet(&m_packet); +- m_packet.data = nullptr; +- m_packet.size = 0; +- ret = av_read_frame(m_format_ctx, &m_packet); ++ while (needs_packet && m_packet->size == 0) { ++ ret = av_read_frame(m_format_ctx, m_packet); + if (ret < 0) { + if (ret == AVERROR_EOF) { +- m_finished = true; ++ needs_packet = false; ++ m_has_more_packets = false; + break; +- } else { ++ } ++ SetError("Error reading from the audio source", ret); ++ return false; ++ } ++ if (m_packet->stream_index == m_stream_index) { ++ needs_packet = false; ++ } else { ++ av_packet_unref(m_packet); ++ } ++ } ++ ++ if (m_packet->size != 0) { ++ ret = avcodec_send_packet(m_codec_ctx, m_packet); ++ if (ret < 0) { ++ if (ret != AVERROR(EAGAIN)) { + SetError("Error reading from the audio source", ret); + return false; + } +- } +- m_packet0 = m_packet; +- if (m_packet.stream_index != m_stream_index) { +- m_packet.data = nullptr; +- m_packet.size = 0; + } else { +- m_nb_packets++; ++ av_packet_unref(m_packet); + } + } + +- ret = avcodec_decode_audio4(m_codec_ctx, m_frame, &m_got_frame, &m_packet); ++ ret = avcodec_receive_frame(m_codec_ctx, m_frame); + if (ret < 0) { +- if (m_decode_error) { +- SetError("Error decoding audio frame", m_decode_error); +- return false; ++ if (ret == AVERROR_EOF) { ++ m_has_more_frames = false; ++ } else if (ret == AVERROR(EAGAIN)) { ++ if (m_has_more_packets) { ++ needs_packet = true; ++ continue; ++ } else { ++ m_has_more_frames = false; ++ } + } +- m_decode_error = ret; +- m_packet.data = nullptr; +- m_packet.size = 0; +- continue; ++ SetError("Error decoding the audio source", ret); ++ return false; + } + +- break; +- } +- +- m_decode_error = 0; +- +- const int decoded = std::min(ret, m_packet.size); +- m_packet.data += decoded; +- m_packet.size -= decoded; +- +- if (m_got_frame) { +- if (m_converter) { +- if (m_frame->nb_samples > m_convert_buffer_nb_samples) { +- int linsize; +- av_freep(&m_convert_buffer[0]); +- m_convert_buffer_nb_samples = std::max(1024 * 8, m_frame->nb_samples); +- ret = av_samples_alloc(m_convert_buffer, &linsize, m_codec_ctx->channels, m_convert_buffer_nb_samples, AV_SAMPLE_FMT_S16, 1); +- if (ret < 0) { +- SetError("Couldn't allocate audio converter buffer", ret); ++ if (m_frame->nb_samples > 0) { ++ if (m_converter) { ++ if (m_frame->nb_samples > m_convert_buffer_nb_samples) { ++ int linsize; ++ av_freep(&m_convert_buffer[0]); ++ m_convert_buffer_nb_samples = std::max(1024 * 8, m_frame->nb_samples); ++ ret = av_samples_alloc(m_convert_buffer, &linsize, m_codec_ctx->ch_layout.nb_channels, m_convert_buffer_nb_samples, AV_SAMPLE_FMT_S16, 1); ++ if (ret < 0) { ++ SetError("Couldn't allocate audio converter buffer", ret); ++ return false; ++ } ++ } ++ auto nb_samples = m_converter->Convert(m_convert_buffer, m_convert_buffer_nb_samples, (const uint8_t **) m_frame->data, m_frame->nb_samples); ++ if (nb_samples < 0) { ++ SetError("Couldn't convert audio", ret); + return false; + } +- } +- auto nb_samples = m_converter->Convert(m_convert_buffer, m_convert_buffer_nb_samples, (const uint8_t **) m_frame->data, m_frame->nb_samples); +- if (nb_samples < 0) { +- SetError("Couldn't convert audio", ret); +- return false; +- } +- *data = (const int16_t *) m_convert_buffer[0]; +- *size = nb_samples; +- } else { +- *data = (const int16_t *) m_frame->data[0]; +- *size = m_frame->nb_samples; +- } +- } else { +- if (m_finished && m_converter) { +- auto nb_samples = m_converter->Flush(m_convert_buffer, m_convert_buffer_nb_samples); +- if (nb_samples < 0) { +- SetError("Couldn't convert audio", ret); +- return false; +- } else if (nb_samples > 0) { +- m_got_frame = 1; + *data = (const int16_t *) m_convert_buffer[0]; + *size = nb_samples; ++ } else { ++ *data = (const int16_t *) m_frame->data[0]; ++ *size = m_frame->nb_samples; ++ } ++ } else { ++ if (m_converter) { ++ if (IsFinished()) { ++ auto nb_samples = m_converter->Flush(m_convert_buffer, m_convert_buffer_nb_samples); ++ if (nb_samples < 0) { ++ SetError("Couldn't convert audio", ret); ++ return false; ++ } else if (nb_samples > 0) { ++ *data = (const int16_t *) m_convert_buffer[0]; ++ *size = nb_samples; ++ } ++ } + } + } +- } + +- return true; ++ return true; ++ } + } + + inline void FFmpegAudioReader::SetError(const char *message, int errnum) { +diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt +index a2b517b..123e643 100644 +--- a/tests/CMakeLists.txt ++++ b/tests/CMakeLists.txt +@@ -38,6 +38,12 @@ set(SRCS + + if(BUILD_TOOLS) + set(SRCS ${SRCS} ../src/audio/ffmpeg_audio_reader_test.cpp) ++ include_directories( ++ ${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS} ++ ${FFMPEG_LIBAVCODEC_INCLUDE_DIRS} ++ ${FFMPEG_LIBAVUTIL_INCLUDE_DIRS} ++ ${AUDIO_PROCESSOR_INCLUDE_DIRS} ++ ) + link_libraries(fpcalc_libs) + endif() + diff --git a/media-libs/libjpeg-turbo/Manifest b/media-libs/libjpeg-turbo/Manifest index cd54abcc289b..3ebbd95133ec 100644 --- a/media-libs/libjpeg-turbo/Manifest +++ b/media-libs/libjpeg-turbo/Manifest @@ -4,5 +4,5 @@ DIST libjpeg-turbo-2.1.5.1.tar.gz 2264936 BLAKE2B 9583a0a91e45347d651de6bf5192a2 DIST libjpeg8_8d-2.debian.tar.gz 14764 BLAKE2B e93d12afa062da28b717b540492221f70e8d9ccf3885371647cf85a2937f938ca723d4a27d5e1c5d79c26aa25dddf69b38754558851a1704172e8b52baf8e17c SHA512 8c5959fb7583a2d61e9442187f67b91b45e72d9dd30db3360d583a3b5d8e1a908db5659f760bdd455b3056e6ae3535b2fd3b847df3d58b140a1816b754003675 EBUILD libjpeg-turbo-2.1.3.ebuild 3135 BLAKE2B fc8a7318c20e87410236f28ce3e93cae7c706db44f0244f34e9e939ea515e66736661180f55a946d85eb1bb73b90b8b6e683a94930f4bed547c6c8b50527a1fd SHA512 529864d47d0b1e984c747c9e37ba1fdaf767de7174859cd49690f8b142a81461fd04848794a6a1b45bac51cf05360222998c573c32a43aa82ffc45cb312da097 EBUILD libjpeg-turbo-2.1.4.ebuild 3120 BLAKE2B e3d070e19bbe3e2bd308ddd062e3a4a96d627655e5602579b34090cce05706bd699e343e91e5ffeb2bdc4eed3c43d6eaa10890601fa3a23694e8f593f2eb088e SHA512 b607bf5308c23b64d9fbd77d9015227d7b58a228a0e3d9a40353ba061582a8284c3430873a9282417a360f9e55acdfd8af50b56596b9394739d5120441614b5d -EBUILD libjpeg-turbo-2.1.5.1.ebuild 3144 BLAKE2B 4abd2caa51a9107480d80a39e03888afb1e6c3abf59bbabe1e3d83cbaadc9d95bc21a83de61904bcb187ef45c24900e02e3353feacc2842e0064ca033ce82f8f SHA512 e847e8e95cd3b787a4d4b36391333180bf75400484e1443e0be5b7ec2fe58213e52defdeb2a74d0b80c1d7b93faad7b3a0a72ad86027458db885b1780108c94d +EBUILD libjpeg-turbo-2.1.5.1.ebuild 3138 BLAKE2B 354c5f0b3d57c0dfe1ac339d8fc2b8c2a494c8d74126f86e2784c3cd9313b12978409f31ea9606dc966c8371efffdccbc11cd37025cb9bfcfa224ecf2d948316 SHA512 6251d0a51721d18cfc1b38d4bca54173e91e8cb82f061ad83a232dfc08fa14567b6f2dc65ac07afefd8922dce7650f3fce83d4aecf1635b0a258d422ff31a6a3 MISC metadata.xml 567 BLAKE2B b4e2dc1098bc3a518b8af80dd63a9d6d000c6a62ab26e9d7792743b10955738bfccde4f6e32d46599194d8f63066913dad4b20c7a8674917d7bf9cd217a0f9bc SHA512 d9af7f4a6ca425c6ae75ac96da3b4467c62dc3baa0be04e590dc821f17e03e12279ed1faf2e66944ce0bed9ed0c9b176e7e372278062588db7adc9ed71f200c1 diff --git a/media-libs/libjpeg-turbo/libjpeg-turbo-2.1.5.1.ebuild b/media-libs/libjpeg-turbo/libjpeg-turbo-2.1.5.1.ebuild index ef3f4d227087..2a25e037a2fc 100644 --- a/media-libs/libjpeg-turbo/libjpeg-turbo-2.1.5.1.ebuild +++ b/media-libs/libjpeg-turbo/libjpeg-turbo-2.1.5.1.ebuild @@ -15,7 +15,7 @@ SRC_URI=" LICENSE="BSD IJG ZLIB" SLOT="0/0.2" if [[ $(ver_cut 3) -lt 90 ]] ; then - KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~x64-macos ~x64-solaris" + KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ppc64 ~riscv ~s390 ~sparc x86 ~amd64-linux ~x86-linux ~arm64-macos ~x64-macos ~x64-solaris" fi IUSE="cpu_flags_arm_neon java static-libs" diff --git a/media-libs/svt-av1/Manifest b/media-libs/svt-av1/Manifest index ff1435b54dd0..97c5fafbd419 100644 --- a/media-libs/svt-av1/Manifest +++ b/media-libs/svt-av1/Manifest @@ -4,6 +4,6 @@ DIST SVT-AV1-v1.5.0.tar.bz2 9490521 BLAKE2B 6f54c1706ed65b8248bc434411cfdea58697 DIST svt-av1-1.1.0.tar.gz 9882945 BLAKE2B 2673fdbe17b36607e581cc540ca181672d16b3fbc0dd9c1a8b100ebea6b7a6872d6fa55976cb19c1c8afd50c5c09b67fbec1bcc892007ccd41e7f7ad68027d83 SHA512 87d661183de33554d228c2fa72deb9a945f2550083eb25688b4dc0676be384373a6a52af235066d85ce963ffbc7751c8afb46a2bc1c09e00f81ea0db5a232522 EBUILD svt-av1-1.1.0.ebuild 1230 BLAKE2B c052068cc58e86e6f8147b5fdadf06633dcfe6fcb4dd020783e151be6dec1f59a8e1f0fce7ce7164cf0980973dcd579b0aadbd5a063dd1b26d4db5cd427a54d6 SHA512 3be02f20fe8ad0b4990d669bea9a9e266f65c529a41dfbf833e5477fcd6534f7a515ced45612862fe8213acd577eea30699e0c84bb9e5ba60e78c743785a4bef EBUILD svt-av1-1.4.1.ebuild 1351 BLAKE2B d9d2c3936b391ab1ca9e55a0d54f8f01211df8860cb44d9a35901e0354674a9daa483cd15bcde347d0ebcd10da110e0a7fcad592bd3634a101a0ef1a2fa8dd39 SHA512 6be3587e7fb497cddfefe28552a7a1b701f1f58c1f7bc0136daaa973736a122352c65402e62828a0a1a132a5d8ad042788ba9734b8b5193e5db92d14cc3bcb9b -EBUILD svt-av1-1.5.0.ebuild 1424 BLAKE2B 0dbc82ef36f8de6d4a1c37dce1a1a2580e3ae1cea759b17a72ae9b2b5bb0be017e2b06b11e4a370e64d0871fb6cb57aad4a88e00de0fc2e5e7a1b9eb324e089a SHA512 f1f66fc5989b29226ff251cb8ea42b773429e697d42972a31a13ddcc33cae295220fab9966a6113dc2d7017e0f74a3d5c4d4a96428cf50a392f2c734e90ec7fb +EBUILD svt-av1-1.5.0-r1.ebuild 1445 BLAKE2B eb7633047e5d1bc9022782337cebc27e9643eed9246bc804eefc41228e75f6452ec482b9f821903fc7990aab2cf556fd6757b97835b2bbf1723693a001a4ca75 SHA512 99dec6d830516ccdbc4c71a30aef347eac0078d6ee7b024b0dc66aac19cebec4ed4dc0ba8362b033bd6d69bd22eb15a0b2e086106cc1f07b7dc1aacc1a15b08e EBUILD svt-av1-9999.ebuild 1424 BLAKE2B 0dbc82ef36f8de6d4a1c37dce1a1a2580e3ae1cea759b17a72ae9b2b5bb0be017e2b06b11e4a370e64d0871fb6cb57aad4a88e00de0fc2e5e7a1b9eb324e089a SHA512 f1f66fc5989b29226ff251cb8ea42b773429e697d42972a31a13ddcc33cae295220fab9966a6113dc2d7017e0f74a3d5c4d4a96428cf50a392f2c734e90ec7fb MISC metadata.xml 561 BLAKE2B 1effb05644507ea39fe071f9de1fe4c1a4feb30f9bc429985cf464aea9f9bc1f525e0c6f5e75da47d373f0acd60394a2bcec3b71e68bc3ab031334f95717d3b8 SHA512 1042fb94a9c0b93c007843585e0ea075d187cdd6b77bb8eb94d5fcfaa7d083a98916aedcbfccd1fa3da3307ef8bbe7d623efa7e39ccc9714d23973497bec7a89 diff --git a/media-libs/svt-av1/svt-av1-1.5.0-r1.ebuild b/media-libs/svt-av1/svt-av1-1.5.0-r1.ebuild new file mode 100644 index 000000000000..2eb0ddfd23fe --- /dev/null +++ b/media-libs/svt-av1/svt-av1-1.5.0-r1.ebuild @@ -0,0 +1,46 @@ +# Copyright 2020-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit cmake-multilib flag-o-matic + +DESCRIPTION="Scalable Video Technology for AV1 (SVT-AV1 Encoder and Decoder)" +HOMEPAGE="https://gitlab.com/AOMediaCodec/SVT-AV1" + +if [[ ${PV} = 9999 ]]; then + inherit git-r3 + EGIT_REPO_URI="https://gitlab.com/AOMediaCodec/SVT-AV1.git" +else + SRC_URI="https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/v${PV}/SVT-AV1-v${PV}.tar.bz2" + KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86" + S="${WORKDIR}/SVT-AV1-v${PV}" +fi + +# Also see "Alliance for Open Media Patent License 1.0" +LICENSE="BSD-2 Apache-2.0 BSD ISC LGPL-2.1+ MIT" +SLOT="0" + +BDEPEND="amd64? ( dev-lang/yasm )" + +PATCHES=( + "${FILESDIR}"/${PN}-1.5.0-fortify-no-override.patch +) + +multilib_src_configure() { + append-ldflags -Wl,-z,noexecstack + + local mycmakeargs=( + # Tests require linking against https://github.com/Cidana-Developers/aom/tree/av1-normative ? + # undefined reference to `ifd_inspect' + # https://github.com/Cidana-Developers/aom/commit/cfc5c9e95bcb48a5a41ca7908b44df34ea1313c0 + # .. and https://gitlab.com/AOMediaCodec/SVT-AV1/-/blob/master/.gitlab/workflows/linux/.gitlab-ci.yml implies it's all quite manual? + -DBUILD_TESTING=OFF + -DCMAKE_OUTPUT_DIRECTORY="${BUILD_DIR}" + -DENABLE_AVX512=ON + ) + + [[ ${ABI} != amd64 ]] && mycmakeargs+=( -DCOMPILE_C_ONLY=ON ) + + cmake_src_configure +} diff --git a/media-libs/svt-av1/svt-av1-1.5.0.ebuild b/media-libs/svt-av1/svt-av1-1.5.0.ebuild deleted file mode 100644 index 01c83e30f392..000000000000 --- a/media-libs/svt-av1/svt-av1-1.5.0.ebuild +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright 2020-2023 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -inherit cmake-multilib flag-o-matic - -DESCRIPTION="Scalable Video Technology for AV1 (SVT-AV1 Encoder and Decoder)" -HOMEPAGE="https://gitlab.com/AOMediaCodec/SVT-AV1" - -if [[ ${PV} = 9999 ]]; then - inherit git-r3 - EGIT_REPO_URI="https://gitlab.com/AOMediaCodec/SVT-AV1.git" -else - SRC_URI="https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/v${PV}/SVT-AV1-v${PV}.tar.bz2" - KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86" - S="${WORKDIR}/SVT-AV1-v${PV}" -fi - -# Also see "Alliance for Open Media Patent License 1.0" -LICENSE="BSD-2 Apache-2.0 BSD ISC LGPL-2.1+ MIT" -SLOT="0" - -BDEPEND="amd64? ( dev-lang/yasm )" - -PATCHES=( - "${FILESDIR}"/${PN}-1.5.0-fortify-no-override.patch -) - -multilib_src_configure() { - append-ldflags -Wl,-z,noexecstack - - local mycmakeargs=( - # Tests require linking against https://github.com/Cidana-Developers/aom/tree/av1-normative ? - # undefined reference to `ifd_inspect' - # https://github.com/Cidana-Developers/aom/commit/cfc5c9e95bcb48a5a41ca7908b44df34ea1313c0 - # .. and https://gitlab.com/AOMediaCodec/SVT-AV1/-/blob/master/.gitlab/workflows/linux/.gitlab-ci.yml implies it's all quite manual? - -DBUILD_TESTING=OFF - -DCMAKE_OUTPUT_DIRECTORY="${BUILD_DIR}" - ) - - [[ ${ABI} != amd64 ]] && mycmakeargs+=( -DCOMPILE_C_ONLY=ON ) - - cmake_src_configure -} -- cgit v1.2.3