summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohns <johns98@gmx.net>2013-02-16 19:47:59 +0100
committerJohns <johns98@gmx.net>2013-02-16 19:47:59 +0100
commit25e388fab0b2b3ae1c4bdfceee202b426efcace9 (patch)
treeaeb9acdb04da2b78f226792d34ff2c1d5849da59
parent9500e98d5da3e406ad77d8a898b5bc8632046740 (diff)
downloadvdr-plugin-play-25e388fab0b2b3ae1c4bdfceee202b426efcace9.tar.gz
vdr-plugin-play-25e388fab0b2b3ae1c4bdfceee202b426efcace9.tar.bz2
Stop/kill external player.
-rw-r--r--player.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/player.c b/player.c
index fac99be..fd02dff 100644
--- a/player.c
+++ b/player.c
@@ -620,6 +620,37 @@ void PlayerStop(void)
{
PlayerThreadExit();
+ //
+ // stop mplayer, if it is still running.
+ //
+ if (PlayerIsRunning()) {
+ int waittime;
+ int timeout;
+
+ waittime = 0;
+ timeout = 500; // 0.5s
+
+ kill(PlayerPid, SIGTERM);
+ // wait for player finishing, with timeout
+ while (PlayerIsRunning() && waittime++ < timeout) {
+ usleep(1 * 1000);
+ }
+ if (PlayerIsRunning()) { // still running
+ waittime = 0;
+ timeout = 500; // 0.5s
+
+ kill(PlayerPid, SIGKILL);
+ // wait for player finishing, with timeout
+ while (PlayerIsRunning() && waittime++ < timeout) {
+ usleep(1 * 1000);
+ }
+ if (PlayerIsRunning()) {
+ Error(_("play: can't stop player\n"));
+ }
+ }
+ }
+ PlayerPid = 0;
+
if (ConfigOsdOverlay) {
DisableDummyDevice();
VideoExit();