[proaudio] [2400] build jack-1.9.9.5 with with no-self-connect patch

[ Thread Index | Date Index | More lists.tuxfamily.org/proaudio Archives ]


Revision: 2400
Author:   nedko
Date:     2013-01-20 19:40:11 +0100 (Sun, 20 Jan 2013)
Log Message:
-----------
build jack-1.9.9.5 with with no-self-connect patch

The no-self-connect patch adds an option (dsabled by default)
to restrict app self-connect ability. This is useful for
jack session managers (e.g. ladish)

Package-Manager: portage-2.1.11.31

Modified Paths:
--------------
    trunk/overlays/proaudio/media-sound/jack-audio-connection-kit/ChangeLog
    trunk/overlays/proaudio/media-sound/jack-audio-connection-kit/Manifest
    trunk/overlays/proaudio/media-sound/jack-audio-connection-kit/jack-audio-connection-kit-1.9.9.5.ebuild

Added Paths:
-----------
    trunk/overlays/proaudio/media-sound/jack-audio-connection-kit/files/jack2-no-self-connect-1.9.9.5.patch

Modified: trunk/overlays/proaudio/media-sound/jack-audio-connection-kit/ChangeLog
===================================================================
--- trunk/overlays/proaudio/media-sound/jack-audio-connection-kit/ChangeLog	2013-01-20 18:18:13 UTC (rev 2399)
+++ trunk/overlays/proaudio/media-sound/jack-audio-connection-kit/ChangeLog	2013-01-20 18:40:11 UTC (rev 2400)
@@ -3,6 +3,11 @@
 # $Header: $
 
   20 Jan 2013; Nedko Arnaudov <nedko@xxxxxxxxxxxxx>
+  jack-audio-connection-kit-1.9.9.5.ebuild,
+  +files/jack2-no-self-connect-1.9.9.5.patch:
+  build with with no-self-connect patch
+
+  20 Jan 2013; Nedko Arnaudov <nedko@xxxxxxxxxxxxx>
   jack-audio-connection-kit-1.9.9.5.ebuild:
   rename the "32bit" use flag to documented "mixed" use flag
 

Modified: trunk/overlays/proaudio/media-sound/jack-audio-connection-kit/Manifest
===================================================================
--- trunk/overlays/proaudio/media-sound/jack-audio-connection-kit/Manifest	2013-01-20 18:18:13 UTC (rev 2399)
+++ trunk/overlays/proaudio/media-sound/jack-audio-connection-kit/Manifest	2013-01-20 18:40:11 UTC (rev 2400)
@@ -1,12 +1,13 @@
 AUX jack-audio-connection-kit-2.9999-link-fix.patch 383 SHA256 32bdd416a1fb6586c361967c4095f75155c71c6bdc99a590b302e96c8e7690f9 SHA512 7c338195d67e6d6d412d6cd5f604a5e0254cdb5df192e874460965e9d61817f19e700ce2ae2a5f046d2b8c14b3b003e3dc8657f26511237ccc856fe2a06c3184 WHIRLPOOL 81f4894606f5876f186c6738bf8d6999b16b414bc6d294e0a0a52af517f5f16cce6646232c9efd1b24fe26de1534528e23d67ddb28298bee3be87fd56e002fbc
 AUX jack-audio-connection-kit-freebsd.patch 496 SHA256 7834f5ec198f8e69e2ac119fc2c4ee349ed7e38d003e473fcb41257e7b605df8 SHA512 7c0cf60ddd3d07e12e036082ab10299308d1e112c6190d008a739ab0374c8ecf9e2dcb703055a58f8098e5187044e2351a1786271cecdeae23cbed72e6d68cd6 WHIRLPOOL 3d11baf0f4ebe0613c378d79efcb6b81f94c28e9070471b9a496dda5f0ba90a2eac1e789a621d7ec5d109f018a7f67b0adbd53bbce9e059f3e18b04ca4fb7cd1
 AUX jack-audio-connection-kit-sparc-cpuinfo.patch 659 SHA256 256d48109d32ce8af89042401508392fbb90c499d4cf8b056104dc1a47522fe5 SHA512 c5964413c99fb1dd20dfe52dd40f857dab1cef123b26f74500e2f5607eda870b563595d39c4e4e0684428971e7295c847253d045b2d9ba0183f358630cfa9888 WHIRLPOOL 01d88bfce0394628fab10c48a4b80f0a025b741c5785f05bd22658fd95594e472439f569a450043cf7cc53700149d0d8b785bb7adc74711474fd3f6bcbc6d66f
+AUX jack2-no-self-connect-1.9.9.5.patch 19308 SHA256 4e7fa1fb68025f68df7fe8c690fb8253b1f810a72f4cb72d34451126f14028e5 SHA512 35c9404087f4f3a93923b70dc2d7fa51fa70b5f9c877818cc8de64cf2121a015eb2247e2babc0b2edee1a65fd3d076f36d80b894ea38c6ad959ab14d1d4efe38 WHIRLPOOL e06d2b651cef8206056bd139698a420df489c68148f4063c674442ec482e06af4701f7f72fc6d17c4733d54a7715e44882ccbcc17019f168229b16e1d9b5daa6
 DIST jack-1.9.9.5.tar.bz2 4673914 SHA256 65ef5acceabb1ebd4ac8c437be47a522292e3c2a1f7bfa656de7392d9351ebbd SHA512 173a10943c98cb17f0041216cc24ce03d5e147f27be121fdf66c4e9d21ba8bf125a1749b985cacffb075618d92025231eb047c754d33d777275373d010a85e27 WHIRLPOOL c6ec9ab4ed29ad67364b4ea3c74bc0bcfb9590fe778820be6a9c5247ecb7f6dc3d894599ce6ac7c27a4243fd77308b4345c2479d1567927247df233165bd6641
 DIST jack-audio-connection-kit-0.121.3-dbus.patch 337061 SHA256 da12003ed4528a09d8109ecc7e75f539f0173b23832a1d993800473f1f1d25fd SHA512 9be280a24d59d35bab07da75be407f0790fd36657bfb54d24522337f2a2bc15d6e8a9f88347ff3215ed3e6b32ab827c4e203f5435fefe30c456d638169524192 WHIRLPOOL 37b6a58c5103ff23e606e3dfd0b5ec2630b86f88ddb964635050555e64aa4ab687205e8e29add29659f36866d036098bb7d6128e230349adfd096c06cc641709
 DIST jack-audio-connection-kit-0.121.3.tar.gz 1083545 SHA256 b7095d3deabeecd19772b37241e89c6c79de6afd6c031ba7567513cfe51beafa SHA512 57323393d5209baefe73cc0cd9a0e818b1cfd260cf9aa36cd6ad800252e22e3ddb7fc46649c54b8e840696878147c2d06c8d39fd7300b5bb92aeb69f44ed710f WHIRLPOOL a256cfb7c3546cb06d6003313802b02812d8da9c13671be9b0341a10442cd348a8b3f7fe65e8d27cc47b4e29ded799fa6cc0efa51d81d01f342c7c8eefbc9c55
 EBUILD jack-audio-connection-kit-0.121.3.ebuild 2192 SHA256 8a7d2dc537b34e8b745d7d90a72ccc0a2734ca68ded2cb33eb4cfaa0cc774ab0 SHA512 3602ed78dfb961454d368da61c4bf87e000b84decb65869b6ff092dc97a5897dc57d507d338e0941ef6453668fe388ef952e4c3adf7bb225a84e56617c035e77 WHIRLPOOL 05c9bfb4c811ea68257ceb57aaa9fa0280d7a0b7c7d3c8628c3da5e0a874479e609523467f9393615c2a575e96482a2c67ef626211e7d0088e09aa2bdbe0e3f7
-EBUILD jack-audio-connection-kit-1.9.9.5.ebuild 1519 SHA256 c7eebd4dad05c92aa74599d52fca3d32bde8a37f203315f1b6f672cd641c269f SHA512 f04006b702897451c918e583b5da12e1ebef7e58610a81987515a7a0ff1517de7c09ef0e1b19cec0b5c9ff18af8cbfa6112cd599031329cd6cf9de8ce649732f WHIRLPOOL 25618bf29a84af69e95209b46040444e9e68eed2b03a162c1ab547d241c141b65f5cab4fec832d70b7b0070ad8248b3bc41b241071edfe95b364c51420434700
+EBUILD jack-audio-connection-kit-1.9.9.5.ebuild 1603 SHA256 bc17e36e72d82acc1984034be729684144dc43e96d0ff2e82dfd4df0b7c87bd1 SHA512 e296a856aa6bf61eedc38e521298e82970f094d343eb6de7cf38b8988528dcf87b2703876db02be0d899a0dddeb8e5e3d1c078a2cb0535c011b04c987ad107e1 WHIRLPOOL 377f2afd7dd1e1f85f879115643efe0206fffb02b3fffc524ec66693ef60fdfe9e7daeeb7b1b6dff3a1739b181ebc22dc45d5330222f2e6e6fcea11d1f99e665
 EBUILD jack-audio-connection-kit-1.9999.ebuild 2626 SHA256 fc5bc080ec7839bf1806e70c36cd0c07314ea236d70fbc8d4226ec3ea204aa60 SHA512 d85ee3772275d3e3d84dc71b8e73afa19ebd0f87d200ece991c0250049ebc66565610d5047af729356232dfdf04e1aa0b4ce715f51e1db284bc0099c1f774a41 WHIRLPOOL f3e641c8c3825b002e0bc12a13b39f5f65bef39d0b88ac0f719020227f520ca9fa76fd602b4a8ee6919f3935b897fbbdce799561e37cd6e591dfb27b02dd87ef
 EBUILD jack-audio-connection-kit-2.9999.ebuild 1727 SHA256 ae20eafdfd7381dc7a1569aa5f54e3bd4bc20c72d4da6cc0965cd77c9f4f19b6 SHA512 6c8580fb93863dfb5fc94b330a9f731b1fa42ef6094b7dc62387afad19dcffc205f719c0cc297e9f85d7ec26ace7dc9b91e0d8a49502584af94855e85d32afba WHIRLPOOL 8e60f6ad6a6f8d11a02e73c987732d9aaa5fe427ab5ef4e601cfaa0f71d46279123cbb43704112bec696a65e4d080fdf7fa1450410e88d698b7541d654031587
-MISC ChangeLog 10451 SHA256 c06e2b7d39a35e3b9a769318fdd68a36c23f96b50ea1630e31c4a38c97170a70 SHA512 bff6b7dcfd8c6855fccc625e4a18f8400a002de8f326844e3f5853e32381c7fbbfec8a10637768d5a22a7f7d27559e52e56aa4480dc7522cd54e0f2b36a334a5 WHIRLPOOL 87e0c45ac5955d156214847dcb8c831c2bd9338ffdc9917577fceceea83582fccc4fc9d2ed3519651a79f7d63adb99a8a3afed13bb7b739d2e2f941b95275d10
+MISC ChangeLog 10634 SHA256 774bbc72251373d98d78b29a1b7c7228d9a81826dd26377a83b847c95c5a509d SHA512 d0529caccba99144eea3d28028179126113178b4981e3b97e072811432df656973b3ff611e6bc110f8c7dd799379a01d8c6c0f745bbad07809ca90f717520fb6 WHIRLPOOL 5e4ce29136d1db0fb1375795f9789d4d3977293d2adcc1100c0314cd41e01568b02e26fbb91bed627551fd8e01e0960785c66b5f20e0731eb36e8c89cb0c2cf8
 MISC metadata.xml 1022 SHA256 061b2aae6c2a75151431640f599f946468dd2dc9ab51fefecacb43c6ef27b97d SHA512 58de0878c32efb5fb254c2c11183758aaca65558f59a8298f08d6ec0b52c04cd89cd217a5884a091d86e40ed58c73b9ad253f5647baca0450c22a85a87f93da4 WHIRLPOOL 11b571d09e1c1f86e3e2c277f5423e56e22bfcd25db6b10b57752bb0de10d4b022d5024d9cc2d7d2cecef5bf15656d020387f6d1f14c186bf64d0e69eb9274c8

Added: trunk/overlays/proaudio/media-sound/jack-audio-connection-kit/files/jack2-no-self-connect-1.9.9.5.patch
===================================================================
--- trunk/overlays/proaudio/media-sound/jack-audio-connection-kit/files/jack2-no-self-connect-1.9.9.5.patch	                        (rev 0)
+++ trunk/overlays/proaudio/media-sound/jack-audio-connection-kit/files/jack2-no-self-connect-1.9.9.5.patch	2013-01-20 18:40:11 UTC (rev 2400)
@@ -0,0 +1,470 @@
+diff --git a/common/JackConstants.h b/common/JackConstants.h
+index 59f6b6d..eb97a9a 100644
+--- a/common/JackConstants.h
++++ b/common/JackConstants.h
+@@ -82,4 +82,6 @@
+ #define EMPTY   0xFFFD
+ #define FREE	0xFFFC
+ 
++#define JACK_DEFAULT_SELF_CONNECT_MODE JackSelfConnectIgnoreAll
++
+ #endif
+diff --git a/common/JackControlAPI.cpp b/common/JackControlAPI.cpp
+index 3cc1141..c4d8168 100644
+--- a/common/JackControlAPI.cpp
++++ b/common/JackControlAPI.cpp
+@@ -47,6 +47,13 @@
+ 
+ using namespace Jack;
+ 
++#define SELF_CONNECT_MODE_ALLOW_CHAR                  ' '
++#define SELF_CONNECT_MODE_FAIL_EXTERNAL_ONLY_CHAR     'E'
++#define SELF_CONNECT_MODE_IGNORE_EXTERNAL_ONLY_CHAR   'e'
++#define SELF_CONNECT_MODE_FAIL_ALL_CHAR               'A'
++#define SELF_CONNECT_MODE_IGNORE_ALL_CHAR             'a'
++#define SELF_CONNECT_MODES_COUNT              5
++
+ struct jackctl_server
+ {
+     JSList * drivers;
+@@ -94,6 +101,12 @@ struct jackctl_server
+     /* bool, synchronous or asynchronous engine mode */
+     union jackctl_parameter_value sync;
+     union jackctl_parameter_value default_sync;
++
++    /* char enum, self connect mode mode */
++    union jackctl_parameter_value self_connect_mode;
++    union jackctl_parameter_value default_self_connect_mode;
++    jack_driver_param_value_enum_t self_connect_mode_possible_values[SELF_CONNECT_MODES_COUNT];
++    jack_driver_param_constraint_desc_t self_connect_mode_constraint;
+ };
+ 
+ struct jackctl_driver
+@@ -869,6 +882,40 @@ SERVER_EXPORT jackctl_server_t * jackctl_server_create(
+         goto fail_free_parameters;
+     }
+ 
++    server_ptr->self_connect_mode_constraint.flags = JACK_CONSTRAINT_FLAG_STRICT | JACK_CONSTRAINT_FLAG_FAKE_VALUE;
++    server_ptr->self_connect_mode_constraint.constraint.enumeration.count = SELF_CONNECT_MODES_COUNT;
++    server_ptr->self_connect_mode_constraint.constraint.enumeration.possible_values_array = server_ptr->self_connect_mode_possible_values;
++
++    server_ptr->self_connect_mode_possible_values[0].value.c = SELF_CONNECT_MODE_ALLOW_CHAR;
++    strcpy(server_ptr->self_connect_mode_possible_values[0].short_desc, "Don't restrict self connect requests");
++
++    server_ptr->self_connect_mode_possible_values[1].value.c = SELF_CONNECT_MODE_FAIL_EXTERNAL_ONLY_CHAR ;
++    strcpy(server_ptr->self_connect_mode_possible_values[1].short_desc, "Fail self connect requests to external ports only");
++
++    server_ptr->self_connect_mode_possible_values[2].value.c = SELF_CONNECT_MODE_IGNORE_EXTERNAL_ONLY_CHAR;
++    strcpy(server_ptr->self_connect_mode_possible_values[2].short_desc, "Ignore self connect requests to external ports only");
++
++    server_ptr->self_connect_mode_possible_values[3].value.c = SELF_CONNECT_MODE_FAIL_ALL_CHAR;
++    strcpy(server_ptr->self_connect_mode_possible_values[3].short_desc, "Fail all self connect requests");
++
++    server_ptr->self_connect_mode_possible_values[4].value.c = SELF_CONNECT_MODE_IGNORE_ALL_CHAR;
++    strcpy(server_ptr->self_connect_mode_possible_values[4].short_desc, "Ignore all self connect requests");
++
++    value.c = SELF_CONNECT_MODE_ALLOW_CHAR;
++    if (jackctl_add_parameter(
++            &server_ptr->parameters,
++            "self-connect-mode",
++            "Self connect mode.",
++            "Whether JACK clients are allowed to connect their own ports",
++            JackParamChar,
++            &server_ptr->self_connect_mode,
++            &server_ptr->default_self_connect_mode,
++            value,
++            &server_ptr->self_connect_mode_constraint) == NULL)
++    {
++        goto fail_free_parameters;
++    }
++
+     JackServerGlobals::on_device_acquire = on_device_acquire;
+     JackServerGlobals::on_device_release = on_device_release;
+ 
+@@ -953,6 +1000,7 @@ jackctl_server_open(
+     jackctl_server *server_ptr,
+     jackctl_driver *driver_ptr)
+ {
++    JackSelfConnectMode self_connect_mode;
+     JSList * paramlist = NULL;
+ 
+     try {
+@@ -986,6 +1034,27 @@ jackctl_server_open(
+             server_ptr->client_timeout.i = 500; /* 0.5 sec; usable when non realtime. */
+         }
+ 
++        switch (server_ptr->self_connect_mode.c)
++        {
++        case SELF_CONNECT_MODE_ALLOW_CHAR:
++            self_connect_mode = JackSelfConnectAllow;
++            break;
++        case SELF_CONNECT_MODE_FAIL_EXTERNAL_ONLY_CHAR:
++            self_connect_mode = JackSelfConnectFailExternalOnly;
++            break;
++        case SELF_CONNECT_MODE_IGNORE_EXTERNAL_ONLY_CHAR:
++            self_connect_mode = JackSelfConnectIgnoreExternalOnly;
++            break;
++        case SELF_CONNECT_MODE_FAIL_ALL_CHAR:
++            self_connect_mode = JackSelfConnectFailAll;
++            break;
++        case SELF_CONNECT_MODE_IGNORE_ALL_CHAR:
++            self_connect_mode = JackSelfConnectIgnoreAll;
++            break;
++        default:
++            self_connect_mode = JACK_DEFAULT_SELF_CONNECT_MODE;
++        }
++
+         /* check port max value before allocating server */
+         if (server_ptr->port_max.ui > PORT_NUM_MAX) {
+             jack_error("Jack server started with too much ports %d (when port max can be %d)", server_ptr->port_max.ui, PORT_NUM_MAX);
+@@ -1002,6 +1071,7 @@ jackctl_server_open(
+             server_ptr->port_max.ui,
+             server_ptr->verbose.b,
+             (jack_timer_type_t)server_ptr->clock_source.ui,
++            self_connect_mode,
+             server_ptr->name.str);
+         if (server_ptr->engine == NULL)
+         {
+diff --git a/common/JackEngine.cpp b/common/JackEngine.cpp
+index 43b50b3..5bdb5b5 100644
+--- a/common/JackEngine.cpp
++++ b/common/JackEngine.cpp
+@@ -38,13 +38,15 @@ namespace Jack
+ 
+ JackEngine::JackEngine(JackGraphManager* manager,
+                        JackSynchro* table,
+-                       JackEngineControl* control) 
++                       JackEngineControl* control,
++                       JackSelfConnectMode self_connect_mode)
+                     : JackLockAble(control->fServerName), 
+                     fSignal(control->fServerName)
+ {
+     fGraphManager = manager;
+     fSynchroTable = table;
+     fEngineControl = control;
++    fSelfConnectMode = self_connect_mode;
+     for (int i = 0; i < CLIENT_NUM; i++) {
+         fClientTable[i] = NULL;
+     }
+@@ -816,10 +818,10 @@ int JackEngine::ClientDeactivate(int refnum)
+ 
+     // First disconnect all ports
+     for (int i = 0; (i < PORT_NUM_FOR_CLIENT) && (input_ports[i] != EMPTY); i++) {
+-        PortDisconnect(refnum, input_ports[i], ALL_PORTS);
++        PortDisconnect(-1, input_ports[i], ALL_PORTS);
+     }
+     for (int i = 0; (i < PORT_NUM_FOR_CLIENT) && (output_ports[i] != EMPTY); i++) {
+-        PortDisconnect(refnum, output_ports[i], ALL_PORTS);
++        PortDisconnect(-1, output_ports[i], ALL_PORTS);
+     }
+ 
+     // Then issue port registration notification
+@@ -875,7 +877,7 @@ int JackEngine::PortUnRegister(int refnum, jack_port_id_t port_index)
+     JackClientInterface* client = fClientTable[refnum];
+ 
+     // Disconnect port ==> notification is sent
+-    PortDisconnect(refnum, port_index, ALL_PORTS);
++    PortDisconnect(-1, port_index, ALL_PORTS);
+ 
+     if (fGraphManager->ReleasePort(refnum, port_index) == 0) {
+         if (client->GetClientControl()->fActive) {
+@@ -887,6 +889,72 @@ int JackEngine::PortUnRegister(int refnum, jack_port_id_t port_index)
+     }
+ }
+ 
++// this check is to prevent apps to self connect to other apps
++// TODO: make this work with multiple clients per app
++int JackEngine::CheckPortsConnect(int refnum, jack_port_id_t src, jack_port_id_t dst)
++{
++    JackPort* src_port = fGraphManager->GetPort(src);
++    JackPort* dst_port = fGraphManager->GetPort(dst);
++
++    jack_log("CheckPortsConnect(caller = %d, src = %d, dst = %d)", refnum, src_port->GetRefNum(), dst_port->GetRefNum());
++
++    int src_self = src_port->GetRefNum() == refnum ? 1 : 0;
++    int dst_self = dst_port->GetRefNum() == refnum ? 1 : 0;
++
++    jack_log("src_self is %s", src_self ? "true" : "false");
++    jack_log("dst_self is %s", dst_self ? "true" : "false");
++
++    // 0 means client is connecting other client ports (i.e. control app patchbay functionality)
++    // 1 means client is connecting its own port to port of other client (i.e. self hooking into system app)
++    // 2 means client is connecting its own ports (i.e. for app internal functionality)
++    // TODO: Make this check an engine option and more tweakable (return error or success)
++    // MAYBE: make the engine option changable on the fly and expose it through client or control API
++
++    switch (fSelfConnectMode)
++    {
++    case JackSelfConnectFailExternalOnly:
++        if (src_self + dst_self == 1)
++        {
++            jack_info("rejecting port self connect request to external port (%s -> %s)", src_port->GetName(), dst_port->GetName());
++            return -1;
++        }
++
++        return 1;
++
++    case JackSelfConnectIgnoreExternalOnly:
++        if (src_self + dst_self == 1)
++        {
++            jack_info("ignoring port self connect request to external port (%s -> %s)", src_port->GetName(), dst_port->GetName());
++            return 0;
++        }
++
++        return 1;
++
++    case JackSelfConnectFailAll:
++        if (src_self + dst_self != 0)
++        {
++            jack_info("rejecting port self connect request (%s -> %s)", src_port->GetName(), dst_port->GetName());
++            return -1;
++        }
++
++        return 1;
++
++    case JackSelfConnectIgnoreAll:
++        if (src_self + dst_self != 0)
++        {
++            jack_info("ignoring port self connect request (%s -> %s)", src_port->GetName(), dst_port->GetName());
++            return 0;
++        }
++
++        return 1;
++
++    case JackSelfConnectAllow:  // fix warning
++        return 1;
++    }
++
++    return 1;
++}
++
+ int JackEngine::PortConnect(int refnum, const char* src, const char* dst)
+ {
+     jack_log("JackEngine::PortConnect src = %s dst = %s", src, dst);
+@@ -927,7 +995,12 @@ int JackEngine::PortConnect(int refnum, jack_port_id_t src, jack_port_id_t dst)
+         return -1;
+     }
+ 
+-    int res = fGraphManager->Connect(src, dst);
++    int res = CheckPortsConnect(refnum, src, dst);
++    if (res != 1) {
++        return res;
++    }
++
++    res = fGraphManager->Connect(src, dst);
+     if (res == 0) {
+         NotifyPortConnect(src, dst, true);
+     }
+@@ -970,15 +1043,21 @@ int JackEngine::PortDisconnect(int refnum, jack_port_id_t src, jack_port_id_t ds
+         }
+ 
+         return ret;
+-    } else if (fGraphManager->CheckPorts(src, dst) < 0) {
+-        return -1;
+-    } else if (fGraphManager->Disconnect(src, dst) == 0) {
+-        // Notifications
+-        NotifyPortConnect(src, dst, false);
+-        return 0;
+-    } else {
++    }
++
++    if (fGraphManager->CheckPorts(src, dst) < 0) {
+         return -1;
+     }
++
++    int res = CheckPortsConnect(refnum, src, dst);
++    if (res != 1) {
++        return res;
++    }
++
++    res = fGraphManager->Disconnect(src, dst);
++    if (res == 0)
++        NotifyPortConnect(src, dst, false);
++    return res;
+ }
+ 
+ int JackEngine::PortRename(int refnum, jack_port_id_t port, const char* name)
+diff --git a/common/JackEngine.h b/common/JackEngine.h
+index ebd3eb1..3393e1c 100644
+--- a/common/JackEngine.h
++++ b/common/JackEngine.h
+@@ -49,6 +49,7 @@ class SERVER_EXPORT JackEngine : public JackLockAble
+ 
+         JackGraphManager* fGraphManager;
+         JackEngineControl* fEngineControl;
++        JackSelfConnectMode fSelfConnectMode;
+         JackClientInterface* fClientTable[CLIENT_NUM];
+         JackSynchro* fSynchroTable;
+         JackServerNotifyChannel fChannel;              /*! To communicate between the RT thread and server */
+@@ -94,9 +95,11 @@ class SERVER_EXPORT JackEngine : public JackLockAble
+             return (refnum >= 0 && refnum < CLIENT_NUM && fClientTable[refnum] != NULL);
+         }
+ 
++        int CheckPortsConnect(int refnum, jack_port_id_t src, jack_port_id_t dst);
++
+     public:
+ 
+-        JackEngine(JackGraphManager* manager, JackSynchro* table, JackEngineControl* controler);
++        JackEngine(JackGraphManager* manager, JackSynchro* table, JackEngineControl* controler, JackSelfConnectMode self_connect_mode);
+         ~JackEngine();
+ 
+         int Open();
+diff --git a/common/JackLockedEngine.h b/common/JackLockedEngine.h
+index a1dc807..a02c83c 100644
+--- a/common/JackLockedEngine.h
++++ b/common/JackLockedEngine.h
+@@ -83,8 +83,8 @@ class SERVER_EXPORT JackLockedEngine
+ 
+     public:
+ 
+-        JackLockedEngine(JackGraphManager* manager, JackSynchro* table, JackEngineControl* controler):
+-            fEngine(manager, table, controler)
++        JackLockedEngine(JackGraphManager* manager, JackSynchro* table, JackEngineControl* controler, JackSelfConnectMode self_connect_mode):
++            fEngine(manager, table, controler, self_connect_mode)
+         {}
+         ~JackLockedEngine()
+         {}
+diff --git a/common/JackServer.cpp b/common/JackServer.cpp
+index b7e7639..5247104 100644
+--- a/common/JackServer.cpp
++++ b/common/JackServer.cpp
+@@ -37,7 +37,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ namespace Jack
+ {
+ 
+-JackServer::JackServer(bool sync, bool temporary, int timeout, bool rt, int priority, int port_max, bool verbose, jack_timer_type_t clock, const char* server_name)
++JackServer::JackServer(bool sync, bool temporary, int timeout, bool rt, int priority, int port_max, bool verbose, jack_timer_type_t clock, JackSelfConnectMode self_connect_mode, const char* server_name)
+ {
+     if (rt) {
+         jack_info("JACK server starting in realtime mode with priority %ld", priority);
+@@ -47,7 +47,7 @@ JackServer::JackServer(bool sync, bool temporary, int timeout, bool rt, int prio
+ 
+     fGraphManager = JackGraphManager::Allocate(port_max);
+     fEngineControl = new JackEngineControl(sync, temporary, timeout, rt, priority, verbose, clock, server_name);
+-    fEngine = new JackLockedEngine(fGraphManager, GetSynchroTable(), fEngineControl);
++    fEngine = new JackLockedEngine(fGraphManager, GetSynchroTable(), fEngineControl, self_connect_mode);
+ 
+     // A distinction is made between the threaded freewheel driver and the
+     // regular freewheel driver because the freewheel driver needs to run in
+diff --git a/common/JackServer.h b/common/JackServer.h
+index 0403272..f288d05 100644
+--- a/common/JackServer.h
++++ b/common/JackServer.h
+@@ -64,7 +64,7 @@ class SERVER_EXPORT JackServer
+ 
+     public:
+ 
+-        JackServer(bool sync, bool temporary, int timeout, bool rt, int priority, int port_max, bool verbose, jack_timer_type_t clock, const char* server_name);
++        JackServer(bool sync, bool temporary, int timeout, bool rt, int priority, int port_max, bool verbose, jack_timer_type_t clock, JackSelfConnectMode self_connect_mode, const char* server_name);
+         ~JackServer();
+ 
+         int Open(jack_driver_desc_t* driver_desc, JSList* driver_params);
+diff --git a/common/JackServerGlobals.cpp b/common/JackServerGlobals.cpp
+index 21feb7f..a10d7f2 100644
+--- a/common/JackServerGlobals.cpp
++++ b/common/JackServerGlobals.cpp
+@@ -48,10 +48,11 @@ int JackServerGlobals::Start(const char* server_name,
+                              int priority,
+                              int port_max,
+                              int verbose,
+-                            jack_timer_type_t clock)
++                             jack_timer_type_t clock,
++                             JackSelfConnectMode self_connect_mode)
+ {
+     jack_log("Jackdmp: sync = %ld timeout = %ld rt = %ld priority = %ld verbose = %ld ", sync, time_out_ms, rt, priority, verbose);
+-    new JackServer(sync, temporary, time_out_ms, rt, priority, port_max, verbose, clock, server_name);  // Will setup fInstance and fUserCount globals
++    new JackServer(sync, temporary, time_out_ms, rt, priority, port_max, verbose, clock, self_connect_mode, server_name);  // Will setup fInstance and fUserCount globals
+     int res = fInstance->Open(driver_desc, driver_params);
+     return (res < 0) ? res : fInstance->Start();
+ }
+@@ -335,7 +336,7 @@ bool JackServerGlobals::Init()
+             free(argv[i]);
+         }
+ 
+-        int res = Start(server_name, driver_desc, master_driver_params, sync, temporary, client_timeout, realtime, realtime_priority, port_max, verbose_aux, clock_source);
++        int res = Start(server_name, driver_desc, master_driver_params, sync, temporary, client_timeout, realtime, realtime_priority, port_max, verbose_aux, clock_source, JACK_DEFAULT_SELF_CONNECT_MODE);
+         if (res < 0) {
+             jack_error("Cannot start server... exit");
+             Delete();
+diff --git a/common/JackServerGlobals.h b/common/JackServerGlobals.h
+index 69b8979..47e9460 100644
+--- a/common/JackServerGlobals.h
++++ b/common/JackServerGlobals.h
+@@ -61,7 +61,8 @@ struct SERVER_EXPORT JackServerGlobals
+                      int priority,
+                      int port_max,
+                      int verbose,
+-                    jack_timer_type_t clock);
++                     jack_timer_type_t clock,
++                     JackSelfConnectMode self_connect_mode);
+     static void Stop();
+     static void Delete();
+ };
+diff --git a/common/JackTypes.h b/common/JackTypes.h
+index b4bad8d..a5a883e 100644
+--- a/common/JackTypes.h
++++ b/common/JackTypes.h
+@@ -55,4 +55,14 @@ typedef enum {
+     Finished,
+ } jack_client_state_t;
+ 
++
++enum JackSelfConnectMode
++{
++    JackSelfConnectAllow,
++    JackSelfConnectFailExternalOnly,
++    JackSelfConnectIgnoreExternalOnly,
++    JackSelfConnectFailAll,
++    JackSelfConnectIgnoreAll,
++};
++
+ #endif
+diff --git a/common/Jackdmp.cpp b/common/Jackdmp.cpp
+index 2aec190..b793c2a 100644
+--- a/common/Jackdmp.cpp
++++ b/common/Jackdmp.cpp
+@@ -184,8 +184,8 @@ int main(int argc, char** argv)
+     jackctl_driver_t * master_driver_ctl;
+     jackctl_driver_t * loopback_driver_ctl = NULL;
+     int replace_registry = 0;
+-
+     const char *options = "-d:X:I:P:uvshVrRL:STFl:t:mn:p:"
++        "a:"
+ #ifdef __linux__
+         "c:"
+ #endif
+@@ -215,6 +215,7 @@ int main(int argc, char** argv)
+                                        { "version", 0, 0, 'V' },
+                                        { "silent", 0, 0, 's' },
+                                        { "sync", 0, 0, 'S' },
++                                       { "autoconnect", 1, 0, 'a' },
+                                        { 0, 0, 0, 0 }
+                                    };
+ 
+@@ -277,6 +278,26 @@ int main(int argc, char** argv)
+                 break;
+         #endif
+ 
++            case 'a':
++                param = jackctl_get_parameter(server_parameters, "self-connect-mode");
++                if (param != NULL) {
++                    bool value_valid = false;
++                    for (uint32_t k=0; k<jackctl_parameter_get_enum_constraints_count( param ); k++ ) {
++                        value = jackctl_parameter_get_enum_constraint_value( param, k );
++                        if( value.c == optarg[0] )
++                            value_valid = true;
++                    }
++
++                    if( value_valid ) {
++                        value.c = optarg[0];
++                        jackctl_parameter_set_value(param, &value);
++                    } else {
++                        usage(stdout);
++                        goto destroy_server;
++                    }
++                }
++                break;
++
+             case 'd':
+                 master_driver_name = optarg;
+                 break;

Modified: trunk/overlays/proaudio/media-sound/jack-audio-connection-kit/jack-audio-connection-kit-1.9.9.5.ebuild
===================================================================
--- trunk/overlays/proaudio/media-sound/jack-audio-connection-kit/jack-audio-connection-kit-1.9.9.5.ebuild	2013-01-20 18:18:13 UTC (rev 2399)
+++ trunk/overlays/proaudio/media-sound/jack-audio-connection-kit/jack-audio-connection-kit-1.9.9.5.ebuild	2013-01-20 18:40:11 UTC (rev 2400)
@@ -6,7 +6,7 @@
 
 PYTHON_DEPEND="2"
 
-inherit multilib python
+inherit multilib python eutils
 
 DESCRIPTION="Jackdmp jack implemention for multi-processor machine"
 HOMEPAGE="http://www.jackaudio.org";
@@ -32,6 +32,10 @@
 	python_pkg_setup
 }
 
+src_prepare() {
+	epatch "${FILESDIR}/jack2-no-self-connect-1.9.9.5.patch"
+}
+
 src_configure() {
 	local myconf="--prefix=/usr --destdir=${D}"
 	use alsa && myconf="${myconf} --alsa"


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/