Date: Sun, 01 Mar 2026 20:47:00 +0000 From: Yuri Victorovich <yuri@FreeBSD.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org Subject: git: a8ecd941ebdf - main - audio/bliss: update 1.2.0=?utf-8?Q?-209 =E2=86=92?= 1.2.0.210 Message-ID: <69a4a5c4.2532a.ab6a586@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by yuri: URL: https://cgit.FreeBSD.org/ports/commit/?id=a8ecd941ebdf3d40b648e63d99f437a6487bb423 commit a8ecd941ebdf3d40b648e63d99f437a6487bb423 Author: Yuri Victorovich <yuri@FreeBSD.org> AuthorDate: 2026-03-01 17:18:26 +0000 Commit: Yuri Victorovich <yuri@FreeBSD.org> CommitDate: 2026-03-01 20:35:18 +0000 audio/bliss: update 1.2.0-209 → 1.2.0.210 --- audio/bliss/Makefile | 7 +- audio/bliss/distinfo | 6 +- audio/bliss/files/patch-src_decode.c | 53 +++++++++++++++ audio/bliss/files/patch-src_frequency__sort.c | 95 +++++++++++++++++++++++++++ 4 files changed, 153 insertions(+), 8 deletions(-) diff --git a/audio/bliss/Makefile b/audio/bliss/Makefile index ff6495baa86a..e5877756c0f4 100644 --- a/audio/bliss/Makefile +++ b/audio/bliss/Makefile @@ -1,8 +1,7 @@ PORTNAME= bliss DISTVERSIONPREFIX= v -DISTVERSION= 1.2.0-209 -DISTVERSIONSUFFIX= -g3464680 -PORTREVISION= 2 +DISTVERSION= 1.2.0-210 +DISTVERSIONSUFFIX= -g20c4536 CATEGORIES= audio PKGNAMESUFFIX= -music-analyzer @@ -13,8 +12,6 @@ WWW= https://github.com/Polochon-street/bliss LICENSE= MIT LICENSE_FILE= ${WRKSRC}/LICENSE -BROKEN= Does not build with ffmpeg > 6, see https://github.com/Polochon-street/bliss/issues/164 - LIB_DEPENDS= libavcodec.so:multimedia/ffmpeg \ libfftw3.so:math/fftw3 diff --git a/audio/bliss/distinfo b/audio/bliss/distinfo index f8f14c6d0088..98e652ef1cec 100644 --- a/audio/bliss/distinfo +++ b/audio/bliss/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1679759094 -SHA256 (Polochon-street-bliss-v1.2.0-209-g3464680_GH0.tar.gz) = 7bc9f5fb3dde136efae92e342c1daf3049a2a6846aa8782660dfeb6fb67d2608 -SIZE (Polochon-street-bliss-v1.2.0-209-g3464680_GH0.tar.gz) = 2166628 +TIMESTAMP = 1772384828 +SHA256 (Polochon-street-bliss-v1.2.0-210-g20c4536_GH0.tar.gz) = ddb531b0acc326798ea2cda9f82a08f98df53b9c29a4e831102456d720fcb867 +SIZE (Polochon-street-bliss-v1.2.0-210-g20c4536_GH0.tar.gz) = 2166640 diff --git a/audio/bliss/files/patch-src_decode.c b/audio/bliss/files/patch-src_decode.c new file mode 100644 index 000000000000..5177882e8e70 --- /dev/null +++ b/audio/bliss/files/patch-src_decode.c @@ -0,0 +1,53 @@ +--- src/decode.c.orig 2026-03-01 17:09:43 UTC ++++ src/decode.c +@@ -66,8 +66,10 @@ int bl_audio_decode(char const *const filename, struct + } + + // Find stream and corresponding codec ++ const AVCodec *codec_const = NULL; + audio_stream = +- av_find_best_stream(context, AVMEDIA_TYPE_AUDIO, -1, -1, &codec, 0); ++ av_find_best_stream(context, AVMEDIA_TYPE_AUDIO, -1, -1, &codec_const, 0); ++ codec = (AVCodec *)codec_const; + if (audio_stream < 0) { + fprintf(stderr, "Couldn't find a suitable audio stream\n"); + avformat_close_input(&context); +@@ -106,7 +108,6 @@ int bl_audio_decode(char const *const filename, struct + index = 0; + + // Read the whole data and copy them into a huge buffer +- av_init_packet(&avpkt); + decoded_frame = av_frame_alloc(); + if (!decoded_frame) { + fprintf(stderr, "Could not allocate audio frame\n"); +@@ -230,7 +231,7 @@ int fill_song_properties(struct bl_song *const song, c + #else + song->sample_rate = codecpar->sample_rate; + song->nb_bytes_per_sample = av_get_bytes_per_sample(codecpar->format); +- song->channels = codecpar->channels; ++ song->channels = codecpar->ch_layout.nb_channels; + #endif + song->duration = (uint64_t)(context->duration) / ((uint64_t)AV_TIME_BASE); + song->bitrate = context->bit_rate; +@@ -332,11 +333,21 @@ int fill_song_properties(struct bl_song *const song, c + codec_context->channel_layout, 0); + av_opt_set_int(*swr_ctx, "out_sample_rate", SAMPLE_RATE, 0); + #else ++#if LIBAVUTIL_VERSION_MAJOR < 58 + av_opt_set_int(*swr_ctx, "in_channel_layout", codecpar->channel_layout, 0); + av_opt_set_int(*swr_ctx, "in_sample_rate", codecpar->sample_rate, 0); + av_opt_set_sample_fmt(*swr_ctx, "in_sample_fmt", codecpar->format, 0); + av_opt_set_int(*swr_ctx, "out_channel_layout", AV_CH_LAYOUT_STEREO, 0); + av_opt_set_int(*swr_ctx, "out_sample_rate", SAMPLE_RATE, 0); ++#else ++ AVChannelLayout in_ch_layout = codecpar->ch_layout; ++ AVChannelLayout out_ch_layout = AV_CHANNEL_LAYOUT_STEREO; ++ av_opt_set_chlayout(*swr_ctx, "in_chlayout", &in_ch_layout, 0); ++ av_opt_set_int(*swr_ctx, "in_sample_rate", codecpar->sample_rate, 0); ++ av_opt_set_sample_fmt(*swr_ctx, "in_sample_fmt", codecpar->format, 0); ++ av_opt_set_chlayout(*swr_ctx, "out_chlayout", &out_ch_layout, 0); ++ av_opt_set_int(*swr_ctx, "out_sample_rate", SAMPLE_RATE, 0); ++#endif + #endif + av_opt_set_sample_fmt(*swr_ctx, "out_sample_fmt", AV_SAMPLE_FMT_S16, 0); + if (swr_init(*swr_ctx) < 0) { diff --git a/audio/bliss/files/patch-src_frequency__sort.c b/audio/bliss/files/patch-src_frequency__sort.c new file mode 100644 index 000000000000..e47a5e0fae75 --- /dev/null +++ b/audio/bliss/files/patch-src_frequency__sort.c @@ -0,0 +1,95 @@ +--- src/frequency_sort.c.orig 2026-03-01 17:09:43 UTC ++++ src/frequency_sort.c +@@ -1,5 +1,5 @@ + #include "bliss.h" +-#include <libavcodec/avfft.h> ++#include <libavutil/tx.h> + #include <math.h> + + // Number of bits in the FFT, log2 of the length +@@ -19,15 +19,18 @@ float bl_frequency_sort(struct bl_song const *const so + + float bl_frequency_sort(struct bl_song const *const song) { + // FFT transform context +- RDFTContext *fft; ++ AVTXContext *fft = NULL; ++ av_tx_fn tx_fn; + // Hann window values + float hann_window[WINDOW_SIZE]; + // Number of frames, that is number of juxtaposed windows in the music + int n_frames; + // Complex DFT of input +- FFTSample *x; ++ float *x; ++ // Complex output from FFT ++ AVComplexFloat *x_out; + // Hold FFT power spectrum +- FFTSample *power_spectrum; ++ float *power_spectrum; + // Power maximum value + float peak = 0; + +@@ -50,19 +53,28 @@ float bl_frequency_sort(struct bl_song const *const so + n_frames = floor((song->nSamples / song->channels) / WINDOW_SIZE); + + // Allocate memory for x vector +- x = (FFTSample *)av_malloc(WINDOW_SIZE * sizeof(FFTSample)); ++ x = (float *)av_malloc(WINDOW_SIZE * sizeof(float)); + ++ // Allocate memory for complex output ++ x_out = (AVComplexFloat *)av_malloc(WINDOW_SIZE * sizeof(AVComplexFloat)); ++ + // Zero-initialize power spectrum +- power_spectrum = (FFTSample *)av_malloc( +- (WINDOW_SIZE * sizeof(FFTSample)) / 2 + 1 * sizeof(FFTSample)); ++ power_spectrum = (float *)av_malloc( ++ (WINDOW_SIZE / 2 + 1) * sizeof(float)); + for (int i = 0; i <= WINDOW_SIZE / 2; + ++i) { // 2 factor due to x's complex nature and power_spectrum's real + // nature. + power_spectrum[i] = 0.0f; + } + +- // Initialize fft +- fft = av_rdft_init(WIN_BITS, DFT_R2C); ++ // Initialize fft with new AVTXContext API ++ float scale = 1.0f; ++ if (av_tx_init(&fft, &tx_fn, AV_TX_FLOAT_RDFT, 0, WINDOW_SIZE, &scale, 0) < 0) { ++ av_free(x); ++ av_free(x_out); ++ av_free(power_spectrum); ++ return 0.0f; ++ } + + for (int i = 0; i < n_frames * WINDOW_SIZE * song->channels; + i += song->channels * WINDOW_SIZE) { +@@ -80,14 +92,13 @@ float bl_frequency_sort(struct bl_song const *const so + } + + // Compute FFT +- av_rdft_calc(fft, x); ++ tx_fn(fft, x_out, x, sizeof(float)); + + // Fill-in power spectrum +- power_spectrum[0] = +- x[0] * x[0]; // Ignore x[1] due to ffmpeg's fft specifity ++ power_spectrum[0] = x_out[0].re * x_out[0].re; + for (int d = 1; d < WINDOW_SIZE / 2; ++d) { +- float re = x[d * 2]; +- float im = x[d * 2 + 1]; ++ float re = x_out[d].re; ++ float im = x_out[d].im; + float raw = (re * re) + (im * im); + power_spectrum[d] += raw; + } +@@ -130,8 +141,9 @@ float bl_frequency_sort(struct bl_song const *const so + + // Clean everything + av_free(x); ++ av_free(x_out); + av_free(power_spectrum); +- av_rdft_end(fft); ++ av_tx_uninit(&fft); + + // Return final score, weighted by coefficients in order to have -4 for a + // panel of calm songs, and 4 for a panel of loud songs. (only useful if youhome | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69a4a5c4.2532a.ab6a586>
