Adapt decryption for vdr-2.3.4 (Thanks to Klaus Schmidinger).

This commit is contained in:
Rolf Ahrenberg 2017-04-17 22:10:29 +03:00
parent c5da1074f3
commit c6145e1ed9
5 changed files with 31 additions and 21 deletions

View File

@ -174,3 +174,7 @@ VDR Plugin 'satip' Revision History
- Added multicast and RTP-over-TCP support. - Added multicast and RTP-over-TCP support.
- Added support for activating/deactivating server on-the-fly. - Added support for activating/deactivating server on-the-fly.
- Extended command-line parameters for setting server quirks. - Extended command-line parameters for setting server quirks.
2017-xx-xx: Version 2.3.1
- Updated for vdr-2.3.4 (Thanks to Klaus Schmidinger).

View File

@ -17,8 +17,9 @@ static cSatipDevice * SatipDevicesS[SATIP_MAX_DEVICES] = { NULL };
cSatipDevice::cSatipDevice(unsigned int indexP) cSatipDevice::cSatipDevice(unsigned int indexP)
: deviceIndexM(indexP), : deviceIndexM(indexP),
isPacketDeliveredM(false), bytesDeliveredM(0),
isOpenDvrM(false), isOpenDvrM(false),
checkTsBufferM(false),
deviceNameM(*cString::sprintf("%s %d", *DeviceType(), deviceIndexM)), deviceNameM(*cString::sprintf("%s %d", *DeviceType(), deviceIndexM)),
channelM(), channelM(),
createdM(0), createdM(0),
@ -395,7 +396,7 @@ void cSatipDevice::CloseFilter(int handleP)
bool cSatipDevice::OpenDvr(void) bool cSatipDevice::OpenDvr(void)
{ {
debug9("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); debug9("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
isPacketDeliveredM = false; bytesDeliveredM = 0;
tsBufferM->Clear(); tsBufferM->Clear();
if (pTunerM) if (pTunerM)
pTunerM->Open(); pTunerM->Open();
@ -481,13 +482,17 @@ bool cSatipDevice::IsIdle(void)
return !Receiving(); return !Receiving();
} }
uchar *cSatipDevice::GetData(int *availableP) uchar *cSatipDevice::GetData(int *availableP, bool checkTsBuffer)
{ {
debug16("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); debug16("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
if (isOpenDvrM && tsBufferM) { if (isOpenDvrM && tsBufferM) {
int count = 0; int count = 0;
if (isPacketDeliveredM) if (bytesDeliveredM) {
SkipData(TS_SIZE); tsBufferM->Del(bytesDeliveredM);
bytesDeliveredM = 0;
}
if (checkTsBuffer && tsBufferM->Available() < TS_SIZE)
return NULL;
uchar *p = tsBufferM->Get(count); uchar *p = tsBufferM->Get(count);
if (p && count >= TS_SIZE) { if (p && count >= TS_SIZE) {
if (*p != TS_SYNC_BYTE) { if (*p != TS_SYNC_BYTE) {
@ -501,7 +506,7 @@ uchar *cSatipDevice::GetData(int *availableP)
info("Skipped %d bytes to sync on TS packet", count); info("Skipped %d bytes to sync on TS packet", count);
return NULL; return NULL;
} }
isPacketDeliveredM = true; bytesDeliveredM = TS_SIZE;
if (availableP) if (availableP)
*availableP = count; *availableP = count;
// Update pid statistics // Update pid statistics
@ -515,8 +520,7 @@ uchar *cSatipDevice::GetData(int *availableP)
void cSatipDevice::SkipData(int countP) void cSatipDevice::SkipData(int countP)
{ {
debug16("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); debug16("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
tsBufferM->Del(countP); bytesDeliveredM = countP;
isPacketDeliveredM = false;
// Update buffer statistics // Update buffer statistics
AddBufferStatistic(countP, tsBufferM->Available()); AddBufferStatistic(countP, tsBufferM->Available());
} }
@ -530,11 +534,12 @@ bool cSatipDevice::GetTSPacket(uchar *&dataP)
if (cCamSlot *cs = CamSlot()) { if (cCamSlot *cs = CamSlot()) {
if (cs->WantsTsData()) { if (cs->WantsTsData()) {
int available; int available;
dataP = GetData(&available); dataP = GetData(&available, checkTsBufferM);
if (dataP) { if (!dataP)
dataP = cs->Decrypt(dataP, available); available = 0;
SkipData(available); dataP = cs->Decrypt(dataP, available);
} SkipData(available);
checkTsBufferM = dataP != NULL;
return true; return true;
} }
} }

View File

@ -31,8 +31,9 @@ private:
eReadyTimeoutMs = 2000 // in milliseconds eReadyTimeoutMs = 2000 // in milliseconds
}; };
unsigned int deviceIndexM; unsigned int deviceIndexM;
bool isPacketDeliveredM; int bytesDeliveredM;
bool isOpenDvrM; bool isOpenDvrM;
bool checkTsBufferM;
cString deviceNameM; cString deviceNameM;
cChannel channelM; cChannel channelM;
cRingBufferLinear *tsBufferM; cRingBufferLinear *tsBufferM;
@ -82,7 +83,7 @@ protected:
// for recording // for recording
private: private:
uchar *GetData(int *availableP = NULL); uchar *GetData(int *availableP = NULL, bool checkTsBuffer = false);
void SkipData(int countP); void SkipData(int countP);
protected: protected:

View File

@ -7,14 +7,14 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: vdr-satip 2.3.0\n" "Project-Id-Version: vdr-satip 2.3.0\n"
"Report-Msgid-Bugs-To: <see README>\n" "Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2017-02-27 23:41+0100\n" "POT-Creation-Date: 2017-04-17 22:02+0300\n"
"PO-Revision-Date: 2017-02-28 14:22+0100\n" "PO-Revision-Date: 2017-02-28 14:22+0100\n"
"Last-Translator: Tomasz Maciej Nowak <tomek_n@o2.pl>\n"
"Language-Team: Polish <vdr@linuxtv.org>\n"
"Language: pl_PL\n" "Language: pl_PL\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Last-Translator: Tomasz Maciej Nowak <tomek_n@o2.pl>\n"
"Language-Team: Polish <vdr@linuxtv.org>\n"
"X-Generator: Poedit 1.8.11\n" "X-Generator: Poedit 1.8.11\n"
msgid "PAT (0x00)" msgid "PAT (0x00)"

View File

@ -19,15 +19,15 @@
#warning "CURL version >= 7.36.0 is recommended" #warning "CURL version >= 7.36.0 is recommended"
#endif #endif
#if defined(APIVERSNUM) && APIVERSNUM < 20301 #if defined(APIVERSNUM) && APIVERSNUM < 20304
#error "VDR-2.3.1 API version or greater is required!" #error "VDR-2.3.4 API version or greater is required!"
#endif #endif
#ifndef GITVERSION #ifndef GITVERSION
#define GITVERSION "" #define GITVERSION ""
#endif #endif
const char VERSION[] = "2.3.0" GITVERSION; const char VERSION[] = "2.3.1" GITVERSION;
static const char DESCRIPTION[] = trNOOP("SAT>IP Devices"); static const char DESCRIPTION[] = trNOOP("SAT>IP Devices");
class cPluginSatip : public cPlugin { class cPluginSatip : public cPlugin {