diff options
author | lvw <lvw@e10066b5-e1e2-0310-b819-94efdf66514b> | 2004-09-25 14:16:29 +0000 |
---|---|---|
committer | lvw <lvw@e10066b5-e1e2-0310-b819-94efdf66514b> | 2004-09-25 14:16:29 +0000 |
commit | 44a755e932b67f1d0d5c53a8383367b3785bbc16 (patch) | |
tree | 017af17c569fc260ab124e10fa6755d8652d491e | |
parent | 292388a7cf2234486c97b6ea0927edaa46c24f8e (diff) | |
download | vdr-plugin-muggle-44a755e932b67f1d0d5c53a8383367b3785bbc16.tar.gz vdr-plugin-muggle-44a755e932b67f1d0d5c53a8383367b3785bbc16.tar.bz2 |
Playlists seem now to work correctly
git-svn-id: https://vdr-muggle.svn.sourceforge.net/svnroot/vdr-muggle/trunk/muggle-plugin@181 e10066b5-e1e2-0310-b819-94efdf66514b
-rw-r--r-- | mg_playlist.c | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/mg_playlist.c b/mg_playlist.c index 6da5905..3c7dae0 100644 --- a/mg_playlist.c +++ b/mg_playlist.c @@ -183,37 +183,47 @@ mgContentItem* mgPlaylist::getCurrent() } // returns the nth track from the playlist -void mgPlaylist::gotoPosition(unsigned int position) +bool mgPlaylist::gotoPosition(unsigned int position) { - if( position >= m_list.size() ) - { - // go to end -- a safe bet - m_current_idx = m_list.size() - 1; - } - else - { - m_current_idx = position; - } + bool result = false; + + if( position < m_list.size() ) + { + m_current_idx = position; + result = true; + } + + return result; } // proceeds to the next item -void mgPlaylist::skipFwd() +bool mgPlaylist::skipFwd() { + bool result = false; + if( m_current_idx + 1 < m_list.size() ) // unless loop mode { m_current_idx ++; + result = true; } + // if we are already at the end -- just do nothing unless in loop mode + return result; } // goes back to the previous item -void mgPlaylist::skipBack() +bool mgPlaylist::skipBack() { + bool result = false; + if( m_current_idx > 0 ) { m_current_idx --; + result = true; } + // if we are at the beginning -- just do nothing unless in loop mode + return result; } // get next track, do not update data structures |