Changeset 1dfe409 for src/io/sink_wavwrite.c
- Timestamp:
- Mar 31, 2019, 11:12:40 PM (5 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/crepe, fix/ffmpeg5, master
- Children:
- 76b6dd3
- Parents:
- 08246ee (diff), f55630c (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/io/sink_wavwrite.c
r08246ee r1dfe409 28 28 #include "io/sink_wavwrite.h" 29 29 #include "io/ioutils.h" 30 31 #include <errno.h>32 30 33 31 #define MAX_SIZE 4096 … … 168 166 s->fid = fopen((const char *)s->path, "wb"); 169 167 if (!s->fid) { 170 char errorstr[256]; 171 AUBIO_STRERROR(errno, errorstr, sizeof(errorstr)); 172 AUBIO_ERR("sink_wavwrite: could not open %s (%s)\n", s->path, errorstr); 168 AUBIO_STRERR("sink_wavwrite: could not open %s (%s)\n", s->path, errorstr); 173 169 goto beach; 174 170 } … … 216 212 217 213 // fwrite(*, *, 1, s->fid) was called 13 times, check success 218 if (written != 13 ) {219 char errorstr[256];220 AUBIO_STRERROR(errno, errorstr, sizeof(errorstr));221 AUBIO_WRN("sink_wavwrite: writing header to %s failed, expected %d"222 " write but got only %d (%s)\n", s->path, 13, written, errorstr);214 if (written != 13 || fflush(s->fid)) { 215 AUBIO_STRERR("sink_wavwrite: writing header to %s failed" 216 " (wrote %d/%d, %s)\n", s->path, written, 13, errorstr); 217 fclose(s->fid); 218 s->fid = NULL; 223 219 return AUBIO_FAIL; 224 220 } … … 247 243 248 244 if (written_frames != write) { 249 char errorstr[256]; 250 AUBIO_STRERROR(errno, errorstr, sizeof(errorstr)); 251 AUBIO_WRN("sink_wavwrite: trying to write %d frames to %s, but only %d" 245 AUBIO_STRERR("sink_wavwrite: trying to write %d frames to %s, but only %d" 252 246 " could be written (%s)\n", write, s->path, written_frames, errorstr); 253 247 } … … 298 292 written += fwrite(write_little_endian(data_size, buf, 4), 4, 1, s->fid); 299 293 if (written != 2 || err != 0) { 300 char errorstr[256]; 301 AUBIO_STRERROR(errno, errorstr, sizeof(errorstr)); 302 AUBIO_WRN("sink_wavwrite: updating header of %s failed, expected %d" 294 AUBIO_STRERR("sink_wavwrite: updating header of %s failed, expected %d" 303 295 " write but got only %d (%s)\n", s->path, 2, written, errorstr); 304 296 } 305 297 // close file 306 298 if (fclose(s->fid)) { 307 char errorstr[256]; 308 AUBIO_STRERROR(errno, errorstr, sizeof(errorstr)); 309 AUBIO_ERR("sink_wavwrite: Error closing file %s (%s)\n", s->path, errorstr); 299 AUBIO_STRERR("sink_wavwrite: Error closing file %s (%s)\n", s->path, errorstr); 310 300 } 311 301 s->fid = NULL;
Note: See TracChangeset
for help on using the changeset viewer.