summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--frontend_local.c46
-rw-r--r--frontend_local.h18
2 files changed, 27 insertions, 37 deletions
diff --git a/frontend_local.c b/frontend_local.c
index 6a4006c4..9a96590f 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.41 2009-06-01 14:01:28 phintuka Exp $
+ * $Id: frontend_local.c,v 1.42 2009-08-18 12:36:56 phintuka Exp $
*
*/
@@ -92,21 +92,7 @@ cXinelibLocal::~cXinelibLocal()
m_bReady = false;
- Stop();
- if(fe) {
- fe->fe_free(fe);
- fe = NULL;
- }
- if(h_fe_lib) {
- dlclose(h_fe_lib);
- }
-}
-
-void cXinelibLocal::Stop(void)
-{
- TRACEF("cXinelibLocal::Stop");
-
- SetStopSignal();
+ Cancel(-1);
{
LOCK_FE;
@@ -115,7 +101,15 @@ void cXinelibLocal::Stop(void)
fe->fe_interrupt(fe);
}
- cXinelibThread::Stop();
+ Cancel(3);
+
+ if (fe) {
+ fe->fe_free(fe);
+ fe = NULL;
+ }
+ if (h_fe_lib) {
+ dlclose(h_fe_lib);
+ }
}
//
@@ -128,7 +122,7 @@ int cXinelibLocal::Play_PES(const uchar *data, int len)
{
LOCK_FE;
- if(fe && !m_bStopThread) {
+ if (fe && Running()) {
int done = fe->xine_queue_pes_packet(fe, (char*)data, len);
if (done >= 0) {
Lock();
@@ -222,7 +216,7 @@ void cXinelibLocal::ConfigureDecoder(int pes_buffers)
fe->fe_interrupt(fe);
}
- while(!m_bReady && !GetStopSignal())
+ while (!m_bReady && Running())
cCondWait::SleepMs(100);
cCondWait::SleepMs(100);
@@ -235,7 +229,7 @@ void cXinelibLocal::ConfigureDecoder(int pes_buffers)
int cXinelibLocal::Xine_Control(const char *cmd)
{
TRACEF("cXinelibLocal::Xine_Control");
- if(cmd && *cmd && !GetStopSignal()) {
+ if (cmd && *cmd && Running()) {
char buf[4096];
if(snprintf(buf, sizeof(buf), "%s\r\n", cmd) >= (int)sizeof(buf)) {
buf[sizeof(buf)-1] = 0;
@@ -345,7 +339,7 @@ void cXinelibLocal::Action(void)
curr_fe = load_frontend(xc.local_frontend);
if(!curr_fe) {
LOGMSG("cXinelibLocal: Error initializing frontend");
- SetStopSignal();
+ Cancel(-1);
} else {
LOGDBG("cXinelibLocal::Action - fe created");
if(!curr_fe->fe_display_open(curr_fe, 0, 0, xc.width, xc.height, xc.fullscreen, xc.hud_osd,
@@ -356,7 +350,7 @@ void cXinelibLocal::Action(void)
xc.field_order,
NULL, -1)) {
LOGMSG("cXinelibLocal: Error initializing display");
- SetStopSignal();
+ Cancel(-1);
} else {
LOGDBG("cXinelibLocal::Action - fe->fe_display_open ok");
}
@@ -364,7 +358,7 @@ void cXinelibLocal::Action(void)
}
// main loop
- while (!GetStopSignal()) {
+ while (Running()) {
{
// init and start xine engine
@@ -426,9 +420,9 @@ void cXinelibLocal::Action(void)
LOGDBG("cXinelibLocal:Action - Starting event loop");
{
LOCK_FE;
- while(!GetStopSignal() && m_bReady &&
- (/*m_bLoopPlay ||*/ !fe->xine_is_finished(fe, 0)) &&
- fe->fe_run(fe))
+ while (Running() && m_bReady &&
+ (/*m_bLoopPlay ||*/ !fe->xine_is_finished(fe, 0)) &&
+ fe->fe_run(fe))
/*cCondWait::SleepMs(50)*/ ;
}
diff --git a/frontend_local.h b/frontend_local.h
index 1a44f3bd..2054ec51 100644
--- a/frontend_local.h
+++ b/frontend_local.h
@@ -4,7 +4,7 @@
* See the main source file 'xineliboutput.c' for copyright information and
* how to reach the author.
*
- * $Id: frontend_local.h,v 1.6 2008-11-18 15:06:12 phintuka Exp $
+ * $Id: frontend_local.h,v 1.7 2009-08-18 12:36:56 phintuka Exp $
*
*/
@@ -19,20 +19,16 @@ extern "C" {
typedef struct frontend_s frontend_t;
}
-class cXinelibLocal : public cXinelibThread
+class cXinelibLocal : public cXinelibThread
{
public:
cXinelibLocal(const char *frontend_name);
virtual ~cXinelibLocal();
- // Thread control
- virtual void Stop(void);
-
protected:
virtual void Action(void);
-
public:
// Data transfer
@@ -44,12 +40,12 @@ class cXinelibLocal : public cXinelibThread
virtual bool EndOfStreamReached(void);
// Image grabbing
- virtual uchar *GrabImage(int &Size, bool Jpeg, int Quality,
+ virtual uchar *GrabImage(int &Size, bool Jpeg, int Quality,
int SizeX, int SizeY);
// Configuration
- virtual void ConfigureWindow(int fullscreen, int width, int height,
- int modeswitch, const char *modeline,
+ virtual void ConfigureWindow(int fullscreen, int width, int height,
+ int modeswitch, const char *modeline,
int aspect, int scale_video, int field_order);
virtual void ConfigureDecoder(int pes_buffers);
@@ -60,11 +56,11 @@ class cXinelibLocal : public cXinelibThread
protected:
- // Frontend access
+ // Frontend access
frontend_t *load_frontend(const char *fe_name);
// Data
- void *h_fe_lib;
+ void *h_fe_lib;
frontend_t *fe;
cRwLock m_feLock;
bool m_bReconfigRequest;