ref: 491e6eacb7da903bc9f93de8260760a1907565ca
parent: c038740f22f0ea8a6dfea5e4e7baafb1ed14329b
author: Paul Brossier <piem@piem.org>
date: Sun Jan 26 11:18:22 EST 2014
src/io/: add missing error strings prefixes
--- a/src/io/sink_sndfile.c
+++ b/src/io/sink_sndfile.c
@@ -49,7 +49,7 @@
SF_INFO sfinfo;
if (path == NULL) {
- AUBIO_ERR("Aborted opening null path\n");
+ AUBIO_ERR("sink_sndfile: Aborted opening null path\n");
return NULL;
}
@@ -69,7 +69,7 @@
if (s->handle == NULL) {
/* show libsndfile err msg */
- AUBIO_ERR("Failed opening %s. %s\n", s->path, sf_strerror (NULL));
+ AUBIO_ERR("sink_sndfile: Failed opening %s. %s\n", s->path, sf_strerror (NULL));
AUBIO_FREE(s);
return NULL;
}
@@ -77,7 +77,7 @@
s->scratch_size = s->max_size*s->channels;
/* allocate data for de/interleaving reallocated when needed. */
if (s->scratch_size >= MAX_SIZE * MAX_CHANNELS) {
- AUBIO_ERR("%d x %d exceeds maximum aubio_sink_sndfile buffer size %d\n",
+ AUBIO_ERR("sink_sndfile: %d x %d exceeds maximum aubio_sink_sndfile buffer size %d\n",
s->max_size, s->channels, MAX_CHANNELS * MAX_CHANNELS);
AUBIO_FREE(s);
return NULL;
@@ -109,7 +109,7 @@
written_frames = sf_write_float (s->handle, s->scratch_data, nsamples);
if (written_frames/channels != write) {
- AUBIO_WRN("trying to write %d frames to %s, but only %d could be written",
+ AUBIO_WRN("sink_sndfile: trying to write %d frames to %s, but only %d could be written",
write, s->path, (uint_t)written_frames);
}
return;
@@ -120,7 +120,7 @@
return AUBIO_FAIL;
}
if (sf_close(s->handle)) {
- AUBIO_ERR("Error closing file %s: %s", s->path, sf_strerror (NULL));
+ AUBIO_ERR("sink_sndfile: Error closing file %s: %s", s->path, sf_strerror (NULL));
return AUBIO_FAIL;
}
s->handle = NULL;
--- a/src/io/source_avcodec.c
+++ b/src/io/source_avcodec.c
@@ -67,15 +67,15 @@
aubio_source_avcodec_t * s = AUBIO_NEW(aubio_source_avcodec_t);
int err;
if (path == NULL) {
- AUBIO_ERR("Aborted opening null path\n");
+ AUBIO_ERR("source_avcodec: Aborted opening null path\n");
goto beach;
}
if ((sint_t)samplerate < 0) {
- AUBIO_ERR("Can not open %s with samplerate %d\n", path, samplerate);
+ AUBIO_ERR("source_avcodec: Can not open %s with samplerate %d\n", path, samplerate);
goto beach;
}
if ((sint_t)hop_size <= 0) {
- AUBIO_ERR("Can not open %s with hop_size %d\n", path, hop_size);
+ AUBIO_ERR("source_avcodec: Can not open %s with hop_size %d\n", path, hop_size);
goto beach;
}
@@ -95,7 +95,7 @@
if ( (err = avformat_open_input(&avFormatCtx, s->path, NULL, NULL) ) < 0 ) {
char errorstr[256];
av_strerror (err, errorstr, sizeof(errorstr));
- AUBIO_ERR("Failed opening %s (%s)\n", s->path, errorstr);
+ AUBIO_ERR("source_avcodec: Failed opening %s (%s)\n", s->path, errorstr);
goto beach;
}
@@ -106,7 +106,7 @@
if ( (err = avformat_find_stream_info(avFormatCtx, NULL)) < 0 ) {
char errorstr[256];
av_strerror (err, errorstr, sizeof(errorstr));
- AUBIO_ERR("Could not find stream information " "for %s (%s)\n", s->path,
+ AUBIO_ERR("source_avcodec: Could not find stream information " "for %s (%s)\n", s->path,
errorstr);
goto beach;
}
@@ -122,13 +122,13 @@
if (selected_stream == -1) {
selected_stream = i;
} else {
- AUBIO_WRN("More than one audio stream in %s, "
+ AUBIO_WRN("source_avcodec: More than one audio stream in %s, "
"taking the first one\n", s->path);
}
}
}
if (selected_stream == -1) {
- AUBIO_ERR("No audio stream in %s\n", s->path);
+ AUBIO_ERR("source_avcodec: No audio stream in %s\n", s->path);
goto beach;
}
//AUBIO_DBG("Taking stream %d in file %s\n", selected_stream, s->path);
@@ -138,7 +138,7 @@
avCodecCtx = avFormatCtx->streams[selected_stream]->codec;
AVCodec *codec = avcodec_find_decoder(avCodecCtx->codec_id);
if (codec == NULL) {
- AUBIO_ERR("Could not find decoder for %s", s->path);
+ AUBIO_ERR("source_avcodec: Could not find decoder for %s", s->path);
goto beach;
}
@@ -145,7 +145,7 @@
if ( ( err = avcodec_open2(avCodecCtx, codec, NULL) ) < 0) {
char errorstr[256];
av_strerror (err, errorstr, sizeof(errorstr));
- AUBIO_ERR("Could not load codec for %s (%s)\n", s->path, errorstr);
+ AUBIO_ERR("source_avcodec: Could not load codec for %s (%s)\n", s->path, errorstr);
goto beach;
}
@@ -162,7 +162,7 @@
s->samplerate = samplerate;
if (s->samplerate > s->input_samplerate) {
- AUBIO_WRN("upsampling %s from %d to %d\n", s->path,
+ AUBIO_WRN("source_avcodec: upsampling %s from %d to %d\n", s->path,
s->input_samplerate, s->samplerate);
}
@@ -169,7 +169,7 @@
AVFrame *avFrame = s->avFrame;
avFrame = avcodec_alloc_frame();
if (!avFrame) {
- AUBIO_ERR("Could not allocate frame for (%s)\n", s->path);
+ AUBIO_ERR("source_avcodec: Could not allocate frame for (%s)\n", s->path);
}
/* allocate output for avr */
@@ -222,7 +222,7 @@
if ( ( err = avresample_open(avr) ) < 0) {
char errorstr[256];
av_strerror (err, errorstr, sizeof(errorstr));
- AUBIO_ERR("Could not open AVAudioResampleContext for %s (%s)\n",
+ AUBIO_ERR("source_avcodec: Could not open AVAudioResampleContext for %s (%s)\n",
s->path, errorstr);
//goto beach;
return;
--- a/src/io/source_sndfile.c
+++ b/src/io/source_sndfile.c
@@ -66,15 +66,15 @@
SF_INFO sfinfo;
if (path == NULL) {
- AUBIO_ERR("Aborted opening null path\n");
+ AUBIO_ERR("source_sndfile: Aborted opening null path\n");
goto beach;
}
if ((sint_t)samplerate < 0) {
- AUBIO_ERR("Can not open %s with samplerate %d\n", path, samplerate);
+ AUBIO_ERR("source_sndfile: Can not open %s with samplerate %d\n", path, samplerate);
goto beach;
}
if ((sint_t)hop_size <= 0) {
- AUBIO_ERR("Can not open %s with hop_size %d\n", path, hop_size);
+ AUBIO_ERR("source_sndfile: Can not open %s with hop_size %d\n", path, hop_size);
goto beach;
}
@@ -88,7 +88,7 @@
if (s->handle == NULL) {
/* show libsndfile err msg */
- AUBIO_ERR("Failed opening %s: %s\n", s->path, sf_strerror (NULL));
+ AUBIO_ERR("source_sndfile: Failed opening %s: %s\n", s->path, sf_strerror (NULL));
goto beach;
}
@@ -107,7 +107,7 @@
s->input_hop_size = (uint_t)FLOOR(s->hop_size / s->ratio + .5);
if (s->input_hop_size * s->input_channels > MAX_SAMPLES) {
- AUBIO_ERR("Not able to process more than %d frames of %d channels\n",
+ AUBIO_ERR("source_sndfile: Not able to process more than %d frames of %d channels\n",
MAX_SAMPLES / s->input_channels, s->input_channels);
goto beach;
}
@@ -121,17 +121,17 @@
if (s->ratio > 1) {
// we would need to add a ring buffer for these
if ( (uint_t)(s->input_hop_size * s->ratio + .5) != s->hop_size ) {
- AUBIO_ERR("can not upsample %s from %d to %d\n", s->path,
+ AUBIO_ERR("source_sndfile: can not upsample %s from %d to %d\n", s->path,
s->input_samplerate, s->samplerate);
goto beach;
}
- AUBIO_WRN("upsampling %s from %d to %d\n", s->path,
+ AUBIO_WRN("source_sndfile: upsampling %s from %d to %d\n", s->path,
s->input_samplerate, s->samplerate);
}
}
#else
if (s->ratio != 1) {
- AUBIO_ERR("aubio was compiled without aubio_resampler\n");
+ AUBIO_ERR("source_sndfile: aubio was compiled without aubio_resampler\n");
goto beach;
}
#endif /* HAVE_SAMPLERATE */
@@ -272,7 +272,7 @@
return AUBIO_FAIL;
}
if(sf_close(s->handle)) {
- AUBIO_ERR("Error closing file %s: %s", s->path, sf_strerror (NULL));
+ AUBIO_ERR("source_sndfile: Error closing file %s: %s", s->path, sf_strerror (NULL));
return AUBIO_FAIL;
}
return AUBIO_OK;
--- a/tests/src/test-cvec.c
+++ b/tests/src/test-cvec.c
@@ -4,9 +4,10 @@
int main (void)
{
uint_t i, window_size = 16; // window size
- utils_init_random();
cvec_t * complex_vector = new_cvec (window_size); // input buffer
uint_t rand_times = 4;
+
+ utils_init_random();
while (rand_times -- ) {
// fill with random phas and norm