Archive > MythTV Plugin Users

Pluto with existing Mythtv installation

<< < (2/2)

archived:
Internally we use the same commands for all media players; xine, myth, and regular i/r controlled devices like VCR's.  If you're a Linux user, ssh into the console and type TailDCERouter.sh which will tail the log file /var/log/pluto/DCERouter.newlog grepping for commands only.  You will see entries like:

08      12/01/05 14:03:49.833           Received Message from 0 (unknown / ) to 37165 (Orbiter Plug-in / main), type 1 id 266 Command:Regen Orbiter, parameters:
08      12/01/05 14:03:49.833             Parameter 2(PK_Device): 37231

That means a message went to device 37165, the type of message is a command, the id is 266 "Regen Orbiter", and the command took 1 parameter, id #2 PK_Device.  In your pluto admin website, choose Advanced, DCE, Commands to see all the commands the system knows.

Now as you control Myth (or any media player) note the commands that are of interest, and look in the source code src/MythTV_Player.cpp.

You will see code blocks like this for every command that the Myth TV device implements:

//<-dceag-c41-b->

   /** @brief COMMAND: #41 - Change Playback Speed */
   /** Will make the playback to FF with a configurable amount of speed. */
      /** @param #41 StreamID */
         /** The media needing the playback speed change. */
      /** @param #43 MediaPlaybackSpeed */
         /** The requested media playback speed * 1000.  -1000 = rev, 4000 = 4x fwd, -500 = rev 1/2.  Less than 10 = relative.  +2 = double, -1 = reverse.   See Media_Plugin::ReceivedMessage */

void MythTV_Player::CMD_Change_Playback_Speed(int iStreamID,int iMediaPlaybackSpeed,string &sCMD_Result,Message *pMessage)
//<-dceag-c41-e->
{
   // We send left/right for this
   PLUTO_SAFETY_LOCK(mm,m_MythMutex);
   if( iMediaPlaybackSpeed==2 )
      processKeyBoardInputRequest(XK_Right);
   else
      processKeyBoardInputRequest(XK_Left);
}

Our DCE library/framework will automatically call that function whenever the device receives the command.  In the device template for mythtv player you can add more commands, and then re-run our code generator DCEGen which merges in more function stubs into the .cpp file.  You will see that all of the functions now do nothing but send a keystroke.

If we had a bi-directional control with myth player, the above code should instead check the state of the front-end, and if tv is playing, specifically tell the player to change the playback speed, rather than just stuffing a 'right' arrow into the keyboard buffer.

Navigation

[0] Message Index

[*] Previous page

Sitemap 
Go to full version