mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-31 01:11:06 +02:00
fix compile for coolstream hardware (works on HD2)
Conflicts:
src/driver/screenshot.cpp
Signed-off-by: Thilo Graf <dbt@novatux.de>
Origin commit data
------------------
Branch: ni/coolstream
Commit: 555f1858e8
Author: gixxpunk <thomas.harfmann@gmail.com>
Date: 2017-11-03 (Fri, 03 Nov 2017)
Origin message was:
------------------
- fix compile for coolstream hardware (works on HD2)
Conflicts:
src/driver/screenshot.cpp
Signed-off-by: Thilo Graf <dbt@novatux.de>
------------------
This commit was generated by Migit
This commit is contained in:
@@ -61,6 +61,7 @@ CScreenShot::CScreenShot(const std::string fname, screenshot_format_t fmt)
|
||||
format = fmt;
|
||||
filename = fname;
|
||||
pixel_data = NULL;
|
||||
#if !HAVE_SPARK_HARDWARE && !HAVE_DUCKBOX_HARDWARE
|
||||
fd = NULL;
|
||||
xres = 0;
|
||||
yres = 0;
|
||||
@@ -68,18 +69,31 @@ CScreenShot::CScreenShot(const std::string fname, screenshot_format_t fmt)
|
||||
scs_thread = 0;
|
||||
pthread_mutex_init(&thread_mutex, NULL);
|
||||
pthread_mutex_init(&getData_mutex, NULL);
|
||||
get_video = g_settings.screenshot_video;
|
||||
get_osd = g_settings.screenshot_mode;
|
||||
#endif
|
||||
xres = 0;
|
||||
yres = 0;
|
||||
get_video = g_settings.screenshot_mode & 1;
|
||||
get_osd = g_settings.screenshot_mode & 2;
|
||||
#if HAVE_COOL_HARDWARE
|
||||
scale_to_video = g_settings.screenshot_scale;
|
||||
#elif HAVE_GENERIC_HARDWARE || HAVE_ARM_HARDWARE
|
||||
scale_to_video = (g_settings.screenshot_mode == 3);
|
||||
#else
|
||||
scale_to_video = (g_settings.screenshot_mode == 3) & (g_settings.screenshot_res & 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
CScreenShot::~CScreenShot()
|
||||
{
|
||||
#if !HAVE_SPARK_HARDWARE && !HAVE_DUCKBOX_HARDWARE
|
||||
pthread_mutex_destroy(&thread_mutex);
|
||||
pthread_mutex_destroy(&getData_mutex);
|
||||
#endif
|
||||
// printf("[CScreenShot::%s:%d] thread: %p\n", __func__, __LINE__, this);
|
||||
}
|
||||
|
||||
#if !HAVE_SPARK_HARDWARE && !HAVE_DUCKBOX_HARDWARE
|
||||
|
||||
#ifdef BOXMODEL_CS_HD2
|
||||
|
||||
bool CScreenShot::mergeOsdScreen(uint32_t dx, uint32_t dy, fb_pixel_t* osdData)
|
||||
@@ -163,7 +177,8 @@ bool CScreenShot::GetData()
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#if 1 // to enable after libcs/drivers update
|
||||
#if !HAVE_GENERIC_HARDWARE
|
||||
// to enable after libcs/drivers update
|
||||
res = videoDecoder->GetScreenImage(pixel_data, xres, yres, get_video, get_osd, scale_to_video);
|
||||
#endif
|
||||
|
||||
@@ -171,7 +186,7 @@ bool CScreenShot::GetData()
|
||||
/* sort of hack. GXA used to transfer/convert live image to RGB,
|
||||
* so setup GXA back */
|
||||
CFrameBuffer::getInstance()->setupGXA();
|
||||
CFrameBuffer::getInstance()->add_gxa_sync_marker();
|
||||
//CFrameBuffer::getInstance()->add_gxa_sync_marker();
|
||||
CFrameBuffer::getInstance()->setActive(true);
|
||||
#endif
|
||||
pthread_mutex_unlock(&getData_mutex);
|
||||
@@ -207,7 +222,9 @@ bool CScreenShot::startThread()
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !HAVE_SPARK_HARDWARE && !HAVE_DUCKBOX_HARDWARE
|
||||
void* CScreenShot::initThread(void *arg)
|
||||
{
|
||||
CScreenShot *scs = static_cast<CScreenShot*>(arg);
|
||||
@@ -240,10 +257,50 @@ void CScreenShot::cleanupThread(void *arg)
|
||||
// printf("[CScreenShot::%s:%d] thread: %p\n", __func__, __LINE__, scs);
|
||||
delete scs;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAVE_COOL_HARDWARE
|
||||
/* start ::run in new thread to save file in selected format */
|
||||
bool CScreenShot::Start()
|
||||
{
|
||||
#else
|
||||
/* start ::run in new thread to save file in selected format */
|
||||
bool CScreenShot::Start(const std::string custom_cmd)
|
||||
{
|
||||
#endif
|
||||
#if HAVE_SPARK_HARDWARE || HAVE_DUCKBOX_HARDWARE
|
||||
std::string cmd = "/bin/grab ";
|
||||
if (get_osd && !get_video)
|
||||
cmd += "-o ";
|
||||
else if (!get_osd && get_video)
|
||||
cmd += "-v ";
|
||||
switch (format) {
|
||||
case FORMAT_PNG:
|
||||
cmd += "-p "; break;
|
||||
case FORMAT_JPG:
|
||||
cmd += "-j 100"; break;
|
||||
default:
|
||||
;
|
||||
}
|
||||
if (!scale_to_video)
|
||||
cmd += " -d";
|
||||
|
||||
if (xres) {
|
||||
char tmp[10];
|
||||
snprintf(tmp, sizeof(tmp), "%d", xres);
|
||||
cmd += "-w " + std::string(tmp);
|
||||
}
|
||||
|
||||
if (!custom_cmd.empty())
|
||||
cmd = "/bin/grab " + custom_cmd;
|
||||
|
||||
cmd += " '";
|
||||
cmd += filename;
|
||||
cmd += "'";
|
||||
fprintf(stderr, "running: %s\n", cmd.c_str());
|
||||
system(cmd.c_str());
|
||||
return true;
|
||||
#else
|
||||
set_threadname("n:screenshot");
|
||||
bool ret = false;
|
||||
if (GetData())
|
||||
@@ -251,8 +308,10 @@ bool CScreenShot::Start()
|
||||
else
|
||||
delete this;
|
||||
return ret;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !HAVE_SPARK_HARDWARE && !HAVE_DUCKBOX_HARDWARE
|
||||
/* save file in sync mode, return true if save ok, or false */
|
||||
bool CScreenShot::StartSync()
|
||||
{
|
||||
@@ -473,6 +532,7 @@ bool CScreenShot::SaveBmp()
|
||||
return true;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* create filename member from channel name and its current EPG data,
|
||||
@@ -505,13 +565,15 @@ void CScreenShot::MakeFileName(const t_channel_id channel_id)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (g_settings.screenshot_cover != 1) {
|
||||
pos = strlen(fname);
|
||||
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
gettimeofday(&tv, NULL);
|
||||
strftime(&(fname[pos]), sizeof(fname) - pos - 1, "_%Y%m%d_%H%M%S", localtime(&tv.tv_sec));
|
||||
pos = strlen(fname);
|
||||
snprintf(&(fname[pos]), sizeof(fname) - pos - 1, "_%03d", (int) tv.tv_usec/1000);
|
||||
}
|
||||
|
||||
switch (format) {
|
||||
case FORMAT_PNG:
|
||||
|
Reference in New Issue
Block a user