diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/playlist.c | 19 | ||||
-rw-r--r-- | tools/playlist.h | 3 |
2 files changed, 20 insertions, 2 deletions
diff --git a/tools/playlist.c b/tools/playlist.c index f91a67f5..c517bd46 100644 --- a/tools/playlist.c +++ b/tools/playlist.c @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: playlist.c,v 1.31 2010-11-17 13:07:28 phintuka Exp $ + * $Id: playlist.c,v 1.32 2010-12-09 14:13:03 phintuka Exp $ * */ @@ -524,6 +524,23 @@ cPlaylistItem *cPlaylist::Prev(void) return NULL; } +cPlaylistItem *cPlaylist::Seek(int Rel) +{ + cMutexLock ml(&m_Lock); + if (!Current()) + return NULL; + + if (Rel > 0) + while (Rel--) + m_Current = (cList<cPlaylistItem>::Next(Current()) ?: Last()); + + if (Rel < 0) + while (Rel++) + m_Current = (cList<cPlaylistItem>::Prev(Current()) ?: First()); + + return Current(); +} + bool cPlaylist::StoreCache(void) { if(!xc.cache_implicit_playlists || diff --git a/tools/playlist.h b/tools/playlist.h index d7de7622..641ff175 100644 --- a/tools/playlist.h +++ b/tools/playlist.h @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: playlist.h,v 1.13 2010-09-13 11:39:34 phintuka Exp $ + * $Id: playlist.h,v 1.14 2010-12-09 14:13:03 phintuka Exp $ * */ @@ -124,6 +124,7 @@ class cPlaylist : protected cList<cPlaylistItem> void SetCurrent(cPlaylistItem *current); cPlaylistItem *Next(void); cPlaylistItem *Prev(void); + cPlaylistItem *Seek(int Rel); static cString BuildMrl(const char *proto, const char *s1, const char *s2 = NULL, const char *s3 = NULL, const char *s4 = NULL); |