Unified · Split
| @@ -98,6 +98,8 @@ Other new features: · 97 unmodified lines | ||
| 98 | 98 | o Can now use `u' & `d' keys to adjust volume whilst playing audio (on some |
| 99 | 99 | systems). (robs) |
| 100 | 100 | o New bitrate, time in seconds, & total options for soxi. (robs) |
| 101 | + o `Magic' (libmagic) file type detection now selected using `--magic' | |
| 102 | + option (where supported). | |
| 101 | 103 | |
| 102 | 104 | Other bug fixes: |
| 103 | 105 | |
| @@ -728,6 +728,10 @@ selects `merge'. · 727 unmodified lines | ||
| 728 | 728 | See \fBInput File Combining\fR above for a description of the different |
| 729 | 729 | combining methods. |
| 730 | 730 | .TP |
| 731 | +.B \-\-magic | |
| 732 | +If SoX has been built with the optional `libmagic' library, then this | |
| 733 | +option can be given to enable its use in helping to detect audio file types. | |
| 734 | +.TP | |
| 731 | 735 | \fB\-D\fR, \fB\-\-no\-dither\fR |
| 732 | 736 | SoX, by default, automatically invokes the dither effect (with TPDF) when reducing |
| 733 | 737 | bit-depth. This option can be given to prevent this behaviour. |
| @@ -418,7 +418,7 @@ sox_format_t * sox_open_read( · 417 unmodified lines | ||
| 418 | 418 | filetype = detect_format(ft, lsx_find_file_extension(path)); |
| 419 | 419 | lsx_rewind(ft); |
| 420 | 420 | #if HAVE_MAGIC |
| 421 | − if (!filetype) { | |
| 421 | + if (sox_globals.use_magic && !filetype) { | |
| 422 | 422 | static magic_t magic; |
| 423 | 423 | if (!magic) { |
| 424 | 424 | magic = magic_open(MAGIC_MIME | MAGIC_SYMLINK); |
| @@ -52,7 +52,8 @@ sox_globals_t sox_globals = { · 51 unmodified lines | ||
| 52 | 52 | NULL, /* char const * stdin_in_use_by */ |
| 53 | 53 | NULL, /* char const * stdout_in_use_by */ |
| 54 | 54 | NULL, /* char const * subsystem */ |
| 55 | − NULL /* char * tmp_path */ | |
| 55 | + NULL, /* char * tmp_path */ | |
| 56 | + sox_false /* sox_bool use_magic */ | |
| 56 | 57 | }; |
| 57 | 58 | |
| 58 | 59 | char const * sox_strerror(int sox_errno) |
| @@ -1742,6 +1742,7 @@ static void usage(char const * message) · 1741 unmodified lines | ||
| 1742 | 1742 | "--interactive Prompt to overwrite output file", |
| 1743 | 1743 | "-m, --combine mix Mix multiple input files (instead of concatenating)", |
| 1744 | 1744 | "-M, --combine merge Merge multiple input files (instead of concatenating)", |
| 1745 | +"--magic Use `magic' file-type detection", | |
| 1745 | 1746 | "--norm Guard (see --guard) & normalise", |
| 1746 | 1747 | "--plot gnuplot|octave Generate script to plot response of filter effect", |
| 1747 | 1748 | "-q, --no-show-progress Run in quiet mode; opposite of -S", |
| @@ -1954,6 +1955,7 @@ static struct option long_options[] = · 206 unmodified lines | ||
| 1954 | 1955 | {"single-threaded" , no_argument, NULL, 0}, |
| 1955 | 1956 | {"ignore-length" , no_argument, NULL, 0}, |
| 1956 | 1957 | {"norm" , no_argument, NULL, 0}, |
| 1958 | + {"magic" , no_argument, NULL, 0}, | |
| 1957 | 1959 | |
| 1958 | 1960 | {"bits" , required_argument, NULL, 'b'}, |
| 1959 | 1961 | {"channels" , required_argument, NULL, 'c'}, |
| @@ -2120,6 +2122,11 @@ static char parse_gopts_and_fopts(file_t * f, int argc, char **argv) · 160 unmodified lines | ||
| 2120 | 2122 | case 17: single_threaded = sox_true; break; |
| 2121 | 2123 | case 18: f->signal.length = SOX_IGNORE_LENGTH; break; |
| 2122 | 2124 | case 19: do_guarded_norm = is_guarded = sox_true; break; |
| 2125 | +#if HAVE_MAGIC | |
| 2126 | + case 20: sox_globals.use_magic = sox_true; break; | |
| 2127 | +#else | |
| 2128 | + case 20: lsx_warn("this build of SoX does not include `magic'"); break; | |
| 2129 | +#endif | |
| 2123 | 2130 | } |
| 2124 | 2131 | break; |
| 2125 | 2132 | |
| @@ -181,6 +181,7 @@ typedef struct { /* Global parameters (for effects & formats) */ · 180 unmodified lines | ||
| 181 | 181 | char const * stdout_in_use_by; |
| 182 | 182 | char const * subsystem; |
| 183 | 183 | char * tmp_path; |
| 184 | + sox_bool use_magic; | |
| 184 | 185 | } sox_globals_t; |
| 185 | 186 | extern sox_globals_t sox_globals; |
| 186 | 187 | |