summaryrefslogtreecommitdiff
path: root/common.h
blob: 664f679d9bdca532a491e4b1008570780c6b45a2 (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
/*
 *  $Id: common.h,v 1.16 2010/07/19 13:49:24 schmirl Exp $
 */
 
#ifndef VDR_STREAMDEV_COMMON_H
#define VDR_STREAMDEV_COMMON_H

/* FreeBSD has it's own version of isnumber(),
   but VDR's version is incompatible */
#ifdef __FreeBSD__
#undef isnumber
#endif

#include <vdr/tools.h>
#include <vdr/plugin.h>

#include "tools/socket.h"

#ifdef DEBUG
#include <stdio.h>
#include <time.h>
#define Dprintf(fmt, x...) {\
	struct timespec ts;\
	clock_gettime(CLOCK_MONOTONIC, &ts);\
	fprintf(stderr, "%ld.%.3ld [%d] "fmt,\
		ts.tv_sec, ts.tv_nsec / 1000000, cThread::ThreadId(), ##x);\
}
#else
#define Dprintf(x...)
#endif

#define MAXPARSEBUFFER KILOBYTE(16)

/* Service ID for loop prevention */
#define LOOP_PREVENTION_SERVICE "StreamdevLoopPrevention"

/* Check if a channel is a radio station. */
#define ISRADIO(x) ((x)->Vpid()==0||(x)->Vpid()==1||(x)->Vpid()==0x1fff)

class cChannel;

enum eStreamType {
	stTS,
	stPES,
	stPS,
	stES,
	stEXT,
	stTSPIDS,
	st_Count
};

enum eSocketId {
	siLive,
	siReplay,
	siLiveFilter,
	siDataRespond,
	si_Count
};

extern const char *VERSION;

class cMenuEditIpItem: public cMenuEditItem {
private:
	static const char IpCharacters[];
	char *value;
	int curNum;
	int pos;
	bool step;

protected:
	virtual void Set(void);

public:
	cMenuEditIpItem(const char *Name, char *Value); // Value must be 16 bytes
	~cMenuEditIpItem();

	virtual eOSState ProcessKey(eKeys Key);
};

#endif // VDR_STREAMDEV_COMMON_H