mirror of
https://projects.vdr-developer.org/git/vdr-plugin-streamdev.git
synced 2023-10-10 19:16:51 +02:00
Reimplemented some client device methods
This commit is contained in:
parent
16f8c75918
commit
744dc6792c
1
HISTORY
1
HISTORY
@ -1,6 +1,7 @@
|
||||
VDR Plugin 'streamdev' Revision History
|
||||
---------------------------------------
|
||||
|
||||
- Reimplemented some client device methods
|
||||
- Proper fix for "client sends ABRT after TUNE". Obsoletes many hacks in client
|
||||
- Added CLOCK_MONOTONIC timestamp and thread id to Dprintf
|
||||
- Silenced warning (thanks to Rolf Ahrenberg)
|
||||
|
@ -84,23 +84,19 @@ bool cStreamdevDevice::IsTunedToTransponder(const cChannel *Channel) const
|
||||
bool cStreamdevDevice::IsTunedToTransponder(const cChannel *Channel)
|
||||
#endif
|
||||
{
|
||||
bool res = false;
|
||||
if (ClientSocket.DataSocket(siLive) != NULL
|
||||
&& TRANSPONDER(Channel, m_Channel)
|
||||
&& Channel->Ca() == CA_FTA
|
||||
&& m_Channel->Ca() == CA_FTA)
|
||||
res = true;
|
||||
return res;
|
||||
return ClientSocket.DataSocket(siLive) != NULL &&
|
||||
m_Channel != NULL &&
|
||||
Channel->Transponder() == m_Channel->Transponder();
|
||||
}
|
||||
|
||||
bool cStreamdevDevice::ProvidesChannel(const cChannel *Channel, int Priority,
|
||||
bool *NeedsDetachReceivers) const {
|
||||
bool res = false;
|
||||
#if APIVERSNUM >= 10725
|
||||
bool prio = Priority == IDLEPRIORITY || Priority >= this->Priority();
|
||||
#else
|
||||
bool prio = Priority < 0 || Priority > this->Priority();
|
||||
#endif
|
||||
bool res = prio;
|
||||
bool ndr = false;
|
||||
|
||||
if (!StreamdevClientSetup.StartClient || Channel == m_DenyChannel)
|
||||
@ -121,29 +117,31 @@ bool cStreamdevDevice::ProvidesChannel(const cChannel *Channel, int Priority,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ClientSocket.DataSocket(siLive) != NULL
|
||||
&& TRANSPONDER(Channel, m_Channel))
|
||||
if (IsTunedToTransponder(Channel)) {
|
||||
if (Channel->Ca() < CA_ENCRYPTED_MIN ||
|
||||
(Channel->Vpid() && HasPid(Channel->Vpid())) ||
|
||||
(Channel->Apid(0) && HasPid(Channel->Apid(0))))
|
||||
res = true;
|
||||
else {
|
||||
if (Priority == LIVEPRIORITY)
|
||||
{
|
||||
if (ClientSocket.ServerVersion() >= 100)
|
||||
{
|
||||
else
|
||||
ndr = true;
|
||||
}
|
||||
else if (prio) {
|
||||
if (Priority == LIVEPRIORITY) {
|
||||
if (ClientSocket.ServerVersion() >= 100) {
|
||||
Priority = StreamdevClientSetup.LivePriority;
|
||||
UpdatePriority(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
if (StreamdevClientSetup.LivePriority >= 0)
|
||||
Priority = StreamdevClientSetup.LivePriority;
|
||||
}
|
||||
}
|
||||
|
||||
res = prio && ClientSocket.ProvidesChannel(Channel, Priority);
|
||||
res = ClientSocket.ProvidesChannel(Channel, Priority);
|
||||
ndr = Receiving();
|
||||
|
||||
if (ClientSocket.ServerVersion() >= 100)
|
||||
UpdatePriority(false);
|
||||
ndr = true;
|
||||
}
|
||||
|
||||
if (NeedsDetachReceivers)
|
||||
@ -154,6 +152,7 @@ bool cStreamdevDevice::ProvidesChannel(const cChannel *Channel, int Priority,
|
||||
|
||||
bool cStreamdevDevice::SetChannelDevice(const cChannel *Channel,
|
||||
bool LiveView) {
|
||||
bool res;
|
||||
Dprintf("SetChannelDevice Channel: %s, LiveView: %s\n", Channel->Name(),
|
||||
LiveView ? "true" : "false");
|
||||
LOCK_THREAD;
|
||||
@ -161,17 +160,23 @@ bool cStreamdevDevice::SetChannelDevice(const cChannel *Channel,
|
||||
if (LiveView)
|
||||
return false;
|
||||
|
||||
if (ClientSocket.DataSocket(siLive) != NULL
|
||||
&& TRANSPONDER(Channel, m_Channel)
|
||||
&& Channel->Ca() == CA_FTA
|
||||
&& m_Channel->Ca() == CA_FTA)
|
||||
return true;
|
||||
|
||||
if (Receiving() && IsTunedToTransponder(Channel) && (
|
||||
Channel->Ca() < CA_ENCRYPTED_MIN ||
|
||||
(Channel->Vpid() && HasPid(Channel->Vpid())) ||
|
||||
(Channel->Apid(0) && HasPid(Channel->Apid(0))))) {
|
||||
res = true;
|
||||
}
|
||||
else {
|
||||
DetachAllReceivers();
|
||||
m_Channel = Channel;
|
||||
bool r = ClientSocket.SetChannelDevice(m_Channel);
|
||||
Dprintf("setchanneldevice r=%d\n", r);
|
||||
return r;
|
||||
// Old servers delete cStreamdevLiveStreamer in ABRT.
|
||||
// Delete it now or it will happen after we tuned to new channel
|
||||
if (ClientSocket.ServerVersion() < 100)
|
||||
CloseDvr();
|
||||
res = ClientSocket.SetChannelDevice(m_Channel);
|
||||
}
|
||||
Dprintf("setchanneldevice res=%d\n", res);
|
||||
return res;
|
||||
}
|
||||
|
||||
bool cStreamdevDevice::SetPid(cPidHandle *Handle, int Type, bool On) {
|
||||
|
6
common.h
6
common.h
@ -29,12 +29,6 @@
|
||||
#define Dprintf(x...)
|
||||
#endif
|
||||
|
||||
#if APIVERSNUM >= 10714
|
||||
#define TRANSPONDER(c1, c2) (c1->Transponder() == c2->Transponder() && !c1->IsSourceType('V'))
|
||||
#else
|
||||
#define TRANSPONDER(c1, c2) (c1->Transponder() == c2->Transponder())
|
||||
#endif
|
||||
|
||||
#define MAXPARSEBUFFER KILOBYTE(16)
|
||||
|
||||
/* Service ID for loop prevention */
|
||||
|
Loading…
Reference in New Issue
Block a user