mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-30 08:51:04 +02:00
gui/movieplayer.cpp: auto-create movie thumbnail, if enabled,
at playback when position more than 5 min from start,
or on stop if position more than 10 minutes before end;
create movie thumbnail with RC_favorites key
Origin commit data
------------------
Branch: ni/coolstream
Commit: ebf37fd192
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2014-04-21 (Mon, 21 Apr 2014)
------------------
This commit was generated by Migit
This commit is contained in:
@@ -349,6 +349,7 @@ void CMoviePlayerGui::Cleanup()
|
||||
startposition = 0;
|
||||
is_file_player = false;
|
||||
p_movie_info = NULL;
|
||||
autoshot_done = false;
|
||||
}
|
||||
|
||||
void CMoviePlayerGui::makeFilename()
|
||||
@@ -640,6 +641,8 @@ void CMoviePlayerGui::PlayFile(void)
|
||||
g_PluginList->startPlugin_by_name(g_settings.movieplayer_plugin.c_str ());
|
||||
} else if (msg == (neutrino_msg_t) g_settings.mpkey_stop) {
|
||||
playstate = CMoviePlayerGui::STOPPED;
|
||||
if ((duration - position) > 600000)
|
||||
makeScreenShot(true);
|
||||
} else if (msg == (neutrino_msg_t) g_settings.mpkey_play) {
|
||||
if (time_forced) {
|
||||
time_forced = false;
|
||||
@@ -772,34 +775,7 @@ void CMoviePlayerGui::PlayFile(void)
|
||||
} else if (msg == NeutrinoMessages::SHOW_EPG) {
|
||||
handleMovieBrowser(NeutrinoMessages::SHOW_EPG, position);
|
||||
} else if (msg == (neutrino_msg_t) g_settings.key_screenshot) {
|
||||
|
||||
char ending[(sizeof(int)*2) + 6] = ".jpg";
|
||||
if(!g_settings.screenshot_cover)
|
||||
snprintf(ending, sizeof(ending) - 1, "_%x.jpg", position);
|
||||
|
||||
std::string fname = full_name;
|
||||
std::string::size_type pos = fname.find_last_of('.');
|
||||
if(pos != std::string::npos) {
|
||||
fname.replace(pos, fname.length(), ending);
|
||||
} else
|
||||
fname += ending;
|
||||
|
||||
if(!g_settings.screenshot_cover){
|
||||
pos = fname.find_last_of('/');
|
||||
if(pos != std::string::npos) {
|
||||
fname.replace(0, pos, g_settings.screenshot_dir);
|
||||
}
|
||||
}
|
||||
|
||||
#if 0 // TODO disable overwrite ?
|
||||
if(!access(fname.c_str(), F_OK)) {
|
||||
}
|
||||
#endif
|
||||
CScreenShot * sc = new CScreenShot(fname);
|
||||
if(g_settings.screenshot_cover && !g_settings.screenshot_video)
|
||||
sc->EnableVideo(true);
|
||||
sc->Start();
|
||||
|
||||
makeScreenShot();
|
||||
} else if ( msg == NeutrinoMessages::EVT_SUBT_MESSAGE) {
|
||||
showSubtitle(data);
|
||||
} else if ( msg == NeutrinoMessages::ANNOUNCE_RECORD ||
|
||||
@@ -815,9 +791,12 @@ void CMoviePlayerGui::PlayFile(void)
|
||||
|
||||
playstate = CMoviePlayerGui::STOPPED;
|
||||
g_RCInput->postMsg(msg, data);
|
||||
} else if (msg == CRCInput::RC_timeout) {
|
||||
// nothing
|
||||
} else if (msg == CRCInput::RC_sat || msg == CRCInput::RC_favorites) {
|
||||
} else if (msg == CRCInput::RC_timeout || msg == NeutrinoMessages::EVT_TIMER) {
|
||||
if (playstate == CMoviePlayerGui::PLAY && position >= 300000)
|
||||
makeScreenShot(true);
|
||||
} else if (msg == CRCInput::RC_favorites) {
|
||||
makeScreenShot(false, true);
|
||||
} else if (msg == CRCInput::RC_sat) {
|
||||
//FIXME do nothing ?
|
||||
} else {
|
||||
if (CNeutrinoApp::getInstance()->handleMsg(msg, data) & messages_return::cancel_all) {
|
||||
@@ -1730,3 +1709,51 @@ bool CMoviePlayerGui::mountIso(CFile *file)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void CMoviePlayerGui::makeScreenShot(bool autoshot, bool forcover)
|
||||
{
|
||||
if (autoshot) {
|
||||
if (autoshot_done || !g_settings.auto_cover)
|
||||
return;
|
||||
autoshot_done = true;
|
||||
}
|
||||
|
||||
bool cover = autoshot || g_settings.screenshot_cover || forcover;
|
||||
char ending[(sizeof(int)*2) + 6] = ".jpg";
|
||||
if (!cover)
|
||||
snprintf(ending, sizeof(ending) - 1, "_%x.jpg", position);
|
||||
|
||||
std::string fname = full_name;
|
||||
std::string::size_type pos = fname.find_last_of('.');
|
||||
if (pos != std::string::npos) {
|
||||
fname.replace(pos, fname.length(), ending);
|
||||
} else
|
||||
fname += ending;
|
||||
|
||||
if (autoshot && !access(fname.c_str(), F_OK)) {
|
||||
printf("CMoviePlayerGui::makeScreenShot: cover [%s] already exist..\n", fname.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!cover) {
|
||||
pos = fname.find_last_of('/');
|
||||
if(pos != std::string::npos)
|
||||
fname.replace(0, pos, g_settings.screenshot_dir);
|
||||
}
|
||||
|
||||
|
||||
CScreenShot * sc = new CScreenShot(fname);
|
||||
if (cover) {
|
||||
sc->EnableVideo(true);
|
||||
}
|
||||
if (autoshot || forcover) {
|
||||
int xres = 0, yres = 0, framerate;
|
||||
videoDecoder->getPictureInfo(xres, yres, framerate);
|
||||
if (xres && yres) {
|
||||
int w = std::min(300, xres);
|
||||
int h = (float) yres / ((float) xres / (float) w);
|
||||
sc->SetSize(w, h);
|
||||
}
|
||||
}
|
||||
sc->Start();
|
||||
}
|
||||
|
@@ -113,6 +113,7 @@ class CMoviePlayerGui : public CMenuTarget
|
||||
CFileFilter tsfilefilter;
|
||||
std::string Path_local;
|
||||
int menu_ret;
|
||||
bool autoshot_done;
|
||||
|
||||
/* playback from bookmark */
|
||||
CBookmarkManager * bookmarkmanager;
|
||||
@@ -147,6 +148,7 @@ class CMoviePlayerGui : public CMenuTarget
|
||||
void parsePlaylist(CFile *file);
|
||||
bool mountIso(CFile *file);
|
||||
void makeFilename();
|
||||
void makeScreenShot(bool autoshot = false, bool forcover = false);
|
||||
|
||||
void Cleanup();
|
||||
static void *ShowStartHint(void *arg);
|
||||
|
Reference in New Issue
Block a user