From 6d7d1ed37faa8230336097b512d24c5429df7b05 Mon Sep 17 00:00:00 2001 From: TangoCash Date: Sat, 29 May 2021 21:16:57 +0200 Subject: [PATCH] use autodetect pip Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/7c76af8a9d262a23218c73dd1cf54bb1eeccb512 Author: TangoCash Date: 2021-05-29 (Sat, 29 May 2021) --- src/gui/videosettings.cpp | 11 +++++++---- src/neutrino.cpp | 23 +++++++++++++++++------ src/neutrino_menue.cpp | 2 +- src/zapit/src/zapit.cpp | 34 +++++++++++++++++++++++----------- 4 files changed, 48 insertions(+), 22 deletions(-) diff --git a/src/gui/videosettings.cpp b/src/gui/videosettings.cpp index 1c5923952..73cfabff8 100644 --- a/src/gui/videosettings.cpp +++ b/src/gui/videosettings.cpp @@ -530,7 +530,7 @@ int CVideoSettings::showVideoSetup() #endif #ifdef ENABLE_PIP CPipSetup pip; - CMenuForwarder * pipsetup = new CMenuForwarder(LOCALE_VIDEOMENU_PIP, true, NULL, &pip); + CMenuForwarder * pipsetup = new CMenuForwarder(LOCALE_VIDEOMENU_PIP, g_info.hw_caps->can_pip, NULL, &pip); pipsetup->setHint("", LOCALE_MENU_HINT_VIDEO_PIP); videosetup->addItem(pipsetup); #endif @@ -690,7 +690,8 @@ bool CVideoSettings::changeNotify(const neutrino_locale_t OptionName, void * /* g_Zapit->setMode43(g_settings.video_43mode); videoDecoder->setAspectRatio(g_settings.video_Format, -1); #ifdef ENABLE_PIP - pipDecoder->setAspectRatio(g_settings.video_Format, g_settings.video_43mode); + if (pipDecoder != NULL) + pipDecoder->setAspectRatio(g_settings.video_Format, g_settings.video_43mode); #endif } else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_VIDEOMENU_VIDEOMODE)) @@ -758,7 +759,8 @@ void CVideoSettings::next43Mode(void) g_settings.video_43mode = videomenu_43mode_options[curmode].key; g_Zapit->setMode43(g_settings.video_43mode); #ifdef ENABLE_PIP - pipDecoder->setAspectRatio(-1, g_settings.video_43mode); + if (pipDecoder != NULL) + pipDecoder->setAspectRatio(-1, g_settings.video_43mode); #endif ShowHint(LOCALE_VIDEOMENU_43MODE, g_Locale->getText(text), 450, 2); } @@ -785,7 +787,8 @@ void CVideoSettings::SwitchFormat() videoDecoder->setAspectRatio(g_settings.video_Format, -1); #ifdef ENABLE_PIP - pipDecoder->setAspectRatio(g_settings.video_Format, -1); + if (pipDecoder != NULL) + pipDecoder->setAspectRatio(g_settings.video_Format, -1); #endif ShowHint(LOCALE_VIDEOMENU_VIDEOFORMAT, g_Locale->getText(text), 450, 2); } diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 7afd7fe2d..1d5cde303 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -3415,7 +3415,7 @@ void CNeutrinoApp::RealRun() CRecordManager::getInstance()->StartTimeshift(); } #ifdef ENABLE_PIP - else if (msg == (neutrino_msg_t) g_settings.key_pip_close) { + else if ((msg == (neutrino_msg_t) g_settings.key_pip_close) && g_info.hw_caps->can_pip) { int boxmode = getBoxMode(); if (boxmode > -1 && boxmode != 12) ShowMsg(LOCALE_MESSAGEBOX_ERROR, LOCALE_BOXMODE12_NOT_ACTIVATED, CMsgBox::mbrOk, CMsgBox::mbOk, NEUTRINO_ICON_ERROR); @@ -3429,7 +3429,7 @@ void CNeutrinoApp::RealRun() } } #if !HAVE_CST_HARDWARE && !HAVE_GENERIC_HARDWARE - else if ((msg == (neutrino_msg_t) g_settings.key_pip_close_avinput) && ((g_info.hw_caps->has_SCART_input) || (g_info.hw_caps->has_HDMI_input))) { + else if ((msg == (neutrino_msg_t) g_settings.key_pip_close_avinput) && ((g_info.hw_caps->has_SCART_input) || (g_info.hw_caps->has_HDMI_input)) && g_info.hw_caps->can_pip) { int boxmode = getBoxMode(); if (boxmode > -1 && boxmode != 12) ShowMsg(LOCALE_MESSAGEBOX_ERROR, LOCALE_BOXMODE12_NOT_ACTIVATED, CMsgBox::mbrOk, CMsgBox::mbOk, NEUTRINO_ICON_ERROR); @@ -3445,11 +3445,11 @@ void CNeutrinoApp::RealRun() } } #endif - else if (msg == (neutrino_msg_t) g_settings.key_pip_setup) { + else if ((msg == (neutrino_msg_t) g_settings.key_pip_setup) && g_info.hw_caps->can_pip) { CPipSetup pipsetup; pipsetup.exec(NULL, ""); } - else if (msg == (neutrino_msg_t) g_settings.key_pip_swap) { + else if ((msg == (neutrino_msg_t) g_settings.key_pip_swap) && g_info.hw_caps->can_pip) { t_channel_id pip_channel_id = CZapit::getInstance()->GetPipChannelID(); t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); if (pip_channel_id && (pip_channel_id != live_channel_id)) { @@ -4819,7 +4819,8 @@ void CNeutrinoApp::tvMode( bool rezap ) } #ifdef ENABLE_PIP - pipDecoder->Pig(g_settings.pip_x, g_settings.pip_y, + if (g_info.hw_caps->can_pip) + pipDecoder->Pig(g_settings.pip_x, g_settings.pip_y, g_settings.pip_width, g_settings.pip_height, frameBuffer->getScreenWidth(true), frameBuffer->getScreenHeight(true)); #endif @@ -5100,7 +5101,8 @@ void CNeutrinoApp::radioMode( bool rezap) } #ifdef ENABLE_PIP - pipDecoder->Pig(g_settings.pip_radio_x, g_settings.pip_radio_y, + if (g_info.hw_caps->can_pip) + pipDecoder->Pig(g_settings.pip_radio_x, g_settings.pip_radio_y, g_settings.pip_radio_width, g_settings.pip_radio_height, frameBuffer->getScreenWidth(true), frameBuffer->getScreenHeight(true)); #endif @@ -5166,6 +5168,8 @@ void CNeutrinoApp::switchTvRadioMode(const int prev_mode) #ifdef ENABLE_PIP #if !HAVE_CST_HARDWARE && !HAVE_GENERIC_HARDWARE void CNeutrinoApp::StartAVInputPiP() { + if (!g_info.hw_caps->can_pip) return; + if (!pipDemux) { pipDemux = new cDemux(1); pipDemux->Open(DMX_PIP_CHANNEL); @@ -5184,6 +5188,8 @@ void CNeutrinoApp::StartAVInputPiP() { } void CNeutrinoApp::StopAVInputPiP() { + if (!g_info.hw_caps->can_pip) return; + pipDecoder->ShowPig(0); pipDemux->Stop(); pipDecoder->Stop(); @@ -5972,10 +5978,15 @@ void CNeutrinoApp::getAnnounceEpgName(CTimerd::RecordingInfo * eventinfo, std::s bool CNeutrinoApp::StartPip(const t_channel_id channel_id) { bool ret = false; + if (!g_info.hw_caps->can_pip) return ret; + CZapitChannel * channel = CServiceManager::getInstance()->FindChannel(channel_id); if (!channel) return ret; + if (!g_info.hw_caps->can_pip) + return ret; + if (channel->getRecordDemux() == channel->getPipDemux()) CStreamManager::getInstance()->StopStream(channel_id); diff --git a/src/neutrino_menue.cpp b/src/neutrino_menue.cpp index 583075145..bb6157139 100644 --- a/src/neutrino_menue.cpp +++ b/src/neutrino_menue.cpp @@ -174,7 +174,7 @@ void CNeutrinoApp::InitMenuMain() personalize.addItem(MENU_MAIN, avinputmode, &g_settings.personalize[SNeutrinoSettings::P_MAIN_AVINPUT]); #ifdef ENABLE_PIP - CMenuForwarder *avinputmode_pip = new CMenuForwarder(LOCALE_MAINMENU_AVINPUTMODE_PIP, true, NULL, this, "avinput_pip"); + CMenuForwarder *avinputmode_pip = new CMenuForwarder(LOCALE_MAINMENU_AVINPUTMODE_PIP, g_info.hw_caps->can_pip, NULL, this, "avinput_pip"); avinputmode_pip->setHint(NEUTRINO_ICON_HINT_AVINPUTMODE_PIP, LOCALE_MENU_HINT_AVINPUTMODE_PIP); personalize.addItem(MENU_MAIN, avinputmode_pip, &g_settings.personalize[SNeutrinoSettings::P_MAIN_AVINPUT_PIP]); #endif diff --git a/src/zapit/src/zapit.cpp b/src/zapit/src/zapit.cpp index 5c47a3d60..93397f3dc 100644 --- a/src/zapit/src/zapit.cpp +++ b/src/zapit/src/zapit.cpp @@ -667,6 +667,8 @@ bool CZapit::ZapIt(const t_channel_id channel_id, bool forupdate, bool startplay #ifdef ENABLE_PIP bool CZapit::StopPip() { + if (!g_info.hw_caps->can_pip) return false; + #if !HAVE_CST_HARDWARE && !HAVE_GENERIC_HARDWARE if (CNeutrinoApp::getInstance()->avinput_pip) { CNeutrinoApp::getInstance()->StopAVInputPiP(); @@ -690,6 +692,8 @@ bool CZapit::StopPip() bool CZapit::StartPip(const t_channel_id channel_id) { + if (!g_info.hw_caps->can_pip) return false; + CZapitChannel* newchannel; bool transponder_change; /* do lock if live is running, or in record mode - @@ -2572,10 +2576,13 @@ bool CZapit::Start(Z_start_arg *ZapStart_arg) audioDecoder->SetVideo(videoDecoder); #ifdef ENABLE_PIP - pipDemux = new cDemux(dnum); - pipDemux->Open(DMX_PIP_CHANNEL); - pipDecoder = cVideo::GetDecoder(1); - pipDecoder->SetDemux(pipDemux); + if (g_info.hw_caps->can_pip) + { + pipDemux = new cDemux(dnum); + pipDemux->Open(DMX_PIP_CHANNEL); + pipDecoder = cVideo::GetDecoder(1); + pipDecoder->SetDemux(pipDemux); + } #endif #else #if HAVE_CST_HARDWARE @@ -2590,14 +2597,17 @@ bool CZapit::Start(Z_start_arg *ZapStart_arg) audioDecoder = new cAudio(audioDemux->getBuffer(), videoDecoder->GetTVEnc(), NULL /*videoDecoder->GetTVEncSD()*/); #ifdef ENABLE_PIP + if (g_info.hw_caps->can_pip) + { #if HAVE_CST_HARDWARE - pipDemux = new cDemux(dnum); - pipDemux->Open(DMX_PIP_CHANNEL); - pipDecoder = new cVideo(video_mode, pipDemux->getChannel(), pipDemux->getBuffer(), 1); + pipDemux = new cDemux(dnum); + pipDemux->Open(DMX_PIP_CHANNEL); + pipDecoder = new cVideo(video_mode, pipDemux->getChannel(), pipDemux->getBuffer(), 1); #else - pipDecoder = new cVideo(0, NULL, NULL, 1); - pipDecoder->ShowPig(0); + pipDecoder = new cVideo(0, NULL, NULL, 1); + pipDecoder->ShowPig(0); #endif + } #endif #endif @@ -2813,8 +2823,10 @@ void CZapit::run() delete audioDemux; #ifdef ENABLE_PIP StopPip(); - delete pipDecoder; - delete pipDemux; + if (pipDecoder) + delete pipDecoder; + if (pipDemux) + delete pipDemux; #endif INFO("demuxes/decoders deleted");