[Xfce4-commits] r26567 - in xfce4-mixer/trunk: . xfce4-mixer
Jannis Pohlmann
jannis at xfce.org
Mon Jan 14 01:47:17 CET 2008
Author: jannis
Date: 2008-01-14 00:47:17 +0000 (Mon, 14 Jan 2008)
New Revision: 26567
Added:
xfce4-mixer/trunk/.gitignore
Modified:
xfce4-mixer/trunk/ChangeLog
xfce4-mixer/trunk/TODO
xfce4-mixer/trunk/autogen.sh
xfce4-mixer/trunk/configure.in.in
xfce4-mixer/trunk/xfce4-mixer/xfce-mixer-card.c
xfce4-mixer/trunk/xfce4-mixer/xfce-mixer-card.h
xfce4-mixer/trunk/xfce4-mixer/xfce-mixer.c
Log:
* configure.in.in, xfce4-mixer/xfce-mixer-card.{c,h},
xfce4-mixer/xfce-mixer.c: Add optional support for the GstMixer
notification API. It uses GstBus and GstMixerMessages. The latter
are only available with GStreamer >= 0.10.14. Not all work is done
yet, but it will be worked on this week.
* autogen.sh: Tweak autogen.sh so that it works with both, SVN and
git-svn.
Added: xfce4-mixer/trunk/.gitignore
===================================================================
--- xfce4-mixer/trunk/.gitignore (rev 0)
+++ xfce4-mixer/trunk/.gitignore 2008-01-14 00:47:17 UTC (rev 26567)
@@ -0,0 +1,27 @@
+*.o
+ltmain.sh
+mkinstalldirs
+depcomp
+*.gmo
+Makefile.in.in
+.intltool-merge-cache
+configure.in
+libtool
+configure
+Makefile
+Makefile.in
+xfce4-mixer.desktop
+intltool-*
+config.*
+stamp-it
+stamp-h1
+POTFILES
+*.m4
+*.swp
+.deps
+.libs
+xfce4-mixer
+missing
+install-sh
+compile
+autom4te*
Modified: xfce4-mixer/trunk/ChangeLog
===================================================================
--- xfce4-mixer/trunk/ChangeLog 2008-01-13 19:27:18 UTC (rev 26566)
+++ xfce4-mixer/trunk/ChangeLog 2008-01-14 00:47:17 UTC (rev 26567)
@@ -1,3 +1,13 @@
+2008-01-14 Jannis Pohlmann <jannis at xfce.org>
+
+ * configure.in.in, xfce4-mixer/xfce-mixer-card.{c,h},
+ xfce4-mixer/xfce-mixer.c: Add optional support for the GstMixer
+ notification API. It uses GstBus and GstMixerMessages. The latter
+ are only available with GStreamer >= 0.10.14. Not all work is done
+ yet, but it will be worked on this week.
+ * autogen.sh: Tweak autogen.sh so that it works with both, SVN and
+ git-svn.
+
2008-01-13 Jannis Pohlmann <jannis at xfce.org>
* xfce4-mixer-card.{c,h}: Add XfceMixerCard class as a wrapper for
Modified: xfce4-mixer/trunk/TODO
===================================================================
--- xfce4-mixer/trunk/TODO 2008-01-13 19:27:18 UTC (rev 26566)
+++ xfce4-mixer/trunk/TODO 2008-01-14 00:47:17 UTC (rev 26567)
@@ -1,5 +1,11 @@
-* Monitor for changes and update the controls according to them
+* Monitor for changes and update the controls according to them:
+ 1) Add GHashTable for (track name => mixer widget) lookup
+ 2) Extend xfce_mixer_bus_message() to handle all types of messages
+ by updating the corresponding mixer widgets
+
* Write panel plugin
+
* Write MCS plugin (or go the xfconf way)
+
* Allow changing controls from the console, probably via something like:
--change-control=SOUNDCARD NAME:TRACK NAME:NEW VALUE
Modified: xfce4-mixer/trunk/autogen.sh
===================================================================
--- xfce4-mixer/trunk/autogen.sh 2008-01-13 19:27:18 UTC (rev 26566)
+++ xfce4-mixer/trunk/autogen.sh 2008-01-14 00:47:17 UTC (rev 26567)
@@ -1,7 +1,7 @@
#!/bin/sh
#
# $Id$
-
+#
# vi:set ts=2 sw=2 et ai:
#
# Copyright (c) 2008 Jannis Pohlmann <jannis at xfce.org>
@@ -29,6 +29,20 @@
# Substitute revision and linguas
linguas=`sed -e '/^#/d' po/LINGUAS`
-sed -e "s/@LINGUAS@/${linguas}/g" < "configure.in.in" > "configure.in"
+if test -d .git/svn; then
+ revision=`LC_ALL=C git-svn find-rev HEAD`
+elif test -f .svn; then
+ revision=`LC_ALL=C svn info $0 | awk '/^Revision: / {printf "%05d\n", $2}'`
+else
+ revision=""
+fi
+sed -e "s/@LINGUAS@/${linguas}/g" \
+ -e "s/@REVISION@/${revision}/g" \
+ < "configure.in.in" > "configure.in"
exec xdt-autogen $@
+
+# xdt-autogen clean does not remove all generated files
+(test x"clean" = x"$1") && {
+ rm -rf configure.in
+} || true
Modified: xfce4-mixer/trunk/configure.in.in
===================================================================
--- xfce4-mixer/trunk/configure.in.in 2008-01-13 19:27:18 UTC (rev 26566)
+++ xfce4-mixer/trunk/configure.in.in 2008-01-14 00:47:17 UTC (rev 26567)
@@ -60,6 +60,19 @@
XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [4.4.0])
XDT_CHECK_PACKAGE([LIBXFCEGUI4], [libxfcegui4-1.0], [4.4.0])
+dnl **************************************
+dnl *** Check for GstMixer bus support ***
+dnl **************************************
+HAVE_GST_MIXER_NOTIFICATION=no
+PKG_CHECK_MODULES(GST_MIXER_NOTIFICATION_API,
+ gstreamer-plugins-base-0.10 >= 0.10.14,
+ HAVE_GST_MIXER_NOTIFICATION=yes,
+ HAVE_GST_MIXER_NOTIFICATION=no)
+if test "x$HAVE_GST_MIXER_NOTIFICATION" = "xyes"; then
+ AC_DEFINE(HAVE_GST_MIXER_NOTIFICATION, 1,
+ [Have GStreamer mixer notification API])
+fi
+
dnl ***********************************
dnl *** Check for debugging support ***
dnl ***********************************
Modified: xfce4-mixer/trunk/xfce4-mixer/xfce-mixer-card.c
===================================================================
--- xfce4-mixer/trunk/xfce4-mixer/xfce-mixer-card.c 2008-01-13 19:27:18 UTC (rev 26566)
+++ xfce4-mixer/trunk/xfce4-mixer/xfce-mixer-card.c 2008-01-14 00:47:17 UTC (rev 26567)
@@ -55,6 +55,10 @@
GstElement *element;
+#ifdef HAVE_GST_MIXER_NOTIFICATION
+ GstBus *bus;
+#endif
+
gchar *display_name;
gchar *name;
};
@@ -112,6 +116,10 @@
xfce_mixer_card_init (XfceMixerCard *card)
{
card->name = NULL;
+
+#ifdef HAVE_GST_MIXER_NOTIFICATION
+ card->bus = NULL;
+#endif
}
@@ -124,6 +132,11 @@
gst_element_set_state (card->element, GST_STATE_NULL);
gst_object_unref (card->element);
+#ifdef HAVE_GST_MIXER_NOTIFICATION
+ if (G_LIKELY (card->bus != NULL))
+ gst_object_unref (card->bus);
+#endif
+
g_free (card->display_name);
g_free (card->name);
@@ -305,3 +318,36 @@
gst_mixer_set_option (GST_MIXER (card->element), GST_MIXER_OPTIONS (track), option);
}
+
+
+
+#ifdef HAVE_GST_MIXER_NOTIFICATION
+void
+xfce_mixer_card_connect (XfceMixerCard *card,
+ GCallback callback_func,
+ gpointer user_data)
+{
+ g_return_if_fail (IS_XFCE_MIXER_CARD (card));
+
+ if (G_UNLIKELY (card->bus == NULL))
+ {
+ card->bus = gst_bus_new ();
+ gst_bus_add_signal_watch (card->bus);
+ gst_element_set_bus (card->element, card->bus);
+ }
+
+ g_signal_connect (G_OBJECT (card->bus), "message::element", callback_func, user_data);
+}
+
+
+
+gboolean
+xfce_mixer_card_get_message_owner (XfceMixerCard *card,
+ GstMessage *message)
+{
+ g_return_val_if_fail (IS_XFCE_MIXER_CARD (card), FALSE);
+ g_return_val_if_fail (GST_IS_MESSAGE (message), FALSE);
+
+ return GST_MESSAGE_SRC (message) == GST_OBJECT (card->element);
+}
+#endif
Modified: xfce4-mixer/trunk/xfce4-mixer/xfce-mixer-card.h
===================================================================
--- xfce4-mixer/trunk/xfce4-mixer/xfce-mixer-card.h 2008-01-13 19:27:18 UTC (rev 26566)
+++ xfce4-mixer/trunk/xfce4-mixer/xfce-mixer-card.h 2008-01-14 00:47:17 UTC (rev 26567)
@@ -62,6 +62,13 @@
void xfce_mixer_card_set_track_option (XfceMixerCard *card,
GstMixerTrack *track,
gchar *option);
+#ifdef HAVE_GST_MIXER_NOTIFICATION
+void xfce_mixer_card_connect (XfceMixerCard *card,
+ GCallback callback_func,
+ gpointer user_data);
+gboolean xfce_mixer_card_get_message_owner (XfceMixerCard *card,
+ GstMessage *message);
+#endif
G_END_DECLS;
Modified: xfce4-mixer/trunk/xfce4-mixer/xfce-mixer.c
===================================================================
--- xfce4-mixer/trunk/xfce4-mixer/xfce-mixer.c 2008-01-13 19:27:18 UTC (rev 26566)
+++ xfce4-mixer/trunk/xfce4-mixer/xfce-mixer.c 2008-01-14 00:47:17 UTC (rev 26567)
@@ -43,6 +43,11 @@
static void xfce_mixer_dispose (GObject *object);
static void xfce_mixer_finalize (GObject *object);
static void xfce_mixer_create_contents (XfceMixer *mixer);
+#ifdef HAVE_GST_MIXER_NOTIFICATION
+static gboolean xfce_mixer_bus_message (GstBus *bus,
+ GstMessage *message,
+ XfceMixer *mixer);
+#endif
@@ -173,6 +178,10 @@
xfce_mixer_card_set_ready (mixer->card);
+#ifdef HAVE_GST_MIXER_NOTIFICATION
+ xfce_mixer_card_connect (mixer->card, G_CALLBACK (xfce_mixer_bus_message), mixer);
+#endif
+
/* Create widgets for all four tabs */
for (i = 0; i < 4; ++i)
{
@@ -297,3 +306,48 @@
gtk_notebook_append_page (GTK_NOTEBOOK (mixer), label2, label1);
}
}
+
+
+
+#ifdef HAVE_GST_MIXER_NOTIFICATION
+static gboolean
+xfce_mixer_bus_message (GstBus *bus,
+ GstMessage *message,
+ XfceMixer *mixer)
+{
+ GstMixerMessageType type;
+ GstMixerOptions *options = NULL;
+ GstMixerTrack *track = NULL;
+ gboolean muted;
+ gboolean record;
+ const gchar *option;
+
+ if (G_UNLIKELY (!xfce_mixer_card_get_message_owner (mixer->card, message)))
+ return TRUE;
+
+ g_debug ("Message from card received: %s", GST_MESSAGE_TYPE_NAME (message));
+
+ type = gst_mixer_message_get_type (message);
+
+ if (type == GST_MIXER_MESSAGE_MUTE_TOGGLED)
+ {
+ gst_mixer_message_parse_mute_toggled (message, &track, &muted);
+ g_debug ("Track '%s' was %s", track->label, muted ? "muted" : "unmuted");
+ }
+ else if (type == GST_MIXER_MESSAGE_RECORD_TOGGLED)
+ {
+ gst_mixer_message_parse_record_toggled (message, &track, &record);
+ g_debug ("Recording on track '%s' was %s", track->label, record ? "turned on" : "turned off");
+ }
+ else if (type == GST_MIXER_MESSAGE_VOLUME_CHANGED)
+ {
+ }
+ else if (type == GST_MIXER_MESSAGE_OPTION_CHANGED)
+ {
+ gst_mixer_message_parse_option_changed (message, &options, &option);
+ g_debug ("Option '%s' was set to '%s'", GST_MIXER_TRACK (options)->label, option);
+ }
+
+ return TRUE;
+}
+#endif
More information about the Xfce4-commits
mailing list