+headphoned (1.4) diablo; urgency=low
+
+ * Add support for pausing MPlayer
+
+ -- Thomas Perl <thp@thpinfo.com> Sat, 21 Nov 2009 17:37:08 +0100
+
headphoned (1.3) diablo; urgency=low
* Add support for pausing Panucci
export DBUS_SESSION_BUS_ADDRESS='unix:path=/tmp/session_bus_socket'
# XXX end
+# Add the headphoned FIFO to MPlayer's global configuration
+CONFIG_LINE="input:file=/etc/headphoned/mplayer-input"
+MPLAYER_CONF="/etc/mplayer/mplayer.conf"
+if [ -f "$MPLAYER_CONF" ]; then
+ if ! grep "$CONFIG_LINE" "$MPLAYER_CONF" >/dev/null; then
+ echo -n "Updating $MPLAYER_CONF... "
+ echo $CONFIG_LINE >>$MPLAYER_CONF
+ echo "done."
+ fi
+fi
+# End Add the headphoned FIFO to MPlayer's global configuration
+
test -x $DAEMON || exit 0
set -e
--- /dev/null
+#!/bin/sh
+
+#DEBHELPER#
+
+CONFIG_LINE="input:file=\/etc\/headphoned\/mplayer-input"
+MPLAYER_CONF="/etc/mplayer/mplayer.conf"
+
+# Remove the headphoned "input" config option for MPlayer (if it exists)
+if [ -f "$MPLAYER_CONF" ]; then
+ if grep "$CONFIG_LINE" "$MPLAYER_CONF" >/dev/null; then
+ echo -n "Updating $MPLAYER_CONF... "
+ sed -i -e "/$CONFIG_LINE/d" "$MPLAYER_CONF"
+ echo "done."
+ fi
+fi
+
dh_link
dh_strip
dh_compress
- dh_fixperms
+ dh_fixperms --exclude=/etc/headphoned/mplayer-input
dh_installdeb
dh_shlibdeps
dh_gencontrol
install: $(PROG)
install $(PROG) $(DESTDIR)$(PREFIX)/sbin/$(PROG)
+ mkdir -p $(DESTDIR)/etc/$(PROG)
+ mkfifo $(DESTDIR)/etc/$(PROG)/mplayer-input
+ chown user:users $(DESTDIR)/etc/$(PROG)/mplayer-input
clean:
rm -f $(PROG) $(OBJS)
#include <gconf/gconf-client.h>
#include <libosso.h>
#include <dbus/dbus.h>
+#include <fcntl.h>
#define STATE_FILE "/sys/devices/platform/gpio-switch/headphone/state"
#define STATE_CONNECTED_STR "connected"
#define PANUCCI_PATH "/panucciInterface"
#define PANUCCI_INTF "org.panucci.panucciInterface"
+#define MPLAYER_FIFO "/etc/headphoned/mplayer-input"
+
// Volume control is currently broken, as something is messing
// with the controls from outside this process in GConf..
//#define ENABLE_VOLUME_CONTROL
gint volume = headphoned->volume[headphoned->state];
#endif
gchar* result;
+ int mplayer_fifo;
g_io_channel_seek_position(source, 0, G_SEEK_SET, NULL);
g_io_channel_read_line(source, &result, NULL, NULL, NULL);
NULL,
DBUS_TYPE_INVALID);
}
+
+ /* MPlayer */
+ if ((mplayer_fifo = open(MPLAYER_FIFO,
+ O_WRONLY | O_NONBLOCK)) != -1) {
+ write(mplayer_fifo, "pause\n", 6);
+ close(mplayer_fifo);
+ }
}
#endif
}