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;
s->async = false;
AUBIO_ERROR("sink_apple_audio: Aborted opening null path\n");
goto beach;
}
+ if (s->path != NULL) AUBIO_FREE(s->path);
+ s->path = AUBIO_ARRAY(char_t, strnlen(uri, PATH_MAX));
+ strncpy(s->path, uri, strnlen(uri, PATH_MAX));
s->samplerate = 0;
s->channels = 0;
void del_aubio_sink_apple_audio(aubio_sink_apple_audio_t * s) {
if (s->audioFile) aubio_sink_apple_audio_close (s);
+ if (s->path) AUBIO_FREE(s->path);
freeAudioBufferList(&s->bufferList);
AUBIO_FREE(s);
return;
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;
if (path == NULL) {
AUBIO_ERR("sink_sndfile: Aborted opening null path\n");
return NULL;
}
+ if (s->path) AUBIO_FREE(s->path);
+ s->path = AUBIO_ARRAY(char_t, strnlen(path, PATH_MAX));
+ strncpy(s->path, path, strnlen(path, PATH_MAX));
+
s->samplerate = 0;
s->channels = 0;
void del_aubio_sink_sndfile(aubio_sink_sndfile_t * s){
if (!s) return;
+ if (s->path) AUBIO_FREE(s->path);
aubio_sink_sndfile_close(s);
AUBIO_FREE(s->scratch_data);
AUBIO_FREE(s);
goto beach;
}
- s->path = path;
+ if (s->path) AUBIO_FREE(s->path);
+ s->path = AUBIO_ARRAY(char_t, strnlen(path, PATH_MAX));
+ strncpy(s->path, path, strnlen(path, PATH_MAX));
+
s->max_size = MAX_SIZE;
s->bitspersample = 16;
s->total_frames_written = 0;
void del_aubio_sink_wavwrite(aubio_sink_wavwrite_t * s){
if (!s) return;
aubio_sink_wavwrite_close(s);
+ if (s->path) AUBIO_FREE(s->path);
AUBIO_FREE(s->scratch_data);
AUBIO_FREE(s);
}
s->block_size = block_size;
s->samplerate = samplerate;
- s->path = path;
if ( aubio_source_apple_audio_open ( s, path ) ) {
goto beach;
{
OSStatus err = noErr;
UInt32 propSize;
- s->path = path;
+
+ if (s->path) AUBIO_FREE(s->path);
+ s->path = AUBIO_ARRAY(char_t, strnlen(path, PATH_MAX));
+ strncpy(s->path, path, strnlen(path, PATH_MAX));
// open the resource url
- CFURLRef fileURL = createURLFromPath(path);
+ CFURLRef fileURL = createURLFromPath(s->path);
err = ExtAudioFileOpenURL(fileURL, &s->audioFile);
CFRelease(fileURL);
if (err == -43) {
void del_aubio_source_apple_audio(aubio_source_apple_audio_t * s){
aubio_source_apple_audio_close (s);
+ if (s->path) AUBIO_FREE(s->path);
freeAudioBufferList(&s->bufferList);
AUBIO_FREE(s);
return;
s->hop_size = hop_size;
s->channels = 1;
- s->path = path;
+
+ if (s->path) AUBIO_FREE(s->path);
+ s->path = AUBIO_ARRAY(char_t, strnlen(path, PATH_MAX));
+ strncpy(s->path, path, strnlen(path, PATH_MAX));
// register all formats and codecs
av_register_all();
if (s->avFrame != NULL) {
av_frame_free( &(s->avFrame) );
}
+ if (s->path) AUBIO_FREE(s->path);
s->avFrame = NULL;
AUBIO_FREE(s);
}
s->hop_size = hop_size;
s->channels = 1;
- s->path = path;
+
+ if (s->path) AUBIO_FREE(s->path);
+ s->path = AUBIO_ARRAY(char_t, strnlen(path, PATH_MAX));
+ strncpy(s->path, path, strnlen(path, PATH_MAX));
// try opening the file, getting the info in sfinfo
AUBIO_MEMSET(&sfinfo, 0, sizeof (sfinfo));
del_fvec(s->input_data);
}
#endif /* HAVE_SAMPLERATE */
+ if (s->path) AUBIO_FREE(s->path);
AUBIO_FREE(s->scratch_data);
AUBIO_FREE(s);
}
goto beach;
}
- s->path = path;
+ if (s->path) AUBIO_FREE(s->path);
+ s->path = AUBIO_ARRAY(char_t, strnlen(path, PATH_MAX));
+ strncpy(s->path, path, strnlen(path, PATH_MAX));
+
s->samplerate = samplerate;
s->hop_size = hop_size;
aubio_source_wavread_close(s);
if (s->short_output) AUBIO_FREE(s->short_output);
if (s->output) del_fmat(s->output);
+ if (s->path) AUBIO_FREE(s->path);
AUBIO_FREE(s);
}