- Timestamp:
- Mar 12, 2017, 2:23:33 PM (8 years ago)
- Branches:
- sampler
- Children:
- 618ebd5
- Parents:
- 4ac4ebc
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/io/source_avcodec.c
r4ac4ebc r91ad284 76 76 uint_t eof; 77 77 uint_t multi; 78 uint_t has_network_url; 78 79 }; 79 80 … … 90 91 av_url_split(proto, proto_size, authorization, authorization_size, hostname, 91 92 hostname_size, port_ptr, uripath, path_size, s->path); 93 s->has_network_url = 0; 92 94 if (strlen(proto)) { 93 return1;94 } 95 return 0;95 s->has_network_url = 1; 96 } 97 return s->has_network_url; 96 98 } 97 99 … … 129 131 // try opening the file and get some info about it 130 132 AVFormatContext *avFormatCtx = s->avFormatCtx; 133 AVDictionary *streamopts = 0; 134 if (s->has_network_url) { 135 if (av_dict_set(&streamopts, "timeout", "1000000", 0)) { // in microseconds 136 AUBIO_WRN("source_avcodec: Failed setting timeout to 1000000 for %s\n", s->path); 137 } else { 138 AUBIO_WRN("source_avcodec: Setting timeout to 1000000 for %s\n", s->path); 139 } 140 } 131 141 avFormatCtx = NULL; 132 if ( (err = avformat_open_input(&avFormatCtx, s->path, NULL, NULL) ) < 0 ) {142 if ( (err = avformat_open_input(&avFormatCtx, s->path, NULL, &streamopts) ) < 0 ) { 133 143 char errorstr[256]; 134 144 av_strerror (err, errorstr, sizeof(errorstr)); 135 145 AUBIO_ERR("source_avcodec: Failed opening %s (%s)\n", s->path, errorstr); 136 goto beach ;146 goto beach_streamopts; 137 147 } 138 148 … … 262 272 //av_log_set_level(AV_LOG_QUIET); 263 273 274 av_dict_free(&streamopts); 264 275 return s; 265 276 277 beach_streamopts: 278 av_dict_free(&streamopts); 266 279 beach: 267 280 //AUBIO_ERR("can not read %s at samplerate %dHz with a hop_size of %d\n",
Note: See TracChangeset
for help on using the changeset viewer.