aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.h
blob: d0a6bb359cc20cb0466f978c79333eddf538a1af (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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#ifndef __servicedvd_h
#define __servicedvd_h

#include <lib/base/message.h>
#include <lib/base/ebase.h>
#include <lib/base/thread.h>
#include <lib/service/iservice.h>

class eSubtitleWidget;
class gPixmap;
class eStaticServiceDVDInfo;

class eServiceFactoryDVD: public iServiceHandler
{
	DECLARE_REF(eServiceFactoryDVD);
public:
	eServiceFactoryDVD();
	virtual ~eServiceFactoryDVD();
	enum { id = 0x1111 };

		// iServiceHandler
	RESULT play(const eServiceReference &, ePtr<iPlayableService> &ptr);
	RESULT record(const eServiceReference &, ePtr<iRecordableService> &ptr);
	RESULT list(const eServiceReference &, ePtr<iListableService> &ptr);
	RESULT info(const eServiceReference &, ePtr<iStaticServiceInformation> &ptr);
	RESULT offlineOperations(const eServiceReference &, ePtr<iServiceOfflineOperations> &ptr);
};

class eServiceDVD: public iPlayableService, public iPauseableService, public iSeekableService,
	public iServiceInformation, public iSubtitleOutput, public iServiceKeys, public iCueSheet, public eThread, public Object
{
	friend class eServiceFactoryDVD;
	DECLARE_REF(eServiceDVD);
public:
	virtual ~eServiceDVD();
		// not implemented (yet)
	RESULT audioChannel(ePtr<iAudioChannelSelection> &ptr) { ptr = 0; return -1; }
	RESULT audioTracks(ePtr<iAudioTrackSelection> &ptr) { ptr = 0; return -1; }
	RESULT frontendInfo(ePtr<iFrontendInformation> &ptr) { ptr = 0; return -1; }
	RESULT subServices(ePtr<iSubserviceList> &ptr) { ptr = 0; return -1; }
	RESULT timeshift(ePtr<iTimeshiftService> &ptr) { ptr = 0; return -1; }
	RESULT audioDelay(ePtr<iAudioDelay> &ptr) { ptr = 0; return -1; }
	RESULT rdsDecoder(ePtr<iRdsDecoder> &ptr) { ptr = 0; return -1; }
	RESULT stream(ePtr<iStreamableService> &ptr) { ptr = 0; return -1; }
	RESULT cueSheet(ePtr<iCueSheet> &ptr);

		// iPlayableService
	RESULT connectEvent(const Slot2<void,iPlayableService*,int> &event, ePtr<eConnection> &connection);
	RESULT start();
	RESULT stop();
	RESULT setTarget(int target);
	RESULT info(ePtr<iServiceInformation> &ptr);
	RESULT pause(ePtr<iPauseableService> &ptr);
	RESULT subtitle(ePtr<iSubtitleOutput> &ptr);
	RESULT seek(ePtr<iSeekableService> &ptr);
	RESULT keys(ePtr<iServiceKeys> &ptr);

		// iPausableService
	RESULT pause();
	RESULT unpause();
	RESULT setSlowMotion(int ratio);
	RESULT setFastForward(int ratio);

		// iSubtitleOutput
	RESULT enableSubtitles(eWidget *parent, SWIG_PYOBJECT(ePyObject) entry);
	RESULT disableSubtitles(eWidget *parent);
	PyObject *getSubtitleList();
	PyObject *getCachedSubtitle();

		// iSeekableService
	RESULT getLength(pts_t &len);
	RESULT seekTo(pts_t to);
	RESULT seekRelative(int direction, pts_t to);
	RESULT getPlayPosition(pts_t &pos);
	RESULT setTrickmode(int trick=0);
	RESULT isCurrentlySeekable();
	RESULT seekChapter(int chapter);
	RESULT seekTitle(int title);

		// iServiceInformation
	RESULT getName(std::string &name);
	int getInfo(int w);
	std::string getInfoString(int w);
	virtual PyObject *getInfoObject(int w);

		// iCueSheet
	PyObject *getCutList();
	void setCutList(SWIG_PYOBJECT(ePyObject));
	void setCutListEnable(int enable);

		// iServiceKeys
	RESULT keyPressed(int key);
private:
	eServiceDVD(const char *filename);

	void gotMessage(int); // message from dvdlib
	void gotThreadMessage(const int &); // message from dvd thread

		// eThread
	void thread();
	void thread_finished();

	std::string m_filename;

	Signal2<void,iPlayableService*,int> m_event;

	struct ddvd *m_ddvdconfig;
	ePtr<gPixmap> m_pixmap;
	eSubtitleWidget *m_subtitle_widget;

	enum
	{
		stIdle, stRunning, stMenu, stStopped
	};

	int m_state;
	int m_current_trick;

	char m_ddvd_titlestring[96];

	eSocketNotifier m_sn;
	eFixedMessagePump<int> m_pump;

	pts_t m_cue_pts;
	void loadCuesheet();
	void saveCuesheet();
};

#endif