Added initial CAM support.

This commit is contained in:
Rolf Ahrenberg 2014-01-28 17:10:11 +02:00
parent 3dcbff0a71
commit 0900e229cf
10 changed files with 67 additions and 27 deletions

View File

@ -225,3 +225,12 @@ VDR Plugin 'iptv' Revision History
- Made devices to shutdown already in cPluginManager::Stop()
to prevent possible crashes while VDR shutdown.
==================================
VDR Plugin 'iptv' Revision History
==================================
2014-XX-XX: Version 2.1.0
- Added initial CAM support.

View File

@ -409,39 +409,66 @@ unsigned int cIptvDevice::CheckData(void)
return 0;
}
bool cIptvDevice::GetTSPacket(uchar *&Data)
uchar *cIptvDevice::GetData(int *availableP)
{
//debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
if (isOpenDvrM && tsBufferM && !IsBuffering()) {
if (isPacketDeliveredM) {
tsBufferM->Del(TS_SIZE);
isPacketDeliveredM = false;
// Update buffer statistics
AddBufferStatistic(TS_SIZE, tsBufferM->Available());
}
int Count = 0;
uchar *p = tsBufferM->Get(Count);
if (p && Count >= TS_SIZE) {
int count = 0;
if (isPacketDeliveredM)
SkipData(TS_SIZE);
uchar *p = tsBufferM->Get(count);
if (p && count >= TS_SIZE) {
if (*p != TS_SYNC_BYTE) {
for (int i = 1; i < Count; i++) {
for (int i = 1; i < count; i++) {
if (p[i] == TS_SYNC_BYTE) {
Count = i;
count = i;
break;
}
}
tsBufferM->Del(Count);
error("Skipped %d bytes to sync on TS packet", Count);
return false;
tsBufferM->Del(count);
error("Skipped %d bytes to sync on TS packet", count);
return NULL;
}
isPacketDeliveredM = true;
Data = p;
if (availableP)
*availableP = count;
// Update pid statistics
AddPidStatistic(ts_pid(p), payload(p));
return true;
return p;
}
}
return NULL;
}
void cIptvDevice::SkipData(int countP)
{
//debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
tsBufferM->Del(countP);
isPacketDeliveredM = false;
// Update buffer statistics
AddBufferStatistic(countP, tsBufferM->Available());
}
bool cIptvDevice::GetTSPacket(uchar *&dataP)
{
//debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
if (tsBufferM) {
if (cCamSlot *cs = CamSlot()) {
if (cs->WantsTsData()) {
int available;
dataP = GetData(&available);
if (dataP) {
dataP = cs->Decrypt(dataP, available);
SkipData(available);
}
return true;
}
}
dataP = GetData();
return true;
}
// Reduce cpu load by preventing busylooping
cCondWait::SleepMs(10);
Data = NULL;
dataP = NULL;
return true;
}

View File

@ -96,6 +96,10 @@ protected:
virtual bool SetChannelDevice(const cChannel *channelP, bool liveViewP);
// for recording
private:
uchar *GetData(int *availableP = NULL);
void SkipData(int countP);
protected:
virtual bool SetPid(cPidHandle *handleP, int typeP, bool onP);
virtual bool OpenDvr(void);

6
iptv.c
View File

@ -13,15 +13,15 @@
#include "device.h"
#include "iptvservice.h"
#if defined(APIVERSNUM) && APIVERSNUM < 20000
#error "VDR-2.0.0 API version or greater is required!"
#if defined(APIVERSNUM) && APIVERSNUM < 20104
#error "VDR-2.1.4 API version or greater is required!"
#endif
#ifndef GITVERSION
#define GITVERSION ""
#endif
const char VERSION[] = "2.0.2" GITVERSION;
const char VERSION[] = "2.1.0" GITVERSION;
static const char DESCRIPTION[] = trNOOP("Experience the IPTV");
class cPluginIptv : public cPlugin {

View File

@ -5,7 +5,7 @@
#
msgid ""
msgstr ""
"Project-Id-Version: vdr-iptv 2.0.2\n"
"Project-Id-Version: vdr-iptv 2.1.0\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2014-01-08 01:18+0200\n"
"PO-Revision-Date: 2014-01-08 01:18+0200\n"

View File

@ -5,7 +5,7 @@
#
msgid ""
msgstr ""
"Project-Id-Version: vdr-iptv 2.0.2\n"
"Project-Id-Version: vdr-iptv 2.1.0\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2014-01-08 01:18+0200\n"
"PO-Revision-Date: 2014-01-08 01:18+0200\n"

View File

@ -6,7 +6,7 @@
#
msgid ""
msgstr ""
"Project-Id-Version: vdr-iptv 2.0.2\n"
"Project-Id-Version: vdr-iptv 2.1.0\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2014-01-08 01:18+0200\n"
"PO-Revision-Date: 2014-01-08 01:18+0200\n"

View File

@ -5,7 +5,7 @@
#
msgid ""
msgstr ""
"Project-Id-Version: vdr-iptv 2.0.2\n"
"Project-Id-Version: vdr-iptv 2.1.0\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2014-01-08 01:18+0200\n"
"PO-Revision-Date: 2014-01-08 01:18+0200\n"

View File

@ -5,7 +5,7 @@
#
msgid ""
msgstr ""
"Project-Id-Version: vdr-iptv 2.0.2\n"
"Project-Id-Version: vdr-iptv 2.1.0\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2014-01-08 01:18+0200\n"
"PO-Revision-Date: 2014-01-08 01:18+0200\n"

View File

@ -5,7 +5,7 @@
#
msgid ""
msgstr ""
"Project-Id-Version: vdr-iptv 2.0.2\n"
"Project-Id-Version: vdr-iptv 2.1.0\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2014-01-08 01:18+0200\n"
"PO-Revision-Date: 2014-01-08 01:18+0200\n"