summaryrefslogtreecommitdiff
path: root/amldevice.h
blob: 6554392dc9a2cb5b8f9024eb5adb8a62ef77f95f (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
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
/*
 * See the README file for copyright information and how to reach the author.
 *
 * $Id$
 */

#ifndef AML_DEVICE_H
#define AML_DEVICE_H

#include <vdr/device.h>
#include "tools.h"

extern "C" {
#include <codec.h>
}

class cScheduler
{

public:

	cScheduler();
	virtual ~cScheduler() { }

	void SetSpeed(int speed, bool forward);
	void Reset();

	bool Check(int64_t pts);
	int64_t GetPts(void);

	enum eSpeed {
		ePause,
		eSlowest,
		eSlower,
		eSlow,
		eNormal,
		eFast,
		eFaster,
		eFastest,
		eNumSpeeds
	};

private:

	int64_t m_pts;
	cTimeMs m_timestamp;

	eSpeed m_speed;
	bool m_forward;

	static const int s_speeds[eNumSpeeds];
};

class cAmlDevice : cDevice
{

public:

	cAmlDevice(void (*onPrimaryDevice)(void));
	virtual ~cAmlDevice();

	virtual int Init(void);
	virtual int DeInit(void);

	virtual bool Start(void);

	virtual bool HasDecoder(void) const { return true; }

	virtual bool SetPlayMode(ePlayMode PlayMode);

	virtual bool Poll(cPoller &Poller, int TimeoutMs = 0);
	virtual bool Flush(int TimeoutMs = 0);

	virtual void GetOsdSize(int &Width, int &Height, double &PixelAspect);

	virtual int64_t GetSTC(void);

protected:

	virtual void MakePrimaryDevice(bool On);

	virtual int PlayVideo(const uchar *Data, int Length);
	virtual int PlayAudio(const uchar *Data, int Length, uchar Id);

	void StillPicture(const uchar *Data, int Length);

	virtual void Clear(void);
	virtual void Play(void);
	virtual void Freeze(void);

	virtual void TrickSpeed(int Speed, bool Forward);

	virtual void SetVolumeDevice(int Volume);

private:

	void (*m_onPrimaryDevice)(void);

	codec_para_t m_videoCodec;
	codec_para_t m_audioCodec;

	uchar m_audioId;
	bool m_trickMode;

	cScheduler m_scheduler;
};

#endif