Author Topic: Anyone have experience with a new Media Plugin?  (Read 2547 times)

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5498
  • DOES work for LinuxMCE.
    • View Profile
Anyone have experience with a new Media Plugin?
« on: November 15, 2007, 05:25:38 am »
I am currently researching into making a new media player/plugin pair, and would like to know if anyone here has made one? There is almost no documentation on this part of the system....

-Thom

darrenmason

  • Addicted
  • *
  • Posts: 529
    • View Profile
Re: Anyone have experience with a new Media Plugin?
« Reply #1 on: November 15, 2007, 05:59:39 am »
Thom,

I played around with it under Pluto when there was no way to view pictures through the Orbiters.
The design seems to be pretty straightforward. A plugin lives on the core an is responsible for stream control (starting, stopping, moving through) and then players currently exist under on screen orbiters (which are under Media Directors) to start a client app and convey stream control commands back to the plugin.

Unfortunately the implmentation is a bit messier, the plugins only use streams if there are more than one client (I think they should have kept this simple and always streamed), otherwise they pass file handles around. Things like CD files get treated in special ways. There seems to be a lot of dependency between the plugin and player of a particular type (eg; xine) whereas I thought the point of the design was that  the stream type would tie the two together. Eg: a player would be able to play certain stream types and a plugin would serve certain stream types and you could then mix and match. So a xine player should have no problem with media from a slimserver plugin, and you could then have an mplayer player which could also play that stream.

Anyway once you have a player you need to associate it with the media type. This is all done through database tables, it certainly wasn't documented and I managed to work out how to get the JPG media type to invoke a certain player(device ID) eventually after lots of trial and error.

I know back in Pluto only days there was people looking into mplayer plugins/players but I don't think they got it to an end user level.

What did you have in mind?

I would like to have a go at producing an icecast plugin for the purpose of streaming internet radio as well as FM radio from capture cards. I attempted at one point but got the sh!ts with the code and gave up before I had too much success.

It might be worth cleaning up some of the xine code first as I would liek to know why it needs to many type checks within its code between the plugin and player.

regards
Darren

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5498
  • DOES work for LinuxMCE.
    • View Profile
Re: Anyone have experience with a new Media Plugin?
« Reply #2 on: November 15, 2007, 06:30:36 am »
simply? I'm working on supporting MAME games, as a prelude to supporting other emulators. I want to be able to treat a game as a media type, which can be dealt with using the standard media browser, and eventually, be able to pass around mame state so that I can synchronise game play between two different media directors if so desired... but at first, I just want simple game start and display on the floorplan/orbiter.

I just opened a world of hurt, didn't I?

-Thom

darrenmason

  • Addicted
  • *
  • Posts: 529
    • View Profile
Re: Anyone have experience with a new Media Plugin?
« Reply #3 on: November 15, 2007, 11:06:10 pm »
It may be quite a bit of work to add new Media Types -assuming you would want them to fit into the /public/data filesystem. Should be possible though.

If you are running the actual emulator software on the MD then I am not sure what the _plugin device would actually be needed for. The player would launch a local emulator and get passed a file reference to the ROM file, much like xine works with non streamed file playing now. It may only be needed for forming the file URLs ???

Setting up the directory structures and getting a scenario to open a file grid on them should be able to be copied from the other areas I guess.

I am interested in what you mean by synchronising the game play. Does this mean multiple screens and controllers into the same game or multiple players playing a linked up game, each with their own view.
Does MAME have support for this?

It all seems do-able, remains to be seen how hard though. Good luck, will try and help out if I can

Darren

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5498
  • DOES work for LinuxMCE.
    • View Profile
Re: Anyone have experience with a new Media Plugin?
« Reply #4 on: November 15, 2007, 11:33:41 pm »
It may be quite a bit of work to add new Media Types -assuming you would want them to fit into the /public/data filesystem. Should be possible though.

If you are running the actual emulator software on the MD then I am not sure what the _plugin device would actually be needed for. The player would launch a local emulator and get passed a file reference to the ROM file, much like xine works with non streamed file playing now. It may only be needed for forming the file URLs ???

Setting up the directory structures and getting a scenario to open a file grid on them should be able to be copied from the other areas I guess.

I am interested in what you mean by synchronising the game play. Does this mean multiple screens and controllers into the same game or multiple players playing a linked up game, each with their own view.
Does MAME have support for this?

It all seems do-able, remains to be seen how hard though. Good luck, will try and help out if I can

Darren


I'm thinking the plugin device would be needed for handling the floorplan transfer of games, and bringing them onto multiple screens... as for that infrastructure... MAME has support for state files, which contain everything needed to restore a game at a specific point, all processor, and ram states are saved.

http://www.mameworld.net/states/

and perhaps something could be done, even if it's digitizing rendered mame frames and sending them over the net, to support multiple screen view/play... This is possible, I just don't know how freakin hard it's going to be...or when that will happen.... but the goal is to have mame games be first class media citizens, complete with floorplan interaction.

-Thom

Zaerc

  • Alumni
  • LinuxMCE God
  • *
  • Posts: 2256
  • Department of Redundancy Department.
    • View Profile
Re: Anyone have experience with a new Media Plugin?
« Reply #5 on: November 16, 2007, 12:03:54 am »
So if I understand it correctly that would mean you could even have "follow me" on your classic arcade games?  That would be incredibly impressive I reckon.

BTW. I'm also very much interested in the "lost art" of adding new plugins and players, so I think that it would be a great step forward if we could document that. 
"Change is inevitable. Progress is optional."
-- Anonymous


tschak909

  • LinuxMCE God
  • ****
  • Posts: 5498
  • DOES work for LinuxMCE.
    • View Profile
Re: Anyone have experience with a new Media Plugin?
« Reply #6 on: November 16, 2007, 12:15:27 am »
follow me....exactly.

-Thom

totallymaxed

  • LinuxMCE God
  • ****
  • Posts: 4426
  • Smart Home Consulting
    • View Profile
    • Dianemo - at home with technology
Re: Anyone have experience with a new Media Plugin?
« Reply #7 on: November 17, 2007, 03:14:43 pm »
It may be quite a bit of work to add new Media Types -assuming you would want them to fit into the /public/data filesystem. Should be possible though.

If you are running the actual emulator software on the MD then I am not sure what the _plugin device would actually be needed for. The player would launch a local emulator and get passed a file reference to the ROM file, much like xine works with non streamed file playing now. It may only be needed for forming the file URLs ???

Setting up the directory structures and getting a scenario to open a file grid on them should be able to be copied from the other areas I guess.

I am interested in what you mean by synchronising the game play. Does this mean multiple screens and controllers into the same game or multiple players playing a linked up game, each with their own view.
Does MAME have support for this?

It all seems do-able, remains to be seen how hard though. Good luck, will try and help out if I can

Darren


I'm thinking the plugin device would be needed for handling the floorplan transfer of games, and bringing them onto multiple screens... as for that infrastructure... MAME has support for state files, which contain everything needed to restore a game at a specific point, all processor, and ram states are saved.

http://www.mameworld.net/states/

and perhaps something could be done, even if it's digitizing rendered mame frames and sending them over the net, to support multiple screen view/play... This is possible, I just don't know how freakin hard it's going to be...or when that will happen.... but the goal is to have mame games be first class media citizens, complete with floorplan interaction.

-Thom


Hi Thom,

What a cool idea! Let me see if i can pull some info together re plugins from our team... and post it here (and the Wiki Zaerc!)
Andy Herron,
Convergent Home Technologies Ltd
United Kingdom

Read My Blog; http://ellipticalcurve.com

Contact me for Smart Home consulting advice here;
@herron on Twitter, totallymaxed+consulting@gmail.com via email or PM me here.

Get a Dianemo S License: http://forum.linuxmce.org/index.php?topic=8880.0
iOS Orbiter: http://wiki.linuxmce.org/index.php/Dianemo_iOS_Orbiter
Follow us on Facebook: https://www.facebook.com/pages/Dianemo-Home-Automation/226019387454465

Sales & Info:
http://www.dianemo.co.uk

flying

  • Regular Poster
  • **
  • Posts: 29
    • View Profile
Re: Anyone have experience with a new Media Plugin?
« Reply #8 on: June 24, 2009, 10:39:28 am »
Thom,

Is following steps are correct for adding a new device/plug in?
-----------------------------------------------------------
1. Add a Device Template through LinuxMCE Web Admin, and the Device Template will be written to pluto_main DB
2. Use DCEGen tool to automatically generate the C++ code based on the Device Template Id which stored in pluto_main DB
3. Manually wrap the app/plug ins interface consistent with the DCE protocol since the app/plug in need communicating with DCERouter
  Notes: For non-open source app/plug ins, they must can be simply communicated via the DCE protocol
4. Use OrbiterGen to automatically generate the C++ code which incorporate the new added Device (app/plug in) to UI DB
5. Then we can co-related the Device (app/plug ins) with the new designed UI

If I create a media plug in, need I must create a media player pair? And I don't think there have communications between plug in and player(such as Xine/MythTV), am I right?

Could you shed some light on adding a new APP SW plug in?

I attached a PPT to describe the wrapper works for new plug in or devices, any comments?

Thanks,
Eric

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5498
  • DOES work for LinuxMCE.
    • View Profile
Re: Anyone have experience with a new Media Plugin?
« Reply #9 on: June 24, 2009, 06:45:21 pm »
What a difference two years makes:

Media types are defined like this:

You have a media player, which runs on each media director. This is a DCE device that basically can either:

(1) be a media player in its own right, Xine_Player uses libxine to do just this.
(2) wrap a media player by forking a process and talking to it over for example a FIFO or a network socket (mplayer_player does the former, mythtv_player does the latter.)

The media player accepts MediaStreams, these are defined in src/Media_Plugin/MediaStream.cpp and are basically handles. Media Streams are created by Media Plugins (which are subclasses of the Media Plugin itself.), and basically handle creating the media stream, finding what media players to send the stream to for an entertainment area, and sending the appropriate DCE::CMD_Play_Media() command.

The Register() method here in the Media Plugin links the Media Player device template, with the Plugin, and must be defined.

Media Players then implement at the very least, a play and stop command, which do what they need to do to start and stop the media. Typically, they receive a media stream ID, which can be used to grab media info (although, typically a media player doesn't need to know this, because it will be handed the relevant info as part of the command anyway.)

A note about device data: The Name device data (156) provides an X window tuple specifying a WM_CLASS and a window name. The Orbiter will reference this in response to the Set Now Playing command sent by the Media Plugin to figure out which window to swallow, and place on screen.

A bit of criteria, a media player's window MUST:

* be able to be resized to ANY size
* must NOT HIJACK THE SCREEN (go full screen, change resolutions, etc.)
* must not alter its window ordering in any way. It is Orbiter's bitch.

Now, Orbiter also needs a UI for the media plugin, so you need at the very least, to create a few screens:

* A Remote Screen
* A Remote FS (full screen)
* A Remote FS Options (used by UI1 OSD to show remote control on screen.)

There may be other screens you need to create to support the UI, but that is the typical scenarios.

--------------------------

Creating the templates, the best way to do it, is to look at the existing Xine and MythTV plugin/player templates and copy them.

Once you've done this:

* run /usr/pluto/DCEGen from inside your src/DCEGen folder.
* run /usr/pluto/sql2cpp from inside your src/sql2cpp folder.
* run /usr/pluto/Screengen from inside your src/ScreenGen folder.
* Implement code, hack, compile, test.