- movieplayer: add virtual zap mode for moviebrowser playlists

This commit fixes virtual zap for timeshift mode too.
TODO: virtual zap for fileplayer playlists
This commit is contained in:
svenhoefer
2016-02-03 16:27:07 +01:00
parent 32d3c2e467
commit fb2967ca8b
5 changed files with 153 additions and 36 deletions

View File

@@ -51,6 +51,7 @@
#include <driver/display.h>
#include <driver/abstime.h>
#include <driver/record.h>
#include <driver/volume.h>
#include <eitd/edvbstring.h>
#include <system/helpers.h>
@@ -74,6 +75,7 @@
extern cVideo * videoDecoder;
extern CRemoteControl *g_RemoteControl; /* neutrino.cpp */
extern CInfoClock *InfoClock;
extern CVolume* g_volume;
#define TIMESHIFT_SECONDS 3
#define ISO_MOUNT_POINT "/media/iso"
@@ -189,6 +191,8 @@ void CMoviePlayerGui::Init(void)
info_1 = "";
info_2 = "";
filelist_it = filelist.end();
vzap_it = filelist_it;
fromInfoviewer = false;
keyPressed = CMoviePlayerGui::PLUGIN_PLAYSTATE_NORMAL;
isLuaPlay = false;
haveLuaInfoFunc = false;
@@ -901,6 +905,55 @@ bool CMoviePlayerGui::SetPosition(int pos, bool absolute)
return res;
}
void CMoviePlayerGui::quickZap(neutrino_msg_t msg)
{
if ((msg == CRCInput::RC_right) || msg == (neutrino_msg_t) g_settings.key_quickzap_up)
{
//printf("CMoviePlayerGui::%s: CRCInput::RC_right or g_settings.key_quickzap_up\n", __func__);
if (isLuaPlay)
{
playstate = CMoviePlayerGui::STOPPED;
keyPressed = CMoviePlayerGui::PLUGIN_PLAYSTATE_NEXT;
ClearQueue();
}
else if (!filelist.empty())
{
if (filelist_it < (filelist.end() - 1))
{
playstate = CMoviePlayerGui::STOPPED;
++filelist_it;
}
else if (repeat_mode == REPEAT_ALL)
{
playstate = CMoviePlayerGui::STOPPED;
++filelist_it;
if (filelist_it == filelist.end())
{
filelist_it = filelist.begin();
}
}
}
}
else if ((msg == CRCInput::RC_left) || msg == (neutrino_msg_t) g_settings.key_quickzap_down)
{
//printf("CMoviePlayerGui::%s: CRCInput::RC_left or g_settings.key_quickzap_down\n", __func__);
if (isLuaPlay)
{
playstate = CMoviePlayerGui::STOPPED;
keyPressed = CMoviePlayerGui::PLUGIN_PLAYSTATE_PREV;
ClearQueue();
}
else if (filelist.size() > 1)
{
if (filelist_it != filelist.begin())
{
playstate = CMoviePlayerGui::STOPPED;
--filelist_it;
}
}
}
}
void CMoviePlayerGui::PlayFileLoop(void)
{
bool first_start = true;
@@ -993,29 +1046,36 @@ void CMoviePlayerGui::PlayFileLoop(void)
playstate = CMoviePlayerGui::STOPPED;
keyPressed = CMoviePlayerGui::PLUGIN_PLAYSTATE_STOP;
ClearQueue();
} else if (isLuaPlay && (msg == (neutrino_msg_t) CRCInput::RC_right)) {
playstate = CMoviePlayerGui::STOPPED;
keyPressed = CMoviePlayerGui::PLUGIN_PLAYSTATE_NEXT;
ClearQueue();
} else if (isLuaPlay && (msg == (neutrino_msg_t) CRCInput::RC_left)) {
playstate = CMoviePlayerGui::STOPPED;
keyPressed = CMoviePlayerGui::PLUGIN_PLAYSTATE_PREV;
ClearQueue();
} else if ((!filelist.empty() && msg == (neutrino_msg_t) CRCInput::RC_right)) {
if (filelist_it < (filelist.end() - 1)) {
++filelist_it;
playstate = CMoviePlayerGui::STOPPED;
} else if (repeat_mode == REPEAT_ALL) {
++filelist_it;
if (filelist_it == filelist.end())
filelist_it = filelist.begin();
playstate = CMoviePlayerGui::STOPPED;
}
} else if (filelist.size() > 1 && msg == (neutrino_msg_t) CRCInput::RC_left) {
if (filelist_it != filelist.begin()) {
playstate = CMoviePlayerGui::STOPPED;
--filelist_it;
} else if (msg == CRCInput::RC_left || msg == CRCInput::RC_right) {
bool reset_vzap_it = true;
switch (g_settings.mode_left_right_key_tv)
{
case SNeutrinoSettings::INFOBAR:
callInfoViewer();
break;
case SNeutrinoSettings::VZAP:
if (fromInfoviewer)
{
set_vzap_it(msg == CRCInput::RC_right);
reset_vzap_it = false;
fromInfoviewer = false;
}
callInfoViewer(reset_vzap_it);
break;
case SNeutrinoSettings::VOLUME:
g_volume->setVolume(msg);
break;
default: /* SNeutrinoSettings::ZAP */
quickZap(msg);
break;
}
} else if (msg == (neutrino_msg_t) g_settings.key_quickzap_up || msg == (neutrino_msg_t) g_settings.key_quickzap_down) {
quickZap(msg);
} else if (fromInfoviewer && msg == CRCInput::RC_ok && !filelist.empty()) {
printf("CMoviePlayerGui::%s: start playlist movie #%d\n", __func__, vzap_it - filelist.begin());
fromInfoviewer = false;
playstate = CMoviePlayerGui::STOPPED;
filelist_it = vzap_it;
} else if (timeshift == TSHIFT_MODE_OFF && !isWebTV /* && !isYT */ && (msg == (neutrino_msg_t) g_settings.mpkey_next_repeat_mode)) {
repeat_mode = (repeat_mode_enum)((int)repeat_mode + 1);
if (repeat_mode > (int) REPEAT_ALL)
@@ -1282,15 +1342,48 @@ void CMoviePlayerGui::PlayFileEnd(bool restore)
}
}
void CMoviePlayerGui::callInfoViewer()
void CMoviePlayerGui::set_vzap_it(bool up)
{
//printf("CMoviePlayerGui::%s: vzap_it: %d count %s\n", __func__, vzap_it - filelist.begin(), up ? "up" : "down");
if (up)
{
if (vzap_it < (filelist.end() - 1))
++vzap_it;
}
else
{
if (vzap_it > filelist.begin())
--vzap_it;
}
//printf("CMoviePlayerGui::%s: vzap_it: %d\n", __func__, vzap_it - filelist.begin());
}
void CMoviePlayerGui::callInfoViewer(bool init_vzap_it)
{
if (init_vzap_it)
{
//printf("CMoviePlayerGui::%s: init_vzap_it\n", __func__);
vzap_it = filelist_it;
}
if (timeshift != TSHIFT_MODE_OFF) {
g_InfoViewer->showTitle(CNeutrinoApp::getInstance()->channelList->getActiveChannel());
return;
}
if (isMovieBrowser && p_movie_info) {
g_InfoViewer->showMovieTitle(playstate, p_movie_info->epgEpgId >>16, p_movie_info->epgChannel, p_movie_info->epgTitle, p_movie_info->epgInfo1,
if (isMovieBrowser && p_movie_info)
{
MI_MOVIE_INFO *mi;
mi = p_movie_info;
if (!filelist.empty() && g_settings.mode_left_right_key_tv == SNeutrinoSettings::VZAP)
{
if (vzap_it <= filelist.end()) {
unsigned idx = vzap_it - filelist.begin();
//printf("CMoviePlayerGui::%s: idx: %d\n", __func__, idx);
mi = milist[idx];
}
}
g_InfoViewer->showMovieTitle(playstate, mi->epgEpgId >>16, mi->epgChannel, mi->epgTitle, mi->epgInfo1,
duration, position, repeat_mode);
return;
}