summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--frontend.c8
-rw-r--r--frontend_local.c30
-rw-r--r--frontend_local.h5
-rw-r--r--frontend_svr.c26
-rw-r--r--xine_fbfe_frontend.c3
-rw-r--r--xine_frontend.c35
-rw-r--r--xine_frontend.h4
-rw-r--r--xine_frontend_main.c4
-rw-r--r--xine_input_vdr.c11
-rw-r--r--xine_sxfe_frontend.c3
10 files changed, 90 insertions, 39 deletions
diff --git a/frontend.c b/frontend.c
index e97de243..cc6d2cda 100644
--- a/frontend.c
+++ b/frontend.c
@@ -4,7 +4,7 @@
* See the main source file 'xineliboutput.c' for copyright information and
* how to reach the author.
*
- * $Id: frontend.c,v 1.9 2006-08-15 16:39:36 phintuka Exp $
+ * $Id: frontend.c,v 1.10 2006-08-16 21:46:34 phintuka Exp $
*
*/
@@ -575,17 +575,15 @@ int cXinelibThread::ConfigurePostprocessing(const char *deinterlace_method,
int cXinelibThread::ConfigurePostprocessing(const char *name, bool on, const char *args)
{
char tmp[1024];
- if(!name) name = "0";
- if(!args) args = "";
if(on) {
- sprintf(tmp, "POST %s On %s", name, args);
+ sprintf(tmp, "POST %s On %s", (name&&*name)?name:"0", args?args:"");
return Xine_Control(tmp);
} else {
// 0 - audio vis.
// 1 - audio post
// 2 - video post
//return fe->post_close(fe, name, -1);
- sprintf(tmp, "POST %s Off", name);
+ sprintf(tmp, "POST %s Off", (name&&*name)?name:"0");
return Xine_Control(tmp);
}
return -1;
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 $
*
*/
@@ -147,6 +147,18 @@ int64_t cXinelibLocal::GetSTC()
}
//
+// 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;
diff --git a/frontend_local.h b/frontend_local.h
index 8e1250ad..59bb31d0 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.2 2006-06-04 11:00:04 phintuka Exp $
+ * $Id: frontend_local.h,v 1.3 2006-08-16 21:46:34 phintuka Exp $
*
*/
@@ -41,6 +41,9 @@ class cXinelibLocal : public cXinelibThread
virtual void OsdCmd(void *cmd);
virtual int64_t GetSTC();
+ // Playback files
+ virtual bool EndOfStreamReached(void);
+
// Image grabbing
virtual uchar *GrabImage(int &Size, bool Jpeg, int Quality,
int SizeX, int SizeY);
diff --git a/frontend_svr.c b/frontend_svr.c
index 0a8e05f0..ab7433bf 100644
--- a/frontend_svr.c
+++ b/frontend_svr.c
@@ -4,7 +4,7 @@
* See the main source file 'xineliboutput.c' for copyright information and
* how to reach the author.
*
- * $Id: frontend_svr.c,v 1.11 2006-08-07 17:08:33 phintuka Exp $
+ * $Id: frontend_svr.c,v 1.12 2006-08-16 21:46:34 phintuka Exp $
*
*/
@@ -446,17 +446,21 @@ int cXinelibServer::Xine_Control(const char *cmd)
{
TRACEF("cXinelibServer::Xine_Control");
- char buf[128];
- sprintf(buf, "%s\r\n", cmd);
- int len = strlen(buf);
- LOCK_THREAD;
+ if(cmd && *cmd) {
+ char buf[2048];
+ int len;
+ sprintf(buf, "%s\r\n", cmd);
+ len = strlen(buf);
- for(int i=0; i<MAXCLIENTS; i++)
- if(fd_control[i]>=0 && (fd_data[i]>=0 || m_bMulticast[i]) && m_bConfigOk[i])
- if(len != timed_write(fd_control[i], buf, len, 100)) {
- LOGMSG("Control send failed (%s), dropping client", cmd);
- CloseConnection(i);
- }
+ LOCK_THREAD;
+
+ for(int i=0; i<MAXCLIENTS; i++)
+ if(fd_control[i]>=0 && (fd_data[i]>=0 || m_bMulticast[i]) && m_bConfigOk[i])
+ if(len != timed_write(fd_control[i], buf, len, 100)) {
+ LOGMSG("Control send failed (%s), dropping client", cmd);
+ CloseConnection(i);
+ }
+ }
return 1;
}
diff --git a/xine_fbfe_frontend.c b/xine_fbfe_frontend.c
index dddbfbcc..8c915de7 100644
--- a/xine_fbfe_frontend.c
+++ b/xine_fbfe_frontend.c
@@ -4,7 +4,7 @@
* See the main source file 'xineliboutput.c' for copyright information and
* how to reach the author.
*
- * $Id: xine_fbfe_frontend.c,v 1.3 2006-06-11 19:08:05 phintuka Exp $
+ * $Id: xine_fbfe_frontend.c,v 1.4 2006-08-16 21:46:34 phintuka Exp $
*
*/
@@ -82,6 +82,7 @@ typedef struct fbfe_t {
/* frontend */
int playback_finished;
+ int slave_playback_finished;
/* vdr */
fe_keypress_f keypress;
diff --git a/xine_frontend.c b/xine_frontend.c
index a8a2a0bd..8d4d40b3 100644
--- a/xine_frontend.c
+++ b/xine_frontend.c
@@ -4,7 +4,7 @@
* See the main source file 'xineliboutput.c' for copyright information and
* how to reach the author.
*
- * $Id: xine_frontend.c,v 1.7 2006-08-16 17:49:22 phintuka Exp $
+ * $Id: xine_frontend.c,v 1.8 2006-08-16 21:46:34 phintuka Exp $
*
*/
@@ -935,10 +935,19 @@ static void fe_free(frontend_t *this_gen)
}
}
-static int fe_is_finished(frontend_t *this_gen)
+static int fe_is_finished(frontend_t *this_gen, int slave_stream)
{
fe_t *this = (fe_t*)this_gen;
- return this ? this->playback_finished : 1;
+
+ if(!this || this->playback_finished)
+ return 1;
+
+ if(slave_stream) {
+ if(!this->postplugins->slave_stream || this->slave_playback_finished)
+ return 1;
+ }
+
+ return 0;
}
/************************** hooks to input plugin ****************************/
@@ -1026,10 +1035,23 @@ static void process_xine_keypress(input_plugin_t *input,
static void *fe_control(void *fe_handle, const char *cmd)
{
fe_t *this = (fe_t*)fe_handle;
- post_plugins_t *posts = this->postplugins;
+ post_plugins_t *posts;
/*LOGDBG("fe_control(\"%s\")", cmd);*/
+ if(!cmd || !this) {
+ LOGMSG("fe_control(0x%x,0x%x) : invalid argument",
+ (unsigned long int)fe_handle, (unsigned long int)cmd);
+ return NULL;
+ }
+
+ posts = this->postplugins;
+
+ if(!posts) {
+ LOGMSG("fe_control : this->posts == NULL");
+ return NULL;
+ }
+
if(!strncmp(cmd, "SLAVE 0x", 8)) {
unsigned long pt;
if(1 == sscanf(cmd, "SLAVE 0x%lx", &pt)) {
@@ -1039,8 +1061,13 @@ static void *fe_control(void *fe_handle, const char *cmd)
posts->slave_stream = slave_stream;
fe_post_rewire(this);
}
+ this->slave_playback_finished = 0;
}
+ } else if(!strncmp(cmd, "ENDOFSTREAM", 11)) {
+ if(posts->slave_stream)
+ this->slave_playback_finished = 1;
+
} else if(!strncmp(cmd, "SUBSTREAM ", 10)) {
unsigned int pid;
int x, y, w, h;
diff --git a/xine_frontend.h b/xine_frontend.h
index 6aee00a4..86106c59 100644
--- a/xine_frontend.h
+++ b/xine_frontend.h
@@ -4,7 +4,7 @@
* See the main source file 'xineliboutput.c' for copyright information and
* how to reach the author.
*
- * $Id: xine_frontend.h,v 1.3 2006-06-04 11:00:04 phintuka Exp $
+ * $Id: xine_frontend.h,v 1.4 2006-08-16 21:46:34 phintuka Exp $
*
*/
@@ -81,7 +81,7 @@ struct frontend_s {
void (*fe_free)(frontend_t*);
/* Data transfer */
- int (*xine_is_finished)(frontend_t*);
+ int (*xine_is_finished)(frontend_t*, int slave_stream);
int (*xine_osd_command)(frontend_t*, struct osd_command_s *cmd);
int (*xine_control)(frontend_t*, const char *cmd);
int (*xine_queue_pes_packet)(frontend_t*, const char *data, int len);
diff --git a/xine_frontend_main.c b/xine_frontend_main.c
index d26dac97..baf292b2 100644
--- a/xine_frontend_main.c
+++ b/xine_frontend_main.c
@@ -4,7 +4,7 @@
* See the main source file 'xineliboutput.c' for copyright information and
* how to reach the author.
*
- * $Id: xine_frontend_main.c,v 1.7 2006-08-05 19:22:16 phintuka Exp $
+ * $Id: xine_frontend_main.c,v 1.8 2006-08-16 21:46:34 phintuka Exp $
*
*/
@@ -431,7 +431,7 @@ int main(int argc, char *argv[])
fflush(stdout);
fflush(stderr);
- while(fe->fe_run(fe) && !fe->xine_is_finished(fe) && !terminate_key_pressed)
+ while(fe->fe_run(fe) && !fe->xine_is_finished(fe,0) && !terminate_key_pressed)
pthread_yield();
/* Clean up */
diff --git a/xine_input_vdr.c b/xine_input_vdr.c
index 004e0942..824a701f 100644
--- a/xine_input_vdr.c
+++ b/xine_input_vdr.c
@@ -4,7 +4,7 @@
* See the main source file 'xineliboutput.c' for copyright information and
* how to reach the author.
*
- * $Id: xine_input_vdr.c,v 1.24 2006-08-16 17:53:05 phintuka Exp $
+ * $Id: xine_input_vdr.c,v 1.25 2006-08-16 21:46:34 phintuka Exp $
*
*/
@@ -3116,19 +3116,22 @@ static void vdr_event_cb (void *user_data, const xine_event_t *event)
if(this->fd_control >= 0) {
write_control(this, "ENDOFSTREAM\r\n");
} else {
+ if(this->funcs.fe_control)
+ this->funcs.fe_control(this->funcs.fe_handle, "ENDOFSTREAM\r\n");
+#if 0
if(!this->loop_play) {
/* forward to vdr-fe (listening only VDR stream events) */
xine_event_t event;
event.data_length = 0;
event.type = XINE_EVENT_UI_PLAYBACK_FINISHED;
xine_event_send (this->stream, &event);
-LOGMSG("No loop play, playback of slave stream finished");
} else {
-#if 0
+# if 0
xine_usec_sleep(500*1000);
xine_play(this->slave_stream, 0, 0);
-#endif
+# endif
}
+#endif
}
}
break;
diff --git a/xine_sxfe_frontend.c b/xine_sxfe_frontend.c
index 95019aec..10cd7364 100644
--- a/xine_sxfe_frontend.c
+++ b/xine_sxfe_frontend.c
@@ -4,7 +4,7 @@
* See the main source file 'xineliboutput.c' for copyright information and
* how to reach the author.
*
- * $Id: xine_sxfe_frontend.c,v 1.7 2006-08-05 14:02:48 phintuka Exp $
+ * $Id: xine_sxfe_frontend.c,v 1.8 2006-08-16 21:46:34 phintuka Exp $
*
*/
@@ -112,6 +112,7 @@ typedef struct sxfe_s {
/* frontend */
int playback_finished;
+ int slave_playback_finished;
/* vdr */
fe_keypress_f keypress;