Changeset eba24c5


Ignore:
Timestamp:
Dec 19, 2018, 3:47:25 PM (12 months ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink
Children:
5573a6b, d64f56d
Parents:
09b4be9
Message:

[io] sink_flac to dynamically allocate metadata

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/io/sink_flac.c

    r09b4be9 reba24c5  
    6464  FLAC__StreamEncoder* encoder;
    6565  FLAC__int32 *buffer;
    66   FLAC__StreamMetadata *metadata[2];
     66  FLAC__StreamMetadata **metadata;
    6767};
    6868
     
    165165  if (!ok) {
    166166    AUBIO_ERR("sink_flac: failed setting metadata for %s\n", s->path);
     167    goto failure;
     168  }
     169
     170  s->metadata = AUBIO_ARRAY(FLAC__StreamMetadata*, 2);
     171  if (!s->metadata) {
     172    AUBIO_ERR("sink_flac: failed allocating memory for %s\n", s->path);
    167173    goto failure;
    168174  }
     
    324330  if (s->metadata) {
    325331    // clean up metadata after stream finished
    326     FLAC__metadata_object_delete(s->metadata[0]);
    327     FLAC__metadata_object_delete(s->metadata[1]);
     332    if (s->metadata[0])
     333      FLAC__metadata_object_delete(s->metadata[0]);
     334    if (s->metadata[1])
     335      FLAC__metadata_object_delete(s->metadata[1]);
     336    AUBIO_FREE(s->metadata);
    328337  }
    329338
Note: See TracChangeset for help on using the changeset viewer.