Changeset 6769586 for src


Ignore:
Timestamp:
Jun 9, 2016, 10:11:19 AM (8 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
Children:
f264b17
Parents:
ae15c63
Message:

src/io/source_avcodec.c: check if the uri is a network stream using av_url_split, call avformat_network_init() if needed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/io/source_avcodec.c

    rae15c63 r6769586  
    7373void aubio_source_avcodec_readframe(aubio_source_avcodec_t *s, uint_t * read_samples);
    7474
     75uint_t aubio_source_avcodec_has_network_url(aubio_source_avcodec_t *s);
     76
     77uint_t aubio_source_avcodec_has_network_url(aubio_source_avcodec_t *s) {
     78  char proto[20], authorization[256], hostname[128], uripath[256];
     79  int proto_size = 20, authorization_size = 256, hostname_size = 128,
     80      *port_ptr = 0, path_size = 256;
     81  av_url_split(proto, proto_size, authorization, authorization_size, hostname,
     82      hostname_size, port_ptr, uripath, path_size, s->path);
     83  if (strlen(proto)) {
     84    return 1;
     85  }
     86  return 0;
     87}
     88
     89
    7590aubio_source_avcodec_t * new_aubio_source_avcodec(const char_t * path, uint_t samplerate, uint_t hop_size) {
    7691  aubio_source_avcodec_t * s = AUBIO_NEW(aubio_source_avcodec_t);
     
    99114  av_register_all();
    100115
    101   // if path[0] != '/'
    102   //avformat_network_init();
     116  if (aubio_source_avcodec_has_network_url(s)) {
     117    avformat_network_init();
     118  }
    103119
    104120  // try opening the file and get some info about it
Note: See TracChangeset for help on using the changeset viewer.