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() - Made devices to shutdown already in cPluginManager::Stop()
to prevent possible crashes while VDR shutdown. 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; return 0;
} }
bool cIptvDevice::GetTSPacket(uchar *&Data) uchar *cIptvDevice::GetData(int *availableP)
{ {
//debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM); //debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
if (isOpenDvrM && tsBufferM && !IsBuffering()) { if (isOpenDvrM && tsBufferM && !IsBuffering()) {
if (isPacketDeliveredM) { int count = 0;
tsBufferM->Del(TS_SIZE); if (isPacketDeliveredM)
isPacketDeliveredM = false; SkipData(TS_SIZE);
// Update buffer statistics uchar *p = tsBufferM->Get(count);
AddBufferStatistic(TS_SIZE, tsBufferM->Available()); if (p && count >= TS_SIZE) {
}
int Count = 0;
uchar *p = tsBufferM->Get(Count);
if (p && Count >= TS_SIZE) {
if (*p != TS_SYNC_BYTE) { 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) { if (p[i] == TS_SYNC_BYTE) {
Count = i; count = i;
break; break;
} }
} }
tsBufferM->Del(Count); tsBufferM->Del(count);
error("Skipped %d bytes to sync on TS packet", Count); error("Skipped %d bytes to sync on TS packet", count);
return false; return NULL;
} }
isPacketDeliveredM = true; isPacketDeliveredM = true;
Data = p; if (availableP)
*availableP = count;
// Update pid statistics // Update pid statistics
AddPidStatistic(ts_pid(p), payload(p)); 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 // Reduce cpu load by preventing busylooping
cCondWait::SleepMs(10); cCondWait::SleepMs(10);
Data = NULL; dataP = NULL;
return true; return true;
} }

View File

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

6
iptv.c
View File

@ -13,15 +13,15 @@
#include "device.h" #include "device.h"
#include "iptvservice.h" #include "iptvservice.h"
#if defined(APIVERSNUM) && APIVERSNUM < 20000 #if defined(APIVERSNUM) && APIVERSNUM < 20104
#error "VDR-2.0.0 API version or greater is required!" #error "VDR-2.1.4 API version or greater is required!"
#endif #endif
#ifndef GITVERSION #ifndef GITVERSION
#define GITVERSION "" #define GITVERSION ""
#endif #endif
const char VERSION[] = "2.0.2" GITVERSION; const char VERSION[] = "2.1.0" GITVERSION;
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

@ -5,7 +5,7 @@
# #
msgid "" msgid ""
msgstr "" 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" "Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2014-01-08 01:18+0200\n" "POT-Creation-Date: 2014-01-08 01:18+0200\n"
"PO-Revision-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 "" msgid ""
msgstr "" 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" "Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2014-01-08 01:18+0200\n" "POT-Creation-Date: 2014-01-08 01:18+0200\n"
"PO-Revision-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 "" msgid ""
msgstr "" 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" "Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2014-01-08 01:18+0200\n" "POT-Creation-Date: 2014-01-08 01:18+0200\n"
"PO-Revision-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 "" msgid ""
msgstr "" 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" "Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2014-01-08 01:18+0200\n" "POT-Creation-Date: 2014-01-08 01:18+0200\n"
"PO-Revision-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 "" msgid ""
msgstr "" 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" "Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2014-01-08 01:18+0200\n" "POT-Creation-Date: 2014-01-08 01:18+0200\n"
"PO-Revision-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 "" msgid ""
msgstr "" 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" "Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2014-01-08 01:18+0200\n" "POT-Creation-Date: 2014-01-08 01:18+0200\n"
"PO-Revision-Date: 2014-01-08 01:18+0200\n" "PO-Revision-Date: 2014-01-08 01:18+0200\n"