From 5337e0ed5d0ebbe73e8df9fbff8e7b258cf42199 Mon Sep 17 00:00:00 2001 From: phintuka Date: Wed, 16 Aug 2006 21:46:34 +0000 Subject: Improved end of stream signalling Some extra checks to catch null pointers and empty strings --- frontend_local.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) (limited to 'frontend_local.c') diff --git a/frontend_local.c b/frontend_local.c index cf5a3f6f..fa998e07 100644 --- a/frontend_local.c +++ b/frontend_local.c @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: frontend_local.c,v 1.6 2006-08-07 17:12:29 phintuka Exp $ + * $Id: frontend_local.c,v 1.7 2006-08-16 21:46:34 phintuka Exp $ * */ @@ -146,6 +146,18 @@ int64_t cXinelibLocal::GetSTC() return pts; } +// +// Playback files +// + +bool cXinelibLocal::EndOfStreamReached(void) +{ + LOCK_THREAD; + if(fe->xine_is_finished(fe, 1)) + return true; + return cXinelibThread::EndOfStreamReached(); +} + // // Configuration // @@ -190,11 +202,13 @@ void cXinelibLocal::ConfigureDecoder(int pes_buffers, int priority) int cXinelibLocal::Xine_Control(const char *cmd) { TRACEF("cXinelibLocal::Xine_Control"); - char buf[256]; - sprintf(buf, "%s\r\n", cmd); - LOCK_FE; - if(fe) - return fe->xine_control(fe, (char*)buf); + if(cmd && *cmd) { + char buf[2048]; + sprintf(buf, "%s\r\n", cmd); + LOCK_FE; + if(fe) + return fe->xine_control(fe, (char*)buf); + } return 0; } @@ -416,13 +430,13 @@ void cXinelibLocal::Action(void) { LOCK_FE; while(!GetStopSignal() && m_bReady && - (/*m_bLoopPlay ||*/ !fe->xine_is_finished(fe)) && + (/*m_bLoopPlay ||*/ !fe->xine_is_finished(fe, 0)) && fe->fe_run(fe)) /*cCondWait::SleepMs(50)*/ ; } LOGDBG("cXinelibLocal::Action - event loop terminated, " - "xine_is_finished=%d", fe->xine_is_finished(fe)); + "xine_is_finished=%d", fe->xine_is_finished(fe, 0)); { LOCK_THREAD; -- cgit v1.2.3