7 |
|
#ifndef _Player_hpp_ |
8 |
|
#define _Player_hpp_ |
9 |
|
|
10 |
< |
#include <menes/platform.hpp> |
10 |
> |
#include <menes/cxx/platform.hpp> |
11 |
|
|
12 |
|
#ifdef MENES_PRAGMA_ONCE |
13 |
|
#pragma once |
14 |
|
#endif |
15 |
|
|
16 |
< |
#include <menes-api/process.hpp> |
17 |
< |
#include <menes-api/threads.hpp> |
18 |
< |
#include <menes-mta/locks.hpp> |
16 |
> |
#include <menes/api/process.hpp> |
17 |
> |
#include <menes/api/threads.hpp> |
18 |
> |
#include <menes/mta/locks.hpp> |
19 |
|
|
20 |
|
#include <queue> |
21 |
|
|
29 |
|
enum State { STOPPED, PLAYING, PAUSED } state; |
30 |
|
BeepRemote remote; |
31 |
|
_R<api::Process> player_; |
32 |
+ |
int position; |
33 |
|
mta::ReaderWriterLock playlistLock; |
34 |
|
_L<MediaFile> playlist; |
35 |
|
mutable api::ThreadMutex queueLock; |
36 |
|
mutable std::queue<api::Path> queue; |
37 |
|
mutable mta::ReaderWriterLock sharesLock; |
38 |
< |
ext::RedBlackMap<api::InternetAddress, ext::RedBlackMap<cse::String, _R<Share> > > shares; |
38 |
> |
ext::RedBlackMap<api::Address, ext::RedBlackMap<cse::String, _R<Share> > > shares; |
39 |
|
bool running; |
40 |
|
_S<api::Thread> adder, copier; |
41 |
|
int Adder(); |
42 |
|
int Copier() const; |
43 |
+ |
void Change(); |
44 |
|
public: |
45 |
< |
Player(const _R<dbi::Connection>& connection, int player); |
45 |
> |
Player(const _R<Connector>& connector, int player); |
46 |
|
~Player(); |
47 |
< |
const _L<MediaFile>& GetPlaylist() const { return playlist; }; |
47 |
> |
_finline int GetPosition() const { return position; } |
48 |
> |
_finline const _L<MediaFile>& GetPlaylist() const { return playlist; }; |
49 |
|
void Add(const _R<Share>& share); |
50 |
|
}; |
51 |
|
|