@@ -2126,6 +2145,26 @@
"",
#endif
},
+ { "Setup.MPlayer$Slave command key",
+ "Slave Kommando Taste",
+ "", // TODO
+ "", // TODO
+ "", // TODO
+ "", // TODO
+ "",
+ "", // TODO
+ "",
+ "", // TODO
+ "",
+ "", // TODO
+ "",
+ "", // TODO
+ "", // TODO
+ "",
+#if VDRVERSNUM >= 10302
+ "",
+#endif
+ },
{ "MPlayer Audio ID",
"MPlayer Audio ID",
"", // TODO
@@ -71,6 +76,13 @@
res[2]=tr("local first");
Add(new cMenuEditStraItem(tr("Setup.MPlayer$Resume mode"), &data.ResumeMode, 3, res));
Add(new cMenuEditBoolItem(tr("Hide mainmenu entry"), &data.HideMainMenu));
+ for(int i=0; i<10; i++) {
+ if(i==3 || i==9) continue;
+ char name[32];
+ snprintf(name,sizeof(name),"%s %d",tr("Setup.MPlayer$Slave command key"),i);
+ static const char allowed[] = { "abcdefghijklmnopqrstuvwxyz0123456789!\"§$%&/()=?{}[]\\+*~#',;.:-_<>|@Ž`^°" };
+ Add(new cMenuEditStrItem(name, data.KeyCmd[i],MAX_KEYCMD,allowed));
+ }
}
void cMenuSetupMPlayer::Store(void)
@@ -79,6 +91,12 @@
SetupStore("ControlMode", MPlayerSetup.SlaveMode);
SetupStore("HideMainMenu",MPlayerSetup.HideMainMenu);
SetupStore("ResumeMode", MPlayerSetup.ResumeMode);
+ for(int i=0; i<10; i++) {
+ if(i==3 || i==9) continue;
+ char name[16];
+ snprintf(name,sizeof(name),"KeyCmd%d",i);
+ SetupStore(name,MPlayerSetup.KeyCmd[i]);
+ }
}
// --- cMPlayerControl ---------------------------------------------------------
@@ -458,26 +476,30 @@
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 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;
ShowTimed();
}
break;
+ case k0:
+ case k1:
+ case k2:
+ case k4:
+ case k5:
+ case k6:
+ case k7:
+ case k8: {
+ const char *cmd=MPlayerSetup.KeyCmd[Key-k0];
+ if(cmd[0]) player->KeyCmd(cmd);
+ }
+ break;
default: break;
}
break;
@@ -499,7 +521,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 +563,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();
}
@@ -713,6 +763,8 @@
if( !strcasecmp(Name, "ControlMode")) MPlayerSetup.SlaveMode = atoi(Value);
else if (!strcasecmp(Name, "HideMainMenu")) MPlayerSetup.HideMainMenu = atoi(Value);
else if (!strcasecmp(Name, "ResumeMode")) MPlayerSetup.ResumeMode = atoi(Value);
+ else if (!strncasecmp(Name, "KeyCmd", 6) && strlen(Name)==7 && isdigit(Name[6]))
+ strn0cpy(MPlayerSetup.KeyCmd[Name[6]-'0'],Value,sizeof(MPlayerSetup.KeyCmd[0]));
else return false;
return true;
}
@@ -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);
@@ -597,32 +626,9 @@
}
}
-void cMPlayerPlayer::Osd(void)
-{
- if(slave) {
- MPlayerControl("osd");
- }
-}
-
-void cMPlayerPlayer::AudioDelay(int del)
-{
- if(slave) {
- MPlayerControl("audio_delay %+.1f",(float)del/10.0);
- }
-}
-
-void cMPlayerPlayer::DvdNav(eDvdNav mode)
+void cMPlayerPlayer::KeyCmd(const char *cmd)
{
- 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;
- }
- }
+ if(slave) MPlayerControl(cmd);
}
bool cMPlayerPlayer::GetIndex(int &Current, int &Total, bool SnapToIFrame)
@@ -48,8 +48,6 @@
// ----------------------------------------------------------------
-enum eDvdNav { navUp, navDown, navLeft, navRight, navMenu, navSelect };
-
class cMPlayerPlayer : public cPlayer, cThread {
private:
cFileObj *file;
@@ -80,9 +79,7 @@
void Play(void);
void Goto(int Index, bool percent, bool still);
void SkipSeconds(int secs);
- void Osd(void);
- void AudioDelay(int del);
- void DvdNav(eDvdNav mode);
+ void KeyCmd(const char *cmd);
virtual bool GetIndex(int &Current, int &Total, bool SnapToIFrame);
virtual bool GetReplayMode(bool &Play, bool &Forward, int &Speed);
};
@@ -19,6 +19,8 @@
* Or, point your browser to http://www.gnu.org/copyleft/gpl.html
*/
+#include <string.h>
+
#include "common.h"
#include "setup-mplayer.h"
@@ -31,4 +33,8 @@
SlaveMode = 0;
ResumeMode = 2;
HideMainMenu = 0;
+ memset(KeyCmd,0,sizeof(KeyCmd));
+ strcpy(KeyCmd[1],"audio_delay +0.1");
+ strcpy(KeyCmd[7],"audio_delay -0.1");
+ strcpy(KeyCmd[4],"switch_audio");
}
@@ -26,11 +26,14 @@
// ----------------------------------------------------------------
+#define MAX_KEYCMD 32
+
class cMPlayerSetup {
public:
int SlaveMode;
int ResumeMode;
int HideMainMenu;
+ char KeyCmd[10][MAX_KEYCMD];
public:
cMPlayerSetup(void);
};