diff options
-rw-r--r-- | media_player.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/media_player.c b/media_player.c index 76759dd1..1c38e210 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.66 2008-11-24 10:49:29 rofafor Exp $ + * $Id: media_player.c,v 1.67 2009-02-12 10:56:56 phintuka Exp $ * */ @@ -47,6 +47,8 @@ class cXinelibPlayer : public cPlayer bool m_UseResumeFile; int m_Speed; + void UpdateNumTracks(void); + protected: virtual void Activate(bool On); @@ -197,6 +199,19 @@ bool cXinelibPlayer::NextFile(int step) return false; } +void cXinelibPlayer::UpdateNumTracks(void) +{ + // cdda tracks + if(m_Playlist.Count() == 1 && !strcmp("cdda:/", m_Playlist.First()->Filename)) { + int count = cXinelibDevice::Instance().PlayFileCtrl("GETAUTOPLAYSIZE CD", 10000); + if(count>0) { + for(int i=0; i<count; i++) + m_Playlist.Read(cString::sprintf("cdda:/%d", i+1)); + m_Playlist.Del(m_Playlist.First()); + } + } +} + void cXinelibPlayer::Activate(bool On) { int pos = 0, len = 0, fd = -1; @@ -225,6 +240,7 @@ void cXinelibPlayer::Activate(bool On) mrl = cPlaylist::EscapeMrl(m_File); // Start replay + UpdateNumTracks(); m_Error = !cXinelibDevice::Instance().PlayFile(mrl, pos); LOGDBG("cXinelibPlayer playing %s (%s)", *m_File, m_Error ? "FAIL" : "OK"); @@ -243,15 +259,7 @@ void cXinelibPlayer::Activate(bool On) if(ar && ar[0]) m_Playlist.Current()->Artist = ar; - // cdda tracks - if(m_Playlist.Count() == 1 && !strcmp("cdda:/", m_Playlist.First()->Filename)) { - int count = cXinelibDevice::Instance().PlayFileCtrl("GETAUTOPLAYSIZE CD"); - if(count>1) { - for(int i=0; i<count; i++) - m_Playlist.Read(cString::sprintf("cdda:/%d", i+1)); - m_Playlist.Del(m_Playlist.First()); - } - } + UpdateNumTracks(); } } else { if(m_UseResumeFile && *m_ResumeFile) { |