123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290 |
- #ifndef NULLSOFT_PLAYLIST_API_PLAYLISTS_H
- #define NULLSOFT_PLAYLIST_API_PLAYLISTS_H
- #include <bfc/dispatch.h>
- #include <bfc/platform/guid.h>
- #include <bfc/std_mkncc.h>
- enum
- {
- API_PLAYLISTS_SUCCESS = 0,
- API_PLAYLISTS_FAILURE = 1,
- API_PLAYLISTS_UNKNOWN_INFO_GUID = 2,
- API_PLAYLISTS_UNABLE_TO_LOAD_PLAYLISTS = 3,
- API_PLAYLISTS_INVALID_INDEX = 4,
- API_PLAYLISTS_BAD_SIZE = 5,
- };
- class api_playlists : public Dispatchable
- {
- protected:
- api_playlists() {}
- virtual ~api_playlists() {}
- public:
-
-
-
- void Lock();
- void Unlock();
- size_t GetIterator();
-
- int Sort( size_t sort_type );
- void Flush();
-
- size_t GetCount();
- const wchar_t *GetFilename( size_t index );
- const wchar_t *GetName( size_t index );
- GUID GetGUID( size_t index );
- int GetPosition( GUID playlist_guid, size_t *index );
- int GetInfo( size_t index, GUID info, void *data, size_t dataLen );
-
-
- int MoveBefore( size_t index1, size_t index2 );
- size_t AddPlaylist( const wchar_t *filename, const wchar_t *playlistName, GUID playlist_guid = INVALID_GUID );
-
- size_t AddCloudPlaylist( const wchar_t *filename, const wchar_t *playlistName, GUID playlist_guid = INVALID_GUID );
-
- size_t AddPlaylist_NoCallback( const wchar_t *filename, const wchar_t *playlistName, GUID playlist_guid = INVALID_GUID );
-
-
- int SetGUID( size_t index, GUID playlist_guid );
- int RenamePlaylist( size_t index, const wchar_t *name );
- int MovePlaylist( size_t index, const wchar_t *filename );
- int SetInfo( size_t index, GUID info, void *data, size_t dataLen );
- int RemovePlaylist( size_t index );
- int ClearPlaylists();
-
- enum
- {
- SYSCALLBACK = MK4CC( 'p', 'l', 'a', 'y' ),
- PLAYLIST_ADDED = 10,
- PLAYLIST_REMOVED_PRE = 20,
- PLAYLIST_REMOVED_POST = 30,
- PLAYLIST_RENAMED = 40,
-
- PLAYLIST_SAVED = 50,
- PLAYLIST_FLUSH_REQUEST = 60,
- };
- enum
- {
- SORT_TITLE_ASCENDING,
- SORT_TITLE_DESCENDING,
- SORT_NUMBER_ASCENDING,
- SORT_NUMBER_DESCENDING,
- };
- DISPATCH_CODES
- {
- API_PLAYLISTS_LOCK = 10,
- API_PLAYLISTS_UNLOCK = 20,
- API_PLAYLISTS_GETITERATOR = 30,
- API_PLAYLISTS_FLUSH = 40,
- API_PLAYLISTS_GETCOUNT = 50,
- API_PLAYLISTS_GETFILENAME = 60,
- API_PLAYLISTS_GETNAME = 70,
- API_PLAYLISTS_GETGUID = 80,
- API_PLAYLISTS_GETPOSITION = 90,
- API_PLAYLISTS_GETINFO = 100,
- API_PLAYLISTS_MOVEBEFORE = 110,
- API_PLAYLISTS_ADDPLAYLIST = 120,
- API_PLAYLISTS_ADDPLAYLISTNOCB = 121,
- API_PLAYLISTS_ADDCLOUDPLAYLIST = 122,
- API_PLAYLISTS_SETGUID = 130,
- API_PLAYLISTS_RENAMEPLAYLIST = 140,
- API_PLAYLISTS_MOVEPLAYLIST = 150,
- API_PLAYLISTS_SETINFO = 160,
- API_PLAYLISTS_REMOVEPLAYLIST = 170,
- API_PLAYLISTS_CLEARPLAYLISTS = 180,
- API_PLAYLISTS_SORT = 190,
- };
- };
- static const GUID api_playlists_itemCount =
- { 0xc4fad6ce, 0xda38, 0x47b0, { 0xaa, 0xa9, 0xe9, 0x66, 0xd8, 0xe8, 0xe7, 0xc5 } };
- static const GUID api_playlists_totalTime =
- { 0xd4e0e000, 0xa3f5, 0x4f18, { 0xad, 0xa5, 0xf2, 0xba, 0x40, 0x68, 0x95, 0x93 } };
- static const GUID api_playlists_iTunesID =
- { 0xf6e1ab19, 0x6931, 0x4cc9, { 0xbc, 0xba, 0x4b, 0x40, 0xde, 0x2a, 0x95, 0x9f } };
- static const GUID api_playlists_cloud =
- { 0xb83ad244, 0x7cd3, 0x4a24, { 0xb2, 0xc5, 0x41, 0xf4, 0x2c, 0xa3, 0x7f, 0x14 } };
- inline void api_playlists::Lock()
- {
- _voidcall( API_PLAYLISTS_LOCK );
- }
- inline void api_playlists::Unlock()
- {
- _voidcall( API_PLAYLISTS_UNLOCK );
- }
- inline size_t api_playlists::GetIterator()
- {
- return _call( API_PLAYLISTS_GETITERATOR, 0 );
- }
- inline void api_playlists::Flush()
- {
- _voidcall( API_PLAYLISTS_FLUSH );
- }
- inline int api_playlists::Sort( size_t sort_type )
- {
- return _call( API_PLAYLISTS_SORT, 0, sort_type );
- }
- inline size_t api_playlists::GetCount()
- {
- return _call( API_PLAYLISTS_GETCOUNT, 0 );
- }
- inline const wchar_t *api_playlists::GetFilename( size_t index )
- {
- return _call( API_PLAYLISTS_GETFILENAME, (const wchar_t *)0, index );
- }
- inline const wchar_t *api_playlists::GetName( size_t index )
- {
- return _call( API_PLAYLISTS_GETNAME, (const wchar_t *)0, index );
- }
- inline GUID api_playlists::GetGUID( size_t index )
- {
- return _call( API_PLAYLISTS_GETGUID, INVALID_GUID, index );
- }
- inline int api_playlists::GetPosition( GUID playlist_guid, size_t *index )
- {
- return _call( API_PLAYLISTS_GETPOSITION, API_PLAYLISTS_FAILURE, playlist_guid, index );
- }
- inline int api_playlists::GetInfo( size_t index, GUID info, void *data, size_t dataLen )
- {
- return _call( API_PLAYLISTS_GETINFO, API_PLAYLISTS_FAILURE, index, info, data, dataLen );
- }
- inline int api_playlists::MoveBefore( size_t index1, size_t index2 )
- {
- return _call( API_PLAYLISTS_MOVEBEFORE, API_PLAYLISTS_FAILURE, index1, index2 );
- }
- inline size_t api_playlists::AddPlaylist( const wchar_t *filename, const wchar_t *playlistName, GUID playlist_guid )
- {
- return _call( API_PLAYLISTS_ADDPLAYLIST, (size_t)-1, filename, playlistName, playlist_guid );
- }
- inline size_t api_playlists::AddPlaylist_NoCallback( const wchar_t *filename, const wchar_t *playlistName, GUID playlist_guid )
- {
- return _call( API_PLAYLISTS_ADDPLAYLISTNOCB, (size_t)-1, filename, playlistName, playlist_guid );
- }
- inline size_t api_playlists::AddCloudPlaylist( const wchar_t *filename, const wchar_t *playlistName, GUID playlist_guid )
- {
- return _call( API_PLAYLISTS_ADDCLOUDPLAYLIST, (size_t)-1, filename, playlistName, playlist_guid );
- }
- inline int api_playlists::SetGUID( size_t index, GUID playlist_guid )
- {
- return _call( API_PLAYLISTS_SETGUID, API_PLAYLISTS_FAILURE, index, playlist_guid );
- }
- inline int api_playlists::RenamePlaylist( size_t index, const wchar_t *name )
- {
- return _call( API_PLAYLISTS_RENAMEPLAYLIST, API_PLAYLISTS_FAILURE, index, name );
- }
- inline int api_playlists::MovePlaylist( size_t index, const wchar_t *filename )
- {
- return _call( API_PLAYLISTS_MOVEPLAYLIST, API_PLAYLISTS_FAILURE, index, filename );
- }
- inline int api_playlists::SetInfo( size_t index, GUID info, void *data, size_t dataLen )
- {
- return _call( API_PLAYLISTS_SETINFO, API_PLAYLISTS_FAILURE, index, info, data, dataLen );
- }
- inline int api_playlists::RemovePlaylist( size_t index )
- {
- return _call( API_PLAYLISTS_REMOVEPLAYLIST, API_PLAYLISTS_FAILURE, index );
- }
- inline int api_playlists::ClearPlaylists()
- {
- return _call( API_PLAYLISTS_CLEARPLAYLISTS, API_PLAYLISTS_FAILURE );
- }
- static const GUID api_playlistsGUID =
- { 0x2dc3c390, 0xd9b8, 0x4a49, { 0xb2, 0x30, 0xef, 0x24, 0xa, 0xdd, 0xdc, 0xdb } };
- #endif
|