Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/io/source_avcodec.c

    r2510248 rc0a1906  
    6161#include "fvec.h"
    6262#include "fmat.h"
    63 #include "ioutils.h"
    6463#include "source_avcodec.h"
    6564
     
    490489  uint_t end = 0;
    491490  uint_t total_wrote = 0;
    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);
     491  while (total_wrote < s->hop_size) {
     492    end = MIN(s->read_samples - s->read_index, s->hop_size - total_wrote);
    496493    for (i = 0; i < end; i++) {
    497494      read_data->data[i + total_wrote] = 0.;
     
    503500    }
    504501    total_wrote += end;
    505     if (total_wrote < length) {
     502    if (total_wrote < s->hop_size) {
    506503      uint_t avcodec_read = 0;
    507504      aubio_source_avcodec_readframe(s, &avcodec_read);
     
    515512    }
    516513  }
    517 
    518   aubio_source_pad_output(read_data, total_wrote);
    519 
     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  }
    520519  *read = total_wrote;
    521520}
     
    526525  uint_t end = 0;
    527526  uint_t total_wrote = 0;
    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++) {
     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++) {
    535530      for (i = 0; i < end; i++) {
    536531        read_data->data[j][i + total_wrote] =
     
    539534    }
    540535    total_wrote += end;
    541     if (total_wrote < length) {
     536    if (total_wrote < s->hop_size) {
    542537      uint_t avcodec_read = 0;
    543538      aubio_source_avcodec_readframe(s, &avcodec_read);
     
    551546    }
    552547  }
    553 
    554   aubio_source_pad_multi_output(read_data, s->input_channels, total_wrote);
    555 
     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  }
    556555  *read = total_wrote;
    557556}
Note: See TracChangeset for help on using the changeset viewer.