From 06c0c9f6104cc03aa302efcdb7e637f073f09ccf Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Wed, 26 Oct 2005 21:33:31 +0000 Subject: [PATCH] Live TV priority overriding --- mvpclient.c | 20 +++++++++++++++++++- mvpreceiver.c | 24 ++++++++++++++---------- mvpreceiver.h | 2 +- 3 files changed, 34 insertions(+), 12 deletions(-) diff --git a/mvpclient.c b/mvpclient.c index 94430cc..b5d7346 100644 --- a/mvpclient.c +++ b/mvpclient.c @@ -422,7 +422,25 @@ void MVPClient::processStartStreamingChannel(UCHAR* data, int length) return; } - lp = MVPReceiver::create(channel); + // get the priority we should use + int fail = 1; + int priority = config.getValueLong("General", "Live priority", &fail); + if (!fail) + { + log->log("Client", Log::DEBUG, "Config: Live TV priority: %i", priority); + } + else + { + log->log("Client", Log::DEBUG, "Config: Live TV priority config fail"); + priority = 0; + } + + // a bit of sanity.. + if (priority < 0) priority = 0; + if (priority > 99) priority = 99; + + log->log("Client", Log::DEBUG, "Using live TV priority %i", priority); + lp = MVPReceiver::create(channel, priority); if (!lp) { diff --git a/mvpreceiver.c b/mvpreceiver.c index 6614304..34be52c 100755 --- a/mvpreceiver.c +++ b/mvpreceiver.c @@ -1,9 +1,9 @@ #include "mvpreceiver.h" -MVPReceiver* MVPReceiver::create(cChannel* channel) +MVPReceiver* MVPReceiver::create(cChannel* channel, int priority) { bool NeedsDetachReceivers; - cDevice* device = cDevice::GetDevice(channel, 0, &NeedsDetachReceivers); + cDevice* device = cDevice::GetDevice(channel, priority, &NeedsDetachReceivers); if (!device) { @@ -11,12 +11,16 @@ MVPReceiver* MVPReceiver::create(cChannel* channel) return NULL; } +/* if (NeedsDetachReceivers) { // can't really happen since we stream with priority zero. if a rec has pri zero maybe Log::getInstance()->log("MVPReceiver", Log::DEBUG, "Needs detach receivers"); return NULL; } +*/ + + // What should we do if NeedsDetachReceivers is true? MVPReceiver* m = new MVPReceiver(channel, device); return m; @@ -51,16 +55,16 @@ MVPReceiver::MVPReceiver(cChannel* channel, cDevice* device) logger->log("MVPReceiver", Log::DEBUG, "Created new < 1.3 TS->PS"); // } #else - if ((channel->Vpid() == 0) || (channel->Vpid() == 1) || (channel->Vpid() == 0x1FFF)) - { - remuxer = new cTS2ESRemux(channel->Apid(0)); - logger->log("MVPReceiver", Log::DEBUG, "Created new > 1.3 TS->ES"); - } - else - { +// if ((channel->Vpid() == 0) || (channel->Vpid() == 1) || (channel->Vpid() == 0x1FFF)) +// { +// remuxer = new cTS2ESRemux(channel->Apid(0)); +// logger->log("MVPReceiver", Log::DEBUG, "Created new > 1.3 TS->ES"); +// } +// else +// { remuxer = new cTS2PSRemux(channel->Vpid(), channel->Apid(0), 0, 0, 0, 0); logger->log("MVPReceiver", Log::DEBUG, "Created new > 1.3 TS->PS"); - } +// } #endif unprocessed = new cRingBufferLinear(1000000, TS_SIZE * 2, false); diff --git a/mvpreceiver.h b/mvpreceiver.h index 2d1440d..2606877 100755 --- a/mvpreceiver.h +++ b/mvpreceiver.h @@ -37,7 +37,7 @@ class MVPReceiver : public cReceiver, public Thread { public: - static MVPReceiver* create(cChannel*); + static MVPReceiver* create(cChannel*, int priority); virtual ~MVPReceiver(); int init(); unsigned long getBlock(unsigned char* buffer, unsigned long amount); -- 2.39.2