mirror of
https://projects.vdr-developer.org/git/vdr-plugin-softhddevice.git
synced 2023-10-10 19:16:51 +02:00
Switch PIP to only available channels.
This commit is contained in:
parent
7cc74795be
commit
55587c86f0
@ -912,6 +912,7 @@ eOSState cMenuSetupSoft::ProcessKey(eKeys key)
|
|||||||
int old_general;
|
int old_general;
|
||||||
int old_video;
|
int old_video;
|
||||||
int old_audio;
|
int old_audio;
|
||||||
|
|
||||||
#ifdef USE_PIP
|
#ifdef USE_PIP
|
||||||
int old_pip;
|
int old_pip;
|
||||||
#endif
|
#endif
|
||||||
@ -1311,6 +1312,7 @@ cSoftHdControl::~cSoftHdControl()
|
|||||||
|
|
||||||
#ifdef USE_PIP
|
#ifdef USE_PIP
|
||||||
|
|
||||||
|
extern "C" void DelPip(void); ///< remove PIP
|
||||||
static int PipAltPosition; ///< flag alternative position
|
static int PipAltPosition; ///< flag alternative position
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
@ -1337,10 +1339,10 @@ class cSoftReceiver:public cReceiver
|
|||||||
**
|
**
|
||||||
** @param channel channel to receive.
|
** @param channel channel to receive.
|
||||||
*/
|
*/
|
||||||
cSoftReceiver::cSoftReceiver(const cChannel * channel):cReceiver(channel,
|
cSoftReceiver::cSoftReceiver(const cChannel * channel):cReceiver(NULL,
|
||||||
LIVEPRIORITY)
|
MINPRIORITY)
|
||||||
{
|
{
|
||||||
SetPids(NULL); // clear all pids, we want video only
|
// clear all pids done above, we want video only
|
||||||
AddPid(channel->Vpid());
|
AddPid(channel->Vpid());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1423,7 +1425,8 @@ static void PipPesParse(const uint8_t * data, int size, int is_start)
|
|||||||
}
|
}
|
||||||
if (pes_buf[0] || pes_buf[1] || pes_buf[2] != 0x01) {
|
if (pes_buf[0] || pes_buf[1] || pes_buf[2] != 0x01) {
|
||||||
// FIXME: first should always fail
|
// FIXME: first should always fail
|
||||||
esyslog(tr("[softhddev]pip: invalid pes packet %d\n"), pes_index);
|
esyslog(tr("[softhddev]pip: invalid pes packet %d\n"),
|
||||||
|
pes_index);
|
||||||
} else {
|
} else {
|
||||||
PipPlayVideo(pes_buf, pes_index);
|
PipPlayVideo(pes_buf, pes_index);
|
||||||
// FIXME: buffer full: pes packet is dropped
|
// FIXME: buffer full: pes packet is dropped
|
||||||
@ -1496,7 +1499,8 @@ void cSoftReceiver::Receive(uchar * data, int size)
|
|||||||
payload = 5 + p[4];
|
payload = 5 + p[4];
|
||||||
// illegal length, ignore packet
|
// illegal length, ignore packet
|
||||||
if (payload >= TS_PACKET_SIZE) {
|
if (payload >= TS_PACKET_SIZE) {
|
||||||
dsyslog("[softhddev]tsdemux: illegal adaption field length\n");
|
dsyslog
|
||||||
|
("[softhddev]tsdemux: illegal adaption field length\n");
|
||||||
goto next_packet;
|
goto next_packet;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1531,11 +1535,9 @@ static void NewPip(int channel_nr)
|
|||||||
channel_nr = cDevice::CurrentChannel();
|
channel_nr = cDevice::CurrentChannel();
|
||||||
}
|
}
|
||||||
if (channel_nr && (channel = Channels.GetByNumber(channel_nr))
|
if (channel_nr && (channel = Channels.GetByNumber(channel_nr))
|
||||||
&& (device = cDevice::GetDevice(channel, 1, false))) {
|
&& (device = cDevice::GetDevice(channel, 0, false, false))) {
|
||||||
|
|
||||||
delete PipReceiver;
|
DelPip();
|
||||||
|
|
||||||
PipReceiver = NULL;
|
|
||||||
|
|
||||||
device->SwitchChannel(channel, false);
|
device->SwitchChannel(channel, false);
|
||||||
receiver = new cSoftReceiver(channel);
|
receiver = new cSoftReceiver(channel);
|
||||||
@ -1563,11 +1565,16 @@ extern "C" void DelPip(void)
|
|||||||
static void TogglePip(void)
|
static void TogglePip(void)
|
||||||
{
|
{
|
||||||
if (PipReceiver) {
|
if (PipReceiver) {
|
||||||
|
int attached;
|
||||||
|
|
||||||
|
attached = PipReceiver->IsAttached();
|
||||||
DelPip();
|
DelPip();
|
||||||
} else {
|
if (attached) { // turn off only if last PIP was on
|
||||||
NewPip(PipChannelNr);
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
NewPip(PipChannelNr);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Switch PIP to next available channel.
|
** Switch PIP to next available channel.
|
||||||
@ -1577,21 +1584,31 @@ static void TogglePip(void)
|
|||||||
static void PipNextAvailableChannel(int direction)
|
static void PipNextAvailableChannel(int direction)
|
||||||
{
|
{
|
||||||
const cChannel *channel;
|
const cChannel *channel;
|
||||||
|
const cChannel *first;
|
||||||
|
|
||||||
channel = PipChannel;
|
channel = PipChannel;
|
||||||
|
first = channel;
|
||||||
while (channel) {
|
while (channel) {
|
||||||
|
bool ndr;
|
||||||
|
cDevice *device;
|
||||||
|
|
||||||
channel = direction > 0 ? Channels.Next(channel)
|
channel = direction > 0 ? Channels.Next(channel)
|
||||||
: Channels.Prev(channel);
|
: Channels.Prev(channel);
|
||||||
if (!channel && Setup.ChannelsWrap) {
|
if (!channel && Setup.ChannelsWrap) {
|
||||||
channel = direction > 0 ? Channels.First() : Channels.Last();
|
channel = direction > 0 ? Channels.First() : Channels.Last();
|
||||||
}
|
}
|
||||||
if (channel && !channel->GroupSep()
|
if (channel && !channel->GroupSep()
|
||||||
&& cDevice::GetDevice(channel, 1, false, true)) {
|
&& (device = cDevice::GetDevice(channel, 0, false, true))
|
||||||
|
&& device->ProvidesChannel(channel, 0, &ndr) && !ndr) {
|
||||||
|
|
||||||
DelPip();
|
DelPip();
|
||||||
NewPip(channel->Number());
|
NewPip(channel->Number());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (channel == first) {
|
||||||
|
Skins.Message(mtError, tr("Channel not available!"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user