2007-09-12 19:28:59 +02:00
|
|
|
/*
|
|
|
|
* common.h: IPTV plugin for the Video Disk Recorder
|
|
|
|
*
|
|
|
|
* See the README file for copyright information and how to reach the author.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __IPTV_COMMON_H
|
|
|
|
#define __IPTV_COMMON_H
|
|
|
|
|
|
|
|
#include <vdr/tools.h>
|
2007-10-28 17:22:44 +01:00
|
|
|
#include <vdr/config.h>
|
2007-10-27 01:18:49 +02:00
|
|
|
#include <vdr/i18n.h>
|
2007-09-12 19:28:59 +02:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
#define debug(x...) dsyslog("IPTV: " x);
|
2009-10-01 17:48:28 +02:00
|
|
|
#define error(x...) esyslog("ERROR: " x);
|
2007-09-12 19:28:59 +02:00
|
|
|
#else
|
|
|
|
#define debug(x...) ;
|
2009-10-01 17:48:28 +02:00
|
|
|
#define error(x...) esyslog("ERROR: " x);
|
2007-09-12 19:28:59 +02:00
|
|
|
#endif
|
|
|
|
|
2010-03-04 16:34:21 +01:00
|
|
|
#define ELEMENTS(x) (sizeof(x) / sizeof(x[0]))
|
2007-10-27 01:13:24 +02:00
|
|
|
|
2008-02-17 20:18:47 +01:00
|
|
|
#define IPTV_DVR_FILENAME "/tmp/vdr-iptv%d.dvr"
|
|
|
|
|
2010-03-04 16:34:21 +01:00
|
|
|
#define IPTV_SOURCE_CHARACTER 'I'
|
|
|
|
|
2007-10-09 01:51:58 +02:00
|
|
|
#define IPTV_DEVICE_INFO_ALL 0
|
|
|
|
#define IPTV_DEVICE_INFO_GENERAL 1
|
|
|
|
#define IPTV_DEVICE_INFO_PIDS 2
|
|
|
|
#define IPTV_DEVICE_INFO_FILTERS 3
|
2012-04-01 21:46:08 +02:00
|
|
|
#define IPTV_DEVICE_INFO_PROTOCOL 4
|
|
|
|
#define IPTV_DEVICE_INFO_BITRATE 5
|
2007-10-07 22:08:44 +02:00
|
|
|
|
2007-10-09 01:51:58 +02:00
|
|
|
#define IPTV_STATS_ACTIVE_PIDS_COUNT 10
|
|
|
|
#define IPTV_STATS_ACTIVE_FILTERS_COUNT 10
|
2007-10-08 00:54:09 +02:00
|
|
|
|
2007-10-09 01:51:58 +02:00
|
|
|
#define SECTION_FILTER_TABLE_SIZE 7
|
2007-10-06 02:02:50 +02:00
|
|
|
|
2007-10-21 01:16:28 +02:00
|
|
|
#define ERROR_IF_FUNC(exp, errstr, func, ret) \
|
2009-10-01 17:48:28 +02:00
|
|
|
do { \
|
|
|
|
if (exp) { \
|
|
|
|
char tmp[64]; \
|
|
|
|
error(errstr": %s", strerror_r(errno, tmp, sizeof(tmp))); \
|
|
|
|
func; \
|
|
|
|
ret; \
|
|
|
|
} \
|
2007-10-21 01:16:28 +02:00
|
|
|
} while (0)
|
|
|
|
|
2007-10-21 01:25:14 +02:00
|
|
|
|
|
|
|
#define ERROR_IF_RET(exp, errstr, ret) ERROR_IF_FUNC(exp, errstr, ,ret);
|
|
|
|
|
|
|
|
#define ERROR_IF(exp, errstr) ERROR_IF_FUNC(exp, errstr, , );
|
2007-10-21 01:16:28 +02:00
|
|
|
|
2007-10-22 21:32:19 +02:00
|
|
|
#define DELETE_POINTER(ptr) \
|
|
|
|
do { \
|
|
|
|
if (ptr) { \
|
|
|
|
typeof(*ptr) *tmp = ptr; \
|
|
|
|
ptr = NULL; \
|
|
|
|
delete(tmp); \
|
|
|
|
} \
|
2007-10-22 18:22:11 +02:00
|
|
|
} while (0)
|
|
|
|
|
2008-01-05 00:36:37 +01:00
|
|
|
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
|
|
|
|
|
2007-10-10 21:41:10 +02:00
|
|
|
uint16_t ts_pid(const uint8_t *buf);
|
|
|
|
uint8_t payload(const uint8_t *tsp);
|
|
|
|
const char *id_pid(const u_short Pid);
|
2007-10-20 22:43:22 +02:00
|
|
|
int select_single_desc(int descriptor, const int usecs, const bool selectWrite);
|
2007-10-10 21:41:10 +02:00
|
|
|
|
|
|
|
struct section_filter_table_type {
|
2007-10-06 02:02:50 +02:00
|
|
|
const char *description;
|
2007-10-10 21:41:10 +02:00
|
|
|
const char *tag;
|
2007-10-06 02:02:50 +02:00
|
|
|
u_short pid;
|
|
|
|
u_char tid;
|
|
|
|
u_char mask;
|
2007-10-10 21:41:10 +02:00
|
|
|
};
|
2007-10-06 02:02:50 +02:00
|
|
|
|
|
|
|
extern const section_filter_table_type section_filter_table[SECTION_FILTER_TABLE_SIZE];
|
|
|
|
|
2010-09-10 09:54:06 +02:00
|
|
|
extern const char VERSION[];
|
|
|
|
|
2007-09-12 19:28:59 +02:00
|
|
|
#endif // __IPTV_COMMON_H
|
|
|
|
|