123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240 |
- #pragma once
- #include <windows.h>
- #include <Dbt.h>
- #include "../../Library/ml_pmp/transcoder.h"
- #include "../../Library/ml_pmp/pmp.h"
- #include "../nde/nde_c.h"
- #include "../nu/AutoLock.h"
- #include <vector>
- #define WINAMP_ANDROID_MARKER_FILE L"\\.winamp\\winamp.info"
- enum
- {
- NDE_ANDROID_FAILURE=0,
- NDE_ANDROID_SUCCESS=1,
- };
- enum
- {
- DEVICEVIEW_COL_FILENAME = 0,
- DEVICEVIEW_COL_ARTIST=1,
- DEVICEVIEW_COL_ALBUM=2,
- DEVICEVIEW_COL_TITLE=3,
- DEVICEVIEW_COL_GENRE=4,
- DEVICEVIEW_COL_ALBUM_ARTIST=5,
- DEVICEVIEW_COL_PUBLISHER=6,
- DEVICEVIEW_COL_COMPOSER=7,
- DEVICEVIEW_COL_YEAR=8,
- DEVICEVIEW_COL_TRACK=9,
- DEVICEVIEW_COL_BITRATE=10,
- DEVICEVIEW_COL_DISC_NUMBER=11,
- DEVICEVIEW_COL_LENGTH=12,
- DEVICEVIEW_COL_SIZE=13,
- DEVICEVIEW_COL_PLAY_COUNT=14,
- };
- #define TAG_CACHE L"winamp_metadata.dat"
- #define FIELD_LENGTH 1024
- class AndroidSong {
- public:
- AndroidSong();
- wchar_t filename[MAX_PATH];
- wchar_t artist[FIELD_LENGTH];
- wchar_t album[FIELD_LENGTH];
- wchar_t title[FIELD_LENGTH];
- wchar_t genre[FIELD_LENGTH];
- wchar_t albumartist[FIELD_LENGTH];
- wchar_t publisher[FIELD_LENGTH];
- wchar_t composer[FIELD_LENGTH];
- int year,track,length,discnum,bitrate,playcount;
- __int64 size;
- BOOL filled;
- wchar_t ext[ 6 ];
- };
- enum DeviceType {
- TYPE_OTHER,
- TYPE_PSP,
- };
- class AndroidPlaylist;
- class AndroidArt
- {
- public:
- AndroidArt(ARGB32 *bits, int w, int h);
- ~AndroidArt();
- ARGB32 *bits;
- int w,h;
- };
- class AndroidDevice : public Device
- {
- public:
- AndroidDevice(wchar_t drive, pmpDeviceLoading * load);
- ~AndroidDevice();
- AndroidDevice();
- void fileProbe(wchar_t * indir);
- void tag(void);
- void createDeviceFields();
- int openDeviceDatabase();
- int openDeviceTable();
- void closeDeviceTable();
-
- static void CloseDatabase();
- void SeekToBegininngOfDevice(nde_scanner_t s);
- void refreshNDECache(void);
- void fillMetaData(AndroidSong *s);
- static int getFileInfoW(const wchar_t *filename, const wchar_t *metadata, wchar_t *dest, size_t len);
- void setupTranscoder();
- AndroidPlaylist* getMasterPlaylist();
- AndroidSong* findSongInMasterPlaylist(const wchar_t *songfn);
- void writeRecordToDB(AndroidSong* songToPrint);
-
- virtual __int64 getDeviceCapacityAvailable();
- virtual __int64 getDeviceCapacityTotal();
- virtual void Eject();
- virtual void Close();
-
- virtual int transferTrackToDevice(const itemRecordW * track,
- void * callbackContext,
- void (*callback)(void *callbackContext, wchar_t *status),
- songid_t * songid,
- int * killswitch
- );
- virtual int trackAddedToTransferQueue(const itemRecordW *track);
- virtual void trackRemovedFromTransferQueue(const itemRecordW *track);
-
-
- virtual __int64 getTrackSizeOnDevice(const itemRecordW *track);
- virtual void deleteTrack(songid_t songid);
- virtual void commitChanges();
- virtual int getPlaylistCount();
-
- virtual void getPlaylistName(int playlistnumber, wchar_t *buf, int len);
- virtual int getPlaylistLength(int playlistnumber);
- virtual songid_t getPlaylistTrack(int playlistnumber,int songnum);
- virtual void setPlaylistName(int playlistnumber, const wchar_t *buf);
- virtual void playlistSwapItems(int playlistnumber, int posA, int posB);
- virtual void sortPlaylist(int playlistnumber, int sortBy);
- virtual void addTrackToPlaylist(int playlistnumber, songid_t songid);
- virtual void removeTrackFromPlaylist(int playlistnumber, int songnum);
- virtual void deletePlaylist(int playlistnumber);
- virtual int newPlaylist(const wchar_t *name);
- virtual void getTrackArtist(songid_t songid, wchar_t *buf, int len);
- virtual void getTrackAlbum(songid_t songid, wchar_t *buf, int len);
- virtual void getTrackTitle(songid_t songid, wchar_t *buf, int len);
- virtual int getTrackTrackNum(songid_t songid);
- virtual int getTrackDiscNum(songid_t songid);
- virtual void getTrackGenre(songid_t songid, wchar_t * buf, int len);
- virtual int getTrackYear(songid_t songid);
- virtual __int64 getTrackSize(songid_t songid);
- virtual int getTrackLength(songid_t songid);
- virtual int getTrackBitrate(songid_t songid);
- virtual int getTrackPlayCount(songid_t songid);
- virtual int getTrackRating(songid_t songid);
- virtual __time64_t getTrackLastPlayed(songid_t songid);
- virtual __time64_t getTrackLastUpdated(songid_t songid);
- virtual void getTrackAlbumArtist(songid_t songid, wchar_t *buf, int len);
- virtual void getTrackPublisher(songid_t songid, wchar_t *buf, int len);
- virtual void getTrackComposer(songid_t songid, wchar_t *buf, int len);
- virtual int getTrackType(songid_t songid);
- virtual void getTrackExtraInfo(songid_t songid, const wchar_t *field, wchar_t *buf, int len) ;
-
- virtual void setTrackArtist(songid_t songid, const wchar_t *value);
- virtual void setTrackAlbum(songid_t songid, const wchar_t *value);
- virtual void setTrackTitle(songid_t songid, const wchar_t *value);
- virtual void setTrackTrackNum(songid_t songid, int value);
- virtual void setTrackDiscNum(songid_t songid, int value);
- virtual void setTrackGenre(songid_t songid, const wchar_t *value);
- virtual void setTrackYear(songid_t songid, int year);
- virtual void setTrackPlayCount(songid_t songid, int value);
- virtual void setTrackRating(songid_t songid, int value);
- virtual void setTrackLastPlayed(songid_t songid, __time64_t value);
- virtual void setTrackLastUpdated(songid_t songid, __time64_t value);
- virtual void setTrackAlbumArtist(songid_t songid, const wchar_t *value);
- virtual void setTrackPublisher(songid_t songid, const wchar_t *value);
- virtual void setTrackComposer(songid_t songid, const wchar_t *value);
- virtual void setTrackExtraInfo(songid_t songid, const wchar_t *field, const wchar_t *value) ;
- virtual bool playTracks(songid_t * songidList, int listLength, int startPlaybackAt, bool enqueue);
- virtual intptr_t extraActions(intptr_t param1, intptr_t param2, intptr_t param3,intptr_t param4);
- virtual bool copyToHardDriveSupported();
- virtual __int64 songSizeOnHardDrive(songid_t song);
- virtual int copyToHardDrive(songid_t song,
- wchar_t * path,
- void * callbackContext,
- void (*callback)(void * callbackContext, wchar_t * status),
- int * killswitch
- );
-
- virtual void setArt(songid_t songid, void *buf, int w, int h);
- virtual pmpart_t getArt(songid_t songid);
- virtual void releaseArt(pmpart_t art);
- virtual int drawArt(pmpart_t art, HDC dc, int x, int y, int w, int h);
- virtual void getArtNaturalSize(pmpart_t art, int *w, int *h);
- virtual void setArtNaturalSize(pmpart_t art, int w, int h);
- virtual void getArtData(pmpart_t art, void* data);
- virtual bool artIsEqual(pmpart_t a, pmpart_t b);
-
- Transcoder *transcoder;
- wchar_t drive;
- wchar_t iniFile[MAX_PATH];
- wchar_t pldir[MAX_PATH];
- wchar_t songFormat[MAX_PATH];
- wchar_t supportedFormats[MAX_PATH];
- wchar_t purgeFolders[2];
- int pl_write_mode;
- __int64 transferQueueLength;
- std::vector<AndroidPlaylist*> androidPlaylists;
- bool loadedUpToDate;
- static nde_database_t discDB;
- nde_table_t deviceTable;
- Nullsoft::Utility::LockGuard dbcs;
- wchar_t ndeDataFile[100];
- wchar_t ndeIndexFile[100];
- private:
-
- void updateTrackField(AndroidSong* song, unsigned int col, const void* newValue, int fieldType);
- bool readRecordFromDB(AndroidSong* song);
- bool songChanged(AndroidSong* song);
- };
|