routing: first steps towards multiplexing input streams
authorJanos Kovacs <jankovac503@gmail.com>
Fri, 25 May 2012 01:14:04 +0000 (04:14 +0300)
committerJanos Kovacs <jankovac503@gmail.com>
Fri, 25 May 2012 01:14:04 +0000 (04:14 +0300)
* filters in discover to treat combine sinks/sink-inputs differently
* moving to the new naming (ie. module-murphy-ivi) and change the src
  to murphy. The later was needed to make room for other source
  directories to accomodate the hacked version of combine module

30 files changed:
Makefile.am
configure
configure.ac
fedora/Makefile
fedora/pulseaudio-module-murphy-ivi.spec.in [moved from fedora/genivi-mir.spec.in with 90% similarity]
murphy/Makefile.am [new file with mode: 0644]
murphy/audiomgr.c [moved from src/audiomgr.c with 99% similarity]
murphy/audiomgr.h [moved from src/audiomgr.h with 100% similarity]
murphy/config.c [moved from src/config.c with 100% similarity]
murphy/config.h [moved from src/config.h with 100% similarity]
murphy/dbusif.c [moved from src/dbusif.c with 100% similarity]
murphy/dbusif.h [moved from src/dbusif.h with 100% similarity]
murphy/discover.c [moved from src/discover.c with 98% similarity]
murphy/discover.h [moved from src/discover.h with 100% similarity]
murphy/list.h [moved from src/list.h with 100% similarity]
murphy/module-murphy-ivi-symdef.h [new file with mode: 0644]
murphy/module-murphy-ivi.c [moved from src/module-genivi-mir.c with 96% similarity]
murphy/node.c [moved from src/node.c with 99% similarity]
murphy/node.h [moved from src/node.h with 96% similarity]
murphy/router.c [moved from src/router.c with 98% similarity]
murphy/router.h [moved from src/router.h with 100% similarity]
murphy/switch.c [moved from src/switch.c with 57% similarity]
murphy/switch.h [moved from src/switch.h with 83% similarity]
murphy/tracker.c [moved from src/tracker.c with 100% similarity]
murphy/tracker.h [moved from src/tracker.h with 100% similarity]
murphy/userdata.h [moved from src/userdata.h with 100% similarity]
murphy/utils.c [moved from src/utils.c with 100% similarity]
murphy/utils.h [moved from src/utils.h with 100% similarity]
src/Makefile.am [deleted file]
src/module-genivi-mir-symdef.h [deleted file]

index 10758c8..41b5a50 100644 (file)
@@ -1,4 +1,4 @@
-SUBDIRS = src # doc
+SUBDIRS = murphy # doc
 
 MAINTAINERCLEANFILES = \
         Makefile.in src/Makefile.in config.h.in configure \
index c445706..de32602 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,8 +1,8 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68 for pulseaudio-genivi-mir .
+# Generated by GNU Autoconf 2.68 for pulseaudio-murphy-ivi .
 #
-# Report bugs to <janos.f.kovacs@nokia.com>.
+# Report bugs to <janos.kovacs@intel.com>.
 #
 #
 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -247,10 +247,10 @@ fi
     $as_echo "$0: be upgraded to zsh 4.3.4 or later."
   else
     $as_echo "$0: Please tell bug-autoconf@gnu.org and
-$0: janos.f.kovacs@nokia.com about your system, including
-$0: any error possibly output before this message. Then
-$0: install a modern shell, or manually run the script
-$0: under such a shell if you do have one."
+$0: janos.kovacs@intel.com about your system, including any
+$0: error possibly output before this message. Then install
+$0: a modern shell, or manually run the script under such a
+$0: shell if you do have one."
   fi
   exit 1
 fi
@@ -570,14 +570,14 @@ MFLAGS=
 MAKEFLAGS=
 
 # Identity of this package.
-PACKAGE_NAME='pulseaudio-genivi-mir'
-PACKAGE_TARNAME='pulseaudio-genivi-mir'
+PACKAGE_NAME='pulseaudio-murphy-ivi'
+PACKAGE_TARNAME='pulseaudio-murphy-ivi'
 PACKAGE_VERSION=''
-PACKAGE_STRING='pulseaudio-genivi-mir '
-PACKAGE_BUGREPORT='janos.f.kovacs@nokia.com'
+PACKAGE_STRING='pulseaudio-murphy-ivi '
+PACKAGE_BUGREPORT='janos.kovacs@intel.com'
 PACKAGE_URL=''
 
-ac_unique_file="src/module-genivi-mir.c"
+ac_unique_file="murphy/module-murphy-ivi.c"
 # Factoring default headers for most tests.
 ac_includes_default="\
 #include <stdio.h>
@@ -620,7 +620,6 @@ am__EXEEXT_TRUE
 LTLIBOBJS
 LIBOBJS
 modlibexecdir
-PULSEAUDIO_HAS_PORTS
 DBUS_LIBS
 DBUS_CFLAGS
 PULSEDEVEL_LIBS
@@ -1327,7 +1326,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures pulseaudio-genivi-mir  to adapt to many kinds of systems.
+\`configure' configures pulseaudio-murphy-ivi  to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1376,7 +1375,7 @@ Fine tuning of the installation directories:
   --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
   --mandir=DIR            man documentation [DATAROOTDIR/man]
   --docdir=DIR            documentation root
-                          [DATAROOTDIR/doc/pulseaudio-genivi-mir]
+                          [DATAROOTDIR/doc/pulseaudio-murphy-ivi]
   --htmldir=DIR           html documentation [DOCDIR]
   --dvidir=DIR            dvi documentation [DOCDIR]
   --pdfdir=DIR            pdf documentation [DOCDIR]
@@ -1398,7 +1397,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of pulseaudio-genivi-mir :";;
+     short | recursive ) echo "Configuration of pulseaudio-murphy-ivi :";;
    esac
   cat <<\_ACEOF
 
@@ -1454,7 +1453,7 @@ Some influential environment variables:
 Use these variables to override the choices made by `configure' or to help
 it to find libraries and programs with nonstandard names/locations.
 
-Report bugs to <janos.f.kovacs@nokia.com>.
+Report bugs to <janos.kovacs@intel.com>.
 _ACEOF
 ac_status=$?
 fi
@@ -1517,7 +1516,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-pulseaudio-genivi-mir configure
+pulseaudio-murphy-ivi configure
 generated by GNU Autoconf 2.68
 
 Copyright (C) 2010 Free Software Foundation, Inc.
@@ -1676,9 +1675,9 @@ $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
 $as_echo "$as_me: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&2;}
     { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
-( $as_echo "## --------------------------------------- ##
-## Report this to janos.f.kovacs@nokia.com ##
-## --------------------------------------- ##"
+( $as_echo "## ------------------------------------- ##
+## Report this to janos.kovacs@intel.com ##
+## ------------------------------------- ##"
      ) | sed "s/^/$as_me: WARNING:     /" >&2
     ;;
 esac
@@ -1986,7 +1985,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by pulseaudio-genivi-mir $as_me , which was
+It was created by pulseaudio-murphy-ivi $as_me , which was
 generated by GNU Autoconf 2.68.  Invocation command line was
 
   $ $0 $@
@@ -3290,7 +3289,7 @@ fi
 
 
 # Define the identity of the package.
- PACKAGE='pulseaudio-genivi-mir'
+ PACKAGE='pulseaudio-murphy-ivi'
  VERSION=''
 
 
@@ -13661,14 +13660,10 @@ else
 fi
 
 
-PULSEAUDIO_HAS_PORTS=0
-echo -e "#include <pulsecore/pulsecore-config.h>\n #include <pulsecore/sink.h>\nint main() {\nreturn pa_sink_set_port((struct pa_sink *)0,\"\",0);\n}" | ${CC} ${CFLAGS} ${LIBPULSECORE_CFLAGS} ${LIBPULSE_CFLAGS} ${AM_LIBADD} ${LIBPULSECORE_LIBS} ${LIBPULSE_LIBS} -Wmissing-declarations -Werror -x c -c -o /dev/null - && PULSEAUDIO_HAS_PORTS=1
 
 
 
-
-
-ac_config_files="$ac_config_files Makefile src/Makefile doc/Makefile"
+ac_config_files="$ac_config_files Makefile murphy/Makefile doc/Makefile"
 
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -14245,7 +14240,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by pulseaudio-genivi-mir $as_me , which was
+This file was extended by pulseaudio-murphy-ivi $as_me , which was
 generated by GNU Autoconf 2.68.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -14296,13 +14291,13 @@ $config_files
 Configuration commands:
 $config_commands
 
-Report bugs to <janos.f.kovacs@nokia.com>."
+Report bugs to <janos.kovacs@intel.com>."
 
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-pulseaudio-genivi-mir config.status
+pulseaudio-murphy-ivi config.status
 configured by $0, generated by GNU Autoconf 2.68,
   with options \\"\$ac_cs_config\\"
 
@@ -14702,7 +14697,7 @@ do
     "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
     "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
-    "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
+    "murphy/Makefile") CONFIG_FILES="$CONFIG_FILES murphy/Makefile" ;;
     "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
 
   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
@@ -16061,7 +16056,6 @@ echo "
     LIBPULSECORE_CFLAGS:  ${LIBPULSECORE_CFLAGS}
     LIBPULSECORE_LIBS:    ${LIBPULSECORE_LIBS}
     MAJORMINOR:           ${PA_MAJORMINOR}
-    PULSEAUDIO_HAS_PORTS: ${PULSEAUDIO_HAS_PORTS}
     DBUS_CFLAGS:          ${DBUS_CFLAGS}
     DBUS_LIBS:            ${DBUS_LIBS}
     PD_SUPPORT:           ${PD_SUPPORT}
index f419928..8d77600 100644 (file)
@@ -3,11 +3,11 @@ m4_define(PAVER, regexp(FULL_PAVER, [\([0123456789.]+\).*], [\1]))
 
 AC_PREREQ(2.61)
 
-AC_INIT([pulseaudio-genivi-mir],[PAVER],[janos.f.kovacs@nokia.com])
+AC_INIT([pulseaudio-murphy-ivi],[PAVER],[janos.kovacs@intel.com])
 
 DOC_SUPPORT_INIT()
 
-AC_CONFIG_SRCDIR([src/module-genivi-mir.c])
+AC_CONFIG_SRCDIR([murphy/module-murphy-ivi.c])
 AC_CONFIG_MACRO_DIR([m4])
 AM_INIT_AUTOMAKE([foreign 1.8.5 -Wall])
 
@@ -82,16 +82,12 @@ AC_ARG_WITH(
         AS_HELP_STRING([--with-module-dir],[Directory where to install the modules to (defaults to ${LIBDIR}/pulse-${PA_MAJORMINOR}/modules/]),
         [modlibexecdir=$withval], [modlibexecdir=${LIBDIR}/pulse-${PA_MAJORMINOR}/modules])
 
-PULSEAUDIO_HAS_PORTS=0
-echo -e "#include <pulsecore/pulsecore-config.h>\n #include <pulsecore/sink.h>\nint main() {\nreturn pa_sink_set_port((struct pa_sink *)0,\"\",0);\n}" | ${CC} ${CFLAGS} ${LIBPULSECORE_CFLAGS} ${LIBPULSE_CFLAGS} ${AM_LIBADD} ${LIBPULSECORE_LIBS} ${LIBPULSE_LIBS} -Wmissing-declarations -Werror -x c -c -o /dev/null - && PULSEAUDIO_HAS_PORTS=1
-AC_SUBST(PULSEAUDIO_HAS_PORTS)
-
 
 AC_SUBST(modlibexecdir)
 
 AC_CONFIG_FILES([
        Makefile
-       src/Makefile
+       murphy/Makefile
        doc/Makefile
 ])
 AC_OUTPUT
@@ -111,7 +107,6 @@ echo "
     LIBPULSECORE_CFLAGS:  ${LIBPULSECORE_CFLAGS}
     LIBPULSECORE_LIBS:    ${LIBPULSECORE_LIBS}
     MAJORMINOR:           ${PA_MAJORMINOR}
-    PULSEAUDIO_HAS_PORTS: ${PULSEAUDIO_HAS_PORTS}
     DBUS_CFLAGS:          ${DBUS_CFLAGS}
     DBUS_LIBS:            ${DBUS_LIBS}
     PD_SUPPORT:           ${PD_SUPPORT}
index 5d860c7..15c951e 100644 (file)
@@ -1,4 +1,4 @@
-PACKAGE := genivi-mir
+PACKAGE := pulseaudio-module-murphy-ivi
 VERSION := 1.1.10
 THISDIR := fedora
 
@@ -19,7 +19,7 @@ PKGDIR   := $(PACKAGE)-$(VERSION)
 # tarball type to use (git = HEAD, current = working copy)
 type      = current
 
-all: rpms cleanup
+all: rpms #cleanup
 
 #showvar:
 #      @echo "$(var) = $($(var))"
@@ -38,9 +38,9 @@ rpms: rmtar $(SPECFILE) tarball
 
 
 cleanup:
-#      rm -fr $(TMPDIR) && \
-#      rm -f $(SPECFILE)
-#      rm -f $(TARBALL)
+       rm -fr $(TMPDIR) && \
+       rm -f $(SPECFILE)
+       rm -f $(TARBALL)
 
 # rules to patch the SPEC file and build a source tarball
 $(SPECFILE): $(SPECFILE).in
similarity index 90%
rename from fedora/genivi-mir.spec.in
rename to fedora/pulseaudio-module-murphy-ivi.spec.in
index c069dab..cd37d86 100644 (file)
@@ -1,10 +1,10 @@
 Summary: Pulseaudio module for enforcing policy decisions in the audio domain
-Name: genivi-mir
+Name: pulseaudio-module-murphy-ivi
 Version:  ##__VERSION__##
 Release: 0
 License: LGPLv2.1
 Group: System Environment/Daemons
-URL: http://meego.gitorious.org/maemo-multimedia/pulseaudio-policy-enforcement
+URL: https://github.com/otcshare/pulseaudio-module-murphy-ivi
 Source0: %{name}-%{version}.tar.gz
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
 BuildRequires: pulseaudio-module-devel
@@ -38,7 +38,7 @@ rm -f %{_libdir}/pulse-*/modules/module-*.la
 
     
 %clean
-rm -rf $RPM_BUILD_ROOT
+#rm -rf $RPM_BUILD_ROOT
 
 %post -p /sbin/ldconfig
 
diff --git a/murphy/Makefile.am b/murphy/Makefile.am
new file mode 100644 (file)
index 0000000..a97cf86
--- /dev/null
@@ -0,0 +1,19 @@
+modlibexec_LTLIBRARIES = module-murphy-ivi.la
+
+module_murphy_ivi_la_SOURCES = \
+                       module-murphy-ivi.c \
+                       tracker.c \
+                       node.c \
+                       discover.c \
+                       router.c \
+                       switch.c \
+                       audiomgr.c \
+                       dbusif.c \
+                       config.c \
+                       utils.c
+
+#AM_CFLAGS = -pedantic
+
+module_murphy_ivi_la_LDFLAGS = -module -avoid-version -Wl,--no-undefined
+module_murphy_ivi_la_LIBADD = $(AM_LIBADD) $(DBUS_LIBS) $(LIBPULSE_LIBS) $(PULSEDEVEL_LIBS)
+module_murphy_ivi_la_CFLAGS = $(AM_CFLAGS) $(DBUS_CFLAGS) $(LIBPULSE_CFLAGS) $(PULSEDEVEL_CFLAGS)
similarity index 99%
rename from src/audiomgr.c
rename to murphy/audiomgr.c
index fe2bd33..b234358 100644 (file)
@@ -337,7 +337,7 @@ void pa_audiomgr_connect(struct userdata *u, am_connect_data *cd)
         (to   = pa_hashmap_get(am->nodes, hash_key(mir_output, cd->sink))))
     {
         pa_log_debug("routing '%s' => '%s'", from->amname, to->amname);
-        if (!mir_switch_setup_link(u, from, to, FALSE))
+        if (!mir_switch_setup_link(u, from, to))
             err = E_NOT_POSSIBLE;
     }
     else {
similarity index 100%
rename from src/audiomgr.h
rename to murphy/audiomgr.h
similarity index 100%
rename from src/config.c
rename to murphy/config.c
similarity index 100%
rename from src/config.h
rename to murphy/config.h
similarity index 100%
rename from src/dbusif.c
rename to murphy/dbusif.c
similarity index 100%
rename from src/dbusif.h
rename to murphy/dbusif.h
similarity index 98%
rename from src/discover.c
rename to murphy/discover.c
index 6713b5e..6c42c1d 100644 (file)
@@ -233,6 +233,7 @@ void pa_discover_profile_changed(struct userdata *u, pa_card *card)
 
 void pa_discover_add_sink(struct userdata *u, pa_sink *sink, pa_bool_t route)
 {
+    pa_module      *module;
     pa_discover    *discover;
     mir_node       *node;
     pa_card        *card;
@@ -245,6 +246,8 @@ void pa_discover_add_sink(struct userdata *u, pa_sink *sink, pa_bool_t route)
     pa_assert(sink);
     pa_assert_se((discover = u->discover));
 
+    module = sink->module;
+
     if ((card = sink->card)) {
         if (!(key = node_key_from_card(u, mir_output, sink, buf, sizeof(buf))))
             return;
@@ -268,12 +271,13 @@ void pa_discover_add_sink(struct userdata *u, pa_sink *sink, pa_bool_t route)
             }
         }
     }
-    else {
+    else if (!module || !pa_streq(module, "module-combine-sink")) {
         memset(&data, 0, sizeof(data));
         data.key = pa_xstrdup(sink->name);
         data.direction = mir_output;
         data.implement = mir_device;
         data.channels  = sink->channel_map.channels;
+        data.muxidx    = PA_IDXSET_INVALID;
 
         if (sink == pa_utils_get_null_sink(u)) {
             data.visible = FALSE;
@@ -434,12 +438,15 @@ void pa_discover_preroute_sink_input(struct userdata *u,
 
 void pa_discover_add_sink_input(struct userdata *u, pa_sink_input *sinp)
 {
+    static const char combine_pattern[] = "Simultaneous output on ";
+
     pa_proplist    *pl;
     pa_discover    *discover;
     mir_node        data;
     mir_node       *node;
     mir_node       *sinknod;
     char           *name;
+    const char     *media;
     mir_node_type   type;
     char            key[256];
     pa_bool_t       created;
@@ -449,12 +456,19 @@ void pa_discover_add_sink_input(struct userdata *u, pa_sink_input *sinp)
     pa_assert_se((discover = u->discover));
     pa_assert_se((pl = sinp->proplist));
 
+
+    if ((media = pa_proplist_gets(sinp->proplist, PA_PROP_MEDIA_NAME)) &&
+        !strncmp(media, combine_pattern, sizeof(combine_pattern)-1))
+    {
+        pa_log_debug("handling new combine stream ...");
+        return;
+    }
+
     name = pa_utils_get_sink_input_name(sinp);
-    type = get_stream_routing_class(pl);
 
     pa_log_debug("dealing with new stream '%s'", name);
 
-    if (type == mir_node_type_unknown) {
+    if ((type = get_stream_routing_class(pl)) == mir_node_type_unknown) {
         if ((type = guess_stream_node_type(pl)) == mir_node_type_unknown) {
             pa_log_debug("cant find stream class for '%s'. "
                          "Leaving it alone", name);
@@ -463,7 +477,7 @@ void pa_discover_add_sink_input(struct userdata *u, pa_sink_input *sinp)
 
         set_stream_routing_properties(pl, type, NULL);
 
-        /* make some post-routing here */
+        /* if needed, make some post-routing here */
     }
 
     /* we need to add this to main hashmap as that is used for loop
@@ -568,6 +582,7 @@ static void handle_alsa_card(struct userdata *u, pa_card *card)
     data.implement = mir_device;
     data.paidx = PA_IDXSET_INVALID;
     data.stamp = pa_utils_get_stamp();
+    data.muxidx = PA_IDXSET_INVALID;
 
     cnam = pa_utils_get_card_name(card);
     udd  = pa_proplist_gets(card->proplist, "module-udev-detect.discovered");
@@ -621,6 +636,7 @@ static void handle_bluetooth_card(struct userdata *u, pa_card *card)
     data.amname = amname;
     data.amdescr = (char *)cdescr;
     data.pacard.index = card->index;
+    data.muxidx = PA_IDXSET_INVALID;
     data.stamp = pa_utils_get_stamp();
 
     cnam = pa_utils_get_card_name(card);
similarity index 100%
rename from src/discover.h
rename to murphy/discover.h
similarity index 100%
rename from src/list.h
rename to murphy/list.h
diff --git a/murphy/module-murphy-ivi-symdef.h b/murphy/module-murphy-ivi-symdef.h
new file mode 100644 (file)
index 0000000..0f7b9f6
--- /dev/null
@@ -0,0 +1,25 @@
+#ifndef foomurphyivisymdeffoo
+#define foomurphyivisymdeffoo
+
+#include <pulsecore/core.h>
+#include <pulsecore/module.h>
+#include <pulsecore/macro.h>
+
+#define pa__init module_murphy_ivi_LTX_pa__init
+#define pa__done module_murphy_ivi_LTX_pa__done
+#define pa__get_author module_murphy_ivi_LTX_pa__get_author
+#define pa__get_description module_murphy_ivi_LTX_pa__get_description
+#define pa__get_usage module_murphy_ivi_LTX_pa__get_usage
+#define pa__get_version module_murphy_ivi_LTX_pa__get_version
+#define pa__load_once module_murphy_ivi_LTX_pa__load_once
+
+int pa__init(pa_module *m);
+void pa__done(pa_module *m);
+
+const char* pa__get_author(void);
+const char* pa__get_description(void);
+const char* pa__get_usage(void);
+const char* pa__get_version(void);
+pa_bool_t pa__load_once(void);
+
+#endif
similarity index 96%
rename from src/module-genivi-mir.c
rename to murphy/module-murphy-ivi.c
index 80f9b31..b833ef3 100644 (file)
@@ -25,7 +25,7 @@
 #include <pulsecore/modargs.h>
 #include <pulsecore/log.h>
 
-#include "module-genivi-mir-symdef.h"
+#include "module-murphy-ivi-symdef.h"
 #include "userdata.h"
 #include "tracker.h"
 #include "discover.h"
 #include "utils.h"
 
 #ifndef DEFAULT_CONFIG_FILE
-#define DEFAULT_CONFIG_FILE "genivi-mir.conf"
+#define DEFAULT_CONFIG_FILE "murphy-ivi.conf"
 #endif
 
 
 PA_MODULE_AUTHOR("Janos Kovacs");
-PA_MODULE_DESCRIPTION("GenIVI and Murphy compliant audio policy module");
+PA_MODULE_DESCRIPTION("Murphy and GenIVI compliant audio policy module");
 PA_MODULE_VERSION(PACKAGE_VERSION);
 PA_MODULE_LOAD_ONCE(TRUE);
 PA_MODULE_USAGE(
similarity index 99%
rename from src/node.c
rename to murphy/node.c
index 0d605cb..1c207a3 100644 (file)
@@ -101,6 +101,7 @@ int mir_node_print(mir_node *node, char *buf, int len)
     PRINT("   pacard.profile: '%s'",  node->pacard.profile ?
                                       node->pacard.profile : "");
     PRINT("   paport        : '%s'",  node->paport ? node->paport : "");
+    PRINT("   muxidx        : %u"  ,  node->muxidx);
     PRINT("   stamp         : %u"  ,  node->stamp);
 
 #undef PRINT
similarity index 96%
rename from src/node.h
rename to murphy/node.h
index 65bb13b..d7e0412 100644 (file)
@@ -103,6 +103,8 @@ struct mir_node {
     uint32_t        paidx;    /**< sink|source|sink_input|source_output index*/
     pa_node_card    pacard;   /**< pulse card related data, if any  */
     char           *paport;   /**< sink or source port if applies */
+    uint32_t        muxidx;   /**< for multiplexable input streams the index
+                                   of the combine module */
     mir_dlist       rtentries;/**< for devices: listhead of nodchain,
                                    for streams: priority link (head is in
                                                                pa_router )
similarity index 98%
rename from src/router.c
rename to murphy/router.c
index 398e2b7..c193e67 100644 (file)
@@ -270,16 +270,16 @@ mir_node *mir_router_make_prerouting(struct userdata *u, mir_node *data)
     MIR_DLIST_FOR_EACH_BACKWARD(mir_node,rtentries, source, &router->nodlist) {
         if (priority >= node_priority(u, source)) {
             if ((target = route_stream(u, data)))
-                mir_switch_setup_link(u, NULL, target, TRUE);
+                mir_switch_setup_link(u, NULL, target);
             done = TRUE;
         }
 
         if ((sink = route_stream(u, source)))
-            mir_switch_setup_link(u, source, sink, FALSE);
+            mir_switch_setup_link(u, source, sink);
     }    
 
     if (!done && (target = route_stream(u, data)))
-        mir_switch_setup_link(u, NULL, target, TRUE);
+        mir_switch_setup_link(u, NULL, target);
 
     return target;
 }
@@ -303,7 +303,7 @@ void mir_router_make_routing(struct userdata *u)
 
     MIR_DLIST_FOR_EACH_BACKWARD(mir_node,rtentries, source, &router->nodlist) {
         if ((sink = route_stream(u, source)))
-            mir_switch_setup_link(u, source, sink, FALSE);
+            mir_switch_setup_link(u, source, sink);
     }    
 
     ongoing_routing = FALSE;
similarity index 100%
rename from src/router.h
rename to murphy/router.h
similarity index 57%
rename from src/switch.c
rename to murphy/switch.c
index 08994e3..1b16ec6 100644 (file)
 #include "node.h"
 
 
-pa_bool_t mir_switch_setup_link(struct userdata *u,
-                                mir_node *from,
-                                mir_node *to,
-                                pa_bool_t prepare_only)
+pa_bool_t set_profile(struct userdata *, mir_node *);
+
+
+pa_bool_t mir_switch_setup_link(struct userdata *u,mir_node *from,mir_node *to)
 {
     pa_core         *core;
     pa_card         *card;
@@ -32,31 +32,9 @@ pa_bool_t mir_switch_setup_link(struct userdata *u,
     pa_assert(to);
     pa_assert_se((core = u->core));
 
-
-    if (to->type == mir_bluetooth_a2dp || to->type == mir_bluetooth_sco) {
-        if (!(card = pa_idxset_get_by_index(core->cards, to->pacard.index))) {
-            pa_log("can't find card for '%s'", to->amname);
-            return FALSE;
-        }
-
-        prof = card->active_profile;
-    
-        if (!pa_streq(to->pacard.profile, prof->name)) {
-            pa_log_debug("changing profile '%s' => '%s'",
-                         prof->name, to->pacard.profile);
-
-            if (u->state.profile) {
-                pa_log("nested profile setting is not allowed. won't change "
-                       "'%s' => '%s'", prof->name, to->pacard.profile);
-                return FALSE;
-            }
-
-            u->state.profile = to->pacard.profile;
-
-            pa_card_set_profile(card, to->pacard.profile, FALSE);
-
-            u->state.profile = NULL;            
-        }
+    if (!set_profile(u, to)) {
+        pa_log("can't route to '%s'", to->amname);
+        return FALSE;
     }
 
     if (to->paidx == PA_IDXSET_INVALID) {
@@ -69,9 +47,14 @@ pa_bool_t mir_switch_setup_link(struct userdata *u,
         return FALSE;
     }
 
-    if (prepare_only)
+    if (!from)
         return TRUE;
 
+    if (!set_profile(u, from)) {
+        pa_log("can't route from '%s'", from->amname);
+        return FALSE;
+    }
+
     if (!from || from->paidx == PA_IDXSET_INVALID) {
         pa_log_debug("can't route '%s': no sink-input", to->amname);
         return FALSE;
@@ -89,6 +72,53 @@ pa_bool_t mir_switch_setup_link(struct userdata *u,
 }
 
 
+pa_bool_t set_profile(struct userdata *u, mir_node *node)
+{
+    pa_core         *core;
+    pa_card         *card;
+    pa_card_profile *prof;
+
+    pa_assert(u);
+    pa_assert(node);
+    pa_assert_se((core = u->core));
+
+    if (node->implement != mir_device)
+        return TRUE;
+
+    if (node->type == mir_bluetooth_a2dp ||
+        node->type == mir_bluetooth_sco)
+    {
+        card = pa_idxset_get_by_index(core->cards, node->pacard.index);
+
+        if (!card) {
+            pa_log("can't find card for '%s'", node->amname);
+            return FALSE;
+        }
+
+        pa_assert_se(prof = card->active_profile);
+    
+        if (!pa_streq(node->pacard.profile, prof->name)) {
+            pa_log_debug("changing profile '%s' => '%s'",
+                         prof->name, node->pacard.profile);
+
+            if (u->state.profile) {
+                pa_log("nested profile setting is not allowed. won't change "
+                       "'%s' => '%s'", prof->name, node->pacard.profile);
+                return FALSE;
+            }
+
+            u->state.profile = node->pacard.profile;
+
+            pa_card_set_profile(card, node->pacard.profile, FALSE);
+
+            u->state.profile = NULL;            
+        }
+    }
+
+    return TRUE;
+}
+
+
 /*
  * Local Variables:
  * c-basic-offset: 4
similarity index 83%
rename from src/switch.h
rename to murphy/switch.h
index deb4b64..b9dd484 100644 (file)
@@ -6,8 +6,7 @@
 #include "userdata.h"
 
 
-pa_bool_t mir_switch_setup_link(struct userdata *, mir_node *, mir_node *,
-                                pa_bool_t);
+pa_bool_t mir_switch_setup_link(struct userdata *, mir_node *, mir_node *);
 
 
 #endif  /* foomirswitchfoo */
similarity index 100%
rename from src/tracker.c
rename to murphy/tracker.c
similarity index 100%
rename from src/tracker.h
rename to murphy/tracker.h
similarity index 100%
rename from src/userdata.h
rename to murphy/userdata.h
similarity index 100%
rename from src/utils.c
rename to murphy/utils.c
similarity index 100%
rename from src/utils.h
rename to murphy/utils.h
diff --git a/src/Makefile.am b/src/Makefile.am
deleted file mode 100644 (file)
index 63f7c0a..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-modlibexec_LTLIBRARIES = module-genivi-mir.la
-
-module_genivi_mir_la_SOURCES = \
-                       module-genivi-mir.c \
-                       tracker.c \
-                       node.c \
-                       discover.c \
-                       router.c \
-                       switch.c \
-                       audiomgr.c \
-                       dbusif.c \
-                       config.c \
-                       utils.c
-
-#AM_CFLAGS = -pedantic
-
-module_genivi_mir_la_LDFLAGS = -module -avoid-version -Wl,--no-undefined
-module_genivi_mir_la_LIBADD = $(AM_LIBADD) $(DBUS_LIBS) $(LIBPULSE_LIBS) $(PULSEDEVEL_LIBS)
-module_genivi_mir_la_CFLAGS = $(AM_CFLAGS) $(DBUS_CFLAGS) $(LIBPULSE_CFLAGS) $(PULSEDEVEL_CFLAGS) -DPULSEAUDIO_HAS_PORTS=$(PULSEAUDIO_HAS_PORTS)
diff --git a/src/module-genivi-mir-symdef.h b/src/module-genivi-mir-symdef.h
deleted file mode 100644 (file)
index ba8fbc9..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifndef foogenivimirsymdeffoo
-#define foogenivimirsymdeffoo
-
-#include <pulsecore/core.h>
-#include <pulsecore/module.h>
-#include <pulsecore/macro.h>
-
-#define pa__init module_genivi_mir_LTX_pa__init
-#define pa__done module_genivi_mir_LTX_pa__done
-#define pa__get_author module_genivi_mir_LTX_pa__get_author
-#define pa__get_description module_genivi_mir_LTX_pa__get_description
-#define pa__get_usage module_genivi_mir_LTX_pa__get_usage
-#define pa__get_version module_genivi_mir_LTX_pa__get_version
-#define pa__load_once module_genivi_mir_LTX_pa__load_once
-
-int pa__init(pa_module *m);
-void pa__done(pa_module *m);
-
-const char* pa__get_author(void);
-const char* pa__get_description(void);
-const char* pa__get_usage(void);
-const char* pa__get_version(void);
-pa_bool_t pa__load_once(void);
-
-#endif