blob: e01da71d11c42a4d627777dbcefa1d4da7988da9 (
plain)
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
|
#pragma once
#include <MVideoWidget>
#include <policy/resource-set.h>
/**
* PlayerWidget subclasses MVideoWidget from libmeegotouch to add policy awareness to this
* widget and also some convenience methods / overrides for our demo.
*
* MVideoWidget is the control for video playback, but apparently also outputs audio as well.
* It has the basic play(), pause(), seek() functions and contains the state of the playback.
*
* We override play() and pause() so that if demo is running in the policy-aware mode (the default),
* an audio resource is acquired for each playback operation.
*
* \see MVideoWidget
*/
class PlayerWidget : public MVideoWidget {
Q_OBJECT
public:
PlayerWidget(QGraphicsItem *parent = 0);
enum {VIDEO, AUDIO} filetype;
void play();
void beginPlayback();
void pause(bool releaseResources = true);
void acquire();
void release();
bool policyAware();
void setPolicyAware(bool aware);
quint64 position();
void setPosition(quint64);
void seek(quint64);
private:
ResourcePolicy::ResourceSet *resourceSet;
ResourcePolicy::AudioResource *audioResource;
struct data {
quint64 pos;
bool policyAware;
data() : pos(0), policyAware(true) {}
} d;
void timerEvent(QTimerEvent *event);
private slots:
void resourceAcquiredHandler(const QList<ResourcePolicy::ResourceType>& /*grantedOptionalResList*/);
void resourceReleasedHandler();
void resourceLostHandler();
signals:
void playerPositionChanged();
void playing();
void paused();
};
|