commit:     feae190908f33d6c840a234ed163aae7d670adc7
Author:     YOSHIOKA Takuma <lo48576 <AT> hard-wi <DOT> red>
AuthorDate: Thu Mar 20 11:49:51 2025 +0000
Commit:     YOSHIOKA Takuma <lo48576 <AT> hard-wi <DOT> red>
CommitDate: Thu Mar 20 11:49:51 2025 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=feae1909

media-sound/loudgain: support ffmpeg-7

Signed-off-by: YOSHIOKA Takuma <lo48576 <AT> hard-wi.red>

 .../files/loudgain-0.6.8-github-pr34-manpage.patch |  69 ++++++++++++
 ...ain-0.6.8-github-pr37-respect-build-flags.patch |  31 ++++++
 ...in-0.6.8-github-pr53-print-taglib-version.patch |  77 +++++++++++++
 .../files/loudgain-0.6.8-github-pr66-ffmpeg7.patch | 124 +++++++++++++++++++++
 .../loudgain/loudgain-0.6.8_p20240128-r1.ebuild    |  41 +++++++
 5 files changed, 342 insertions(+)

diff --git 
a/media-sound/loudgain/files/loudgain-0.6.8-github-pr34-manpage.patch 
b/media-sound/loudgain/files/loudgain-0.6.8-github-pr34-manpage.patch
new file mode 100644
index 000000000..92b77fccd
--- /dev/null
+++ b/media-sound/loudgain/files/loudgain-0.6.8-github-pr34-manpage.patch
@@ -0,0 +1,69 @@
+https://github.com/Moonbase59/loudgain/pull/34
+From 3b0bcd99b030908d55796e147eb5e4ab18ca579c Mon Sep 17 00:00:00 2001
+From: Hugh McMaster <hugh.mcmas...@outlook.com>
+Date: Mon, 3 Aug 2020 22:29:38 +1000
+Subject: [PATCH] docs/loudgain.1: Print apostrophes instead of acute accents
+
+This manual page uses the \' groff sequence to print acute accents,
+when you actually just need to print apostrophes.
+
+Signed-off-by: Hugh McMaster <hugh.mcmas...@outlook.com>
+---
+ docs/loudgain.1 | 14 +++++++-------
+ 1 file changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/docs/loudgain.1 b/docs/loudgain.1
+index 0aaeac2..55d01a2 100644
+--- a/docs/loudgain.1
++++ b/docs/loudgain.1
+@@ -13,7 +13,7 @@
+ \fBloudgain\fR is a loudness normalizer that scans music files and calculates 
loudness\-normalized gain and loudness peak values according to the EBU R128 
standard, and can optionally write ReplayGain\-compatible metadata\.
+ .
+ .P
+-loudgain implements a subset of mp3gain\'s command\-line options, which means 
that it can be used as a drop\-in replacement in some situations\.
++loudgain implements a subset of mp3gain's command\-line options, which means 
that it can be used as a drop\-in replacement in some situations\.
+ .
+ .P
+ loudgain will \fInot\fR modify the actual audio data, but instead just write 
ReplayGain \fItags\fR if so requested\. It is up to the player to interpret 
these\. (In some players, you need to enable this feature\.)
+@@ -71,19 +71,19 @@ Write ReplayGain 2\.0 tags to files\. ID3v2 for MP2, MP3, 
WAV and AIFF; Vorbis C
+ .
+ .TP
+ \fB\-s e, \-\-tagmode=e\fR
+-like \'\-s i\', plus extra tags (reference, ranges)\.
++like '\-s i', plus extra tags (reference, ranges)\.
+ .
+ .TP
+ \fB\-s l, \-\-tagmode=l\fR
+-like \'\-s e\', but LU units instead of dB\.
++like '\-s e', but LU units instead of dB\.
+ .
+ .TP
+ \fB\-s s, \-\-tagmode=s\fR
+-Don\'t write ReplayGain tags (default)\.
++Don't write ReplayGain tags (default)\.
+ .
+ .TP
+ \fB\-L, \-\-lowercase\fR
+-Force lowercase \'REPLAYGAIN_*\' tags (MP2/MP3/MP4/ASF/WMA/WAV/AIFF only)\. 
This is non\-standard, but sometimes needed\.
++Force lowercase 'REPLAYGAIN_*' tags (MP2/MP3/MP4/ASF/WMA/WAV/AIFF only)\. 
This is non\-standard, but sometimes needed\.
+ .
+ .TP
+ \fB\-S, \-\-striptags\fR
+@@ -107,7 +107,7 @@ Database\-friendly new format tab\-delimited list output\. 
Ideal for analysis of
+ .
+ .TP
+ \fB\-q, \-\-quiet\fR
+-Don\'t print scanning status messages\.
++Don't print scanning status messages\.
+ .
+ .SH "RECOMMENDATIONS"
+ To give you a head start, here are my personal recommendations for being 
(almost) universally compatible\.
+@@ -135,7 +135,7 @@ $ loudgain \-S \-a \-k \-s e *\.ape
+ .IP "" 0
+ .
+ .P
+-I’ve been happy with these settings for many years now\. Your mileage may 
vary\.
++I've been happy with these settings for many years now\. Your mileage may 
vary\.
+ .
+ .P
+ For easy mass\-tagging, there is a bash script called \fBrgbpm\fR included 
with loudgain, which follows above recommendations\. You can make a copy, put 
that into your personal \fB~/bin\fR folder and modify it to whatever \fIyou\fR 
need\.

diff --git 
a/media-sound/loudgain/files/loudgain-0.6.8-github-pr37-respect-build-flags.patch
 
b/media-sound/loudgain/files/loudgain-0.6.8-github-pr37-respect-build-flags.patch
new file mode 100644
index 000000000..cf4e4aadd
--- /dev/null
+++ 
b/media-sound/loudgain/files/loudgain-0.6.8-github-pr37-respect-build-flags.patch
@@ -0,0 +1,31 @@
+https://github.com/Moonbase59/loudgain/pull/37
+From 31fc71b9970f22a116a9ad7eae66dc9cc66a54c1 Mon Sep 17 00:00:00 2001
+From: Peter Oliver <g...@mavit.org.uk>
+Date: Sun, 18 Oct 2020 00:51:52 +0100
+Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20override=20CFLAGS=20and=20CXXFL?=
+ =?UTF-8?q?AGS=20env=20variables?=
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This is necessary, for example, to build with the [hardened build 
flags](https://src.fedoraproject.org/rpms/redhat-rpm-config/blob/master/f/buildflags.md#hardened-builds)
 used by default for Fedora.
+---
+ CMakeLists.txt | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 9487ab9..eb030e2 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -72,9 +72,9 @@ SET_TARGET_PROPERTIES(loudgain PROPERTIES
+   COMPILE_FLAGS "-Wall -pedantic -g"
+ )
+ 
+-SET(CMAKE_C_FLAGS "-std=gnu99 -D_GNU_SOURCE")
++SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -D_GNU_SOURCE")
+ 
+-SET(CMAKE_CXX_FLAGS "-std=gnu++11 -D_GNU_SOURCE")
++SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11 -D_GNU_SOURCE")
+ 
+ INSTALL(TARGETS loudgain DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
+ 

diff --git 
a/media-sound/loudgain/files/loudgain-0.6.8-github-pr53-print-taglib-version.patch
 
b/media-sound/loudgain/files/loudgain-0.6.8-github-pr53-print-taglib-version.patch
new file mode 100644
index 000000000..bcfa966d6
--- /dev/null
+++ 
b/media-sound/loudgain/files/loudgain-0.6.8-github-pr53-print-taglib-version.patch
@@ -0,0 +1,77 @@
+https://github.com/Moonbase59/loudgain/pull/53
+From f15d7dd9e7617e6d2a7c295a9ee83bf9ae93d0e3 Mon Sep 17 00:00:00 2001
+From: sagudev <16504129+sagu...@users.noreply.github.com>
+Date: Sat, 13 Aug 2022 18:27:52 +0200
+Subject: [PATCH] Print taglib version
+
+---
+ src/loudgain.c | 10 ++++++++++
+ src/tag.cc     |  6 ++++++
+ src/tag.h      |  2 ++
+ 3 files changed, 18 insertions(+)
+
+diff --git a/src/loudgain.c b/src/loudgain.c
+index 04f40e3..6b6b253 100644
+--- a/src/loudgain.c
++++ b/src/loudgain.c
+@@ -148,6 +148,10 @@ int  ebur128_v_major     = 0;
+ int  ebur128_v_minor     = 0;
+ int  ebur128_v_patch     = 0;
+ char ebur128_version[15] = "";
++int  tag_v_major     = 0;
++int  tag_v_minor     = 0;
++int  tag_v_patch     = 0;
++char tag_version[15] = "";
+ unsigned swr_ver         = 0;
+ char     swr_version[15] = "";
+ unsigned lavf_ver         = 0;
+@@ -176,6 +180,11 @@ int main(int argc, char *argv[]) {
+       bool strip          = false; // MP3 ID3v2: strip other tag types?
+       int  id3v2version   = 4;     // MP3 ID3v2 version to write; can be 3 or 
4
+ 
++      // taglib version 
++      tag_get_version(&tag_v_major, &tag_v_minor, &tag_v_patch);
++      snprintf(tag_version, sizeof(tag_version), "%d.%d.%d",
++              tag_v_major, tag_v_minor, tag_v_patch);
++
+       // libebur128 version check -- versions before 1.2.4 aren’t recommended
+       ebur128_get_version(&ebur128_v_major, &ebur128_v_minor, 
&ebur128_v_patch);
+       snprintf(ebur128_version, sizeof(ebur128_version), "%d.%d.%d",
+@@ -725,6 +734,7 @@ static inline void help(void) {
+ 
+ static inline void version(void) {
+       printf("%s %s - using:\n", PROJECT_NAME, PROJECT_VER);
++      printf("  %s %s\n", "libtag", tag_version);
+       printf("  %s %s\n", "libebur128", ebur128_version);
+       printf("  %s %s\n", "libavformat", lavf_version);
+       printf("  %s %s\n", "libswresample", swr_version);
+diff --git a/src/tag.cc b/src/tag.cc
+index 1c149f3..cd0eaa4 100644
+--- a/src/tag.cc
++++ b/src/tag.cc
+@@ -84,6 +84,12 @@
+ #include "tag.h"
+ #include "printf.h"
+ 
++void tag_get_version(int* major, int* minor, int* patch) {
++  *major = TAGLIB_MAJOR_VERSION;
++  *minor = TAGLIB_MINOR_VERSION;
++  *patch = TAGLIB_PATCH_VERSION;
++}
++
+ // define possible replaygain tags
+ 
+ enum RG_ENUM {
+diff --git a/src/tag.h b/src/tag.h
+index da80c1e..8d28e18 100644
+--- a/src/tag.h
++++ b/src/tag.h
+@@ -32,6 +32,8 @@
+ extern "C" {
+ #endif
+ 
++void tag_get_version(int* major, int* minor, int* patch);
++
+ bool tag_write_mp3(scan_result *scan, bool do_album, char mode, char *unit,
+   bool lowercase, bool strip, int id3v2version);
+ bool tag_clear_mp3(scan_result *scan, bool strip, int id3v2version);

diff --git 
a/media-sound/loudgain/files/loudgain-0.6.8-github-pr66-ffmpeg7.patch 
b/media-sound/loudgain/files/loudgain-0.6.8-github-pr66-ffmpeg7.patch
new file mode 100644
index 000000000..f139ae988
--- /dev/null
+++ b/media-sound/loudgain/files/loudgain-0.6.8-github-pr66-ffmpeg7.patch
@@ -0,0 +1,124 @@
+https://github.com/Moonbase59/loudgain/pull/66
+From 50741b98fb4b932759f05e8d208d80d93bcc8261 Mon Sep 17 00:00:00 2001
+From: Hugh McMaster <hugh.mcmas...@outlook.com>
+Date: Mon, 29 Jul 2024 23:15:35 +1000
+Subject: [PATCH] src/scan.c: Update for FFmpeg 7.0
+
+---
+ src/scan.c | 40 +++++++++++++++++++++-------------------
+ 1 file changed, 21 insertions(+), 19 deletions(-)
+
+diff --git a/src/scan.c b/src/scan.c
+index 85b36b3..91eb261 100644
+--- a/src/scan.c
++++ b/src/scan.c
+@@ -119,7 +119,7 @@ int scan_file(const char *file, unsigned index) {
+       AVCodecContext *ctx;
+ 
+       AVFrame *frame;
+-      AVPacket packet;
++      AVPacket *packet;
+ 
+       SwrContext *swr;
+ 
+@@ -177,8 +177,8 @@ int scan_file(const char *file, unsigned index) {
+       }
+ 
+   // try to get default channel layout (they aren’t specified in .wav files)
+-  if (!ctx->channel_layout)
+-    ctx->channel_layout = av_get_default_channel_layout(ctx->channels);
++  if (ctx->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC)
++    av_channel_layout_default(&ctx->ch_layout, ctx->ch_layout.nb_channels);
+ 
+   // show some information about the file
+   // only show bits/sample where it makes sense
+@@ -187,21 +187,21 @@ int scan_file(const char *file, unsigned index) {
+     snprintf(infotext, sizeof(infotext), "%d bit, ",
+       ctx->bits_per_raw_sample > 0 ? ctx->bits_per_raw_sample : 
ctx->bits_per_coded_sample);
+   }
+-  av_get_channel_layout_string(infobuf, sizeof(infobuf), -1, 
ctx->channel_layout);
++  av_channel_layout_describe(&ctx->ch_layout, infobuf, sizeof(infobuf));
+   ok_printf("Stream #%d: %s, %s%d Hz, %d ch, %s",
+-    stream_id, codec->long_name, infotext, ctx->sample_rate, ctx->channels, 
infobuf);
++    stream_id, codec->long_name, infotext, ctx->sample_rate, 
ctx->ch_layout.nb_channels, infobuf);
+ 
+       scan_codecs[index] = codec -> id;
+ 
+-      av_init_packet(&packet);
++      packet = av_packet_alloc();
+ 
+-      packet.data = buffer;
+-      packet.size = buffer_size;
++      packet->data = buffer;
++      packet->size = buffer_size;
+ 
+       swr = swr_alloc();
+ 
+       *ebur128 = ebur128_init(
+-              ctx -> channels, ctx -> sample_rate,
++              ctx->ch_layout.nb_channels, ctx->sample_rate,
+               EBUR128_MODE_S | EBUR128_MODE_I | EBUR128_MODE_LRA |
+               EBUR128_MODE_SAMPLE_PEAK | EBUR128_MODE_TRUE_PEAK
+       );
+@@ -222,10 +222,10 @@ int scan_file(const char *file, unsigned index) {
+ 
+       progress_bar(0, 0, 0, 0);
+ 
+-      while (av_read_frame(container, &packet) >= 0) {
+-              if (packet.stream_index == stream_id) {
++      while (av_read_frame(container, packet) >= 0) {
++              if (packet->stream_index == stream_id) {
+ 
+-      rc = avcodec_send_packet(ctx, &packet);
++      rc = avcodec_send_packet(ctx, packet);
+       if (rc < 0) {
+         err_printf("Error while sending a packet to the decoder");
+         break;
+@@ -252,7 +252,7 @@ int scan_file(const char *file, unsigned index) {
+       av_frame_unref(frame);
+     }
+ 
+-              av_packet_unref(&packet);
++              av_packet_unref(packet);
+       }
+ 
+   // complete progress bar for very short files (only cosmetic)
+@@ -263,9 +263,11 @@ int scan_file(const char *file, unsigned index) {
+ 
+       av_frame_free(&frame);
+ 
++        av_packet_free(&packet);
++
+       swr_free(&swr);
+ 
+-      avcodec_close(ctx);
++      avcodec_free_context(&ctx);
+ 
+       avformat_close_input(&container);
+ 
+@@ -413,12 +415,12 @@ static void scan_frame(ebur128_state *ebur128, AVFrame 
*frame,
+       int                 out_linesize;
+       enum AVSampleFormat out_fmt = AV_SAMPLE_FMT_S16;
+ 
+-      av_opt_set_channel_layout(swr, "in_channel_layout", frame -> 
channel_layout, 0);
+-      av_opt_set_channel_layout(swr, "out_channel_layout", frame -> 
channel_layout, 0);
++      av_opt_set_chlayout(swr, "in_chlayout", &frame->ch_layout, 0);
++      av_opt_set_chlayout(swr, "out_chlayout", &frame->ch_layout, 0);
+ 
+   // add channel count to properly handle .wav reading
+-  av_opt_set_int(swr, "in_channel_count",  frame -> channels, 0);
+-  av_opt_set_int(swr, "out_channel_count", frame -> channels, 0);
++  av_opt_set_int(swr, "in_channel_count",  frame->ch_layout.nb_channels, 0);
++  av_opt_set_int(swr, "out_channel_count", frame->ch_layout.nb_channels, 0);
+ 
+   av_opt_set_int(swr, "in_sample_rate", frame -> sample_rate, 0);
+   av_opt_set_int(swr, "out_sample_rate", frame -> sample_rate, 0);
+@@ -434,7 +436,7 @@ static void scan_frame(ebur128_state *ebur128, AVFrame 
*frame,
+       }
+ 
+       out_size = av_samples_get_buffer_size(
+-              &out_linesize, frame -> channels, frame -> nb_samples, out_fmt, 0
++              &out_linesize, frame->ch_layout.nb_channels, frame->nb_samples, 
out_fmt, 0
+       );
+ 
+       out_data = av_malloc(out_size);

diff --git a/media-sound/loudgain/loudgain-0.6.8_p20240128-r1.ebuild 
b/media-sound/loudgain/loudgain-0.6.8_p20240128-r1.ebuild
new file mode 100644
index 000000000..2035e2f60
--- /dev/null
+++ b/media-sound/loudgain/loudgain-0.6.8_p20240128-r1.ebuild
@@ -0,0 +1,41 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit cmake
+
+MY_COMMIT="079f82c613ea1e3597ad5e2cad077829fd75d2c9"
+MY_P="${PN}-${MY_COMMIT}"
+
+DESCRIPTION="Versatile ReplayGain 2.0 loudness normalizer"
+HOMEPAGE="https://github.com/Moonbase59/loudgain";
+SRC_URI="https://github.com/Moonbase59/${PN}/archive/${MY_COMMIT}.tar.gz -> 
${MY_P}.tar.gz"
+S="${WORKDIR}/${MY_P}"
+
+LICENSE="BSD-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+#REQUIRED_USE=""
+
+COMMON_DEPEND="
+       media-video/ffmpeg:=
+       media-libs/libebur128
+       media-libs/taglib
+"
+RDEPEND="${COMMON_DEPEND}"
+DEPEND="${COMMON_DEPEND}"
+
+PATCHES=(
+       "${FILESDIR}/loudgain-0.6.8-github-pr34-manpage.patch"
+       "${FILESDIR}/loudgain-0.6.8-github-pr37-respect-build-flags.patch"
+       "${FILESDIR}/loudgain-0.6.8-github-pr50-ffmpeg6.patch"
+       "${FILESDIR}/loudgain-0.6.8-github-pr53-print-taglib-version.patch"
+       "${FILESDIR}/loudgain-0.6.8-github-pr65-ffmpeg6-gcc14.patch"
+       "${FILESDIR}/loudgain-0.6.8-github-pr66-ffmpeg7.patch"
+)
+
+src_install() {
+       cmake_src_install
+       dodoc README.md
+}

Reply via email to