more pip changes

Origin commit data
------------------
Commit: 019fadbe29
Author: BPanther <bpanther_ts@hotmail.com>
Date: 2021-10-15 (Fri, 15 Oct 2021)
This commit is contained in:
BPanther
2021-10-15 14:55:29 +02:00
committed by vanhofen
parent 1fc8de297d
commit 40947e8c60
3 changed files with 44 additions and 36 deletions

View File

@@ -199,8 +199,9 @@ class CZapitMessages
t_channel_id channel_id;
bool record;
bool pip;
int pip_dev;
bool epg;
commandZaptoServiceID():channel_id(0),record(false),pip(false),epg(false){}
commandZaptoServiceID():channel_id(0), record(false), pip(false), pip_dev(0), epg(false){}
};
struct commandZaptoEpg
{

View File

@@ -213,6 +213,7 @@ unsigned int CZapitClient::zapTo_pip(const t_channel_id channel_id, int pip)
msg.channel_id = channel_id;
msg.record = false;
msg.pip = true;
msg.pip_dev = pip;
msg.epg = false;
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);

View File

@@ -691,16 +691,16 @@ bool CZapit::StopPip(int pip)
}
#endif
if (pip_channel_id[0]) {
INFO("[pip] stop %llx", pip_channel_id);
if (pip_channel_id[pip]) {
INFO("[pip] stop %llx", pip_channel_id[pip]);
#if !HAVE_CST_HARDWARE
pipVideoDecoder[0]->ShowPig(0);
pipVideoDecoder[pip]->ShowPig(0);
#endif
CCamManager::getInstance()->Stop(pip_channel_id, CCamManager::PIP);
pipVideoDemux[0]->Stop();
pipVideoDecoder[0]->Stop();
pip_fe[0] = NULL;
pip_channel_id[0] = 0;
CCamManager::getInstance()->Stop(pip_channel_id[pip], CCamManager::PIP);
pipVideoDemux[pip]->Stop();
pipVideoDecoder[pip]->Stop();
pip_fe[pip] = NULL;
pip_channel_id[pip] = 0;
return true;
}
return false;
@@ -745,7 +745,7 @@ bool CZapit::StartPip(const t_channel_id channel_id, int pip)
if(!ParsePatPmt(newchannel))
return false;
pip_fe[0] = frontend;
pip_fe[pip] = frontend;
#if HAVE_CST_HARDWARE
INFO("[pip] vpid %X apid %X pcr %X", newchannel->getVideoPid(), newchannel->getAudioPid(), newchannel->getPcrPid());
@@ -765,41 +765,41 @@ bool CZapit::StartPip(const t_channel_id channel_id, int pip)
cDemux::SetSource(dnum, pip_fe->getNumber());
#else
#ifdef DYNAMIC_DEMUX
int dnum = CFEManager::getInstance()->getDemux(newchannel->getTransponderId(), pip_fe[0]->getNumber());
int dnum = CFEManager::getInstance()->getDemux(newchannel->getTransponderId(), pip_fe[pip]->getNumber());
INFO("[pip] dyn demux: %d", dnum);
#else
/* FIXME until proper demux management */
int dnum = 1;
int dnum = pip + 1;
INFO("[pip] demux: %d", dnum);
#endif
INFO("[pip] vpid %X apid %X pcr %X", newchannel->getVideoPid(), newchannel->getAudioPid(), newchannel->getPcrPid());
if (!pipVideoDemux[0]) {
pipVideoDemux[0] = new cDemux(dnum);
pipVideoDemux[0]->Open(DMX_VIDEO_CHANNEL);
if (!pipVideoDecoder[0]) {
pipVideoDecoder[0] = new cVideo(0, NULL, NULL, dnum);
if (!pipVideoDemux[pip]) {
pipVideoDemux[pip] = new cDemux(dnum);
pipVideoDemux[pip]->Open(DMX_VIDEO_CHANNEL);
if (!pipVideoDecoder[pip]) {
pipVideoDecoder[pip] = new cVideo(0, NULL, NULL, dnum);
}
}
pipVideoDemux[0]->SetSource(dnum, pip_fe[0]->getNumber());
pipVideoDemux[pip]->SetSource(dnum, pip_fe[pip]->getNumber());
newchannel->setPipDemux(dnum);
newchannel->setRecordDemux(pip_fe[0]->getNumber());
newchannel->setRecordDemux(pip_fe[pip]->getNumber());
#endif
pipVideoDecoder[0]->SetStreamType((VIDEO_FORMAT)newchannel->type);
pipVideoDemux[0]->pesFilter(newchannel->getVideoPid());
pipVideoDecoder[pip]->SetStreamType((VIDEO_FORMAT) newchannel->type);
pipVideoDemux[pip]->pesFilter(newchannel->getVideoPid());
#if HAVE_CST_HARDWARE
pipVideoDecoder[0]->Start(0, newchannel->getPcrPid(), newchannel->getVideoPid());
pipVideoDemux[0]->Start();
pip_channel_id = channel_id;
pipVideoDecoder[pip]->Start(0, newchannel->getPcrPid(), newchannel->getVideoPid());
pipVideoDemux[pip]->Start();
pip_channel_id[pip] = channel_id;
#else
pipVideoDemux[0]->Start();
pipVideoDecoder[0]->Start(0, newchannel->getPcrPid(), newchannel->getVideoPid());
pip_channel_id[0] = newchannel->getChannelID();
pipVideoDemux[pip]->Start();
pipVideoDecoder[pip]->Start(0, newchannel->getPcrPid(), newchannel->getVideoPid());
pip_channel_id[pip] = newchannel->getChannelID();
pipVideoDecoder[0]->Pig(g_settings.pip_x,g_settings.pip_y,g_settings.pip_width,g_settings.pip_height,g_settings.screen_width,g_settings.screen_height);
pipVideoDecoder[0]->ShowPig(1);
pipVideoDecoder[pip]->Pig(g_settings.pip_x,g_settings.pip_y,g_settings.pip_width,g_settings.pip_height,g_settings.screen_width,g_settings.screen_height);
pipVideoDecoder[pip]->ShowPig(1);
#endif
CCamManager::getInstance()->Start(newchannel->getChannelID(), CCamManager::PIP);
@@ -1286,7 +1286,7 @@ bool CZapit::ParseCommand(CBasicMessage::Header &rmsg, int connfd)
msgResponseZapComplete.zapStatus = ZapForRecord(msgZaptoServiceID.channel_id);
#ifdef ENABLE_PIP
else if(msgZaptoServiceID.pip)
msgResponseZapComplete.zapStatus = StartPip(msgZaptoServiceID.channel_id);
msgResponseZapComplete.zapStatus = StartPip(msgZaptoServiceID.channel_id, msgZaptoServiceID.pip_dev);
#endif
else
msgResponseZapComplete.zapStatus = ZapTo(msgZaptoServiceID.channel_id, (rmsg.cmd == CZapitMessages::CMD_ZAPTO_SUBSERVICEID));
@@ -2624,8 +2624,11 @@ bool CZapit::Start(Z_start_arg *ZapStart_arg)
pipVideoDemux[0]->Open(DMX_PIP_CHANNEL);
pipVideoDecoder[0] = new cVideo(video_mode, pipVideoDemux[0]->getChannel(), pipVideoDemux[0]->getBuffer(), 1);
#else
pipVideoDecoder[0] = new cVideo(0, NULL, NULL, 1);
pipVideoDecoder[0]->ShowPig(0);
for (unsigned i=0; i < (unsigned int) g_info.hw_caps->pip_devs; i++)
{
pipVideoDecoder[i] = new cVideo(0, NULL, NULL, i+1);
pipVideoDecoder[i]->ShowPig(0);
}
#endif
}
#endif
@@ -2843,10 +2846,13 @@ void CZapit::run()
delete audioDemux;
#ifdef ENABLE_PIP
StopPip();
if (pipVideoDecoder[0])
pipVideoDecoder[0] = NULL;
if (pipVideoDemux[0])
pipVideoDemux[0] = NULL;
for (unsigned i=0; i < (unsigned int) g_info.hw_caps->pip_devs; i++)
{
if (pipVideoDecoder[i])
pipVideoDecoder[i] = NULL;
if (pipVideoDemux[i])
pipVideoDemux[i] = NULL;
}
#endif
INFO("demuxes/decoders deleted");