summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--play.cpp48
-rw-r--r--player.c110
-rw-r--r--player.h30
3 files changed, 150 insertions, 38 deletions
diff --git a/play.cpp b/play.cpp
index 1ca118a..03b2c6b 100644
--- a/play.cpp
+++ b/play.cpp
@@ -185,20 +185,6 @@ extern "C" void DrawText(int x, int y, const char *s, uint32_t fg, uint32_t bg,
#endif
//////////////////////////////////////////////////////////////////////////////
-// Play
-//////////////////////////////////////////////////////////////////////////////
-
-static char DvdNav; ///< dvdnav active
-static char PlayerPaused; ///< player paused
-static char PlayerSpeed; ///< player playback speed
-
-#define PlayerSendQuit()
-#define PlayerSendPause()
-#define PlayerSendSetSpeed(x)
-#define PlayerSendSeek(x)
-#define SendCommand(x)
-
-//////////////////////////////////////////////////////////////////////////////
// cPlayer
//////////////////////////////////////////////////////////////////////////////
@@ -471,8 +457,8 @@ eOSState cMyControl::ProcessKey(eKeys key)
state = osContinue;
switch ((int)key) { // cast to shutup g++ warnings
case kUp:
- if (DvdNav) {
- SendCommand("pausing_keep dvdnav up\n");
+ if (PlayerDvdNav) {
+ PlayerSendDvdNavUp();
break;
}
case kPlay:
@@ -488,8 +474,8 @@ eOSState cMyControl::ProcessKey(eKeys key)
break;
case kDown:
- if (DvdNav) {
- SendCommand("pausing_keep dvdnav down\n");
+ if (PlayerDvdNav) {
+ PlayerSendDvdNavDown();
break;
}
case kPause:
@@ -506,8 +492,8 @@ eOSState cMyControl::ProcessKey(eKeys key)
// FIXME:
break;
case kLeft:
- if (DvdNav) {
- SendCommand("pausing_keep dvdnav left\n");
+ if (PlayerDvdNav) {
+ PlayerSendDvdNavLeft();
break;
}
case kFastRew:
@@ -519,8 +505,8 @@ eOSState cMyControl::ProcessKey(eKeys key)
ShowReplayMode();
break;
case kRight:
- if (DvdNav) {
- SendCommand("pausing_keep dvdnav right\n");
+ if (PlayerDvdNav) {
+ PlayerSendDvdNavRight();
break;
}
case kFastFwd:
@@ -585,9 +571,9 @@ eOSState cMyControl::ProcessKey(eKeys key)
return osEnd;
case kOk:
- if (DvdNav) {
- SendCommand("pausing_keep dvdnav select\n");
- // FIXME: DvdNav = 0;
+ if (PlayerDvdNav) {
+ PlayerSendDvdNavSelect();
+ // FIXME: PlayerDvdNav = 0;
break;
}
// FIXME: full mode
@@ -595,8 +581,8 @@ eOSState cMyControl::ProcessKey(eKeys key)
break;
case kBack:
- if (DvdNav > 1) {
- SendCommand("pausing_keep dvdnav prev\n");
+ if (PlayerDvdNav > 1) {
+ PlayerSendDvdNavPrev();
break;
}
PlayerSendQuit();
@@ -605,8 +591,8 @@ eOSState cMyControl::ProcessKey(eKeys key)
return osBack;
case kMenu:
- if (DvdNav) {
- SendCommand("pausing_keep dvdnav menu\n");
+ if (PlayerDvdNav) {
+ PlayerSendDvdNavMenu();
break;
}
break;
@@ -614,12 +600,12 @@ eOSState cMyControl::ProcessKey(eKeys key)
case kAudio: // VDR: eats the keys
case k7:
// FIXME: audio menu
- SendCommand("pausing_keep switch_audio\n");
+ PlayerSendSwitchAudio();
break;
case kSubtitles: // VDR: eats the keys
case k9:
// FIXME: subtitle menu
- SendCommand("pausing_keep sub_select\n");
+ PlayerSendSubSelect();
break;
default:
diff --git a/player.c b/player.c
index f8dc295..4d2e2c4 100644
--- a/player.c
+++ b/player.c
@@ -131,11 +131,11 @@ static int PlayerPipeIdx; ///< pipe buffer index
static int PlayerPipeOut[2]; ///< player write pipe
static int PlayerPipeIn[2]; ///< player read pipe
-static char DvdNav; ///< dvdnav active
-
static int PlayerVolume = -1; ///< volume 0 - 100
-static char PlayerPaused; ///< player paused
-static char PlayerSpeed; ///< player playback speed
+
+char PlayerDvdNav; ///< dvdnav active
+char PlayerPaused; ///< player paused
+char PlayerSpeed; ///< player playback speed
//////////////////////////////////////////////////////////////////////////////
// Slave
@@ -153,9 +153,9 @@ static void PlayerParseLine(const char *data, int size)
// data is \0 terminated
if (!strncasecmp(data, "DVDNAV_TITLE_IS_MENU", 20)) {
- DvdNav = 1;
+ PlayerDvdNav = 1;
} else if (!strncasecmp(data, "DVDNAV_TITLE_IS_MOVIE", 21)) {
- DvdNav = 2;
+ PlayerDvdNav = 2;
} else if (!strncasecmp(data, "ID_DVD_VOLUME_ID=", 17)) {
Debug(3, "DVD_VOLUME = %s\n", data + 17);
} else if (!strncasecmp(data, "ID_AID_", 7)) {
@@ -508,6 +508,8 @@ static void PlayerThreadExit(void)
/**
** Send command to player.
+**
+** @param formst printf format string
*/
static void SendCommand(const char *format, ...)
{
@@ -556,6 +558,8 @@ void PlayerSendPause(void)
/**
** Send player speed_set.
+**
+** @param speed mplayer speed
*/
void PlayerSendSetSpeed(int speed)
{
@@ -566,6 +570,8 @@ void PlayerSendSetSpeed(int speed)
/**
** Send player seek.
+**
+** @param seconds seek in seconds relative to current position
*/
void PlayerSendSeek(int seconds)
{
@@ -587,6 +593,96 @@ void PlayerSendVolume(void)
}
/**
+** Send switch audio track.
+*/
+void PlayerSendSwitchAudio(void)
+{
+ if (ConfigUseSlave) {
+ SendCommand("pausing_keep switch_audio\n");
+ }
+}
+
+/**
+** Send select subtitle.
+*/
+void PlayerSendSubSelect(void)
+{
+ if (ConfigUseSlave) {
+ SendCommand("pausing_keep sub_select\n");
+ }
+}
+
+/**
+** Send up for dvdnav.
+*/
+void PlayerSendDvdNavUp(void)
+{
+ if (ConfigUseSlave) {
+ SendCommand("pausing_keep dvdnav up\n");
+ }
+}
+
+/**
+** Send down for dvdnav.
+*/
+void PlayerSendDvdNavDown(void)
+{
+ if (ConfigUseSlave) {
+ SendCommand("pausing_keep dvdnav down\n");
+ }
+}
+
+/**
+** Send left for dvdnav.
+*/
+void PlayerSendDvdNavLeft(void)
+{
+ if (ConfigUseSlave) {
+ SendCommand("pausing_keep dvdnav left\n");
+ }
+}
+
+/**
+** Send right for dvdnav.
+*/
+void PlayerSendDvdNavRight(void)
+{
+ if (ConfigUseSlave) {
+ SendCommand("pausing_keep dvdnav right\n");
+ }
+}
+
+/**
+** Send select for dvdnav.
+*/
+void PlayerSendDvdNavSelect(void)
+{
+ if (ConfigUseSlave) {
+ SendCommand("pausing_keep dvdnav select\n");
+ }
+}
+
+/**
+** Send prev for dvdnav.
+*/
+void PlayerSendDvdNavPrev(void)
+{
+ if (ConfigUseSlave) {
+ SendCommand("pausing_keep dvdnav prev\n");
+ }
+}
+
+/**
+** Send menu for dvdnav.
+*/
+void PlayerSendDvdNavMenu(void)
+{
+ if (ConfigUseSlave) {
+ SendCommand("pausing_keep dvdnav menu\n");
+ }
+}
+
+/**
** Start external player.
**
** @param filename path and name of file to play
@@ -605,7 +701,7 @@ void PlayerStart(const char *filename)
PlayerPaused = 0;
PlayerSpeed = 1;
- DvdNav = 0;
+ PlayerDvdNav = 0;
if (ConfigOsdOverlay) { // overlay wanted
VideoSetColorKey(ConfigColorKey);
diff --git a/player.h b/player.h
index 620f84a..983e461 100644
--- a/player.h
+++ b/player.h
@@ -100,6 +100,9 @@ extern "C"
/// Browser root=start directory
extern const char *ConfigBrowserRoot;
extern const char *X11DisplayName; ///< x11 display name
+ extern char PlayerDvdNav; ///< dvdnav active
+ extern char PlayerPaused; ///< player paused
+ extern char PlayerSpeed; ///< player playback speed
/// Start external player
extern void PlayerStart(const char *name);
@@ -111,6 +114,33 @@ extern "C"
/// Set player volume
extern void PlayerSetVolume(int);
+ /// Player send quit command
+ extern void PlayerSendQuit(void);
+ /// Player send toggle pause command
+ extern void PlayerSendPause(void);
+ /// Player send set play speed
+ extern void PlayerSendSetSpeed(int);
+ /// Player send seek
+ extern void PlayerSendSeek(int);
+ /// Player send switch audio track
+ extern void PlayerSendSwitchAudio(void);
+ /// Player send select subtitle
+ extern void PlayerSendSubSelect(void);
+ /// Player send dvd-nav up
+ extern void PlayerSendDvdNavUp(void);
+ /// Player send dvd-nav down
+ extern void PlayerSendDvdNavDown(void);
+ /// Player send dvd-nav left
+ extern void PlayerSendDvdNavLeft(void);
+ /// Player send dvd-nav right
+ extern void PlayerSendDvdNavRight(void);
+ /// Player send dvd-nav menu select
+ extern void PlayerSendDvdNavSelect(void);
+ /// Player send dvd-nav menu prev
+ extern void PlayerSendDvdNavPrev(void);
+ /// Player send dvd-nav prev
+ extern void PlayerSendDvdNavMenu(void);
+
#ifdef __cplusplus
}
#endif