mirror of
https://projects.vdr-developer.org/git/vdr-plugin-softhddevice.git
synced 2023-10-10 19:16:51 +02:00
Adds PIP channel switch functions.
This commit is contained in:
parent
8ee1e84b2e
commit
6a3a560857
@ -1505,6 +1505,7 @@ void cSoftReceiver::Receive(uchar * data, int size)
|
|||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
static cSoftReceiver *PipReceiver; ///< PIP receiver
|
static cSoftReceiver *PipReceiver; ///< PIP receiver
|
||||||
|
static const cChannel *PipChannel; ///< current PIP channel
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Prepare new PIP.
|
** Prepare new PIP.
|
||||||
@ -1530,6 +1531,7 @@ static void NewPip(void)
|
|||||||
device->AttachReceiver(receiver);
|
device->AttachReceiver(receiver);
|
||||||
fprintf(stderr, "pip: attached\n");
|
fprintf(stderr, "pip: attached\n");
|
||||||
PipReceiver = receiver;
|
PipReceiver = receiver;
|
||||||
|
PipChannel = channel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1539,9 +1541,72 @@ static void NewPip(void)
|
|||||||
static void DelPip(void)
|
static void DelPip(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "pip: stopped\n");
|
fprintf(stderr, "pip: stopped\n");
|
||||||
|
|
||||||
delete PipReceiver;
|
delete PipReceiver;
|
||||||
|
|
||||||
PipReceiver = NULL;
|
PipReceiver = NULL;
|
||||||
|
PipChannel = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
** Switch PIP to next available channel.
|
||||||
|
**
|
||||||
|
** @param direction direction of channel switch
|
||||||
|
*/
|
||||||
|
static void PipNextAvailableChannel(int direction)
|
||||||
|
{
|
||||||
|
const cChannel *channel;
|
||||||
|
|
||||||
|
channel = PipChannel;
|
||||||
|
while (channel) {
|
||||||
|
channel = direction > 0 ? Channels.Next(channel)
|
||||||
|
: Channels.Prev(channel);
|
||||||
|
if (!channel && Setup.ChannelsWrap) {
|
||||||
|
channel = direction > 0 ? Channels.First() : Channels.Last();
|
||||||
|
}
|
||||||
|
if (channel && !channel->GroupSep()
|
||||||
|
&& cDevice::GetDevice(channel, 1, false, true)) {
|
||||||
|
cDevice *device;
|
||||||
|
cSoftReceiver *receiver;
|
||||||
|
|
||||||
|
DelPip();
|
||||||
|
|
||||||
|
if ((device = cDevice::GetDevice(channel, 1, false))) {
|
||||||
|
fprintf(stderr, "pip: %p %p\n", channel, device);
|
||||||
|
|
||||||
|
delete PipReceiver;
|
||||||
|
|
||||||
|
PipReceiver = NULL;
|
||||||
|
|
||||||
|
device->SwitchChannel(channel, false);
|
||||||
|
receiver = new cSoftReceiver(channel);
|
||||||
|
device->AttachReceiver(receiver);
|
||||||
|
fprintf(stderr, "pip: attached\n");
|
||||||
|
PipReceiver = receiver;
|
||||||
|
PipChannel = channel;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
** Swap PIP channels.
|
||||||
|
*/
|
||||||
|
static void SwapPipChannels(void)
|
||||||
|
{
|
||||||
|
const cChannel *channel;
|
||||||
|
|
||||||
|
fprintf(stderr, "pip: switch channel\n");
|
||||||
|
|
||||||
|
channel = PipChannel;
|
||||||
|
|
||||||
|
DelPip();
|
||||||
|
NewPip();
|
||||||
|
|
||||||
|
if (channel) {
|
||||||
|
Channels.SwitchTo(channel->Number());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1824,6 +1889,15 @@ eOSState cSoftHdMenu::ProcessKey(eKeys key)
|
|||||||
case osUser2:
|
case osUser2:
|
||||||
NewPip();
|
NewPip();
|
||||||
return osEnd;
|
return osEnd;
|
||||||
|
case osUser4:
|
||||||
|
PipNextAvailableChannel(-1);
|
||||||
|
return osEnd;
|
||||||
|
case osUser5:
|
||||||
|
PipNextAvailableChannel(1);
|
||||||
|
return osEnd;
|
||||||
|
case osUser6:
|
||||||
|
SwapPipChannels();
|
||||||
|
return osEnd;
|
||||||
case osUser7:
|
case osUser7:
|
||||||
SwapPipPosition();
|
SwapPipPosition();
|
||||||
return osEnd;
|
return osEnd;
|
||||||
|
Loading…
Reference in New Issue
Block a user