Author
Topic: How is xine used in Pluto ? (Read 14745 times)

I'd like to have multichannel alsa cards on pluto core, each output is separate stereo channel - used similarly as media player.

I've seen that xine is used for such purposes under Pluto. I have few questions:- can xine be run in multiple instances each outputting to its own alsa stereo device ? How hard would it be to do this under Pluto - so each xine instance is separate media player ?

- I've seen that there is slim server plugin for xin in Pluto sources. Can Xine listen to slim stream ? How are audio playing features organized in Pluto ?

- if not with Xine, I'm thinking to implement media player with alsaplayer. Any thoughts how to start properly ? Any other ideas ?

I have small house and much greater number of speakers than media directors, that's why I'm thinking in this way ...

It's probably possible to do this with Xine. What could be done is adding a device data (data parm) to the xine player with the audio/video output to use. You can add as many xine players to a computer as you want, and they will all get spawned. The only problem is that at the moment they will all try to grab the same audio/video devices and conflict. But in our Xine_Player.cpp file, which is our wrapper for Xine, something could be added to the constructor that gets the audio/video device from teh data parmaeter, and spawns xine appropriately.

Yes, we are using xine as the player for the Slim Server. The device "Media Plugin", which is a plug-in for the DCERouter, coordinates all the media--regardless of device. There are then separate plugins for each type of media player--MythTV Plugin, Xine Plugin, etc., which in turn register with the media plugin. the media plugin passes off the actual "Start", "Stop", etc., to those plugins.

this part should work. It works in our test environment. You only need to setup Pluto, then plug in your squeeze boxes. Our plug-and-play drivers will detect that it's a squeeze box, configure it, add the slim server back-end and any other packages, and then you can play any media. We have this working in our office test system.

It's probably possible to do this with Xine. What could be done is adding a device data (data parm) to the xine player with the audio/video output to use. You can add as many xine players to a computer as you want, and they will all get spawned. The only problem is that at the moment they will all try to grab the same audio/video devices and conflict. But in our Xine_Player.cpp file, which is our wrapper for Xine, something could be added to the constructor that gets the audio/video device from teh data parmaeter, and spawns xine appropriately.

Ok, I guess this would be easiest solution. I'm just thinking of possible drawbacks of using xine as audio player... I have following in mind:- how many cpu resources does xine take? For multichanel we would need several xines on single machine. - could we stripp down xine to not use X any unneeded resources (like X, ...) ?- how do you estimeate what would happen if we run 5 xine instances on single computer ? I guess we would have to deal also with priorities ?

I guess you have more experience with it, so am looking forward to some discussion. For a start, we could make a test and add xine's output device to parameter. Is there anything else that we should add as parameter for more instances (like tcp ports for remote control...) ?

Quote from: "aaron.b"

Yes, we are using xine as the player for the Slim Server. The device "Media Plugin", which is a plug-in for the DCERouter, coordinates all the media--regardless of device. There are then separate plugins for each type of media player--MythTV Plugin, Xine Plugin, etc., which in turn register with the media plugin. the media plugin passes off the actual "Start", "Stop", etc., to those plugins.

Why is xine Slim Server player? Does this mean that you always go to xine via slimserver or is there any other purpose of slim plugin for xine ?

Quote from: "aaron.b"

this part should work. It works in our test environment. You only need to setup Pluto, then plug in your squeeze boxes. Our plug-and-play drivers will detect that it's a squeeze box, configure it, add the slim server back-end and any other packages, and then you can play any media. We have this working in our office test system.

Is slim server used only for squeeze boxes or for xine in media directors too ?

I'm also considering for this task libalsaplayer library (http://www.alsaplayer.org) that would be really thin implementation without any bells and whistles. We use it for Misterhouse whole house audio/speech system and it works quite good...

I'm willing to contribute if we decide to try both variants and decide for the best. Anyway would need some help as pluto newbie to carry this out...

the /home directory, where all the media is stored, is mounted on all the media directors. Normally, when you go to play music on a media director, slim server isn't used. Xine just gets a 'play' command, and plays the file off the local mount.

However, if the destination is multiple xine's, then it's not advisable to have both of them play the files individually -- they will be out of sync. So, media plugin has the logic that says: if the destination is a single xine, send that xine a play. if the destination is a single network audio player (like the squeeze box which can't 'play' media that's not streamed), or if the destination is multiple xines, or a combination of a xine and a squeeze box, then rather than xine the play, it starts the slim server streaming the audio.

Then it sends all the target devices (xine, and squeezebox) a command to play what is being broadcast over a given port.

What I'm not totally understanding is the desire to run multiple xine's. We never tried running more than 1. If you want 10 zones of audio in your house, and have 2 media directors, than those 2 m/d's can be 2 of your zones, and you can add 8 network audio players, like the squeeze boxes, which cost around $150 for the other zones.

You mention running 5 xine instances on a single computer. Is the intention that you will put 5 sound cards in the computer, and have each xine running to a sound card, and the goal is to have 5 'zones' of audio?

You mention 'multichannel', and I'm not sure if we're talking the same thing or not... When I think of multi-channel, I think of multiple audio channels within a given stream. Like dolby digital 5.1. That doesn't require multiple xines, or multiple sound cards. The single xine player gets the single audio/video stream which contains 5+1 channels of audio and plays it.

When I think of multiple xine's, I'm assuming you're referring to, what we call multi-zone, rather than multi-channel. Multii-zone meaning I want to be playing Metallica in Zone 1, Mozart in Zone 2, and iRobot in Zone 3. The channels are not important--Zone 1 may be stereo, Zone 2 may be 4 channel audio from an SACD, and Zone 3 may be 6+1 channel.

But when you talk about running 5 xine's, which I assume means 5 different zones, the only way that would make sense to me is if you have 5 separate sound cards. If there's only 1 sound card, what would the 5 different xine's render their audio to?

So, assuming you mean 5 xine's and 5 sound card's, so that you can 5 zones of music with 1 pc, it should be possible, theoretically, although we haven't tried it. Since the squeeze boxes are fairly cheap, we figured that rather than buying 5 sound cards, it would be easier to buy 5 squeeze boxes.

Let me know the intended purpose, so I can be sure we're talking the same thing.

the /home directory, where all the media is stored, is mounted on all the media directors. Normally, when you go to play music on a media director, slim server isn't used. Xine just gets a 'play' command, and plays the file off the local mount.

However, if the destination is multiple xine's, then it's not advisable to have both of them play the files individually -- they will be out of sync. So, media plugin has the logic that says: if the destination is a single xine, send that xine a play. if the destination is a single network audio player (like the squeeze box which can't 'play' media that's not streamed), or if the destination is multiple xines, or a combination of a xine and a squeeze box, then rather than xine the play, it starts the slim server streaming the audio.

Then it sends all the target devices (xine, and squeezebox) a command to play what is being broadcast over a given port.

Thanks for info - now I have much better picture. It's sync feature that demands slim plugin for xine.

Quote from: "aaron.b"

What I'm not totally understanding is the desire to run multiple xine's. We never tried running more than 1. If you want 10 zones of audio in your house, and have 2 media directors, than those 2 m/d's can be 2 of your zones, and you can add 8 network audio players, like the squeeze boxes, which cost around $150 for the other zones.

You mention running 5 xine instances on a single computer. Is the intention that you will put 5 sound cards in the computer, and have each xine running to a sound card, and the goal is to have 5 'zones' of audio?

You mention 'multichannel', and I'm not sure if we're talking the same thing or not... When I think of multi-channel, I think of multiple audio channels within a given stream. Like dolby digital 5.1. That doesn't require multiple xines, or multiple sound cards. The single xine player gets the single audio/video stream which contains 5+1 channels of audio and plays it.

When I think of multiple xine's, I'm assuming you're referring to, what we call multi-zone, rather than multi-channel. Multii-zone meaning I want to be playing Metallica in Zone 1, Mozart in Zone 2, and iRobot in Zone 3. The channels are not important--Zone 1 may be stereo, Zone 2 may be 4 channel audio from an SACD, and Zone 3 may be 6+1 channel.

But when you talk about running 5 xine's, which I assume means 5 different zones, the only way that would make sense to me is if you have 5 separate sound cards. If there's only 1 sound card, what would the 5 different xine's render their audio to?

So, assuming you mean 5 xine's and 5 sound card's, so that you can 5 zones of music with 1 pc, it should be possible, theoretically, although we haven't tried it. Since the squeeze boxes are fairly cheap, we figured that rather than buying 5 sound cards, it would be easier to buy 5 squeeze boxes.

Let me know the intended purpose, so I can be sure we're talking the same thing.

Thanks.

sorry for being unclear. Yer you're right I'm talking about multiple zones. There exists middle solution to this one. If I take cs46xx based card (like Hercules Difigire 7+1) I get 4 independent devices under alsa (it looks like 4 cards - 3 stereo devices and one SPDIF out device) - they are numbered like hw:1,1 hw:1,2 hw:1,3 hw:1,4 if card number is 1. And if you play to alsa device hw:1,3 you get output on subdevice 3.

cs46xx based cards and few others have HW based mixer, so you can send more streams to same device. But in majority of cases on other sound cards (mostly i810) you don't have HW mixers, but can configure them for SW mixing in alsa configuration file. So for instance you can configure cards as 1x6 channels, or for instance 3x2 channel and use each of them independently. But there is major drawback - you can't control HW volume on each of them, cause there is only one volume device. But if you have software volume on media player (alsaplayer has it, don't know about xine), then you can control volume of each channel separately.

So I've bought digifire and I'm using it for 3 stereo outputs and that's much cheaper than having 3 squezeboxes !? . I also have relaxation feature that spawns two players for each channel - one plays relaxation music, on the other one I play short wave files with speech announcements or any other prerecorded positive thoughts. During announcement, volume of other channel goes lower and higher after that....

My kids won't go to bed anymore without "relaxation programme".

I'm finishing construction of new house right now, and I have small distances to speakers - with everything wired invisibly, so will have players located on core. If you think of new house, that's for my taste slightly better solution.

If we do this, then each media director could feed out more stereo channels instead of one (maybe outside speakers, hall speakers, etc...). We just have to pick right card and you can get 2-4 decent stereo channels out of 1 cheaper sound card ....

Aha, now I understand the confusion. You want to use a multi-channel audio card as multi-zone. Honestly, I've never heard of anyone doing that -- I mean having 2 separate programs take over individual channels individually.

It would be nice on the 5.1 boards which usually have 3 stereo mini jacks, to be able to make 3 separate zones out of them. Running 3 instances of xine in our software is not an issue. If you create 3 xine's under the media director, or hybrid device, the Start_localDevices script will spawn them. And, if you put those 3 xine's in separate rooms, then Pluto is fine with that too.

The hard part is telling this xine to take over these channels, and another one to take over different ones. But that is something that's better for the Xine forums -- I don't think any of us here have the low level technical knowledge of Xine to make this happen.

Aha, now I understand the confusion. You want to use a multi-channel audio card as multi-zone. Honestly, I've never heard of anyone doing that -- I mean having 2 separate programs take over individual channels individually.

It would be nice on the 5.1 boards which usually have 3 stereo mini jacks, to be able to make 3 separate zones out of them. Running 3 instances of xine in our software is not an issue. If you create 3 xine's under the media director, or hybrid device, the Start_localDevices script will spawn them. And, if you put those 3 xine's in separate rooms, then Pluto is fine with that too.

The hard part is telling this xine to take over these channels, and another one to take over different ones. But that is something that's better for the Xine forums -- I don't think any of us here have the low level technical knowledge of Xine to make this happen.

I guess you're talking about how to tell each xine on what alsa device to play ?

Right now I think this device is set to 'alsa:default' or something like that in /etc/pluto/xine.conf. We should just figure out how to add this device as parameter and start xine in this way (set it to 'alsa:hw:1,1') . I'll try this and get back to you...

Are there any other parameters that should be customized for each instance of xine?

I've asked this also on slim mailing list:- do you perhaps now how sync is made between different slim clients ? If I try with Alsaplayer I guess I should solve this sync too...

Aha, now I understand the confusion. You want to use a multi-channel audio card as multi-zone. Honestly, I've never heard of anyone doing that -- I mean having 2 separate programs take over individual channels individually.

It would be nice on the 5.1 boards which usually have 3 stereo mini jacks, to be able to make 3 separate zones out of them. Running 3 instances of xine in our software is not an issue. If you create 3 xine's under the media director, or hybrid device, the Start_localDevices script will spawn them. And, if you put those 3 xine's in separate rooms, then Pluto is fine with that too.

The hard part is telling this xine to take over these channels, and another one to take over different ones. But that is something that's better for the Xine forums -- I don't think any of us here have the low level technical knowledge of Xine to make this happen.

I guess you're talking about how to tell each xine on what alsa device to play ?

Right now I think this device is set to 'alsa:default' or something like that in /etc/pluto/xine.conf. We should just figure out how to add this device as parameter and start xine in this way (set it to 'alsa:hw:1,1') . I'll try this and get back to you...

Are there any other parameters that should be customized for each instance of xine?

I've asked this also on slim mailing list:- do you perhaps now how sync is made between different slim clients ? If I try with Alsaplayer I guess I should solve this sync too...

Thanks for help,

regards,

Rob.

Hi,

I've taken a closer look of xine and found out following:- alsa device for player output is set in xine.conf :

So I think we have options to try to enhance xine player plugin under Pluto. But I'd like to get some minor help, maybe from pluto-xine plugin author ? - is xine in Pluto launched with graphic window ? - how to run xine from command line without any X resources - audio only from console ? - how is volume control implemented in Pluto ? I've tried to use it on video, but no effect...

Propositions:- xine should be spawned with as little resources as possible (audio only setup, but to stay pluto compatible)- add some parameter to specify alsa device and mixing settings for each instance....

I'll try to do this, but I guess that it's best if author of pluto-xine gives some guidance and opinion...

There are technical issues that might prevent you from using more xine players to accomplish what you want. First: - The Xine players share the same config. This should be changes first and paramterized per instance (the Device Data that aaron told you about). - The Xine players need to know if they are going to be used as audio and/or video players. (This is to avoid creating the Video ports and windows on the X server in order to be able to run on a headless box).

After those issues are fixed you will be able to use multiple Xine Player's on a media director for multiple audio zones.

The second issue is your question about alsaplayer. This should not be such big of a deal but you will probrably need to code some control code in the Xine_Plugin, or create a new Media Plugin to control Alsa Players. Is not rocket science but is also not trivial.

The other solution would be to buy a lot of Squeeze boxes and use our SqueezeBox integration to achieve the same effects. This should work right now and if not it will be a priority for me to fix it. The SlimServer/XinePlayer integration is not there yet so is not something that you can count on now to resolve your issue.

The first this is the more usefull thing because it can help people like yourself to enjoy whole house audio without expensive investments in SqueezeBoxes. I'll put those fixes on my list and try to fix then as soon as possible.

There are technical issues that might prevent you from using more xine players to accomplish what you want. First: - The Xine players share the same config. This should be changes first and paramterized per instance (the Device Data that aaron told you about). - The Xine players need to know if they are going to be used as audio and/or video players. (This is to avoid creating the Video ports and windows on the X server in order to be able to run on a headless box).

Do you have any idea how hard that would be ?

I'll probably try to do it: I think I know where to start for first, but have no clue about second.

I'd kindly aks for few short answers:- how do you start xine ? thought xine-lib, system(), or third way ?- do know how to start xine without any video resources ? I tried from command line -H -I , but still wants to open window (it says: cannot open window).

Quote from: "xine in pluto"

After those issues are fixed you will be able to use multiple Xine Player's on a media director for multiple audio zones.

----snip --------

The first this is the more usefull thing because it can help people like yourself to enjoy whole house audio without expensive investments in SqueezeBoxes. I'll put those fixes on my list and try to fix then as soon as possible.

If you want to contact me directly i have the mtoader YM id.

Sincerely, ToMiC

I've been thinking of alsaplayer - it would be easy to write audio player but syncing with other media players doesn't exist (like boradcast to all media directors, etc...) . Cause of that I decided to go xine route cause of syncing with slimserver and other media players, so you can distribute same sound to on or more xine player. Could you please describe what features do work and what don't - specially with slimserver, volume controls, ... ?

We are using xine-lib to instantiate xine and use it in our player. You can view the Xine_Player as a xine frontend controlled by pluto. The code is in the Xine_Player device (in the XineSlaveWrapper.{cpp,h} class), the player just forwards the command to the XineSlaveWrapper instance.

The xine ui will always creates an window i think since the code that i used to create the Xine Player in the first place is mimiched after the sample UI application from the xine-lib distributin and this will always try to create a window (2 windows actually). My guess is that it will always try to create one.

The slim server intergration should work pretty well with SqueezeBoxes but is not that usable yet with the Xine Player.