aubio_source_avcodec_t * new_aubio_source_avcodec(const char_t * path, uint_t samplerate, uint_t hop_size) {
aubio_source_avcodec_t * s = AUBIO_NEW(aubio_source_avcodec_t);
+ AVFormatContext *avFormatCtx = s->avFormatCtx;
+ AVCodecContext *avCodecCtx = s->avCodecCtx;
+ AVFrame *avFrame = s->avFrame;
++ AVDictionary *streamopts = 0;
+ sint_t selected_stream = -1;
+ #if FF_API_LAVF_AVCTX
+ AVCodecParameters *codecpar;
+ #endif
+ AVCodec *codec;
+ uint_t i;
int err;
if (path == NULL) {
AUBIO_ERR("source_avcodec: Aborted opening null path\n");
}
// try opening the file and get some info about it
- AVFormatContext *avFormatCtx = s->avFormatCtx;
- AVDictionary *streamopts = 0;
+ if (s->has_network_url) {
+ if (av_dict_set(&streamopts, "timeout", "1000000", 0)) { // in microseconds
+ AUBIO_WRN("source_avcodec: Failed setting timeout to 1000000 for %s\n", s->path);
+ } else {
+ AUBIO_WRN("source_avcodec: Setting timeout to 1000000 for %s\n", s->path);
+ }
+ }
avFormatCtx = NULL;
- if ( (err = avformat_open_input(&avFormatCtx, s->path, NULL, NULL) ) < 0 ) {
+ if ( (err = avformat_open_input(&avFormatCtx, s->path, NULL, &streamopts) ) < 0 ) {
char errorstr[256];
av_strerror (err, errorstr, sizeof(errorstr));
AUBIO_ERR("source_avcodec: Failed opening %s (%s)\n", s->path, errorstr);