[vdr] mplayer.sh and AID 0

Stefan Huelswitt s.huelswitt at gmx.de
Sat Jul 2 15:58:21 CEST 2005


On 02 Jul 2005 "C.Y.M" <syphir at syphir.sytes.net> wrote:

> Ok, This is what I have seen so far (while using this new patch for the mplayer
> plugin).
> 
> If I set the AID to "default", and do not make any changes to mplayer.sh-0.8.6
> (reversing my patch above), then I am able to switch AIDs on the fly using the
> "2" key on the remote.  But, without any changes to mplayer.sh, I am not able to
> specify a particular default AID (ie; setting AID to 0,1,2,...).  This would not

Your mplayer.sh at least has to have support for the AID
parameter and (vanilla) mplayer.sh-0.8.6 doesn't have it
(AFAIK).

> Also, it appears that the mplayer plugin is still not returning "AID 0" to the
> mplayer.sh script.

Well, I checked this and found that unfortunaly one change is
missing in the patch:

-    if(MPlayerAid>0) snprintf(aid,sizeof(aid)," AID %d",MPlayerAid);
+    if(MPlayerAid>=0) snprintf(aid,sizeof(aid)," AID %d",MPlayerAid);

(I'll attach the whole patch for completenes)

Regards.

-- 
Stefan Huelswitt
s.huelswitt at gmx.de  | http://www.muempf.de/
-------------- next part --------------
diff -urN -X mp3-unstable/.exclude mp3-0.9.12/mplayer.c mp3-unstable/mplayer.c
--- mp3-0.9.12/mplayer.c	2005-02-21 18:30:01.000000000 +0100
+++ mp3-unstable/mplayer.c	2005-07-01 19:26:51.000000000 +0200
@@ -458,20 +458,15 @@
           case kOk: if(visible && !modeOnly) { Hide(); DoShowMode=true; }
                     else ShowTimed();
                     break;
-          case k0:  player->DvdNav(navMenu); break;
           case k1:  player->AudioDelay(1); break;
-          case k2:  player->DvdNav(navUp); break;
+          case k2:  player->SwitchAudio(); break;
           case k3:  if(visible && !modeOnly) {
                       Hide();
                       osdPos--; if(osdPos<-6) osdPos=-6;
                       ShowTimed();
                       }
                     break;
-          case k4:  player->DvdNav(navLeft); break;
-          case k5:  player->DvdNav(navSelect); break;
-          case k6:  player->DvdNav(navRight); break;
           case k7:  player->AudioDelay(-1); break;
-          case k8:  player->DvdNav(navDown); break;
           case k9:  if(visible && !modeOnly) {
                       Hide();
                       osdPos++; if(osdPos>0) osdPos=0;
@@ -499,7 +494,7 @@
 cMenuMPlayAid::cMenuMPlayAid(void)
 :cOsdMenu(tr("MPlayer Audio ID"),20)
 {
-  Add(new cMenuEditIntItem(tr("Audiostream ID"),&MPlayerAid,0,255));
+  Add(new cMenuEditIntItem(tr("Audiostream ID"),&MPlayerAid,-1,255));
   Display();
 }
 
@@ -538,7 +533,7 @@
 void cMenuMPlayBrowse::SetButtons(void)
 {
   static char blue[12];
-  snprintf(blue,sizeof(blue),"AID:%d",MPlayerAid);
+  snprintf(blue,sizeof(blue),MPlayerAid>=0 ? "AID:%d" : "AID:def",MPlayerAid);
   SetHelp(tr("Play"), MPlayerSetup.ResumeMode ? tr("Rewind"):0, tr("Source"), blue);
   Display();
 }
--- mp3-0.9.12/player-mplayer.c	2005-01-12 18:07:22.000000000 +0100
+++ mp3-unstable/player-mplayer.c	2005-07-01 19:15:41.000000000 +0200
@@ -48,7 +49,7 @@
 #define MPLAYER_2_VDR(x) (MIN((int)((x)*2.55),255))
 
 const char *MPlayerCmd = "mplayer.sh";
-int MPlayerAid=0;
+int MPlayerAid=-1;
 
 // -- cMPlayerStatus -----------------------------------------------------------
 
@@ -378,7 +380,7 @@
 
     char cmd[64+PATH_MAX*2], aid[20];
     char *fname=Quote(file->FullPath());
-    if(MPlayerAid>0) snprintf(aid,sizeof(aid)," AID %d",MPlayerAid);
+    if(MPlayerAid>=0) snprintf(aid,sizeof(aid)," AID %d",MPlayerAid);
     else aid[0]=0;
     snprintf(cmd,sizeof(cmd),"%s \"%s\" %s%s",MPlayerCmd,fname,MPlayerSetup.SlaveMode?"SLAVE":"",aid);
     free(fname);
@@ -611,17 +640,10 @@
     }
 }
 
-void cMPlayerPlayer::DvdNav(eDvdNav mode)
+void cMPlayerPlayer::SwitchAudio(void)
 {
   if(slave) {
-    switch(mode) {
-      case navUp:     MPlayerControl("dvdnav 1"); break;
-      case navDown:   MPlayerControl("dvdnav 2"); break;
-      case navLeft:   MPlayerControl("dvdnav 3"); break;
-      case navRight:  MPlayerControl("dvdnav 4"); break;
-      case navMenu:   MPlayerControl("dvdnav 5"); break;
-      case navSelect: MPlayerControl("dvdnav 6"); break;
-      }
+    MPlayerControl("switch_audio");
     }
 }
 
diff -urN -X mp3-unstable/.exclude mp3-0.9.12/player-mplayer.h mp3-unstable/player-mplayer.h
--- mp3-0.9.12/player-mplayer.h	2005-01-09 13:33:23.000000000 +0100
+++ mp3-unstable/player-mplayer.h	2005-07-01 19:13:56.000000000 +0200
@@ -48,8 +48,6 @@
 
 // ----------------------------------------------------------------
 
-enum eDvdNav { navUp, navDown, navLeft, navRight, navMenu, navSelect };
-
 class cMPlayerPlayer : public cPlayer, cThread {
 private:
   cFileObj *file;
@@ -57,6 +55,7 @@
   cMPlayerResume *resume;
   bool started, slave, run;
   int pid, inpipe[2], outpipe[2], pipefl;
+  bool brokenPipe;
   enum ePlayMode { pmPlay, pmPaused };
   ePlayMode playMode;
   int index, total, saveIndex;
@@ -82,7 +81,7 @@
   void SkipSeconds(int secs);
   void Osd(void);
   void AudioDelay(int del);
-  void DvdNav(eDvdNav mode);
+  void SwitchAudio(void);
   virtual bool GetIndex(int &Current, int &Total, bool SnapToIFrame);
   virtual bool GetReplayMode(bool &Play, bool &Forward, int &Speed);
   };


More information about the vdr mailing list