add option to rotate PiP clockwise/counterclockwise

This commit is contained in:
TangoCash
2022-11-19 11:09:01 +01:00
committed by Thilo Graf
parent 32c24c1fb4
commit 1249a61edf
13 changed files with 134 additions and 9 deletions

View File

@@ -1167,6 +1167,8 @@ int CNeutrinoApp::loadSetup(const char *fname)
g_settings.pip_radio_y = configfile.getInt32("pip_radio_y", g_settings.pip_y);
g_settings.pip_radio_width = configfile.getInt32("pip_radio_width", g_settings.pip_width);
g_settings.pip_radio_height = configfile.getInt32("pip_radio_height", g_settings.pip_height);
g_settings.pip_rotate_lastpos = configfile.getInt32("pip_rotate_lastpos", PIP_ROFF);
#endif
#if ENABLE_QUADPIP
@@ -2043,6 +2045,8 @@ void CNeutrinoApp::saveSetup(const char *fname)
configfile.setInt32("pip_radio_y", g_settings.pip_radio_y);
configfile.setInt32("pip_radio_width", g_settings.pip_radio_width);
configfile.setInt32("pip_radio_height", g_settings.pip_radio_height);
configfile.setInt32("pip_rotate_lastpos", g_settings.pip_rotate_lastpos);
#endif
#if ENABLE_QUADPIP
@@ -3484,6 +3488,9 @@ void CNeutrinoApp::RealRun()
StartPip(CZapit::getInstance()->GetCurrentChannelID());
}
}
else if (((msg == (neutrino_msg_t) g_settings.key_pip_rotate_cw) || (msg == (neutrino_msg_t) g_settings.key_pip_rotate_ccw)) && g_info.hw_caps->can_pip) {
(msg == (neutrino_msg_t) g_settings.key_pip_rotate_cw) ? pip_rotate(1) : pip_rotate(-1);
}
#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)) && g_info.hw_caps->can_pip) {
int boxmode = getBoxMode();
@@ -4918,7 +4925,7 @@ void CNeutrinoApp::tvMode( bool rezap )
#if ENABLE_PIP
if (g_info.hw_caps->can_pip)
{
pipVideoDecoder[0]->Pig(g_settings.pip_x, g_settings.pip_y,
pipVideoDecoder[0]->Pig(pip_recalc_pos_x(g_settings.pip_x),pip_recalc_pos_y(g_settings.pip_y),
g_settings.pip_width, g_settings.pip_height,
frameBuffer->getScreenWidth(true), frameBuffer->getScreenHeight(true));
}
@@ -5202,7 +5209,7 @@ void CNeutrinoApp::radioMode( bool rezap)
#if ENABLE_PIP
if (g_info.hw_caps->can_pip)
{
pipVideoDecoder[0]->Pig(g_settings.pip_radio_x, g_settings.pip_radio_y,
pipVideoDecoder[0]->Pig(pip_recalc_pos_x(g_settings.pip_radio_x),pip_recalc_pos_y(g_settings.pip_radio_y),
g_settings.pip_radio_width, g_settings.pip_radio_height,
frameBuffer->getScreenWidth(true), frameBuffer->getScreenHeight(true));
}
@@ -5284,7 +5291,7 @@ void CNeutrinoApp::StartAVInputPiP() {
pipVideoDemux[0]->Start();
pipVideoDecoder[0]->Start(0, 0, 0);
pipVideoDecoder[0]->open_AVInput_Device();
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]->Pig(pip_recalc_pos_x(g_settings.pip_x),pip_recalc_pos_y(g_settings.pip_y),g_settings.pip_width,g_settings.pip_height,g_settings.screen_width,g_settings.screen_height);
pipVideoDecoder[0]->ShowPig(1);
avinput_pip = true;
}
@@ -5729,6 +5736,8 @@ void CNeutrinoApp::loadKeys(const char *fname)
#if ENABLE_PIP
g_settings.key_pip_close = tconfig->getInt32("key_pip_close", CRCInput::RC_prev);
g_settings.key_pip_close_avinput = tconfig->getInt32("key_pip_close_avinput", CRCInput::RC_nokey);
g_settings.key_pip_rotate_cw = tconfig->getInt32("key_pip_rotate_cw", CRCInput::RC_nokey);
g_settings.key_pip_rotate_ccw = tconfig->getInt32("key_pip_rotate_ccw", CRCInput::RC_nokey);
g_settings.key_pip_setup = tconfig->getInt32("key_pip_setup", CRCInput::RC_nokey);
g_settings.key_pip_swap = tconfig->getInt32("key_pip_swap", CRCInput::RC_next);
#endif
@@ -5838,6 +5847,8 @@ void CNeutrinoApp::saveKeys(const char *fname)
#if ENABLE_PIP
tconfig->setInt32("key_pip_close", g_settings.key_pip_close);
tconfig->setInt32("key_pip_close_avinput", g_settings.key_pip_close_avinput);
tconfig->setInt32("key_pip_rotate_cw", g_settings.key_pip_rotate_cw);
tconfig->setInt32("key_pip_rotate_ccw", g_settings.key_pip_rotate_ccw);
tconfig->setInt32("key_pip_setup", g_settings.key_pip_setup);
tconfig->setInt32("key_pip_swap", g_settings.key_pip_swap);
#endif
@@ -6048,6 +6059,54 @@ bool CNeutrinoApp::StartPip(const t_channel_id channel_id, int pip)
}
return ret;
}
int CNeutrinoApp::pip_recalc_pos_x(int x)
{
int new_x = x;
switch(g_settings.pip_rotate_lastpos)
{
case PIP_UP_LEFT:
case PIP_DOWN_LEFT:
new_x = x;
break;
case PIP_UP_RIGHT:
case PIP_DOWN_RIGHT:
new_x = g_settings.screen_width - g_settings.pip_width - x;
break;
}
return new_x;
}
int CNeutrinoApp::pip_recalc_pos_y(int y)
{
int new_y = y;
switch(g_settings.pip_rotate_lastpos)
{
case PIP_UP_LEFT:
case PIP_UP_RIGHT:
new_y = y;
break;
case PIP_DOWN_RIGHT:
case PIP_DOWN_LEFT:
new_y = g_settings.screen_height - g_settings.pip_height - y;
break;
}
return new_y;
}
void CNeutrinoApp::pip_rotate(int cw)
{
if (!pipVideoDecoder[0]->getBlank())
{
g_settings.pip_rotate_lastpos += cw;
if (g_settings.pip_rotate_lastpos < PIP_UP_LEFT)
g_settings.pip_rotate_lastpos = PIP_DOWN_LEFT;
if (g_settings.pip_rotate_lastpos > PIP_DOWN_LEFT)
g_settings.pip_rotate_lastpos = PIP_UP_LEFT;
pipVideoDecoder[0]->Pig(pip_recalc_pos_x(g_settings.pip_x),pip_recalc_pos_y(g_settings.pip_y),g_settings.pip_width,g_settings.pip_height,g_settings.screen_width,g_settings.screen_height);
}
}
#endif
void CNeutrinoApp::Cleanup()