libspark/player, libeplayer3/ffmpeg: improve termination handling

This commit is contained in:
martii
2013-11-02 12:58:29 +01:00
parent eda54c7cea
commit 773553ddb5
3 changed files with 13 additions and 3 deletions

View File

@@ -346,7 +346,7 @@ static void FFMPEGThread(Context_t *context) {
}
ffmpeg_printf(10, "Running!\n");
while ( context && context->playback && context->playback->isPlaying ) {
while ( context && context->playback && context->playback->isPlaying && !context->playback->abortRequested ) {
//IF MOVIE IS PAUSED, WAIT
if (context->playback->isPaused) {

View File

@@ -15,7 +15,7 @@ extern ManagerHandler_t ManagerHandler;
#include "playback_libeplayer3.h"
#include "subtitle.h"
static Context_t *player;
static Context_t *player = NULL;
extern cAudio *audioDecoder;
extern cVideo *videoDecoder;
@@ -710,8 +710,17 @@ void cPlayback::SuspendSubtitle(bool b)
}
void cPlayback::RequestAbort() {
if (player->playback)
if (player && player->playback) {
player->playback->abortRequested = 1;
while (player->playback->isPlaying)
usleep(100000);
}
}
bool cPlayback::isPlaying() {
if (player && player->playback)
return player->playback->isPlaying;
return false;
}
#if 0
bool cPlayback::IsPlaying(void) const

View File

@@ -48,6 +48,7 @@ class cPlayback
void FindAllDvbsubtitlePids(int *pids, unsigned int *numpids, std::string *language);
void FindAllTeletextsubtitlePids(int *pids, unsigned int *numpidt, std::string *tlanguage);
void RequestAbort(void);
bool isPlaying(void);
#if 0
void FindAllSubs(uint16_t *pids, unsigned short *supported, uint16_t *numpida, std::string *language);
bool SelectSubtitles(int pid);