Movieplayer cleanup: remove unused code, move all time realted to CTimeOSD

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@1964 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
focus
2011-12-10 12:09:10 +00:00
parent f323ffceb1
commit 2be4e1e21f
4 changed files with 125 additions and 290 deletions

View File

@@ -164,7 +164,6 @@ CMoviePlayerGui::CMoviePlayerGui()
void CMoviePlayerGui::Init(void) void CMoviePlayerGui::Init(void)
{ {
stopped = false; stopped = false;
hintBox = new CHintBox(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_MOVIEPLAYER_PLEASEWAIT)); // UTF-8
frameBuffer = CFrameBuffer::getInstance(); frameBuffer = CFrameBuffer::getInstance();
@@ -200,17 +199,9 @@ void CMoviePlayerGui::Init(void)
tsfilefilter.addFilter("mp4"); tsfilefilter.addFilter("mp4");
tsfilefilter.addFilter("mov"); tsfilefilter.addFilter("mov");
vlcfilefilter.addFilter("mpg");
vlcfilefilter.addFilter("mpeg");
vlcfilefilter.addFilter("m2p");
vlcfilefilter.addFilter("avi");
vlcfilefilter.addFilter("vob");
pesfilefilter.addFilter("mpv");
filebrowser->Filter = &tsfilefilter; filebrowser->Filter = &tsfilefilter;
rct = 0;
speed = 1; speed = 1;
slow = 0; //slow = 0;
jumpseconds = 0; jumpseconds = 0;
showaudioselectdialog = false; showaudioselectdialog = false;
timeshift = 0; timeshift = 0;
@@ -223,7 +214,6 @@ CMoviePlayerGui::~CMoviePlayerGui()
delete filebrowser; delete filebrowser;
if (moviebrowser) if (moviebrowser)
delete moviebrowser; delete moviebrowser;
delete hintBox;
if (bookmarkmanager) if (bookmarkmanager)
delete bookmarkmanager; delete bookmarkmanager;
g_Zapit->setStandby(false); g_Zapit->setStandby(false);
@@ -272,8 +262,6 @@ int CMoviePlayerGui::exec(CMenuTarget * parent, const std::string & actionKey)
bookmarkmanager = new CBookmarkManager(); bookmarkmanager = new CBookmarkManager();
// dvbsub_pause();
if (parent) { if (parent) {
parent->hide(); parent->hide();
} }
@@ -284,21 +272,9 @@ int CMoviePlayerGui::exec(CMenuTarget * parent, const std::string & actionKey)
frameBuffer->Clear(); frameBuffer->Clear();
} }
const CBookmark *theBookmark = NULL;
if (actionKey == "bookmarkplayback") {
isBookmark = true;
theBookmark = bookmarkmanager->getBookmark(NULL);
if (theBookmark == NULL) {
bookmarkmanager->flush();
return menu_return::RETURN_REPAINT;
}
}
isBookmark = false;
startfilename = ""; startfilename = "";
startposition = 0; startposition = 0;
isMovieBrowser = false;
minuteoffset = MINUTEOFFSET; minuteoffset = MINUTEOFFSET;
secondoffset = minuteoffset / 60; secondoffset = minuteoffset / 60;
@@ -306,62 +282,44 @@ int CMoviePlayerGui::exec(CMenuTarget * parent, const std::string & actionKey)
if (system(MOVIEPLAYER_START_SCRIPT) != 0) if (system(MOVIEPLAYER_START_SCRIPT) != 0)
perror(MOVIEPLAYER_START_SCRIPT " failed"); perror(MOVIEPLAYER_START_SCRIPT " failed");
#if 0 isMovieBrowser = false;
if (actionKey == "fileplayback") { isBookmark = false;
cutNeutrino(); timeshift = 0;
PlayStream(STREAMTYPE_FILE);
} else if (actionKey == "dvdplayback") {
cutNeutrino();
PlayStream(STREAMTYPE_DVD);
} else if (actionKey == "vcdplayback") {
cutNeutrino();
PlayStream(STREAMTYPE_SVCD);
} else if (actionKey == "tsplayback") {
timeshift = 0;
PlayFile();
} else
#endif
if (actionKey == "tsmoviebrowser") { if (actionKey == "tsmoviebrowser") {
isMovieBrowser = true; isMovieBrowser = true;
timeshift = 0;
PlayFile();
} }
else if (actionKey == "fileplayback") { else if (actionKey == "fileplayback") {
timeshift = 0;
PlayFile();
} }
else if (actionKey == "timeshift") { else if (actionKey == "timeshift") {
cutNeutrino(); cutNeutrino();
timeshift = 1; timeshift = 1;
PlayFile();
} }
else if (actionKey == "ptimeshift") { else if (actionKey == "ptimeshift") {
cutNeutrino(); cutNeutrino();
timeshift = 2; timeshift = 2;
PlayFile();
} }
else if (actionKey == "rtimeshift") { else if (actionKey == "rtimeshift") {
cutNeutrino(); cutNeutrino();
timeshift = 3; timeshift = 3;
PlayFile();
} }
#if 0 #if 0
else if (actionKey == "bookmarkplayback") { else if (actionKey == "bookmarkplayback") {
isBookmark = true; isBookmark = true;
if (theBookmark != NULL) { const CBookmark * theBookmark = bookmarkmanager->getBookmark(NULL);
cutNeutrino(); if (theBookmark == NULL) {
startfilename = theBookmark->getUrl(); bookmarkmanager->flush();
sscanf(theBookmark->getTime(), "%lld", &startposition); return menu_return::RETURN_REPAINT;
int vlcpos = startfilename.rfind("vlc://");
if (vlcpos == 0) {
PlayStream(STREAMTYPE_FILE);
} else {
timeshift = 0;
PlayFile();
}
} }
startfilename = theBookmark->getUrl();
sscanf(theBookmark->getTime(), "%lld", &startposition);
} }
#endif #endif
else {
delete bookmarkmanager;
return menu_return::RETURN_REPAINT;
}
PlayFile();
bookmarkmanager->flush(); bookmarkmanager->flush();
// Restore previous background // Restore previous background
@@ -377,17 +335,13 @@ int CMoviePlayerGui::exec(CMenuTarget * parent, const std::string & actionKey)
restoreNeutrino(); restoreNeutrino();
CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO); CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO);
//g_RCInput->postMsg(NeutrinoMessages::SHOW_INFOBAR, 0);
//dvbsub_start(0);
if (bookmarkmanager) delete bookmarkmanager;
delete bookmarkmanager;
if (timeshift) { if (timeshift) {
timeshift = 0; timeshift = 0;
return menu_return::RETURN_EXIT_ALL; return menu_return::RETURN_EXIT_ALL;
} }
return menu_return::RETURN_REPAINT; return menu_return::RETURN_REPAINT;
//return menu_return::RETURN_EXIT_ALL;
} }
void CMoviePlayerGui::updateLcd(const std::string & sel_filename) void CMoviePlayerGui::updateLcd(const std::string & sel_filename)
@@ -398,37 +352,22 @@ void CMoviePlayerGui::updateLcd(const std::string & sel_filename)
switch (playstate) { switch (playstate) {
case CMoviePlayerGui::PAUSE: case CMoviePlayerGui::PAUSE:
lcd = "|| "; lcd = "|| ";
lcd += sel_filename;
//lcd += ')';
break; break;
case CMoviePlayerGui::REW: case CMoviePlayerGui::REW:
sprintf(tmp, "%dx<< ", speed); sprintf(tmp, "%dx<< ", speed);
lcd = tmp; lcd = tmp;
lcd += sel_filename;
break; break;
case CMoviePlayerGui::FF: case CMoviePlayerGui::FF:
sprintf(tmp, "%dx>> ", speed); sprintf(tmp, "%dx>> ", speed);
lcd = tmp; lcd = tmp;
lcd += sel_filename;
break; break;
#if 0 case CMoviePlayerGui::PLAY:
case CMoviePlayerGui::JF: lcd = "> ";
sprintf(tmp, "%ds>> ", speed);
lcd = tmp;
lcd += sel_filename;
break; break;
#endif
default: default:
if (slow) {
sprintf(tmp, "%ds||> ", slow);
lcd = tmp;
} else
lcd = "> ";
lcd += sel_filename;
break; break;
} }
lcd += sel_filename;
//CVFD::getInstance()->showServicename(lcd);
CVFD::getInstance()->showMenuText(0, lcd.c_str(), -1, true); CVFD::getInstance()->showMenuText(0, lcd.c_str(), -1, true);
} }
@@ -525,8 +464,6 @@ void CMoviePlayerGui::PlayFile(void)
bookStartMenu.addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_BOOK_MOVIESTART, true, NULL, &cSelectedMenuBookStart[4])); bookStartMenu.addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_BOOK_MOVIESTART, true, NULL, &cSelectedMenuBookStart[4]));
bookStartMenu.addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_BOOK_MOVIEEND, true, NULL, &cSelectedMenuBookStart[5])); bookStartMenu.addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_BOOK_MOVIEEND, true, NULL, &cSelectedMenuBookStart[5]));
rct = 0;
go_repeat: go_repeat:
do { do {
@@ -686,11 +623,7 @@ void CMoviePlayerGui::PlayFile(void)
CFile::FileType ftype; CFile::FileType ftype;
ftype = file->getType(); ftype = file->getType();
if(ftype == CFile::FILE_AVI || ftype == CFile::FILE_MKV) { is_file_player = false;
is_file_player = true; // Movie player AVI/MKV
} else {
is_file_player = false; // Movie player AVI/MKV
}
filename = file->Name.c_str(); filename = file->Name.c_str();
sel_filename = file->getFileName(); sel_filename = file->getFileName();
@@ -706,23 +639,7 @@ void CMoviePlayerGui::PlayFile(void)
minuteoffset = MINUTEOFFSET; minuteoffset = MINUTEOFFSET;
secondoffset = minuteoffset / 60; secondoffset = minuteoffset / 60;
} }
#if 0
if(!p_movie_info->audioPids.empty()) {
CAPIDSelectExec::g_currentapid = p_movie_info->audioPids[0].epgAudioPid; //FIXME
CAPIDSelectExec::g_currentac3 = p_movie_info->audioPids[0].atype;
}
for (int i = 0; i < (int)p_movie_info->audioPids.size(); i++) {
CAPIDSelectExec::g_apids[i] = p_movie_info->audioPids[i].epgAudioPid;
CAPIDSelectExec::g_ac3flags[i] = p_movie_info->audioPids[i].atype;
g_numpida++;
if (p_movie_info->audioPids[i].selected) {
CAPIDSelectExec::g_currentapid = p_movie_info->audioPids[i].epgAudioPid; //FIXME
CAPIDSelectExec::g_currentac3 = p_movie_info->audioPids[i].atype;
}
}
g_vpid = p_movie_info->epgVideoPid;
g_vtype = p_movie_info->VideoType;
#endif
fillPids(p_movie_info); fillPids(p_movie_info);
printf("CMoviePlayerGui::PlayFile: file %s apid %X atype %d vpid %x vtype %d\n", filename, CAPIDSelectExec::g_currentapid, CAPIDSelectExec::g_currentac3, g_vpid, g_vtype); printf("CMoviePlayerGui::PlayFile: file %s apid %X atype %d vpid %x vtype %d\n", filename, CAPIDSelectExec::g_currentapid, CAPIDSelectExec::g_currentac3, g_vpid, g_vtype);
printf("Bytes per minute: %lld\n", minuteoffset); printf("Bytes per minute: %lld\n", minuteoffset);
@@ -751,15 +668,6 @@ void CMoviePlayerGui::PlayFile(void)
ftype = file->getType(); ftype = file->getType();
is_file_player = true; is_file_player = true;
#if 0
if(ftype == CFile::FILE_AVI || ftype == CFile::FILE_MKV || ftype == CFile::FILE_WAV || ftype == CFile::FILE_ASF) {
is_file_player = true; // Movie player AVI/MKV
} else {
is_file_player = false; // Movie player AVI/MKV
}
#endif
filename = file->Name.c_str(); filename = file->Name.c_str();
update_lcd = true; update_lcd = true;
@@ -862,14 +770,7 @@ void CMoviePlayerGui::PlayFile(void)
update_lcd = true; update_lcd = true;
} }
if (FileTime.IsVisible() /*FIXME && playstate == CMoviePlayerGui::PLAY */ ) { FileTime.update(position, duration);
if (FileTime.GetMode() == CTimeOSD::MODE_ASC) {
FileTime.update(position / 1000);
} else {
FileTime.update((duration - position) / 1000);
}
FileTime.updatePos(file_prozent);
}
if (start_play) { if (start_play) {
printf("Startplay at %d seconds\n", startposition/1000); printf("Startplay at %d seconds\n", startposition/1000);
@@ -985,14 +886,12 @@ void CMoviePlayerGui::PlayFile(void)
speed = 1; speed = 1;
playback->SetSpeed(speed); playback->SetSpeed(speed);
if (!timeshift) if (!timeshift)
callInfoViewer(p_movie_info->epgTitle, p_movie_info->epgInfo1, p_movie_info->epgChannel, duration, position); callInfoViewer(p_movie_info, duration, position);
} else if (!timeshift) { } else if (!timeshift) {
open_filebrowser = true; open_filebrowser = true;
} }
if (time_forced) { if (time_forced) {
time_forced = false; time_forced = false;
if (g_settings.mode_clock)
InfoClock->StopClock();
FileTime.hide(); FileTime.hide();
} }
} else if (msg == (neutrino_msg_t) g_settings.mpkey_pause) { } else if (msg == (neutrino_msg_t) g_settings.mpkey_pause) {
@@ -1009,7 +908,7 @@ void CMoviePlayerGui::PlayFile(void)
playback->SetSpeed(speed); playback->SetSpeed(speed);
} }
if (!timeshift) if (!timeshift)
callInfoViewer(p_movie_info->epgTitle, p_movie_info->epgInfo1, p_movie_info->epgChannel, duration, position); callInfoViewer(p_movie_info, duration, position);
} else if (msg == (neutrino_msg_t) g_settings.mpkey_bookmark) { } else if (msg == (neutrino_msg_t) g_settings.mpkey_bookmark) {
// is there already a bookmark activity? // is there already a bookmark activity?
@@ -1113,23 +1012,7 @@ void CMoviePlayerGui::PlayFile(void)
} else if (msg == (neutrino_msg_t) g_settings.mpkey_audio) { } else if (msg == (neutrino_msg_t) g_settings.mpkey_audio) {
showaudioselectdialog = true; showaudioselectdialog = true;
} else if (msg == (neutrino_msg_t) g_settings.mpkey_time) { } else if (msg == (neutrino_msg_t) g_settings.mpkey_time) {
if (FileTime.IsVisible()) { FileTime.switchMode(position, duration);
if (FileTime.GetMode() == CTimeOSD::MODE_ASC) {
FileTime.SetMode(CTimeOSD::MODE_DESC);
FileTime.update((duration - position) / 1000);
FileTime.updatePos(file_prozent);
} else {
if (g_settings.mode_clock)
InfoClock->StopClock();
FileTime.hide();
}
} else {
if (g_settings.mode_clock)
InfoClock->StartClock();
FileTime.SetMode(CTimeOSD::MODE_ASC);
FileTime.show(position / 1000);
FileTime.updatePos(file_prozent);
}
} else if (msg == (neutrino_msg_t) g_settings.mpkey_rewind) { // rewind } else if (msg == (neutrino_msg_t) g_settings.mpkey_rewind) { // rewind
if (speed >= 0) if (speed >= 0)
speed = -1; speed = -1;
@@ -1141,14 +1024,10 @@ void CMoviePlayerGui::PlayFile(void)
update_lcd = true; update_lcd = true;
if (!timeshift) if (!timeshift)
callInfoViewer(p_movie_info->epgTitle, p_movie_info->epgInfo1, p_movie_info->epgChannel, duration, position); callInfoViewer(p_movie_info, duration, position);
if (!FileTime.IsVisible()) { if (!FileTime.IsVisible()) {
if (g_settings.mode_clock) FileTime.show(position);
InfoClock->StartClock();
FileTime.SetMode(CTimeOSD::MODE_ASC);
FileTime.show(position / 1000);
FileTime.updatePos(file_prozent);
time_forced = true; time_forced = true;
} }
} else if (msg == (neutrino_msg_t) g_settings.mpkey_forward) { // fast-forward } else if (msg == (neutrino_msg_t) g_settings.mpkey_forward) { // fast-forward
@@ -1163,31 +1042,20 @@ void CMoviePlayerGui::PlayFile(void)
playstate = CMoviePlayerGui::FF; playstate = CMoviePlayerGui::FF;
if (!timeshift) if (!timeshift)
callInfoViewer(p_movie_info->epgTitle, p_movie_info->epgInfo1, p_movie_info->epgChannel, duration, position); callInfoViewer(p_movie_info, duration, position);
if (!FileTime.IsVisible()) { if (!FileTime.IsVisible()) {
if (g_settings.mode_clock) FileTime.show(position);
InfoClock->StartClock();
FileTime.SetMode(CTimeOSD::MODE_ASC);
FileTime.show(position / 1000);
FileTime.updatePos(file_prozent);
time_forced = true; time_forced = true;
} }
} else if (msg == CRCInput::RC_help || msg == CRCInput::RC_info) { } else if (msg == CRCInput::RC_help || msg == CRCInput::RC_info) {
if (timeshift) callInfoViewer(p_movie_info, duration, position);
g_InfoViewer->showTitle(CNeutrinoApp::getInstance()->channelList->getActiveChannelNumber(), CNeutrinoApp::getInstance()->channelList->getActiveChannelName(), CNeutrinoApp::getInstance()->channelList->getActiveSatellitePosition(), CNeutrinoApp::getInstance()->channelList->getActiveChannel_ChannelID()); // UTF-8 CVFD::getInstance()->setMode(CVFD::MODE_MENU_UTF8);
update_lcd = true;
else { //showHelpTS();
callInfoViewer(p_movie_info->epgTitle, p_movie_info->epgInfo1, p_movie_info->epgChannel, duration, position);
CVFD::getInstance()->setMode(CVFD::MODE_MENU_UTF8);
update_lcd = true;
//showHelpTS();
}
} else if (msg == CRCInput::RC_1) { // Jump Backwards 1 minute } else if (msg == CRCInput::RC_1) { // Jump Backwards 1 minute
//update_lcd = true;
playback->SetPosition(-60 * 1000); playback->SetPosition(-60 * 1000);
} else if (msg == CRCInput::RC_3) { // Jump Forward 1 minute } else if (msg == CRCInput::RC_3) { // Jump Forward 1 minute
//update_lcd = true;
playback->SetPosition(60 * 1000); playback->SetPosition(60 * 1000);
} else if (msg == CRCInput::RC_4) { // Jump Backwards 5 minutes } else if (msg == CRCInput::RC_4) { // Jump Backwards 5 minutes
playback->SetPosition(-5 * 60 * 1000); playback->SetPosition(-5 * 60 * 1000);
@@ -1216,47 +1084,13 @@ void CMoviePlayerGui::PlayFile(void)
} }
jump_not_until = (position / 1000) + 10; // avoid bookmark jumping for the next 10 seconds, , TODO: might be moved to another key jump_not_until = (position / 1000) + 10; // avoid bookmark jumping for the next 10 seconds, , TODO: might be moved to another key
} }
} else if (msg == CRCInput::RC_up || msg == CRCInput::RC_down) { }
if (msg == CRCInput::RC_up) {
if (slow == 2)
slow = 0;
if (slow > 0)
slow--;
} else if (msg == CRCInput::RC_down) {
if (slow == 0)
slow++;
slow++;
}
//set_slow (slow);
update_lcd = true;
} else if (msg == CRCInput::RC_radio) {
if (isMovieBrowser == true && p_movie_info != NULL) {
std::string fname = p_movie_info->file.Name;
strReplace(fname, ".ts", ".bmp");
//CVCRControl::getInstance()->Screenshot(0, (char *)fname.c_str());
}
}
#if 0
else if (msg == CRCInput::RC_shift_radio) {
if (isMovieBrowser == true && p_movie_info != NULL) {
time_t t = time(NULL);
char filename[512];
sprintf(filename, "%s", p_movie_info->file.Name.c_str());
int pos = strlen(filename);
strftime(&(filename[pos - 3]), sizeof(filename) - pos - 1, "%Y%m%d_%H%M%S", localtime(&t));
strcat(filename, ".bmp");
CVCRControl::getInstance()->Screenshot(0, filename);
}
}
#endif
else if (msg == CRCInput::RC_sat || msg == CRCInput::RC_favorites) { else if (msg == CRCInput::RC_sat || msg == CRCInput::RC_favorites) {
//FIXME do nothing ? //FIXME do nothing ?
} }
else if(timeshift && (msg == CRCInput::RC_text || msg == CRCInput::RC_epg)) { else if(timeshift && (msg == CRCInput::RC_text || msg == CRCInput::RC_epg)) {
bool restore = FileTime.IsVisible(); bool restore = FileTime.IsVisible();
FileTime.hide(); FileTime.hide();
if (g_settings.mode_clock)
InfoClock->StopClock();
if( msg == CRCInput::RC_epg ) if( msg == CRCInput::RC_epg )
g_EventList->exec(CNeutrinoApp::getInstance()->channelList->getActiveChannel_ChannelID(), CNeutrinoApp::getInstance()->channelList->getActiveChannelName()); g_EventList->exec(CNeutrinoApp::getInstance()->channelList->getActiveChannel_ChannelID(), CNeutrinoApp::getInstance()->channelList->getActiveChannelName());
@@ -1266,11 +1100,8 @@ void CMoviePlayerGui::PlayFile(void)
tuxtx_main(g_RCInput->getFileHandle(), g_RemoteControl->current_PIDs.PIDs.vtxtpid, 0, 2); tuxtx_main(g_RCInput->getFileHandle(), g_RemoteControl->current_PIDs.PIDs.vtxtpid, 0, 2);
frameBuffer->paintBackground(); frameBuffer->paintBackground();
} }
if (g_settings.mode_clock)
InfoClock->StartClock();
if(restore) { if(restore) {
FileTime.show(position / 1000); FileTime.show(position / 1000);
FileTime.updatePos(file_prozent);
} }
} }
else if (msg == CRCInput::RC_timeout) { else if (msg == CRCInput::RC_timeout) {
@@ -1281,17 +1112,12 @@ void CMoviePlayerGui::PlayFile(void)
} else if (timeshift && msg == NeutrinoMessages::SHOW_EPG ) { } else if (timeshift && msg == NeutrinoMessages::SHOW_EPG ) {
bool restore = FileTime.IsVisible(); bool restore = FileTime.IsVisible();
FileTime.hide(); FileTime.hide();
if (g_settings.mode_clock)
InfoClock->StopClock();
g_EpgData->show(CNeutrinoApp::getInstance()->channelList->getActiveChannel_ChannelID()); g_EpgData->show(CNeutrinoApp::getInstance()->channelList->getActiveChannel_ChannelID());
if(restore) { if(restore) {
FileTime.show(position / 1000); FileTime.show(position / 1000);
FileTime.updatePos(file_prozent);
} }
} else if ( msg == NeutrinoMessages::ZAPTO || } else if ( msg == NeutrinoMessages::ZAPTO ||
msg == NeutrinoMessages::STANDBY_ON || msg == NeutrinoMessages::STANDBY_ON ||
msg == NeutrinoMessages::SHUTDOWN || msg == NeutrinoMessages::SHUTDOWN ||
@@ -1308,10 +1134,7 @@ void CMoviePlayerGui::PlayFile(void)
} }
if (first_start_timeshift) { if (first_start_timeshift) {
g_InfoViewer->showTitle(CNeutrinoApp::getInstance()->channelList->getActiveChannelNumber(), callInfoViewer(p_movie_info, duration, position);
CNeutrinoApp::getInstance()->channelList->getActiveChannelName(),
CNeutrinoApp::getInstance()->channelList->getActiveSatellitePosition(),
CNeutrinoApp::getInstance()->channelList->getActiveChannel_ChannelID());
first_start_timeshift = false; first_start_timeshift = false;
} }
@@ -1349,11 +1172,17 @@ printf("CMoviePlayerGui::PlayFile: exit, isMovieBrowser %d p_movie_info %x\n", i
InfoClock->StartClock(); InfoClock->StartClock();
} }
void CMoviePlayerGui::callInfoViewer(const std::string & epg_title, const std::string & epg_info1, void CMoviePlayerGui::callInfoViewer(MI_MOVIE_INFO * p_movie_info, const int duration, const int curr_pos)
const std::string & epg_channel, const int duration, const int curr_pos)
{ {
if (isMovieBrowser) { if(timeshift) {
g_InfoViewer->showMovieTitle(playstate, epg_channel, epg_title, epg_info1, g_InfoViewer->showTitle(CNeutrinoApp::getInstance()->channelList->getActiveChannelNumber(),
CNeutrinoApp::getInstance()->channelList->getActiveChannelName(),
CNeutrinoApp::getInstance()->channelList->getActiveSatellitePosition(),
CNeutrinoApp::getInstance()->channelList->getActiveChannel_ChannelID());
return;
}
if (isMovieBrowser && p_movie_info) {
g_InfoViewer->showMovieTitle(playstate, p_movie_info->epgChannel, p_movie_info->epgTitle, p_movie_info->epgInfo1,
duration, curr_pos); duration, curr_pos);
return; return;
} }

View File

@@ -61,17 +61,9 @@ class CMoviePlayerGui : public CMenuTarget
PAUSE = 4, PAUSE = 4,
FF = 5, FF = 5,
REW = 6, REW = 6,
RESYNC = 7,
JPOS = 8, // jump to absolute position
JF = 9,
JB = 10,
SKIP = 11,
AUDIOSELECT = 12,
SOFTRESET = 99
}; };
private: private:
pthread_t rct;
CFrameBuffer * frameBuffer; CFrameBuffer * frameBuffer;
int m_LastMode; int m_LastMode;
const char *filename; const char *filename;
@@ -80,7 +72,6 @@ class CMoviePlayerGui : public CMenuTarget
bool isBookmark; bool isBookmark;
bool isMovieBrowser; bool isMovieBrowser;
int speed; int speed;
int slow;
off64_t fullposition; off64_t fullposition;
int startposition; int startposition;
int jumpseconds; int jumpseconds;
@@ -90,10 +81,6 @@ class CMoviePlayerGui : public CMenuTarget
std::string startfilename; std::string startfilename;
std::string Path_local; std::string Path_local;
std::string Path_vlc;
std::string Path_vlc_settings;
std::string g_file_epg;
std::string g_file_epg1;
static unsigned short g_numpida; static unsigned short g_numpida;
static unsigned short g_vtype; static unsigned short g_vtype;
static unsigned short g_vpid; static unsigned short g_vpid;
@@ -102,27 +89,22 @@ class CMoviePlayerGui : public CMenuTarget
CFileBrowser * filebrowser; CFileBrowser * filebrowser;
CMovieBrowser* moviebrowser; CMovieBrowser* moviebrowser;
CHintBox *hintBox;
CBookmarkManager * bookmarkmanager; CBookmarkManager * bookmarkmanager;
CFileFilter tsfilefilter; CFileFilter tsfilefilter;
CFileFilter pesfilefilter;
CFileFilter vlcfilefilter;
static cPlayback *playback; static cPlayback *playback;
static CMoviePlayerGui* instance_mp; static CMoviePlayerGui* instance_mp;
void Init(void); void Init(void);
void PlayStream(int streamtype);
void PlayFile(); void PlayFile();
void cutNeutrino(); void cutNeutrino();
void restoreNeutrino(); void restoreNeutrino();
void showHelpTS(void); void showHelpTS(void);
void showHelpVLC(void); void showHelpVLC(void);
void callInfoViewer(const std::string & epg_title, const std::string & epg_info1, void callInfoViewer(MI_MOVIE_INFO * p_movie_info, const int duration, const int pos);
const std::string & epg_channel, const int duration, const int pos);
void fillPids(MI_MOVIE_INFO * p_movie_info); void fillPids(MI_MOVIE_INFO * p_movie_info);
CMoviePlayerGui(const CMoviePlayerGui&) {}; CMoviePlayerGui(const CMoviePlayerGui&) {};

View File

@@ -30,43 +30,43 @@
#include <driver/fontrenderer.h> #include <driver/fontrenderer.h>
#include <system/settings.h> #include <system/settings.h>
#include <gui/widget/progressbar.h> #include <gui/widget/progressbar.h>
#include "gui/infoclock.h"
static CProgressBar *timescale = 0; //static CProgressBar *timescale = 0;
#define TIMEOSD_FONT SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME #define TIMEOSD_FONT SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME
#define BARLEN 200 #define BARLEN 200
extern CInfoClock *InfoClock;
CTimeOSD::CTimeOSD() CTimeOSD::CTimeOSD()
{ {
frameBuffer = CFrameBuffer::getInstance(); frameBuffer = CFrameBuffer::getInstance();
visible=false; visible=false;
m_mode=MODE_ASC; m_mode=MODE_ASC;
GetDimensions(); GetDimensions();
if (! timescale ){ timescale = new CProgressBar(true, BARLEN, m_height -5, 40, 100, 70, true);
if(m_height < 5) m_time_show = 0;
m_height = 10;
timescale = new CProgressBar(true, BARLEN, m_height -5, 40, 100, 70, true);
}
} }
CTimeOSD::~CTimeOSD() CTimeOSD::~CTimeOSD()
{ {
hide(); hide();
if(timescale) { delete timescale;
delete timescale;
timescale = 0;
}
} }
void CTimeOSD::show(time_t time_show) void CTimeOSD::show(time_t time_show)
{ {
if (g_settings.mode_clock)
InfoClock->StartClock();
GetDimensions(); GetDimensions();
visible = true; visible = true;
m_time_dis = time(NULL); SetMode(CTimeOSD::MODE_ASC);
m_time_show = time_show; m_time_show = 0;
frameBuffer->paintBoxRel(m_xstart-2, m_y, 2+BARLEN+2, m_height, COL_INFOBAR_SHADOW_PLUS_0); //border frameBuffer->paintBoxRel(m_xstart-2, m_y, 2+BARLEN+2, m_height, COL_INFOBAR_SHADOW_PLUS_0); //border
if(timescale) timescale->reset();
timescale->reset(); update(time_show);
update();
} }
void CTimeOSD::GetDimensions() void CTimeOSD::GetDimensions()
@@ -74,72 +74,92 @@ void CTimeOSD::GetDimensions()
m_xstart = g_settings.screen_StartX + 10; m_xstart = g_settings.screen_StartX + 10;
m_xend = frameBuffer->getScreenWidth(); m_xend = frameBuffer->getScreenWidth();
m_height = g_Font[TIMEOSD_FONT]->getHeight(); m_height = g_Font[TIMEOSD_FONT]->getHeight();
if(m_height < 10)
m_height = 10;
m_y = frameBuffer->getScreenY(); m_y = frameBuffer->getScreenY();
m_width = g_Font[TIMEOSD_FONT]->getRenderWidth("00:00:00"); m_width = g_Font[TIMEOSD_FONT]->getRenderWidth("00:00:00");
t1 = g_Font[TIMEOSD_FONT]->getRenderWidth(widest_number); t1 = g_Font[TIMEOSD_FONT]->getRenderWidth(widest_number);
m_width += t1; m_width += t1;
if(g_settings.mode_clock) { if(g_settings.mode_clock)
m_xend = m_xend - m_width - (m_width/4); m_xend = m_xend - m_width - (m_width/4);
}
} }
void CTimeOSD::update(time_t time_show) void CTimeOSD::update(time_t time_show)
{ {
time_t tDisplayTime;
static time_t oldDisplayTime = 0;
char cDisplayTime[8+1]; char cDisplayTime[8+1];
fb_pixel_t color1, color2; fb_pixel_t color1, color2;
//printf("CTimeOSD::update time %ld\n", time_show);
if(!visible) if(!visible)
return; return;
time_show /= 1000;
if(m_time_show == time_show)
return;
//printf("CTimeOSD::update time %ld -> %ld\n", m_time_show, time_show);
m_time_show = time_show;
if(m_mode == MODE_ASC) { if(m_mode == MODE_ASC) {
color1 = COL_MENUCONTENT_PLUS_0; color1 = COL_MENUCONTENT_PLUS_0;
color2 = COL_MENUCONTENT; color2 = COL_MENUCONTENT;
} else { } else {
color1 = COL_MENUCONTENTSELECTED_PLUS_0; color1 = COL_MENUCONTENTSELECTED_PLUS_0;
color2 = COL_MENUCONTENTSELECTED; color2 = COL_MENUCONTENTSELECTED;
if(!time_show) time_show = 1;
}
if(time_show) {
m_time_show = time_show;
tDisplayTime = m_time_show;
} else {
if(m_mode == MODE_ASC) {
tDisplayTime = m_time_show + (time(NULL) - m_time_dis);
} else {
tDisplayTime = m_time_show + (m_time_dis - time(NULL));
}
}
if(tDisplayTime < 0)
tDisplayTime=0;
if(tDisplayTime != oldDisplayTime) {
oldDisplayTime = tDisplayTime;
strftime(cDisplayTime, 9, "%T", gmtime(&tDisplayTime));
frameBuffer->paintBoxRel(m_xend - m_width - t1, m_y, m_width, m_height, color1,RADIUS_SMALL);
g_Font[TIMEOSD_FONT]->RenderString(m_xend - m_width - (t1/2), m_y + m_height, m_width, cDisplayTime, color2);
} }
strftime(cDisplayTime, 9, "%T", gmtime(&time_show));
frameBuffer->paintBoxRel(m_xend - m_width - t1, m_y, m_width, m_height, color1,RADIUS_SMALL);
g_Font[TIMEOSD_FONT]->RenderString(m_xend - m_width - (t1/2), m_y + m_height, m_width, cDisplayTime, color2);
} }
void CTimeOSD::updatePos(short runningPercent) void CTimeOSD::updatePos(short runningPercent)
{ {
if(timescale){ if(!visible)
if(runningPercent > 100 || runningPercent < 0){ return;
runningPercent = 0;
} if(runningPercent > 100 || runningPercent < 0)
timescale->paintProgressBar2(m_xstart, m_y, runningPercent); runningPercent = 0;
}
timescale->paintProgressBar2(m_xstart, m_y, runningPercent);
}
void CTimeOSD::update(int position, int duration)
{
if(!visible)
return;
int percent = 0;
if(duration > 100)
percent = (unsigned char) (position / (duration / 100));
if(m_mode == CTimeOSD::MODE_ASC)
update(position /* / 1000*/);
else
update((duration - position)/* / 1000 */);
updatePos(percent);
} }
void CTimeOSD::hide() void CTimeOSD::hide()
{ {
GetDimensions();
if(!visible) if(!visible)
return; return;
frameBuffer->paintBackgroundBoxRel(m_xend - m_width - t1, m_y, m_width, m_height);
visible=false;
if(timescale)
timescale->reset();
frameBuffer->paintBackgroundBoxRel(m_xstart-2, m_y, 2+BARLEN+2, m_height); //clear border
if (g_settings.mode_clock)
InfoClock->StopClock();
//GetDimensions();
frameBuffer->paintBackgroundBoxRel(m_xend - m_width - t1, m_y, m_width, m_height);
timescale->reset();
frameBuffer->paintBackgroundBoxRel(m_xstart-2, m_y, 2+BARLEN+2, m_height); //clear border
visible=false;
}
void CTimeOSD::switchMode(int position, int duration)
{
if(visible) {
if (GetMode() == CTimeOSD::MODE_ASC) {
SetMode(CTimeOSD::MODE_DESC);
update(position, duration);
} else
hide();
} else
show(position);
} }

View File

@@ -27,6 +27,7 @@
#include <time.h> #include <time.h>
#include <driver/framebuffer.h> #include <driver/framebuffer.h>
#include <gui/widget/progressbar.h>
class CTimeOSD class CTimeOSD
{ {
@@ -39,7 +40,8 @@ class CTimeOSD
private: private:
CFrameBuffer *frameBuffer; CFrameBuffer *frameBuffer;
time_t m_time_dis; CProgressBar *timescale;
time_t m_time_show; time_t m_time_show;
bool visible; bool visible;
int m_xstart,m_xend,m_y,m_height, m_width, t1; int m_xstart,m_xend,m_y,m_height, m_width, t1;
@@ -50,11 +52,13 @@ class CTimeOSD
CTimeOSD(); CTimeOSD();
~CTimeOSD(); ~CTimeOSD();
void show(time_t time_show); void show(time_t time_show);
void update(time_t time_show = 0); void update(time_t time_show);
void updatePos(short runningPercent); void updatePos(short runningPercent);
void hide(); void hide();
bool IsVisible() {return visible;} bool IsVisible() {return visible;}
void SetMode(mode m) { m_mode = m;} void SetMode(mode m) { m_mode = m;}
mode GetMode() { return m_mode;} mode GetMode() { return m_mode;}
void update(int position, int duration);
void switchMode(int position, int duration);
}; };
#endif #endif