« on: January 12, 2014, 08:43:34 pm »
You need to do some serious study of the media plugin, and of the Xine Plugin and Player, as this is the most feature complete media player we have, which uses ALL of the functionality of the system.
You're overthinking things, this is what happens when you try to think things through without actually digging your hands into the code. stop it.
the Media Plugin concerns itself with instances of MediaStream. Which is merely a container for a given instance of media throughout the house. Right now, the media handlers look for media devices in an entertainment area (in the DeviceTemplate_MediaType table), and then cross reference this with a vector that is populated when the different media plugins run their ::Register() methods. The two ends meet, and the relevant media plugin's CreateMediaStream is called, which, in the end, will take the subclassed media stream (e.g. MPDMediaStream), and return it back to the Media Plugin.
Once this is done, StartMedia is called, which does all the logic to figure out WHERE a stream needs to go. You're given a LOT of data in the MediaStream object (look in src/Media_Plugin/MediaStream.h), and you use this to cross reference with the device tree, to figure out ultimately where things need to go, either ending in a CMD_Play_Media() call, or a CMD_Start_Streaming() call for sending to multiple destinations.
These individual calls are merely declarative control, you're not actually sending the streams down these DCE calls, you're just coordinating signalling to the target media player as need be. Your Player's job, is to either EMBED mpd, or to control it, depending on the approach.
The Media Plugin does a _LOT_ of abstraction for you, including figuring out whether the media stream needs to be bifurcated or not (if you're sending an audio stream to a couple of media directors running Xine, a couple of squeezeboxes, and a couple of MPD endpoints, then THREE separate media streams will be created, the media streams themselves will not talk to each other.)
The Squeezebox support, for example, relies on a Slim Server Streamer, that runs on the core, and talks to the CLI interface that Logitech Media Server exposes for integration. The Squeezeboxes themselves are children of the Slim Server Streamer, and their configuration script merely sets the Controlled Via to be the Slim Server Streamer on the core. The Entertainment areas for each device are set appropriately, and are placed in their appropriate rooms.
So, what you need to figure out now, is whether to either (on the core)
(1) embed the mpd libraries and call them from C++ (spawn thread, etc.)
(2) talk to mpd over a socket to your player.
then, you need to figure the same out for the media directors.