diff options
Diffstat (limited to 'src/riff.c')
-rw-r--r-- | src/riff.c | 36 |
1 files changed, 17 insertions, 19 deletions
@@ -68,7 +68,7 @@ error_io: return -1; } -static xas_riff *file_new(const char *path, +static xas_riff *new_file(const char *path, size_t sample_size, size_t sample_rate, size_t channels, @@ -184,8 +184,7 @@ error_invalid_header_main_id: return -1; } -static xas_riff *file_open(const char *path, - int flags) { +static xas_riff *open_file(const char *path, int flags) { xas_riff *riff; xas_riff_wave_header header; @@ -239,7 +238,7 @@ error_malloc_riff: return NULL; } -static void file_close(xas_riff *riff, xas_audio_stream *stream) { +static void close_file(xas_riff *riff, xas_audio_stream *stream) { if (lseek(riff->fd, 0, SEEK_SET) < 0) { goto error_io; } @@ -297,7 +296,7 @@ error_read: return -1; } -xas_audio_stream *xas_riff_file_new(const char *path, +xas_audio_stream *xas_riff_new_file(const char *path, size_t sample_size, size_t sample_rate, size_t channels, @@ -305,17 +304,17 @@ xas_audio_stream *xas_riff_file_new(const char *path, xas_audio_stream *stream; xas_riff *riff; - if ((riff = file_new(path, + if ((riff = new_file(path, sample_size, sample_rate, channels, flags)) == NULL) { - goto error_file_new; + goto error_new_file; } if (flags & (O_RDWR | O_WRONLY)) { if ((stream = xas_audio_stream_new_sink((xas_audio_drain)audio_drain, - (xas_audio_cleanup)file_close, + (xas_audio_cleanup)close_file, riff, sample_size, sample_rate, @@ -325,7 +324,7 @@ xas_audio_stream *xas_riff_file_new(const char *path, } } else { if ((stream = xas_audio_stream_new_source((xas_audio_fill)audio_fill, - (xas_audio_cleanup)file_close, + (xas_audio_cleanup)close_file, riff, sample_size, sample_rate, @@ -338,24 +337,23 @@ xas_audio_stream *xas_riff_file_new(const char *path, return stream; error_audio_stream_new_sink: - file_close(riff, NULL); + close_file(riff, NULL); -error_file_new: +error_new_file: return NULL; } -xas_audio_stream *xas_riff_file_open(const char *path, - int flags) { +xas_audio_stream *xas_riff_open_file(const char *path, int flags) { xas_audio_stream *stream; xas_riff *riff; - if ((riff = file_open(path, flags)) == NULL) { - goto error_file_open; + if ((riff = open_file(path, flags)) == NULL) { + goto error_open_file; } if (flags & (O_RDWR | O_WRONLY)) { if ((stream = xas_audio_stream_new_sink((xas_audio_drain)audio_drain, - (xas_audio_cleanup)file_close, + (xas_audio_cleanup)close_file, riff, riff->sample_size, riff->sample_rate, @@ -365,7 +363,7 @@ xas_audio_stream *xas_riff_file_open(const char *path, } } else { if ((stream = xas_audio_stream_new_source((xas_audio_fill)audio_fill, - (xas_audio_cleanup)file_close, + (xas_audio_cleanup)close_file, riff, riff->sample_size, riff->sample_rate, @@ -378,8 +376,8 @@ xas_audio_stream *xas_riff_file_open(const char *path, return stream; error_audio_stream_new_sink: - file_close(riff, NULL); + close_file(riff, NULL); -error_file_open: +error_open_file: return NULL; } |