summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorphintuka <phintuka>2008-01-03 19:05:07 +0000
committerphintuka <phintuka>2008-01-03 19:05:07 +0000
commit11d222ce6d4be6ee629ac348164cf232d2b28d3d (patch)
tree5583f3050e9202494e8bdea736e0dc7ed9f46c43
parent69b5d11760aa1d5787dd72bffad8f0c962d259c3 (diff)
downloadxineliboutput-11d222ce6d4be6ee629ac348164cf232d2b28d3d.tar.gz
xineliboutput-11d222ce6d4be6ee629ac348164cf232d2b28d3d.tar.bz2
Use "file:" mrl when replaying media files or images
-rw-r--r--frontend_svr.c5
-rw-r--r--media_player.c17
-rw-r--r--xine_input_vdr.c9
3 files changed, 21 insertions, 10 deletions
diff --git a/frontend_svr.c b/frontend_svr.c
index 86598d48..6468c692 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.46 2007-06-21 13:22:06 phintuka Exp $
+ * $Id: frontend_svr.c,v 1.47 2008-01-03 19:05:07 phintuka Exp $
*
*/
@@ -1261,6 +1261,9 @@ void cXinelibServer::Handle_Control_CONTROL(int cli, const char *arg)
static int strcmp_escaped(const char *s1, const char *s2)
{
+ if(!strncmp(s1, "file:", 5))
+ s1 += 5;
+
while(*s1 && *s2) {
int c1 = *s1;
int c2 = *s2;
diff --git a/media_player.c b/media_player.c
index 6c641855..ce139ef2 100644
--- a/media_player.c
+++ b/media_player.c
@@ -4,7 +4,7 @@
* See the main source file 'xineliboutput.c' for copyright information and
* how to reach the author.
*
- * $Id: media_player.c,v 1.38 2007-11-25 19:01:45 phelin Exp $
+ * $Id: media_player.c,v 1.39 2008-01-03 19:05:07 phintuka Exp $
*
*/
@@ -209,8 +209,15 @@ void cXinelibPlayer::Activate(bool On)
// (those may contain #subtitle, #volnorm etc. directives)
cString mrl;
if(*m_SubFile)
- mrl = cString::sprintf("%s#subtitle:%s", *cPlaylist::EscapeMrl(m_File), *cPlaylist::EscapeMrl(m_SubFile));
- else /*if((*m_File)[0] == '/')*/
+ mrl = cString::sprintf("%s%s#subtitle:%s",
+ m_File[0] == '/' ? "file:" : "",
+ *cPlaylist::EscapeMrl(m_File),
+ *cPlaylist::EscapeMrl(m_SubFile));
+ else if((*m_File)[0] == '/')
+ mrl = cString::sprintf("%s%s",
+ m_File[0] == '/' ? "file:" : "",
+ *cPlaylist::EscapeMrl(m_File));
+ else
mrl = cPlaylist::EscapeMrl(m_File);
m_Replaying = cXinelibDevice::Instance().PlayFile(mrl, pos);
LOGDBG("cXinelibPlayer playing %s (%s)", *m_File, m_Replaying?"OK":"FAIL");
@@ -1031,7 +1038,7 @@ void cXinelibImagePlayer::Activate(bool On)
{
if(On) {
m_Active = true;
- cXinelibDevice::Instance().PlayFile(m_File, 0, true);
+ cXinelibDevice::Instance().PlayFile(*cString::sprintf("file:%s", *cPlaylist::EscapeMrl(m_File)), 0, true);
} else {
m_Active = false;
cXinelibDevice::Instance().PlayFile(NULL, 0);
@@ -1042,7 +1049,7 @@ bool cXinelibImagePlayer::ShowImage(const char *File)
{
m_File = File;
if(m_Active)
- return cXinelibDevice::Instance().PlayFile(m_File, 0, true);
+ return cXinelibDevice::Instance().PlayFile(*cString::sprintf("file:%s", *cPlaylist::EscapeMrl(m_File)), 0, true);
return true;
}
diff --git a/xine_input_vdr.c b/xine_input_vdr.c
index 3e7a0e02..6e57d7ad 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.105 2008-01-03 15:33:40 phintuka Exp $
+ * $Id: xine_input_vdr.c,v 1.106 2008-01-03 19:05:07 phintuka Exp $
*
*/
@@ -2772,6 +2772,7 @@ static int handle_control_playfile(vdr_input_plugin_t *this, const char *cmd)
strn0cpy(filename, pt, sizeof(filename));
if(*filename) {
+ int is_file_mrl = !strncmp(filename, "file:/", 6) ? 5 : 0;
this->loop_play = 0;
if(this->slave_stream)
@@ -2781,11 +2782,11 @@ static int handle_control_playfile(vdr_input_plugin_t *this, const char *cmd)
loop, pos, av, filename);
/* check if it is really a file (not mrl) and try to access it */
- if(filename[0] == '/') {
+ if(is_file_mrl || filename[0] == '/') {
struct stat st;
char *f = unescape_filename(filename);
errno = 0;
- if(stat(f, &st)) {
+ if(stat(f+is_file_mrl, &st)) {
if(errno == EACCES || errno == ELOOP)
LOGERR("Can't access file !");
if(errno == ENOENT || errno == ENOTDIR)
@@ -2800,7 +2801,7 @@ static int handle_control_playfile(vdr_input_plugin_t *this, const char *cmd)
if(sub) *sub = 0;
snprintf(mrlbase, sizeof(mrlbase), "http://%s:%d/PLAYFILE",
host?:"127.0.0.1", iport);
- sprintf(mrl, "%s%s", mrlbase, filename);
+ sprintf(mrl, "%s%s", mrlbase, filename + is_file_mrl);
if(sub) {
sub += 10; /*strlen("#subtitle:");*/
strcat(mrl, "#subtitle:");