aboutsummaryrefslogtreecommitdiffstats
path: root/src/outputBuffer_audio.h
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2008-08-20 01:31:51 -0700
committerEric Wong <normalperson@yhbt.net>2008-08-20 01:31:51 -0700
commit1b197e65232e1a51b853db53985e8eda61f1b196 (patch)
tree2d85ff67ba79e32256a20d2d2bee7222352007fd /src/outputBuffer_audio.h
parent5a0216af3dc7c9dedc4dacb708191f0fd380bb73 (diff)
parent508ae1c18d3bdc99a1bb06181762e5ec859cf072 (diff)
downloadmpd-1b197e65232e1a51b853db53985e8eda61f1b196.tar.gz
mpd-1b197e65232e1a51b853db53985e8eda61f1b196.tar.xz
mpd-1b197e65232e1a51b853db53985e8eda61f1b196.zip
Merge branch 'core-rewrite' of git://git.musicpd.org/normalperson/mpd
* 'core-rewrite' of git://git.musicpd.org/normalperson/mpd: Remove ob_wait_sync and cleanup triggering in playlist fix output buffer deadlock when daemonizing log.c: thread-safety for warning log core rewrite (decode,player,outputBuffer,playlist)
Diffstat (limited to 'src/outputBuffer_audio.h')
-rw-r--r--src/outputBuffer_audio.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/outputBuffer_audio.h b/src/outputBuffer_audio.h
new file mode 100644
index 000000000..2af40c95f
--- /dev/null
+++ b/src/outputBuffer_audio.h
@@ -0,0 +1,35 @@
+/* This is where audio devices are managed inside the output buffer thread */
+
+static int audio_opened;
+
+/*
+ * reopen is set when we get a new song and there's a difference
+ * in audio format
+ */
+static int open_audio_devices(int reopen)
+{
+ assert(pthread_equal(pthread_self(), ob.thread));
+
+ if (!reopen && audio_opened)
+ return 0;
+ if (openAudioDevice(&ob.audio_format) >= 0) {
+ audio_opened = 1;
+ return 0;
+ }
+ audio_opened = 0;
+ stop_playback();
+ player_seterror(PLAYER_ERROR_AUDIO, NULL);
+ ERROR("problems opening audio device\n");
+ return -1;
+}
+
+static void close_audio_devices(void)
+{
+ assert(pthread_equal(pthread_self(), ob.thread));
+ DEBUG(__FILE__":%s %d\n", __func__, __LINE__);
+ dropBufferedAudio();
+ closeAudioDevice();
+ audio_opened = 0;
+ /* DEBUG(__FILE__":%s %d\n", __func__, __LINE__); */
+}
+