diff options
| author | Johns <johns98@gmx.net> | 2013-02-16 19:47:59 +0100 |
|---|---|---|
| committer | Johns <johns98@gmx.net> | 2013-02-16 19:47:59 +0100 |
| commit | 25e388fab0b2b3ae1c4bdfceee202b426efcace9 (patch) | |
| tree | aeb9acdb04da2b78f226792d34ff2c1d5849da59 | |
| parent | 9500e98d5da3e406ad77d8a898b5bc8632046740 (diff) | |
| download | vdr-plugin-play-25e388fab0b2b3ae1c4bdfceee202b426efcace9.tar.gz vdr-plugin-play-25e388fab0b2b3ae1c4bdfceee202b426efcace9.tar.bz2 | |
Stop/kill external player.
| -rw-r--r-- | player.c | 31 |
1 files changed, 31 insertions, 0 deletions
@@ -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(); |
