1
0

Playlist.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #ifndef NULLSOFT_ML_PLAYLISTS_PLAYLIST_H
  2. #define NULLSOFT_ML_PLAYLISTS_PLAYLIST_H
  3. #include "playlist/ifc_playlist.h"
  4. #include "bfc/multipatch.h"
  5. #include "playlist/pl_entry.h"
  6. #include "playlist/ifc_playlistloadercallback.h"
  7. enum
  8. {
  9. patch_playlist,
  10. patch_playlistloadercallback
  11. };
  12. class Playlist : public MultiPatch<patch_playlist, ifc_playlist>, public MultiPatch<patch_playlistloadercallback, ifc_playlistloadercallback>
  13. {
  14. public:
  15. Playlist() {}
  16. virtual ~Playlist();
  17. void Clear();
  18. void OnFile( const wchar_t *filename, const wchar_t *title, int lengthInMS, ifc_plentryinfo *info );
  19. void AppendWithInfo( const wchar_t *filename, const wchar_t *title, int lengthInMS );
  20. void AppendWithInfo( const wchar_t *filename, const wchar_t *title, int lengthInMS, std::map<std::wstring, std::wstring> &p_extended_infos );
  21. size_t GetNumItems();
  22. size_t GetItem( size_t item, wchar_t *filename, size_t filenameCch );
  23. size_t GetItemTitle( size_t item, wchar_t *title, size_t titleCch );
  24. const wchar_t *ItemTitle( size_t item );
  25. const wchar_t *ItemName( size_t item );
  26. int GetItemLengthMilliseconds( size_t item ); // TODO: maybe microsecond for better resolution?
  27. size_t GetItemExtendedInfo( size_t item, const wchar_t *metadata, wchar_t *info, size_t infoCch );
  28. bool IsCached( size_t item );
  29. bool IsLocal( size_t item );
  30. void ClearCache( size_t item );
  31. void SetItemFilename( size_t item, const wchar_t *filename );
  32. void SetItemTitle( size_t item, const wchar_t *title );
  33. void SetItemLengthMilliseconds( size_t item, int length );
  34. int Reverse();
  35. int Swap( size_t item1, size_t item2 );
  36. int Randomize( int ( *generator )( ) );
  37. void Remove( size_t item );
  38. int SortByTitle();
  39. int SortByFilename();
  40. int SortByDirectory(); //sorts by directory and then by filename
  41. void InsertPlaylist( Playlist &copy, size_t index );
  42. void AppendPlaylist( Playlist &copy );
  43. protected:
  44. RECVS_MULTIPATCH;
  45. public:
  46. typedef std::vector<pl_entry*> PlaylistEntries;
  47. PlaylistEntries entries;
  48. uint64_t lengthInMS = 0;
  49. };
  50. #endif // !NULLSOFT_ML_PLAYLISTS_PLAYLIST_H