@@ -0,0 +1,52 @@
+From 0904a4c1387919d318adece40838564b0a96c5b6 Mon Sep 17 00:00:00 2001
+From: Reuben Thomas <rrt@sc3d.org>
+Date: Wed, 25 May 2011 22:38:50 +0100
+Subject: [PATCH] Stop using some deprecated symbol names.
+
+---
+ src/ffmpeg.c | 8 ++++----
+ 1 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/src/ffmpeg.c b/src/ffmpeg.c
+index e6292f3..b9727ba 100644
+--- a/src/ffmpeg.c
++++ b/src/ffmpeg.c
+@@ -91,7 +91,7 @@ static int stream_component_open(priv_t * ffmpeg, int stream_index)
+
+ if (!codec || avcodec_open(enc, codec) < 0)
+ return -1;
+- if (enc->codec_type != CODEC_TYPE_AUDIO) {
++ if (enc->codec_type != AVMEDIA_TYPE_AUDIO) {
+ lsx_fail("ffmpeg CODEC %x is not an audio CODEC", enc->codec_type);
+ return -1;
+ }
+@@ -182,7 +182,7 @@ static int startread(sox_format_t * ft)
+ /* Find audio stream (FIXME: allow different stream to be selected) */
+ for (i = 0; (unsigned)i < ffmpeg->ctxt->nb_streams; i++) {
+ AVCodecContext *enc = ffmpeg->ctxt->streams[i]->codec;
+- if (enc->codec_type == CODEC_TYPE_AUDIO && ffmpeg->audio_index < 0) {
++ if (enc->codec_type == AVMEDIA_TYPE_AUDIO && ffmpeg->audio_index < 0) {
+ ffmpeg->audio_index = i;
+ break;
+ }
+@@ -273,7 +273,7 @@ static AVStream *add_audio_stream(sox_format_t * ft, AVFormatContext *oc, enum C
+
+ c = st->codec;
+ c->codec_id = codec_id;
+- c->codec_type = CODEC_TYPE_AUDIO;
++ c->codec_type = AVMEDIA_TYPE_AUDIO;
+
+ /* put sample parameters */
+ c->bit_rate = 256000; /* FIXME: allow specification */
+@@ -423,7 +423,7 @@ static size_t write_samples(sox_format_t * ft, const sox_sample_t *buf, size_t l
+ av_init_packet(&pkt);
+ pkt.size = avcodec_encode_audio(c, ffmpeg->audio_buf_aligned, AVCODEC_MAX_AUDIO_FRAME_SIZE, ffmpeg->samples);
+ pkt.pts = av_rescale_q(c->coded_frame->pts, c->time_base, ffmpeg->audio_st->time_base);
+- pkt.flags |= PKT_FLAG_KEY;
++ pkt.flags |= AV_PKT_FLAG_KEY;
+ pkt.stream_index = ffmpeg->audio_st->index;
+ pkt.data = ffmpeg->audio_buf_aligned;
+
+--
+1.7.0.1
+
|
@@ -0,0 +1,154 @@
+--- src/8svx.c.orig
++++ src/8svx.c
+@@ -161,7 +161,7 @@ static int startread(sox_format_t * ft)
+ chan1_pos = lsx_tell(ft);
+
+ for (i = 1; i < channels; i++) {
+- if ((p->ch[i] = fopen(ft->filename, "rb")) == NULL)
++ if ((p->ch[i] = fopen(ft->filename, "rbe")) == NULL)
+ {
+ lsx_fail_errno(ft,errno,"Can't open channel file '%s'",
+ ft->filename);
+--- src/effects_i.c.orig
++++ src/effects_i.c
+@@ -350,7 +350,7 @@ FILE * lsx_open_input_file(sox_effect_t
+ effp->global_info->global_info->stdin_in_use_by = effp->handler.name;
+ file = stdin;
+ }
+- else if (!(file = fopen(filename, "r"))) {
++ else if (!(file = fopen(filename, "re"))) {
+ lsx_fail("couldn't open file %s: %s", filename, strerror(errno));
+ return NULL;
+ }
+--- src/noiseprof.c.orig
++++ src/noiseprof.c
+@@ -75,7 +75,7 @@ static int sox_noiseprof_start(sox_effec
+ effp->global_info->global_info->stdout_in_use_by = effp->handler.name;
+ data->output_file = stdout;
+ }
+- else if ((data->output_file = fopen(data->output_filename, "w")) == NULL) {
++ else if ((data->output_file = fopen(data->output_filename, "we")) == NULL) {
+ lsx_fail("Couldn't open profile file %s: %s", data->output_filename, strerror(errno));
+ return SOX_EOF;
+ }
+--- src/sox.c.orig
++++ src/sox.c
+@@ -852,7 +852,7 @@ static char * * strtoargv(char * s, int
+
+ static void read_user_effects(char *filename)
+ {
+- FILE *file = fopen(filename, "rt");
++ FILE *file = fopen(filename, "rte");
+ char s[FILENAME_MAX];
+ int argc;
+ char * * argv;
+@@ -1189,7 +1189,7 @@ static int kbhit(void)
+ static void adjust_volume(int delta)
+ {
+ char * from_env = getenv("MIXERDEV");
+- int vol1 = 0, vol2 = 0, fd = open(from_env? from_env : "/dev/mixer", O_RDWR);
++ int vol1 = 0, vol2 = 0, fd = open(from_env? from_env : "/dev/mixer", O_RDWR|O_CLOEXEC);
+ if (fd >= 0) {
+ if (ioctl(fd, MIXER_READ(SOUND_MIXER_PCM), &vol1) != -1) {
+ int side1 = vol1 & 0xff, side2 = (vol1 >> 8) & 0xff;
+@@ -1983,7 +1983,7 @@ static void read_comment_file(sox_commen
+ int c;
+ size_t text_length = 100;
+ char * text = lsx_malloc(text_length + 1);
+- FILE * file = fopen(filename, "rt");
++ FILE * file = fopen(filename, "rte");
+
+ if (file == NULL) {
+ lsx_fail("Cannot open comment file `%s'", filename);
+--- src/spectrogram.c.orig
++++ src/spectrogram.c
+@@ -491,7 +491,7 @@ static int axis(double to, int max_steps
+ static int stop(sox_effect_t * effp)
+ {
+ priv_t * p = (priv_t *) effp->priv;
+- FILE * file = fopen(p->out_name, "wb");
++ FILE * file = fopen(p->out_name, "wbe");
+ uLong font_len = 96 * font_y;
+ int chans = effp->in_signal.channels;
+ int c_rows = p->rows * chans + chans - 1;
+--- src/formats.c.orig
++++ src/formats.c
+@@ -366,7 +366,7 @@ static FILE * xfopen(char const * identi
+ if (*identifier == '|') {
+ FILE * f = NULL;
+ #ifdef HAVE_POPEN
+- f = popen(identifier + 1, "r");
++ f = popen(identifier + 1, "re");
+ *io_type = lsx_io_pipe;
+ #else
+ lsx_fail("this build of SoX cannot open pipes");
+@@ -375,11 +375,12 @@ static FILE * xfopen(char const * identi
+ }
+ else if (is_url(identifier)) {
+ FILE * f = NULL;
++/* XXX: really folks ? forking a wget process to get an URL.. (!!!!!) */
+ #ifdef HAVE_POPEN
+ char const * const command_format = "wget --no-check-certificate -q -O- \"%s\"";
+ char * command = lsx_malloc(strlen(command_format) + strlen(identifier));
+ sprintf(command, command_format, identifier);
+- f = popen(command, "r");
++ f = popen(command, "re");
+ free(command);
+ *io_type = lsx_io_url;
+ #else
+@@ -451,7 +452,7 @@ static sox_format_t * open_read(
+ #ifdef HAVE_FMEMOPEN
+ buffer? fmemopen(buffer, buffer_size, "rb") :
+ #endif
+- xfopen(path, "rb", &ft->io_type);
++ xfopen(path, "rbe", &ft->io_type);
+ type = io_types[ft->io_type];
+ if (ft->fp == NULL) {
+ lsx_fail("can't open input %s `%s': %s", type, path, strerror(errno));
+@@ -849,7 +850,7 @@ static sox_format_t * open_write(
+ buffer? fmemopen(buffer, buffer_size, "w+b") :
+ buffer_ptr? open_memstream(buffer_ptr, buffer_size_ptr) :
+ #endif
+- fopen(path, "w+b");
++ fopen(path, "w+be");
+ if (ft->fp == NULL) {
+ lsx_fail("can't open output file `%s': %s", path, strerror(errno));
+ goto error;
+@@ -1059,7 +1060,7 @@ int sox_parse_playlist(sox_playlist_call
+ char * dirname = lsx_strdup(listname);
+ char * slash_pos = LAST_SLASH(dirname);
+ lsx_io_type io_type;
+- FILE * file = xfopen(listname, "r", &io_type);
++ FILE * file = xfopen(listname, "re", &io_type);
+ char * filename;
+ int c, result = SOX_SUCCESS;
+
+--- src/libsox_i.c.orig
++++ src/libsox_i.c
+@@ -34,7 +34,7 @@
+ #else
+ #define MKTEMP_X 0
+ #endif
+-
++#include <fcntl.h>
+ #ifndef HAVE_MKSTEMP
+ #include <fcntl.h>
+ #include <sys/types.h>
+@@ -54,7 +54,7 @@ FILE * lsx_tmpfile(void)
+ int fildes;
+ strcpy(name, sox_globals.tmp_path);
+ strcat(name, end);
+- fildes = mkstemp(name);
++ fildes = mkostemp(name, O_CLOEXEC);
+ #ifdef HAVE_UNISTD_H
+ lsx_debug(FAKE_MKSTEMP "mkstemp, name=%s (unlinked)", name);
+ unlink(name);
+@@ -62,7 +62,7 @@ FILE * lsx_tmpfile(void)
+ lsx_debug(FAKE_MKSTEMP "mkstemp, name=%s (O_TEMPORARY)", name);
+ #endif
+ free(name);
+- return fildes == -1? NULL : fdopen(fildes, "w+");
++ return fildes == -1? NULL : fdopen(fildes, "w+e");
+ }
+
+ /* Use standard tmpfile (delete on close); tmp dir is undefined: */
|