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

mpd: mimick httpd plugin as output #1779

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

grobian
Copy link

@grobian grobian commented Jul 6, 2024

MPD produces the following entry on outputs command:

OK MPD 0.23.5
outputs
outputid: 0
outputname: MP3 stream
plugin: httpd
outputenabled: 1
OK

This indicates to some clients that a HTTP stream is available, and without it they will refuse to do any config/support for it (if at all). While this stream normally would be available on port 8000 that is something that can easily be directed to stream.mp3 using a proxy in front.

Faking this "plugin" simply allows some client to make use of owntone's http stream.

MPD produces the following entry on outputs command:

OK MPD 0.23.5
outputs
outputid: 0
outputname: MP3 stream
plugin: httpd
outputenabled: 1
OK

This indicates to some clients that a HTTP stream is available, and
without it they will refuse to do any config/support for it (if at all).
While this stream normally would be available on port 8000 that is
something that can easily be directed to stream.mp3 using a proxy in
front.

Faking this "plugin" simply allows some client to make use of owntone's
http stream.

Signed-off-by: Fabian Groffen <[email protected]>
@ejurgensen
Copy link
Member

Thanks for this. The original maintainer of the mpd module is inactive, and I'm not so well into it, so please clarify a bit. Which mpd client(s) are you testing with? Where is the port 8000 standard coming from?

@grobian
Copy link
Author

grobian commented Jul 7, 2024

Ah, so I've just been copying exactly what MPD does. The client that needs to see httpd plugin is Stylophone (iOS app).

The port 8000 is a thing that comes from the default MPD config: https://github.com/MusicPlayerDaemon/MPD/blob/e380ae90ebb6325d1820b6f34e10bf3474710899/doc/mpdconf.example#L276
their "type" becomes "plugin" in the outputs command, and since it doesn't communicate an url or port, clients need to assume, which becomes that port 8000. But to be clear, I think opening up port 8000 to serve the stream is a separate feature (that I may or may not try to implement later – my proxy solution for now works fine).

@ejurgensen
Copy link
Member

Ok thanks for clarifying. Do you know why the outputid is that particular value? Then please update the comment (ushort max - 1 doesn't explain why).

@grobian
Copy link
Author

grobian commented Jul 8, 2024

Well, that value is point of discussion. All I need is a unique value, I suppose. But 0 is already taken, and other devices seem to use some random or hardware address in an unsigned short value (id). So I decided not to take the risk to conflict with any other speaker/output and use a value they can never emit – one that is beyond their datatype range. Looping over all speakers twice just to get the first free id seemed like a bit overkill, that said, if I can change the context of the callback to become a struct in which I can keep the first free ID, I might just emit the httpd plugin after all speakers have been produced as output.

That said, what remained a mystery for now is where "Computer" comes from. It has ID 0 and perhaps we can inject the plugin thing just for that entry, instead of making a separate one just for "MP3 steam". What do you think?

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

Successfully merging this pull request may close these issues.

None yet

2 participants