Changeset ac97e80d
- Timestamp:
- Nov 16, 2018, 9:14:42 PM (6 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
- Children:
- 6551a683
- Parents:
- 8a4ccf7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/io/source_avcodec.c
r8a4ccf7 rac97e80d 90 90 sint_t selected_stream; 91 91 uint_t eof; 92 uint_t multi;93 92 }; 94 93 95 94 // create or re-create the context when _do or _do_multi is called 96 void aubio_source_avcodec_reset_resampler(aubio_source_avcodec_t * s, 97 uint_t multi); 95 void aubio_source_avcodec_reset_resampler(aubio_source_avcodec_t * s); 98 96 // actually read a frame 99 97 void aubio_source_avcodec_readframe(aubio_source_avcodec_t *s, … … 285 283 s->avFrame = avFrame; 286 284 287 // default to mono output 288 aubio_source_avcodec_reset_resampler(s, 0); 285 aubio_source_avcodec_reset_resampler(s); 289 286 290 287 if (s->avr == NULL) goto beach; 291 288 292 289 s->eof = 0; 293 s->multi = 0;294 290 295 291 //av_log_set_level(AV_LOG_QUIET); … … 304 300 } 305 301 306 void aubio_source_avcodec_reset_resampler(aubio_source_avcodec_t * s, 307 uint_t multi) 302 void aubio_source_avcodec_reset_resampler(aubio_source_avcodec_t * s) 308 303 { 309 304 // create or reset resampler to/from mono/multi-channel 310 if ( (multi != s->multi) || (s->avr == NULL)) {305 if ( s->avr == NULL ) { 311 306 int err; 312 307 int64_t input_layout = av_get_default_channel_layout(s->input_channels); … … 354 349 oldavr = NULL; 355 350 } 356 s->multi = multi;357 351 } 358 352 } … … 495 489 void aubio_source_avcodec_do(aubio_source_avcodec_t * s, fvec_t * read_data, 496 490 uint_t * read) { 497 uint_t i ;491 uint_t i, j; 498 492 uint_t end = 0; 499 493 uint_t total_wrote = 0; 500 // switch from multi501 if (s->multi == 1) aubio_source_avcodec_reset_resampler(s, 0);502 494 while (total_wrote < s->hop_size) { 503 495 end = MIN(s->read_samples - s->read_index, s->hop_size - total_wrote); … … 536 528 uint_t end = 0; 537 529 uint_t total_wrote = 0; 538 // switch from mono539 if (s->multi == 0) aubio_source_avcodec_reset_resampler(s, 1);540 530 while (total_wrote < s->hop_size) { 541 531 end = MIN(s->read_samples - s->read_index, s->hop_size - total_wrote);
Note: See TracChangeset
for help on using the changeset viewer.