hzeller / gmrender-resurrect

Resource efficient UPnP/DLNA renderer, optimal for Raspberry Pi, CuBox or a general MediaServer. Fork of GMediaRenderer to add some features to make it usable.
GNU General Public License v2.0
851 stars 206 forks source link

Enable JACK audio support with selectable client names and autoconnection? #224

Open EternityForest opened 3 years ago

EternityForest commented 3 years ago

GStreamer supports JACK perfectly well, but as is, there is no way to control autoconnection, or client name.

I propose two changes:

A --jack-client-name to be used with the "jackaudiosink" element A --jack-port-pattern, or a reuse of the existing device option, to control the port-pattern of the GStreamer object.

As these are simple changes, I plan to do them myself, but I'd rather start a discussion here in the best way to do this, to see if this is something that could possibly be upstreamed.

My use case is allowing music streamed from a phone to coexist with an existing JACK based framework that handles things like voice announcements, but I think this is simple and useful enough that lots of applications could be found.

Baffless commented 3 years ago

Hi Exactly thats the problem. It autoconnects to jack system1 and 2 ports. I was thinking to edit the code, but i am not SW engineer, so searched the code, but could find anything related to jack port connection part in code. What part of the code does that.Can someone help here? Thanks

EternityForest commented 3 years ago

Not sure what part of the code, look for "gstreamer" and output stuff from there and you can probably find it.

There is a workaround though, with a long ugly command line. Here's the code I use to launch from within Python. Note the random nonsense in port-pattern, if you leave it blank it autoconnects to system.

´´´ x = ['gmediarender', '--gstout-videosink', 'glimagesink', '--gstout-audiopipe', 'jackaudiosink slave-method=0 port-pattern="jkhjkjhkhkhkhkjhk" client-name='+data.get("device.advertiseName", 'DLNA')] ´´´

Baffless commented 3 years ago

I looked in all files for words connect, port, jack, active,gstreamer. Could't find anything that i could think that points to connection part. Maybe i don't understand . Thanks for workaround, but i don't understand how to use it properly. syntax even for running is not very clear if run with provided script and chose alsa i still get it in jack world.But i prefer like this: /usr/local/bin/gmediarender --gstout-audiopipe "something her" --gstout-audiodevice "something her" but cant figure out the syntax , cant find an example.

Baffless commented 3 years ago

Found the solution for autoconnect issue! You just have to add --autoconnect 'a' when running jackd. in example this works for me: /usr/bin/jackd --autoconnect 'a' -t2000 -dalsa -dhw:MKII -r96000 -p2048 -n3 more info related is here https://github.com/jackaudio/jack2/issues/731