forked from oreo639/LimePlayer3DS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplayer.hpp
121 lines (82 loc) · 2.13 KB
/
player.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#ifndef __LIME_PLAYER_H__
#define __LIME_PLAYER_H__
#include <string>
#include <memory>
#include "settings.hpp"
#include "debug.hpp"
#include "transport/transport.hpp"
typedef struct
{
std::string Title;
std::string Album;
std::string Artist;
std::string Year;
std::string Comment;
std::string Genre;
bool isSupported;
bool isParsed;
//void *Image;
} metaInfo_t;
typedef struct
{
std::string filepath;
std::string filename;
metaInfo_t fileMeta;
settings_t settings;
playlist_t playlistfile;
int usePlaylist; // 0 do not use playlist, 1 use playlistfile, 2 use playlist from settings
uint32_t selectPlaylistOffset;
} playbackInfo_t;
enum Format {
FORMAT_16,
FORMAT_8,
FORMAT_ADPCM
};
class Decoder {
public:
// Decoder interface
Decoder(const char* name) : decoderName(name) {}
Decoder() {}
virtual ~Decoder() {}
bool GetIsInit(void) {return mIsInit;}
const char* GetErrInfo(void) {return mErrInfo;}
std::string GetDecoderName(void) {
if (decoderName)
return decoderName;
else
return "";
}
// Allow the decoder to specify if the medadata needs to be updated.
virtual bool AllowUpdateInfo() {return false;}
virtual void UpdateInfo(metaInfo_t* Meta) {};
virtual void GetInfo(metaInfo_t* Meta) = 0;
virtual uint32_t Position(void) = 0;
virtual uint32_t Length(void) = 0;
virtual void Seek(uint32_t location) = 0;
virtual uint32_t Decode(void* buffer) = 0;
virtual uint32_t Samplerate(void) = 0;
virtual uint32_t Buffsize(void) = 0;
virtual int Channels(void) = 0;
protected:
bool mIsInit = 0;
const char* mErrInfo;
private:
const char* decoderName = "Unknown";
};
namespace PlayerInterface {
void ThreadMainFunct(void* input);
bool TogglePlayback(void);
void ExitPlayback(void);
void SkipPlayback(void);
bool IsPlaying(void);
bool IsPaused(void);
uint32_t GetTotalLength(void);
uint32_t GetTotalTime(void);
uint32_t GetCurrentPos(void);
uint32_t GetCurrentTime(void);
void SeekSection(uint32_t location);
void SeekSectionPercent(uint32_t percent);
void SeekSectionTime(int time);
std::string GetDecoderName(void);
}
#endif