shithub: aubio

Download patch

ref: 135bc14f80c3316dd46e1a365fd98a9d0ed613df
parent: 8fe522da2c84630f38c1c52ff85b208e5b0addf8
parent: 07c76d008560c7d5d8cce8f74ca295575fb5ec2a
author: Paul Brossier <piem@piem.org>
date: Sun Mar 31 19:12:25 EDT 2019

Merge branch 'feature/sink_flac' into feature/autosink

--- a/src/io/sink_flac.c
+++ b/src/io/sink_flac.c
@@ -34,9 +34,6 @@
 #include <FLAC/metadata.h>
 #include <FLAC/stream_encoder.h>
 
-#include <string.h> // strerror
-#include <errno.h> // errno
-
 #define MAX_WRITE_SIZE 4096
 
 // swap host to little endian
@@ -132,6 +129,7 @@
   uint_t ret = AUBIO_FAIL;
   FLAC__bool ok = true;
   FLAC__StreamEncoderInitStatus init_status;
+  FLAC__StreamMetadata_VorbisComment_Entry entry;
   const unsigned comp_level = 5;
   const unsigned bps = 16;
 
@@ -145,7 +143,7 @@
 
   s->fid = fopen((const char *)s->path, "wb");
   if (!s->fid) {
-    AUBIO_ERR("sink_flac: failed opening %s, %s\n", s->path, strerror(errno));
+    AUBIO_STRERR("sink_flac: Failed opening %s (%s)\n", s->path, errorstr);
     return AUBIO_FAIL;
   }
 
@@ -185,7 +183,6 @@
     goto failure;
   }
 
-  FLAC__StreamMetadata_VorbisComment_Entry entry;
   ok = FLAC__metadata_object_vorbiscomment_entry_from_name_value_pair(&entry,
       "encoder", "aubio");
   ok &= FLAC__metadata_object_vorbiscomment_append_comment(s->metadata[0],
@@ -347,8 +344,7 @@
   }
 
   if (s->fid && fclose(s->fid)) {
-    AUBIO_ERR("sink_flac: Error closing file %s (%s)\n",
-        s->path, strerror(errno));
+    AUBIO_STRERR("sink_flac: Error closing file %s (%s)\n", s->path, errorstr);
     ret &= AUBIO_FAIL;
   }
   s->fid = NULL;