From 57f3da0b1a25c285ae065a21e822ed07ef88ef4a Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Sat, 13 May 2006 12:59:19 +0000 Subject: [PATCH] Bug fixes --- demuxervdr.cc | 4 ++-- log.cc | 2 ++ player.cc | 19 ++++++++++++++++--- player.h | 2 +- 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/demuxervdr.cc b/demuxervdr.cc index a278456..2c3fd03 100644 --- a/demuxervdr.cc +++ b/demuxervdr.cc @@ -56,7 +56,7 @@ int DemuxerVDR::scan(UCHAR *buf, int len) } return ret; } - + int DemuxerVDR::findVideoPTS(UCHAR* buf, int len, ULLONG* dest) { while (len >= 14) @@ -129,7 +129,7 @@ int DemuxerVDR::put(UCHAR* buf, int len) } } - while (len >= 0) + while (len > 0) { switch (state) { diff --git a/log.cc b/log.cc index 5aa1f4c..884769f 100644 --- a/log.cc +++ b/log.cc @@ -74,6 +74,8 @@ int Log::init(int startLogLevel, char* fileName, int tenabled) // logfile = fopen(fileName, "a"); // logfile = fopen(stdout, "a"); logfile = stdout; +// logfile = fopen("/log", "a"); + if (logfile) return 1; else return 0; } diff --git a/player.cc b/player.cc index 621a878..a07d8ce 100644 --- a/player.cc +++ b/player.cc @@ -157,8 +157,10 @@ ULLONG Player::getPositionTS() // used internall (skip fw/bw) int Player::play() { lock(); - return playInt(); -// unLock(); - let thread unlock this + bool doUnlock = false; + int result = playInt(&doUnlock); + if (doUnlock) unLock(); + return result; } void Player::stop() @@ -213,7 +215,7 @@ void Player::skipBackward(int seconds) // ----------------------------------- Implementations called events -int Player::playInt() +int Player::playInt(bool* doUnlock) { if (!initted) return 0; @@ -221,6 +223,7 @@ int Player::playInt() if (paused) { togglePauseInt(); + *doUnlock = true; return 1; } @@ -238,6 +241,13 @@ int Player::playInt() return 1; } + // If we are already playing, ignore. no resyncing to do now! + if (playing) + { + *doUnlock = true; + return 1; + } + // Standard play start logger->log("Player", Log::DEBUG, "Standard play start"); @@ -429,6 +439,8 @@ void Player::lock() { #ifndef WIN32 pthread_mutex_lock(&mutex); + logger->log("Player", Log::DEBUG, "LOCKED"); + #else // FIXME Marten #endif @@ -437,6 +449,7 @@ void Player::lock() void Player::unLock() { #ifndef WIN32 + logger->log("Player", Log::DEBUG, "UNLOCKING"); pthread_mutex_unlock(&mutex); #else // FIXME Marten diff --git a/player.h b/player.h index 228f6d2..1496dce 100644 --- a/player.h +++ b/player.h @@ -78,7 +78,7 @@ class Player : public Thread_TYPE, public Callback void threadPostStopCleanup(); private: - int playInt(); + int playInt(bool* doUnlock); void stopInt(); void togglePauseInt(); void toggleFastForwardInt(); -- 2.39.2