ref: ae5d58a7ec6083e54c14da6dd2ac8d755a0e9224
parent: 1120f86f4c27475f0ae23afaa06d2a2e5996ecd8
author: Paul Brossier <piem@piem.org>
date: Thu Apr 21 14:47:50 EDT 2016
src/io/*.{c,h}: added const qualifiers to unmodified pointers
--- a/src/io/sink.c
+++ b/src/io/sink.c
@@ -54,7 +54,7 @@
del_aubio_sink_t s_del;
};
-aubio_sink_t * new_aubio_sink(char_t * uri, uint_t samplerate) {
+aubio_sink_t * new_aubio_sink(const char_t * uri, uint_t samplerate) {
aubio_sink_t * s = AUBIO_NEW(aubio_sink_t);
#ifdef HAVE_SINK_APPLE_AUDIO
s->sink = (void *)new_aubio_sink_apple_audio(uri, samplerate);
@@ -120,11 +120,11 @@
return s->s_preset_channels((void *)s->sink, channels);
}
-uint_t aubio_sink_get_samplerate(aubio_sink_t * s) {
+uint_t aubio_sink_get_samplerate(const aubio_sink_t * s) {
return s->s_get_samplerate((void *)s->sink);
}
-uint_t aubio_sink_get_channels(aubio_sink_t * s) {
+uint_t aubio_sink_get_channels(const aubio_sink_t * s) {
return s->s_get_channels((void *)s->sink);
}
--- a/src/io/sink.h
+++ b/src/io/sink.h
@@ -76,7 +76,7 @@
been called.
*/
-aubio_sink_t * new_aubio_sink(char_t * uri, uint_t samplerate);
+aubio_sink_t * new_aubio_sink(const char_t * uri, uint_t samplerate);
/**
@@ -120,7 +120,7 @@
\return samplerate, in Hz
*/
-uint_t aubio_sink_get_samplerate(aubio_sink_t *s);
+uint_t aubio_sink_get_samplerate(const aubio_sink_t *s);
/**
@@ -130,7 +130,7 @@
\return number of channels
*/
-uint_t aubio_sink_get_channels(aubio_sink_t *s);
+uint_t aubio_sink_get_channels(const aubio_sink_t *s);
/**
--- a/src/io/sink_apple_audio.c
+++ b/src/io/sink_apple_audio.c
@@ -57,7 +57,7 @@
bool async;
};
-aubio_sink_apple_audio_t * new_aubio_sink_apple_audio(char_t * uri, uint_t samplerate) {
+aubio_sink_apple_audio_t * new_aubio_sink_apple_audio(const char_t * uri, uint_t samplerate) {
aubio_sink_apple_audio_t * s = AUBIO_NEW(aubio_sink_apple_audio_t);
s->path = uri;
s->max_frames = MAX_SIZE;
@@ -112,12 +112,12 @@
return AUBIO_OK;
}
-uint_t aubio_sink_apple_audio_get_samplerate(aubio_sink_apple_audio_t *s)
+uint_t aubio_sink_apple_audio_get_samplerate(const aubio_sink_apple_audio_t *s)
{
return s->samplerate;
}
-uint_t aubio_sink_apple_audio_get_channels(aubio_sink_apple_audio_t *s)
+uint_t aubio_sink_apple_audio_get_channels(const aubio_sink_apple_audio_t *s)
{
return s->channels;
}
--- a/src/io/sink_apple_audio.h
+++ b/src/io/sink_apple_audio.h
@@ -58,7 +58,7 @@
been called.
*/
-aubio_sink_apple_audio_t * new_aubio_sink_apple_audio(char_t * uri, uint_t samplerate);
+aubio_sink_apple_audio_t * new_aubio_sink_apple_audio(const char_t * uri, uint_t samplerate);
/**
@@ -102,7 +102,7 @@
\return samplerate, in Hz
*/
-uint_t aubio_sink_apple_audio_get_samplerate(aubio_sink_apple_audio_t *s);
+uint_t aubio_sink_apple_audio_get_samplerate(const aubio_sink_apple_audio_t *s);
/**
@@ -112,7 +112,7 @@
\return number of channels
*/
-uint_t aubio_sink_apple_audio_get_channels(aubio_sink_apple_audio_t *s);
+uint_t aubio_sink_apple_audio_get_channels(const aubio_sink_apple_audio_t *s);
/**
--- a/src/io/sink_sndfile.c
+++ b/src/io/sink_sndfile.c
@@ -53,7 +53,7 @@
uint_t aubio_sink_sndfile_open(aubio_sink_sndfile_t *s);
-aubio_sink_sndfile_t * new_aubio_sink_sndfile(char_t * path, uint_t samplerate) {
+aubio_sink_sndfile_t * new_aubio_sink_sndfile(const char_t * path, uint_t samplerate) {
aubio_sink_sndfile_t * s = AUBIO_NEW(aubio_sink_sndfile_t);
s->max_size = MAX_SIZE;
s->path = path;
@@ -106,12 +106,12 @@
return AUBIO_OK;
}
-uint_t aubio_sink_sndfile_get_samplerate(aubio_sink_sndfile_t *s)
+uint_t aubio_sink_sndfile_get_samplerate(const aubio_sink_sndfile_t *s)
{
return s->samplerate;
}
-uint_t aubio_sink_sndfile_get_channels(aubio_sink_sndfile_t *s)
+uint_t aubio_sink_sndfile_get_channels(const aubio_sink_sndfile_t *s)
{
return s->channels;
}
--- a/src/io/sink_sndfile.h
+++ b/src/io/sink_sndfile.h
@@ -57,7 +57,7 @@
been called.
*/
-aubio_sink_sndfile_t * new_aubio_sink_sndfile(char_t * uri, uint_t samplerate);
+aubio_sink_sndfile_t * new_aubio_sink_sndfile(const char_t * uri, uint_t samplerate);
/**
@@ -101,7 +101,7 @@
\return samplerate, in Hz
*/
-uint_t aubio_sink_sndfile_get_samplerate(aubio_sink_sndfile_t *s);
+uint_t aubio_sink_sndfile_get_samplerate(const aubio_sink_sndfile_t *s);
/**
@@ -111,7 +111,7 @@
\return number of channels
*/
-uint_t aubio_sink_sndfile_get_channels(aubio_sink_sndfile_t *s);
+uint_t aubio_sink_sndfile_get_channels(const aubio_sink_sndfile_t *s);
/**
--- a/src/io/sink_wavwrite.c
+++ b/src/io/sink_wavwrite.c
@@ -77,7 +77,7 @@
return str;
}
-aubio_sink_wavwrite_t * new_aubio_sink_wavwrite(char_t * path, uint_t samplerate) {
+aubio_sink_wavwrite_t * new_aubio_sink_wavwrite(const char_t * path, uint_t samplerate) {
aubio_sink_wavwrite_t * s = AUBIO_NEW(aubio_sink_wavwrite_t);
if (path == NULL) {
@@ -142,12 +142,12 @@
return AUBIO_OK;
}
-uint_t aubio_sink_wavwrite_get_samplerate(aubio_sink_wavwrite_t *s)
+uint_t aubio_sink_wavwrite_get_samplerate(const aubio_sink_wavwrite_t *s)
{
return s->samplerate;
}
-uint_t aubio_sink_wavwrite_get_channels(aubio_sink_wavwrite_t *s)
+uint_t aubio_sink_wavwrite_get_channels(const aubio_sink_wavwrite_t *s)
{
return s->channels;
}
--- a/src/io/sink_wavwrite.h
+++ b/src/io/sink_wavwrite.h
@@ -57,7 +57,7 @@
been called.
*/
-aubio_sink_wavwrite_t * new_aubio_sink_wavwrite(char_t * uri, uint_t samplerate);
+aubio_sink_wavwrite_t * new_aubio_sink_wavwrite(const char_t * uri, uint_t samplerate);
/**
@@ -101,7 +101,7 @@
\return samplerate, in Hz
*/
-uint_t aubio_sink_wavwrite_get_samplerate(aubio_sink_wavwrite_t *s);
+uint_t aubio_sink_wavwrite_get_samplerate(const aubio_sink_wavwrite_t *s);
/**
@@ -111,7 +111,7 @@
\return number of channels
*/
-uint_t aubio_sink_wavwrite_get_channels(aubio_sink_wavwrite_t *s);
+uint_t aubio_sink_wavwrite_get_channels(const aubio_sink_wavwrite_t *s);
/**
--- a/src/io/source.c
+++ b/src/io/source.c
@@ -55,7 +55,7 @@
del_aubio_source_t s_del;
};
-aubio_source_t * new_aubio_source(char_t * uri, uint_t samplerate, uint_t hop_size) {
+aubio_source_t * new_aubio_source(const char_t * uri, uint_t samplerate, uint_t hop_size) {
aubio_source_t * s = AUBIO_NEW(aubio_source_t);
#if HAVE_LIBAV
s->source = (void *)new_aubio_source_avcodec(uri, samplerate, hop_size);
--- a/src/io/source.h
+++ b/src/io/source.h
@@ -85,7 +85,7 @@
::aubio_source_get_samplerate.
*/
-aubio_source_t * new_aubio_source(char_t * uri, uint_t samplerate, uint_t hop_size);
+aubio_source_t * new_aubio_source(const char_t * uri, uint_t samplerate, uint_t hop_size);
/**
--- a/src/io/source_apple_audio.c
+++ b/src/io/source_apple_audio.c
@@ -54,9 +54,9 @@
extern CFURLRef createURLFromPath(const char * path);
char_t *getPrintableOSStatusError(char_t *str, OSStatus error);
-uint_t aubio_source_apple_audio_open (aubio_source_apple_audio_t *s, char_t * path);
+uint_t aubio_source_apple_audio_open (aubio_source_apple_audio_t *s, const char_t * path);
-aubio_source_apple_audio_t * new_aubio_source_apple_audio(char_t * path, uint_t samplerate, uint_t block_size)
+aubio_source_apple_audio_t * new_aubio_source_apple_audio(const char_t * path, uint_t samplerate, uint_t block_size)
{
aubio_source_apple_audio_t * s = AUBIO_NEW(aubio_source_apple_audio_t);
@@ -91,7 +91,7 @@
return NULL;
}
-uint_t aubio_source_apple_audio_open (aubio_source_apple_audio_t *s, char_t * path)
+uint_t aubio_source_apple_audio_open (aubio_source_apple_audio_t *s, const char_t * path)
{
OSStatus err = noErr;
UInt32 propSize;
@@ -352,11 +352,11 @@
return err;
}
-uint_t aubio_source_apple_audio_get_samplerate(aubio_source_apple_audio_t * s) {
+uint_t aubio_source_apple_audio_get_samplerate(const aubio_source_apple_audio_t * s) {
return s->samplerate;
}
-uint_t aubio_source_apple_audio_get_channels(aubio_source_apple_audio_t * s) {
+uint_t aubio_source_apple_audio_get_channels(const aubio_source_apple_audio_t * s) {
return s->channels;
}
--- a/src/io/source_apple_audio.h
+++ b/src/io/source_apple_audio.h
@@ -57,7 +57,7 @@
::aubio_source_apple_audio_get_samplerate.
*/
-aubio_source_apple_audio_t * new_aubio_source_apple_audio(char_t * uri, uint_t samplerate, uint_t hop_size);
+aubio_source_apple_audio_t * new_aubio_source_apple_audio(const char_t * uri, uint_t samplerate, uint_t hop_size);
/**
@@ -95,7 +95,7 @@
\return samplerate, in Hz
*/
-uint_t aubio_source_apple_audio_get_samplerate(aubio_source_apple_audio_t * s);
+uint_t aubio_source_apple_audio_get_samplerate(const aubio_source_apple_audio_t * s);
/**
@@ -105,7 +105,7 @@
\return number of channels
*/
-uint_t aubio_source_apple_audio_get_channels(aubio_source_apple_audio_t * s);
+uint_t aubio_source_apple_audio_get_channels(const aubio_source_apple_audio_t * s);
/**
--- a/src/io/source_avcodec.c
+++ b/src/io/source_avcodec.c
@@ -66,7 +66,7 @@
void aubio_source_avcodec_reset_resampler(aubio_source_avcodec_t * s, uint_t multi);
void aubio_source_avcodec_readframe(aubio_source_avcodec_t *s, uint_t * read_samples);
-aubio_source_avcodec_t * new_aubio_source_avcodec(char_t * path, uint_t samplerate, uint_t hop_size) {
+aubio_source_avcodec_t * new_aubio_source_avcodec(const char_t * path, uint_t samplerate, uint_t hop_size) {
aubio_source_avcodec_t * s = AUBIO_NEW(aubio_source_avcodec_t);
int err;
if (path == NULL) {
@@ -369,11 +369,11 @@
*read = total_wrote;
}
-uint_t aubio_source_avcodec_get_samplerate(aubio_source_avcodec_t * s) {
+uint_t aubio_source_avcodec_get_samplerate(const aubio_source_avcodec_t * s) {
return s->samplerate;
}
-uint_t aubio_source_avcodec_get_channels(aubio_source_avcodec_t * s) {
+uint_t aubio_source_avcodec_get_channels(const aubio_source_avcodec_t * s) {
return s->input_channels;
}
--- a/src/io/source_avcodec.h
+++ b/src/io/source_avcodec.h
@@ -56,7 +56,7 @@
::aubio_source_avcodec_get_samplerate.
*/
-aubio_source_avcodec_t * new_aubio_source_avcodec(char_t * uri, uint_t samplerate, uint_t hop_size);
+aubio_source_avcodec_t * new_aubio_source_avcodec(const char_t * uri, uint_t samplerate, uint_t hop_size);
/**
@@ -94,7 +94,7 @@
\return samplerate, in Hz
*/
-uint_t aubio_source_avcodec_get_samplerate(aubio_source_avcodec_t * s);
+uint_t aubio_source_avcodec_get_samplerate(const aubio_source_avcodec_t * s);
/**
@@ -104,7 +104,7 @@
\return number of channels
*/
-uint_t aubio_source_avcodec_get_channels (aubio_source_avcodec_t * s);
+uint_t aubio_source_avcodec_get_channels (const aubio_source_avcodec_t * s);
/**
--- a/src/io/source_sndfile.c
+++ b/src/io/source_sndfile.c
@@ -67,7 +67,7 @@
smpl_t *scratch_data;
};
-aubio_source_sndfile_t * new_aubio_source_sndfile(char_t * path, uint_t samplerate, uint_t hop_size) {
+aubio_source_sndfile_t * new_aubio_source_sndfile(const char_t * path, uint_t samplerate, uint_t hop_size) {
aubio_source_sndfile_t * s = AUBIO_NEW(aubio_source_sndfile_t);
SF_INFO sfinfo;
--- a/src/io/source_sndfile.h
+++ b/src/io/source_sndfile.h
@@ -56,7 +56,7 @@
::aubio_source_sndfile_get_samplerate.
*/
-aubio_source_sndfile_t * new_aubio_source_sndfile(char_t * uri, uint_t samplerate, uint_t hop_size);
+aubio_source_sndfile_t * new_aubio_source_sndfile(const char_t * uri, uint_t samplerate, uint_t hop_size);
/**
--- a/src/io/source_wavread.c
+++ b/src/io/source_wavread.c
@@ -67,7 +67,7 @@
return ret;
}
-aubio_source_wavread_t * new_aubio_source_wavread(char_t * path, uint_t samplerate, uint_t hop_size) {
+aubio_source_wavread_t * new_aubio_source_wavread(const char_t * path, uint_t samplerate, uint_t hop_size) {
aubio_source_wavread_t * s = AUBIO_NEW(aubio_source_wavread_t);
size_t bytes_read = 0, bytes_expected = 44;
unsigned char buf[5];
--- a/src/io/source_wavread.h
+++ b/src/io/source_wavread.h
@@ -61,7 +61,7 @@
::aubio_source_wavread_get_samplerate.
*/
-aubio_source_wavread_t * new_aubio_source_wavread(char_t * uri, uint_t samplerate, uint_t hop_size);
+aubio_source_wavread_t * new_aubio_source_wavread(const char_t * uri, uint_t samplerate, uint_t hop_size);
/**