From 0140804ef948b3c919e2e0c69dd175f443574fb9 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 2 May 2010 17:38:02 +0200 Subject: [PATCH] output_thread: moved code to ao_filter_open(), ao_filter_close() --- src/output_thread.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/output_thread.c b/src/output_thread.c index 60d008407..c3e064c3f 100644 --- a/src/output_thread.c +++ b/src/output_thread.c @@ -88,6 +88,20 @@ ao_disable(struct audio_output *ao) } } +static const struct audio_format * +ao_filter_open(struct audio_output *ao, + struct audio_format *audio_format, + GError **error_r) +{ + return filter_open(ao->filter, audio_format, error_r); +} + +static void +ao_filter_close(struct audio_output *ao) +{ + filter_close(ao->filter); +} + static void ao_open(struct audio_output *ao) { @@ -109,8 +123,7 @@ ao_open(struct audio_output *ao) /* open the filter */ - filter_audio_format = filter_open(ao->filter, &ao->in_audio_format, - &error); + filter_audio_format = ao_filter_open(ao, &ao->in_audio_format, &error); if (filter_audio_format == NULL) { g_warning("Failed to open filter for \"%s\" [%s]: %s", ao->name, ao->plugin->name, error->message); @@ -137,7 +150,7 @@ ao_open(struct audio_output *ao) ao->name, ao->plugin->name, error->message); g_error_free(error); - filter_close(ao->filter); + ao_filter_close(ao); ao->fail_timer = g_timer_new(); return; } @@ -176,7 +189,7 @@ ao_close(struct audio_output *ao, bool drain) ao_plugin_cancel(ao->plugin, ao->data); ao_plugin_close(ao->plugin, ao->data); - filter_close(ao->filter); + ao_filter_close(ao); g_mutex_lock(ao->mutex); @@ -189,9 +202,8 @@ ao_reopen_filter(struct audio_output *ao) const struct audio_format *filter_audio_format; GError *error = NULL; - filter_close(ao->filter); - filter_audio_format = filter_open(ao->filter, &ao->in_audio_format, - &error); + ao_filter_close(ao); + filter_audio_format = ao_filter_open(ao, &ao->in_audio_format, &error); if (filter_audio_format == NULL) { g_warning("Failed to open filter for \"%s\" [%s]: %s", ao->name, ao->plugin->name, error->message);