Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/io/ioutils.c

    r33d0242 rb5de3a9  
    5252  return AUBIO_OK;
    5353}
     54
     55uint_t
     56aubio_sink_validate_input_length(const char_t *kind, const char_t *path,
     57    uint_t max_size, uint_t write_data_length, uint_t write)
     58{
     59  uint_t can_write = write;
     60
     61  if (write > max_size) {
     62    AUBIO_WRN("%s: partial write to %s, trying to write %d frames,"
     63        " at most %d can be written at once\n", kind, path, write, max_size);
     64    can_write = max_size;
     65  }
     66
     67  if (can_write > write_data_length) {
     68    AUBIO_WRN("%s: partial write to %s, trying to write %d frames,"
     69        " but found input of length %d\n", kind, path, write,
     70        write_data_length);
     71    can_write = write_data_length;
     72  }
     73
     74  return can_write;
     75}
     76
     77uint_t
     78aubio_sink_validate_input_channels(const char_t *kind, const char_t *path,
     79    uint_t sink_channels, uint_t write_data_height)
     80{
     81  uint_t channels = sink_channels;
     82  if (write_data_height < sink_channels) {
     83    AUBIO_WRN("%s: partial write to %s, trying to write %d channels,"
     84        " but found input of height %d\n", kind, path, sink_channels,
     85        write_data_height);
     86    channels = write_data_height;
     87  }
     88  return channels;
     89}
Note: See TracChangeset for help on using the changeset viewer.