Closed Takkat-Nebuk closed 9 years ago
This can be done without any change in the code of pulseaudio-dlna by loading default pulseaudio modules.
pactl load-module module-switch-on-connect
To make this work we will also have to disallow pulseaudio to restore a device's stream properties by editing the following line in default.pa
to
load-module module-stream-restore restore_device=false
A minor glitch is the sometimes rather lengthy renderer URL we need to give, which can only easily be found out by running pulseaudio-dlna in -debug mode. Any chance to shorten that in any way (e.g. device name)?
Hello Takkat. Sorry for the late reply. Was a week in NY for business.
When i understand it correctly, you want a CLI option which enables you to select a single renderer from the list of the detected ones, right?
So, if you have just one renderer in your network everything works without any modification. You just have a problem when there is more than one, thats why you specifiy the renderer url yourself, besides that feature was never meant to be used that way :smile:
@Takkat-Nebuk I made a branch (feature/device-filter) which implements a --device-filter
option.
Can you check it out and report if thats suitable for you?
@masmu hey thanks for coming back to this, it is a promising approach.
I can restrict discovery to only one device by saying e.g --device-filter [+bubble]
or [+TVUE40ES6100]
but if I say [+BubbleUPnP]
or [+tvue40es6100]
it will still discover and use both devices. It may be just me getting the options wrong but it appears a bit inconsistent.
Nevertheless I am quite happy with the option --renderer-urls
which gives me consistent and good results.
At present I make good progress in adding support for pulseaudio-dlna
to my GUI wrapper for several audio streaming solutions (stream2ip). We are now able to wait for a single renderer to become available then connect and automatically switch sinks. We can also disconnect/reconnect if this renderer was temporarily lost, all provided we had an URL of the device. At present I use the URL from the renderer URL I submit to pulseaudio-dlna --renderer-urls
.
Finding this URL is not so easy however. At present I use pulseaudio-dlna in --debug
mode to search for Response from upnp device
which usually is followed by the renderer URL. It would be nice if we had pulseaudio-dlna
running in normal non-debug mode to also print the renderer URLs in addition to the device names.
A really cool feature I would love to see would be an option --discover-only
when pulseaudio-dlna only prints discovered devices and their renderer URLs but then just quits without connecting to them. Finding the URLs (or parsing them in another application) would then be much much easier (and more consistent, --debug
mode certainly was not meant for that).
Finally, another feature (where I am not sure if and how this could be done easily) would be that pulseaudio-dlna
removed a sink from a renderer as soon as the renderer was disconnected. At present it will still show a sink of a lost device.
Hope this was not too much for now.
@Takkat-Nebuk : I updated the branch and replaced the regular expression with plain text search.
So, regardless how many devices there are in your network, --device-filter="Wohnzimmer,Nexus 5"
will just find those both and --device-filter="Nexus 5"
just the one.
Could you explain me a little bit more what you are trying to build? :smile:
Well, may app "stream2ip" is a Gtk3 GUI wrapper for all kinds of audio network streaming solutions (it all started with supporting AirTunes for my AirportExpress I had). Over the years I added more and more other streaming solutions. The aim always was to just start stream2ip per a single mouse click (or even from autostart) and it will take care of everything else to switch pulseaudio to any streaming sink we had set up (e.g. RAOP device, Bluetooth device, Icecast server, pulseaudio RTP).
Now pulseaudio-dlna fits in rather nicely as it fills the gap to allow doing that for a DLNA renderer. If you are interested to can get it from https://launchpad.net/stream2ip/+download. It is all Python3 but may also run with Python2. Please don't look at the code, it's awful! It grew over the years without anybody (me) feeling like having time to put it in an appropriate shape. :flushed:
At present, if we run the setup routine to choose "DLNA live" we can search for a renderer with the looking glass button. This calls pulseaudio-dlna in debug mode just to get the renderer URL of a single DLNA device - then kills it again. A bit hacky, I know. That's where a --discover-only
option would come in handy, also to allow choosing from a list of devices (which then would need an additional window to be made).
The main program can be set up to wait a given interval for the renderer's IP to respond to a ping, only then call pulseaudio-dlna, and if a new sink was created, switch audio output to that sink. If that IP gets lost pulseaudio-dlna will be terminated, and the previous audio sink restored.
--filter-device
optionThank you so much Massimo. We can now select from a renderer to support autoconnecting in stream2ip 1.0.8. :smiley:
After a successful discovery a little selection box will pop up:
In addition I thought it may be a good idea to also support other options for non-default sets. This can now be done either by giving in a full command set as options for "DLNA live" or by a configuration file padlna.cfg
in ~/.config/stream2ip/
to always add additional options before we call pulseaudio-dlna.
Hi! Pulseaudio-dlna doesn't see the device on hostapd. I have ubuntu with the adjusted point of access of hostapd! When I start pulseaudio-dlna on this ubuntu, the devices connected to hostapd aren't found! Prompt please as to correct it?
@lavaed Sorry, i really don't understand. Could you explain it a little bit more?
Forgive for my English! I have ubuntu 14.04 server. And not a simple network configuration. I found out that the started pulseaudio-dlna on server works only with default a route. And options - host, - renderer-host don't help to find the device in a home network!
Pulseaudio-dlna saw devices in a network after I added a route route add -net 239.255.255.250 netmask 255.255.255.255 wlan1! Answer please! A sound delay at a pulseaudio-dlna broadcast of 13 seconds it is normal and whether it is possible to correct it?
With the possibility to give a single renderer URL we are able to connect to a single known DLNA renderer in our network.
It would be nice to then automatically move the audio stream to this device once we had started pulseaudio-dlna.