Skip to content

Commit

Permalink
e4hdultra: fix pip (first start)
Browse files Browse the repository at this point in the history
  • Loading branch information
BPanther committed Oct 9, 2023
1 parent 00c7310 commit 7204baa
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 34 deletions.
2 changes: 1 addition & 1 deletion src/zapit/include/zapit/zapit.h
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ class CZapit : public OpenThreads::Thread
int SetVolumePercent(int percent);
void SetVolumePercent(int default_ac3, int default_pcm);
#ifdef ENABLE_PIP
bool OpenPip(int pip = 0);
bool OpenPip(int pip = 0, int dnum = -1);
bool StartPip(const t_channel_id channel_id, int pip = 0);
bool StopPip(int pip = 0);
#endif
Expand Down
61 changes: 28 additions & 33 deletions src/zapit/src/zapit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -651,18 +651,34 @@ bool CZapit::ZapIt(const t_channel_id channel_id, bool forupdate, bool startplay
}

#ifdef ENABLE_PIP
bool CZapit::OpenPip(int pip)
bool CZapit::OpenPip(int pip, int dnum)
{
if (!g_info.hw_caps->can_pip)
return false;

pipVideoDecoder[pip] = new cVideo(0, NULL, NULL, pip+1);
pipVideoDecoder[pip]->ShowPig(0);
pipVideoDemux[pip] = new cDemux(pip+1);
pipVideoDemux[pip]->Open(DMX_VIDEO_CHANNEL);
pipAudioDecoder[pip] = new cAudio(0, NULL, NULL, pip+1);
pipAudioDemux[pip] = new cDemux(pip+1);
pipAudioDemux[pip]->Open(DMX_AUDIO_CHANNEL);
if (dnum == -1)
dnum = pip + 1;

if (!pipVideoDecoder[pip])
{
pipVideoDecoder[pip] = new cVideo(0, NULL, NULL, dnum);
pipVideoDecoder[pip]->ShowPig(0);
}
if (!pipVideoDemux[pip])
{
pipVideoDemux[pip] = new cDemux(dnum);
pipVideoDemux[pip]->Open(DMX_VIDEO_CHANNEL);
}
if (!pipAudioDecoder[pip])
{
pipAudioDecoder[pip] = new cAudio(0, NULL, NULL, dnum);
}
if (!pipAudioDemux[pip])
{
pipAudioDemux[pip] = new cDemux(dnum);
pipAudioDemux[pip]->Open(DMX_AUDIO_CHANNEL);
}
return true;
}

bool CZapit::StopPip(int pip)
Expand Down Expand Up @@ -708,7 +724,6 @@ bool CZapit::StopPip(int pip)
delete pipAudioDecoder[pip];
pipAudioDecoder[pip] = NULL;
}

return true;
}

Expand All @@ -721,14 +736,6 @@ bool CZapit::StartPip(const t_channel_id channel_id, int pip)
StopPip(0);
}

pipVideoDecoder[pip] = new cVideo(0, NULL, NULL, pip+1);
pipVideoDecoder[pip]->ShowPig(0);
pipVideoDemux[pip] = new cDemux(pip+1);
pipVideoDemux[pip]->Open(DMX_VIDEO_CHANNEL);
pipAudioDecoder[pip] = new cAudio(0, NULL, NULL, pip+1);
pipAudioDemux[pip] = new cDemux(pip+1);
pipAudioDemux[pip]->Open(DMX_AUDIO_CHANNEL);

CZapitChannel* newchannel;
bool transponder_change;
/* do lock if live is running, or in record mode -
Expand All @@ -753,7 +760,9 @@ bool CZapit::StartPip(const t_channel_id channel_id, int pip)
ERROR("Cannot get frontend\n");
return false;
}

StopPip(pip);

if (!need_lock && !SAME_TRANSPONDER(newchannel->getChannelID(), live_channel_id))
live_channel_id = newchannel->getChannelID();

Expand All @@ -775,13 +784,7 @@ bool CZapit::StartPip(const t_channel_id channel_id, int pip)
#endif

INFO("[pip %d] vpid %X apid %X pcr %X", pip, newchannel->getVideoPid(), newchannel->getAudioPid(), newchannel->getPcrPid());
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);
}
}
OpenPip(pip, dnum);

pipVideoDemux[pip]->SetSource(dnum, pip_fe[pip]->getNumber());
newchannel->setPipDemux(dnum);
Expand All @@ -793,17 +796,9 @@ bool CZapit::StartPip(const t_channel_id channel_id, int pip)
pipVideoDecoder[pip]->Start(0, newchannel->getPcrPid(), newchannel->getVideoPid());
pip_channel_id[pip] = newchannel->getChannelID();

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]->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);

if (!pipAudioDemux[pip]) {
pipAudioDemux[pip] = new cDemux(dnum);
pipAudioDemux[pip]->Open(DMX_AUDIO_CHANNEL);
if (!pipAudioDecoder[pip]) {
pipAudioDecoder[pip] = new cAudio(0, NULL, NULL, dnum);
}
}

if (newchannel->getAudioChannel())
pipAudioDecoder[pip]->SetStreamType(newchannel->getAudioChannel()->audioChannelType);
pipAudioDemux[pip]->pesFilter(newchannel->getAudioPid());
Expand Down

0 comments on commit 7204baa

Please sign in to comment.