diff options
author | Denis Krjuchkov <alcohold@gmail.com> | 2010-10-08 23:55:14 +0600 |
---|---|---|
committer | Denis Krjuchkov <alcohold@gmail.com> | 2010-10-08 23:55:14 +0600 |
commit | 20004b7ee09db7de5a58ef50735b64309709a4c7 (patch) | |
tree | 9ae51c443fc7b851f6b1fe717e574d08adc2f837 /src/output | |
parent | 84e037631da0cf7e3d7099c566a181a2d506ed4c (diff) | |
download | mpd-20004b7ee09db7de5a58ef50735b64309709a4c7.tar.gz mpd-20004b7ee09db7de5a58ef50735b64309709a4c7.tar.xz mpd-20004b7ee09db7de5a58ef50735b64309709a4c7.zip |
win32_output: renamed win32 output plugin to winmm
Win32 has many audio APIs. New name is slightly more correct.
Diffstat (limited to '')
-rw-r--r-- | src/output/winmm_output_plugin.c (renamed from src/output/win32_output_plugin.c) | 100 | ||||
-rw-r--r-- | src/output_list.c | 6 |
2 files changed, 53 insertions, 53 deletions
diff --git a/src/output/win32_output_plugin.c b/src/output/winmm_output_plugin.c index 970c62d79..88c338c52 100644 --- a/src/output/win32_output_plugin.c +++ b/src/output/winmm_output_plugin.c @@ -24,15 +24,15 @@ #include <windows.h> #undef G_LOG_DOMAIN -#define G_LOG_DOMAIN "win32_output" +#define G_LOG_DOMAIN "winmm_output" -struct win32_buffer { +struct winmm_buffer { struct pcm_buffer buffer; WAVEHDR hdr; }; -struct win32_output { +struct winmm_output { HWAVEOUT handle; /** @@ -41,7 +41,7 @@ struct win32_output { */ HANDLE event; - struct win32_buffer buffers[8]; + struct winmm_buffer buffers[8]; unsigned next_buffer; }; @@ -49,45 +49,45 @@ struct win32_output { * The quark used for GError.domain. */ static inline GQuark -win32_output_quark(void) +winmm_output_quark(void) { - return g_quark_from_static_string("win32_output"); + return g_quark_from_static_string("winmm_output"); } static bool -win32_output_test_default_device(void) +winmm_output_test_default_device(void) { /* we assume that Wave is always available */ return true; } static void * -win32_output_init(G_GNUC_UNUSED const struct audio_format *audio_format, +winmm_output_init(G_GNUC_UNUSED const struct audio_format *audio_format, G_GNUC_UNUSED const struct config_param *param, G_GNUC_UNUSED GError **error) { - struct win32_output *wo = g_new(struct win32_output, 1); + struct winmm_output *wo = g_new(struct winmm_output, 1); return wo; } static void -win32_output_finish(void *data) +winmm_output_finish(void *data) { - struct win32_output *wo = data; + struct winmm_output *wo = data; g_free(wo); } static bool -win32_output_open(void *data, struct audio_format *audio_format, +winmm_output_open(void *data, struct audio_format *audio_format, GError **error_r) { - struct win32_output *wo = data; + struct winmm_output *wo = data; wo->event = CreateEvent(NULL, false, false, NULL); if (wo->event == NULL) { - g_set_error(error_r, win32_output_quark(), 0, + g_set_error(error_r, winmm_output_quark(), 0, "CreateEvent() failed"); return false; } @@ -123,7 +123,7 @@ win32_output_open(void *data, struct audio_format *audio_format, (DWORD_PTR)wo->event, 0, CALLBACK_EVENT); if (result != MMSYSERR_NOERROR) { CloseHandle(wo->event); - g_set_error(error_r, win32_output_quark(), result, + g_set_error(error_r, winmm_output_quark(), result, "waveOutOpen() failed"); return false; } @@ -139,9 +139,9 @@ win32_output_open(void *data, struct audio_format *audio_format, } static void -win32_output_close(void *data) +winmm_output_close(void *data) { - struct win32_output *wo = data; + struct winmm_output *wo = data; for (unsigned i = 0; i < G_N_ELEMENTS(wo->buffers); ++i) pcm_buffer_deinit(&wo->buffers[i].buffer); @@ -155,13 +155,13 @@ win32_output_close(void *data) * Copy data into a buffer, and prepare the wave header. */ static bool -win32_set_buffer(struct win32_output *wo, struct win32_buffer *buffer, +winmm_set_buffer(struct winmm_output *wo, struct winmm_buffer *buffer, const void *data, size_t size, GError **error_r) { void *dest = pcm_buffer_get(&buffer->buffer, size); if (dest == NULL) { - g_set_error(error_r, win32_output_quark(), 0, + g_set_error(error_r, winmm_output_quark(), 0, "Out of memory"); return false; } @@ -175,7 +175,7 @@ win32_set_buffer(struct win32_output *wo, struct win32_buffer *buffer, MMRESULT result = waveOutPrepareHeader(wo->handle, &buffer->hdr, sizeof(buffer->hdr)); if (result != MMSYSERR_NOERROR) { - g_set_error(error_r, win32_output_quark(), result, + g_set_error(error_r, winmm_output_quark(), result, "waveOutPrepareHeader() failed"); return false; } @@ -187,7 +187,7 @@ win32_set_buffer(struct win32_output *wo, struct win32_buffer *buffer, * Wait until the buffer is finished. */ static bool -win32_drain_buffer(struct win32_output *wo, struct win32_buffer *buffer, +winmm_drain_buffer(struct winmm_output *wo, struct winmm_buffer *buffer, GError **error_r) { if ((buffer->hdr.dwFlags & WHDR_DONE) == WHDR_DONE) @@ -201,7 +201,7 @@ win32_drain_buffer(struct win32_output *wo, struct win32_buffer *buffer, if (result == MMSYSERR_NOERROR) return true; else if (result != WAVERR_STILLPLAYING) { - g_set_error(error_r, win32_output_quark(), result, + g_set_error(error_r, winmm_output_quark(), result, "waveOutUnprepareHeader() failed"); return false; } @@ -212,14 +212,14 @@ win32_drain_buffer(struct win32_output *wo, struct win32_buffer *buffer, } static size_t -win32_output_play(void *data, const void *chunk, size_t size, GError **error_r) +winmm_output_play(void *data, const void *chunk, size_t size, GError **error_r) { - struct win32_output *wo = data; + struct winmm_output *wo = data; /* get the next buffer from the ring and prepare it */ - struct win32_buffer *buffer = &wo->buffers[wo->next_buffer]; - if (!win32_drain_buffer(wo, buffer, error_r) || - !win32_set_buffer(wo, buffer, chunk, size, error_r)) + struct winmm_buffer *buffer = &wo->buffers[wo->next_buffer]; + if (!winmm_drain_buffer(wo, buffer, error_r) || + !winmm_set_buffer(wo, buffer, chunk, size, error_r)) return 0; /* enqueue the buffer */ @@ -228,7 +228,7 @@ win32_output_play(void *data, const void *chunk, size_t size, GError **error_r) if (result != MMSYSERR_NOERROR) { waveOutUnprepareHeader(wo->handle, &buffer->hdr, sizeof(buffer->hdr)); - g_set_error(error_r, win32_output_quark(), result, + g_set_error(error_r, winmm_output_quark(), result, "waveOutWrite() failed"); return 0; } @@ -241,56 +241,56 @@ win32_output_play(void *data, const void *chunk, size_t size, GError **error_r) } static bool -win32_drain_all_buffers(struct win32_output *wo, GError **error_r) +winmm_drain_all_buffers(struct winmm_output *wo, GError **error_r) { for (unsigned i = wo->next_buffer; i < G_N_ELEMENTS(wo->buffers); ++i) - if (!win32_drain_buffer(wo, &wo->buffers[i], error_r)) + if (!winmm_drain_buffer(wo, &wo->buffers[i], error_r)) return false; for (unsigned i = 0; i < wo->next_buffer; ++i) - if (!win32_drain_buffer(wo, &wo->buffers[i], error_r)) + if (!winmm_drain_buffer(wo, &wo->buffers[i], error_r)) return false; return true; } static void -win32_stop(struct win32_output *wo) +winmm_stop(struct winmm_output *wo) { waveOutReset(wo->handle); for (unsigned i = 0; i < G_N_ELEMENTS(wo->buffers); ++i) { - struct win32_buffer *buffer = &wo->buffers[i]; + struct winmm_buffer *buffer = &wo->buffers[i]; waveOutUnprepareHeader(wo->handle, &buffer->hdr, sizeof(buffer->hdr)); } } static void -win32_output_drain(void *data) +winmm_output_drain(void *data) { - struct win32_output *wo = data; + struct winmm_output *wo = data; - if (!win32_drain_all_buffers(wo, NULL)) - win32_stop(wo); + if (!winmm_drain_all_buffers(wo, NULL)) + winmm_stop(wo); } static void -win32_output_cancel(void *data) +winmm_output_cancel(void *data) { - struct win32_output *wo = data; + struct winmm_output *wo = data; - win32_stop(wo); + winmm_stop(wo); } -const struct audio_output_plugin win32_output_plugin = { - .name = "win32", - .test_default_device = win32_output_test_default_device, - .init = win32_output_init, - .finish = win32_output_finish, - .open = win32_output_open, - .close = win32_output_close, - .play = win32_output_play, - .drain = win32_output_drain, - .cancel = win32_output_cancel, +const struct audio_output_plugin winmm_output_plugin = { + .name = "winmm", + .test_default_device = winmm_output_test_default_device, + .init = winmm_output_init, + .finish = winmm_output_finish, + .open = winmm_output_open, + .close = winmm_output_close, + .play = winmm_output_play, + .drain = winmm_output_drain, + .cancel = winmm_output_cancel, }; diff --git a/src/output_list.c b/src/output_list.c index c5fd05b1d..0d1e70968 100644 --- a/src/output_list.c +++ b/src/output_list.c @@ -36,7 +36,7 @@ extern const struct audio_output_plugin mvp_output_plugin; extern const struct audio_output_plugin jack_output_plugin; extern const struct audio_output_plugin httpd_output_plugin; extern const struct audio_output_plugin recorder_output_plugin; -extern const struct audio_output_plugin win32_output_plugin; +extern const struct audio_output_plugin winmm_output_plugin; const struct audio_output_plugin *audio_output_plugins[] = { #ifdef HAVE_SHOUT @@ -82,8 +82,8 @@ const struct audio_output_plugin *audio_output_plugins[] = { #ifdef ENABLE_RECORDER_OUTPUT &recorder_output_plugin, #endif -#ifdef ENABLE_WIN32_OUTPUT - &win32_output_plugin, +#ifdef ENABLE_WINMM_OUTPUT + &winmm_output_plugin, #endif NULL }; |