patch: support jack portpattern
whohoho opened this issue · 1 comments
whohoho commented
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')