- Timestamp:
- Dec 5, 2013, 3:20:12 PM (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:
- f3b93c6
- Parents:
- 75eb182
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/io/source_avcodec.c
r75eb182 rd75e2d5 74 74 s->path = path; 75 75 76 // try opening the file and get some info about it77 76 // register all formats and codecs 78 77 av_register_all(); 79 78 80 // open file79 // try opening the file and get some info about it 81 80 AVFormatContext *avFormatCtx = s->avFormatCtx; 82 81 avFormatCtx = NULL; … … 110 109 //av_dump_format(avFormatCtx, 0, s->path, 0); 111 110 111 // look for the first audio stream, printing a warning if more than one is found 112 112 uint_t i; 113 113 sint_t selected_stream = -1; … … 125 125 goto beach; 126 126 } 127 128 127 //AUBIO_DBG("Taking stream %d in file %s\n", selected_stream, s->path); 129 128 … … 220 219 int16_t *output = s->output; 221 220 222 uint_t i;223 221 int err = av_read_frame (avFormatCtx, &avPacket); 224 222 if (err != 0) { … … 279 277 uint_t i; 280 278 //AUBIO_DBG("entering 'do' with %d, %d\n", s->read_samples, s->read_index); 281 // begin reading282 if (s->read_samples == 0) {283 uint_t avcodec_read = 0;284 aubio_source_avcodec_readframe(s, &avcodec_read);285 s->read_samples += avcodec_read;286 s->read_index = 0;287 }288 279 if (s->read_samples < s->hop_size) { 289 280 // write the end of the buffer to the beginning of read_data … … 292 283 read_data->data[i] = SHORT_TO_FLOAT(s->output[i + s->read_index]); 293 284 } 294 s->read_samples = 0;295 s->read_index = 0;296 285 // get more data 297 286 uint_t avcodec_read = 0; 298 287 aubio_source_avcodec_readframe(s, &avcodec_read); 299 s->read_samples += avcodec_read;288 s->read_samples = avcodec_read; 300 289 s->read_index = 0; 301 290 // write the beginning of the buffer to the end of read_data … … 312 301 } 313 302 } 314 s->read_index += partial;315 s->read_samples -= partial;303 s->read_index += end - partial; 304 s->read_samples -= end - partial; 316 305 *read = end; 317 306 } else {
Note: See TracChangeset
for help on using the changeset viewer.