mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-31 17:31:20 +02:00
gui/movieplayer.cpp: add position,duration, CTimeOSD class members;
add UpdatePosition() to be called from infoviewer; set infoviewer timer to 1 sec for playback
This commit is contained in:
@@ -148,6 +148,8 @@ void CMoviePlayerGui::cutNeutrino()
|
|||||||
|
|
||||||
CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE, NeutrinoMessages::mode_ts);
|
CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE, NeutrinoMessages::mode_ts);
|
||||||
m_LastMode = (CNeutrinoApp::getInstance()->getLastMode() | NeutrinoMessages::norezap);
|
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()
|
void CMoviePlayerGui::restoreNeutrino()
|
||||||
@@ -374,13 +376,13 @@ bool CMoviePlayerGui::SelectFile()
|
|||||||
if (cLine[strlen(cLine)-1]=='\r')
|
if (cLine[strlen(cLine)-1]=='\r')
|
||||||
cLine[strlen(cLine)-1]=0;
|
cLine[strlen(cLine)-1]=0;
|
||||||
|
|
||||||
int duration;
|
int dur;
|
||||||
sscanf(cLine, "#EXTINF:%d,%[^\n]\n", &duration, name);
|
sscanf(cLine, "#EXTINF:%d,%[^\n]\n", &dur, name);
|
||||||
if (strlen(cLine) > 0 && cLine[0]!='#')
|
if (strlen(cLine) > 0 && cLine[0]!='#')
|
||||||
{
|
{
|
||||||
char *url = strstr(cLine, "http://");
|
char *url = strstr(cLine, "http://");
|
||||||
if (url != NULL) {
|
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;
|
full_name = url;
|
||||||
if(strlen(name))
|
if(strlen(name))
|
||||||
file_name = name;
|
file_name = name;
|
||||||
@@ -415,13 +417,13 @@ void CMoviePlayerGui::PlayFile(void)
|
|||||||
neutrino_msg_data_t data;
|
neutrino_msg_data_t data;
|
||||||
menu_ret = menu_return::RETURN_REPAINT;
|
menu_ret = menu_return::RETURN_REPAINT;
|
||||||
|
|
||||||
int position = 0, duration = 0;
|
|
||||||
bool first_start_timeshift = false;
|
bool first_start_timeshift = false;
|
||||||
bool time_forced = false;
|
bool time_forced = false;
|
||||||
bool update_lcd = true;
|
bool update_lcd = true;
|
||||||
int eof = 0;
|
int eof = 0;
|
||||||
|
|
||||||
CTimeOSD FileTime;
|
//CTimeOSD FileTime;
|
||||||
|
position = 0, duration = 0;
|
||||||
|
|
||||||
playstate = CMoviePlayerGui::STOPPED;
|
playstate = CMoviePlayerGui::STOPPED;
|
||||||
printf("Startplay at %d seconds\n", startposition/1000);
|
printf("Startplay at %d seconds\n", startposition/1000);
|
||||||
@@ -489,7 +491,7 @@ void CMoviePlayerGui::PlayFile(void)
|
|||||||
updateLcd();
|
updateLcd();
|
||||||
}
|
}
|
||||||
if (first_start_timeshift) {
|
if (first_start_timeshift) {
|
||||||
callInfoViewer(duration, position);
|
callInfoViewer(/*duration, position*/);
|
||||||
first_start_timeshift = false;
|
first_start_timeshift = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -539,7 +541,7 @@ void CMoviePlayerGui::PlayFile(void)
|
|||||||
//update_lcd = true;
|
//update_lcd = true;
|
||||||
updateLcd();
|
updateLcd();
|
||||||
if (!timeshift)
|
if (!timeshift)
|
||||||
callInfoViewer(duration, position);
|
callInfoViewer(/*duration, position*/);
|
||||||
}
|
}
|
||||||
if (time_forced) {
|
if (time_forced) {
|
||||||
time_forced = false;
|
time_forced = false;
|
||||||
@@ -560,7 +562,7 @@ void CMoviePlayerGui::PlayFile(void)
|
|||||||
//update_lcd = true;
|
//update_lcd = true;
|
||||||
updateLcd();
|
updateLcd();
|
||||||
if (!timeshift)
|
if (!timeshift)
|
||||||
callInfoViewer(duration, position);
|
callInfoViewer(/*duration, position*/);
|
||||||
|
|
||||||
} else if (msg == (neutrino_msg_t) g_settings.mpkey_bookmark) {
|
} else if (msg == (neutrino_msg_t) g_settings.mpkey_bookmark) {
|
||||||
handleMovieBrowser((neutrino_msg_t) g_settings.mpkey_bookmark, position);
|
handleMovieBrowser((neutrino_msg_t) g_settings.mpkey_bookmark, position);
|
||||||
@@ -591,7 +593,7 @@ void CMoviePlayerGui::PlayFile(void)
|
|||||||
//update_lcd = true;
|
//update_lcd = true;
|
||||||
|
|
||||||
if (!timeshift)
|
if (!timeshift)
|
||||||
callInfoViewer(duration, position);
|
callInfoViewer(/*duration, position*/);
|
||||||
|
|
||||||
if (!FileTime.IsVisible()) {
|
if (!FileTime.IsVisible()) {
|
||||||
FileTime.show(position);
|
FileTime.show(position);
|
||||||
@@ -622,7 +624,7 @@ void CMoviePlayerGui::PlayFile(void)
|
|||||||
} else if (msg == CRCInput::RC_0) { // cancel bookmark jump
|
} else if (msg == CRCInput::RC_0) { // cancel bookmark jump
|
||||||
handleMovieBrowser(CRCInput::RC_0, position);
|
handleMovieBrowser(CRCInput::RC_0, position);
|
||||||
} else if (msg == CRCInput::RC_help || msg == CRCInput::RC_info) {
|
} else if (msg == CRCInput::RC_help || msg == CRCInput::RC_info) {
|
||||||
callInfoViewer(duration, position);
|
callInfoViewer(/*duration, position*/);
|
||||||
update_lcd = true;
|
update_lcd = true;
|
||||||
//showHelpTS();
|
//showHelpTS();
|
||||||
} else if(timeshift && (msg == CRCInput::RC_text || msg == CRCInput::RC_epg || msg == NeutrinoMessages::SHOW_EPG)) {
|
} 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();
|
InfoClock->StartClock();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMoviePlayerGui::callInfoViewer(const int duration, const int curr_pos)
|
void CMoviePlayerGui::callInfoViewer(/*const int duration, const int curr_pos*/)
|
||||||
{
|
{
|
||||||
if(timeshift) {
|
if(timeshift) {
|
||||||
g_InfoViewer->showTitle(CNeutrinoApp::getInstance()->channelList->getActiveChannelNumber(),
|
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) {
|
if (isMovieBrowser && p_movie_info) {
|
||||||
g_InfoViewer->showMovieTitle(playstate, p_movie_info->epgChannel, p_movie_info->epgTitle, p_movie_info->epgInfo1,
|
g_InfoViewer->showMovieTitle(playstate, p_movie_info->epgChannel, p_movie_info->epgTitle, p_movie_info->epgInfo1,
|
||||||
duration, curr_pos);
|
duration, position);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* not moviebrowser => use the filename as title */
|
/* 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)
|
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
|
CMovieInfo cMovieInfo; // funktions to save and load movie info
|
||||||
|
|
||||||
@@ -1150,6 +1152,18 @@ void CMoviePlayerGui::handleMovieBrowser(neutrino_msg_t msg, int position)
|
|||||||
return;
|
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()
|
void CMoviePlayerGui::showHelpTS()
|
||||||
{
|
{
|
||||||
Helpbox helpbox;
|
Helpbox helpbox;
|
||||||
|
@@ -41,6 +41,7 @@
|
|||||||
#include <gui/moviebrowser.h>
|
#include <gui/moviebrowser.h>
|
||||||
#include <gui/movieinfo.h>
|
#include <gui/movieinfo.h>
|
||||||
#include <gui/widget/hintbox.h>
|
#include <gui/widget/hintbox.h>
|
||||||
|
#include <gui/timeosd.h>
|
||||||
#include <driver/record.h>
|
#include <driver/record.h>
|
||||||
#include <playback.h>
|
#include <playback.h>
|
||||||
|
|
||||||
@@ -74,6 +75,9 @@ class CMoviePlayerGui : public CMenuTarget
|
|||||||
CMoviePlayerGui::state playstate;
|
CMoviePlayerGui::state playstate;
|
||||||
int speed;
|
int speed;
|
||||||
int startposition;
|
int startposition;
|
||||||
|
int position;
|
||||||
|
int duration;
|
||||||
|
CTimeOSD FileTime;
|
||||||
|
|
||||||
unsigned short numpida;
|
unsigned short numpida;
|
||||||
unsigned short vpid;
|
unsigned short vpid;
|
||||||
@@ -109,7 +113,7 @@ class CMoviePlayerGui : public CMenuTarget
|
|||||||
void restoreNeutrino();
|
void restoreNeutrino();
|
||||||
|
|
||||||
void showHelpTS(void);
|
void showHelpTS(void);
|
||||||
void callInfoViewer(const int duration, const int pos);
|
void callInfoViewer(/*const int duration, const int pos*/);
|
||||||
void fillPids();
|
void fillPids();
|
||||||
bool getAudioName(int pid, std::string &apidtitle);
|
bool getAudioName(int pid, std::string &apidtitle);
|
||||||
void selectAudioPid(bool file_player);
|
void selectAudioPid(bool file_player);
|
||||||
@@ -132,6 +136,9 @@ class CMoviePlayerGui : public CMenuTarget
|
|||||||
bool Playing() { return playing; };
|
bool Playing() { return playing; };
|
||||||
std::string CurrentAudioName() { return currentaudioname; };
|
std::string CurrentAudioName() { return currentaudioname; };
|
||||||
int GetSpeed() { return speed; }
|
int GetSpeed() { return speed; }
|
||||||
|
int GetPosition() { return position; }
|
||||||
|
int GetDuration() { return duration; }
|
||||||
|
void UpdatePosition();
|
||||||
int timeshift;
|
int timeshift;
|
||||||
int file_prozent;
|
int file_prozent;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user