From 703f4729993ccbeba0ff4837a947066992234169 Mon Sep 17 00:00:00 2001 From: tigro Date: Wed, 25 Dec 2024 12:24:32 +0300 Subject: [PATCH] import libmpcdec-1.3.0^20110810svn475-2.el10 --- .gitignore | 3 +- .libmpcdec.metadata | 1 + ...g-behavior-that-confused-some-people.patch | 39 ++ ...-gcc-warnings-and-compilation-issues.patch | 150 +++++++ SOURCES/0003-prevent-endless-loops.patch | 26 ++ ...rd-to-global-variable-declaration-do.patch | 31 ++ ...w-output-to-mpcdec-not-really-tested.patch | 186 +++++++++ SOURCES/0008-FSF-address-change.patch | 372 ++++++++++++++++++ .../0011-removed-some-new-gcc-warnings.patch | 228 +++++++++++ ...move-compilation-error-and-a-warning.patch | 35 ++ ...fix-a-segfault-caused-by-commit-r476.patch | 57 +++ SOURCES/r475-cmake.patch | 31 ++ libmpcdec.spec => SPECS/libmpcdec.spec | 130 ++++-- sources | 1 - 14 files changed, 1264 insertions(+), 26 deletions(-) create mode 100644 .libmpcdec.metadata create mode 100644 SOURCES/0001-changes-a-seeking-behavior-that-confused-some-people.patch create mode 100644 SOURCES/0002-removed-some-gcc-warnings-and-compilation-issues.patch create mode 100644 SOURCES/0003-prevent-endless-loops.patch create mode 100644 SOURCES/0004-add-extern-keyword-to-global-variable-declaration-do.patch create mode 100644 SOURCES/0005-add-raw-output-to-mpcdec-not-really-tested.patch create mode 100644 SOURCES/0008-FSF-address-change.patch create mode 100644 SOURCES/0011-removed-some-new-gcc-warnings.patch create mode 100644 SOURCES/0012-mpcenc-remove-compilation-error-and-a-warning.patch create mode 100644 SOURCES/0013-mpc2sv8-fix-a-segfault-caused-by-commit-r476.patch create mode 100644 SOURCES/r475-cmake.patch rename libmpcdec.spec => SPECS/libmpcdec.spec (58%) delete mode 100644 sources diff --git a/.gitignore b/.gitignore index 9b448ba..97dd64a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ -libmpcdec-1.2.2.tar.bz2 -libmpcdec-1.2.6.tar.bz2 +SOURCES/musepack_src_r475.tar.gz diff --git a/.libmpcdec.metadata b/.libmpcdec.metadata new file mode 100644 index 0000000..1376bef --- /dev/null +++ b/.libmpcdec.metadata @@ -0,0 +1 @@ +bdd4042773eb5c885df70d7a19914fa6e2306391 SOURCES/musepack_src_r475.tar.gz diff --git a/SOURCES/0001-changes-a-seeking-behavior-that-confused-some-people.patch b/SOURCES/0001-changes-a-seeking-behavior-that-confused-some-people.patch new file mode 100644 index 0000000..31982f5 --- /dev/null +++ b/SOURCES/0001-changes-a-seeking-behavior-that-confused-some-people.patch @@ -0,0 +1,39 @@ +From b823edffc71103308ede0ebc0fcb3c783466db81 Mon Sep 17 00:00:00 2001 +From: r2d +Date: Thu, 24 Nov 2011 22:45:02 +0000 +Subject: [PATCH 01/19] changes a seeking behavior that confused some people + using the library. mpc_demux_decode() would return zero samples a couple of + times requiring the caller to loop over. patch by DEATH + +git-svn-id: http://svn.musepack.net/libmpc/trunk@476 c51c8d5e-032a-db11-a0f2-0002b3467eef +--- + libmpcdec/mpc_demux.c | 13 +++++++++---- + 1 file changed, 9 insertions(+), 4 deletions(-) + +diff --git a/libmpcdec/mpc_demux.c b/libmpcdec/mpc_demux.c +index 63e58e6..e486382 100644 +--- a/libmpcdec/mpc_demux.c ++++ b/libmpcdec/mpc_demux.c +@@ -637,10 +637,15 @@ static mpc_status mpc_demux_decode_inner(mpc_demux * d, mpc_frame_info * i) + } + + mpc_status mpc_demux_decode(mpc_demux * d, mpc_frame_info * i) { +- mpc_status s = mpc_demux_decode_inner(d, i); +- if (MPC_IS_FAILURE(s)) +- i->bits = -1; // we pretend it's end of file +- return s; ++ for(;;) { ++ // mpc_demux_decode_inner may return 0 samples and require repeated calls after a seek. Loop over until we have data to return. ++ mpc_status s = mpc_demux_decode_inner(d, i); ++ if (MPC_IS_FAILURE(s)) ++ i->bits = -1; // we pretend it's end of file ++ ++ if (MPC_IS_FAILURE(s) || i->samples > 0) ++ return s; ++ } + } + + mpc_status mpc_demux_seek_second(mpc_demux * d, double seconds) +-- +2.46.0 + diff --git a/SOURCES/0002-removed-some-gcc-warnings-and-compilation-issues.patch b/SOURCES/0002-removed-some-gcc-warnings-and-compilation-issues.patch new file mode 100644 index 0000000..ee03017 --- /dev/null +++ b/SOURCES/0002-removed-some-gcc-warnings-and-compilation-issues.patch @@ -0,0 +1,150 @@ +From c99bdc3a6c6beaf0e85bad75966330bab2478fed Mon Sep 17 00:00:00 2001 +From: r2d +Date: Sun, 1 Jan 2012 16:05:19 +0000 +Subject: [PATCH 02/19] removed some gcc warnings and compilation issues + +git-svn-id: http://svn.musepack.net/libmpc/trunk@477 c51c8d5e-032a-db11-a0f2-0002b3467eef +--- + common/fastmath.c | 3 +-- + libmpcdec/mpc_demux.c | 14 ++------------ + libmpcdec/streaminfo.c | 3 +-- + mpcchap/iniparser.c | 4 ++-- + mpcdec/CMakeLists.txt | 8 ++++---- + mpcgain/mpcgain.c | 4 ++-- + 6 files changed, 12 insertions(+), 24 deletions(-) + +diff --git a/common/fastmath.c b/common/fastmath.c +index 2a23a59..518b22c 100644 +--- a/common/fastmath.c ++++ b/common/fastmath.c +@@ -29,7 +29,7 @@ const float tabsqrt_m [ TABSTEP+1] [2]; + + void Init_FastMath ( void ) + { +- int i; mpc_floatint X, Y; double xm, x0, xp, x, y; float* p; ++ int i; mpc_floatint X; double xm, x0, xp, x, y; float* p; + + p = (float*) tabatan2; + for ( i = -TABSTEP; i <= TABSTEP; i++ ) { +@@ -56,7 +56,6 @@ void Init_FastMath ( void ) + p = (float*) tabsqrt_ex; + for ( i = 0; i < 255; i++ ) { + X.n = (i << 23); +- Y.n = (i << 23) + (1<<23) - 1; + *p++ = sqrt(X.f); + } + X.n = (255 << 23) - 1; +diff --git a/libmpcdec/mpc_demux.c b/libmpcdec/mpc_demux.c +index e486382..4d74dc7 100644 +--- a/libmpcdec/mpc_demux.c ++++ b/libmpcdec/mpc_demux.c +@@ -78,16 +78,6 @@ static mpc_int32_t mpc_unread_bytes_unchecked(mpc_demux * d) { + return d->bytes_total + d->buffer - d->bits_reader.buff - ((8 - d->bits_reader.count) >> 3); + } + +-// Returns the amount of unread bytes in the demux buffer. +-static mpc_uint32_t mpc_unread_bytes(mpc_demux * d) { +- mpc_int32_t unread_bytes = mpc_unread_bytes_unchecked(d); +- +- if (unread_bytes < 0) return 0; +- +- return (mpc_uint32_t) unread_bytes; +-} +- +- + + // Returns the number of bytes available in the buffer. + static mpc_uint32_t +@@ -96,8 +86,8 @@ mpc_demux_fill(mpc_demux * d, mpc_uint32_t min_bytes, int flags) + mpc_uint32_t unread_bytes = (mpc_uint32_t) mpc_unread_bytes_unchecked(d); + int offset = 0; + +- if ((mpc_int32_t) +- unread_bytes < 0) return 0; // Error - we've been reading past the end of the buffer - abort ++ if ((mpc_int32_t) unread_bytes < 0) ++ return 0; // Error - we've been reading past the end of the buffer - abort + + if (min_bytes == 0 || min_bytes > DEMUX_BUFFER_SIZE || + (unread_bytes < min_bytes && (flags & MPC_BUFFER_FULL) != 0 )) +diff --git a/libmpcdec/streaminfo.c b/libmpcdec/streaminfo.c +index 0e2e844..0e7769d 100644 +--- a/libmpcdec/streaminfo.c ++++ b/libmpcdec/streaminfo.c +@@ -108,7 +108,6 @@ static mpc_status check_streaminfo(mpc_streaminfo * si) + mpc_status + streaminfo_read_header_sv7(mpc_streaminfo* si, mpc_bits_reader * r) + { +- mpc_uint16_t Estimatedpeak_title = 0; + mpc_uint32_t frames, last_frame_samples; + + si->bitrate = 0; +@@ -120,7 +119,7 @@ streaminfo_read_header_sv7(mpc_streaminfo* si, mpc_bits_reader * r) + si->profile_name = mpc_get_version_string(si->profile); + mpc_bits_read(r, 2); // Link ? + si->sample_freq = samplefreqs[mpc_bits_read(r, 2)]; +- Estimatedpeak_title = (mpc_uint16_t) mpc_bits_read(r, 16); // read the ReplayGain data ++ mpc_bits_read(r, 16); // skip MaxLevel (maximum level of input PCM) + si->gain_title = (mpc_uint16_t) mpc_bits_read(r, 16); + si->peak_title = (mpc_uint16_t) mpc_bits_read(r, 16); + si->gain_album = (mpc_uint16_t) mpc_bits_read(r, 16); +diff --git a/mpcchap/iniparser.c b/mpcchap/iniparser.c +index 2ad88eb..62a2a40 100644 +--- a/mpcchap/iniparser.c ++++ b/mpcchap/iniparser.c +@@ -184,10 +184,10 @@ char * iniparser_getsecname(dictionary * d, int n) + /*--------------------------------------------------------------------------*/ + int iniparser_getnkey(dictionary * d, int n) + { +- int i, i_sec, cnt = 0 ; ++ int i, cnt = 0 ; + + if (d==NULL) return -1 ; +- for (i_sec=i=0 ; isize ; i++) { ++ for (i=0 ; isize ; i++) { + if (d->key[i]==NULL) + continue ; + if (strchr(d->key[i], ':')==NULL) { +diff --git a/mpcdec/CMakeLists.txt b/mpcdec/CMakeLists.txt +index da3123f..c95f521 100644 +--- a/mpcdec/CMakeLists.txt ++++ b/mpcdec/CMakeLists.txt +@@ -12,10 +12,6 @@ endif(MSVC) + + add_executable(mpcdec_cmd mpcdec.c) + +-if(NOT MSVC) +-target_link_libraries(mpcdec_cmd m) +-endif(NOT MSVC) +- + target_link_libraries(mpcdec_cmd wavformat_static) + + if(SHARED) +@@ -24,6 +20,10 @@ else(SHARED) + target_link_libraries(mpcdec_cmd mpcdec_static) + endif(SHARED) + ++if(NOT MSVC) ++target_link_libraries(mpcdec_cmd m) ++endif(NOT MSVC) ++ + SET_TARGET_PROPERTIES(mpcdec_cmd PROPERTIES OUTPUT_NAME "mpcdec") + + install(TARGETS mpcdec_cmd RUNTIME DESTINATION bin) +diff --git a/mpcgain/mpcgain.c b/mpcgain/mpcgain.c +index d367fff..86a4b02 100644 +--- a/mpcgain/mpcgain.c ++++ b/mpcgain/mpcgain.c +@@ -163,8 +163,8 @@ int main(int argc, char **argv) + + for (j = 1; j < argc; j++) { + MPC_SAMPLE_FORMAT sample_buffer[MPC_DECODER_BUFFER_LENGTH]; +- MPC_SAMPLE_FORMAT title_max = 0, chap_max; +- mpc_uint16_t * chap_gain, * chap_peak; ++ MPC_SAMPLE_FORMAT title_max = 0, chap_max = 0; ++ mpc_uint16_t * chap_gain = 0, * chap_peak = 0; + mpc_reader reader; + mpc_demux* demux; + mpc_streaminfo si; +-- +2.46.0 + diff --git a/SOURCES/0003-prevent-endless-loops.patch b/SOURCES/0003-prevent-endless-loops.patch new file mode 100644 index 0000000..6020306 --- /dev/null +++ b/SOURCES/0003-prevent-endless-loops.patch @@ -0,0 +1,26 @@ +From 73ce57718c1dca4a788e18946a42af3bacfad8b3 Mon Sep 17 00:00:00 2001 +From: r2d +Date: Fri, 30 Mar 2012 19:54:01 +0000 +Subject: [PATCH 03/19] prevent endless loops + +git-svn-id: http://svn.musepack.net/libmpc/trunk@478 c51c8d5e-032a-db11-a0f2-0002b3467eef +--- + libmpcdec/mpc_demux.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libmpcdec/mpc_demux.c b/libmpcdec/mpc_demux.c +index 4d74dc7..c28a9a0 100644 +--- a/libmpcdec/mpc_demux.c ++++ b/libmpcdec/mpc_demux.c +@@ -633,7 +633,7 @@ mpc_status mpc_demux_decode(mpc_demux * d, mpc_frame_info * i) { + if (MPC_IS_FAILURE(s)) + i->bits = -1; // we pretend it's end of file + +- if (MPC_IS_FAILURE(s) || i->samples > 0) ++ if (i->bits == -1 || i->samples > 0) + return s; + } + } +-- +2.46.0 + diff --git a/SOURCES/0004-add-extern-keyword-to-global-variable-declaration-do.patch b/SOURCES/0004-add-extern-keyword-to-global-variable-declaration-do.patch new file mode 100644 index 0000000..e1e77fb --- /dev/null +++ b/SOURCES/0004-add-extern-keyword-to-global-variable-declaration-do.patch @@ -0,0 +1,31 @@ +From fec0e122f4232aaa52dd6c31d5aeebf55ae3e922 Mon Sep 17 00:00:00 2001 +From: r2d +Date: Fri, 30 Mar 2012 20:03:53 +0000 +Subject: [PATCH 04/19] add extern keyword to global variable declaration + (don't know it worked without ... thanks Dmitry) + +git-svn-id: http://svn.musepack.net/libmpc/trunk@479 c51c8d5e-032a-db11-a0f2-0002b3467eef +--- + libmpcdec/requant.h | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/libmpcdec/requant.h b/libmpcdec/requant.h +index eb3124d..c95101f 100644 +--- a/libmpcdec/requant.h ++++ b/libmpcdec/requant.h +@@ -47,9 +47,9 @@ extern "C" { + + + /* C O N S T A N T S */ +-const mpc_uint8_t Res_bit [18]; ///< Bits per sample for chosen quantizer +-const MPC_SAMPLE_FORMAT __Cc [1 + 18]; ///< Requantization coefficients +-const mpc_int16_t __Dc [1 + 18]; ///< Requantization offset ++extern const mpc_uint8_t Res_bit [18]; ///< Bits per sample for chosen quantizer ++extern const MPC_SAMPLE_FORMAT __Cc [1 + 18]; ///< Requantization coefficients ++extern const mpc_int16_t __Dc [1 + 18]; ///< Requantization offset + + #define Cc (__Cc + 1) + #define Dc (__Dc + 1) +-- +2.46.0 + diff --git a/SOURCES/0005-add-raw-output-to-mpcdec-not-really-tested.patch b/SOURCES/0005-add-raw-output-to-mpcdec-not-really-tested.patch new file mode 100644 index 0000000..f635a61 --- /dev/null +++ b/SOURCES/0005-add-raw-output-to-mpcdec-not-really-tested.patch @@ -0,0 +1,186 @@ +From a19f87fe308e84416eccf9279febff84b080c1c7 Mon Sep 17 00:00:00 2001 +From: r2d +Date: Fri, 30 Mar 2012 21:52:54 +0000 +Subject: [PATCH 05/19] add raw output to mpcdec, not really tested + +git-svn-id: http://svn.musepack.net/libmpc/trunk@480 c51c8d5e-032a-db11-a0f2-0002b3467eef +--- + mpcdec/mpcdec.c | 98 ++++++++++++++++++++++++++++++++++++++++++------- + 1 file changed, 84 insertions(+), 14 deletions(-) + +diff --git a/mpcdec/mpcdec.c b/mpcdec/mpcdec.c +index b60483f..5ad3dd3 100644 +--- a/mpcdec/mpcdec.c ++++ b/mpcdec/mpcdec.c +@@ -39,6 +39,8 @@ + #include "../libmpcdec/internal.h" + #include + #include ++#include ++#include + + #ifdef _MSC_VER + #include +@@ -75,6 +77,44 @@ t_wav_uint32 mpc_wav_output_seek(void* p_user_data, t_wav_uint32 p_position) + return (t_wav_uint32) !fseek(p_handle, p_position, SEEK_SET); + } + ++#ifdef MPC_FIXED_POINT ++ ++static int raw_output_int16(FILE * file, short * buff, int cnt, mpc_bool_t reverse_endian) ++{ ++ int i; ++ for (i = 0; i < cnt; i++) { ++ short out = buff[i]; ++ if (reverse_endian) ++ out = bswap_16(out); ++ if (fwrite(&out, sizeof(out), 1, file) != 1) ++ return -1; ++ } ++ return 0; ++} ++ ++#else ++ ++static int raw_output_float32(FILE * file, float * buff, int cnt, mpc_bool_t reverse_endian) ++{ ++ int i; ++ for (i = 0; i < cnt; i++) { ++ int tmp = nearbyintf(buff[i] * (1 << 15)); ++ short out; ++ if (tmp > ((1 << 15) - 1)) ++ tmp = ((1 << 15) - 1); ++ if (tmp < -(1 << 15)) ++ tmp = -(1 << 15); ++ if (reverse_endian) ++ tmp = bswap_16((short) tmp); ++ out = (short)tmp; ++ if (fwrite(&out, sizeof(out), 1, file) != 1) ++ return -1; ++ } ++ return 0; ++} ++ ++#endif ++ + static void print_info(mpc_streaminfo * info, char * filename) + { + int time = (int) mpc_streaminfo_get_length(info); +@@ -108,6 +148,8 @@ usage(const char *exename) + "-i : print file information on stdout\n" + "-c : check the file for stream errors\n" + " (doesn't fully decode, outfile will be ignored)\n" ++ "-r : output raw data (left/right) in machine native endian\n" ++ "-e : reverse raw data endianness\n" + "-h : print this help\n" + "you can use stdin and stdout as resp. and\n" + " replacing the file name by \"-\"\n", exename); +@@ -121,13 +163,16 @@ main(int argc, char **argv) + mpc_streaminfo si; + mpc_status err; + mpc_bool_t info = MPC_FALSE, is_wav_output = MPC_FALSE, check = MPC_FALSE; ++ mpc_bool_t is_raw_output = MPC_FALSE, reverse_endian = MPC_FALSE; + MPC_SAMPLE_FORMAT sample_buffer[MPC_DECODER_BUFFER_LENGTH]; +- clock_t begin, end, sum; int total_samples; t_wav_output_file wav_output; ++ clock_t begin, end, sum; int total_samples; ++ t_wav_output_file wav_output; ++ t_wav_output_file_callback wavo_fc; + int c; + + fprintf(stderr, About); + +- while ((c = getopt(argc , argv, "ihc")) != -1) { ++ while ((c = getopt(argc , argv, "ihcre")) != -1) { + switch (c) { + case 'i': + info = MPC_TRUE; +@@ -135,6 +180,12 @@ main(int argc, char **argv) + case 'c': + check = MPC_TRUE; + break; ++ case 'r': ++ is_raw_output = MPC_TRUE; ++ break; ++ case 'e': ++ reverse_endian = MPC_TRUE; ++ break; + case 'h': + usage(argv[0]); + return 0; +@@ -165,22 +216,29 @@ main(int argc, char **argv) + return 0; + } + +- if (!check) +- is_wav_output = argc - optind > 1; +- if(is_wav_output) ++ if (check) { ++ is_raw_output = MPC_FALSE; ++ } else if (argc - optind > 1 && is_raw_output == MPC_FALSE) { ++ is_wav_output = MPC_TRUE; ++ }; ++ ++ if (is_wav_output || is_raw_output) + { +- t_wav_output_file_callback wavo_fc; + memset(&wav_output, 0, sizeof wav_output); + wavo_fc.m_seek = mpc_wav_output_seek; + wavo_fc.m_write = mpc_wav_output_write; +- if (strcmp(argv[optind + 1], "-") == 0) { ++ if (strcmp(argv[optind + 1], "-") == 0 || (is_raw_output && argc - optind <= 1)) { + SET_BINARY_MODE(stdout); + wavo_fc.m_user_data = stdout; + } else + wavo_fc.m_user_data = fopen(argv[optind + 1], "wb"); +- if(!wavo_fc.m_user_data) return !MPC_STATUS_OK; +- err = waveformat_output_open(&wav_output, wavo_fc, si.channels, 16, 0, si.sample_freq, (t_wav_uint32) si.samples * si.channels); +- if(!err) return !MPC_STATUS_OK; ++ if(!wavo_fc.m_user_data) ++ return !MPC_STATUS_OK; ++ ++ if (is_wav_output) { ++ if (!waveformat_output_open(&wav_output, wavo_fc, si.channels, 16, 0, si.sample_freq, (t_wav_uint32) si.samples * si.channels)) ++ return !MPC_STATUS_OK; ++ } + } + + sum = total_samples = 0; +@@ -199,7 +257,7 @@ main(int argc, char **argv) + total_samples += frame.samples; + sum += end - begin; + +- if(is_wav_output) { ++ if (is_wav_output || is_raw_output) { + #ifdef MPC_FIXED_POINT + mpc_int16_t tmp_buff[MPC_DECODER_BUFFER_LENGTH]; + int i; +@@ -209,11 +267,23 @@ main(int argc, char **argv) + if (tmp < -(1 << 15)) tmp = -(1 << 15); + tmp_buff[i] = tmp; + } +- if(waveformat_output_process_int16(&wav_output, tmp_buff, frame.samples * si.channels) < 0) ++#endif ++ if (is_wav_output) { ++#ifdef MPC_FIXED_POINT ++ if(waveformat_output_process_int16(&wav_output, tmp_buff, frame.samples * si.channels) < 0) ++#else ++ if(waveformat_output_process_float32(&wav_output, sample_buffer, frame.samples * si.channels) < 0) ++#endif ++ break; ++ } ++ if (is_raw_output) { ++#ifdef MPC_FIXED_POINT ++ if (raw_output_int16(wavo_fc.m_user_data, tmp_buff, frame.samples * si.channels, reverse_endian) < 0) + #else +- if(waveformat_output_process_float32(&wav_output, sample_buffer, frame.samples * si.channels) < 0) ++ if (raw_output_float32(wavo_fc.m_user_data, sample_buffer, frame.samples * si.channels, reverse_endian) < 0) + #endif +- break; ++ break; ++ } + } + } + +-- +2.46.0 + diff --git a/SOURCES/0008-FSF-address-change.patch b/SOURCES/0008-FSF-address-change.patch new file mode 100644 index 0000000..34926ee --- /dev/null +++ b/SOURCES/0008-FSF-address-change.patch @@ -0,0 +1,372 @@ +From 6338c003f2c0a0a2c1f774607c6ced28864182e1 Mon Sep 17 00:00:00 2001 +From: r2d +Date: Mon, 21 Oct 2013 21:21:51 +0000 +Subject: [PATCH 08/19] FSF address change + +git-svn-id: http://svn.musepack.net/libmpc/trunk@484 c51c8d5e-032a-db11-a0f2-0002b3467eef +--- + common/fastmath.c | 3 +-- + include/mpc/datatypes.h | 3 +-- + include/mpc/minimax.h | 3 +-- + include/mpc/mpcmath.h | 3 +-- + libmpcenc/analy_filter.c | 3 +-- + libmpcenc/bitstream.c | 3 +-- + libmpcenc/encode_sv7.c | 3 +-- + libmpcenc/huffsv7.c | 3 +-- + libmpcenc/libmpcenc.h | 3 +-- + libmpcenc/quant.c | 3 +-- + libmpcpsy/ans.c | 3 +-- + libmpcpsy/cvd.c | 3 +-- + libmpcpsy/fft4g.c | 3 +-- + libmpcpsy/fft_routines.c | 3 +-- + libmpcpsy/libmpcpsy.h | 3 +-- + libmpcpsy/profile.c | 3 +-- + libmpcpsy/psy.c | 3 +-- + libmpcpsy/psy_tab.c | 3 +-- + mpcenc/config.h | 3 +-- + mpcenc/mpcenc.c | 3 +-- + mpcenc/mpcenc.h | 3 +-- + mpcenc/predict.h | 3 +-- + mpcenc/wave_in.c | 3 +-- + mpcenc/winmsg.c | 3 +-- + 24 files changed, 24 insertions(+), 48 deletions(-) + +diff --git a/common/fastmath.c b/common/fastmath.c +index 518b22c..9a5bb6a 100644 +--- a/common/fastmath.c ++++ b/common/fastmath.c +@@ -13,8 +13,7 @@ + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public +- * License along with this library; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ * License along with this library; If not, see + */ + + #include "mpc/mpcmath.h" +diff --git a/include/mpc/datatypes.h b/include/mpc/datatypes.h +index 608ecfa..7e6c5fc 100644 +--- a/include/mpc/datatypes.h ++++ b/include/mpc/datatypes.h +@@ -12,8 +12,7 @@ + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public +- * License along with this library; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ * License along with this library; If not, see + */ + + #pragma once +diff --git a/include/mpc/minimax.h b/include/mpc/minimax.h +index 1192626..5351a21 100644 +--- a/include/mpc/minimax.h ++++ b/include/mpc/minimax.h +@@ -13,8 +13,7 @@ + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public +- * License along with this library; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ * License along with this library; If not, see + */ + + #pragma once +diff --git a/include/mpc/mpcmath.h b/include/mpc/mpcmath.h +index 3b42a45..9372d4b 100644 +--- a/include/mpc/mpcmath.h ++++ b/include/mpc/mpcmath.h +@@ -12,8 +12,7 @@ + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public +- * License along with this library; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ * License along with this library; If not, see + */ + + #include +diff --git a/libmpcenc/analy_filter.c b/libmpcenc/analy_filter.c +index fa8e0ff..d9cc814 100644 +--- a/libmpcenc/analy_filter.c ++++ b/libmpcenc/analy_filter.c +@@ -14,8 +14,7 @@ + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public +- * License along with this library; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ * License along with this library; If not, see + */ + + #include +diff --git a/libmpcenc/bitstream.c b/libmpcenc/bitstream.c +index 0650ee2..4865ce9 100644 +--- a/libmpcenc/bitstream.c ++++ b/libmpcenc/bitstream.c +@@ -14,8 +14,7 @@ + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public +- * License along with this library; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ * License along with this library; If not, see + */ + + #ifdef _WIN32 +diff --git a/libmpcenc/encode_sv7.c b/libmpcenc/encode_sv7.c +index 68de5ae..cb7704f 100644 +--- a/libmpcenc/encode_sv7.c ++++ b/libmpcenc/encode_sv7.c +@@ -14,8 +14,7 @@ + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public +- * License along with this library; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ * License along with this library; If not, see + */ + + #include +diff --git a/libmpcenc/huffsv7.c b/libmpcenc/huffsv7.c +index dd13f8e..ea5c948 100644 +--- a/libmpcenc/huffsv7.c ++++ b/libmpcenc/huffsv7.c +@@ -14,8 +14,7 @@ + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public +- * License along with this library; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ * License along with this library; If not, see + */ + + #include "libmpcenc.h" +diff --git a/libmpcenc/libmpcenc.h b/libmpcenc/libmpcenc.h +index e9d5f19..5228856 100644 +--- a/libmpcenc/libmpcenc.h ++++ b/libmpcenc/libmpcenc.h +@@ -12,8 +12,7 @@ + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public +- * License along with this library; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ * License along with this library; If not, see + */ + + #pragma once +diff --git a/libmpcenc/quant.c b/libmpcenc/quant.c +index 4cad889..9eeb98a 100644 +--- a/libmpcenc/quant.c ++++ b/libmpcenc/quant.c +@@ -14,8 +14,7 @@ + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public +- * License along with this library; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ * License along with this library; If not, see + */ + + #include "libmpcenc.h" +diff --git a/libmpcpsy/ans.c b/libmpcpsy/ans.c +index cf2e0c3..3204f2d 100644 +--- a/libmpcpsy/ans.c ++++ b/libmpcpsy/ans.c +@@ -14,8 +14,7 @@ + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public +- * License along with this library; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ * License along with this library; If not, see + */ + + /* +diff --git a/libmpcpsy/cvd.c b/libmpcpsy/cvd.c +index 9377dab..4e3bae6 100644 +--- a/libmpcpsy/cvd.c ++++ b/libmpcpsy/cvd.c +@@ -14,8 +14,7 @@ + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public +- * License along with this library; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ * License along with this library; If not, see + */ + + #include +diff --git a/libmpcpsy/fft4g.c b/libmpcpsy/fft4g.c +index 8efc2b6..e2f6c94 100644 +--- a/libmpcpsy/fft4g.c ++++ b/libmpcpsy/fft4g.c +@@ -14,8 +14,7 @@ + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public +- * License along with this library; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ * License along with this library; If not, see + */ + + #include "libmpcpsy.h" +diff --git a/libmpcpsy/fft_routines.c b/libmpcpsy/fft_routines.c +index eadc9ac..e656ca5 100644 +--- a/libmpcpsy/fft_routines.c ++++ b/libmpcpsy/fft_routines.c +@@ -14,8 +14,7 @@ + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public +- * License along with this library; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ * License along with this library; If not, see + */ + + #include +diff --git a/libmpcpsy/libmpcpsy.h b/libmpcpsy/libmpcpsy.h +index bc24c98..2763646 100644 +--- a/libmpcpsy/libmpcpsy.h ++++ b/libmpcpsy/libmpcpsy.h +@@ -12,8 +12,7 @@ + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public +- * License along with this library; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ * License along with this library; If not, see + */ + + // psy_tab.h +diff --git a/libmpcpsy/profile.c b/libmpcpsy/profile.c +index abc9b72..48dd350 100644 +--- a/libmpcpsy/profile.c ++++ b/libmpcpsy/profile.c +@@ -14,8 +14,7 @@ + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public +- * License along with this library; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ * License along with this library; If not, see + */ + + #include "libmpcpsy.h" +diff --git a/libmpcpsy/psy.c b/libmpcpsy/psy.c +index 8c5b9f7..062a3b7 100644 +--- a/libmpcpsy/psy.c ++++ b/libmpcpsy/psy.c +@@ -14,8 +14,7 @@ + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public +- * License along with this library; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ * License along with this library; If not, see + */ + + /* +diff --git a/libmpcpsy/psy_tab.c b/libmpcpsy/psy_tab.c +index 35c56ac..f04369f 100644 +--- a/libmpcpsy/psy_tab.c ++++ b/libmpcpsy/psy_tab.c +@@ -14,8 +14,7 @@ + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public +- * License along with this library; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ * License along with this library; If not, see + */ + + #include "libmpcpsy.h" +diff --git a/mpcenc/config.h b/mpcenc/config.h +index 0ab13aa..5efe178 100644 +--- a/mpcenc/config.h ++++ b/mpcenc/config.h +@@ -14,8 +14,7 @@ + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public +- * License along with this library; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ * License along with this library; If not, see + */ + + /* Test the fast float-to-int rounding trick works */ +diff --git a/mpcenc/mpcenc.c b/mpcenc/mpcenc.c +index cd1b902..df3453d 100644 +--- a/mpcenc/mpcenc.c ++++ b/mpcenc/mpcenc.c +@@ -14,8 +14,7 @@ + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public +- * License along with this library; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ * License along with this library; If not, see + */ + + /* overflow of subband-samples */ +diff --git a/mpcenc/mpcenc.h b/mpcenc/mpcenc.h +index 46f1ba0..66ba74f 100644 +--- a/mpcenc/mpcenc.h ++++ b/mpcenc/mpcenc.h +@@ -14,8 +14,7 @@ + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public +- * License along with this library; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ * License along with this library; If not, see + */ + + #ifndef MPCENC_MPCENC_H +diff --git a/mpcenc/predict.h b/mpcenc/predict.h +index f568832..83cd913 100644 +--- a/mpcenc/predict.h ++++ b/mpcenc/predict.h +@@ -14,8 +14,7 @@ + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public +- * License along with this library; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ * License along with this library; If not, see + */ + + #include "mpcenc.h" +diff --git a/mpcenc/wave_in.c b/mpcenc/wave_in.c +index 27aa233..b20f97e 100644 +--- a/mpcenc/wave_in.c ++++ b/mpcenc/wave_in.c +@@ -14,8 +14,7 @@ + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public +- * License along with this library; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ * License along with this library; If not, see + */ + + # include +diff --git a/mpcenc/winmsg.c b/mpcenc/winmsg.c +index 1d248da..e393301 100644 +--- a/mpcenc/winmsg.c ++++ b/mpcenc/winmsg.c +@@ -13,8 +13,7 @@ + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public +- * License along with this library; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ * License along with this library; If not, see + */ + + #include "mpcenc.h" +-- +2.46.0 + diff --git a/SOURCES/0011-removed-some-new-gcc-warnings.patch b/SOURCES/0011-removed-some-new-gcc-warnings.patch new file mode 100644 index 0000000..2d92dde --- /dev/null +++ b/SOURCES/0011-removed-some-new-gcc-warnings.patch @@ -0,0 +1,228 @@ +From 30196e28ca463803086ce9a15a4194e2ccfccea7 Mon Sep 17 00:00:00 2001 +From: r2d +Date: Sun, 10 Jan 2016 20:36:06 +0000 +Subject: [PATCH 11/19] removed some new gcc warnings + +git-svn-id: http://svn.musepack.net/libmpc/trunk@487 c51c8d5e-032a-db11-a0f2-0002b3467eef +--- + mpcchap/mpcchap.c | 40 +++++++++++++++++++++++++++------------- + mpcenc/mpcenc.c | 13 +++++++------ + mpcgain/mpcgain.c | 14 +++++++------- + 3 files changed, 41 insertions(+), 26 deletions(-) + +diff --git a/mpcchap/mpcchap.c b/mpcchap/mpcchap.c +index 4f02191..eee3dbd 100644 +--- a/mpcchap/mpcchap.c ++++ b/mpcchap/mpcchap.c +@@ -22,6 +22,7 @@ + #include "../libmpcenc/libmpcenc.h" + #include "iniparser.h" + ++#include + #include + + #include +@@ -82,6 +83,7 @@ mpc_status add_chaps_ini(char * mpc_file, char * chap_file, mpc_demux * demux, m + int chap_pos, end_pos, chap_size, i, nchap; + char * tmp_buff; + dictionary * dict; ++ mpc_status ret = MPC_STATUS_OK; + + chap_pos = (demux->chap_pos >> 3) + si->header_position; + end_pos = mpc_demux_pos(demux) >> 3; +@@ -89,9 +91,13 @@ mpc_status add_chaps_ini(char * mpc_file, char * chap_file, mpc_demux * demux, m + + stat(mpc_file, &stbuf); + tmp_buff = malloc(stbuf.st_size - chap_pos - chap_size); ++ + in_file = fopen( mpc_file, "r+b" ); + fseek(in_file, chap_pos + chap_size, SEEK_SET); +- fread(tmp_buff, 1, stbuf.st_size - chap_pos - chap_size, in_file); ++ if (1 != fread(tmp_buff, stbuf.st_size - chap_pos - chap_size, 1, in_file)) { ++ ret = MPC_STATUS_FAIL; ++ goto error_read_in_file; ++ } + fseek(in_file, chap_pos, SEEK_SET); + + dict = iniparser_load(chap_file); +@@ -104,8 +110,8 @@ mpc_status add_chaps_ini(char * mpc_file, char * chap_file, mpc_demux * demux, m + mpc_int64_t chap_pos = atoll(chap_sec); + + if (chap_pos > si->samples - si->beg_silence) +- fprintf(stderr, "warning : chapter %i starts @ %lli samples after the end of the stream (%lli)\n", +- i + 1, chap_pos, si->samples - si->beg_silence); ++ fprintf(stderr, "warning : chapter %i starts @ %" PRId64 " samples after the end of the stream (%" PRId64 ")\n", ++ i + 1, chap_pos, si->samples - si->beg_silence); + + Init_Tags(); + +@@ -141,13 +147,15 @@ mpc_status add_chaps_ini(char * mpc_file, char * chap_file, mpc_demux * demux, m + } + + fwrite(tmp_buff, 1, stbuf.st_size - chap_pos - chap_size, in_file); +- ftruncate(fileno(in_file), ftell(in_file)); ++ if (0 != ftruncate(fileno(in_file), ftell(in_file))) ++ ret = MPC_STATUS_FAIL; + +- fclose(in_file); +- free(tmp_buff); +- iniparser_freedict(dict); ++ iniparser_freedict(dict); ++error_read_in_file: ++ fclose(in_file); ++ free(tmp_buff); + +- return MPC_STATUS_OK; ++ return ret; + } + + mpc_status add_chaps_cue(char * mpc_file, char * chap_file, mpc_demux * demux, mpc_streaminfo * si) +@@ -158,6 +166,7 @@ mpc_status add_chaps_cue(char * mpc_file, char * chap_file, mpc_demux * demux, m + FILE * in_file; + int chap_pos, end_pos, chap_size, i; + char * tmp_buff; ++ mpc_status ret = MPC_STATUS_OK; + + if (0 == (cd = cf_parse(chap_file, &format))) { + fprintf(stderr, "%s: input file error\n", chap_file); +@@ -172,7 +181,10 @@ mpc_status add_chaps_cue(char * mpc_file, char * chap_file, mpc_demux * demux, m + tmp_buff = malloc(stbuf.st_size - chap_pos - chap_size); + in_file = fopen( mpc_file, "r+b" ); + fseek(in_file, chap_pos + chap_size, SEEK_SET); +- fread(tmp_buff, 1, stbuf.st_size - chap_pos - chap_size, in_file); ++ if (1 != fread(tmp_buff, stbuf.st_size - chap_pos - chap_size, 1, in_file)) { ++ ret = MPC_STATUS_FAIL; ++ goto error_read_in_file; ++ } + fseek(in_file, chap_pos, SEEK_SET); + + nchap = cd_get_ntrack(cd); +@@ -190,7 +202,7 @@ mpc_status add_chaps_cue(char * mpc_file, char * chap_file, mpc_demux * demux, m + chap_pos = (mpc_int64_t) si->sample_freq * track_get_start (track) / 75; + + if (chap_pos > si->samples - si->beg_silence) +- fprintf(stderr, "warning : chapter %i starts @ %lli samples after the end of the stream (%lli)\n", ++ fprintf(stderr, "warning : chapter %i starts @ %" PRId64 " samples after the end of the stream (%" PRId64 ")\n", + i, chap_pos, si->samples - si->beg_silence); + + Init_Tags(); +@@ -224,12 +236,14 @@ mpc_status add_chaps_cue(char * mpc_file, char * chap_file, mpc_demux * demux, m + } + + fwrite(tmp_buff, 1, stbuf.st_size - chap_pos - chap_size, in_file); +- ftruncate(fileno(in_file), ftell(in_file)); ++ if (0 != ftruncate(fileno(in_file), ftell(in_file))) ++ ret = MPC_STATUS_FAIL; + ++error_read_in_file: + fclose(in_file); + free(tmp_buff); + +- return MPC_STATUS_OK; ++ return ret; + } + + mpc_status dump_chaps(mpc_demux * demux, char * chap_file, int chap_nb) +@@ -247,7 +261,7 @@ mpc_status dump_chaps(mpc_demux * demux, char * chap_file, int chap_nb) + + for (i = 0; i < chap_nb; i++) { + chap = mpc_demux_chap(demux, i); +- fprintf(out_file, "[%lli]\ngain=%i\npeak=%i\n", chap->sample, chap->gain, chap->peak); ++ fprintf(out_file, "[%" PRId64 "]\ngain=%i\npeak=%i\n", chap->sample, chap->gain, chap->peak); + if (chap->tag_size > 0) { + int item_count, j; + char const * tag = chap->tag; +diff --git a/mpcenc/mpcenc.c b/mpcenc/mpcenc.c +index df3453d..84f6376 100644 +--- a/mpcenc/mpcenc.c ++++ b/mpcenc/mpcenc.c +@@ -1023,7 +1023,7 @@ EvalParameters (PsyModel * m, int argc, char** argv, char** InputFile, char** Ou + } + else if ( 0 == strcmp ( arg, "stderr") ) { // Offset for threshold in quiet + if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; } +- freopen ( argv[k], "a", stderr ); ++ stderr = freopen ( argv[k], "a", stderr ); + } + else if ( 0 == strcmp ( arg, "ltq") || 0 == strcmp ( arg, "ath") ) { // threshold in quiet + if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; } +@@ -1208,11 +1208,12 @@ EvalParameters (PsyModel * m, int argc, char** argv, char** InputFile, char** Ou + p = strchr ( argv[k], '=' ); + if ( p == NULL ) { + stderr_printf (" Enter value for tag key '%s': ", argv[k] ); +- fgets ( buff, sizeof buff, stdin ); +- len = strlen (buff); +- while ( len > 0 && (buff [len-1] == '\r' || buff [len-1] == '\n') ) +- len--; +- addtag ( arg, strlen(arg), buff, len, NoUnicode*6, 0 ); ++ if (0 != fgets ( buff, sizeof buff, stdin )) { ++ len = strlen (buff); ++ while ( len > 0 && (buff [len-1] == '\r' || buff [len-1] == '\n') ) ++ len--; ++ addtag ( arg, strlen(arg), buff, len, NoUnicode*6, 0 ); ++ } + } + else { + fp = fopen ( p+1, "rb" ); +diff --git a/mpcgain/mpcgain.c b/mpcgain/mpcgain.c +index 86a4b02..4e44d3e 100644 +--- a/mpcgain/mpcgain.c ++++ b/mpcgain/mpcgain.c +@@ -115,7 +115,7 @@ static void write_chaps_gain(mpc_demux * demux, const char * file_name, + + while (1) { + fseek(file, next_chap_pos, SEEK_SET); +- fread(buffer, 1, MAX_HEAD_SIZE, file); ++ if (0 == fread(buffer, 1, MAX_HEAD_SIZE, file)) break; + r.buff = buffer; + r.count = 8; + size = mpc_bits_get_block(&r, &b); +@@ -182,7 +182,7 @@ int main(int argc, char **argv) + chap_nb = mpc_demux_chap_nb(demux); + mpc_demux_seek_sample(demux, 0); + if (chap_nb > 0) { +- mpc_chap_info * chap_info = mpc_demux_chap(demux, chap); ++ const mpc_chap_info * chap_info = mpc_demux_chap(demux, chap); + next_chap_sample = chap_info->sample; + chap_gain = malloc(sizeof(mpc_uint16_t) * 2 * chap_nb); + chap_peak = chap_gain + chap_nb; +@@ -215,7 +215,7 @@ int main(int argc, char **argv) + i += sample_nb; + cur_sample = next_chap_sample; + if (chap < chap_nb) { +- mpc_chap_info * chap_info = mpc_demux_chap(demux, chap); ++ const mpc_chap_info * chap_info = mpc_demux_chap(demux, chap); + next_chap_sample = chap_info->sample; + } else + next_chap_sample = mpc_int64_max; +@@ -260,8 +260,8 @@ int main(int argc, char **argv) + continue; + } + fseek(file, header_pos[j] - 4, SEEK_SET); +- fread(buffer, 1, 16, file); +- if (memcmp(buffer, "MPCK", 4) != 0) { ++ ++ if (fread(buffer, 1, 16, file) != 16 || memcmp(buffer, "MPCK", 4) != 0) { + fprintf(stderr, "Unsupported file format, not a sv8 file : %s\n", argv[j + 1]); + fclose(file); + continue; +@@ -276,7 +276,7 @@ int main(int argc, char **argv) + if (memcmp(b.key, "RG", 2) == 0) break; + header_pos[j] += b.size + size; + fseek(file, header_pos[j], SEEK_SET); +- fread(buffer, 1, 16, file); ++ if (0 == fread(buffer, 1, 16, file)) break; + r.buff = buffer; + r.count = 8; + } +@@ -286,7 +286,7 @@ int main(int argc, char **argv) + fclose(file); + continue; + } +- header_pos[j] += size; ++ header_pos[j] += size; + + buffer[size] = 1; // replaygain version + buffer[size + 1] = title_gain[j] >> 8; +-- +2.46.0 + diff --git a/SOURCES/0012-mpcenc-remove-compilation-error-and-a-warning.patch b/SOURCES/0012-mpcenc-remove-compilation-error-and-a-warning.patch new file mode 100644 index 0000000..3c59191 --- /dev/null +++ b/SOURCES/0012-mpcenc-remove-compilation-error-and-a-warning.patch @@ -0,0 +1,35 @@ +From d12f274173940bc67118625d1b4829e31a8e7e79 Mon Sep 17 00:00:00 2001 +From: r2d +Date: Tue, 12 Jan 2016 21:08:49 +0000 +Subject: [PATCH 12/19] mpcenc : remove compilation error and a warning + +git-svn-id: http://svn.musepack.net/libmpc/trunk@488 c51c8d5e-032a-db11-a0f2-0002b3467eef +--- + mpcenc/mpcenc.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/mpcenc/mpcenc.c b/mpcenc/mpcenc.c +index 84f6376..776a890 100644 +--- a/mpcenc/mpcenc.c ++++ b/mpcenc/mpcenc.c +@@ -1023,7 +1023,7 @@ EvalParameters (PsyModel * m, int argc, char** argv, char** InputFile, char** Ou + } + else if ( 0 == strcmp ( arg, "stderr") ) { // Offset for threshold in quiet + if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; } +- stderr = freopen ( argv[k], "a", stderr ); ++ if ( 0 == freopen ( argv[k], "a", stderr ) ) { stderr_printf ("invalid stderr filename"); return -1; } + } + else if ( 0 == strcmp ( arg, "ltq") || 0 == strcmp ( arg, "ath") ) { // threshold in quiet + if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; } +@@ -1458,6 +1458,8 @@ static void Init_FPU ( void ) + _asm { fstcw cw }; + cw &= ~0x300; + _asm { fldcw cw }; ++#else ++ (void)cw; // remove unused variable warning + #endif + } + +-- +2.46.0 + diff --git a/SOURCES/0013-mpc2sv8-fix-a-segfault-caused-by-commit-r476.patch b/SOURCES/0013-mpc2sv8-fix-a-segfault-caused-by-commit-r476.patch new file mode 100644 index 0000000..3bc124b --- /dev/null +++ b/SOURCES/0013-mpc2sv8-fix-a-segfault-caused-by-commit-r476.patch @@ -0,0 +1,57 @@ +From 9d68c3c358bee5eb440afcc516023df1b0cab2bb Mon Sep 17 00:00:00 2001 +From: r2d +Date: Tue, 12 Jan 2016 22:33:48 +0000 +Subject: [PATCH 13/19] mpc2sv8 : fix a segfault caused by commit r476 + +git-svn-id: http://svn.musepack.net/libmpc/trunk@489 c51c8d5e-032a-db11-a0f2-0002b3467eef +--- + include/mpc/mpcdec.h | 2 ++ + libmpcdec/mpc_demux.c | 2 +- + mpc2sv8/mpc2sv8.c | 4 ++-- + 3 files changed, 5 insertions(+), 3 deletions(-) + +diff --git a/include/mpc/mpcdec.h b/include/mpc/mpcdec.h +index c723595..52fd070 100644 +--- a/include/mpc/mpcdec.h ++++ b/include/mpc/mpcdec.h +@@ -116,6 +116,8 @@ MPC_API void mpc_set_replay_level(mpc_demux * d, float level, mpc_bool_t use_gai + mpc_bool_t use_title, mpc_bool_t clip_prevention); + /// decode frame + MPC_API mpc_status mpc_demux_decode(mpc_demux * d, mpc_frame_info * i); ++/// decode frame : use mpc_demux_decode() instead. This function is only used by mpc2sv8. ++MPC_API mpc_status mpc_demux_decode_inner(mpc_demux * d, mpc_frame_info * i); + /// get streaminfo + MPC_API void mpc_demux_get_info(mpc_demux * d, mpc_streaminfo * i); + /// seeks to a given sample +diff --git a/libmpcdec/mpc_demux.c b/libmpcdec/mpc_demux.c +index c28a9a0..8b60dad 100644 +--- a/libmpcdec/mpc_demux.c ++++ b/libmpcdec/mpc_demux.c +@@ -566,7 +566,7 @@ void mpc_demux_get_info(mpc_demux * d, mpc_streaminfo * i) + memcpy(i, &d->si, sizeof d->si); + } + +-static mpc_status mpc_demux_decode_inner(mpc_demux * d, mpc_frame_info * i) ++mpc_status mpc_demux_decode_inner(mpc_demux * d, mpc_frame_info * i) + { + mpc_bits_reader r; + if (d->si.stream_version >= 8) { +diff --git a/mpc2sv8/mpc2sv8.c b/mpc2sv8/mpc2sv8.c +index 7b77a1b..9a0237c 100644 +--- a/mpc2sv8/mpc2sv8.c ++++ b/mpc2sv8/mpc2sv8.c +@@ -162,9 +162,9 @@ int convert(char * sv7file, char * sv8file) + mpc_frame_info frame; + + demux->d->samples_to_skip = MPC_FRAME_LENGTH + MPC_DECODER_SYNTH_DELAY; +- err = mpc_demux_decode(demux, &frame); ++ err = mpc_demux_decode_inner(demux, &frame); + +- if(frame.bits == -1) break; ++ if (MPC_IS_FAILURE(err) || frame.bits == -1) break; + + datacpy(demux->d, &e); + writeBitstream_SV8 ( &e, si.max_band); // write SV8-Bitstream +-- +2.46.0 + diff --git a/SOURCES/r475-cmake.patch b/SOURCES/r475-cmake.patch new file mode 100644 index 0000000..2254eb8 --- /dev/null +++ b/SOURCES/r475-cmake.patch @@ -0,0 +1,31 @@ +diff -ur musepack_src_r475.orig/CMakeLists.txt musepack_src_r475/CMakeLists.txt +--- musepack_src_r475.orig/CMakeLists.txt 2010-07-13 07:15:24.000000000 -0400 ++++ musepack_src_r475/CMakeLists.txt 2023-02-07 11:02:43.230330382 -0500 +@@ -15,9 +15,6 @@ + + add_definitions(-DFAST_MATH -DCVD_FASTLOG) + +-if(NOT MSVC) +- set(CMAKE_C_FLAGS "-O3 -Wall -fomit-frame-pointer -pipe") +-endif(NOT MSVC) + + add_subdirectory(libmpcdec) + add_subdirectory(libmpcpsy) +diff -ur musepack_src_r475.orig/include/CMakeLists.txt musepack_src_r475/include/CMakeLists.txt +--- musepack_src_r475.orig/include/CMakeLists.txt 2009-08-03 05:44:13.000000000 -0400 ++++ musepack_src_r475/include/CMakeLists.txt 2023-02-07 11:02:59.430391038 -0500 +@@ -1 +1 @@ +-INSTALL(DIRECTORY mpc DESTINATION include) ++INSTALL(DIRECTORY mpc DESTINATION include PATTERN ".svn" EXCLUDE) +diff -ur musepack_src_r475.orig/libmpcdec/CMakeLists.txt musepack_src_r475/libmpcdec/CMakeLists.txt +--- musepack_src_r475.orig/libmpcdec/CMakeLists.txt 2010-08-21 11:55:01.000000000 -0400 ++++ musepack_src_r475/libmpcdec/CMakeLists.txt 2023-02-07 11:03:43.119554606 -0500 +@@ -1,6 +1,8 @@ + include_directories(${libmpc_SOURCE_DIR}/include) + if(SHARED) + add_library(mpcdec SHARED huffman mpc_decoder mpc_reader streaminfo mpc_bits_reader mpc_demux requant synth_filter ${libmpc_SOURCE_DIR}/common/crc32) ++ set_target_properties(mpcdec PROPERTIES SOVERSION 6 VERSION 6.0.0) ++ install(TARGETS mpcdec DESTINATION "lib${LIB_SUFFIX}") + else(SHARED) + add_library(mpcdec_static STATIC huffman mpc_decoder mpc_reader streaminfo mpc_bits_reader mpc_demux requant synth_filter ${libmpc_SOURCE_DIR}/common/crc32) + endif(SHARED) diff --git a/libmpcdec.spec b/SPECS/libmpcdec.spec similarity index 58% rename from libmpcdec.spec rename to SPECS/libmpcdec.spec index 1ed8d20..86e7f92 100644 --- a/libmpcdec.spec +++ b/SPECS/libmpcdec.spec @@ -1,17 +1,55 @@ +## START: Set by rpmautospec +## (rpmautospec version 0.7.2) +## RPMAUTOSPEC: autorelease, autochangelog +%define autorelease(e:s:pb:n) %{?-p:0.}%{lua: + release_number = 2; + base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}")); + print(release_number + base_release_number - 1); +}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}} +## END: Set by rpmautospec + +%bcond cuefile 0 + +# FTBFS with GCC 14 -Werror=incompatible-pointer-types +# https://bugzilla.redhat.com/show_bug.cgi?id=2261331 +%global build_type_safety_c 2 + +%global svn_release 475 +# code does not compile with -fno-common +%global _legacy_common_support 1 Summary: Musepack audio decoding library Name: libmpcdec -Version: 1.2.6 -Release: 28%{?dist} +Version: 1.3.0^20110810svn%{svn_release} +Release: %autorelease -License: BSD -URL: http://www.musepack.net/ -Source0: http://files.musepack.net/source/libmpcdec-%{version}.tar.bz2 +License: BSD-3-Clause +URL: https://www.musepack.net/ +Source: https://files.musepack.net/source/musepack_src_r%{svn_release}.tar.gz + +## upstream patches +Patch: 0001-changes-a-seeking-behavior-that-confused-some-people.patch +Patch: 0002-removed-some-gcc-warnings-and-compilation-issues.patch +Patch: 0003-prevent-endless-loops.patch +Patch: 0004-add-extern-keyword-to-global-variable-declaration-do.patch +Patch: 0005-add-raw-output-to-mpcdec-not-really-tested.patch +Patch: 0008-FSF-address-change.patch +Patch: 0011-removed-some-new-gcc-warnings.patch +Patch: 0012-mpcenc-remove-compilation-error-and-a-warning.patch +Patch: 0013-mpc2sv8-fix-a-segfault-caused-by-commit-r476.patch + +## upstreamable patches + +## downstream patches +Patch: r475-cmake.patch -BuildRequires: gcc-c++ BuildRequires: gcc BuildRequires: sed -BuildRequires: make +BuildRequires: cmake +%if %{with cuefile} +BuildRequires: libcuefile-devel +%endif +BuildRequires: libreplaygain-devel %description Musepack is an audio compression format with a strong emphasis on high quality. @@ -28,40 +66,85 @@ Requires: %{name}%{?_isa} = %{version}-%{release} %description devel %{summary}. +%package -n musepack-tools +Summary: Musepack audio decoding and encoding tools +License: BSD-3-Clause AND LGPL-2.1-or-later +Requires: %{name}%{?_isa} = %{version}-%{release} +%description -n musepack-tools +%{summary}. + %prep -%setup -q +%autosetup -p1 -n musepack_src_r%{svn_release} -#hack out hard-coded undesirable compiler flags -sed -i.cflags -e 's|-O3 -fomit-frame-pointer||g' configure +%if %{without cuefile} +sed -i -e '/add_subdirectory.*mpcchap/d' CMakeLists.txt +%endif +# Correct permissions and end of line +find -type f -exec chmod 0644 '{}' + +sed -ibackup 's/\r$//' libwavformat/* -%build -%configure --disable-static -%make_build +%build +%cmake -Wno-dev . +%cmake_build %install -%make_install - -#Unpackaged files -rm -fv $RPM_BUILD_ROOT%{_libdir}/lib*.la +%cmake_install -%ldconfig_scriptlets - %files -%doc AUTHORS ChangeLog README -%license COPYING -%{_libdir}/libmpcdec.so.5* +%doc libmpcdec/AUTHORS libmpcdec/ChangeLog libmpcdec/README +%license libmpcdec/COPYING +%{_libdir}/libmpcdec.so.6{,.*} %files devel -%{_includedir}/mpcdec/ +%{_includedir}/mpc/ %{_libdir}/libmpcdec.so +%files -n musepack-tools +%license libmpcdec/COPYING +%{_bindir}/mpc* +%{_bindir}/wavcmp + %changelog +* Wed Dec 25 2024 Arkady L. Shane - 1.3.0^20110810svn475-2 +- Rebuilt for MSVSphere 10 + +## START: Generated by rpmautospec +* Thu Sep 19 2024 Yaakov Selkowitz - 1.3.0^20110810svn475-2 +- Add upstream code fixes + +* Mon Sep 02 2024 Miroslav Suchý - 1.3.0-0.6.20110810svn475 +- convert license to SPDX + +* Thu Jul 18 2024 Fedora Release Engineering - 1.3.0-0.5.20110810svn475 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + +* Thu Jan 25 2024 Fedora Release Engineering - 1.3.0-0.4.20110810svn475 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Sun Jan 21 2024 Fedora Release Engineering - 1.3.0-0.3.20110810svn475 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Thu Jul 20 2023 Fedora Release Engineering - 1.3.0-0.2.20110810svn475 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Tue Feb 07 2023 Yaakov Selkowitz - 1.3.0-0.1.20110810svn475 +- Update to latest SV8 version (#1014468) + +* Thu Jan 19 2023 Fedora Release Engineering - 1.2.6-31 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Thu Jul 21 2022 Fedora Release Engineering - 1.2.6-30 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Thu Jan 20 2022 Fedora Release Engineering - 1.2.6-29 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + * Thu Jul 22 2021 Fedora Release Engineering - 1.2.6-28 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild @@ -174,3 +257,4 @@ rm -fv $RPM_BUILD_ROOT%{_libdir}/lib*.la - Initial RPM release. - Include the mandatory copy of the LGPL (there is none in the sources...). +## END: Generated by rpmautospec diff --git a/sources b/sources deleted file mode 100644 index d102dc9..0000000 --- a/sources +++ /dev/null @@ -1 +0,0 @@ -7f7a060e83b4278acf4b77d7a7b9d2c0 libmpcdec-1.2.6.tar.bz2