Ignore:
Timestamp:
Dec 20, 2018, 8:30:18 PM (5 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/crepe, fix/ffmpeg5, master
Children:
b8fa393, e2f1e6d
Parents:
5e9bdca (diff), 49ac58e0 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into feature/sink_vorbis

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/io/source_avcodec.c

    r5e9bdca ra2019c4  
    6161#include "fvec.h"
    6262#include "fmat.h"
     63#include "ioutils.h"
    6364#include "source_avcodec.h"
    6465
     
    489490  uint_t end = 0;
    490491  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);
    493496    for (i = 0; i < end; i++) {
    494497      read_data->data[i + total_wrote] = 0.;
     
    500503    }
    501504    total_wrote += end;
    502     if (total_wrote < s->hop_size) {
     505    if (total_wrote < length) {
    503506      uint_t avcodec_read = 0;
    504507      aubio_source_avcodec_readframe(s, &avcodec_read);
     
    512515    }
    513516  }
    514   if (total_wrote < s->hop_size) {
    515     for (i = total_wrote; i < s->hop_size; i++) {
    516       read_data->data[i] = 0.;
    517     }
    518   }
     517
     518  aubio_source_pad_output(read_data, total_wrote);
     519
    519520  *read = total_wrote;
    520521}
     
    525526  uint_t end = 0;
    526527  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++) {
     528  uint_t length = aubio_source_validate_input_length("source_wavread", s->path,
     529      s->hop_size, read_data->length);
     530  uint_t channels = aubio_source_validate_input_channels("source_wavread",
     531      s->path, s->input_channels, read_data->height);
     532  while (total_wrote < length) {
     533    end = MIN(s->read_samples - s->read_index, length - total_wrote);
     534    for (j = 0; j < channels; j++) {
    530535      for (i = 0; i < end; i++) {
    531536        read_data->data[j][i + total_wrote] =
     
    534539    }
    535540    total_wrote += end;
    536     if (total_wrote < s->hop_size) {
     541    if (total_wrote < length) {
    537542      uint_t avcodec_read = 0;
    538543      aubio_source_avcodec_readframe(s, &avcodec_read);
     
    546551    }
    547552  }
    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++) {
    551         read_data->data[j][i] = 0.;
    552       }
    553     }
    554   }
     553
     554  aubio_source_pad_multi_output(read_data, s->input_channels, total_wrote);
     555
    555556  *read = total_wrote;
    556557}
Note: See TracChangeset for help on using the changeset viewer.