movieplayer: allow screenshots from stream

Origin commit data
------------------
Branch: ni/coolstream
Commit: 1ba3b901e0
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2019-03-18 (Mon, 18 Mar 2019)

Origin message was:
------------------
- movieplayer: allow screenshots from stream

------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
Jacek Jendrzej
2019-03-18 13:33:43 +01:00
committed by vanhofen
parent 2474ddb63f
commit 5e55999854

View File

@@ -80,6 +80,8 @@
#include <algorithm>
#include <iconv.h>
#include <system/stacktrace.h>
#include <ctime>
#include <iomanip>
//NI InfoIcons
#include <gui/infoicons.h>
@@ -3239,21 +3241,33 @@ void CMoviePlayerGui::makeScreenShot(bool autoshot, bool forcover)
snprintf(ending, sizeof(ending) - 1, "_%x.jpg", position);
std::string fname = file_name;
std::string tmp_str;
if (p_movie_info)
fname = p_movie_info->file.Name;
/* quick check we have file and not url as file name */
if (fname.c_str()[0] != '/') {
if (autoshot)
{
autoshot_done = true;
return;
return;
}
cover = false;
autoshot = false;
forcover = false;
std::time_t t = std::time(NULL);
std::tm tm = *std::localtime(&t);
std::stringstream ss;
ss << std::put_time(&tm, "%Y%m%d_%H%M%S");
tmp_str = ss.str();
}
tmp_str += ending;
std::string::size_type pos = fname.find_last_of('.');
if (pos != std::string::npos) {
fname.replace(pos, fname.length(), ending);
fname.replace(pos, fname.length(), tmp_str.c_str());
} else
fname += ending;
fname += tmp_str;
if (autoshot && !access(fname.c_str(), F_OK)) {
printf("CMoviePlayerGui::makeScreenShot: cover [%s] already exist..\n", fname.c_str());