Changeset 20ce2ad for src/io/sink.c
- Timestamp:
- Dec 18, 2018, 1:07:13 AM (6 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/crepe, fix/ffmpeg5, master
- Children:
- 0da5208
- Parents:
- d286fe4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/io/sink.c
rd286fe4 r20ce2ad 54 54 }; 55 55 56 extern uint_t aubio_str_path_has_extension(const char_t *filename, 57 const char_t *pattern); 58 56 59 #ifdef HAVE_VORBISENC 57 60 typedef struct _aubio_sink_vorbis_t aubio_sink_vorbis_t; … … 92 95 #endif /* HAVE_FLAC */ 93 96 94 static const char_t *aubio_get_extension(const char_t *filename)95 {96 if (!filename) return NULL;97 // find last occurence of dot character98 const char_t *ext = strrchr(filename, '.');99 if (!ext || ext == filename) return "";100 else return ext + 1;101 }102 103 97 aubio_sink_t * new_aubio_sink(const char_t * uri, uint_t samplerate) { 104 98 aubio_sink_t * s = AUBIO_NEW(aubio_sink_t); 105 #if defined(HAVE_VORBISENC) || defined(HAVE_FLAC)106 const char_t * uri_ext = aubio_get_extension(uri);107 #endif /* defined(HAVE_VORBISENC) || defined(HAVE_FLAC) */108 99 109 100 #ifdef HAVE_VORBISENC 110 101 // check if this uri could be for us 111 uint_t match_oggstream = 0; 112 if (uri_ext && strcmp (uri_ext, "ogg") == 0) match_oggstream = 1; 113 if (match_oggstream) { 102 if (aubio_str_path_has_extension(uri, "ogg")) { 114 103 s->sink = (void *)new_aubio_sink_vorbis(uri, samplerate); 115 104 if (s->sink) { … … 129 118 #ifdef HAVE_FLAC 130 119 // check if this uri could be for us 131 uint_t match_flacstream = 0; 132 if (uri_ext && strcmp (uri_ext, "flac") == 0) match_flacstream = 1; 133 if (match_flacstream) { 120 if (aubio_str_path_has_extension(uri, "flac")) { 134 121 s->sink = (void *)new_aubio_sink_flac(uri, samplerate); 135 122 if (s->sink) {
Note: See TracChangeset
for help on using the changeset viewer.