1
0
mirror of https://git.freebsd.org/ports.git synced 2026-06-02 11:08:52 +00:00

audio/wavegain: Update to 1.3.1

No public changelog but this version is thread safe

PR:		287385
Approved by:	maintainer timeout, 1+ month
This commit is contained in:
Daniel Engberg
2025-08-02 08:46:21 +02:00
parent e0b0759f50
commit af21b5512e
7 changed files with 21 additions and 196 deletions
+7 -10
View File
@@ -1,9 +1,8 @@
PORTNAME= wavegain
PORTVERSION= 1.2.8
PORTREVISION= 3
DISTVERSION= 1.3.1
CATEGORIES= audio
MASTER_SITES= http://www.rarewares.org/files/others/
DISTNAME= ${PORTNAME}-${PORTVERSION}srcs${EXTRACT_SUFFIX}
DISTNAME= ${PORTNAME}-${DISTVERSION}srcs
MAINTAINER= darcsis@gmail.com
COMMENT= Program that applies ReplayGain to wave files
@@ -11,20 +10,18 @@ WWW= https://www.rarewares.org/others.html
LICENSE= LGPL21
LIB_DEPENDS= libsndfile.so:audio/libsndfile
ONLY_FOR_ARCHS= i386 amd64
ONLY_FOR_ARCHS_REASON= uses x86 assembly
USES= gmake dos2unix zip
USES= dos2unix zip
WRKSRC= ${WRKDIR}/WaveGain-${DISTVERSION}
PLIST_FILES= bin/wavegain
WRKSRC= ${WRKDIR}/WaveGain-${PORTVERSION}
do-build:
@cd ${WRKSRC} && ${CC} ${CFLAGS} *.c -o ${PORTNAME} \
-DHAVE_CONFIG_H -lm -lsndfile -L${LOCALBASE}/lib
(cd ${WRKSRC} && ${SETENVI} ${CC} *.c -o ${PORTNAME} \
${CFLAGS} -DHAVE_CONFIG_H ${LDFLAGS} -lm)
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin
+3 -2
View File
@@ -1,2 +1,3 @@
SHA256 (wavegain-1.2.8srcs.zip) = e1ded05855fa209a67b887fa90e62c7c0a018dab20265a54d26eca40a6cc1436
SIZE (wavegain-1.2.8srcs.zip) = 72867
TIMESTAMP = 1749380338
SHA256 (wavegain-1.3.1srcs.zip) = 939bdcae73c59851f0a4aaf4e1ecee0815d293f105cc6372c95d4bbeb9346d3d
SIZE (wavegain-1.3.1srcs.zip) = 76000
+4 -19
View File
@@ -1,7 +1,7 @@
--- audio.c.orig 2020-09-25 07:48:54 UTC
--- audio.c.orig 2025-06-08 11:07:50 UTC
+++ audio.c
@@ -32,20 +32,8 @@
#include <sys/types.h>
@@ -32,14 +32,6 @@
#include <sys/stat.h>
#include <math.h>
-#ifdef _WIN32
@@ -14,19 +14,4 @@
-
#include <fcntl.h>
-#ifndef __MACOSX__
-#include <malloc.h>
-#endif
-
#include "config.h"
#include "audio.h"
#include "i18n.h"
@@ -642,7 +630,7 @@ int wav_open(FILE *in, wavegain_opt *opt, unsigned cha
if (!find_gain_chunk(in, &len))
FSEEK64(in, current_pos, SEEK_SET);
else {
- char buf_double[8];
+ unsigned char buf_double[8];
opt->gain_chunk = 1;
fread(buf_double, 1, 8, in);
opt->gain_scale = READ_D64(buf_double);
#ifndef __MACOSX__
+2 -2
View File
@@ -1,6 +1,6 @@
--- audio.h.orig 2008-11-11 11:29:08 UTC
--- audio.h.orig 2025-06-08 11:12:29 UTC
+++ audio.h
@@ -118,7 +118,7 @@ void raw_close(void *);
@@ -136,7 +136,7 @@ long wav_ieee_read(void *, double **buffer, int sample
long wav_read(void *, double **buffer, int samples, int fast, int chunk);
long wav_ieee_read(void *, double **buffer, int samples, int fast, int chunk);
-44
View File
@@ -1,44 +0,0 @@
--- main.c.orig 2008-08-08 08:48:38 UTC
+++ main.c
@@ -178,7 +178,7 @@ int process_files(FILE_LIST* file_list, SETTINGS* sett
/* Undo previously applied gain */
if (settings->undo) {
for (file = file_list; file; file = file->next_file) {
- if (file->filename == '\0')
+ if (file->filename == NULL)
continue;
if (!write_gains(file->filename, 0, 0, 0, 0, 0, settings)) {
fprintf(stderr, " Error processing GAIN for file - %s\n", file->filename);
@@ -191,12 +191,12 @@ int process_files(FILE_LIST* file_list, SETTINGS* sett
for (file = file_list; file; file = file->next_file) {
int dc_l;
int dc_r;
- if (file->filename == '\0')
+ if (file->filename == NULL)
continue;
if (!get_gain(file->filename, &file->track_peak, &file->track_gain,
file->dc_offset, file->offset, settings)) {
- file->filename = '\0';
+ file->filename = NULL;
continue;
}
dc_l = (int)(file->dc_offset[0] * 32768 * -1);
@@ -262,7 +262,7 @@ int process_files(FILE_LIST* file_list, SETTINGS* sett
if(settings->apply_gain) { /* Write radio and audiophile gains. */
total_files = 0.0;
for (file = file_list; file; file = file->next_file) {
- if (file->filename == '\0')
+ if (file->filename == NULL)
continue;
if (settings->audiophile && settings->set_album_gain == 1)
break;
@@ -297,7 +297,7 @@ int process_files(FILE_LIST* file_list, SETTINGS* sett
SetEnvironmentVariable("ALBUM_PEAK", ftos(settings->album_peak, "%.0lf"));
for (file = file_list; file; file = file->next_file) {
- if (file->filename == '\0')
+ if (file->filename[0] == NULL)
continue;
if (dir[0] == '.' && dir[1] == '\\') dir += 2;
-12
View File
@@ -1,12 +0,0 @@
--- misc.c.orig 2006-06-04 21:47:38 UTC
+++ misc.c
@@ -39,8 +39,7 @@ void file_error(const char* message, ...)
vfprintf(stderr, message, args);
va_end(args);
- fprintf(stderr, strerror(err_num));
- fprintf(stderr, "\n");
+ fprintf(stderr, "%s\n", strerror(err_num));
}
+5 -107
View File
@@ -1,11 +1,12 @@
--- wavegain.c.orig 2020-09-25 07:55:21 UTC
--- wavegain.c.orig 2025-06-08 11:08:36 UTC
+++ wavegain.c
@@ -19,20 +19,8 @@
#include <string.h>
@@ -34,15 +34,6 @@
#include <time.h>
#include <ctype.h>
-#ifdef _WIN32
-#include <io.h>
-#include <process.h>
-#else
-# ifndef __MACOSX__
-# include <sys/io.h>
@@ -14,107 +15,4 @@
-
#include <fcntl.h>
-#ifndef __MACOSX__
-#include <malloc.h>
-#endif
-
#include "gain_analysis.h"
#include "i18n.h"
#include "getopt.h"
@@ -44,6 +32,8 @@
#ifdef _WIN32
#include <windows.h>
+#else
+#include <unistd.h>
#endif
#ifdef ENABLE_RECURSIVE
@@ -57,6 +47,9 @@
#define ROUND64(x) ( doubletmp = (x) + Dither.Add + (Int64_t)0x001FFFFD80000000L, *(Int64_t*)(&doubletmp) - (Int64_t)0x433FFFFD80000000L )
#endif
+#include <errno.h>
+static int xrename(const char *oldpath, const char *newpath);
+
extern int write_to_log;
dither_t Dither;
double doubletmp;
@@ -639,7 +632,14 @@ int write_gains(const char *filename, double radio_gai
goto exit;
}
- if (rename(TEMP_NAME, filename) != 0) {
+ /*
+ * int rename(const char *old, const char *new);
+ * In POSIX, rename will fail if the 'old' and 'new' names are on different mounted file systems.
+ * ( From http://en.wikipedia.org/wiki/Rename_%28C%29 )
+ * Function 'xrename' from 'normalize-0.7.6' is one clever solution
+ */
+ /*if (rename(TEMP_NAME, filename) != 0) {*/
+ if (xrename(TEMP_NAME, filename) != 0) {
fprintf(stderr, " Error renaming '" TEMP_NAME "' to '%s' (uh-oh)\n", filename);
goto exit;
}
@@ -650,4 +650,61 @@ exit:
return result;
}
+/* From normalize-0.7.6/nid3lib/write.c
+ * Move the file "oldpath" to "newpath", or copy and delete if they
+ * are on different filesystems.
+*/
+static int
+xrename(const char *oldpath, const char *newpath)
+{
+ FILE *in, *out;
+ char buf[4096];
+ size_t sz;
+ if (strcmp(oldpath, newpath) == 0)
+ return 0;
+
+#ifdef __EMX__
+ if (unlink(newpath) == -1 && errno != ENOENT)
+ return -1;
+#endif
+
+ if (rename(oldpath, newpath) == -1) {
+ if (errno == EXDEV) {
+ /* files are on different filesystems, so we have to copy */
+ if (unlink(newpath) == -1 && errno != ENOENT)
+ return -1;
+
+ in = fopen(oldpath, "rb");
+ if (in == NULL)
+ return -1;
+ out = fopen(newpath, "wb");
+ if (out == NULL) {
+ fclose(in);
+ return -1;
+ }
+
+ while ((sz = fread(buf, 1, 4096, in)) > 0)
+ fwrite(buf, 1, sz, out);
+
+ if (ferror(in) || ferror(out)) {
+ fclose(in);
+ fclose(out);
+ return -1;
+ }
+ if (fclose(in) == EOF) {
+ fclose(out);
+ return -1;
+ }
+ if (fclose(out) == EOF)
+ return -1;
+
+ if (unlink(oldpath) == -1)
+ return -1;
+ } else {
+ return -1;
+ }
+ }
+
+ return 0;
+}
#ifndef __MACOSX__