NowPlayingPlugin:

- Fixed that PlayerName=, TrackChangeAction=, and DisableLeadingZero= were global (i.e. only usable from the first loaded skin)
- Code refactoring and cleanup
This commit is contained in:
Birunthan Mohanathas
2011-06-17 19:07:06 +00:00
parent 67cc4c7c6c
commit 6aa004eb22
26 changed files with 1251 additions and 1714 deletions

View File

@ -19,26 +19,10 @@
#ifndef __PLAYER_H__
#define __PLAYER_H__
// TagLib
#include "apefile.h"
#include "apetag.h"
#include "asffile.h"
#include "attachedpictureframe.h"
#include "commentsframe.h"
#include "flacfile.h"
#include "id3v1genres.h"
#include "id3v2tag.h"
#include "mpcfile.h"
#include "mp4file.h"
#include "mpegfile.h"
#include "tag.h"
#include "taglib.h"
#include "textidentificationframe.h"
#include "tstring.h"
#include "vorbisfile.h"
#include "wavpackfile.h"
#include "Cover.h"
enum PLAYERSTATE
enum PLAYSTATE
{
PLAYER_STOPPED,
PLAYER_PLAYING,
@ -50,6 +34,7 @@ enum MEASURETYPE
MEASURE_ARTIST,
MEASURE_TITLE,
MEASURE_ALBUM,
MEASURE_LYRICS,
MEASURE_COVER,
MEASURE_DURATION,
MEASURE_POSITION,
@ -60,72 +45,66 @@ enum MEASURETYPE
MEASURE_FILE
};
class CPlayer
class CPlayer :
public CCover
{
public:
CPlayer();
virtual ~CPlayer();
virtual ~CPlayer() = 0;
void AddInstance();
void RemoveInstance();
void UpdateMeasure();
virtual void AddMeasure(MEASURETYPE measure);
virtual void UpdateData() = 0;
bool IsInitialized() { return m_Initialized; }
UINT GetTrackCount() { return m_TrackCount; }
virtual void Pause() {}
virtual void Play() {}
virtual void PlayPause() {}
virtual void Stop() {}
virtual void Next() {}
virtual void Previous() {}
virtual void SetPosition(int position) {}
virtual void SetRating(int rating) {}
virtual void SetVolume(int volume) {}
virtual void OpenPlayer() {}
virtual void OpenPlayer(std::wstring& path) {}
virtual void ClosePlayer() {}
virtual void TogglePlayer() {}
virtual void AddInstance(MEASURETYPE type) = 0;
virtual void RemoveInstance() = 0;
virtual void UpdateData() = 0;
PLAYERSTATE GetState() { return m_State; }
PLAYSTATE GetState() { return m_State; }
LPCTSTR GetArtist() { return m_Artist.c_str(); }
LPCTSTR GetAlbum() { return m_Album.c_str(); }
LPCTSTR GetTitle() { return m_Title.c_str(); }
LPCTSTR GetFilePath() { return m_FilePath.c_str(); }
LPCTSTR GetLyrics() { return m_Lyrics.c_str(); }
LPCTSTR GetCoverPath() { return m_CoverPath.c_str(); }
LPCTSTR GetPlayerPath() { return m_PlayerPath.c_str(); }
LPCTSTR GetFilePath() { return m_FilePath.c_str(); }
UINT GetDuration() { return m_Duration; }
UINT GetPosition() { return m_Position; }
UINT GetRating() { return m_Rating; }
UINT GetVolume() { return m_Volume; }
void SetPlayerPath(LPCTSTR path) { m_PlayerPath = path; }
void SetTrackChangeAction(LPCTSTR action) { m_TrackChangeAction = action; }
void ExecuteTrackChangeAction();
void ClearInfo();
bool GetCachedArt();
bool GetLocalArt(std::wstring& folder, std::wstring filename);
bool GetEmbeddedArt(const TagLib::FileRef& fr);
bool GetArtAPE(TagLib::APE::Tag* tag);
bool GetArtID3(TagLib::ID3v2::Tag* tag);
bool GetArtASF(TagLib::ASF::File* file);
bool GetArtFLAC(TagLib::FLAC::File* file);
bool GetArtMP4(TagLib::MP4::File* file);
protected:
int m_InstanceCount;
bool m_TrackChanged;
void ClearData();
PLAYERSTATE m_State;
bool m_Initialized;
bool m_HasCoverMeasure;
bool m_HasLyricsMeasure;
UINT m_InstanceCount;
UINT m_UpdateCount;
UINT m_TrackCount;
PLAYSTATE m_State;
std::wstring m_Artist;
std::wstring m_Album;
std::wstring m_Title;
std::wstring m_FilePath; // Path to playing file
std::wstring m_Album;
std::wstring m_Lyrics;
std::wstring m_CoverPath; // Path to cover art image
std::wstring m_PlayerPath; // Path to player executable
std::wstring m_FilePath; // Path to playing file
UINT m_Duration; // Track duration in seconds
UINT m_Position; // Current position in seconds
UINT m_Rating; // Track rating from 0 to 100
UINT m_Volume; // Volume from 0 to 100
std::wstring m_TrackChangeAction;
};
#endif