summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Kocialkowski <contact@paulk.fr>2012-10-20 19:07:00 +0200
committerPaul Kocialkowski <contact@paulk.fr>2012-10-20 19:07:00 +0200
commit7751e9ab8b411d69fab1e455ef4ff75b883ab4d6 (patch)
tree48d3c728efe61f0da155c2dcb13875ae3e292490
parente61d5db12e477a2de085894f4bb9e5c4514d6ee8 (diff)
downloadhardware_tinyalsa-audio-7751e9ab8b411d69fab1e455ef4ff75b883ab4d6.zip
hardware_tinyalsa-audio-7751e9ab8b411d69fab1e455ef4ff75b883ab4d6.tar.gz
hardware_tinyalsa-audio-7751e9ab8b411d69fab1e455ef4ff75b883ab4d6.tar.bz2
Output: Disable current device when asked device is 0
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
-rw-r--r--audio_out.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/audio_out.c b/audio_out.c
index 573fbdc..4bfd9b3 100644
--- a/audio_out.c
+++ b/audio_out.c
@@ -20,6 +20,7 @@
#define LOG_TAG "TinyALSA-Audio Output"
+#include <stdlib.h>
#include <errno.h>
#include <pthread.h>
#include <stdint.h>
@@ -91,10 +92,27 @@ void audio_out_pcm_close(struct tinyalsa_audio_stream_out *stream_out)
int audio_out_set_route(struct tinyalsa_audio_stream_out *stream_out,
audio_devices_t device)
{
+ int rc;
+
if(stream_out == NULL)
return -1;
stream_out->device_current = device;
+
+ if(device == 0) {
+ tinyalsa_mixer_set_route(stream_out->device->mixer,
+ AUDIO_DEVICE_OUT_DEFAULT, stream_out->device->mode);
+
+ rc = yamaha_mc1n2_audio_output_stop(stream_out->device->mc1n2_pdata);
+ if(rc < 0) {
+ LOGE("Failed to set Yamaha-MC1N2-Audio route");
+ }
+
+ stream_out->standby = 1;
+
+ return 0;
+ }
+
tinyalsa_mixer_set_route(stream_out->device->mixer,
stream_out->device_current, stream_out->device->mode);