diff --git a/Makefile b/Makefile index 9ba0646..ab6855b 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # # Makefile for a Video Disk Recorder plugin # -# $Id: Makefile,v 1.15 2007/10/05 19:00:44 ajhseppa Exp $ +# $Id: Makefile,v 1.16 2007/10/05 20:01:24 ajhseppa Exp $ # Debugging on/off #IPTV_DEBUG = 1 @@ -59,7 +59,7 @@ endif OBJS = $(PLUGIN).o config.o setup.o device.o streamer.o protocoludp.o \ protocolhttp.o protocolfile.o sectionfilter.o sidscanner.o \ - statistics.o + statistics.o common.c ### The main target: diff --git a/common.c b/common.c new file mode 100644 index 0000000..108195a --- /dev/null +++ b/common.c @@ -0,0 +1,30 @@ +/* + * common.c: IPTV plugin for the Video Disk Recorder + * + * See the README file for copyright information and how to reach the author. + * + * $Id: common.c,v 1.1 2007/10/05 20:01:24 ajhseppa Exp $ + */ + + +#include + +uint16_t ts_pid(const uint8_t *buf) +{ + return ((buf[1] & 0x1f) << 8) + buf[2]; +} + +uint8_t payload(const uint8_t *tsp) +{ + if (!(tsp[3] & 0x10)) // no payload? + return 0; + + if (tsp[3] & 0x20) { // adaptation field? + if (tsp[4] > 183) // corrupted data? + return 0; + else + return 184 - 1 - tsp[4]; + } + + return 184; +} diff --git a/common.h b/common.h index 26b9394..75b9ad0 100644 --- a/common.h +++ b/common.h @@ -3,7 +3,7 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: common.h,v 1.2 2007/09/29 16:23:40 rahrenbe Exp $ + * $Id: common.h,v 1.3 2007/10/05 20:01:24 ajhseppa Exp $ */ #ifndef __IPTV_COMMON_H @@ -11,6 +11,9 @@ #include +uint16_t ts_pid(const uint8_t *buf); +uint8_t payload(const uint8_t *tsp); + #ifdef DEBUG #define debug(x...) dsyslog("IPTV: " x); #define error(x...) esyslog("IPTV: " x); diff --git a/sectionfilter.c b/sectionfilter.c index 273cebc..8a950c4 100644 --- a/sectionfilter.c +++ b/sectionfilter.c @@ -3,7 +3,7 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: sectionfilter.c,v 1.7 2007/10/05 19:00:44 ajhseppa Exp $ + * $Id: sectionfilter.c,v 1.8 2007/10/05 20:01:24 ajhseppa Exp $ */ #include "sectionfilter.h" @@ -11,26 +11,6 @@ #define IPTV_FILTER_FILENAME "/tmp/vdr-iptv%d.filter%d" -uint16_t ts_pid(const uint8_t *buf) -{ - return ((buf[1] & 0x1f) << 8) + buf[2]; -} - -uint8_t payload(const uint8_t *tsp) -{ - if (!(tsp[3] & 0x10)) // no payload? - return 0; - - if (tsp[3] & 0x20) { // adaptation field? - if (tsp[4] > 183) // corrupted data? - return 0; - else - return 184 - 1 - tsp[4]; - } - - return 184; -} - cIptvSectionFilter::cIptvSectionFilter(int Index, int devInd, u_short Pid, u_char Tid, u_char Mask) : pusi_seen(0), diff --git a/sectionfilter.h b/sectionfilter.h index 8dee4a3..f47e4ef 100644 --- a/sectionfilter.h +++ b/sectionfilter.h @@ -3,7 +3,7 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: sectionfilter.h,v 1.3 2007/10/05 19:00:44 ajhseppa Exp $ + * $Id: sectionfilter.h,v 1.4 2007/10/05 20:01:24 ajhseppa Exp $ */ #ifndef __IPTV_SECTIONFILTER_H @@ -38,9 +38,6 @@ #define DVB_DEMUX_MASK_MAX 18 -uint16_t ts_pid(const uint8_t *buf); -uint8_t payload(const uint8_t *tsp); - class cIptvSectionFilter : public cIptvSectionStatistics { private: enum dmx_success {