gui/movieplayer.cpp: add position,duration, CTimeOSD class members;

add UpdatePosition() to be called from infoviewer;
set infoviewer timer to 1 sec for playback


Origin commit data
------------------
Branch: ni/coolstream
Commit: 6554921ad4
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2013-03-26 (Tue, 26 Mar 2013)



------------------
This commit was generated by Migit
This commit is contained in:
[CST] Focus
2013-03-26 18:45:17 +04:00
parent 30ea241a2f
commit 3c65d4c0ff
2 changed files with 36 additions and 15 deletions

View File

@@ -148,6 +148,8 @@ void CMoviePlayerGui::cutNeutrino()
CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE, NeutrinoMessages::mode_ts);
m_LastMode = (CNeutrinoApp::getInstance()->getLastMode() | NeutrinoMessages::norezap);
/* set g_InfoViewer update timer to 1 sec, should be reset to default from restoreNeutrino->set neutrino mode */
g_InfoViewer->setUpdateTimer(1000 * 1000);
}
void CMoviePlayerGui::restoreNeutrino()
@@ -374,13 +376,13 @@ bool CMoviePlayerGui::SelectFile()
if (cLine[strlen(cLine)-1]=='\r')
cLine[strlen(cLine)-1]=0;
int duration;
sscanf(cLine, "#EXTINF:%d,%[^\n]\n", &duration, name);
int dur;
sscanf(cLine, "#EXTINF:%d,%[^\n]\n", &dur, name);
if (strlen(cLine) > 0 && cLine[0]!='#')
{
char *url = strstr(cLine, "http://");
if (url != NULL) {
printf("name %s [%d] url: %s\n", name, duration, url);
printf("name %s [%d] url: %s\n", name, dur, url);
full_name = url;
if(strlen(name))
file_name = name;
@@ -415,13 +417,13 @@ void CMoviePlayerGui::PlayFile(void)
neutrino_msg_data_t data;
menu_ret = menu_return::RETURN_REPAINT;
int position = 0, duration = 0;
bool first_start_timeshift = false;
bool time_forced = false;
bool update_lcd = true;
int eof = 0;
CTimeOSD FileTime;
//CTimeOSD FileTime;
position = 0, duration = 0;
playstate = CMoviePlayerGui::STOPPED;
printf("Startplay at %d seconds\n", startposition/1000);
@@ -489,7 +491,7 @@ void CMoviePlayerGui::PlayFile(void)
updateLcd();
}
if (first_start_timeshift) {
callInfoViewer(duration, position);
callInfoViewer(/*duration, position*/);
first_start_timeshift = false;
}
@@ -539,7 +541,7 @@ void CMoviePlayerGui::PlayFile(void)
//update_lcd = true;
updateLcd();
if (!timeshift)
callInfoViewer(duration, position);
callInfoViewer(/*duration, position*/);
}
if (time_forced) {
time_forced = false;
@@ -560,7 +562,7 @@ void CMoviePlayerGui::PlayFile(void)
//update_lcd = true;
updateLcd();
if (!timeshift)
callInfoViewer(duration, position);
callInfoViewer(/*duration, position*/);
} else if (msg == (neutrino_msg_t) g_settings.mpkey_bookmark) {
handleMovieBrowser((neutrino_msg_t) g_settings.mpkey_bookmark, position);
@@ -591,7 +593,7 @@ void CMoviePlayerGui::PlayFile(void)
//update_lcd = true;
if (!timeshift)
callInfoViewer(duration, position);
callInfoViewer(/*duration, position*/);
if (!FileTime.IsVisible()) {
FileTime.show(position);
@@ -622,7 +624,7 @@ void CMoviePlayerGui::PlayFile(void)
} else if (msg == CRCInput::RC_0) { // cancel bookmark jump
handleMovieBrowser(CRCInput::RC_0, position);
} else if (msg == CRCInput::RC_help || msg == CRCInput::RC_info) {
callInfoViewer(duration, position);
callInfoViewer(/*duration, position*/);
update_lcd = true;
//showHelpTS();
} else if(timeshift && (msg == CRCInput::RC_text || msg == CRCInput::RC_epg || msg == NeutrinoMessages::SHOW_EPG)) {
@@ -719,7 +721,7 @@ void CMoviePlayerGui::PlayFile(void)
InfoClock->StartClock();
}
void CMoviePlayerGui::callInfoViewer(const int duration, const int curr_pos)
void CMoviePlayerGui::callInfoViewer(/*const int duration, const int curr_pos*/)
{
if(timeshift) {
g_InfoViewer->showTitle(CNeutrinoApp::getInstance()->channelList->getActiveChannelNumber(),
@@ -733,12 +735,12 @@ void CMoviePlayerGui::callInfoViewer(const int duration, const int curr_pos)
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, position);
return;
}
/* not moviebrowser => use the filename as title */
g_InfoViewer->showMovieTitle(playstate, file_name, "", "", duration, curr_pos);
g_InfoViewer->showMovieTitle(playstate, file_name, "", "", duration, position);
}
bool CMoviePlayerGui::getAudioName(int apid, std::string &apidtitle)
@@ -896,7 +898,7 @@ void CMoviePlayerGui::selectAudioPid(bool file_player)
}
}
void CMoviePlayerGui::handleMovieBrowser(neutrino_msg_t msg, int position)
void CMoviePlayerGui::handleMovieBrowser(neutrino_msg_t msg, int /*position*/)
{
CMovieInfo cMovieInfo; // funktions to save and load movie info
@@ -1150,6 +1152,18 @@ void CMoviePlayerGui::handleMovieBrowser(neutrino_msg_t msg, int position)
return;
}
void CMoviePlayerGui::UpdatePosition()
{
if(playback->GetPosition(position, duration)) {
if(duration > 100)
file_prozent = (unsigned char) (position / (duration / 100));
FileTime.update(position, duration);
#ifdef DEBUG
printf("CMoviePlayerGui::PlayFile: speed %d position %d duration %d (%d, %d%%)\n", speed, position, duration, duration-position, file_prozent);
#endif
}
}
void CMoviePlayerGui::showHelpTS()
{
Helpbox helpbox;

View File

@@ -41,6 +41,7 @@
#include <gui/moviebrowser.h>
#include <gui/movieinfo.h>
#include <gui/widget/hintbox.h>
#include <gui/timeosd.h>
#include <driver/record.h>
#include <playback.h>
@@ -74,6 +75,9 @@ class CMoviePlayerGui : public CMenuTarget
CMoviePlayerGui::state playstate;
int speed;
int startposition;
int position;
int duration;
CTimeOSD FileTime;
unsigned short numpida;
unsigned short vpid;
@@ -109,7 +113,7 @@ class CMoviePlayerGui : public CMenuTarget
void restoreNeutrino();
void showHelpTS(void);
void callInfoViewer(const int duration, const int pos);
void callInfoViewer(/*const int duration, const int pos*/);
void fillPids();
bool getAudioName(int pid, std::string &apidtitle);
void selectAudioPid(bool file_player);
@@ -132,6 +136,9 @@ class CMoviePlayerGui : public CMenuTarget
bool Playing() { return playing; };
std::string CurrentAudioName() { return currentaudioname; };
int GetSpeed() { return speed; }
int GetPosition() { return position; }
int GetDuration() { return duration; }
void UpdatePosition();
int timeshift;
int file_prozent;
};