aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-11-25 17:37:12 +0100
committerMax Kellermann <max@duempel.org>2008-11-25 17:37:12 +0100
commitb76f7b769cb6c44e8ef04562a2bda7b8534925c0 (patch)
tree4acffe6f64f838914a19c90bbc355253a293a575 /src
parentbe60ff83f770815d97977e6fd9a1516d398e7a7a (diff)
downloadmpd-b76f7b769cb6c44e8ef04562a2bda7b8534925c0.tar.gz
mpd-b76f7b769cb6c44e8ef04562a2bda7b8534925c0.tar.xz
mpd-b76f7b769cb6c44e8ef04562a2bda7b8534925c0.zip
mvp: use GLib instead of utils.h/log.h
Diffstat (limited to 'src')
-rw-r--r--src/output/mvp_plugin.c43
1 files changed, 27 insertions, 16 deletions
diff --git a/src/output/mvp_plugin.c b/src/output/mvp_plugin.c
index 61b45ba0f..ef822ee74 100644
--- a/src/output/mvp_plugin.c
+++ b/src/output/mvp_plugin.c
@@ -20,13 +20,18 @@
*/
#include "../output_api.h"
-#include "../utils.h"
-#include "../log.h"
+#include <glib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <fcntl.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+#undef G_LOG_DOMAIN
+#define G_LOG_DOMAIN "mvp"
typedef struct {
unsigned long dsp_status;
@@ -92,8 +97,8 @@ static bool mvp_testDefault(void)
return true;
}
- WARNING("Error opening PCM device \"/dev/adec_pcm\": %s\n",
- strerror(errno));
+ g_warning("Error opening PCM device \"/dev/adec_pcm\": %s\n",
+ strerror(errno));
return false;
}
@@ -102,7 +107,7 @@ static void *mvp_initDriver(mpd_unused struct audio_output *audio_output,
mpd_unused const struct audio_format *audio_format,
mpd_unused ConfigParam *param)
{
- MvpData *md = xmalloc(sizeof(MvpData));
+ MvpData *md = g_new(MvpData, 1);
md->audio_output = audio_output;
md->fd = -1;
@@ -156,22 +161,23 @@ static int mvp_setPcmParams(MvpData * md, unsigned long rate, int channels,
}
if (iloop >= numfrequencies) {
- ERROR("Can not find suitable output frequency for %ld\n", rate);
+ g_warning("Can not find suitable output frequency for %ld\n",
+ rate);
return -1;
}
if (ioctl(md->fd, MVP_SET_AUD_FORMAT, &mix) < 0) {
- ERROR("Can not set audio format\n");
+ g_warning("Can not set audio format\n");
return -1;
}
if (ioctl(md->fd, MVP_SET_AUD_SYNC, 2) != 0) {
- ERROR("Can not set audio sync\n");
+ g_warning("Can not set audio sync\n");
return -1;
}
if (ioctl(md->fd, MVP_SET_AUD_PLAY, 0) < 0) {
- ERROR("Can not set audio play mode\n");
+ g_warning("Can not set audio play mode\n");
return -1;
}
@@ -186,24 +192,29 @@ mvp_openDevice(void *data, struct audio_format *audioFormat)
int mix[5] = { 0, 2, 7, 1, 0 };
if ((md->fd = open("/dev/adec_pcm", O_RDWR | O_NONBLOCK)) < 0) {
- ERROR("Error opening /dev/adec_pcm: %s\n", strerror(errno));
+ g_warning("Error opening /dev/adec_pcm: %s\n",
+ strerror(errno));
return false;
}
if (ioctl(md->fd, MVP_SET_AUD_SRC, 1) < 0) {
- ERROR("Error setting audio source: %s\n", strerror(errno));
+ g_warning("Error setting audio source: %s\n",
+ strerror(errno));
return false;
}
if (ioctl(md->fd, MVP_SET_AUD_STREAMTYPE, 0) < 0) {
- ERROR("Error setting audio streamtype: %s\n", strerror(errno));
+ g_warning("Error setting audio streamtype: %s\n",
+ strerror(errno));
return false;
}
if (ioctl(md->fd, MVP_SET_AUD_FORMAT, &mix) < 0) {
- ERROR("Error setting audio format: %s\n", strerror(errno));
+ g_warning("Error setting audio format: %s\n",
+ strerror(errno));
return false;
}
ioctl(md->fd, MVP_SET_AUD_STC, &stc);
if (ioctl(md->fd, MVP_SET_AUD_BYPASS, 1) < 0) {
- ERROR("Error setting audio streamtype: %s\n", strerror(errno));
+ g_warning("Error setting audio streamtype: %s\n",
+ strerror(errno));
return false;
}
#ifdef WORDS_BIGENDIAN
@@ -251,8 +262,8 @@ mvp_playAudio(void *data, const char *playChunk, size_t size)
if (ret < 0) {
if (errno == EINTR)
continue;
- ERROR("closing mvp PCM device due to write error: "
- "%s\n", strerror(errno));
+ g_warning("closing mvp PCM device due to write error: "
+ "%s\n", strerror(errno));
return false;
}
playChunk += ret;