From cbfa6f88c5c5199719c2863fbb8ea2b1148c6059 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Tue, 5 Mar 2013 18:34:47 +0400 Subject: [PATCH] use ENABLE_PIP for pip code --- src/driver/record.cpp | 2 +- src/gui/channellist.cpp | 10 ++++------ src/gui/pipsetup.cpp | 5 +++-- src/gui/scan.cpp | 2 +- src/gui/videosettings.cpp | 15 +++++++++------ src/neutrino.cpp | 6 +++++- src/zapit/src/zapit.cpp | 22 +++++++++++++++------- 7 files changed, 38 insertions(+), 24 deletions(-) diff --git a/src/driver/record.cpp b/src/driver/record.cpp index e4e3b9cb9..b15fca793 100644 --- a/src/driver/record.cpp +++ b/src/driver/record.cpp @@ -1623,7 +1623,7 @@ bool CRecordManager::CutBackNeutrino(const t_channel_id channel_id, CFrontend * ret = false; #endif if(ret) { -#ifdef BOXMODEL_APOLLO +#ifdef ENABLE_PIP if (CZapit::getInstance()->GetPipChannelID() == channel_id) CZapit::getInstance()->StopPip(); #endif diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 97a6d8253..75683f9ac 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -778,18 +778,16 @@ int CChannelList::show() loop=false; } } -#ifdef BOXMODEL_APOLLO +#ifdef ENABLE_PIP else if ( msg == CRCInput::RC_play) { if(SameTP() && CRecordManager::getInstance()->GetRecordMode(chanlist[selected]->channel_id) == CRecordManager::RECMODE_OFF) { if (CZapit::getInstance()->GetPipChannelID() == chanlist[selected]->getChannelID()) { CZapit::getInstance()->StopPip(); - paint(); } else { - if (CZapit::getInstance()->StartPip(chanlist[selected]->getChannelID())) - paint(); - else + if (!CZapit::getInstance()->StartPip(chanlist[selected]->getChannelID())) DisplayErrorMessage(g_Locale->getText(LOCALE_VIDEOMENU_PIP_ERROR)); } + paint(); } } #endif @@ -1876,7 +1874,7 @@ void CChannelList::paintItem(int pos) rec_icon = NEUTRINO_ICON_REC; else if (rec_mode & CRecordManager::RECMODE_TSHIFT) rec_icon = NEUTRINO_ICON_AUTO_SHIFT; -#ifdef BOXMODEL_APOLLO +#ifdef ENABLE_PIP else if (chanlist[curr]->channel_id == CZapit::getInstance()->GetPipChannelID()) { int h; frameBuffer->getIconSize(NEUTRINO_ICON_PIP, &ChannelList_Rec, &h); diff --git a/src/gui/pipsetup.cpp b/src/gui/pipsetup.cpp index a3679c762..e94cd0ae7 100644 --- a/src/gui/pipsetup.cpp +++ b/src/gui/pipsetup.cpp @@ -12,12 +12,13 @@ #include #include #include +#include #define PERCENT 5 #define XMOVE 10 #define YMOVE 10 -#ifdef BOXMODEL_APOLLO +#ifdef ENABLE_PIP extern cVideo *pipDecoder; @@ -216,4 +217,4 @@ void CPipSetup::paint() g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+5, y+mheight*4, mwidth, hpos, COL_MENUCONTENT); } -#endif //BOXMODEL_APOLLO +#endif //#ifdef ENABLE_PIP diff --git a/src/gui/scan.cpp b/src/gui/scan.cpp index f2fbbca19..4eab4f4d2 100644 --- a/src/gui/scan.cpp +++ b/src/gui/scan.cpp @@ -200,7 +200,7 @@ int CScanTs::exec(CMenuTarget* /*parent*/, const std::string & actionKey) CRecordManager::getInstance()->StopAutoRecord(); g_Zapit->stopPlayBack(); -#ifdef BOXMODEL_APOLLO +#ifdef ENABLE_PIP CZapit::getInstance()->StopPip(); #endif diff --git a/src/gui/videosettings.cpp b/src/gui/videosettings.cpp index 8af4e7f8b..e2fe5b216 100644 --- a/src/gui/videosettings.cpp +++ b/src/gui/videosettings.cpp @@ -54,7 +54,7 @@ #include extern cVideo *videoDecoder; -#ifdef BOXMODEL_APOLLO +#ifdef ENABLE_PIP extern cVideo *pipDecoder; #include #endif @@ -309,7 +309,8 @@ int CVideoSettings::showVideoSetup() videosetup->addItem(bcont); videosetup->addItem(ccont); videosetup->addItem(scont); - +#endif +#ifdef ENABLE_PIP CPipSetup pip; CMenuForwarder * pipsetup = new CMenuForwarder(LOCALE_VIDEOMENU_PIP, true, NULL, &pip); pipsetup->setHint("", LOCALE_MENU_HINT_VIDEO_PIP); @@ -344,7 +345,7 @@ void CVideoSettings::setVideoSettings() videoDecoder->setAspectRatio(g_settings.video_Format, -1); #endif videoDecoder->setAspectRatio(g_settings.video_Format, g_settings.video_43mode); -#ifdef BOXMODEL_APOLLO +#ifdef ENABLE_PIP pipDecoder->setAspectRatio(g_settings.video_Format, g_settings.video_43mode); #endif @@ -355,6 +356,8 @@ void CVideoSettings::setVideoSettings() changeNotify(LOCALE_VIDEOMENU_BRIGHTNESS, NULL); changeNotify(LOCALE_VIDEOMENU_CONTRAST, NULL); changeNotify(LOCALE_VIDEOMENU_SATURATION, NULL); +#endif +#ifdef ENABLE_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 } @@ -413,7 +416,7 @@ bool CVideoSettings::changeNotify(const neutrino_locale_t OptionName, void * /* if (g_settings.video_Format != 1 && g_settings.video_Format != 3 && g_settings.video_Format != 2) g_settings.video_Format = 3; videoDecoder->setAspectRatio(g_settings.video_Format, g_settings.video_43mode); -#ifdef BOXMODEL_APOLLO +#ifdef ENABLE_PIP pipDecoder->setAspectRatio(g_settings.video_Format, g_settings.video_43mode); #endif } @@ -468,7 +471,7 @@ void CVideoSettings::next43Mode(void) text = VIDEOMENU_43MODE_OPTIONS[curmode].value; g_settings.video_43mode = VIDEOMENU_43MODE_OPTIONS[curmode].key; videoDecoder->setAspectRatio(-1, g_settings.video_43mode); -#ifdef BOXMODEL_APOLLO +#ifdef ENABLE_PIP pipDecoder->setAspectRatio(-1, g_settings.video_43mode); #endif ShowHintUTF(LOCALE_VIDEOMENU_43MODE, g_Locale->getText(text), 450, 2); @@ -494,7 +497,7 @@ void CVideoSettings::SwitchFormat() g_settings.video_Format = VIDEOMENU_VIDEOFORMAT_OPTIONS[curmode].key; videoDecoder->setAspectRatio(g_settings.video_Format, -1); -#ifdef BOXMODEL_APOLLO +#ifdef ENABLE_PIP pipDecoder->setAspectRatio(g_settings.video_Format, -1); #endif ShowHintUTF(LOCALE_VIDEOMENU_VIDEOFORMAT, g_Locale->getText(text), 450, 2); diff --git a/src/neutrino.cpp b/src/neutrino.cpp index eaff487e5..2ccd4e361 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -769,6 +769,8 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.brightness = configfile.getInt32("brightness", 0); g_settings.contrast = configfile.getInt32("contrast", 0); g_settings.saturation = configfile.getInt32("saturation", 0); +#endif +#ifdef ENABLE_PIP g_settings.pip_x = configfile.getInt32("pip_x", 50); g_settings.pip_y = configfile.getInt32("pip_y", 50); g_settings.pip_width = configfile.getInt32("pip_width", 365); @@ -1150,6 +1152,8 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setInt32("brightness", g_settings.brightness ); configfile.setInt32("contrast", g_settings.contrast ); configfile.setInt32("saturation", g_settings.saturation ); +#endif +#ifdef ENABLE_PIP configfile.setInt32("pip_x", g_settings.pip_x); configfile.setInt32("pip_y", g_settings.pip_y); configfile.setInt32("pip_width", g_settings.pip_width); @@ -2111,7 +2115,7 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) else if (msg == (neutrino_msg_t) g_settings.key_current_transponder){ numericZap( msg ); } -#ifdef BOXMODEL_APOLLO +#ifdef ENABLE_PIP else if (msg == (neutrino_msg_t) g_settings.key_pip) { CZapit::getInstance()->StopPip(); } diff --git a/src/zapit/src/zapit.cpp b/src/zapit/src/zapit.cpp index bdf3e74db..027d6218b 100644 --- a/src/zapit/src/zapit.cpp +++ b/src/zapit/src/zapit.cpp @@ -86,7 +86,7 @@ extern cAudio *audioDecoder; extern cDemux *audioDemux; extern cDemux *videoDemux; -#ifdef BOXMODEL_APOLLO +#ifdef ENABLE_PIP cVideo *pipDecoder; cDemux *pipDemux; #endif @@ -517,7 +517,7 @@ bool CZapit::ZapIt(const t_channel_id channel_id, bool forupdate, bool startplay } SendEvent(CZapitClient::EVT_TUNE_COMPLETE, &live_channel_id, sizeof(t_channel_id)); -#ifdef BOXMODEL_APOLLO +#ifdef ENABLE_PIP if (transponder_change && (live_fe == pip_fe)) StopPip(); #endif @@ -562,7 +562,7 @@ bool CZapit::ZapIt(const t_channel_id channel_id, bool forupdate, bool startplay return true; } -#ifdef BOXMODEL_APOLLO +#ifdef ENABLE_PIP bool CZapit::StopPip() { if (pip_channel_id) { @@ -582,7 +582,6 @@ bool CZapit::StartPip(const t_channel_id channel_id) CZapitChannel* newchannel; bool transponder_change; - StopPip(); if((newchannel = CServiceManager::getInstance()->FindChannel(channel_id)) == NULL) { printf("zapit_to_record: channel_id " PRINTF_CHANNEL_ID_TYPE " not found", channel_id); @@ -597,6 +596,7 @@ bool CZapit::StartPip(const t_channel_id channel_id) ERROR("Cannot get frontend\n"); return false; } + StopPip(); if(!TuneChannel(frontend, newchannel, transponder_change)) return false; @@ -650,7 +650,7 @@ bool CZapit::ZapForRecord(const t_channel_id channel_id) if(!TuneChannel(frontend, newchannel, transponder_change)) return false; -#ifdef BOXMODEL_APOLLO +#ifdef ENABLE_PIP if (transponder_change && (frontend == pip_fe)) StopPip(); #endif @@ -2023,7 +2023,7 @@ void CZapit::enterStandby(void) SaveAudioMap(); SaveVolumeMap(); StopPlayBack(true); -#ifdef BOXMODEL_APOLLO +#ifdef ENABLE_PIP StopPip(); #endif @@ -2142,15 +2142,23 @@ bool CZapit::Start(Z_start_arg *ZapStart_arg) audioDecoder->SetDemux(audioDemux); audioDecoder->SetVideo(videoDecoder); +#ifdef ENABLE_PIP pipDemux = new cDemux(); pipDemux->Open(DMX_PIP_CHANNEL); pipDecoder = cVideo::GetDecoder(1); pipDecoder->SetDemux(pipDemux); +#endif #else videoDecoder = new cVideo(video_mode, videoDemux->getChannel(), videoDemux->getBuffer()); videoDecoder->Standby(false); audioDecoder = new cAudio(audioDemux->getBuffer(), videoDecoder->GetTVEnc(), NULL /*videoDecoder->GetTVEncSD()*/); + +#ifdef ENABLE_PIP + pipDemux = new cDemux(); + pipDemux->Open(DMX_PIP_CHANNEL); + pipDecoder = new cVideo(video_mode, pipDemux->getChannel(), pipDemux->getBuffer(), 1); +#endif #endif videoDecoder->SetAudioHandle(audioDecoder->GetHandle()); @@ -2330,7 +2338,7 @@ void CZapit::run() delete pmtDemux; delete audioDecoder; delete audioDemux; -#ifdef BOXMODEL_APOLLO +#ifdef ENABLE_PIP StopPip(); delete pipDecoder; delete pipDemux;