summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorphintuka <phintuka>2008-09-06 06:41:00 +0000
committerphintuka <phintuka>2008-09-06 06:41:00 +0000
commit04f7bf70943a16c290094df4897bc5a7f9ae904a (patch)
tree69f4589451f70df6e965cf67bfebbea696474cfc
parenta203da2696144df4e703c86a8d7d097496e4f7d6 (diff)
downloadxineliboutput-04f7bf70943a16c290094df4897bc5a7f9ae904a.tar.gz
xineliboutput-04f7bf70943a16c290094df4897bc5a7f9ae904a.tar.bz2
Simplify
-rw-r--r--media_player.c42
1 files changed, 23 insertions, 19 deletions
diff --git a/media_player.c b/media_player.c
index d7c55b55..4c13edc0 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.60 2008-09-06 05:54:44 phintuka Exp $
+ * $Id: media_player.c,v 1.61 2008-09-06 06:41:00 phintuka Exp $
*
*/
@@ -1071,8 +1071,11 @@ eOSState cXinelibDvdPlayerControl::ProcessKey(eKeys Key)
class cXinelibImagePlayer : public cPlayer {
private:
- cString m_File;
+ cString m_Mrl;
bool m_Active;
+ cXinelibDevice *m_Dev;
+
+ bool Play(void);
protected:
virtual void Activate(bool On);
@@ -1086,8 +1089,9 @@ class cXinelibImagePlayer : public cPlayer {
cXinelibImagePlayer::cXinelibImagePlayer(const char *File)
{
- m_File = File;
+ m_Mrl = File;
m_Active = false;
+ m_Dev = &(cXinelibDevice::Instance());
}
cXinelibImagePlayer::~cXinelibImagePlayer()
@@ -1096,28 +1100,28 @@ cXinelibImagePlayer::~cXinelibImagePlayer()
Detach();
}
+bool cXinelibImagePlayer::Play(void)
+{
+ if ((*m_Mrl)[0] == '/')
+ m_Mrl = cString::sprintf("file:%s", *cPlaylist::EscapeMrl(m_Mrl));
+
+ return m_Dev->PlayFile(m_Mrl, 0, true);
+}
+
void cXinelibImagePlayer::Activate(bool On)
{
- if(On) {
- m_Active = true;
- cXinelibDevice::Instance().PlayFile( ( (*m_File)[0]=='/'
- ? *cString::sprintf("file:%s", *cPlaylist::EscapeMrl(m_File))
- : *m_File),
- 0, true);
- } else {
- m_Active = false;
- cXinelibDevice::Instance().PlayFile(NULL, 0);
- }
+ m_Active = On;
+ if (On)
+ Play();
+ else
+ m_Dev->PlayFile(NULL);
}
bool cXinelibImagePlayer::ShowImage(const char *File)
{
- m_File = File;
- if(m_Active)
- return cXinelibDevice::Instance().PlayFile( ( (*m_File)[0] == '/'
- ? *cString::sprintf("file:%s", *cPlaylist::EscapeMrl(m_File))
- : *m_File ),
- 0, true);
+ m_Mrl = File;
+ if (m_Active)
+ return Play();
return true;
}