diff options
author | phintuka <phintuka> | 2010-12-09 14:13:03 +0000 |
---|---|---|
committer | phintuka <phintuka> | 2010-12-09 14:13:03 +0000 |
commit | 990943fcd5defcc86bedfc6d386a71263576a81b (patch) | |
tree | 4da9c99f3507da0b2e2290964f2f077e1780ba8c | |
parent | 406f1da8c4a6e16e7edb9d7e6f85b0245eacd80e (diff) | |
download | xineliboutput-990943fcd5defcc86bedfc6d386a71263576a81b.tar.gz xineliboutput-990943fcd5defcc86bedfc6d386a71263576a81b.tar.bz2 |
Added cPlaylist::Seek()
-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); |