diff --git a/sox-14.4.2-bend_arch_workaround.patch b/sox-14.4.2-bend_arch_workaround.patch deleted file mode 100644 index 2efa2c4..0000000 --- a/sox-14.4.2-bend_arch_workaround.patch +++ /dev/null @@ -1,69 +0,0 @@ -From a76bad19e8b078a5cf259a601a35cc3a8320cc5e Mon Sep 17 00:00:00 2001 -From: Jiri Kucera -Date: Thu, 1 Feb 2018 12:00:07 +0100 -Subject: [PATCH] Added big endian architectures workaround - ---- - src/testall.sh | 11 ++++++++++- - src/tests.sh | 12 +++++++++++- - 2 files changed, 21 insertions(+), 2 deletions(-) - -diff --git a/src/testall.sh b/src/testall.sh -index e739837..1ec124e 100755 ---- a/src/testall.sh -+++ b/src/testall.sh -@@ -36,6 +36,13 @@ while [ $# -ne 0 ]; do - shift - done - -+__is_big_endian=0 -+case $(uname -m) in -+ ppc64 | s390x ) -+ __is_big_endian=1 -+ ;; -+esac -+ - t() { - format=$1 - shift -@@ -53,7 +60,9 @@ t avr -e unsigned-integer - t cdr - t cvs - t dat --t hcom -r 22050 -+if [ $__is_big_endian -eq 0 ]; then -+ t hcom -r 22050 -+fi - t maud - t prc - t prc -e signed-integer -diff --git a/src/tests.sh b/src/tests.sh -index 51a6ede..6237d56 100755 ---- a/src/tests.sh -+++ b/src/tests.sh -@@ -63,6 +63,13 @@ while [ $# -ne 0 ]; do - shift - done - -+__is_big_endian=0 -+case $(uname -m) in -+ ppc64 | s390x ) -+ __is_big_endian=1 -+ ;; -+esac -+ - getFormat () { - formatExt=$1; formatText=$1; formatFlags="" - case $1 in -@@ -167,7 +174,10 @@ do_singlechannel_formats () { - format1=wavu8 - convertToAndFrom smp s8 s1X s1N s1XN sndt sndr - #(rate=50000; convertToAndFrom txw) || exit 1 # FIXME -- (rate=11025; convertToAndFrom hcom) || exit 1 # Fixed rates -+ # FIXME: This conversion raise SIGABRT on big endian architectures -+ if [ $__is_big_endian -eq 0 ]; then -+ (rate=11025; convertToAndFrom hcom) || exit 1 # Fixed rates -+ fi - - format1=wve - (rate=8000; convertToAndFrom al s16 u16 s32 f32 f64 dat) || exit 1 # Fixed rate diff --git a/sox-14.4.2-check_for_bugs.patch b/sox-14.4.2-check_for_bugs.patch index 7a303b5..bdcd43d 100644 --- a/sox-14.4.2-check_for_bugs.patch +++ b/sox-14.4.2-check_for_bugs.patch @@ -1,4 +1,4 @@ -From 67a764f51e9ab05fc15cea450e3e6d0283958475 Mon Sep 17 00:00:00 2001 +From 0b920fec9f9e70749c9b6fcc0ad0a019363e5bad Mon Sep 17 00:00:00 2001 From: Jiri Kucera Date: Mon, 22 Jan 2018 03:18:25 +0100 Subject: [PATCH] Added tests that check if fixed bugs are still fixed @@ -124,7 +124,7 @@ HcmV?d00001 diff --git a/tests/check-if-old-bugs-remain-fixed/runtest.sh b/tests/check-if-old-bugs-remain-fixed/runtest.sh new file mode 100644 -index 0000000..5286df8 +index 0000000..60f6b3d --- /dev/null +++ b/tests/check-if-old-bugs-remain-fixed/runtest.sh @@ -0,0 +1,30 @@ @@ -145,11 +145,11 @@ index 0000000..5286df8 + rlPhaseEnd + + rlPhaseStartTest -+ rlRun "sox $DataDir/02-heap-buffer-over $SndFile" 0 'Test for CVE-2017-15370 presence' -+ rlRun "sox $DataDir/03-abort /dev/null" 2 'Test for CVE-2017-15371 presence' 2>&1 | tee $TmpFile ++ rlRun "soxdbg $DataDir/02-heap-buffer-over $SndFile" 0 'Test for CVE-2017-15370 presence' ++ rlRun "soxdbg $DataDir/03-abort /dev/null" 2 'Test for CVE-2017-15371 presence' 2>&1 | tee $TmpFile + rlAssertGrep 'FLAC ERROR whilst decoding metadata' $TmpFile -+ rlRun "sox $DataDir/01-stack-overflow $SndFile" 0 'Test for CVE-2017-15372 presence' -+ rlRun "sox -D -V -V $DataDir/crash00 /dev/null" 2 'Test for CVE-2017-15642 presence' ++ rlRun "soxdbg $DataDir/01-stack-overflow $SndFile" 0 'Test for CVE-2017-15372 presence' ++ rlRun "soxdbg -D -V -V $DataDir/crash00 /dev/null" 2 'Test for CVE-2017-15642 presence' + rlPhaseEnd + + rlPhaseStartCleanup diff --git a/sox-14.4.2-plugins_env_var_doc.patch b/sox-14.4.2-plugins_env_var_doc.patch deleted file mode 100644 index 3eef857..0000000 --- a/sox-14.4.2-plugins_env_var_doc.patch +++ /dev/null @@ -1,572 +0,0 @@ -From 516b66148cc3db0029347dae530ac7dd0e141b34 Mon Sep 17 00:00:00 2001 -From: Jiri Kucera -Date: Thu, 25 Jan 2018 17:08:16 +0100 -Subject: [PATCH] Path to plugins overriding feature mentioned in man pages - -Also added ENVIRONMENT section ---- - libsox.3 | 13 +++- - libsox.txt | 213 ++++++++++++++++++++++++++++++++----------------------------- - sox.1 | 24 +++++++ - sox.txt | 38 ++++++++--- - soxi.1 | 4 ++ - soxi.txt | 3 + - 6 files changed, 182 insertions(+), 113 deletions(-) - -diff --git a/libsox.3 b/libsox.3 -index 1233bc7..5117220 100644 ---- a/libsox.3 -+++ b/libsox.3 -@@ -75,8 +75,13 @@ useful for any sound application. - \fBsox_format_init\fR function performs some required initialization - related to all file format handlers. If compiled with dynamic - library support then this will detect and initialize all external --libraries. This should be called before any other file operations --are performed. -+libraries. As default, SoX loads external libraries from its compile-time -+given directory. This behavior can be changed by setting the SOX_PLUGINS -+environment variable that overrides the default path to external libraries -+directory. sox_format_init should be called before any other file operations -+are performed. See also \fIPlugins\fR subsection under the \fIDESCRIPTION\fR -+section in -+.BR sox (1). - .P - \fBsox_format_quit\fR function performs some required cleanup - related to all file format handlers. -@@ -360,6 +365,10 @@ details; basically, you use it as: - .EX - libtool \-\-mode=link gcc \-o prog /path/to/libsox.la - .EE -+.SH ENVIRONMENT -+.TP 20 -+SOX_PLUGINS -+Overrides the default path to the external libraries directory. - .SH BUGS - This manual page is both incomplete and out of date. - .SH SEE ALSO -diff --git a/libsox.txt b/libsox.txt -index dc627fc..38c552d 100644 ---- a/libsox.txt -+++ b/libsox.txt -@@ -45,92 +45,97 @@ DESCRIPTION - - sox_format_init function performs some required initialization related - to all file format handlers. If compiled with dynamic library support -- then this will detect and initialize all external libraries. This -- should be called before any other file operations are performed. -- -- sox_format_quit function performs some required cleanup related to all -+ then this will detect and initialize all external libraries. As -+ default, SoX loads external libraries from its compile-time given -+ directory. This behavior can be changed by setting the SOX_PLUGINS -+ environment variable that overrides the default path to external -+ libraries directory. sox_format_init should be called before any other -+ file operations are performed. See also Plugins subsection under the -+ DESCRIPTION section in sox(1). -+ -+ sox_format_quit function performs some required cleanup related to all - file format handlers. - -- sox_open_input function opens the file for reading whose name is the -- string pointed to by path and associates an sox_format_t with it. If -+ sox_open_input function opens the file for reading whose name is the -+ string pointed to by path and associates an sox_format_t with it. If - info is non-NULL then it will be used to specify the data format of the -- input file. This is normally only needed for headerless audio files -- since the information is not stored in the file. If filetype is non- -- NULL then it will be used to specify the file type. If this is not -- specified then the file type is attempted to be derived by looking at -- the file header and/or the filename extension. A special name of "-" -+ input file. This is normally only needed for headerless audio files -+ since the information is not stored in the file. If filetype is non- -+ NULL then it will be used to specify the file type. If this is not -+ specified then the file type is attempted to be derived by looking at -+ the file header and/or the filename extension. A special name of "-" - can be used to read data from stdin. - -- sox_open_output function opens the file for writing whose name is the -- string pointed to by path and associates an sox_format_t with it. If -+ sox_open_output function opens the file for writing whose name is the -+ string pointed to by path and associates an sox_format_t with it. If - info is non-NULL then it will be used to specify the data format of the -- output file. Since most file formats can write data in different data -- formats, this generally has to be specified. The info structure from -+ output file. Since most file formats can write data in different data -+ formats, this generally has to be specified. The info structure from - the input format handler can be specified to copy data over in the same -- format. If comment is non-NULL, it will be written in the file header -+ format. If comment is non-NULL, it will be written in the file header - for formats that support comments. If filetype is non-NULL then it will -- be used to specify the file type. If this is not specified then the -- file type is attempted to be derived by looking at the filename exten‐ -+ be used to specify the file type. If this is not specified then the -+ file type is attempted to be derived by looking at the filename exten‐ - sion. A special name of "-" can be used to write data to stdout. - - The function sox_read reads len samples in to buf using the format han‐ -- dler specified by ft. All data read is converted to 32-bit signed sam‐ -- ples before being placed in to buf. The value of len is specified in -- total samples. If its value is not evenly divisable by the number of -+ dler specified by ft. All data read is converted to 32-bit signed sam‐ -+ ples before being placed in to buf. The value of len is specified in -+ total samples. If its value is not evenly divisable by the number of - channels, undefined behavior will occur. - -- The function sox_write writes len samples from buf using the format -- handler specified by ft. Data in buf must be 32-bit signed samples and -- will be converted during the write process. The value of len is speci‐ -+ The function sox_write writes len samples from buf using the format -+ handler specified by ft. Data in buf must be 32-bit signed samples and -+ will be converted during the write process. The value of len is speci‐ - fied in total samples. If its value is not evenly divisable by the num‐ - ber of channels, undefined behavior will occur. - -- The sox_close function dissociates the named sox_format_t from its -- underlying file or set of functions. If the format handler was being -+ The sox_close function dissociates the named sox_format_t from its -+ underlying file or set of functions. If the format handler was being - used for output, any buffered data is written first. - -- The function sox_find_effect finds effect name, returning a pointer to -+ The function sox_find_effect finds effect name, returning a pointer to - its sox_effect_handler_t if it exists, and NULL otherwise. - -- The function sox_create_effect instantiates an effect into a -- sox_effect_t given a sox_effect_handler_t *. Any missing methods are -+ The function sox_create_effect instantiates an effect into a -+ sox_effect_t given a sox_effect_handler_t *. Any missing methods are - automatically set to the corresponding nothing method. - -- The function sox_effect_options allows passing options into the effect -- to control its behavior. It will return SOX_EOF if there were any -- invalid options passed in. On success, the effp->in_signal will -+ The function sox_effect_options allows passing options into the effect -+ to control its behavior. It will return SOX_EOF if there were any -+ invalid options passed in. On success, the effp->in_signal will - optional contain the rate and channel count it requires input data from - and effp->out_signal will optionally contain the rate and channel count -- it outputs in. When present, this information should be used to make -- sure appropriate effects are placed in the effects chain to handle any -+ it outputs in. When present, this information should be used to make -+ sure appropriate effects are placed in the effects chain to handle any - needed conversions. - -- Passing in options is currently only supported when they are passed in -- before the effect is ever started. The behavior is undefined if its -+ Passing in options is currently only supported when they are passed in -+ before the effect is ever started. The behavior is undefined if its - called once the effect is started. - - sox_create_effects_chain will instantiate an effects chain that effects -- can be added to. in_enc and out_enc are the signal encoding of the -+ can be added to. in_enc and out_enc are the signal encoding of the - input and output of the chain respectively. The pointers to in_enc and -- out_enc are stored internally and so their memory should not be freed. -+ out_enc are stored internally and so their memory should not be freed. - Also, it is OK if their values change over time to reflect new input or - output encodings as they are referenced only as effects start up or are - restarted. - - sox_delete_effects_chain will release any resources reserved during the -- creation of the chain. This will also call sox_delete_effects if any -+ creation of the chain. This will also call sox_delete_effects if any - effects are still in the chain. - -- sox_add_effect adds an effect to the chain. in specifies the input -+ sox_add_effect adds an effect to the chain. in specifies the input - signal info for this effect. out is a suggestion as to what the output -- signal should be but depending on the effects given options and on in -- the effect can choose to do differently. Whatever output rate and -- channels the effect does produce are written back to in. It is meant -+ signal should be but depending on the effects given options and on in -+ the effect can choose to do differently. Whatever output rate and -+ channels the effect does produce are written back to in. It is meant - that in be stored and passed to each new call to sox_add_effect so that - changes will be propagated to each new effect. - -- SoX includes skeleton C files to assist you in writing new formats -- (skelform.c) and effects (skeleff.c). Note that new formats can often -+ SoX includes skeleton C files to assist you in writing new formats -+ (skelform.c) and effects (skeleff.c). Note that new formats can often - just deal with the header and then use raw.c's routines for reading and - writing. - -@@ -140,97 +145,97 @@ DESCRIPTION - - RETURN VALUE - Upon successful completion sox_open_input and sox_open_output return an -- sox_format_t (which is a pointer). Otherwise, NULL is returned. TODO: -+ sox_format_t (which is a pointer). Otherwise, NULL is returned. TODO: - Need a way to return reason for failures. Currently, relies on sox_warn - to print information. - -- sox_read and sox_write return the number of samples successfully read -- or written. If an error occurs, or the end-of-file is reached, the -- return value is a short item count or SOX_EOF. TODO: sox_read does not -- distiguish between end-of-file and error. Need an feof() and ferror() -+ sox_read and sox_write return the number of samples successfully read -+ or written. If an error occurs, or the end-of-file is reached, the -+ return value is a short item count or SOX_EOF. TODO: sox_read does not -+ distiguish between end-of-file and error. Need an feof() and ferror() - concept to determine which occured. - -- Upon successful completion sox_close returns 0. Otherwise, SOX_EOF is -+ Upon successful completion sox_close returns 0. Otherwise, SOX_EOF is - returned. In either case, any further access (including another call to - sox_close()) to the handler results in undefined behavior. TODO: Need a -- way to return reason for failures. Currently, relies on sox_warn to -+ way to return reason for failures. Currently, relies on sox_warn to - print information. - -- Upon successful completion sox_seek returns 0. Otherwise, SOX_EOF is -+ Upon successful completion sox_seek returns 0. Otherwise, SOX_EOF is - returned. TODO Need to set a global error and implement sox_tell. - - ERRORS - TODO - - INTERNALS -- SoX's formats and effects operate with an internal sample format of -- signed 32-bit integer. The data processing routines are called with -+ SoX's formats and effects operate with an internal sample format of -+ signed 32-bit integer. The data processing routines are called with - buffers of these samples, and buffer sizes which refer to the number of - samples processed, not the number of bytes. File readers translate the -- input samples to signed 32-bit integers and return the number of sam‐ -- ples read. For example, data in linear signed byte format is left- -+ input samples to signed 32-bit integers and return the number of sam‐ -+ ples read. For example, data in linear signed byte format is left- - shifted 24 bits. - - Representing samples as integers can cause problems when processing the -- audio. For example, if an effect to mix down left and right channels -+ audio. For example, if an effect to mix down left and right channels - into one monophonic channel were to use the line - *obuf++ = (*ibuf++ + *ibuf++)/2; -- distortion might occur since the intermediate addition can overflow 32 -+ distortion might occur since the intermediate addition can overflow 32 - bits. The line - *obuf++ = *ibuf++/2 + *ibuf++/2; -- would get round the overflow problem (at the expense of the least sig‐ -+ would get round the overflow problem (at the expense of the least sig‐ - nificant bit). - -- Stereo data is stored with the left and right speaker data in succes‐ -- sive samples. Quadraphonic data is stored in this order: left front, -+ Stereo data is stored with the left and right speaker data in succes‐ -+ sive samples. Quadraphonic data is stored in this order: left front, - right front, left rear, right rear. - - FORMATS -- A format is responsible for translating between sound sample files and -- an internal buffer. The internal buffer is store in signed longs with -+ A format is responsible for translating between sound sample files and -+ an internal buffer. The internal buffer is store in signed longs with - a fixed sampling rate. The format operates from two data structures: a - format structure, and a private structure. - - The format structure contains a list of control parameters for the sam‐ -- ple: sampling rate, data size (8, 16, or 32 bits), encoding (unsigned, -- signed, floating point, etc.), number of sound channels. It also con‐ -- tains other state information: whether the sample file needs to be -+ ple: sampling rate, data size (8, 16, or 32 bits), encoding (unsigned, -+ signed, floating point, etc.), number of sound channels. It also con‐ -+ tains other state information: whether the sample file needs to be - byte-swapped, whether sox_seek() will work, its suffix, its file stream - pointer, its format pointer, and the private structure for the format . - -- The private area is just a preallocated data array for the format to -- use however it wishes. It should have a defined data structure and -- cast the array to that structure. See voc.c for the use of a private -+ The private area is just a preallocated data array for the format to -+ use however it wishes. It should have a defined data structure and -+ cast the array to that structure. See voc.c for the use of a private - data area. Voc.c has to track the number of samples it writes and when -- finishing, seek back to the beginning of the file and write it out. -- The private area is not very large. The ``echo'' effect has to mal‐ -+ finishing, seek back to the beginning of the file and write it out. -+ The private area is not very large. The ``echo'' effect has to mal‐ - loc() a much larger area for its delay line buffers. - - A format has 6 routines: - -- startread Set up the format parameters, or read in a data -+ startread Set up the format parameters, or read in a data - header, or do what needs to be done. - -- read Given a buffer and a length: read up to that many -- samples, transform them into signed long integers, -- and copy them into the buffer. Return the number -+ read Given a buffer and a length: read up to that many -+ samples, transform them into signed long integers, -+ and copy them into the buffer. Return the number - of samples actually read. - - stopread Do what needs to be done. - -- startwrite Set up the format parameters, or write out a data -+ startwrite Set up the format parameters, or write out a data - header, or do what needs to be done. - - write Given a buffer and a length: copy that many samples -- out of the buffer, convert them from signed longs -- to the appropriate data, and write them to the -+ out of the buffer, convert them from signed longs -+ to the appropriate data, and write them to the - file. If it can't write out all the samples, fail. - -- stopwrite Fix up any file header, or do what needs to be -+ stopwrite Fix up any file header, or do what needs to be - done. - - EFFECTS -- Each effect runs with one input and one output stream. An effect's -+ Each effect runs with one input and one output stream. An effect's - implementation comprises six functions that may be called to the follow - flow diagram: - LOOP (invocations with different parameters) -@@ -247,54 +252,58 @@ EFFECTS - LOOP (channels) - stop - kill -- Notes: For some effects, some of the functions may not be needed and -- can be NULL. An effect that is marked `MCHAN' does not use the LOOP -+ Notes: For some effects, some of the functions may not be needed and -+ can be NULL. An effect that is marked `MCHAN' does not use the LOOP - (channels) lines and must therefore perform multiple channel processing -- inside the affected functions. Multiple effect instances may be pro‐ -+ inside the affected functions. Multiple effect instances may be pro‐ - cessed (according to the above flow diagram) in parallel. - - getopts is called with a character string argument list for - the effect. - -- start is called with the signal parameters for the input -+ start is called with the signal parameters for the input - and output streams. - -- flow is called with input and output data buffers, and -- (by reference) the input and output data buffer -+ flow is called with input and output data buffers, and -+ (by reference) the input and output data buffer - sizes. It processes the input buffer into the out‐ - put buffer, and sets the size variables to the num‐ - bers of samples actually processed. It is under no -- obligation to read from the input buffer or write -- to the output buffer during the same call. If the -+ obligation to read from the input buffer or write -+ to the output buffer during the same call. If the - call returns SOX_EOF then this should be used as an - indication that this effect will no longer read any -- data and can be used to switch to drain mode -+ data and can be used to switch to drain mode - sooner. - -- drain is called after there are no more input data sam‐ -- ples. If the effect wishes to generate more data -- samples it copies the generated data into a given -+ drain is called after there are no more input data sam‐ -+ ples. If the effect wishes to generate more data -+ samples it copies the generated data into a given - buffer and returns the number of samples generated. -- If it fills the buffer, it will be called again, -+ If it fills the buffer, it will be called again, - etc. The echo effect uses this to fade away. - -- stop is called when there are no more input samples and -+ stop is called when there are no more input samples and - no more output samples to process. It is typically -- used to release or close resources (e.g. allocated -- memory or temporary files) that were set-up in -+ used to release or close resources (e.g. allocated -+ memory or temporary files) that were set-up in - start. See echo.c for an example. - -- kill is called to allow resources allocated by getopts -+ kill is called to allow resources allocated by getopts - to be released. See pad.c for an example. - - LINKING -- The method of linking against libsox depends on how SoX was built on -- your system. For a static build, just link against the libraries as -- normal. For a dynamic build, you should use libtool to link with the -- correct linker flags. See the libtool manual for details; basically, -+ The method of linking against libsox depends on how SoX was built on -+ your system. For a static build, just link against the libraries as -+ normal. For a dynamic build, you should use libtool to link with the -+ correct linker flags. See the libtool manual for details; basically, - you use it as: - libtool --mode=link gcc -o prog /path/to/libsox.la - -+ENVIRONMENT -+ SOX_PLUGINS Overrides the default path to the external -+ libraries directory. -+ - BUGS - This manual page is both incomplete and out of date. - -diff --git a/sox.1 b/sox.1 -index 2c4ca47..bca20c8 100644 ---- a/sox.1 -+++ b/sox.1 -@@ -620,6 +620,17 @@ Another option to stop processing early is to use an effect that - has a time period or sample count to determine the stopping - point. The trim effect is an example of this. Once all - effects chains have stopped then SoX will also stop. -+.SS Plugins -+When SoX recognizes the format of its input or output file, it looks for the -+corresponding plugin. During its start, SoX loads all its plugins from the -+specified directory. The default path to this directory is given at the compile -+time as `${libdir}/sox', but it can be overridden by the -+.B SOX_PLUGINS -+environment variable. A plugin is in fact a shared library object its name has -+a format `libsox_fmt_.so', where is a name of one of -+the supported formats, so for FLAC SoX use `libsox_fmt_flac.so' etc. For the -+list of supported formats, see -+.BR soxformat (7). - .SH FILENAMES - Filenames can be simple file names, absolute or relative path names, - or URLs (input files only). Note that URL support requires that -@@ -4180,6 +4191,19 @@ See also - for a volume-changing effect with different capabilities, and - .B compand - for a dynamic-range compression/expansion/limiting effect. -+.SH ENVIRONMENT -+.TP 20 -+AUDIODEV -+Overrides the default audio device. -+.TP 20 -+AUDIODRIVER -+Overrides the default audio driver selected by SoX. -+.TP 20 -+SOX_OPTS -+Provides alternative default values for SoX's global options. -+.TP 20 -+SOX_PLUGINS -+Overrides default path to directory with plugins. - .SH DIAGNOSTICS - Exit status is 0 for no error, 1 if there is a problem with the - command-line parameters, or 2 if an error occurs during file processing. -diff --git a/sox.txt b/sox.txt -index 2e7bcde..ad79445 100644 ---- a/sox.txt -+++ b/sox.txt -@@ -481,6 +481,17 @@ DESCRIPTION - effect is an example of this. Once all effects chains have stopped - then SoX will also stop. - -+ Plugins -+ When SoX recognizes the format of its input or output file, it looks -+ for the corresponding plugin. During its start, SoX loads all its -+ plugins from the specified directory. The default path to this -+ directory is given at the compile time as `${libdir}/sox', but it can -+ be overridden by the SOX_PLUGINS environment variable. A plugin is in -+ fact a shared library object its name has a format `libsox_fmt_.so', where is a name of one of the supported -+ formats, so for FLAC SoX use `libsox_fmt_flac.so' etc. For the list of -+ supported formats, see soxformat(7). -+ - FILENAMES - Filenames can be simple file names, absolute or relative path names, or - URLs (input files only). Note that URL support requires that wget(1) -@@ -2009,8 +2020,6 @@ EFFECTS - -l low 80% 100 playback on old - hardware - -m medium 95% 100 audio playback -- -- - -h high 95% 125 16-bit mastering - (use with dither) - -v very high 95% 175 24-bit mastering -@@ -2166,7 +2175,6 @@ EFFECTS - - Letter Volume number Notes - p power adjust in dB 0 = no change -- - i power adjust in dB As `p', but invert - the audio - v voltage multiplier 1 = no change, 0.5 -@@ -2727,6 +2735,7 @@ EFFECTS - - - -+ - RMS amplitude √(¹/nΣxk²) The level of a D.C. - signal that would - have the same power -@@ -2797,6 +2806,7 @@ EFFECTS - Bit-depth 16/16 16/16 16/16 - Num samples 7.72M - Length s 174.973 -+ - Scale max 1.000000 - Window s 0.050 - -@@ -3202,8 +3212,18 @@ EFFECTS - bilities, and compand for a dynamic-range compression/expan‐ - sion/limiting effect. - -+ENVIRONMENT -+ AUDIODEV Overrides the default audio device. -+ -+ AUDIODRIVER Overrides the default audio driver selected by SoX. -+ -+ SOX_OPTS Provides alternative default values for SoX's -+ global options. -+ -+ SOX_PLUGINS Overrides default path to directory with plugins. -+ - DIAGNOSTICS -- Exit status is 0 for no error, 1 if there is a problem with the com‐ -+ Exit status is 0 for no error, 1 if there is a problem with the com‐ - mand-line parameters, or 2 if an error occurs during file processing. - - BUGS -@@ -3239,13 +3259,13 @@ LICENSE - Copyright 1991 Lance Norskog and Sundry Contributors. - - This program is free software; you can redistribute it and/or modify it -- under the terms of the GNU General Public License as published by the -- Free Software Foundation; either version 2, or (at your option) any -+ under the terms of the GNU General Public License as published by the -+ Free Software Foundation; either version 2, or (at your option) any - later version. - -- This program is distributed in the hope that it will be useful, but -- WITHOUT ANY WARRANTY; without even the implied warranty of MER‐ -- CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -+ This program is distributed in the hope that it will be useful, but -+ WITHOUT ANY WARRANTY; without even the implied warranty of MER‐ -+ CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General - Public License for more details. - - AUTHORS -diff --git a/soxi.1 b/soxi.1 -index 5c48452..39f78ba 100644 ---- a/soxi.1 -+++ b/soxi.1 -@@ -96,6 +96,10 @@ Show the name of the audio encoding. - .TP - \fB\-a\fR - Show file comments (annotations) if available. -+.SH ENVIRONMENT -+.TP 20 -+SOX_PLUGINS -+Overrides default path to directory with plugins. - .SH BUGS - Please report any bugs found in this version of SoX to the mailing list - (sox-users@lists.sourceforge.net). -diff --git a/soxi.txt b/soxi.txt -index 9164d01..9176770 100644 ---- a/soxi.txt -+++ b/soxi.txt -@@ -50,6 +50,9 @@ OPTIONS - - -a Show file comments (annotations) if available. - -+ENVIRONMENT -+ SOX_PLUGINS Overrides default path to directory with plugins. -+ - BUGS - Please report any bugs found in this version of SoX to the mailing list - (sox-users@lists.sourceforge.net). diff --git a/sox-14.4.2-plugins_env_var_impl.patch b/sox-14.4.2-plugins_env_var_impl.patch index 96f7ab4..e569941 100644 --- a/sox-14.4.2-plugins_env_var_impl.patch +++ b/sox-14.4.2-plugins_env_var_impl.patch @@ -1,25 +1,110 @@ -From 2e86340a3494c7decef02d389f286f8a324484b4 Mon Sep 17 00:00:00 2001 +From 4d8183f35cd9e2c4fdc23c4a3b152f1fcaff8e49 Mon Sep 17 00:00:00 2001 From: Jiri Kucera Date: Thu, 25 Jan 2018 17:05:37 +0100 Subject: [PATCH] Added support for path to plugins overriding --- - src/formats.c | 13 ++++++++++++- - 1 file changed, 12 insertions(+), 1 deletion(-) + src/Makefile.am | 28 ++++++++++++++++++++-------- + src/formats.c | 19 ++++++++++++++++++- + src/test-comments | 44 ++++++++++++++++++++++++-------------------- + src/testall.sh | 12 ++++++++---- + src/tests.sh | 25 +++++++++++++++---------- + 5 files changed, 85 insertions(+), 43 deletions(-) +diff --git a/src/Makefile.am b/src/Makefile.am +index 7cceaaf..e9169c5 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -34,15 +34,17 @@ endif + # SoX - the application # + ######################### + +-bin_PROGRAMS = sox ++bin_PROGRAMS = sox soxdbg + EXTRA_PROGRAMS = example0 example1 example2 example3 example4 example5 example6 sox_sample_test +-lib_LTLIBRARIES = libsox.la ++lib_LTLIBRARIES = libsox.la libsoxdbg.la + include_HEADERS = sox.h + sox_SOURCES = sox.c + if HAVE_WIN32_GLOB + sox_SOURCES += win32-glob.c win32-glob.h + endif ++soxdbg_SOURCES = ${sox_SOURCES} + sox_LDADD = libsox.la ++soxdbg_LDADD = libsoxdbg.la + example0_SOURCES = example0.c + example1_SOURCES = example1.c + example2_SOURCES = example2.c +@@ -132,6 +134,11 @@ include optional-fmts.am + + + ++libsoxdbg_la_SOURCES = ${libsox_la_SOURCES} ++libsoxdbg_la_LIBADD = ${libsox_la_LIBADD} ++libsoxdbg_la_CPPFLAGS = -DSOX_ALLOW_SOX_PLUGINS_OVERRIDING=1 ${AM_CPPFLAGS} ++libsoxdbg_la_CFLAGS = ${libsox_la_CFLAGS} ++libsoxdbg_la_LDFLAGS = ${libsox_la_LDFLAGS} + # example programs will need same link options as sox does. + example0_LDADD = ${sox_LDADD} + example1_LDADD = ${sox_LDADD} +@@ -145,31 +152,36 @@ EXTRA_DIST = monkey.wav optional-fmts.am \ + CMakeLists.txt soxconfig.h.cmake \ + tests.sh testall.sh tests.bat testall.bat test-comments + +-all: sox$(EXEEXT) play$(EXEEXT) rec$(EXEEXT) soxi$(EXEEXT) sox_sample_test$(EXEEXT) example0$(EXEEXT) example1$(EXEEXT) example2$(EXEEXT) example3$(EXEEXT) example4$(EXEEXT) example5$(EXEEXT) example6$(EXEEXT) ++all: sox$(EXEEXT) soxdbg$(EXEEXT) play$(EXEEXT) playdbg$(EXEEXT) rec$(EXEEXT) recdbg$(EXEEXT) soxi$(EXEEXT) soxidbg$(EXEEXT) sox_sample_test$(EXEEXT) example0$(EXEEXT) example1$(EXEEXT) example2$(EXEEXT) example3$(EXEEXT) example4$(EXEEXT) example5$(EXEEXT) example6$(EXEEXT) + + play$(EXEEXT) rec$(EXEEXT) soxi$(EXEEXT): sox$(EXEEXT) + if test "$(PLAYRECLINKS)" = "yes"; then \ + test -f sox$(EXEEXT) && ( $(RM) $@ && $(LN_S) sox$(EXEEXT) $@ ) || $(LN_S) sox $@; \ + fi + ++playdbg$(EXEEXT) recdbg$(EXEEXT) soxidbg$(EXEEXT): soxdbg$(EXEEXT) ++ if test "$(PLAYRECLINKS)" = "yes"; then \ ++ test -f soxdbg$(EXEEXT) && ( $(RM) $@ && $(LN_S) soxdbg$(EXEEXT) $@ ) || $(LN_S) soxdbg $@; \ ++ fi ++ + install-exec-hook: + if test "$(PLAYRECLINKS)" = "yes"; then \ +- cd $(DESTDIR)$(bindir); $(RM) play$(EXEEXT) rec$(EXEEXT); $(LN_S) sox$(EXEEXT) play$(EXEEXT); $(LN_S) sox$(EXEEXT) rec$(EXEEXT); \ ++ cd $(DESTDIR)$(bindir); $(RM) play$(EXEEXT) rec$(EXEEXT) playdbg$(EXEEXT) recdbg$(EXEEXT); $(LN_S) sox$(EXEEXT) play$(EXEEXT); $(LN_S) sox$(EXEEXT) rec$(EXEEXT); $(LN_S) soxdbg$(EXEEXT) playdbg$(EXEEXT); $(LN_S) soxdbg$(EXEEXT) recdbg$(EXEEXT); \ + fi + if test "$(SYMLINKS)" = "yes"; then \ +- cd $(DESTDIR)$(bindir); $(RM) soxi$(EXEEXT); $(LN_S) sox$(EXEEXT) soxi$(EXEEXT); \ ++ cd $(DESTDIR)$(bindir); $(RM) soxi$(EXEEXT) soxidbg$(EXEEXT); $(LN_S) sox$(EXEEXT) soxi$(EXEEXT); $(LN_S) soxdbg$(EXEEXT) soxidbg$(EXEEXT); \ + fi + + uninstall-hook: + if test "$(PLAYRECLINKS)" = "yes"; then \ +- cd $(DESTDIR)$(bindir); $(RM) play$(EXTEXT) rec$(EXEEXT); \ ++ cd $(DESTDIR)$(bindir); $(RM) play$(EXTEXT) rec$(EXEEXT) playdbg$(EXTEXT) recdbg$(EXEEXT); \ + fi + if test "$(SYMLINKS)" = "yes"; then \ +- cd $(DESTDIR)$(bindir); $(RM) soxi$(EXEEXT); \ ++ cd $(DESTDIR)$(bindir); $(RM) soxi$(EXEEXT) soxidbg$(EXEEXT); \ + fi + + clean-local: +- $(RM) play$(EXEEXT) rec$(EXEEXT) soxi$(EXEEXT) ++ $(RM) play$(EXEEXT) rec$(EXEEXT) soxi$(EXEEXT) playdbg$(EXEEXT) recdbg$(EXEEXT) soxidbg$(EXEEXT) + $(RM) sox_sample_test$(EXEEXT) + $(RM) example0$(EXEEXT) example1$(EXEEXT) example2$(EXEEXT) example3$(EXEEXT) example4$(EXEEXT) example5$(EXEEXT) example6$(EXEEXT) + diff --git a/src/formats.c b/src/formats.c -index 724a4cd..fdd47f6 100644 +index 724a4cd..03ab68a 100644 --- a/src/formats.c +++ b/src/formats.c -@@ -1161,6 +1161,7 @@ enum { +@@ -1161,6 +1161,9 @@ enum { static sox_bool plugins_initted = sox_false; #ifdef HAVE_LIBLTDL /* Plugin format handlers */ -+ #define SOX_PLUGINS_NAME "SOX_PLUGINS" ++ #ifdef SOX_ALLOW_SOX_PLUGINS_OVERRIDING ++ #define SOX_PLUGINS_NAME "SOX_PLUGINS" ++ #endif #define MAX_DYNAMIC_FORMATS 42 #define MAX_FORMATS (NSTATIC_FORMATS + MAX_DYNAMIC_FORMATS) #define MAX_FORMATS_1 (MAX_FORMATS + 1) -@@ -1218,6 +1219,16 @@ sox_get_format_fns(void) +@@ -1218,6 +1221,20 @@ sox_get_format_fns(void) } return 0; } @@ -27,16 +112,20 @@ index 724a4cd..fdd47f6 100644 + /* Allow to specify SoX plugin directory via environment */ + static const char *get_sox_plugins_dir(void) + { ++ #ifdef SOX_ALLOW_SOX_PLUGINS_OVERRIDING + const char *sox_plugins_dir = getenv(SOX_PLUGINS_NAME); + + if (!sox_plugins_dir) ++ #endif + return PKGLIBDIR; ++ #ifdef SOX_ALLOW_SOX_PLUGINS_OVERRIDING + return sox_plugins_dir; ++ #endif + } #endif int sox_format_init(void) /* Find & load format handlers. */ -@@ -1233,7 +1244,7 @@ int sox_format_init(void) /* Find & load format handlers. */ +@@ -1233,7 +1250,7 @@ int sox_format_init(void) /* Find & load format handlers. */ lsx_fail("lt_dlinit failed with %d error(s): %s", error, lt_dlerror()); return SOX_EOF; } @@ -45,3 +134,228 @@ index 724a4cd..fdd47f6 100644 } #endif return SOX_SUCCESS; +diff --git a/src/test-comments b/src/test-comments +index 291ffa1..4a978b5 100755 +--- a/src/test-comments ++++ b/src/test-comments +@@ -1,10 +1,14 @@ + #!/bin/sh + ++bindir=. ++ + tmp=/tmp/`basename $0`-$$ + input=$tmp.wav # no comment support + ++[ "$SOX_TEST_BINDIR" ] && bindir="$SOX_TEST_BINDIR" ++ + check_file () { +- ./sox --i -a $1 > $tmp.comments ++ ${bindir}/soxdbg --i -a $1 > $tmp.comments + cmp $tmp.comments $2 || exit 1 + } + +@@ -22,9 +26,9 @@ com0="Processed by SoX" + com1="foo bar" + com2="bar foo" + +-./sox -n $input trim 0 .1 ++${bindir}/soxdbg -n $input trim 0 .1 + +-./sox $input $tmp.au # Apply default comment ++${bindir}/soxdbg $input $tmp.au # Apply default comment + check $tmp.au "$com0" + + cp $tmp.au $tmp.comment.au +@@ -36,47 +40,47 @@ ALBUM=A Collection Of Songs + TRACKNUMBER=01 + . + +-./sox $input --comment-file $tmp.i $tmp.comments.au ++${bindir}/soxdbg $input --comment-file $tmp.i $tmp.comments.au + check_file $tmp.comments.au $tmp.i + +-./sox $input --comment= $tmp.au # Don't apply default comment ++${bindir}/soxdbg $input --comment= $tmp.au # Don't apply default comment + check $tmp.au + +-./sox $input --add-comment "$com1" $tmp.au ++${bindir}/soxdbg $input --add-comment "$com1" $tmp.au + check $tmp.au "$com1" + +-./sox $tmp.comment.au --add-comment "$com1" $tmp.au ++${bindir}/soxdbg $tmp.comment.au --add-comment "$com1" $tmp.au + check $tmp.au "$com0" "$com1" + +-./sox $input --add-comment "$com1" --add-comment "$com2" $tmp.au ++${bindir}/soxdbg $input --add-comment "$com1" --add-comment "$com2" $tmp.au + check $tmp.au "$com1" "$com2" + +-./sox $tmp.comment.au --add-comment "$com1" --add-comment "$com2" $tmp.au ++${bindir}/soxdbg $tmp.comment.au --add-comment "$com1" --add-comment "$com2" $tmp.au + check $tmp.au "$com0" "$com1" "$com2" + +-./sox $tmp.comments.au --comment= $tmp.au ++${bindir}/soxdbg $tmp.comments.au --comment= $tmp.au + check $tmp.au + +-./sox $tmp.comments.au --comment "$com1" $tmp.au ++${bindir}/soxdbg $tmp.comments.au --comment "$com1" $tmp.au + check $tmp.au "$com1" + +-./sox $tmp.comments.au --add-comment "$com1" $tmp.au ++${bindir}/soxdbg $tmp.comments.au --add-comment "$com1" $tmp.au + cp $tmp.i $tmp.j + echo "$com1" >> $tmp.j + check_file $tmp.au $tmp.j + +-./sox $tmp.comments.au --add-comment "$com1" --add-comment "$com2" $tmp.au ++${bindir}/soxdbg $tmp.comments.au --add-comment "$com1" --add-comment "$com2" $tmp.au + echo "$com2" >> $tmp.j + check_file $tmp.au $tmp.j + + # FIXME: smp mp3 +-./sox $tmp.comments.au $tmp.aiff +-./sox $tmp.aiff $tmp.flac +-./sox $tmp.flac $tmp.sf +-./sox $tmp.sf $tmp.ogg +-./sox $tmp.ogg $tmp.sndt +-./sox $tmp.sndt $tmp.sox +-./sox $tmp.sox $tmp.au ++${bindir}/soxdbg $tmp.comments.au $tmp.aiff ++${bindir}/soxdbg $tmp.aiff $tmp.flac ++${bindir}/soxdbg $tmp.flac $tmp.sf ++${bindir}/soxdbg $tmp.sf $tmp.ogg ++${bindir}/soxdbg $tmp.ogg $tmp.sndt ++${bindir}/soxdbg $tmp.sndt $tmp.sox ++${bindir}/soxdbg $tmp.sox $tmp.au + check_file $tmp.au $tmp.i + + rm -f $tmp.* +diff --git a/src/testall.sh b/src/testall.sh +index e739837..5f85def 100755 +--- a/src/testall.sh ++++ b/src/testall.sh +@@ -2,7 +2,7 @@ bindir="." + srcdir="." + effect="" + +-if [ -f ./sox.exe ] ; then ++if [ -f ./soxdbg.exe ] ; then + EXEEXT=".exe" + else + EXEEXXT="" +@@ -36,14 +36,16 @@ while [ $# -ne 0 ]; do + shift + done + ++[ "$SOX_TEST_BINDIR" ] && bindir="$SOX_TEST_BINDIR" ++ + t() { + format=$1 + shift + opts="$*" + + echo "Format: $format Options: $opts" +- ${bindir}/sox${EXEEXT} ${srcdir}/monkey.wav $opts /tmp/monkey.$format $effect +- ${bindir}/sox${EXEEXT} $opts /tmp/monkey.$format /tmp/monkey1.wav $effect ++ ${bindir}/soxdbg${EXEEXT} ${srcdir}/monkey.wav $opts /tmp/monkey.$format $effect ++ ${bindir}/soxdbg${EXEEXT} $opts /tmp/monkey.$format /tmp/monkey1.wav $effect + } + t 8svx + t aiff +@@ -53,7 +55,9 @@ t avr -e unsigned-integer + t cdr + t cvs + t dat +-t hcom -r 22050 ++if [[ ! $(uname -m) =~ ppc64|s390x ]]; then ++ t hcom -r 22050 ++fi + t maud + t prc + t prc -e signed-integer +diff --git a/src/tests.sh b/src/tests.sh +index 51a6ede..6bb3818 100755 +--- a/src/tests.sh ++++ b/src/tests.sh +@@ -6,7 +6,7 @@ bindir="." + builddir="." + srcdir="." + +-if [ -f ./sox.exe ] ; then ++if [ -f ./soxdbg.exe ] ; then + EXEEXT=".exe" + else + EXEEXT="" +@@ -63,6 +63,8 @@ while [ $# -ne 0 ]; do + shift + done + ++[ "$SOX_TEST_BINDIR" ] && bindir="$SOX_TEST_BINDIR" ++ + getFormat () { + formatExt=$1; formatText=$1; formatFlags="" + case $1 in +@@ -93,9 +95,9 @@ convertToAndFrom () { + if [ "${format1_skip}x" = "x" -a "${from_skip}x" = "x" ] ; then + getFormat ${format1}; format1Ext=$formatExt; format1Text=$formatText; format1Flags=$formatFlags + getFormat $1; format2Ext=$formatExt; format2Text=$formatText; format2Flags=$formatFlags +- execute ${bindir}/sox${EXEEXT} $verbose -RD -r $rate -c $channels -n $format1Flags input.$format1Ext synth $samples's' sin 300-3300 noise trapezium +- execute ${bindir}/sox${EXEEXT} $verbose -RD -r $rate -c $channels $format1Flags input.$format1Ext $format2Flags intermediate.$format2Ext +- execute ${bindir}/sox${EXEEXT} $verbose -RD -r $rate -c $channels $format2Flags intermediate.$format2Ext $format1Flags output.$format1Ext ++ execute ${bindir}/soxdbg${EXEEXT} $verbose -RD -r $rate -c $channels -n $format1Flags input.$format1Ext synth $samples's' sin 300-3300 noise trapezium ++ execute ${bindir}/soxdbg${EXEEXT} $verbose -RD -r $rate -c $channels $format1Flags input.$format1Ext $format2Flags intermediate.$format2Ext ++ execute ${bindir}/soxdbg${EXEEXT} $verbose -RD -r $rate -c $channels $format2Flags intermediate.$format2Ext $format1Flags output.$format1Ext + intermediateReference=vectors/intermediate`echo "$channels $rate $format1Flags $format1Ext $format2Flags"|tr " " "_"`.$format2Ext + + # Uncomment to generate new reference files +@@ -167,7 +169,10 @@ do_singlechannel_formats () { + format1=wavu8 + convertToAndFrom smp s8 s1X s1N s1XN sndt sndr + #(rate=50000; convertToAndFrom txw) || exit 1 # FIXME +- (rate=11025; convertToAndFrom hcom) || exit 1 # Fixed rates ++ # FIXME: Conversion between wav and hcom fails on big endian machine ++ if [[ ! $(uname -m) =~ ppc64|s390x ]]; then ++ (rate=11025; convertToAndFrom hcom) || exit 1 # Fixed rates ++ fi + + format1=wve + (rate=8000; convertToAndFrom al s16 u16 s32 f32 f64 dat) || exit 1 # Fixed rate +@@ -184,7 +189,7 @@ stderr_time () { + # Reading and writing performance test + time="/usr/bin/time -p" + timeIO () { +- $time ${bindir}/sox${EXEEXT} -c $channels -r $rate -n tmp.sox synth $samples's' saw 0:`expr $rate / 2` noise brown vol .9 2> tmp.write ++ $time ${bindir}/soxdbg${EXEEXT} -c $channels -r $rate -n tmp.sox synth $samples's' saw 0:`expr $rate / 2` noise brown vol .9 2> tmp.write + echo TIME synth channels=$channels samples=$samples `stderr_time tmp.write`s + if [ `uname` != SunOS ]; then + while [ $# != 0 ]; do +@@ -193,8 +198,8 @@ timeIO () { + fi + if [ "${from_skip}x" = "x" ] ; then + getFormat $1; +- ($time ${bindir}/sox${EXEEXT} $verbose -D tmp.sox $formatFlags -t $1 - 2> tmp.read) | \ +- ($time ${bindir}/sox${EXEEXT} $verbose -t $1 -c $channels -r $rate - -t sox /dev/null 2> tmp.write) ++ ($time ${bindir}/soxdbg${EXEEXT} $verbose -D tmp.sox $formatFlags -t $1 - 2> tmp.read) | \ ++ ($time ${bindir}/soxdbg${EXEEXT} $verbose -t $1 -c $channels -r $rate - -t sox /dev/null 2> tmp.write) + echo "TIME `printf %4s $formatText` write=`stderr_time tmp.write`s read=`stderr_time tmp.read`s" + fi + shift +@@ -206,7 +211,7 @@ timeIO () { + # Don't try to test un-built formats + skip_check () { + while [ $# -ne 0 ]; do +- ${bindir}/sox${EXEEXT} --help|grep "^AUDIO FILE.*\<$1\>">/dev/null || skip="$1 $skip" ++ ${bindir}/soxdbg${EXEEXT} --help|grep "^AUDIO FILE.*\<$1\>">/dev/null || skip="$1 $skip" + shift + done + } +@@ -251,7 +256,7 @@ else + fi + fi + +-${bindir}/sox${EXEEXT} -c 1 -r 44100 -n output.u8 synth .01 vol .5 ++${bindir}/soxdbg${EXEEXT} -c 1 -r 44100 -n output.u8 synth .01 vol .5 + if [ `wc -c - 14.4.2.0-17 +- SOX_PLUGINS environment variable is now used only while running %%check + during the package building; SOX_PLUGINS are now no longer available to + users + * Thu Feb 01 2018 Jiri Kucera - 14.4.2.0-16 - added patch that disables hcom conversion tests on big endian architectures due to SIGABRT issues