- Timestamp:
- Dec 20, 2018, 6:21:40 PM (6 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/timestretch, fix/ffmpeg5, master
- Children:
- 2589ea9
- Parents:
- ec3f25f9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/io/source_avcodec.c
rec3f25f9 r9b5aa50 61 61 #include "fvec.h" 62 62 #include "fmat.h" 63 #include "ioutils.h" 63 64 #include "source_avcodec.h" 64 65 … … 489 490 uint_t end = 0; 490 491 uint_t total_wrote = 0; 491 while (total_wrote < s->hop_size) { 492 end = MIN(s->read_samples - s->read_index, s->hop_size - total_wrote); 492 uint_t length = aubio_source_validate_input_length("source_avcodec", s->path, 493 s->hop_size, read_data->length); 494 while (total_wrote < length) { 495 end = MIN(s->read_samples - s->read_index, length - total_wrote); 493 496 for (i = 0; i < end; i++) { 494 497 read_data->data[i + total_wrote] = 0.; … … 500 503 } 501 504 total_wrote += end; 502 if (total_wrote < s->hop_size) {505 if (total_wrote < length) { 503 506 uint_t avcodec_read = 0; 504 507 aubio_source_avcodec_readframe(s, &avcodec_read); … … 512 515 } 513 516 } 514 if (total_wrote < s->hop_size) {515 for (i = total_wrote; i < s->hop_size; i++) {517 if (total_wrote < length) { 518 for (i = total_wrote; i < length; i++) { 516 519 read_data->data[i] = 0.; 517 520 } … … 525 528 uint_t end = 0; 526 529 uint_t total_wrote = 0; 527 while (total_wrote < s->hop_size) { 528 end = MIN(s->read_samples - s->read_index, s->hop_size - total_wrote); 529 for (j = 0; j < read_data->height; j++) { 530 uint_t length = aubio_source_validate_input_length("source_wavread", s->path, 531 s->hop_size, read_data->length); 532 uint_t channels = aubio_source_validate_input_channels("source_wavread", 533 s->path, s->input_channels, read_data->height); 534 while (total_wrote < length) { 535 end = MIN(s->read_samples - s->read_index, length - total_wrote); 536 for (j = 0; j < channels; j++) { 530 537 for (i = 0; i < end; i++) { 531 538 read_data->data[j][i + total_wrote] = … … 534 541 } 535 542 total_wrote += end; 536 if (total_wrote < s->hop_size) {543 if (total_wrote < length) { 537 544 uint_t avcodec_read = 0; 538 545 aubio_source_avcodec_readframe(s, &avcodec_read); … … 546 553 } 547 554 } 548 if (total_wrote < s->hop_size) {549 for (j = 0; j < read_data->height; j++) {550 for (i = total_wrote; i < s->hop_size; i++) {555 if (total_wrote < length) { 556 for (j = 0; j < channels; j++) { 557 for (i = total_wrote; i < length; i++) { 551 558 read_data->data[j][i] = 0.; 552 559 }
Note: See TracChangeset
for help on using the changeset viewer.