mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-27 07:23:09 +02:00
Merge branch 'master' into pu/fb-setmode
Conflicts: src/driver/screenshot.h src/driver/screenshot.cpp acinclude.m4
This commit is contained in:
@@ -29,11 +29,6 @@ if test "$enable_reschange" = "yes"; then
|
|||||||
AC_DEFINE(ENABLE_CHANGE_OSD_RESOLUTION,1,[enable change the osd resolution])
|
AC_DEFINE(ENABLE_CHANGE_OSD_RESOLUTION,1,[enable change the osd resolution])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_ARG_ENABLE(tmsdk,
|
|
||||||
AS_HELP_STRING(--enable-tmsdk, compile inside sdk),
|
|
||||||
,[enable_tmsdk=no])
|
|
||||||
AM_CONDITIONAL(ENABLE_TMSDK,test "$enable_tmsdk" = "yes")
|
|
||||||
|
|
||||||
AC_MSG_CHECKING(target)
|
AC_MSG_CHECKING(target)
|
||||||
|
|
||||||
if test "$TARGET" = "native"; then
|
if test "$TARGET" = "native"; then
|
||||||
|
@@ -145,14 +145,12 @@ if BOXTYPE_COOL
|
|||||||
neutrino_LDADD += \
|
neutrino_LDADD += \
|
||||||
$(top_builddir)/lib/hardware/coolstream/libhwcaps.a
|
$(top_builddir)/lib/hardware/coolstream/libhwcaps.a
|
||||||
neutrino_LDADD += -lcoolstream-mt -lca-sc
|
neutrino_LDADD += -lcoolstream-mt -lca-sc
|
||||||
if ENABLE_TMSDK
|
|
||||||
else
|
|
||||||
if BOXMODEL_CS_HD2
|
if BOXMODEL_CS_HD2
|
||||||
neutrino_LDADD += -lca-ci -llnxtmvssUsr -llnxUKAL -llnxplatUsr -llnxtmasUsr -llnxdvbciUsr -llnxpvrUsr -llnxcssUsr -llnxnotifyqUsr -ltmpvrDataManager-cst -ltmpvrIndexStorage -llnxscsUsr
|
neutrino_LDADD += -lca-ci -llnxtmvssUsr -llnxUKAL -llnxplatUsr -llnxtmasUsr -llnxdvbciUsr -llnxpvrUsr -llnxcssUsr -llnxnotifyqUsr -ltmpvrDataManager-cst -ltmpvrIndexStorage -llnxscsUsr
|
||||||
else
|
else
|
||||||
neutrino_LDADD += -lnxp
|
neutrino_LDADD += -lnxp
|
||||||
endif
|
endif
|
||||||
endif
|
|
||||||
|
|
||||||
if BOXMODEL_CS_HD2
|
if BOXMODEL_CS_HD2
|
||||||
neutrino_LDADD += -liconv
|
neutrino_LDADD += -liconv
|
||||||
@@ -166,5 +164,4 @@ bin_PROGRAMS += rcsim
|
|||||||
rcsim_SOURCES = rcsim.c rcsim.h
|
rcsim_SOURCES = rcsim.c rcsim.h
|
||||||
bin_PROGRAMS += mdev_helper
|
bin_PROGRAMS += mdev_helper
|
||||||
mdev_helper_SOURCES = mdev_helper.cpp
|
mdev_helper_SOURCES = mdev_helper.cpp
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
Neutrino-GUI - DBoxII-Project
|
Neutrino-GUI - DBoxII-Project
|
||||||
|
|
||||||
Copyright (C) 2011 CoolStream International Ltd
|
Copyright (C) 2011 CoolStream International Ltd
|
||||||
|
Copyright (C) 2017 M. Liebmann (micha-bbg)
|
||||||
|
|
||||||
parts based on AiO Screengrabber (C) Seddi seddi@ihad.tv
|
parts based on AiO Screengrabber (C) Seddi seddi@ihad.tv
|
||||||
|
|
||||||
@@ -62,6 +63,9 @@ CScreenShot::CScreenShot(const std::string fname, screenshot_format_t fmt)
|
|||||||
xres = 0;
|
xres = 0;
|
||||||
yres = 0;
|
yres = 0;
|
||||||
extra_osd = false;
|
extra_osd = false;
|
||||||
|
scs_thread = 0;
|
||||||
|
pthread_mutex_init(&thread_mutex, NULL);
|
||||||
|
pthread_mutex_init(&getData_mutex, NULL);
|
||||||
get_video = g_settings.screenshot_video;
|
get_video = g_settings.screenshot_video;
|
||||||
get_osd = g_settings.screenshot_mode;
|
get_osd = g_settings.screenshot_mode;
|
||||||
scale_to_video = g_settings.screenshot_scale;
|
scale_to_video = g_settings.screenshot_scale;
|
||||||
@@ -69,6 +73,9 @@ CScreenShot::CScreenShot(const std::string fname, screenshot_format_t fmt)
|
|||||||
|
|
||||||
CScreenShot::~CScreenShot()
|
CScreenShot::~CScreenShot()
|
||||||
{
|
{
|
||||||
|
pthread_mutex_destroy(&thread_mutex);
|
||||||
|
pthread_mutex_destroy(&getData_mutex);
|
||||||
|
// printf("[CScreenShot::%s:%d] thread: %p\n", __func__, __LINE__, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BOXMODEL_CS_HD2
|
#ifdef BOXMODEL_CS_HD2
|
||||||
@@ -122,19 +129,17 @@ bool CScreenShot::GetData()
|
|||||||
extra_osd = true;
|
extra_osd = true;
|
||||||
screenBuf = new fb_pixel_t[_xres*_yres*sizeof(fb_pixel_t)];
|
screenBuf = new fb_pixel_t[_xres*_yres*sizeof(fb_pixel_t)];
|
||||||
if (screenBuf == NULL) {
|
if (screenBuf == NULL) {
|
||||||
printf("[%s:%s:%d] memory error\n", __path_file__, __func__, __LINE__);
|
printf("[CScreenShot::%s:%d] memory error\n", __func__, __LINE__);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
printf("\n[%s:%s:%d] Read osd screen...", __path_file__, __func__, __LINE__);
|
printf("\n[CScreenShot::%s:%d] Read osd screen...", __func__, __LINE__);
|
||||||
frameBuffer->SaveScreen(0, 0, _xres, _yres, screenBuf);
|
frameBuffer->SaveScreen(0, 0, _xres, _yres, screenBuf);
|
||||||
printf(" done.\n");
|
printf(" done.\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static OpenThreads::Mutex mutex;
|
|
||||||
bool res = false;
|
bool res = false;
|
||||||
|
pthread_mutex_lock(&getData_mutex);
|
||||||
mutex.lock();
|
|
||||||
|
|
||||||
#ifdef BOXMODEL_CS_HD1
|
#ifdef BOXMODEL_CS_HD1
|
||||||
CFrameBuffer::getInstance()->setActive(false);
|
CFrameBuffer::getInstance()->setActive(false);
|
||||||
@@ -147,7 +152,8 @@ bool CScreenShot::GetData()
|
|||||||
uint32_t memSize = xres * yres * sizeof(fb_pixel_t) * 2;
|
uint32_t memSize = xres * yres * sizeof(fb_pixel_t) * 2;
|
||||||
pixel_data = (uint8_t*)cs_malloc_uncached(memSize);
|
pixel_data = (uint8_t*)cs_malloc_uncached(memSize);
|
||||||
if (pixel_data == NULL) {
|
if (pixel_data == NULL) {
|
||||||
printf("[%s:%s:%d] memory error\n", __path_file__, __func__, __LINE__);
|
printf("[CScreenShot::%s:%d] memory error\n", __func__, __LINE__);
|
||||||
|
pthread_mutex_unlock(&getData_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
memset(pixel_data, 0, memSize);
|
memset(pixel_data, 0, memSize);
|
||||||
@@ -166,56 +172,92 @@ bool CScreenShot::GetData()
|
|||||||
CFrameBuffer::getInstance()->add_gxa_sync_marker();
|
CFrameBuffer::getInstance()->add_gxa_sync_marker();
|
||||||
CFrameBuffer::getInstance()->setActive(true);
|
CFrameBuffer::getInstance()->setActive(true);
|
||||||
#endif
|
#endif
|
||||||
mutex.unlock();
|
pthread_mutex_unlock(&getData_mutex);
|
||||||
if (!res) {
|
if (!res) {
|
||||||
printf("CScreenShot::Start: GetScreenImage failed\n");
|
printf("[CScreenShot::%s:%d] GetScreenImage failed\n", __func__, __LINE__);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BOXMODEL_CS_HD2
|
#ifdef BOXMODEL_CS_HD2
|
||||||
if (extra_osd && screenBuf) {
|
if (extra_osd && screenBuf) {
|
||||||
printf("[%s:%s:%d] Merge osd screen to screenshot...", __path_file__, __func__, __LINE__);
|
printf("[CScreenShot::%s:%d] Merge osd screen to screenshot...", __func__, __LINE__);
|
||||||
mergeOsdScreen(_xres, _yres, screenBuf);
|
mergeOsdScreen(_xres, _yres, screenBuf);
|
||||||
delete[] screenBuf;
|
delete[] screenBuf;
|
||||||
printf(" done.\n \n");
|
printf(" done.\n \n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
printf("CScreenShot::GetData: data: %p %d x %d\n", pixel_data, xres, yres);
|
printf("[CScreenShot::%s:%d] data: %p %d x %d\n", __func__, __LINE__, pixel_data, xres, yres);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CScreenShot::startThread()
|
||||||
|
{
|
||||||
|
if (!scs_thread) {
|
||||||
|
void *ptr = static_cast<void*>(this);
|
||||||
|
int res = pthread_create(&scs_thread, NULL, initThread, ptr);
|
||||||
|
if (res != 0) {
|
||||||
|
printf("[CScreenShot::%s:%d] ERROR! pthread_create\n", __func__, __LINE__);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
pthread_detach(scs_thread);
|
||||||
|
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, 0);
|
||||||
|
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, 0);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void* CScreenShot::initThread(void *arg)
|
||||||
|
{
|
||||||
|
CScreenShot *scs = static_cast<CScreenShot*>(arg);
|
||||||
|
pthread_cleanup_push(cleanupThread, scs);
|
||||||
|
// printf("[CScreenShot::%s:%d] thread: %p\n", __func__, __LINE__, scs);
|
||||||
|
|
||||||
|
scs->runThread();
|
||||||
|
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, 0);
|
||||||
|
pthread_exit(0);
|
||||||
|
|
||||||
|
pthread_cleanup_pop(0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* thread function to save data asynchroniosly. delete itself after saving */
|
||||||
|
void CScreenShot::runThread()
|
||||||
|
{
|
||||||
|
pthread_mutex_lock(&thread_mutex);
|
||||||
|
printf("[CScreenShot::%s:%d] save to %s format %d\n", __func__, __LINE__, filename.c_str(), format);
|
||||||
|
|
||||||
|
bool ret = SaveFile();
|
||||||
|
|
||||||
|
printf("[CScreenShot::%s:%d] %s finished: %d\n", __func__, __LINE__, filename.c_str(), ret);
|
||||||
|
pthread_mutex_unlock(&thread_mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CScreenShot::cleanupThread(void *arg)
|
||||||
|
{
|
||||||
|
CScreenShot *scs = static_cast<CScreenShot*>(arg);
|
||||||
|
// printf("[CScreenShot::%s:%d] thread: %p\n", __func__, __LINE__, scs);
|
||||||
|
delete scs;
|
||||||
|
}
|
||||||
|
|
||||||
/* start ::run in new thread to save file in selected format */
|
/* start ::run in new thread to save file in selected format */
|
||||||
bool CScreenShot::Start()
|
bool CScreenShot::Start()
|
||||||
{
|
{
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
if(GetData())
|
if (GetData())
|
||||||
ret = (start() == 0);
|
ret = startThread();
|
||||||
else
|
else
|
||||||
delete this;
|
delete this;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* thread function to save data asynchroniosly. delete itself after saving */
|
|
||||||
void CScreenShot::run()
|
|
||||||
{
|
|
||||||
printf("CScreenShot::run save to %s format %d\n", filename.c_str(), format);
|
|
||||||
detach();
|
|
||||||
setCancelModeDisable();
|
|
||||||
setSchedulePriority(THREAD_PRIORITY_MIN);
|
|
||||||
bool ret = SaveFile();
|
|
||||||
printf("CScreenShot::run: %s finished: %d\n", filename.c_str(), ret);
|
|
||||||
delete this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* save file in sync mode, return true if save ok, or false */
|
/* save file in sync mode, return true if save ok, or false */
|
||||||
bool CScreenShot::StartSync()
|
bool CScreenShot::StartSync()
|
||||||
{
|
{
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
printf("CScreenShot::StartSync save to %s format %d\n", filename.c_str(), format);
|
printf("[CScreenShot::%s:%d] save to %s format %d\n", __func__, __LINE__, filename.c_str(), format);
|
||||||
if(GetData())
|
if (GetData())
|
||||||
ret = SaveFile();
|
ret = SaveFile();
|
||||||
|
printf("[CScreenShot::%s:%d] %s finished: %d\n", __func__, __LINE__, filename.c_str(), ret);
|
||||||
printf("CScreenShot::StartSync: %s finished: %d\n", filename.c_str(), ret);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -309,7 +351,7 @@ bool CScreenShot::SavePng()
|
|||||||
|
|
||||||
free(row_pointers);
|
free(row_pointers);
|
||||||
fclose(fd);
|
fclose(fd);
|
||||||
TIMER_STOP(filename.c_str());
|
TIMER_STOP(("[CScreenShot::SavePng] " + filename).c_str());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -349,7 +391,7 @@ bool CScreenShot::SaveJpg()
|
|||||||
int xres2 = xres1+2;
|
int xres2 = xres1+2;
|
||||||
for (int x = 0; x < xres; x++) {
|
for (int x = 0; x < xres; x++) {
|
||||||
int x2 = x*3;
|
int x2 = x*3;
|
||||||
memmove(pixel_data + x2 + xres1, pixel_data + x*4 + y*xres*4, 3);
|
memcpy(pixel_data + x2 + xres1, pixel_data + x*4 + y*xres*4, 3);
|
||||||
SWAP(pixel_data[x2 + xres1], pixel_data[x2 + xres2]);
|
SWAP(pixel_data[x2 + xres1], pixel_data[x2 + xres2]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -390,7 +432,7 @@ bool CScreenShot::SaveJpg()
|
|||||||
jpeg_finish_compress(&cinfo);
|
jpeg_finish_compress(&cinfo);
|
||||||
jpeg_destroy_compress(&cinfo);
|
jpeg_destroy_compress(&cinfo);
|
||||||
fclose(fd);
|
fclose(fd);
|
||||||
TIMER_STOP(filename.c_str());
|
TIMER_STOP(("[CScreenShot::SaveJpg] " + filename).c_str());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -423,7 +465,7 @@ bool CScreenShot::SaveBmp()
|
|||||||
fwrite(pixel_data+(y*xres*4),xres*4,1,fd);
|
fwrite(pixel_data+(y*xres*4),xres*4,1,fd);
|
||||||
}
|
}
|
||||||
fclose(fd);
|
fclose(fd);
|
||||||
TIMER_STOP(filename.c_str());
|
TIMER_STOP(("[CScreenShot::SaveBmp] " + filename).c_str());
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
Neutrino-GUI - DBoxII-Project
|
Neutrino-GUI - DBoxII-Project
|
||||||
|
|
||||||
Copyright (C) 2011 CoolStream International Ltd
|
Copyright (C) 2011 CoolStream International Ltd
|
||||||
|
Copyright (C) 2017 M. Liebmann (micha-bbg)
|
||||||
|
|
||||||
License: GPLv2
|
License: GPLv2
|
||||||
|
|
||||||
@@ -22,9 +23,9 @@
|
|||||||
#ifndef __screenshot_h_
|
#ifndef __screenshot_h_
|
||||||
#define __screenshot_h_
|
#define __screenshot_h_
|
||||||
|
|
||||||
#include <OpenThreads/Thread>
|
#include <pthread.h>
|
||||||
|
|
||||||
class CScreenShot : public OpenThreads::Thread
|
class CScreenShot
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@@ -44,6 +45,9 @@ class CScreenShot : public OpenThreads::Thread
|
|||||||
bool get_video;
|
bool get_video;
|
||||||
bool scale_to_video;
|
bool scale_to_video;
|
||||||
FILE *fd;
|
FILE *fd;
|
||||||
|
pthread_t scs_thread;
|
||||||
|
pthread_mutex_t thread_mutex;
|
||||||
|
pthread_mutex_t getData_mutex;
|
||||||
|
|
||||||
bool GetData();
|
bool GetData();
|
||||||
bool OpenFile();
|
bool OpenFile();
|
||||||
@@ -52,7 +56,12 @@ class CScreenShot : public OpenThreads::Thread
|
|||||||
bool SavePng();
|
bool SavePng();
|
||||||
bool SaveJpg();
|
bool SaveJpg();
|
||||||
bool SaveBmp();
|
bool SaveBmp();
|
||||||
void run();
|
|
||||||
|
bool startThread();
|
||||||
|
static void* initThread(void *arg);
|
||||||
|
void runThread();
|
||||||
|
static void cleanupThread(void *arg);
|
||||||
|
|
||||||
#ifdef BOXMODEL_CS_HD2
|
#ifdef BOXMODEL_CS_HD2
|
||||||
bool mergeOsdScreen(uint32_t dx, uint32_t dy, fb_pixel_t* osdData);
|
bool mergeOsdScreen(uint32_t dx, uint32_t dy, fb_pixel_t* osdData);
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user