libspark/playback: add more player checks

This commit is contained in:
martii
2013-11-03 14:31:45 +01:00
parent 7c4100b856
commit a4f3af23bf

View File

@@ -213,7 +213,7 @@ bool cPlayback::Start(char *filename, int vpid, int vtype, int apid, int ac3, un
{
//pause playback in case of timeshift
//FIXME: no picture on tv
if (player->playback->Command(player, PLAYBACK_PAUSE, NULL) < 0)
if (!player || !player->playback || player->playback->Command(player, PLAYBACK_PAUSE, NULL) < 0)
{
ret = false;
printf("failed to pause playback\n");
@@ -268,8 +268,7 @@ bool cPlayback::Stop(void)
player->playback->Command(player,PLAYBACK_CLOSE, NULL);
if(player)
free(player);
if(player != NULL)
player = NULL;
player = NULL;
playing=false;
return true;
@@ -412,7 +411,8 @@ bool cPlayback::GetSpeed(int &speed) const
void cPlayback::GetPts(uint64_t &pts)
{
player->playback->Command(player, PLAYBACK_PTS, (void*)&pts);
if (player && player->playback)
player->playback->Command(player, PLAYBACK_PTS, (void*)&pts);
}
// in milliseconds