[vdr] mplayer.sh and AID 0

Stefan Huelswitt s.huelswitt at gmx.de
Fri Jul 1 19:43:41 CEST 2005


Hi,

attached is a patch which:

1.) fix the AID 0 problem. AID 0 is now allways passed. The
default autoselect is now on AID -1. To enter the -1 value, first
press 0 and than left.

2.) supports switch_audio slave command. The command is mapped to
key 2.

Regards.

PS: line numbers may be a bit off

-- 
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();
 }
diff -urN -X mp3-unstable/.exclude mp3-0.9.12/player-mplayer.c mp3-unstable/player-mplayer.c
--- 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 -----------------------------------------------------------
 
@@ -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;
@@ -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