1
0
mirror of https://github.com/rofafor/vdr-plugin-iptv.git synced 2023-10-10 11:37:03 +00:00

Compare commits

...

22 Commits

Author SHA1 Message Date
Rolf Ahrenberg
fd7a43d733 Added optional patches to disable CA updates. 2009-03-07 15:27:04 +02:00
Rolf Ahrenberg
d546cac834 Fixed pid scanner to set the existing video stream type. 2009-03-06 22:20:34 +02:00
Rolf Ahrenberg
94225ac6a4 Fixed pid scanner to default MPEG2 video stream type. 2009-03-06 19:30:56 +02:00
Rolf Ahrenberg
25ec9df0cc Whitespace cleanup. 2009-03-06 19:06:47 +02:00
Rolf Ahrenberg
abf0a5ece4 Refactored section filter class. 2009-02-27 16:05:19 +02:00
Rolf Ahrenberg
024ee7ba89 Optimized TS packet data flow. 2009-02-26 16:04:12 +02:00
Rolf Ahrenberg
73906ab698 Fixed a possible crash in pid scanner. 2009-02-25 22:52:25 +02:00
Rolf Ahrenberg
ec2ec19f68 Fixed a possible crash in sid scanner. 2009-02-25 14:34:19 +02:00
Rolf Ahrenberg
1e8f117988 Updated for vdr-1.7.4.
Fixed blacklisting of PAT section filter.
Set max IPTV device count to VDR's max devices.
2009-02-24 13:40:16 +02:00
Rolf Ahrenberg
00cf880a5d Updated HISTORY. 2008-12-16 17:14:45 +02:00
Rolf Ahrenberg
71472a1033 Updated for vdr-1.7.2. 2008-12-14 20:27:45 +02:00
Rolf Ahrenberg
0eff9de2ee Silenced a warning about ignoring a return value of write(). 2008-11-10 12:32:34 +02:00
Rolf Ahrenberg
9a19009451 Cleaned up Makefile header. 2008-11-04 23:29:20 +02:00
Rolf Ahrenberg
04c194ffc7 Incremented the version number. 2008-10-12 23:08:41 +03:00
Rolf Ahrenberg
40125dd9bb Updated HISTORY for the release. 2008-10-12 22:44:17 +03:00
Rolf Ahrenberg
c5a7598544 Optimized streamer thread termination. 2008-09-10 17:22:36 +03:00
Rolf Ahrenberg
4e8e26a4b3 Updated iptvstream.sh script to support optional video resolution settings. 2008-09-01 14:28:05 +03:00
Rolf Ahrenberg
9ec10262d4 Fifo shouldn't be opened as write-only, if there're no readers. 2008-08-31 12:56:22 +03:00
Rolf Ahrenberg
501701e3d3 Added .gitignore. 2008-08-29 17:38:46 +03:00
Rolf Ahrenberg
53b5644973 Migration changes for git and UTF-8.
Updated contact information.
2008-08-23 08:15:30 +03:00
Rolf Ahrenberg
17b4709c30 Tweaked pid scanner parameters for HD broadcasts. 2008-08-06 08:05:52 +00:00
Rolf Ahrenberg
2bff3d0f8f Updated Italian translation. 2008-07-14 10:13:48 +00:00
47 changed files with 477 additions and 555 deletions

6
.gitignore vendored Normal file
View File

@@ -0,0 +1,6 @@
.dependencies
*.o
*.so
*~
po/*.pot
po/*.mo

33
HISTORY
View File

@@ -43,7 +43,7 @@ VDR Plugin 'iptv' Revision History
- Updated for vdr-1.5.15. - Updated for vdr-1.5.15.
- Replaced asprintf with cString. - Replaced asprintf with cString.
- Updated French translation (Thanks to Micha<EFBFBD>l Nival). - Updated French translation (Thanks to Michaël Nival).
- Modified VDR locale support detection. - Modified VDR locale support detection.
- Added preliminary automatic Pid scanning functionality. - Added preliminary automatic Pid scanning functionality.
- Modified channels.conf format to enable/disable channel - Modified channels.conf format to enable/disable channel
@@ -63,3 +63,34 @@ VDR Plugin 'iptv' Revision History
- Updated vlc2iptv script for new channels.conf format. - Updated vlc2iptv script for new channels.conf format.
- Added pluginparam patch for vdr-1.7.0. - Added pluginparam patch for vdr-1.7.0.
- Added new example scripts from VDR-WIKI. - Added new example scripts from VDR-WIKI.
2008-10-12: Version 0.2.2
- Converted HISTORY and fi_FI.po to UTF-8.
- Updated Italian translation (Thanks to Diego Pierotto).
- Tweaked pid scanner parameters for HD broadcasts.
- Fixed opening of fifo tap.
- Updated iptvstream.sh script to support optional video resolution
settings.
- Optimized streamer thread termination.
2008-12-16: Version 0.2.3
- Updated for vdr-1.7.2.
- Silenced a compilation warning.
2009-02-25: Version 0.2.4
- Updated for vdr-1.7.4.
- Fixed blacklisting of PAT section filter.
- Set max IPTV device count to VDR's max devices.
- Fixed a possible crash in sid and pid scanners.
2009-03-08: Version 0.2.5
- Optimized TS packet data flow.
- Refactored section filter class.
- Cleaned up example scripts.
- Fixed pid scanner to set the existing video stream type
(Thanks to ua0lnj for reporting this one).
- Added optional patches to disable CA updates.

View File

@@ -1,7 +1,6 @@
# #
# Makefile for a Video Disk Recorder plugin # Makefile for IPTV plugin
# #
# $Id: Makefile,v 1.27 2008/02/19 22:29:02 rahrenbe Exp $
# Debugging on/off # Debugging on/off
#IPTV_DEBUG = 1 #IPTV_DEBUG = 1
@@ -120,7 +119,7 @@ dist: clean
@-rm -rf $(TMPDIR)/$(ARCHIVE) @-rm -rf $(TMPDIR)/$(ARCHIVE)
@mkdir $(TMPDIR)/$(ARCHIVE) @mkdir $(TMPDIR)/$(ARCHIVE)
@cp -a * $(TMPDIR)/$(ARCHIVE) @cp -a * $(TMPDIR)/$(ARCHIVE)
@tar czf $(PACKAGE).tgz -C $(TMPDIR) --exclude CVS $(ARCHIVE) @tar czf $(PACKAGE).tgz -C $(TMPDIR) $(ARCHIVE)
@-rm -rf $(TMPDIR)/$(ARCHIVE) @-rm -rf $(TMPDIR)/$(ARCHIVE)
@echo Distribution package created as $(PACKAGE).tgz @echo Distribution package created as $(PACKAGE).tgz

4
README
View File

@@ -3,8 +3,8 @@ This is an IPTV plugin for the Video Disk Recorder (VDR).
Written by: Rolf Ahrenberg Written by: Rolf Ahrenberg
< R o l f . A h r e n b e r g @ s c i . f i > < R o l f . A h r e n b e r g @ s c i . f i >
Antti Sepp<EFBFBD>l<EFBFBD> Antti Seppälä
<a j h s e p p a @ n i k s u l a . h u t . f i > < a . s e p p a l a @ g m a i l . c o m >
Project's homepage: http://www.saunalahti.fi/~rahrenbe/vdr/iptv/ Project's homepage: http://www.saunalahti.fi/~rahrenbe/vdr/iptv/

View File

@@ -3,7 +3,6 @@
* *
* See the README file for copyright information and how to reach the author. * See the README file for copyright information and how to reach the author.
* *
* $Id: common.c,v 1.10 2008/01/30 21:57:33 rahrenbe Exp $
*/ */
#include <vdr/tools.h> #include <vdr/tools.h>

View File

@@ -3,7 +3,6 @@
* *
* See the README file for copyright information and how to reach the author. * See the README file for copyright information and how to reach the author.
* *
* $Id: common.h,v 1.20 2008/02/17 19:18:47 rahrenbe Exp $
*/ */
#ifndef __IPTV_COMMON_H #ifndef __IPTV_COMMON_H
@@ -42,6 +41,8 @@
#define SECTION_FILTER_TABLE_SIZE 7 #define SECTION_FILTER_TABLE_SIZE 7
#define TS_SYNC_BYTE 0x47
#define ERROR_IF_FUNC(exp, errstr, func, ret) \ #define ERROR_IF_FUNC(exp, errstr, func, ret) \
do { \ do { \
if (exp) { \ if (exp) { \

View File

@@ -3,7 +3,6 @@
* *
* See the README file for copyright information and how to reach the author. * See the README file for copyright information and how to reach the author.
* *
* $Id: config.c,v 1.21 2008/02/01 21:54:24 rahrenbe Exp $
*/ */
#include "config.h" #include "config.h"
@@ -11,14 +10,13 @@
cIptvConfig IptvConfig; cIptvConfig IptvConfig;
cIptvConfig::cIptvConfig(void) cIptvConfig::cIptvConfig(void)
: readBufferTsCount(48), : tsBufferSize(2),
tsBufferSize(2),
tsBufferPrefillRatio(0), tsBufferPrefillRatio(0),
extProtocolBasePort(4321), extProtocolBasePort(4321),
useBytes(1), useBytes(1),
sectionFiltering(1) sectionFiltering(1)
{ {
for (unsigned int i = 0; i < ARRAY_SIZE(disabledFilters) - 1; ++i) for (unsigned int i = 0; i < ARRAY_SIZE(disabledFilters); ++i)
disabledFilters[i] = -1; disabledFilters[i] = -1;
memset(configDirectory, '\0', sizeof(configDirectory)); memset(configDirectory, '\0', sizeof(configDirectory));
} }
@@ -26,7 +24,7 @@ cIptvConfig::cIptvConfig(void)
unsigned int cIptvConfig::GetDisabledFiltersCount(void) const unsigned int cIptvConfig::GetDisabledFiltersCount(void) const
{ {
unsigned int n = 0; unsigned int n = 0;
while ((disabledFilters[n] != -1) && (n < ARRAY_SIZE(disabledFilters) - 1)) while ((disabledFilters[n] != -1) && (n < ARRAY_SIZE(disabledFilters)))
n++; n++;
return n; return n;
} }

View File

@@ -3,7 +3,6 @@
* *
* See the README file for copyright information and how to reach the author. * See the README file for copyright information and how to reach the author.
* *
* $Id: config.h,v 1.20 2008/02/01 21:54:24 rahrenbe Exp $
*/ */
#ifndef __IPTV_CONFIG_H #ifndef __IPTV_CONFIG_H
@@ -15,7 +14,6 @@
class cIptvConfig class cIptvConfig
{ {
private: private:
unsigned int readBufferTsCount;
unsigned int tsBufferSize; unsigned int tsBufferSize;
unsigned int tsBufferPrefillRatio; unsigned int tsBufferPrefillRatio;
unsigned int extProtocolBasePort; unsigned int extProtocolBasePort;
@@ -26,7 +24,6 @@ private:
public: public:
cIptvConfig(); cIptvConfig();
unsigned int GetReadBufferTsCount(void) const { return readBufferTsCount; }
unsigned int GetTsBufferSize(void) const { return tsBufferSize; } unsigned int GetTsBufferSize(void) const { return tsBufferSize; }
unsigned int GetTsBufferPrefillRatio(void) const { return tsBufferPrefillRatio; } unsigned int GetTsBufferPrefillRatio(void) const { return tsBufferPrefillRatio; }
unsigned int GetExtProtocolBasePort(void) const { return extProtocolBasePort; } unsigned int GetExtProtocolBasePort(void) const { return extProtocolBasePort; }

View File

@@ -3,13 +3,12 @@
* *
* See the README file for copyright information and how to reach the author. * See the README file for copyright information and how to reach the author.
* *
* $Id: device.c,v 1.87 2008/04/02 22:55:04 rahrenbe Exp $
*/ */
#include "config.h" #include "config.h"
#include "device.h" #include "device.h"
#define IPTV_MAX_DEVICES 8 #define IPTV_MAX_DEVICES MAXDEVICES
cIptvDevice * IptvDevices[IPTV_MAX_DEVICES] = { NULL }; cIptvDevice * IptvDevices[IPTV_MAX_DEVICES] = { NULL };
@@ -21,20 +20,20 @@ cIptvDevice::cIptvDevice(unsigned int Index)
isPacketDelivered(false), isPacketDelivered(false),
isOpenDvr(false), isOpenDvr(false),
sidScanEnabled(false), sidScanEnabled(false),
pidScanEnabled(false), pidScanEnabled(false)
mutex()
{ {
debug("cIptvDevice::cIptvDevice(%d)\n", deviceIndex); unsigned int bufsize = MEGABYTE(IptvConfig.GetTsBufferSize());
tsBuffer = new cRingBufferLinear(MEGABYTE(IptvConfig.GetTsBufferSize()), bufsize -= (bufsize % TS_SIZE);
(TS_SIZE * IptvConfig.GetReadBufferTsCount()), isyslog("creating IPTV device %d (CardIndex=%d)", deviceIndex, CardIndex());
false, "IPTV"); tsBuffer = new cRingBufferLinear(bufsize + 1, TS_SIZE, false,
tsBuffer->SetTimeouts(100, 100); *cString::sprintf("IPTV %d", deviceIndex));
tsBuffer->SetTimeouts(10, 10);
ResetBuffering(); ResetBuffering();
pUdpProtocol = new cIptvProtocolUdp(); pUdpProtocol = new cIptvProtocolUdp();
pHttpProtocol = new cIptvProtocolHttp(); pHttpProtocol = new cIptvProtocolHttp();
pFileProtocol = new cIptvProtocolFile(); pFileProtocol = new cIptvProtocolFile();
pExtProtocol = new cIptvProtocolExt(); pExtProtocol = new cIptvProtocolExt();
pIptvStreamer = new cIptvStreamer(tsBuffer, &mutex); pIptvStreamer = new cIptvStreamer(tsBuffer, (100 * TS_SIZE));
pPidScanner = new cPidScanner; pPidScanner = new cPidScanner;
// Initialize filter pointers // Initialize filter pointers
memset(secfilters, '\0', sizeof(secfilters)); memset(secfilters, '\0', sizeof(secfilters));
@@ -49,7 +48,7 @@ cIptvDevice::cIptvDevice(unsigned int Index)
cString filename = cString::sprintf(IPTV_DVR_FILENAME, deviceIndex); cString filename = cString::sprintf(IPTV_DVR_FILENAME, deviceIndex);
stat(filename, &sb); stat(filename, &sb);
if (S_ISFIFO(sb.st_mode)) { if (S_ISFIFO(sb.st_mode)) {
dvrFd = open(filename, O_WRONLY | O_NONBLOCK); dvrFd = open(filename, O_RDWR | O_NONBLOCK);
if (dvrFd >= 0) if (dvrFd >= 0)
dsyslog("IPTV device %d redirecting input stream to '%s'", deviceIndex, *filename); dsyslog("IPTV device %d redirecting input stream to '%s'", deviceIndex, *filename);
} }
@@ -334,7 +333,7 @@ int cIptvDevice::OpenFilter(u_short Pid, u_char Tid, u_char Mask)
for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) { for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) {
if (!secfilters[i]) { if (!secfilters[i]) {
//debug("cIptvDevice::OpenFilter(%d): Pid=%d Tid=%02X Mask=%02X Index=%d\n", deviceIndex, Pid, Tid, Mask, i); //debug("cIptvDevice::OpenFilter(%d): Pid=%d Tid=%02X Mask=%02X Index=%d\n", deviceIndex, Pid, Tid, Mask, i);
secfilters[i] = new cIptvSectionFilter(i, deviceIndex, Pid, Tid, Mask); secfilters[i] = new cIptvSectionFilter(deviceIndex, i, Pid, Tid, Mask);
return secfilters[i]->GetReadDesc(); return secfilters[i]->GetReadDesc();
} }
} }
@@ -356,12 +355,11 @@ void cIptvDevice::CloseFilter(int Handle)
bool cIptvDevice::OpenDvr(void) bool cIptvDevice::OpenDvr(void)
{ {
debug("cIptvDevice::OpenDvr(%d)\n", deviceIndex); debug("cIptvDevice::OpenDvr(%d)\n", deviceIndex);
mutex.Lock();
isPacketDelivered = false; isPacketDelivered = false;
tsBuffer->Clear(); tsBuffer->Clear();
mutex.Unlock();
ResetBuffering(); ResetBuffering();
pIptvStreamer->Open(); if (pIptvStreamer)
pIptvStreamer->Open();
if (sidScanEnabled && pSidScanner && IptvConfig.GetSectionFiltering()) if (sidScanEnabled && pSidScanner && IptvConfig.GetSectionFiltering())
pSidScanner->SetStatus(true); pSidScanner->SetStatus(true);
isOpenDvr = true; isOpenDvr = true;
@@ -407,7 +405,7 @@ bool cIptvDevice::GetTSPacket(uchar *&Data)
{ {
int Count = 0; int Count = 0;
//debug("cIptvDevice::GetTSPacket(%d)\n", deviceIndex); //debug("cIptvDevice::GetTSPacket(%d)\n", deviceIndex);
if (!IsBuffering()) { if (tsBuffer && !IsBuffering()) {
if (isPacketDelivered) { if (isPacketDelivered) {
tsBuffer->Del(TS_SIZE); tsBuffer->Del(TS_SIZE);
isPacketDelivered = false; isPacketDelivered = false;
@@ -429,24 +427,24 @@ bool cIptvDevice::GetTSPacket(uchar *&Data)
} }
isPacketDelivered = true; isPacketDelivered = true;
Data = p; Data = p;
// Update pid statistics // Update pid statistics
AddPidStatistic(ts_pid(p), payload(p)); AddPidStatistic(ts_pid(p), payload(p));
// Send data also to dvr fifo // Send data also to dvr fifo
if (dvrFd >= 0) if (dvrFd >= 0)
write(dvrFd, p, TS_SIZE); Count = write(dvrFd, p, TS_SIZE);
// Analyze incomplete streams with built-in pid analyzer // Analyze incomplete streams with built-in pid analyzer
if (pidScanEnabled && pPidScanner) if (pidScanEnabled && pPidScanner)
pPidScanner->Process(p); pPidScanner->Process(p);
// Run the data through all filters // Run the data through all filters
for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) { for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) {
if (secfilters[i]) if (secfilters[i])
secfilters[i]->ProcessData(p); secfilters[i]->Process(p);
} }
return true; return true;
} }
} }
// Reduce cpu load by preventing busylooping // Reduce cpu load by preventing busylooping
cCondWait::SleepMs(100); cCondWait::SleepMs(10);
Data = NULL; Data = NULL;
return true; return true;
} }

View File

@@ -3,7 +3,6 @@
* *
* See the README file for copyright information and how to reach the author. * See the README file for copyright information and how to reach the author.
* *
* $Id: device.h,v 1.39 2008/02/17 19:18:47 rahrenbe Exp $
*/ */
#ifndef __IPTV_DEVICE_H #ifndef __IPTV_DEVICE_H

3
iptv.c
View File

@@ -3,7 +3,6 @@
* *
* See the README file for copyright information and how to reach the author. * See the README file for copyright information and how to reach the author.
* *
* $Id: iptv.c,v 1.39 2008/03/30 20:25:12 rahrenbe Exp $
*/ */
#include <getopt.h> #include <getopt.h>
@@ -21,7 +20,7 @@
#error "VDR-1.6.0 API version or greater is required!" #error "VDR-1.6.0 API version or greater is required!"
#endif #endif
static const char VERSION[] = "0.2.1"; static const char VERSION[] = "0.2.5";
static const char DESCRIPTION[] = trNOOP("Experience the IPTV"); static const char DESCRIPTION[] = trNOOP("Experience the IPTV");
class cPluginIptv : public cPlugin { class cPluginIptv : public cPlugin {

View File

@@ -27,7 +27,7 @@
if [ $# -ne 2 ]; then if [ $# -ne 2 ]; then
logger "$0: error: Invalid parameter count '$#' $*" logger "$0: error: Invalid parameter count '$#' $*"
exit 1; exit 1
fi fi
# Channels.conf parameter # Channels.conf parameter
@@ -49,8 +49,8 @@ rm -f "${FIFO}"
mkfifo "${FIFO}" mkfifo "${FIFO}"
mplayer -dumpstream "${URL}" \ mplayer -dumpstream "${URL}" \
-quiet -nolirc -noautosub -noconsolecontrols -novideo -nojoystick \ -quiet -nolirc -noautosub -noconsolecontrols -novideo -nojoystick \
-dumpfile "$FIFO" & -dumpfile "$FIFO" &
# Time to connect and fill pipe # Time to connect and fill pipe
sleep 3 sleep 3
@@ -58,10 +58,10 @@ sleep 3
# Build audio only stream # Build audio only stream
# PID 0x100/256 = Audio # PID 0x100/256 = Audio
ffmpeg -v -1 \ ffmpeg -v -1 \
-i "${FIFO}" \ -i "${FIFO}" \
-title "${TITLE}" \ -title "${TITLE}" \
-f mpegts -acodec mp2 -ac 2 -ab 96k -ar 48000 \ -f mpegts -acodec mp2 -ac 2 -ab 96k -ar 48000 \
- | nc -u 127.0.0.1 ${PORT} - | nc -u 127.0.0.1 ${PORT}
rm -f "${FIFO}" rm -f "${FIFO}"
} > ${LOG} 2>&1 } > ${LOG} 2>&1

View File

@@ -3,7 +3,7 @@
# iptvstream.sh can be used by the VDR iptv plugin to transcode external # iptvstream.sh can be used by the VDR iptv plugin to transcode external
# sources # sources
# #
# (C) 2007 Rolf Ahrenberg, Antti Sepp<EFBFBD>l<EFBFBD> # (C) 2007 Rolf Ahrenberg, Antti Seppälä
# #
# iptvstream.sh is free software; you can redistribute it and/or modify # iptvstream.sh is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
if [ $# -ne 2 ]; then if [ $# -ne 2 ]; then
logger "$0: error: Invalid parameter count '$#' $*" logger "$0: error: Invalid parameter count '$#' $*"
exit 1; exit 1
fi fi
# Channels.conf parameter # Channels.conf parameter
@@ -31,30 +31,40 @@ PARAMETER=${1}
# Iptv plugin listens this port # Iptv plugin listens this port
PORT=${2} PORT=${2}
# Default bitrates for stream transcoding # Default settings for stream transcoding
VCODEC=mp2v
VBITRATE=2400 VBITRATE=2400
ACODEC=mpga
ABITRATE=320 ABITRATE=320
# There is a way to specify multiple URLs in the same script. The selection is # There is a way to specify multiple URLs in the same script. The selection is
# then controlled by the extra parameter passed by IPTV plugin to the script # then controlled by the extra parameter passed by IPTV plugin to the script
case ${PARAMETER} in case ${PARAMETER} in
1) 1)
URL="" URL=""
;; WIDTH=720
HEIGHT=576
;;
2) 2)
URL="" URL=""
;; ;;
3) 3)
URL="" URL=""
;; ;;
*) *)
URL="" # Default URL URL="" # Default URL
;; ;;
esac esac
if [ -z "${URL}" ]; then if [ -z "${URL}" ]; then
logger "$0: error: URL not defined!" logger "$0: error: URL not defined!"
exit 1; exit 1
fi
# Create transcoding options
TRANSCODE_OPTS="vcodec=${VCODEC},acodec=${ACODEC},vb=${VBITRATE},ab=${ABITRATE}"
if [ -n "${WIDTH}" -a -n "${HEIGHT}" ] ; then
TRANSCODE_OPTS="${TRANSCODE_OPTS},width=${WIDTH},height=${HEIGHT}"
fi fi
# Create unique pids for the stream # Create unique pids for the stream
@@ -63,7 +73,7 @@ let APID=${PARAMETER}+2
let SPID=${PARAMETER}+3 let SPID=${PARAMETER}+3
# Capture VLC pid for further management in IPTV plugin # Capture VLC pid for further management in IPTV plugin
vlc "${URL}" --sout "#transcode{vcodec=mp2v,acodec=mpga,vb=${VBITRATE},ab=${ABITRATE}}:standard{access=udp,mux=ts{pid-video=${VPID},pid-audio=${APID},pid-spu=${SPID}},dst=127.0.0.1:${PORT}}" --intf dummy & vlc "${URL}" --sout "#transcode{${TRANSCODE_OPTS}}:standard{access=udp,mux=ts{pid-video=${VPID},pid-audio=${APID},pid-spu=${SPID}},dst=127.0.0.1:${PORT}}" --intf dummy &
PID=${!} PID=${!}

View File

@@ -27,7 +27,7 @@
if [ $# -ne 2 ]; then if [ $# -ne 2 ]; then
logger "$0: error: Invalid parameter count '$#' $*" logger "$0: error: Invalid parameter count '$#' $*"
exit 1; exit 1
fi fi
# Channels.conf parameter # Channels.conf parameter
@@ -46,9 +46,9 @@ LOG=/dev/null
# PID 0x100/256 = Audio # PID 0x100/256 = Audio
arecord -q -D hw:0,0 -f dat | \ arecord -q -D hw:0,0 -f dat | \
ffmpeg -v -1 \ ffmpeg -v -1 \
-f wav \ -f wav \
-i - \ -i - \
-title "${TITLE}" \ -title "${TITLE}" \
-f mpegts -acodec mp2 -ac 2 -ab 128k -ar 48000 \ -f mpegts -acodec mp2 -ac 2 -ab 128k -ar 48000 \
- | nc -nu 127.0.0.1 ${PORT} - | nc -nu 127.0.0.1 ${PORT}
} > ${LOG} 2>&1 } > ${LOG} 2>&1

View File

@@ -2,7 +2,7 @@
# #
# vlc2iptv is used by the VDR iptv plugin to transcode external sources # vlc2iptv is used by the VDR iptv plugin to transcode external sources
# #
# (C) 2007 Rolf Ahrenberg, Antti Sepp<EFBFBD>l<EFBFBD> # (C) 2007 Rolf Ahrenberg, Antti Seppälä
# (C) 2007 Tobias Grimm # (C) 2007 Tobias Grimm
# #
# vlc2iptv is free software; you can redistribute it and/or modify # vlc2iptv is free software; you can redistribute it and/or modify
@@ -37,7 +37,7 @@ AUDIO_BITRATE=320
exit_with_error() exit_with_error()
{ {
logger "vlc2iptv: error: $*" logger "vlc2iptv: error: $*"
exit 1; exit 1
} }
read_arguments() read_arguments()

View File

@@ -27,7 +27,7 @@
if [ $# -ne 2 ]; then if [ $# -ne 2 ]; then
logger "$0: error: Invalid parameter count '$#' $*" logger "$0: error: Invalid parameter count '$#' $*"
exit 1; exit 1
fi fi
# Channels.conf parameter # Channels.conf parameter
@@ -50,8 +50,8 @@ rm -f "${FIFO}"
mkfifo "${FIFO}" mkfifo "${FIFO}"
mplayer -dumpstream "${URL}" \ mplayer -dumpstream "${URL}" \
-quiet -nolirc -noautosub -noconsolecontrols -novideo -nojoystick \ -quiet -nolirc -noautosub -noconsolecontrols -novideo -nojoystick \
-dumpfile "${FIFO}" & -dumpfile "${FIFO}" &
# Time to connect and fill pipe # Time to connect and fill pipe
sleep 3 sleep 3
@@ -59,11 +59,11 @@ sleep 3
# Build stream from audiodump with cycle image as video # Build stream from audiodump with cycle image as video
# PID 0x100/256 = Video 0x101/257 = Audio # PID 0x100/256 = Video 0x101/257 = Audio
ffmpeg -v -1 \ ffmpeg -v -1 \
-i "${FIFO}" -r 0.5 -loop_input -i '${IMAGE}' \ -i "${FIFO}" -r 0.5 -loop_input -i '${IMAGE}' \
-title "${TITLE}" \ -title "${TITLE}" \
-f mpegts -intra -r 24 -vcodec mpeg2video -b 500k -s 352x288 \ -f mpegts -intra -r 24 -vcodec mpeg2video -b 500k -s 352x288 \
-acodec mp2 -ac 2 -ab 96k -ar 48000 \ -acodec mp2 -ac 2 -ab 96k -ar 48000 \
- | nc -u 127.0.0.1 ${PORT} - | nc -u 127.0.0.1 ${PORT}
rm -f "${FIFO}" rm -f "${FIFO}"
} > ${LOG} 2>&1 } > ${LOG} 2>&1

View File

@@ -0,0 +1,11 @@
diff -Nru vdr-1.6.0-vanilla/pat.c vdr-1.6.0-disable-ca-updates/pat.c
--- vdr-1.6.0-vanilla/pat.c 2008-02-08 15:48:31.000000000 +0200
+++ vdr-1.6.0-disable-ca-updates/pat.c 2009-03-07 14:56:42.000000000 +0200
@@ -440,6 +440,7 @@
}
if (Setup.UpdateChannels >= 2) {
Channel->SetPids(Vpid, Vpid ? Ppid : 0, Apids, ALangs, Dpids, DLangs, Spids, SLangs, Tpid);
+ if (!Channel->IsPlug())
Channel->SetCaIds(CaDescriptors->CaIds());
}
Channel->SetCaDescriptors(CaDescriptorHandler.AddCaDescriptors(CaDescriptors));

View File

@@ -0,0 +1,11 @@
diff -Nru vdr-1.7.4-vanilla/pat.c vdr-1.7.4-disable-ca-updates/pat.c
--- vdr-1.7.4-vanilla/pat.c 2008-07-06 17:01:32.000000000 +0300
+++ vdr-1.7.4-disable-ca-updates/pat.c 2009-03-07 14:54:12.000000000 +0200
@@ -444,6 +444,7 @@
}
if (Setup.UpdateChannels >= 2) {
Channel->SetPids(Vpid, Ppid, Vtype, Apids, ALangs, Dpids, DLangs, Spids, SLangs, Tpid);
+ if (!Channel->IsPlug())
Channel->SetCaIds(CaDescriptors->CaIds());
}
Channel->SetCaDescriptors(CaDescriptorHandler.AddCaDescriptors(CaDescriptors));

View File

@@ -1,15 +1,15 @@
diff -Nru vdr-1.7.0-vanilla/channels.c vdr-1.7.0-pluginparam/channels.c diff -Nru vdr-1.7.4-vanilla/channels.c vdr-1.7.4-pluginparam/channels.c
--- vdr-1.7.0-vanilla/channels.c 2008-04-12 16:49:12.000000000 +0300 --- vdr-1.7.4-vanilla/channels.c 2009-01-26 11:44:48.000000000 +0200
+++ vdr-1.7.0-pluginparam/channels.c 2008-04-13 18:58:41.000000000 +0300 +++ vdr-1.7.4-pluginparam/channels.c 2009-02-24 13:31:33.000000000 +0200
@@ -216,6 +216,7 @@ @@ -188,6 +188,7 @@
shortName = strdup(""); shortName = strdup("");
provider = strdup(""); provider = strdup("");
portalName = strdup(""); portalName = strdup("");
+ pluginParam = strdup(""); + pluginParam = strdup("");
memset(&__BeginData__, 0, (char *)&__EndData__ - (char *)&__BeginData__); memset(&__BeginData__, 0, (char *)&__EndData__ - (char *)&__BeginData__);
inversion = DVBFE_INVERSION_AUTO; inversion = INVERSION_AUTO;
bandwidth = DVBFE_BANDWIDTH_AUTO; bandwidth = 8000000;
@@ -241,6 +242,7 @@ @@ -211,6 +212,7 @@
shortName = NULL; shortName = NULL;
provider = NULL; provider = NULL;
portalName = NULL; portalName = NULL;
@@ -17,7 +17,7 @@ diff -Nru vdr-1.7.0-vanilla/channels.c vdr-1.7.0-pluginparam/channels.c
schedule = NULL; schedule = NULL;
linkChannels = NULL; linkChannels = NULL;
refChannel = NULL; refChannel = NULL;
@@ -269,6 +271,7 @@ @@ -239,6 +241,7 @@
free(shortName); free(shortName);
free(provider); free(provider);
free(portalName); free(portalName);
@@ -25,7 +25,7 @@ diff -Nru vdr-1.7.0-vanilla/channels.c vdr-1.7.0-pluginparam/channels.c
} }
cChannel& cChannel::operator= (const cChannel &Channel) cChannel& cChannel::operator= (const cChannel &Channel)
@@ -277,6 +280,7 @@ @@ -247,6 +250,7 @@
shortName = strcpyrealloc(shortName, Channel.shortName); shortName = strcpyrealloc(shortName, Channel.shortName);
provider = strcpyrealloc(provider, Channel.provider); provider = strcpyrealloc(provider, Channel.provider);
portalName = strcpyrealloc(portalName, Channel.portalName); portalName = strcpyrealloc(portalName, Channel.portalName);
@@ -33,9 +33,9 @@ diff -Nru vdr-1.7.0-vanilla/channels.c vdr-1.7.0-pluginparam/channels.c
memcpy(&__BeginData__, &Channel.__BeginData__, (char *)&Channel.__EndData__ - (char *)&Channel.__BeginData__); memcpy(&__BeginData__, &Channel.__BeginData__, (char *)&Channel.__EndData__ - (char *)&Channel.__BeginData__);
return *this; return *this;
} }
@@ -338,9 +342,26 @@ @@ -306,9 +310,26 @@
alpha = Channel->alpha; guard = Channel->guard;
priority = Channel->priority; hierarchy = Channel->hierarchy;
rollOff = Channel->rollOff; rollOff = Channel->rollOff;
+ if (IsPlug()) pluginParam = strcpyrealloc(pluginParam, Channel->pluginParam); + if (IsPlug()) pluginParam = strcpyrealloc(pluginParam, Channel->pluginParam);
} }
@@ -60,7 +60,7 @@ diff -Nru vdr-1.7.0-vanilla/channels.c vdr-1.7.0-pluginparam/channels.c
bool cChannel::SetSatTransponderData(int Source, int Frequency, char Polarization, int Srate, int CoderateH, int Modulation, int System, int RollOff) bool cChannel::SetSatTransponderData(int Source, int Frequency, char Polarization, int Srate, int CoderateH, int Modulation, int System, int RollOff)
{ {
// Workarounds for broadcaster stupidity: // Workarounds for broadcaster stupidity:
@@ -472,6 +493,18 @@ @@ -438,6 +459,18 @@
} }
} }
@@ -79,7 +79,7 @@ diff -Nru vdr-1.7.0-vanilla/channels.c vdr-1.7.0-pluginparam/channels.c
#define STRDIFF 0x01 #define STRDIFF 0x01
#define VALDIFF 0x02 #define VALDIFF 0x02
@@ -665,7 +698,7 @@ @@ -632,7 +665,7 @@
if (isdigit(type)) if (isdigit(type))
type = 'S'; type = 'S';
#define ST(s) if (strchr(s, type)) #define ST(s) if (strchr(s, type))
@@ -88,7 +88,7 @@ diff -Nru vdr-1.7.0-vanilla/channels.c vdr-1.7.0-pluginparam/channels.c
char *q = buffer; char *q = buffer;
*q = 0; *q = 0;
ST(" S ") q += sprintf(q, "%c", polarization); ST(" S ") q += sprintf(q, "%c", polarization);
@@ -681,6 +714,7 @@ @@ -646,6 +679,7 @@
ST(" S ") q += PrintParameter(q, 'S', MapToUser(system, SystemValues)); ST(" S ") q += PrintParameter(q, 'S', MapToUser(system, SystemValues));
ST(" T") q += PrintParameter(q, 'T', MapToUser(transmission, TransmissionValues)); ST(" T") q += PrintParameter(q, 'T', MapToUser(transmission, TransmissionValues));
ST(" T") q += PrintParameter(q, 'Y', MapToUser(hierarchy, HierarchyValues)); ST(" T") q += PrintParameter(q, 'Y', MapToUser(hierarchy, HierarchyValues));
@@ -96,25 +96,25 @@ diff -Nru vdr-1.7.0-vanilla/channels.c vdr-1.7.0-pluginparam/channels.c
return buffer; return buffer;
} }
@@ -702,7 +736,7 @@ @@ -674,7 +708,7 @@
bool cChannel::StringToParameters(const char *s) bool cChannel::StringToParameters(const char *s)
{ {
- while (s && *s) { - while (s && *s) {
+ while (s && *s && !IsPlug()) { + while (s && *s && !IsPlug()) {
switch (toupper(*s)) { switch (toupper(*s)) {
case 'A': s = ParseParameter(s, alpha, AlphaValues); break; case 'A': s = SkipDigits(s); break; // for compatibility with the "multiproto" approach - may be removed in future versions
case 'B': s = ParseParameter(s, bandwidth, BandwidthValues); break; case 'B': s = ParseParameter(s, bandwidth, BandwidthValues); break;
@@ -817,7 +851,7 @@ @@ -792,7 +826,7 @@
dpids[0] = 0; dpids[0] = 0;
ok = false; ok = false;
if (parambuf && sourcebuf && vpidbuf && apidbuf) { if (parambuf && sourcebuf && vpidbuf && apidbuf) {
- ok = StringToParameters(parambuf) && (source = cSource::FromString(sourcebuf)) >= 0; - ok = StringToParameters(parambuf) && (source = cSource::FromString(sourcebuf)) >= 0;
+ ok = ((source = cSource::FromString(sourcebuf)) >= 0) && StringToParameters(parambuf); + ok = ((source = cSource::FromString(sourcebuf)) >= 0) && StringToParameters(parambuf);
char *p = strchr(vpidbuf, '+'); char *p;
if (p) if ((p = strchr(vpidbuf, '=')) != NULL) {
@@ -908,6 +942,7 @@ @@ -887,6 +921,7 @@
shortName = strcpyrealloc(shortName, p); shortName = strcpyrealloc(shortName, p);
} }
name = strcpyrealloc(name, namebuf); name = strcpyrealloc(name, namebuf);
@@ -122,10 +122,10 @@ diff -Nru vdr-1.7.0-vanilla/channels.c vdr-1.7.0-pluginparam/channels.c
free(parambuf); free(parambuf);
free(sourcebuf); free(sourcebuf);
diff -Nru vdr-1.7.0-vanilla/channels.h vdr-1.7.0-pluginparam/channels.h diff -Nru vdr-1.7.4-vanilla/channels.h vdr-1.7.4-pluginparam/channels.h
--- vdr-1.7.0-vanilla/channels.h 2008-04-12 16:46:50.000000000 +0300 --- vdr-1.7.4-vanilla/channels.h 2009-01-26 11:44:48.000000000 +0200
+++ vdr-1.7.0-pluginparam/channels.h 2008-04-13 18:57:08.000000000 +0300 +++ vdr-1.7.4-pluginparam/channels.h 2009-02-24 13:31:33.000000000 +0200
@@ -118,6 +118,7 @@ @@ -116,6 +116,7 @@
char *shortName; char *shortName;
char *provider; char *provider;
char *portalName; char *portalName;
@@ -133,7 +133,7 @@ diff -Nru vdr-1.7.0-vanilla/channels.h vdr-1.7.0-pluginparam/channels.h
int __BeginData__; int __BeginData__;
int frequency; // MHz int frequency; // MHz
int source; int source;
@@ -174,6 +175,7 @@ @@ -171,6 +172,7 @@
int Frequency(void) const { return frequency; } ///< Returns the actual frequency, as given in 'channels.conf' int Frequency(void) const { return frequency; } ///< Returns the actual frequency, as given in 'channels.conf'
int Transponder(void) const; ///< Returns the transponder frequency in MHz, plus the polarization in case of sat int Transponder(void) const; ///< Returns the transponder frequency in MHz, plus the polarization in case of sat
static int Transponder(int Frequency, char Polarization); ///< builds the transponder from the given Frequency and Polarization static int Transponder(int Frequency, char Polarization); ///< builds the transponder from the given Frequency and Polarization
@@ -141,7 +141,7 @@ diff -Nru vdr-1.7.0-vanilla/channels.h vdr-1.7.0-pluginparam/channels.h
int Source(void) const { return source; } int Source(void) const { return source; }
int Srate(void) const { return srate; } int Srate(void) const { return srate; }
int Vpid(void) const { return vpid; } int Vpid(void) const { return vpid; }
@@ -212,6 +214,7 @@ @@ -208,6 +210,7 @@
int RollOff(void) const { return rollOff; } int RollOff(void) const { return rollOff; }
const cLinkChannels* LinkChannels(void) const { return linkChannels; } const cLinkChannels* LinkChannels(void) const { return linkChannels; }
const cChannel *RefChannel(void) const { return refChannel; } const cChannel *RefChannel(void) const { return refChannel; }
@@ -149,37 +149,37 @@ diff -Nru vdr-1.7.0-vanilla/channels.h vdr-1.7.0-pluginparam/channels.h
bool IsCable(void) const { return cSource::IsCable(source); } bool IsCable(void) const { return cSource::IsCable(source); }
bool IsSat(void) const { return cSource::IsSat(source); } bool IsSat(void) const { return cSource::IsSat(source); }
bool IsTerr(void) const { return cSource::IsTerr(source); } bool IsTerr(void) const { return cSource::IsTerr(source); }
@@ -219,12 +222,14 @@ @@ -215,12 +218,14 @@
bool HasTimer(void) const; bool HasTimer(void) const;
int Modification(int Mask = CHANNELMOD_ALL); int Modification(int Mask = CHANNELMOD_ALL);
void CopyTransponderData(const cChannel *Channel); void CopyTransponderData(const cChannel *Channel);
+ bool SetPlugTransponderData(int Source, int Frequency, const char *PluginParam); + bool SetPlugTransponderData(int Source, int Frequency, const char *PluginParam);
bool SetSatTransponderData(int Source, int Frequency, char Polarization, int Srate, int CoderateH, int Modulation, int System, int RollOff); bool SetSatTransponderData(int Source, int Frequency, char Polarization, int Srate, int CoderateH, int Modulation, int System, int RollOff);
bool SetCableTransponderData(int Source, int Frequency, int Modulation, int Srate, int CoderateH); bool SetCableTransponderData(int Source, int Frequency, int Modulation, int Srate, int CoderateH);
bool SetTerrTransponderData(int Source, int Frequency, int Bandwidth, int Modulation, int Hierarchy, int CodeRateH, int CodeRateL, int Guard, int Transmission, int Alpha, int Priority); bool SetTerrTransponderData(int Source, int Frequency, int Bandwidth, int Modulation, int Hierarchy, int CodeRateH, int CodeRateL, int Guard, int Transmission);
void SetId(int Nid, int Tid, int Sid, int Rid = 0); void SetId(int Nid, int Tid, int Sid, int Rid = 0);
void SetName(const char *Name, const char *ShortName, const char *Provider); void SetName(const char *Name, const char *ShortName, const char *Provider);
void SetPortalName(const char *PortalName); void SetPortalName(const char *PortalName);
+ void SetPluginParam(const char *PluginParam); + void SetPluginParam(const char *PluginParam);
void SetPids(int Vpid, int Ppid, int *Apids, char ALangs[][MAXLANGCODE2], int *Dpids, char DLangs[][MAXLANGCODE2], int *Spids, char SLangs[][MAXLANGCODE2], int Tpid); void SetPids(int Vpid, int Ppid, int Vtype, int *Apids, char ALangs[][MAXLANGCODE2], int *Dpids, char DLangs[][MAXLANGCODE2], int *Spids, char SLangs[][MAXLANGCODE2], int Tpid);
void SetCaIds(const int *CaIds); // list must be zero-terminated void SetCaIds(const int *CaIds); // list must be zero-terminated
void SetCaDescriptors(int Level); void SetCaDescriptors(int Level);
diff -Nru vdr-1.7.0-vanilla/config.h vdr-1.7.0-pluginparam/config.h diff -Nru vdr-1.7.4-vanilla/config.h vdr-1.7.4-pluginparam/config.h
--- vdr-1.7.0-vanilla/config.h 2008-04-12 16:02:10.000000000 +0300 --- vdr-1.7.4-vanilla/config.h 2009-01-26 11:44:48.000000000 +0200
+++ vdr-1.7.0-pluginparam/config.h 2008-04-13 18:54:25.000000000 +0300 +++ vdr-1.7.4-pluginparam/config.h 2009-02-24 13:31:33.000000000 +0200
@@ -30,6 +30,8 @@ @@ -30,6 +30,8 @@
#define APIVERSION "1.7.0" #define APIVERSION "1.7.4"
#define APIVERSNUM 10700 // Version * 10000 + Major * 100 + Minor #define APIVERSNUM 10704 // Version * 10000 + Major * 100 + Minor
+#define PLUGINPARAMPATCHVERSNUM 1 +#define PLUGINPARAMPATCHVERSNUM 1
+ +
// When loading plugins, VDR searches them by their APIVERSION, which // When loading plugins, VDR searches them by their APIVERSION, which
// may be smaller than VDRVERSION in case there have been no changes to // may be smaller than VDRVERSION in case there have been no changes to
// VDR header files since the last APIVERSION. This allows compiled // VDR header files since the last APIVERSION. This allows compiled
diff -Nru vdr-1.7.0-vanilla/menu.c vdr-1.7.0-pluginparam/menu.c diff -Nru vdr-1.7.4-vanilla/menu.c vdr-1.7.4-pluginparam/menu.c
--- vdr-1.7.0-vanilla/menu.c 2008-04-12 14:37:17.000000000 +0300 --- vdr-1.7.4-vanilla/menu.c 2009-01-26 11:44:48.000000000 +0200
+++ vdr-1.7.0-pluginparam/menu.c 2008-04-13 18:56:07.000000000 +0300 +++ vdr-1.7.4-pluginparam/menu.c 2009-02-24 13:31:33.000000000 +0200
@@ -189,6 +189,7 @@ @@ -190,6 +190,7 @@
cChannel *channel; cChannel *channel;
cChannel data; cChannel data;
char name[256]; char name[256];
@@ -187,7 +187,7 @@ diff -Nru vdr-1.7.0-vanilla/menu.c vdr-1.7.0-pluginparam/menu.c
void Setup(void); void Setup(void);
public: public:
cMenuEditChannel(cChannel *Channel, bool New = false); cMenuEditChannel(cChannel *Channel, bool New = false);
@@ -221,6 +222,7 @@ @@ -222,6 +223,7 @@
// Parameters for all types of sources: // Parameters for all types of sources:
strn0cpy(name, data.name, sizeof(name)); strn0cpy(name, data.name, sizeof(name));
@@ -195,15 +195,15 @@ diff -Nru vdr-1.7.0-vanilla/menu.c vdr-1.7.0-pluginparam/menu.c
Add(new cMenuEditStrItem( tr("Name"), name, sizeof(name))); Add(new cMenuEditStrItem( tr("Name"), name, sizeof(name)));
Add(new cMenuEditSrcItem( tr("Source"), &data.source)); Add(new cMenuEditSrcItem( tr("Source"), &data.source));
Add(new cMenuEditIntItem( tr("Frequency"), &data.frequency)); Add(new cMenuEditIntItem( tr("Frequency"), &data.frequency));
@@ -255,6 +257,7 @@ @@ -254,6 +256,7 @@
ST(" T") Add(new cMenuEditMapItem( tr("Alpha"), &data.alpha, AlphaValues)); ST(" T") Add(new cMenuEditMapItem( tr("Guard"), &data.guard, GuardValues));
ST(" T") Add(new cMenuEditMapItem( tr("Priority"), &data.priority, PriorityValues)); ST(" T") Add(new cMenuEditMapItem( tr("Hierarchy"), &data.hierarchy, HierarchyValues));
ST(" S ") Add(new cMenuEditMapItem( tr("Rolloff"), &data.rollOff, RollOffValues)); ST(" S ") Add(new cMenuEditMapItem( tr("Rolloff"), &data.rollOff, RollOffValues));
+ ST("P ") Add(new cMenuEditStrItem( tr("Parameters"), pluginParam, sizeof(pluginParam), tr(FileNameChars))); + ST("P ") Add(new cMenuEditStrItem( tr("Parameters"), pluginParam, sizeof(pluginParam), tr(FileNameChars)));
SetCurrent(Get(current)); SetCurrent(Get(current));
Display(); Display();
@@ -269,6 +272,7 @@ @@ -268,6 +271,7 @@
if (Key == kOk) { if (Key == kOk) {
if (Channels.HasUniqueChannelID(&data, channel)) { if (Channels.HasUniqueChannelID(&data, channel)) {
data.name = strcpyrealloc(data.name, name); data.name = strcpyrealloc(data.name, name);
@@ -211,29 +211,29 @@ diff -Nru vdr-1.7.0-vanilla/menu.c vdr-1.7.0-pluginparam/menu.c
if (channel) { if (channel) {
*channel = data; *channel = data;
isyslog("edited channel %d %s", channel->Number(), *data.ToText()); isyslog("edited channel %d %s", channel->Number(), *data.ToText());
diff -Nru vdr-1.7.0-vanilla/po/fi_FI.po vdr-1.7.0-pluginparam/po/fi_FI.po diff -Nru vdr-1.7.4-vanilla/po/fi_FI.po vdr-1.7.4-pluginparam/po/fi_FI.po
--- vdr-1.7.0-vanilla/po/fi_FI.po 2008-04-13 17:16:58.000000000 +0300 --- vdr-1.7.4-vanilla/po/fi_FI.po 2009-01-26 11:44:48.000000000 +0200
+++ vdr-1.7.0-pluginparam/po/fi_FI.po 2008-04-13 18:54:25.000000000 +0300 +++ vdr-1.7.4-pluginparam/po/fi_FI.po 2009-02-24 13:31:33.000000000 +0200
@@ -1019,3 +1019,6 @@ @@ -1010,3 +1010,6 @@
#, c-format #, c-format
msgid "VDR will shut down in %s minutes" msgid "VDR will shut down in %s minutes"
msgstr "VDR sammuu %s minuutin kuluttua" msgstr "VDR sammuu %s minuutin kuluttua"
+ +
+msgid "Parameters" +msgid "Parameters"
+msgstr "Parametrit" +msgstr "Parametrit"
diff -Nru vdr-1.7.0-vanilla/po/fr_FR.po vdr-1.7.0-pluginparam/po/fr_FR.po diff -Nru vdr-1.7.4-vanilla/po/fr_FR.po vdr-1.7.4-pluginparam/po/fr_FR.po
--- vdr-1.7.0-vanilla/po/fr_FR.po 2008-04-13 17:16:58.000000000 +0300 --- vdr-1.7.4-vanilla/po/fr_FR.po 2009-01-26 11:44:48.000000000 +0200
+++ vdr-1.7.0-pluginparam/po/fr_FR.po 2008-04-13 18:54:25.000000000 +0300 +++ vdr-1.7.4-pluginparam/po/fr_FR.po 2009-02-24 13:31:33.000000000 +0200
@@ -1022,3 +1022,6 @@ @@ -1013,3 +1013,6 @@
#, c-format #, c-format
msgid "VDR will shut down in %s minutes" msgid "VDR will shut down in %s minutes"
msgstr "VDR s'arrêtera dans %s minutes" msgstr "VDR s'arrêtera dans %s minutes"
+ +
+msgid "Parameters" +msgid "Parameters"
+msgstr "Paramètres" +msgstr "Paramètres"
diff -Nru vdr-1.7.0-vanilla/sources.c vdr-1.7.0-pluginparam/sources.c diff -Nru vdr-1.7.4-vanilla/sources.c vdr-1.7.4-pluginparam/sources.c
--- vdr-1.7.0-vanilla/sources.c 2008-02-10 16:07:26.000000000 +0200 --- vdr-1.7.4-vanilla/sources.c 2009-01-26 11:44:48.000000000 +0200
+++ vdr-1.7.0-pluginparam/sources.c 2008-04-13 18:54:25.000000000 +0300 +++ vdr-1.7.4-pluginparam/sources.c 2009-02-24 13:31:33.000000000 +0200
@@ -37,6 +37,7 @@ @@ -37,6 +37,7 @@
char buffer[16]; char buffer[16];
char *q = buffer; char *q = buffer;
@@ -250,10 +250,10 @@ diff -Nru vdr-1.7.0-vanilla/sources.c vdr-1.7.0-pluginparam/sources.c
case 'C': type = stCable; break; case 'C': type = stCable; break;
case 'S': type = stSat; break; case 'S': type = stSat; break;
case 'T': type = stTerr; break; case 'T': type = stTerr; break;
diff -Nru vdr-1.7.0-vanilla/sources.conf vdr-1.7.0-pluginparam/sources.conf diff -Nru vdr-1.7.4-vanilla/sources.conf vdr-1.7.4-pluginparam/sources.conf
--- vdr-1.7.0-vanilla/sources.conf 2007-02-17 18:15:13.000000000 +0200 --- vdr-1.7.4-vanilla/sources.conf 2009-01-26 11:44:48.000000000 +0200
+++ vdr-1.7.0-pluginparam/sources.conf 2008-04-13 18:54:25.000000000 +0300 +++ vdr-1.7.4-pluginparam/sources.conf 2009-02-24 13:31:33.000000000 +0200
@@ -188,3 +188,7 @@ @@ -194,3 +194,7 @@
# Terrestrial # Terrestrial
T Terrestrial T Terrestrial
@@ -261,9 +261,9 @@ diff -Nru vdr-1.7.0-vanilla/sources.conf vdr-1.7.0-pluginparam/sources.conf
+# Plugin +# Plugin
+ +
+P Plugin +P Plugin
diff -Nru vdr-1.7.0-vanilla/sources.h vdr-1.7.0-pluginparam/sources.h diff -Nru vdr-1.7.4-vanilla/sources.h vdr-1.7.4-pluginparam/sources.h
--- vdr-1.7.0-vanilla/sources.h 2005-05-14 12:30:41.000000000 +0300 --- vdr-1.7.4-vanilla/sources.h 2009-01-26 11:44:48.000000000 +0200
+++ vdr-1.7.0-pluginparam/sources.h 2008-04-13 18:54:25.000000000 +0300 +++ vdr-1.7.4-pluginparam/sources.h 2009-02-24 13:31:33.000000000 +0200
@@ -16,10 +16,11 @@ @@ -16,10 +16,11 @@
public: public:
enum eSourceType { enum eSourceType {

View File

@@ -3,16 +3,15 @@
* *
* See the README file for copyright information and how to reach the author. * See the README file for copyright information and how to reach the author.
* *
* $Id: pidscanner.c,v 1.7 2008/04/02 22:55:04 rahrenbe Exp $
*/ */
#include "common.h" #include "common.h"
#include "pidscanner.h" #include "pidscanner.h"
#define PIDSCANNER_TIMEOUT_IN_MS 15000 /* 15s timeout for detection */ #define PIDSCANNER_TIMEOUT_IN_MS 15000 /* 15s timeout for detection */
#define PIDSCANNER_APID_COUNT 10 /* minimum count of audio pid samples for pid detection */ #define PIDSCANNER_APID_COUNT 5 /* minimum count of audio pid samples for pid detection */
#define PIDSCANNER_VPID_COUNT 10 /* minimum count of video pid samples for pid detection */ #define PIDSCANNER_VPID_COUNT 5 /* minimum count of video pid samples for pid detection */
#define PIDSCANNER_PID_DELTA_COUNT 50 /* minimum count of pid samples for audio/video only pid detection */ #define PIDSCANNER_PID_DELTA_COUNT 100 /* minimum count of pid samples for audio/video only pid detection */
cPidScanner::cPidScanner(void) cPidScanner::cPidScanner(void)
: timeout(0), : timeout(0),
@@ -121,32 +120,39 @@ void cPidScanner::Process(const uint8_t* buf)
return; return;
} }
cChannel *IptvChannel = Channels.GetByChannelID(channel.GetChannelID()); cChannel *IptvChannel = Channels.GetByChannelID(channel.GetChannelID());
int Apids[MAXAPIDS + 1] = { 0 }; // these lists are zero-terminated if (IptvChannel) {
int Dpids[MAXDPIDS + 1] = { 0 }; int Apids[MAXAPIDS + 1] = { 0 }; // these lists are zero-terminated
int Spids[MAXSPIDS + 1] = { 0 }; int Dpids[MAXDPIDS + 1] = { 0 };
char ALangs[MAXAPIDS][MAXLANGCODE2] = { "" }; int Spids[MAXSPIDS + 1] = { 0 };
char DLangs[MAXDPIDS][MAXLANGCODE2] = { "" }; char ALangs[MAXAPIDS][MAXLANGCODE2] = { "" };
char SLangs[MAXSPIDS][MAXLANGCODE2] = { "" }; char DLangs[MAXDPIDS][MAXLANGCODE2] = { "" };
int Ppid = IptvChannel->Ppid(); char SLangs[MAXSPIDS][MAXLANGCODE2] = { "" };
int Tpid = IptvChannel->Tpid(); int Ppid = IptvChannel->Ppid();
bool foundApid = false; int Tpid = IptvChannel->Tpid();
if (numVpids < PIDSCANNER_VPID_COUNT) bool foundApid = false;
Vpid = 0; // No detected video pid if (numVpids < PIDSCANNER_VPID_COUNT)
else if (numApids < PIDSCANNER_APID_COUNT) Vpid = 0; // No detected video pid
Apid = 0; // No detected audio pid else if (numApids < PIDSCANNER_APID_COUNT)
for (unsigned int i = 1; i < MAXAPIDS; ++i) { Apid = 0; // No detected audio pid
Apids[i] = IptvChannel->Apid(i); for (unsigned int i = 1; i < MAXAPIDS; ++i) {
if (Apids[i] && (Apids[i] == Apid)) Apids[i] = IptvChannel->Apid(i);
foundApid = true; if (Apids[i] && (Apids[i] == Apid))
} foundApid = true;
if (!foundApid) }
Apids[0] = Apid; if (!foundApid)
for (unsigned int i = 0; i < MAXDPIDS; ++i) Apids[0] = Apid;
Dpids[i] = IptvChannel->Dpid(i); for (unsigned int i = 0; i < MAXDPIDS; ++i)
for (unsigned int i = 0; i < MAXSPIDS; ++i) Dpids[i] = IptvChannel->Dpid(i);
Spids[i] = IptvChannel->Spid(i); for (unsigned int i = 0; i < MAXSPIDS; ++i)
debug("cPidScanner::Process(): Vpid=0x%04X, Apid=0x%04X\n", Vpid, Apid); Spids[i] = IptvChannel->Spid(i);
IptvChannel->SetPids(Vpid, Ppid, Apids, ALangs, Dpids, DLangs, Spids, SLangs, Tpid); debug("cPidScanner::Process(): Vpid=0x%04X, Apid=0x%04X\n", Vpid, Apid);
#if defined(APIVERSNUM) && APIVERSNUM >= 10704
int Vtype = IptvChannel->Vtype();
IptvChannel->SetPids(Vpid, Ppid, Vtype, Apids, ALangs, Dpids, DLangs, Spids, SLangs, Tpid);
#else
IptvChannel->SetPids(Vpid, Ppid, Apids, ALangs, Dpids, DLangs, Spids, SLangs, Tpid);
#endif
}
Channels.Unlock(); Channels.Unlock();
process = false; process = false;
} }

View File

@@ -3,7 +3,6 @@
* *
* See the README file for copyright information and how to reach the author. * See the README file for copyright information and how to reach the author.
* *
* $Id: pidscanner.h,v 1.3 2008/02/02 20:51:47 rahrenbe Exp $
*/ */
#ifndef __PIDSCANNER_H #ifndef __PIDSCANNER_H

View File

@@ -5,9 +5,9 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: iptv 0.2.0\n" "Project-Id-Version: iptv 0.2.5\n"
"Report-Msgid-Bugs-To: Rolf Ahrenberg\n" "Report-Msgid-Bugs-To: Rolf Ahrenberg\n"
"POT-Creation-Date: 2008-02-01 23:43+0200\n" "POT-Creation-Date: 2009-03-06 22:15+0200\n"
"PO-Revision-Date: 2007-10-29 21:19+0100\n" "PO-Revision-Date: 2007-10-29 21:19+0100\n"
"Last-Translator: Tobias Grimm <tg@e-tobi.net>\n" "Last-Translator: Tobias Grimm <tg@e-tobi.net>\n"
"Language-Team: German\n" "Language-Team: German\n"
@@ -76,6 +76,9 @@ msgstr "Scanne SID"
msgid "Scan pids" msgid "Scan pids"
msgstr "Scanne PIDS" msgstr "Scanne PIDS"
msgid "Vtype"
msgstr "Vtype"
msgid "Nid" msgid "Nid"
msgstr "Nid" msgstr "Nid"

View File

@@ -5,14 +5,14 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: iptv 0.2.0\n" "Project-Id-Version: iptv 0.2.5\n"
"Report-Msgid-Bugs-To: Rolf Ahrenberg\n" "Report-Msgid-Bugs-To: Rolf Ahrenberg\n"
"POT-Creation-Date: 2008-02-01 23:43+0200\n" "POT-Creation-Date: 2009-03-06 22:15+0200\n"
"PO-Revision-Date: 2007-08-12 23:22+0300\n" "PO-Revision-Date: 2007-08-12 23:22+0300\n"
"Last-Translator: Rolf Ahrenberg\n" "Last-Translator: Rolf Ahrenberg\n"
"Language-Team: <vdr@linuxtv.org>\n" "Language-Team: <vdr@linuxtv.org>\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO-8859-15\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
msgid "PAT (0x00)" msgid "PAT (0x00)"
@@ -75,17 +75,20 @@ msgstr "Etsi palvelu-ID"
msgid "Scan pids" msgid "Scan pids"
msgstr "Etsi pidit" msgstr "Etsi pidit"
msgid "Vtype"
msgstr "Kuvatyyppi"
msgid "Nid" msgid "Nid"
msgstr "Verkko-ID" msgstr "Verkko-ID"
msgid "Tid" msgid "Tid"
msgstr "L<EFBFBD>hete-ID" msgstr "Lähete-ID"
msgid "Rid" msgid "Rid"
msgstr "Radio-ID" msgstr "Radio-ID"
msgid "Cannot find unique channel settings!" msgid "Cannot find unique channel settings!"
msgstr "Yksil<EFBFBD>llisi<EFBFBD> kanava-asetuksia ei l<EFBFBD>ydet<EFBFBD>!" msgstr "Yksilöllisiä kanava-asetuksia ei löydetä!"
msgid "IPTV Channels" msgid "IPTV Channels"
msgstr "IPTV-kanavat" msgstr "IPTV-kanavat"
@@ -116,21 +119,21 @@ msgid ""
"\n" "\n"
"Smaller sizes help memory consumption, but are more prone to buffer overflows." "Smaller sizes help memory consumption, but are more prone to buffer overflows."
msgstr "" msgstr ""
"M<EFBFBD><EFBFBD>rit<EFBFBD> rengaspuskurin koko TS-l<EFBFBD>hetteelle megatavuina.\n" "Määritä rengaspuskurin koko TS-lähetteelle megatavuina.\n"
"\n" "\n"
"Pienempi rengaspuskuri v<EFBFBD>hent<EFBFBD><EFBFBD> muistinkulutusta, mutta on virhealttiimpi puskurin ylivuodolle." "Pienempi rengaspuskuri vähentää muistinkulutusta, mutta on virhealttiimpi puskurin ylivuodolle."
msgid "TS buffer prefill ratio [%]" msgid "TS buffer prefill ratio [%]"
msgstr "TS-puskurin esit<EFBFBD>ytt<EFBFBD>aste [%]" msgstr "TS-puskurin esitäyttöaste [%]"
msgid "" msgid ""
"Define a prefill ratio of the ringbuffer for transport streams before data is transferred to VDR.\n" "Define a prefill ratio of the ringbuffer for transport streams before data is transferred to VDR.\n"
"\n" "\n"
"This is useful if streaming media over a slow or unreliable connection." "This is useful if streaming media over a slow or unreliable connection."
msgstr "" msgstr ""
"M<EFBFBD><EFBFBD>rittele TS-rengaspuskurin esit<EFBFBD>ytt<EFBFBD>aste, jonka j<EFBFBD>lkeen l<EFBFBD>hetett<EFBFBD> aletaan siirt<EFBFBD>m<EFBFBD><EFBFBD>n eteenp<EFBFBD>in VDR:lle.\n" "Määrittele TS-rengaspuskurin esitäyttöaste, jonka jälkeen lähetettä aletaan siirtämään eteenpäin VDR:lle.\n"
"\n" "\n"
"Puskurin esit<EFBFBD>ytt<EFBFBD> parantaa suoratoistoa hitailla ja ep<EFBFBD>luotettavilla yhteyksill<EFBFBD>." "Puskurin esitäyttö parantaa suoratoistoa hitailla ja epäluotettavilla yhteyksillä."
msgid "EXT protocol base port" msgid "EXT protocol base port"
msgstr "EXT-protokollan perusportti" msgstr "EXT-protokollan perusportti"
@@ -140,12 +143,12 @@ msgid ""
"\n" "\n"
"The port range is defined by the number of IPTV devices. This setting sets the port which is listened for connections from external applications when using the EXT protocol." "The port range is defined by the number of IPTV devices. This setting sets the port which is listened for connections from external applications when using the EXT protocol."
msgstr "" msgstr ""
"M<EFBFBD><EFBFBD>rittele EXT-protokollan k<EFBFBD>ytt<EFBFBD>m<EFBFBD> perusportti.\n" "Määrittele EXT-protokollan käyttämä perusportti.\n"
"\n" "\n"
"Porttiavaruuden koko m<EFBFBD><EFBFBD>r<EFBFBD>ytyy k<EFBFBD>ytettyjen IPTV-laitteiden mukaan. Laajennos lukee EXT-protokollan yhteydess<EFBFBD> perusportista dataa, jota ulkoiset ohjelmistot tarjoavat." "Porttiavaruuden koko määräytyy käytettyjen IPTV-laitteiden mukaan. Laajennos lukee EXT-protokollan yhteydessä perusportista dataa, jota ulkoiset ohjelmistot tarjoavat."
msgid "Use section filtering" msgid "Use section filtering"
msgstr "K<EFBFBD>yt<EFBFBD> sektioiden suodatusta" msgstr "Käytä sektioiden suodatusta"
msgid "" msgid ""
"Define whether the section filtering shall be used.\n" "Define whether the section filtering shall be used.\n"
@@ -153,29 +156,29 @@ msgid ""
"Section filtering means that IPTV plugin tries to parse and provide VDR with secondary data about the currently active stream. VDR can then use this data for providing various functionalities such as automatic pid change detection and EPG etc.\n" "Section filtering means that IPTV plugin tries to parse and provide VDR with secondary data about the currently active stream. VDR can then use this data for providing various functionalities such as automatic pid change detection and EPG etc.\n"
"Enabling this feature does not affect streams that do not contain section data." "Enabling this feature does not affect streams that do not contain section data."
msgstr "" msgstr ""
"M<EFBFBD><EFBFBD>rittele suodatuksen k<EFBFBD>ytt<EFBFBD> sektioille.\n" "Määrittele suodatuksen käyttö sektioille.\n"
"\n" "\n"
"IPTV-laajennos voi suodattaa l<EFBFBD>hetteest<EFBFBD> VDR:lle tarjottavia sektioita, joita k<EFBFBD>ytet<EFBFBD><EFBFBD>n esim. ohjelmaoppaan ja ohjelmatunnisteiden (PID) p<EFBFBD>ivitt<EFBFBD>miseen.\n" "IPTV-laajennos voi suodattaa lähetteestä VDR:lle tarjottavia sektioita, joita käytetään esim. ohjelmaoppaan ja ohjelmatunnisteiden (PID) päivittämiseen.\n"
"Toiminto ei vaikuta l<EFBFBD>hetteeseen, jossa ei ole sektioita." "Toiminto ei vaikuta lähetteeseen, jossa ei ole sektioita."
msgid "Disable filters" msgid "Disable filters"
msgstr "Poista suodattimia k<EFBFBD>yt<EFBFBD>st<EFBFBD>" msgstr "Poista suodattimia käytöstä"
msgid "" msgid ""
"Define number of section filters to be disabled.\n" "Define number of section filters to be disabled.\n"
"\n" "\n"
"Certain section filters might cause some unwanted behaviour to VDR such as time being falsely synchronized. By black-listing the filters here useful section data can be left intact for VDR to process." "Certain section filters might cause some unwanted behaviour to VDR such as time being falsely synchronized. By black-listing the filters here useful section data can be left intact for VDR to process."
msgstr "" msgstr ""
"M<EFBFBD><EFBFBD>rittele k<EFBFBD>yt<EFBFBD>st<EFBFBD> poistettavien suodattimien lukum<EFBFBD><EFBFBD>r<EFBFBD> sektioille.\n" "Määrittele käytöstä poistettavien suodattimien lukumäärä sektioille.\n"
"\n" "\n"
"Tietyt sektiot saattavat aiheuttaa virheellist<EFBFBD> toimintaa VDR:ss<EFBFBD>, esimerkiksi asettavat v<EFBFBD><EFBFBD>r<EFBFBD>n kellonajan, ja n<EFBFBD>iden poistaminen auttaa VDR:<EFBFBD><EFBFBD> toimimaan kunnolla j<EFBFBD>ljelle j<EFBFBD><EFBFBD>vien sektioiden kanssa." "Tietyt sektiot saattavat aiheuttaa virheellistä toimintaa VDR:ssä, esimerkiksi asettavat väärän kellonajan, ja näiden poistaminen auttaa VDR:ää toimimaan kunnolla jäljelle jäävien sektioiden kanssa."
#. TRANSLATORS: note the singular! #. TRANSLATORS: note the singular!
msgid "Disable filter" msgid "Disable filter"
msgstr "Poista suodatin k<EFBFBD>yt<EFBFBD>st<EFBFBD>" msgstr "Poista suodatin käytöstä"
msgid "Define an ill-behaving filter to be blacklisted." msgid "Define an ill-behaving filter to be blacklisted."
msgstr "M<EFBFBD><EFBFBD>rittele k<EFBFBD>yt<EFBFBD>st<EFBFBD> poistettava suodatin, joka lis<EFBFBD>t<EFBFBD><EFBFBD>n mustalle listalle." msgstr "Määrittele käytöstä poistettava suodatin, joka lisätään mustalle listalle."
msgid "Help" msgid "Help"
msgstr "Opaste" msgstr "Opaste"

View File

@@ -6,9 +6,9 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: iptv 0.2.0\n" "Project-Id-Version: iptv 0.2.5\n"
"Report-Msgid-Bugs-To: Rolf Ahrenberg\n" "Report-Msgid-Bugs-To: Rolf Ahrenberg\n"
"POT-Creation-Date: 2008-02-01 23:43+0200\n" "POT-Creation-Date: 2009-03-06 22:15+0200\n"
"PO-Revision-Date: 2008-01-26 13:14+0100\n" "PO-Revision-Date: 2008-01-26 13:14+0100\n"
"Last-Translator: NIVAL Michaël <mnival@club-internet.fr>\n" "Last-Translator: NIVAL Michaël <mnival@club-internet.fr>\n"
"Language-Team: French\n" "Language-Team: French\n"
@@ -77,6 +77,9 @@ msgstr "Scanne les SID"
msgid "Scan pids" msgid "Scan pids"
msgstr "Scanne les PID" msgstr "Scanne les PID"
msgid "Vtype"
msgstr "Vtype"
msgid "Nid" msgid "Nid"
msgstr "Nid" msgstr "Nid"

View File

@@ -5,10 +5,10 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: iptv 0.2.0\n" "Project-Id-Version: iptv 0.2.5\n"
"Report-Msgid-Bugs-To: Rolf Ahrenberg\n" "Report-Msgid-Bugs-To: Rolf Ahrenberg\n"
"POT-Creation-Date: 2008-02-01 23:43+0200\n" "POT-Creation-Date: 2009-03-06 22:15+0200\n"
"PO-Revision-Date: 2008-03-30 05:26+0100\n" "PO-Revision-Date: 2008-07-13 03:28+0100\n"
"Last-Translator: Diego Pierotto <vdr-italian@tiscali.it>\n" "Last-Translator: Diego Pierotto <vdr-italian@tiscali.it>\n"
"Language-Team: Italian\n" "Language-Team: Italian\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@@ -76,6 +76,9 @@ msgstr "Scansione Sid"
msgid "Scan pids" msgid "Scan pids"
msgstr "Scansione Pids" msgstr "Scansione Pids"
msgid "Vtype"
msgstr "Vtype"
msgid "Nid" msgid "Nid"
msgstr "Nid" msgstr "Nid"
@@ -122,7 +125,7 @@ msgstr ""
"Dimensioni più piccole aiutano il consumo di memoria, ma sono più inclini a generare buffer overflows." "Dimensioni più piccole aiutano il consumo di memoria, ma sono più inclini a generare buffer overflows."
msgid "TS buffer prefill ratio [%]" msgid "TS buffer prefill ratio [%]"
msgstr "Percentuale riempimento buffer TS [%]" msgstr "Riempimento buffer TS [%]"
msgid "" msgid ""
"Define a prefill ratio of the ringbuffer for transport streams before data is transferred to VDR.\n" "Define a prefill ratio of the ringbuffer for transport streams before data is transferred to VDR.\n"
@@ -180,4 +183,3 @@ msgstr "Definisci un filtro corrotto che sarà messo nella lista nera."
msgid "Help" msgid "Help"
msgstr "Aiuto" msgstr "Aiuto"

View File

@@ -5,9 +5,9 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: iptv 0.2.0\n" "Project-Id-Version: iptv 0.2.5\n"
"Report-Msgid-Bugs-To: Rolf Ahrenberg\n" "Report-Msgid-Bugs-To: Rolf Ahrenberg\n"
"POT-Creation-Date: 2008-02-01 23:43+0200\n" "POT-Creation-Date: 2009-03-06 22:15+0200\n"
"PO-Revision-Date: 2008-03-16 12:14+0100\n" "PO-Revision-Date: 2008-03-16 12:14+0100\n"
"Last-Translator: Alexander Gross <Bikalexander@gmail.com>\n" "Last-Translator: Alexander Gross <Bikalexander@gmail.com>\n"
"Language-Team: Russian <de@li.org>\n" "Language-Team: Russian <de@li.org>\n"
@@ -77,6 +77,9 @@ msgstr "Сканировать SID"
msgid "Scan pids" msgid "Scan pids"
msgstr "Сканировать пиды" msgstr "Сканировать пиды"
msgid "Vtype"
msgstr "Vtype"
msgid "Nid" msgid "Nid"
msgstr "Nid" msgstr "Nid"
@@ -165,4 +168,3 @@ msgstr "Неправильно работающий фильтр, занести
msgid "Help" msgid "Help"
msgstr "Справка" msgstr "Справка"

View File

@@ -3,7 +3,6 @@
* *
* See the README file for copyright information and how to reach the author. * See the README file for copyright information and how to reach the author.
* *
* $Id: protocolext.c,v 1.24 2008/02/17 19:18:47 rahrenbe Exp $
*/ */
#include <sys/wait.h> #include <sys/wait.h>
@@ -128,9 +127,9 @@ bool cIptvProtocolExt::Close(void)
return true; return true;
} }
int cIptvProtocolExt::Read(unsigned char* *BufferAddr) int cIptvProtocolExt::Read(unsigned char* BufferAddr, unsigned int BufferLen)
{ {
return cIptvUdpSocket::Read(BufferAddr); return cIptvUdpSocket::Read(BufferAddr, BufferLen);
} }
bool cIptvProtocolExt::Set(const char* Location, const int Parameter, const int Index) bool cIptvProtocolExt::Set(const char* Location, const int Parameter, const int Index)

View File

@@ -3,7 +3,6 @@
* *
* See the README file for copyright information and how to reach the author. * See the README file for copyright information and how to reach the author.
* *
* $Id: protocolext.h,v 1.10 2008/02/17 19:18:47 rahrenbe Exp $
*/ */
#ifndef __IPTV_PROTOCOLEXT_H #ifndef __IPTV_PROTOCOLEXT_H
@@ -26,7 +25,7 @@ private:
public: public:
cIptvProtocolExt(); cIptvProtocolExt();
virtual ~cIptvProtocolExt(); virtual ~cIptvProtocolExt();
int Read(unsigned char* *BufferAddr); int Read(unsigned char* BufferAddr, unsigned int BufferLen);
bool Set(const char* Location, const int Parameter, const int Index); bool Set(const char* Location, const int Parameter, const int Index);
bool Open(void); bool Open(void);
bool Close(void); bool Close(void);

View File

@@ -3,7 +3,6 @@
* *
* See the README file for copyright information and how to reach the author. * See the README file for copyright information and how to reach the author.
* *
* $Id: protocolfile.c,v 1.15 2008/01/04 23:36:37 ajhseppa Exp $
*/ */
#include <fcntl.h> #include <fcntl.h>
@@ -17,15 +16,10 @@
cIptvProtocolFile::cIptvProtocolFile() cIptvProtocolFile::cIptvProtocolFile()
: fileDelay(0), : fileDelay(0),
readBufferLen(TS_SIZE * IptvConfig.GetReadBufferTsCount()),
isActive(false) isActive(false)
{ {
debug("cIptvProtocolFile::cIptvProtocolFile()\n"); debug("cIptvProtocolFile::cIptvProtocolFile()\n");
fileLocation = strdup(""); fileLocation = strdup("");
// Allocate receive buffer
readBuffer = MALLOC(unsigned char, readBufferLen);
if (!readBuffer)
error("ERROR: MALLOC() failed in ProtocolFile()");
} }
cIptvProtocolFile::~cIptvProtocolFile() cIptvProtocolFile::~cIptvProtocolFile()
@@ -35,7 +29,6 @@ cIptvProtocolFile::~cIptvProtocolFile()
cIptvProtocolFile::Close(); cIptvProtocolFile::Close();
// Free allocated memory // Free allocated memory
free(fileLocation); free(fileLocation);
free(readBuffer);
} }
bool cIptvProtocolFile::OpenFile(void) bool cIptvProtocolFile::OpenFile(void)
@@ -62,10 +55,9 @@ void cIptvProtocolFile::CloseFile(void)
} }
} }
int cIptvProtocolFile::Read(unsigned char* *BufferAddr) int cIptvProtocolFile::Read(unsigned char* BufferAddr, unsigned int BufferLen)
{ {
//debug("cIptvProtocolFile::Read()\n"); //debug("cIptvProtocolFile::Read()\n");
*BufferAddr = readBuffer;
// Check errors // Check errors
if (ferror(fileStream)) { if (ferror(fileStream)) {
debug("Read error\n"); debug("Read error\n");
@@ -82,7 +74,7 @@ int cIptvProtocolFile::Read(unsigned char* *BufferAddr)
// during the sleep and buffers are disposed. Check here that the plugin is // during the sleep and buffers are disposed. Check here that the plugin is
// still active before accessing the buffers // still active before accessing the buffers
if (isActive) if (isActive)
return fread(readBuffer, sizeof(unsigned char), readBufferLen, fileStream); return fread(BufferAddr, sizeof(unsigned char), BufferLen, fileStream);
return -1; return -1;
} }

View File

@@ -3,7 +3,6 @@
* *
* See the README file for copyright information and how to reach the author. * See the README file for copyright information and how to reach the author.
* *
* $Id: protocolfile.h,v 1.8 2008/01/04 23:36:37 ajhseppa Exp $
*/ */
#ifndef __IPTV_PROTOCOLFILE_H #ifndef __IPTV_PROTOCOLFILE_H
@@ -17,8 +16,6 @@ private:
char* fileLocation; char* fileLocation;
int fileDelay; int fileDelay;
FILE* fileStream; FILE* fileStream;
unsigned char* readBuffer;
unsigned int readBufferLen;
bool isActive; bool isActive;
private: private:
@@ -28,7 +25,7 @@ private:
public: public:
cIptvProtocolFile(); cIptvProtocolFile();
virtual ~cIptvProtocolFile(); virtual ~cIptvProtocolFile();
int Read(unsigned char* *BufferAddr); int Read(unsigned char* BufferAddr, unsigned int BufferLen);
bool Set(const char* Location, const int Parameter, const int Index); bool Set(const char* Location, const int Parameter, const int Index);
bool Open(void); bool Open(void);
bool Close(void); bool Close(void);

View File

@@ -3,7 +3,6 @@
* *
* See the README file for copyright information and how to reach the author. * See the README file for copyright information and how to reach the author.
* *
* $Id: protocolhttp.c,v 1.25 2008/04/02 22:55:04 rahrenbe Exp $
*/ */
#include <sys/types.h> #include <sys/types.h>
@@ -46,7 +45,7 @@ bool cIptvProtocolHttp::Connect(void)
// First try only the IP address // First try only the IP address
sockAddr.sin_addr.s_addr = inet_addr(streamAddr); sockAddr.sin_addr.s_addr = inet_addr(streamAddr);
if (sockAddr.sin_addr.s_addr == INADDR_NONE) { if (sockAddr.sin_addr.s_addr == INADDR_NONE) {
debug("Cannot convert %s directly to internet address\n", streamAddr); debug("Cannot convert %s directly to internet address\n", streamAddr);
@@ -215,9 +214,9 @@ bool cIptvProtocolHttp::Close(void)
return true; return true;
} }
int cIptvProtocolHttp::Read(unsigned char* *BufferAddr) int cIptvProtocolHttp::Read(unsigned char* BufferAddr, unsigned int BufferLen)
{ {
return cIptvTcpSocket::Read(BufferAddr); return cIptvTcpSocket::Read(BufferAddr, BufferLen);
} }
bool cIptvProtocolHttp::Set(const char* Location, const int Parameter, const int Index) bool cIptvProtocolHttp::Set(const char* Location, const int Parameter, const int Index)

View File

@@ -3,7 +3,6 @@
* *
* See the README file for copyright information and how to reach the author. * See the README file for copyright information and how to reach the author.
* *
* $Id: protocolhttp.h,v 1.12 2008/01/04 23:36:37 ajhseppa Exp $
*/ */
#ifndef __IPTV_PROTOCOLHTTP_H #ifndef __IPTV_PROTOCOLHTTP_H
@@ -28,7 +27,7 @@ private:
public: public:
cIptvProtocolHttp(); cIptvProtocolHttp();
virtual ~cIptvProtocolHttp(); virtual ~cIptvProtocolHttp();
int Read(unsigned char* *BufferAddr); int Read(unsigned char* BufferAddr, unsigned int BufferLen);
bool Set(const char* Location, const int Parameter, const int Index); bool Set(const char* Location, const int Parameter, const int Index);
bool Open(void); bool Open(void);
bool Close(void); bool Close(void);

View File

@@ -3,7 +3,6 @@
* *
* See the README file for copyright information and how to reach the author. * See the README file for copyright information and how to reach the author.
* *
* $Id: protocolif.h,v 1.8 2008/01/30 21:57:33 rahrenbe Exp $
*/ */
#ifndef __IPTV_PROTOCOLIF_H #ifndef __IPTV_PROTOCOLIF_H
@@ -13,7 +12,7 @@ class cIptvProtocolIf {
public: public:
cIptvProtocolIf() {} cIptvProtocolIf() {}
virtual ~cIptvProtocolIf() {} virtual ~cIptvProtocolIf() {}
virtual int Read(unsigned char* *BufferAddr) = 0; virtual int Read(unsigned char* BufferAddr, unsigned int BufferLen) = 0;
virtual bool Set(const char* Location, const int Parameter, const int Index) = 0; virtual bool Set(const char* Location, const int Parameter, const int Index) = 0;
virtual bool Open(void) = 0; virtual bool Open(void) = 0;
virtual bool Close(void) = 0; virtual bool Close(void) = 0;

View File

@@ -3,7 +3,6 @@
* *
* See the README file for copyright information and how to reach the author. * See the README file for copyright information and how to reach the author.
* *
* $Id: protocoludp.c,v 1.22 2008/01/04 23:36:37 ajhseppa Exp $
*/ */
#include <sys/types.h> #include <sys/types.h>
@@ -92,9 +91,9 @@ bool cIptvProtocolUdp::Close(void)
return true; return true;
} }
int cIptvProtocolUdp::Read(unsigned char* *BufferAddr) int cIptvProtocolUdp::Read(unsigned char* BufferAddr, unsigned int BufferLen)
{ {
return cIptvUdpSocket::Read(BufferAddr); return cIptvUdpSocket::Read(BufferAddr, BufferLen);
} }
bool cIptvProtocolUdp::Set(const char* Location, const int Parameter, const int Index) bool cIptvProtocolUdp::Set(const char* Location, const int Parameter, const int Index)

View File

@@ -3,7 +3,6 @@
* *
* See the README file for copyright information and how to reach the author. * See the README file for copyright information and how to reach the author.
* *
* $Id: protocoludp.h,v 1.13 2008/01/04 23:36:37 ajhseppa Exp $
*/ */
#ifndef __IPTV_PROTOCOLUDP_H #ifndef __IPTV_PROTOCOLUDP_H
@@ -24,7 +23,7 @@ private:
public: public:
cIptvProtocolUdp(); cIptvProtocolUdp();
virtual ~cIptvProtocolUdp(); virtual ~cIptvProtocolUdp();
int Read(unsigned char* *BufferAddr); int Read(unsigned char* BufferAddr, unsigned int BufferLen);
bool Set(const char* Location, const int Parameter, const int Index); bool Set(const char* Location, const int Parameter, const int Index);
bool Open(void); bool Open(void);
bool Close(void); bool Close(void);

View File

@@ -3,13 +3,12 @@
* *
* See the README file for copyright information and how to reach the author. * See the README file for copyright information and how to reach the author.
* *
* $Id: sectionfilter.c,v 1.19 2008/02/17 19:18:47 rahrenbe Exp $
*/ */
#include "sectionfilter.h" #include "sectionfilter.h"
cIptvSectionFilter::cIptvSectionFilter(int Index, int devInd, cIptvSectionFilter::cIptvSectionFilter(int DeviceIndex, int Index,
u_short Pid, u_char Tid, u_char Mask) u_short Pid, u_char Tid, u_char Mask)
: pusi_seen(0), : pusi_seen(0),
feedcc(0), feedcc(0),
doneq(0), doneq(0),
@@ -18,10 +17,13 @@ cIptvSectionFilter::cIptvSectionFilter(int Index, int devInd,
seclen(0), seclen(0),
tsfeedp(0), tsfeedp(0),
pid(Pid), pid(Pid),
devid(DeviceIndex),
id(Index), id(Index),
pipeName("") pipeName("")
{ {
//debug("cIptvSectionFilter::cIptvSectionFilter(%d)\n", Index); //debug("cIptvSectionFilter::cIptvSectionFilter(%d, %d)\n", devid, id);
int i;
memset(secbuf_base, '\0', sizeof(secbuf_base)); memset(secbuf_base, '\0', sizeof(secbuf_base));
memset(filter_value, '\0', sizeof(filter_value)); memset(filter_value, '\0', sizeof(filter_value));
memset(filter_mask, '\0', sizeof(filter_mask)); memset(filter_mask, '\0', sizeof(filter_mask));
@@ -29,17 +31,15 @@ cIptvSectionFilter::cIptvSectionFilter(int Index, int devInd,
memset(maskandmode, '\0', sizeof(maskandmode)); memset(maskandmode, '\0', sizeof(maskandmode));
memset(maskandnotmode, '\0', sizeof(maskandnotmode)); memset(maskandnotmode, '\0', sizeof(maskandnotmode));
SetPipeName(devInd);
filter_value[0] = Tid; filter_value[0] = Tid;
filter_mask[0] = Mask; filter_mask[0] = Mask;
// Invert the filter // Invert the filter
for (int i = 0; i < DMX_MAX_FILTER_SIZE; ++i) for (i = 0; i < DMX_MAX_FILTER_SIZE; ++i)
filter_value[i] ^= 0xff; filter_value[i] ^= 0xff;
uint8_t mask, mode, local_doneq = 0; uint8_t mask, mode, local_doneq = 0;
for (int i = 0; i < DMX_MAX_FILTER_SIZE; ++i) { for (i = 0; i < DMX_MAX_FILTER_SIZE; ++i) {
mode = filter_mode[i]; mode = filter_mode[i];
mask = filter_mask[i]; mask = filter_mask[i];
maskandmode[i] = mask & mode; maskandmode[i] = mask & mode;
@@ -48,11 +48,12 @@ cIptvSectionFilter::cIptvSectionFilter(int Index, int devInd,
doneq = local_doneq ? 1 : 0; doneq = local_doneq ? 1 : 0;
struct stat sb; struct stat sb;
pipeName = cString::sprintf(IPTV_FILTER_FILENAME, devid, id);
stat(pipeName, &sb); stat(pipeName, &sb);
if (S_ISFIFO(sb.st_mode)) if (S_ISFIFO(sb.st_mode))
unlink(pipeName); unlink(pipeName);
int err = mknod(pipeName, 0644 | S_IFIFO, 0); i = mknod(pipeName, 0644 | S_IFIFO, 0);
ERROR_IF_RET(err < 0, "mknod()", return); ERROR_IF_RET(i < 0, "mknod()", return);
// Create descriptors // Create descriptors
fifoDescriptor = open(pipeName, O_RDWR | O_NONBLOCK); fifoDescriptor = open(pipeName, O_RDWR | O_NONBLOCK);
@@ -61,7 +62,7 @@ cIptvSectionFilter::cIptvSectionFilter(int Index, int devInd,
cIptvSectionFilter::~cIptvSectionFilter() cIptvSectionFilter::~cIptvSectionFilter()
{ {
//debug("cIptvSectionFilter::~cIptvSectionfilter(%d)\n", id); //debug("cIptvSectionFilter::~cIptvSectionfilter(%d, %d)\n", devid, id);
close(fifoDescriptor); close(fifoDescriptor);
close(readDescriptor); close(readDescriptor);
unlink(pipeName); unlink(pipeName);
@@ -69,119 +70,65 @@ cIptvSectionFilter::~cIptvSectionFilter()
readDescriptor = -1; readDescriptor = -1;
} }
void cIptvSectionFilter::SetPipeName(int deviceIndex) int cIptvSectionFilter::GetReadDesc(void)
{
pipeName = cString::sprintf(IPTV_FILTER_FILENAME, deviceIndex, id);
}
int cIptvSectionFilter::GetReadDesc()
{ {
return readDescriptor; return readDescriptor;
} }
inline uint16_t cIptvSectionFilter::section_length(const uint8_t *buf) inline uint16_t cIptvSectionFilter::GetLength(const uint8_t *Data)
{ {
return 3 + ((buf[1] & 0x0f) << 8) + buf[2]; return 3 + ((Data[1] & 0x0f) << 8) + Data[2];
} }
int cIptvSectionFilter::dmxdev_section_callback(const uint8_t *buffer1, size_t buffer1_len, void cIptvSectionFilter::New(void)
const uint8_t *buffer2, size_t buffer2_len,
enum dmx_success success)
{ {
// See if there is data in the fifo
int retval = select_single_desc(fifoDescriptor, 0, false);
// There is no data in the fifo, more can be written
if (!retval) {
#ifdef DEBUG_PRINTF
printf("id = %d, pid %d would now write %d data to buffer\n", id, pid, buffer1_len);
for (unsigned int i = 0; i < buffer1_len; ++i)
printf("0x%X ", buffer1[i]);
printf("\n");
#endif
retval = write(fifoDescriptor, buffer1, buffer1_len);
ERROR_IF(retval < 0, "write()");
// Update statistics
AddSectionStatistic(retval, 1);
}
#ifdef DEBUG_PRINTF
else if (retval)
printf("id %d pid %d data is already present\n", id, pid);
#endif
return 0;
}
void cIptvSectionFilter::demux_swfilter_section_new()
{
#ifdef DEMUX_SECTION_LOSS_LOG
if (secbufp < tsfeedp) {
int i, n = tsfeedp - secbufp;
/*
* Section padding is done with 0xff bytes entirely.
* Due to speed reasons, we won't check all of them
* but just first and last.
*/
if (secbuf[0] != 0xff || secbuf[n - 1] != 0xff) {
printf("sectionfilter.c section ts padding loss: %d/%d\n",
n, tsfeedp);
printf("sectionfilter.c pad data:");
for (i = 0; i < n; ++i)
printf(" %02x", secbuf[i]);
printf("\n");
}
}
#endif
tsfeedp = secbufp = seclen = 0; tsfeedp = secbufp = seclen = 0;
secbuf = secbuf_base; secbuf = secbuf_base;
} }
int cIptvSectionFilter::demux_swfilter_sectionfilter() int cIptvSectionFilter::Filter(void)
{ {
uint8_t neq = 0; uint8_t neq = 0;
int i; int i;
for (i = 0; i < DMX_MAX_FILTER_SIZE; ++i) { for (i = 0; i < DMX_MAX_FILTER_SIZE; ++i) {
uint8_t local_xor = filter_value[i] ^ secbuf[i]; uint8_t local_xor = filter_value[i] ^ secbuf[i];
if (maskandmode[i] & local_xor) { if (maskandmode[i] & local_xor)
#ifdef DEBUG_PRINTF
printf("maskandmode discard\n");
#endif
return 0; return 0;
}
neq |= maskandnotmode[i] & local_xor; neq |= maskandnotmode[i] & local_xor;
} }
if (doneq && !neq) { if (doneq && !neq)
#ifdef DEBUG_PRINTF
printf("doneq discard, doneq = 0x%X, neq = 0x%X\n", doneq, !neq);
#endif
return 0; return 0;
// There is no data in the fifo, more can be written
if (!select_single_desc(fifoDescriptor, 0, false)) {
i = write(fifoDescriptor, secbuf, seclen);
ERROR_IF(i < 0, "write()");
// Update statistics
AddSectionStatistic(i, 1);
} }
return dmxdev_section_callback(secbuf, seclen, NULL, 0, DMX_OK);
return 0;
} }
inline int cIptvSectionFilter::demux_swfilter_section_feed() inline int cIptvSectionFilter::Feed(void)
{ {
if (demux_swfilter_sectionfilter() < 0) if (Filter() < 0)
return -1; return -1;
seclen = 0; seclen = 0;
return 0; return 0;
} }
int cIptvSectionFilter::demux_swfilter_section_copy_dump(const uint8_t *buf, uint8_t len) int cIptvSectionFilter::CopyDump(const uint8_t *buf, uint8_t len)
{ {
uint16_t limit, seclen_local, n; uint16_t limit, seclen_local, n;
if (tsfeedp >= DMX_MAX_SECFEED_SIZE) if (tsfeedp >= DMX_MAX_SECFEED_SIZE)
return 0; return 0;
if (tsfeedp + len > DMX_MAX_SECFEED_SIZE) { if (tsfeedp + len > DMX_MAX_SECFEED_SIZE)
#ifdef DEMUX_SECTION_LOSS_LOG
printf("sectionfilter.c section buffer full loss: %d/%d\n",
tsfeedp + len - DMX_MAX_SECFEED_SIZE,
DMX_MAX_SECFEED_SIZE);
#endif
len = DMX_MAX_SECFEED_SIZE - tsfeedp; len = DMX_MAX_SECFEED_SIZE - tsfeedp;
}
if (len <= 0) if (len <= 0)
return 0; return 0;
@@ -189,108 +136,80 @@ int cIptvSectionFilter::demux_swfilter_section_copy_dump(const uint8_t *buf, uin
memcpy(secbuf_base + tsfeedp, buf, len); memcpy(secbuf_base + tsfeedp, buf, len);
tsfeedp += len; tsfeedp += len;
/*
* Dump all the sections we can find in the data (Emard)
*/
limit = tsfeedp; limit = tsfeedp;
if (limit > DMX_MAX_SECFEED_SIZE) if (limit > DMX_MAX_SECFEED_SIZE)
return -1; /* internal error should never happen */ return -1; // internal error should never happen
/* to be sure always set secbuf */ // Always set secbuf
secbuf = secbuf_base + secbufp; secbuf = secbuf_base + secbufp;
for (n = 0; secbufp + 2 < limit; ++n) { for (n = 0; secbufp + 2 < limit; ++n) {
seclen_local = section_length(secbuf); seclen_local = GetLength(secbuf);
if (seclen_local <= 0 || seclen_local > DMX_MAX_SECTION_SIZE || if (seclen_local <= 0 || seclen_local > DMX_MAX_SECTION_SIZE ||
seclen_local + secbufp > limit) seclen_local + secbufp > limit)
return 0; return 0;
#ifdef DEBUG_PRINTF
printf("Non-mismatching seclen! %d, limit = %d\n", seclen_local, limit);
#endif
seclen = seclen_local; seclen = seclen_local;
/* dump [secbuf .. secbuf+seclen) */
if (pusi_seen) if (pusi_seen)
demux_swfilter_section_feed(); Feed();
#ifdef DEMUX_SECTION_LOSS_LOG secbufp += seclen_local;
else secbuf += seclen_local;
printf("sectionfilter.c pusi not seen, discarding section data\n");
#endif
secbufp += seclen_local; /* secbufp and secbuf moving together is */
secbuf += seclen_local; /* redundant but saves pointer arithmetic */
} }
return 0; return 0;
} }
void cIptvSectionFilter::ProcessData(const uint8_t* buf) void cIptvSectionFilter::Process(const uint8_t* Data)
{ {
if (buf[0] != 0x47) { if (Data[0] != TS_SYNC_BYTE)
error("Not TS packet: 0x%X\n", buf[0]);
return; return;
}
// Stop if not the PID this filter is looking for // Stop if not the PID this filter is looking for
if (ts_pid(buf) != pid) if (ts_pid(Data) != pid)
return; return;
uint8_t count = payload(buf); uint8_t count = payload(Data);
if (count == 0) /* count == 0 if no payload or out of range */ // Check if no payload or out of range
if (count == 0)
return; return;
uint8_t p = 188 - count; /* payload start */ // Payload start
uint8_t p = TS_SIZE - count;
uint8_t cc = buf[3] & 0x0f; uint8_t cc = Data[3] & 0x0f;
int ccok = ((feedcc + 1) & 0x0f) == cc; int ccok = ((feedcc + 1) & 0x0f) == cc;
feedcc = cc; feedcc = cc;
int dc_i = 0; int dc_i = 0;
if (buf[3] & 0x20) { if (Data[3] & 0x20) {
/* adaption field present, check for discontinuity_indicator */ // Adaption field present, check for discontinuity_indicator
if ((buf[4] > 0) && (buf[5] & 0x80)) if ((Data[4] > 0) && (Data[5] & 0x80))
dc_i = 1; dc_i = 1;
} }
if (!ccok || dc_i) { if (!ccok || dc_i) {
#ifdef DEMUX_SECTION_LOSS_LOG // Discontinuity detected. Reset pusi_seen = 0 to
printf("sectionfilter.c discontinuity detected %d bytes lost\n", // stop feeding of suspicious data until next PUSI=1 arrives
count);
/*
* those bytes under sume circumstances will again be reported
* in the following demux_swfilter_section_new
*/
#endif
/*
* Discontinuity detected. Reset pusi_seen = 0 to
* stop feeding of suspicious data until next PUSI=1 arrives
*/
pusi_seen = 0; pusi_seen = 0;
demux_swfilter_section_new(); New();
} }
if (buf[1] & 0x40) { if (Data[1] & 0x40) {
/* PUSI=1 (is set), section boundary is here */ // PUSI=1 (is set), section boundary is here
if (count > 1 && buf[p] < count) { if (count > 1 && Data[p] < count) {
#ifdef DEBUG_PRINTF const uint8_t *before = &Data[p + 1];
printf("Valid section\n"); uint8_t before_len = Data[p];
#endif
const uint8_t *before = &buf[p + 1];
uint8_t before_len = buf[p];
const uint8_t *after = &before[before_len]; const uint8_t *after = &before[before_len];
uint8_t after_len = (count - 1) - before_len; uint8_t after_len = (count - 1) - before_len;
CopyDump(before, before_len);
demux_swfilter_section_copy_dump(before, before_len); // Before start of new section, set pusi_seen = 1
/* before start of new section, set pusi_seen = 1 */
pusi_seen = 1; pusi_seen = 1;
demux_swfilter_section_new(); New();
demux_swfilter_section_copy_dump(after, after_len); CopyDump(after, after_len);
} }
#ifdef DEMUX_SECTION_LOSS_LOG
else if (count > 0)
printf("sectionfilter.c PUSI=1 but %d bytes lost\n", count);
#endif
} }
else { else {
/* PUSI=0 (is not set), no section boundary */ // PUSI=0 (is not set), no section boundary
demux_swfilter_section_copy_dump(&buf[p], count); CopyDump(&Data[p], count);
} }
} }

View File

@@ -3,24 +3,12 @@
* *
* See the README file for copyright information and how to reach the author. * See the README file for copyright information and how to reach the author.
* *
* $Id: sectionfilter.h,v 1.8 2008/02/17 19:18:47 rahrenbe Exp $
*/ */
#ifndef __IPTV_SECTIONFILTER_H #ifndef __IPTV_SECTIONFILTER_H
#define __IPTV_SECTIONFILTER_H #define __IPTV_SECTIONFILTER_H
#include <stdio.h> #include <vdr/device.h>
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <libgen.h>
#include <stdint.h>
#include <sys/param.h>
#include "common.h" #include "common.h"
#include "statistics.h" #include "statistics.h"
@@ -28,19 +16,19 @@
class cIptvSectionFilter : public cIptvSectionStatistics { class cIptvSectionFilter : public cIptvSectionStatistics {
private: private:
enum dmx_success { enum dmx_success {
DMX_OK = 0, /* Received Ok */ DMX_OK = 0, // Received OK
DMX_LENGTH_ERROR, /* Incorrect length */ DMX_LENGTH_ERROR, // Incorrect length
DMX_OVERRUN_ERROR, /* Receiver ring buffer overrun */ DMX_OVERRUN_ERROR, // Receiver ring buffer overrun
DMX_CRC_ERROR, /* Incorrect CRC */ DMX_CRC_ERROR, // Incorrect CRC
DMX_FRAME_ERROR, /* Frame alignment error */ DMX_FRAME_ERROR, // Frame alignment error
DMX_FIFO_ERROR, /* Receiver FIFO overrun */ DMX_FIFO_ERROR, // Receiver FIFO overrun
DMX_MISSED_ERROR /* Receiver missed packet */ DMX_MISSED_ERROR // Receiver missed packet
}; };
enum dmx_limits { enum dmx_limits {
DMX_MAX_FILTER_SIZE = 18, DMX_MAX_FILTER_SIZE = 18,
DMX_MAX_SECTION_SIZE = 4096, DMX_MAX_SECTION_SIZE = 4096,
DMX_MAX_SECFEED_SIZE = (DMX_MAX_SECTION_SIZE + 188) DMX_MAX_SECFEED_SIZE = (DMX_MAX_SECTION_SIZE + TS_SIZE)
}; };
int fifoDescriptor; int fifoDescriptor;
@@ -56,49 +44,32 @@ private:
uint16_t seclen; uint16_t seclen;
uint16_t tsfeedp; uint16_t tsfeedp;
uint16_t pid; uint16_t pid;
int devid;
int id; int id;
cString pipeName;
uint8_t filter_value[DMX_MAX_FILTER_SIZE]; uint8_t filter_value[DMX_MAX_FILTER_SIZE];
uint8_t filter_mask[DMX_MAX_FILTER_SIZE]; uint8_t filter_mask[DMX_MAX_FILTER_SIZE];
uint8_t filter_mode[DMX_MAX_FILTER_SIZE]; uint8_t filter_mode[DMX_MAX_FILTER_SIZE];
uint8_t maskandmode[DMX_MAX_FILTER_SIZE]; uint8_t maskandmode[DMX_MAX_FILTER_SIZE];
uint8_t maskandnotmode[DMX_MAX_FILTER_SIZE]; uint8_t maskandnotmode[DMX_MAX_FILTER_SIZE];
cString pipeName; inline uint16_t GetLength(const uint8_t *Data);
void New(void);
inline uint16_t section_length(const uint8_t *buf); int Filter(void);
inline int Feed(void);
int dmxdev_section_callback(const uint8_t *buffer1, int CopyDump(const uint8_t *buf, uint8_t len);
size_t buffer1_len,
const uint8_t *buffer2,
size_t buffer2_len,
enum dmx_success success);
void demux_swfilter_section_new();
int demux_swfilter_sectionfilter();
inline int demux_swfilter_section_feed();
int demux_swfilter_section_copy_dump(const uint8_t *buf,
uint8_t len);
int GetFifoDesc();
void ClearPipeName();
void SetPipeName(int deviceIndex);
public: public:
// constructor & destructor // constructor & destructor
cIptvSectionFilter(int Index, int devInd, u_short Pid, u_char Tid, cIptvSectionFilter(int Index, int DeviceIndex, u_short Pid,
u_char Mask); u_char Tid, u_char Mask);
virtual ~cIptvSectionFilter(); virtual ~cIptvSectionFilter();
void Process(const uint8_t* Data);
void ProcessData(const uint8_t* buf); int GetReadDesc(void);
uint16_t GetPid(void) { return pid; }
int GetReadDesc();
uint16_t GetPid() { return pid; }
}; };
#endif // __IPTV_SECTIONFILTER_H #endif // __IPTV_SECTIONFILTER_H

16
setup.c
View File

@@ -3,7 +3,6 @@
* *
* See the README file for copyright information and how to reach the author. * See the README file for copyright information and how to reach the author.
* *
* $Id: setup.c,v 1.58 2008/04/02 20:22:48 rahrenbe Exp $
*/ */
#include <string.h> #include <string.h>
@@ -35,7 +34,7 @@ private:
eProtocolCount eProtocolCount
}; };
struct tIptvChannel { struct tIptvChannel {
int frequency, source, protocol, parameter, vpid, ppid, tpid, sid, nid, tid, rid; int frequency, source, protocol, parameter, vpid, ppid, vtype, tpid, sid, nid, tid, rid;
int apid[MAXAPIDS + 1], dpid[MAXDPIDS + 1], spid[MAXSPIDS + 1], caids[MAXCAIDS + 1]; int apid[MAXAPIDS + 1], dpid[MAXDPIDS + 1], spid[MAXSPIDS + 1], caids[MAXCAIDS + 1];
int sidscan, pidscan; int sidscan, pidscan;
char name[256], location[256]; char name[256], location[256];
@@ -58,7 +57,7 @@ cIptvMenuEditChannel::cIptvMenuEditChannel(cChannel *Channel, bool New)
protocols[eProtocolUDP] = tr("UDP"); protocols[eProtocolUDP] = tr("UDP");
protocols[eProtocolHTTP] = tr("HTTP"); protocols[eProtocolHTTP] = tr("HTTP");
protocols[eProtocolFILE] = tr("FILE"); protocols[eProtocolFILE] = tr("FILE");
protocols[eProtocolEXT] = tr("EXT"); protocols[eProtocolEXT] = tr("EXT");
channel = Channel; channel = Channel;
GetChannelData(channel); GetChannelData(channel);
if (New) { if (New) {
@@ -128,6 +127,9 @@ void cIptvMenuEditChannel::GetChannelData(cChannel *Channel)
data.source = Channel->Source(); data.source = Channel->Source();
data.vpid = Channel->Vpid(); data.vpid = Channel->Vpid();
data.ppid = Channel->Ppid(); data.ppid = Channel->Ppid();
#if defined(APIVERSNUM) && APIVERSNUM >= 10704
data.vtype = Channel->Vtype();
#endif
data.tpid = Channel->Tpid(); data.tpid = Channel->Tpid();
for (unsigned int i = 0; i < ARRAY_SIZE(data.apid); ++i) for (unsigned int i = 0; i < ARRAY_SIZE(data.apid); ++i)
data.apid[i] = Channel->Apid(i); data.apid[i] = Channel->Apid(i);
@@ -153,6 +155,7 @@ void cIptvMenuEditChannel::GetChannelData(cChannel *Channel)
data.source = cSource::FromData(cSource::stPlug); data.source = cSource::FromData(cSource::stPlug);
data.vpid = 0; data.vpid = 0;
data.ppid = 0; data.ppid = 0;
data.vtype = 0;
data.tpid = 0; data.tpid = 0;
for (unsigned int i = 0; i < ARRAY_SIZE(data.apid); ++i) for (unsigned int i = 0; i < ARRAY_SIZE(data.apid); ++i)
data.apid[i] = 0; data.apid[i] = 0;
@@ -197,7 +200,11 @@ void cIptvMenuEditChannel::SetChannelData(cChannel *Channel)
break; break;
} }
char slangs[MAXSPIDS][MAXLANGCODE2] = { "" }; char slangs[MAXSPIDS][MAXLANGCODE2] = { "" };
#if defined(APIVERSNUM) && APIVERSNUM >= 10704
Channel->SetPids(data.vpid, data.ppid, data.vtype, data.apid, alangs, data.dpid, dlangs, data.spid, slangs, data.tpid);
#else
Channel->SetPids(data.vpid, data.ppid, data.apid, alangs, data.dpid, dlangs, data.spid, slangs, data.tpid); Channel->SetPids(data.vpid, data.ppid, data.apid, alangs, data.dpid, dlangs, data.spid, slangs, data.tpid);
#endif
Channel->SetCaIds(data.caids); Channel->SetCaIds(data.caids);
Channel->SetId(data.nid, data.tid, data.sid, data.rid); Channel->SetId(data.nid, data.tid, data.sid, data.rid);
Channel->SetName(data.name, "", "IPTV"); Channel->SetName(data.name, "", "IPTV");
@@ -237,6 +244,9 @@ void cIptvMenuEditChannel::Setup(void)
Add(new cMenuEditStrItem(trVDR("Name"), data.name, sizeof(data.name))); Add(new cMenuEditStrItem(trVDR("Name"), data.name, sizeof(data.name)));
Add(new cMenuEditIntItem(trVDR("Frequency"), &data.frequency)); Add(new cMenuEditIntItem(trVDR("Frequency"), &data.frequency));
Add(new cMenuEditIntItem(trVDR("Vpid"), &data.vpid, 0, 0x1FFF)); Add(new cMenuEditIntItem(trVDR("Vpid"), &data.vpid, 0, 0x1FFF));
#if defined(APIVERSNUM) && APIVERSNUM >= 10704
Add(new cMenuEditIntItem(tr ("Vtype"), &data.vtype, 0, 0xFF));
#endif
Add(new cMenuEditIntItem(trVDR("Ppid"), &data.ppid, 0, 0x1FFF)); Add(new cMenuEditIntItem(trVDR("Ppid"), &data.ppid, 0, 0x1FFF));
Add(new cMenuEditIntItem(trVDR("Apid1"), &data.apid[0], 0, 0x1FFF)); Add(new cMenuEditIntItem(trVDR("Apid1"), &data.apid[0], 0, 0x1FFF));
Add(new cMenuEditIntItem(trVDR("Apid2"), &data.apid[1], 0, 0x1FFF)); Add(new cMenuEditIntItem(trVDR("Apid2"), &data.apid[1], 0, 0x1FFF));

View File

@@ -3,7 +3,6 @@
* *
* See the README file for copyright information and how to reach the author. * See the README file for copyright information and how to reach the author.
* *
* $Id: setup.h,v 1.21 2008/02/19 22:29:02 rahrenbe Exp $
*/ */
#ifndef __IPTV_SETUP_H #ifndef __IPTV_SETUP_H

View File

@@ -3,7 +3,6 @@
* *
* See the README file for copyright information and how to reach the author. * See the README file for copyright information and how to reach the author.
* *
* $Id: sidscanner.c,v 1.1 2007/10/01 18:14:57 rahrenbe Exp $
*/ */
#include <libsi/section.h> #include <libsi/section.h>
@@ -52,8 +51,9 @@ void cSidScanner::Process(u_short Pid, u_char Tid, const u_char *Data, int Lengt
if (!Channels.Lock(true, 10)) if (!Channels.Lock(true, 10))
return; return;
cChannel *IptvChannel = Channels.GetByChannelID(channel.GetChannelID()); cChannel *IptvChannel = Channels.GetByChannelID(channel.GetChannelID());
IptvChannel->SetId(IptvChannel->Nid(), IptvChannel->Tid(), if (IptvChannel)
assoc.getServiceId(), IptvChannel->Rid()); IptvChannel->SetId(IptvChannel->Nid(), IptvChannel->Tid(),
assoc.getServiceId(), IptvChannel->Rid());
Channels.Unlock(); Channels.Unlock();
} }
SetChannel(NULL); SetChannel(NULL);

View File

@@ -3,7 +3,6 @@
* *
* See the README file for copyright information and how to reach the author. * See the README file for copyright information and how to reach the author.
* *
* $Id: sidscanner.h,v 1.1 2007/10/01 18:14:57 rahrenbe Exp $
*/ */
#ifndef __SIDSCANNER_H #ifndef __SIDSCANNER_H

116
socket.c
View File

@@ -3,7 +3,6 @@
* *
* See the README file for copyright information and how to reach the author. * See the README file for copyright information and how to reach the author.
* *
* $Id: socket.c,v 1.7 2008/01/30 21:57:33 rahrenbe Exp $
*/ */
#include <sys/types.h> #include <sys/types.h>
@@ -21,14 +20,9 @@
cIptvSocket::cIptvSocket() cIptvSocket::cIptvSocket()
: socketPort(0), : socketPort(0),
socketDesc(-1), socketDesc(-1),
readBufferLen(TS_SIZE * IptvConfig.GetReadBufferTsCount()),
isActive(false) isActive(false)
{ {
debug("cIptvSocket::cIptvSocket()\n"); debug("cIptvSocket::cIptvSocket()\n");
// Allocate receive buffer
readBuffer = MALLOC(unsigned char, readBufferLen);
if (!readBuffer)
error("ERROR: MALLOC() failed in socket()");
} }
cIptvSocket::~cIptvSocket() cIptvSocket::~cIptvSocket()
@@ -36,8 +30,6 @@ cIptvSocket::~cIptvSocket()
debug("cIptvSocket::~cIptvSocket()\n"); debug("cIptvSocket::~cIptvSocket()\n");
// Close the socket // Close the socket
CloseSocket(); CloseSocket();
// Free allocated memory
free(readBuffer);
} }
bool cIptvSocket::OpenSocket(const int Port, const bool isUdp) bool cIptvSocket::OpenSocket(const int Port, const bool isUdp)
@@ -51,7 +43,7 @@ bool cIptvSocket::OpenSocket(const int Port, const bool isUdp)
} }
// Bind to the socket if it is not active already // Bind to the socket if it is not active already
if (socketDesc < 0) { if (socketDesc < 0) {
int yes = 1; int yes = 1;
// Create socket // Create socket
if (isUdp) if (isUdp)
socketDesc = socket(PF_INET, SOCK_DGRAM, 0); socketDesc = socket(PF_INET, SOCK_DGRAM, 0);
@@ -59,10 +51,11 @@ bool cIptvSocket::OpenSocket(const int Port, const bool isUdp)
socketDesc = socket(PF_INET, SOCK_STREAM, 0); socketDesc = socket(PF_INET, SOCK_STREAM, 0);
ERROR_IF_RET(socketDesc < 0, "socket()", return false); ERROR_IF_RET(socketDesc < 0, "socket()", return false);
// Make it use non-blocking I/O to avoid stuck read calls // Make it use non-blocking I/O to avoid stuck read calls
ERROR_IF_FUNC(fcntl(socketDesc, F_SETFL, O_NONBLOCK), "fcntl()", CloseSocket(), return false); ERROR_IF_FUNC(fcntl(socketDesc, F_SETFL, O_NONBLOCK), "fcntl()",
CloseSocket(), return false);
// Allow multiple sockets to use the same PORT number // Allow multiple sockets to use the same PORT number
ERROR_IF_FUNC(setsockopt(socketDesc, SOL_SOCKET, SO_REUSEADDR, &yes, ERROR_IF_FUNC(setsockopt(socketDesc, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes)) < 0, "setsockopt()",
sizeof(yes)) < 0, "setsockopt()", CloseSocket(), return false); CloseSocket(), return false);
// Bind socket // Bind socket
memset(&sockAddr, '\0', sizeof(sockAddr)); memset(&sockAddr, '\0', sizeof(sockAddr));
sockAddr.sin_family = AF_INET; sockAddr.sin_family = AF_INET;
@@ -105,7 +98,7 @@ bool cIptvUdpSocket::OpenSocket(const int Port)
return cIptvSocket::OpenSocket(Port, true); return cIptvSocket::OpenSocket(Port, true);
} }
int cIptvUdpSocket::Read(unsigned char* *BufferAddr) int cIptvUdpSocket::Read(unsigned char* BufferAddr, unsigned int BufferLen)
{ {
//debug("cIptvUdpSocket::Read()\n"); //debug("cIptvUdpSocket::Read()\n");
// Error out if socket not initialized // Error out if socket not initialized
@@ -114,51 +107,40 @@ int cIptvUdpSocket::Read(unsigned char* *BufferAddr)
return -1; return -1;
} }
socklen_t addrlen = sizeof(sockAddr); socklen_t addrlen = sizeof(sockAddr);
// Set argument point to read buffer int len = 0;
*BufferAddr = readBuffer; // Read data from socket
// Wait 500ms for data if (isActive)
int retval = select_single_desc(socketDesc, 500000, false); len = recvfrom(socketDesc, BufferAddr, BufferLen, MSG_DONTWAIT,
// Check if error (struct sockaddr *)&sockAddr, &addrlen);
if (retval < 0) if ((len > 0) && (BufferAddr[0] == TS_SYNC_BYTE)) {
return retval; return len;
// Check if data available }
else if (retval) { else if (len > 3) {
int len = 0; // http://www.networksorcery.com/enp/rfc/rfc2250.txt
// Read data from socket // version
if (isActive) unsigned int v = (BufferAddr[0] >> 6) & 0x03;
len = recvfrom(socketDesc, readBuffer, readBufferLen, MSG_DONTWAIT, // extension bit
(struct sockaddr *)&sockAddr, &addrlen); unsigned int x = (BufferAddr[0] >> 4) & 0x01;
ERROR_IF_RET(len < 0, "recvfrom()", return len); // cscr count
if ((len > 0) && (readBuffer[0] == 0x47)) { unsigned int cc = BufferAddr[0] & 0x0F;
// Set argument point to read buffer // payload type: MPEG2 TS = 33
*BufferAddr = &readBuffer[0]; //unsigned int pt = readBuffer[1] & 0x7F;
return len; // header lenght
unsigned int headerlen = (3 + cc) * sizeof(uint32_t);
// check if extension
if (x) {
// extension header length
unsigned int ehl = (((BufferAddr[headerlen + 2] & 0xFF) << 8) |
(BufferAddr[headerlen + 3] & 0xFF));
// update header length
headerlen += (ehl + 1) * sizeof(uint32_t);
} }
else if (len > 3) { // Check that rtp is version 2 and payload contains multiple of TS packet data
// http://www.networksorcery.com/enp/rfc/rfc2250.txt if ((v == 2) && (((len - headerlen) % TS_SIZE) == 0) &&
// version (BufferAddr[headerlen] == TS_SYNC_BYTE)) {
unsigned int v = (readBuffer[0] >> 6) & 0x03; // Set argument point to payload in read buffer
// extension bit memmove(BufferAddr, &BufferAddr[headerlen], (len - headerlen));
unsigned int x = (readBuffer[0] >> 4) & 0x01; return (len - headerlen);
// cscr count
unsigned int cc = readBuffer[0] & 0x0F;
// payload type: MPEG2 TS = 33
//unsigned int pt = readBuffer[1] & 0x7F;
// header lenght
unsigned int headerlen = (3 + cc) * sizeof(uint32_t);
// check if extension
if (x) {
// extension header length
unsigned int ehl = (((readBuffer[headerlen + 2] & 0xFF) << 8) | (readBuffer[headerlen + 3] & 0xFF));
// update header length
headerlen += (ehl + 1) * sizeof(uint32_t);
}
// Check that rtp is version 2 and payload contains multiple of TS packet data
if ((v == 2) && (((len - headerlen) % TS_SIZE) == 0) && (readBuffer[headerlen] == 0x47)) {
// Set argument point to payload in read buffer
*BufferAddr = &readBuffer[headerlen];
return (len - headerlen);
}
} }
} }
return 0; return 0;
@@ -181,7 +163,7 @@ bool cIptvTcpSocket::OpenSocket(const int Port)
return cIptvSocket::OpenSocket(Port, false); return cIptvSocket::OpenSocket(Port, false);
} }
int cIptvTcpSocket::Read(unsigned char* *BufferAddr) int cIptvTcpSocket::Read(unsigned char* BufferAddr, unsigned int BufferLen)
{ {
//debug("cIptvTcpSocket::Read()\n"); //debug("cIptvTcpSocket::Read()\n");
// Error out if socket not initialized // Error out if socket not initialized
@@ -190,19 +172,9 @@ int cIptvTcpSocket::Read(unsigned char* *BufferAddr)
return -1; return -1;
} }
socklen_t addrlen = sizeof(sockAddr); socklen_t addrlen = sizeof(sockAddr);
// Set argument point to read buffer // Read data from socket
*BufferAddr = readBuffer; if (isActive)
// Wait 500ms for data return recvfrom(socketDesc, BufferAddr, BufferLen, MSG_DONTWAIT,
int retval = select_single_desc(socketDesc, 500000, false); (struct sockaddr *)&sockAddr, &addrlen);
// Check if error
if (retval < 0)
return retval;
// Check if data available
else if (retval) {
// Read data from socket
if (isActive)
return recvfrom(socketDesc, readBuffer, readBufferLen, MSG_DONTWAIT,
(struct sockaddr *)&sockAddr, &addrlen);
}
return 0; return 0;
} }

View File

@@ -3,7 +3,6 @@
* *
* See the README file for copyright information and how to reach the author. * See the README file for copyright information and how to reach the author.
* *
* $Id: socket.h,v 1.3 2007/10/21 19:32:15 ajhseppa Exp $
*/ */
#ifndef __IPTV_SOCKET_H #ifndef __IPTV_SOCKET_H
@@ -15,8 +14,6 @@ class cIptvSocket {
protected: protected:
int socketPort; int socketPort;
int socketDesc; int socketDesc;
unsigned char* readBuffer;
unsigned int readBufferLen;
struct sockaddr_in sockAddr; struct sockaddr_in sockAddr;
bool isActive; bool isActive;
@@ -33,7 +30,7 @@ class cIptvUdpSocket : public cIptvSocket {
public: public:
cIptvUdpSocket(); cIptvUdpSocket();
virtual ~cIptvUdpSocket(); virtual ~cIptvUdpSocket();
virtual int Read(unsigned char* *BufferAddr); virtual int Read(unsigned char* BufferAddr, unsigned int BufferLen);
bool OpenSocket(const int Port); bool OpenSocket(const int Port);
}; };
@@ -41,7 +38,7 @@ class cIptvTcpSocket : public cIptvSocket {
public: public:
cIptvTcpSocket(); cIptvTcpSocket();
virtual ~cIptvTcpSocket(); virtual ~cIptvTcpSocket();
virtual int Read(unsigned char* *BufferAddr); virtual int Read(unsigned char* BufferAddr, unsigned int BufferLen);
bool OpenSocket(const int Port); bool OpenSocket(const int Port);
}; };

View File

@@ -3,7 +3,6 @@
* *
* See the README file for copyright information and how to reach the author. * See the README file for copyright information and how to reach the author.
* *
* $Id: statistics.c,v 1.22 2008/01/19 21:08:03 ajhseppa Exp $
*/ */
#include <limits.h> #include <limits.h>

View File

@@ -3,7 +3,6 @@
* *
* See the README file for copyright information and how to reach the author. * See the README file for copyright information and how to reach the author.
* *
* $Id: statistics.h,v 1.11 2008/01/19 21:08:03 ajhseppa Exp $
*/ */
#ifndef __IPTV_STATISTICS_H #ifndef __IPTV_STATISTICS_H

View File

@@ -3,7 +3,6 @@
* *
* See the README file for copyright information and how to reach the author. * See the README file for copyright information and how to reach the author.
* *
* $Id: streamer.c,v 1.33 2008/04/04 20:55:44 rahrenbe Exp $
*/ */
#include <vdr/thread.h> #include <vdr/thread.h>
@@ -12,13 +11,19 @@
#include "common.h" #include "common.h"
#include "streamer.h" #include "streamer.h"
cIptvStreamer::cIptvStreamer(cRingBufferLinear* RingBuffer, cMutex* Mutex) cIptvStreamer::cIptvStreamer(cRingBufferLinear* RingBuffer, unsigned int PacketLen)
: cThread("IPTV streamer"), : cThread("IPTV streamer"),
ringBuffer(RingBuffer), ringBuffer(RingBuffer),
mutex(Mutex), packetBufferLen(PacketLen),
protocol(NULL) protocol(NULL)
{ {
debug("cIptvStreamer::cIptvStreamer()\n"); debug("cIptvStreamer::cIptvStreamer(%d)\n", packetBufferLen);
// Allocate packet buffer
packetBuffer = MALLOC(unsigned char, packetBufferLen);
if (packetBuffer)
memset(packetBuffer, 0, packetBufferLen);
else
error("ERROR: MALLOC() failed for packet buffer");
} }
cIptvStreamer::~cIptvStreamer() cIptvStreamer::~cIptvStreamer()
@@ -26,32 +31,31 @@ cIptvStreamer::~cIptvStreamer()
debug("cIptvStreamer::~cIptvStreamer()\n"); debug("cIptvStreamer::~cIptvStreamer()\n");
// Close the protocol // Close the protocol
Close(); Close();
// Free allocated memory
free(packetBuffer);
} }
void cIptvStreamer::Action(void) void cIptvStreamer::Action(void)
{ {
debug("cIptvStreamer::Action(): Entering\n"); debug("cIptvStreamer::Action(): Entering\n");
// Increase priority
//SetPriority(-1);
// Do the thread loop // Do the thread loop
while (Running()) { while (packetBuffer && Running()) {
if (ringBuffer && mutex && protocol && ringBuffer->Free()) { int length = -1;
unsigned char *buffer = NULL; if (protocol)
mutex->Lock(); length = protocol->Read(packetBuffer, packetBufferLen);
int length = protocol->Read(&buffer); if (length > 0) {
if (length >= 0) { AddStreamerStatistic(length);
AddStreamerStatistic(length); if (ringBuffer) {
int p = ringBuffer->Put(buffer, length); int p = ringBuffer->Put(packetBuffer, length);
if (p != length && Running()) if (p != length)
ringBuffer->ReportOverflow(length - p); ringBuffer->ReportOverflow(length - p);
mutex->Unlock(); }
} }
else { else
mutex->Unlock(); sleep.Wait(10); // to avoid busy loop and reduce cpu load
cCondWait::SleepMs(100); // to reduce cpu load }
}
}
else
cCondWait::SleepMs(100); // and avoid busy loop
}
debug("cIptvStreamer::Action(): Exiting\n"); debug("cIptvStreamer::Action(): Exiting\n");
} }
@@ -70,17 +74,12 @@ bool cIptvStreamer::Close(void)
{ {
debug("cIptvStreamer::Close()\n"); debug("cIptvStreamer::Close()\n");
// Stop thread // Stop thread
sleep.Signal();
if (Running()) if (Running())
Cancel(3); Cancel(3);
// Close the protocol. A mutex should be taken here to avoid a race condition // Close the protocol
// where thread Action() may be in the process of accessing the protocol.
// Taking a mutex serializes the Close() and Action() -calls.
if (mutex)
mutex->Lock();
if (protocol) if (protocol)
protocol->Close(); protocol->Close();
if (mutex)
mutex->Unlock();
return true; return true;
} }

View File

@@ -3,7 +3,6 @@
* *
* See the README file for copyright information and how to reach the author. * See the README file for copyright information and how to reach the author.
* *
* $Id: streamer.h,v 1.16 2008/04/04 20:55:44 rahrenbe Exp $
*/ */
#ifndef __IPTV_STREAMER_H #ifndef __IPTV_STREAMER_H
@@ -20,13 +19,13 @@
class cIptvStreamer : public cThread, public cIptvStreamerStatistics { class cIptvStreamer : public cThread, public cIptvStreamerStatistics {
private: private:
cRingBufferLinear* ringBuffer; cRingBufferLinear* ringBuffer;
cMutex* mutex; cCondWait sleep;
unsigned char* readBuffer; unsigned char* packetBuffer;
unsigned int readBufferLen; unsigned int packetBufferLen;
cIptvProtocolIf* protocol; cIptvProtocolIf* protocol;
public: public:
cIptvStreamer(cRingBufferLinear* RingBuffer, cMutex* Mutex); cIptvStreamer(cRingBufferLinear* RingBuffer, unsigned int PacketLen);
virtual ~cIptvStreamer(); virtual ~cIptvStreamer();
virtual void Action(void); virtual void Action(void);
bool Set(const char* Location, const int Parameter, const int Index, cIptvProtocolIf* Protocol); bool Set(const char* Location, const int Parameter, const int Index, cIptvProtocolIf* Protocol);