- Timestamp:
- Dec 23, 2013, 2:25:30 AM (11 years ago)
- 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:
- 3a00b1e7
- Parents:
- 7bb5cef
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/io/source_avcodec.c
r7bb5cef r50bb325 371 371 372 372 uint_t aubio_source_avcodec_seek (aubio_source_avcodec_t * s, uint_t pos) { 373 //uint_t resampled_pos = (uint_t)ROUND(pos * s->input_samplerate * 1. / s->samplerate); 374 AUBIO_ERR("Not implemented, _seek(%d) file %s", pos, s->path); 375 return -1; //sf_seek (s->handle, resampled_pos, SEEK_SET); 373 int64_t resampled_pos = (uint_t)ROUND(pos * (s->input_samplerate * 1. / s->samplerate)); 374 int64_t min_ts = MAX(resampled_pos - 2000, 0); 375 int64_t max_ts = MIN(resampled_pos + 2000, INT64_MAX); 376 int seek_flags = AVSEEK_FLAG_FRAME | AVSEEK_FLAG_ANY; 377 int ret = avformat_seek_file(s->avFormatCtx, s->selected_stream, 378 min_ts, resampled_pos, max_ts, seek_flags); 379 if (ret < 0) { 380 AUBIO_ERR("Failed seeking to %d in file %s", pos, s->path); 381 } 382 // reset read status 383 s->eof = 0; 384 s->read_index = 0; 385 s->read_samples = 0; 386 // reset the AVAudioResampleContext 387 avresample_close(s->avr); 388 avresample_open(s->avr); 389 return ret; 376 390 } 377 391
Note: See TracChangeset
for help on using the changeset viewer.