ref: 857f8871b11f72155f93a8da944b553fd2cf4d98
parent: 691791ef37e9fef0b09c72c5c21bf7e1742c864d
author: Paul Brossier <piem@piem.org>
date: Mon Apr 25 13:49:10 EDT 2016
src/io/source.*: add _get_duration
--- a/src/io/source.c
+++ b/src/io/source.c
@@ -40,6 +40,7 @@
typedef void (*aubio_source_do_multi_t)(aubio_source_t * s, fmat_t * data, uint_t * read);
typedef uint_t (*aubio_source_get_samplerate_t)(aubio_source_t * s);
typedef uint_t (*aubio_source_get_channels_t)(aubio_source_t * s);
+typedef uint_t (*aubio_source_get_duration_t)(aubio_source_t * s);
typedef uint_t (*aubio_source_seek_t)(aubio_source_t * s, uint_t seek);
typedef uint_t (*aubio_source_close_t)(aubio_source_t * s);
typedef void (*del_aubio_source_t)(aubio_source_t * s);
@@ -50,6 +51,7 @@
aubio_source_do_multi_t s_do_multi;
aubio_source_get_samplerate_t s_get_samplerate;
aubio_source_get_channels_t s_get_channels;
+ aubio_source_get_duration_t s_get_duration;
aubio_source_seek_t s_seek;
aubio_source_close_t s_close;
del_aubio_source_t s_del;
@@ -64,6 +66,7 @@
s->s_do_multi = (aubio_source_do_multi_t)(aubio_source_avcodec_do_multi);
s->s_get_channels = (aubio_source_get_channels_t)(aubio_source_avcodec_get_channels);
s->s_get_samplerate = (aubio_source_get_samplerate_t)(aubio_source_avcodec_get_samplerate);
+ s->s_get_duration = (aubio_source_get_duration_t)(aubio_source_avcodec_get_duration);
s->s_seek = (aubio_source_seek_t)(aubio_source_avcodec_seek);
s->s_close = (aubio_source_close_t)(aubio_source_avcodec_close);
s->s_del = (del_aubio_source_t)(del_aubio_source_avcodec);
@@ -77,6 +80,7 @@
s->s_do_multi = (aubio_source_do_multi_t)(aubio_source_apple_audio_do_multi);
s->s_get_channels = (aubio_source_get_channels_t)(aubio_source_apple_audio_get_channels);
s->s_get_samplerate = (aubio_source_get_samplerate_t)(aubio_source_apple_audio_get_samplerate);
+ s->s_get_duration = (aubio_source_get_duration_t)(aubio_source_apple_audio_get_duration);
s->s_seek = (aubio_source_seek_t)(aubio_source_apple_audio_seek);
s->s_close = (aubio_source_close_t)(aubio_source_apple_audio_close);
s->s_del = (del_aubio_source_t)(del_aubio_source_apple_audio);
@@ -90,6 +94,7 @@
s->s_do_multi = (aubio_source_do_multi_t)(aubio_source_sndfile_do_multi);
s->s_get_channels = (aubio_source_get_channels_t)(aubio_source_sndfile_get_channels);
s->s_get_samplerate = (aubio_source_get_samplerate_t)(aubio_source_sndfile_get_samplerate);
+ s->s_get_duration = (aubio_source_get_duration_t)(aubio_source_sndfile_get_duration);
s->s_seek = (aubio_source_seek_t)(aubio_source_sndfile_seek);
s->s_close = (aubio_source_close_t)(aubio_source_sndfile_close);
s->s_del = (del_aubio_source_t)(del_aubio_source_sndfile);
@@ -103,6 +108,7 @@
s->s_do_multi = (aubio_source_do_multi_t)(aubio_source_wavread_do_multi);
s->s_get_channels = (aubio_source_get_channels_t)(aubio_source_wavread_get_channels);
s->s_get_samplerate = (aubio_source_get_samplerate_t)(aubio_source_wavread_get_samplerate);
+ s->s_get_duration = (aubio_source_get_duration_t)(aubio_source_wavread_get_duration);
s->s_seek = (aubio_source_seek_t)(aubio_source_wavread_seek);
s->s_close = (aubio_source_close_t)(aubio_source_wavread_close);
s->s_del = (del_aubio_source_t)(del_aubio_source_wavread);
@@ -139,6 +145,10 @@
uint_t aubio_source_get_channels(aubio_source_t * s) {
return s->s_get_channels((void *)s->source);
+}
+
+uint_t aubio_source_get_duration(aubio_source_t *s) {
+ return s->s_get_duration((void *)s->source);
}
uint_t aubio_source_seek (aubio_source_t * s, uint_t seek ) {
--- a/src/io/source.h
+++ b/src/io/source.h
@@ -149,6 +149,16 @@
/**
+ get the duration of source object, in frames
+
+ \param s source object, created with ::new_aubio_source
+ \return number of frames in file
+
+*/
+uint_t aubio_source_get_duration (aubio_source_t * s);
+
+/**
+
close source object
\param s source object, created with ::new_aubio_source