Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

patch: support jack portpattern #36

Open
whohoho opened this issue Jul 26, 2018 · 1 comment
Open

patch: support jack portpattern #36

whohoho opened this issue Jul 26, 2018 · 1 comment

Comments

@whohoho
Copy link

whohoho commented Jul 26, 2018

It is possible to tell jack what ports to autoconnect to (so you can for example connect to the ardour mixer instead of soundcard output)

Here is a patch:

diff --git a/bin/openob b/bin/openob
index 4ce9b44..82af62f 100755
--- a/bin/openob
+++ b/bin/openob
@@ -44,6 +44,7 @@ parser_tx_alsa.add_argument('-d', '--alsa_device', type=str, default='hw:0', hel
 parser_tx_jack = parser_tx.add_argument_group('jack', 'Options when using JACK source type')
 parser_tx_jack.add_argument('-jn', '--jack_name', type=str, default='openob', help="JACK port name root")
 parser_tx_jack.add_argument('-aj', '--jack_auto', action='store_false', help="Disable auto connection for JACK inputs")
+parser_tx_jack.add_argument('-jp', '--jack_port_pattern', type=str, default=None, help="JACK port pattern")
 parser_tx.add_argument('-r', '--samplerate', type=int, default=0, help="Set the sample rate to request from the input (Hz)")
 parser_tx.add_argument('-e', '--encoding', type=str, choices=['pcm', 'opus'], default='opus', help="The audio encoding type for this link; PCM for linear audio (16-bit), or Opus for encoded audio")
 parser_tx.add_argument('-p', '--port', type=int, default=3000, help="The base port to use for audio transport. This port must be accessible on the receiving host")
@@ -68,6 +69,8 @@ parser_rx_alsa.add_argument('-d', '--alsa_device', type=str, default='hw:0', hel
 parser_rx_jack = parser_rx.add_argument_group('jack', 'Options when using JACK output type')
 parser_rx_jack.add_argument('-jn', '--jack_name', type=str, default='openob', help="JACK port name root")
 parser_rx_jack.add_argument('-aj', '--jack_auto', action='store_false', help="Disable auto connection for JACK inputs")
+parser_rx_jack.add_argument('-jp', '--jack_port_pattern', type=str, default=None, help="JACK port pattern")
+
 parser_rx.set_defaults(mode='rx')
 
 
diff --git a/openob/audio_interface.py b/openob/audio_interface.py
index d9dcd7b..a62f000 100755
--- a/openob/audio_interface.py
+++ b/openob/audio_interface.py
@@ -49,3 +49,5 @@ class AudioInterface(object):
                 self.set("jack_name", opts.jack_name)
             else:
                 self.set("jack_name", "openob")
+            if opts.jack_port_pattern is not None:
+                self.set("jack_port_pattern", opts.jack_port_pattern)
diff --git a/openob/rtp/rx.py b/openob/rtp/rx.py
index 3771533..6ff1a60 100755
--- a/openob/rtp/rx.py
+++ b/openob/rtp/rx.py
@@ -68,6 +68,8 @@ class RTPReceiver(object):
                 sink.set_property('connect', 'none')
             sink.set_property('name', self.audio_interface.jack_name)
             sink.set_property('client-name', self.audio_interface.jack_name)
+            if self.audio_interface.jack_port_pattern:
+                sink.set_property('port-pattern', self.audio_interface.jack_port_pattern)
         elif self.audio_interface.type == 'test':
             sink = Gst.ElementFactory.make('fakesink')
 
diff --git a/openob/rtp/tx.py b/openob/rtp/tx.py
index 90481e8..6831be0 100755
--- a/openob/rtp/tx.py
+++ b/openob/rtp/tx.py
@@ -82,6 +82,9 @@ class RTPTransmitter(object):
             source.set_property('buffer-time', 50000)
             source.set_property('name', self.audio_interface.jack_name)
             source.set_property('client-name', self.audio_interface.jack_name)
+            if self.audio_interface.jack_port_pattern:
+                source.set_property('port-pattern', self.audio_interface.jack_port_pattern)
+
         elif self.audio_interface.type == 'test':
             source = Gst.ElementFactory.make('audiotestsrc')
 
@whohoho whohoho changed the title support jack portpattern patch: support jack portpattern Jul 31, 2018
@whohoho
Copy link
Author

whohoho commented Aug 19, 2018

And a pull request: #37

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant