/
DBusMprisProxy.h
68 lines (60 loc) · 1.66 KB
/
DBusMprisProxy.h
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
/*
* File: DBusMprisProxy.h
* Author: Saleem Edah-Tally - nmset@yandex.com
* License : GPL V2
*
* Created on 10 décembre 2017, 22:23
*/
#ifndef DBUSMPRISPROXY_H
#define DBUSMPRISPROXY_H
#include "mpris_proxy.hpp"
#define FFR_STEP 5000000 // Fast forward and rewind by 5 secs
#define FFR_STEP_QUICK 50000000 // 50 secs
/**
* Sends DBus commands to an MPRIS compliant media player.
* @param connection
* @param service
*/
class DBusMprisProxy : public org::mpris::MediaPlayer2::Player_proxy,
public DBus::IntrospectableProxy,
public DBus::ObjectProxy
{
public:
/**
*
* @param connection
* @param service : pedal.event, from application POD7.
*/
DBusMprisProxy(DBus::Connection &connection, const char * service);
virtual ~DBusMprisProxy();
/**
* Advances the media position by step milliseconds,
* pausing 200 milliseconds between steps.
* Runs in a detached thread.
* @param step
*/
void FastForward(const int& step);
/**
* Moves back the media position by step milliseconds,
* pausing 200 milliseconds between steps.
* Runs in a detached thread.
*/
void Rewind(const int& step);
/**
* Sets a flag that allows running threads to end.
*/
void Reset();
/**
* Rewinds specified milliseconds before starting playback.
* An unavoidable feature for transcriptionists.
*/
void AutoRewind();
private:
/**
* Flag controlling thread lifetime.
*/
static bool m_break;
static int DoFastForward(DBusMprisProxy * obj, const int& step);
static int DoRewind(DBusMprisProxy * obj, const int& step);
};
#endif /* DBUSMPRISPROXY_H */