#include <sys/stat.h>
#include <signal.h>
#include <getopt.h>
+#include <dirent.h>
#include "logoview.h"
#include "jpeg.h"
-#define LV_VERSION "1.01d"
+#define LV_VERSION "1.01e"
#define VERSIONSTR "\n\
-------------------------------------------------------------\n\
-- logoview v" LV_VERSION " * (C)2011-2012, M. Liebmann (micha-bbg) --\n\
{
ClearThis();
}
+#if HAVE_ARM_HARDWARE
+void CLogoView::InitOsd()
+{
+#ifdef LV_DEBUG
+ printf("[logoview] *** Init OSD ***\n");
+#endif
+ if (access("/proc/stb/fb/dst_left", R_OK) == 0) {
+ char buffer[64];
+ sprintf(buffer, "%8x", 0);
+ proc_put("/proc/stb/fb/dst_top", buffer, strlen(buffer));
+ proc_put("/proc/stb/fb/dst_left", buffer, strlen(buffer));
+ sprintf(buffer, "%8x", 576);
+ proc_put("/proc/stb/fb/dst_height", buffer, strlen(buffer));
+ sprintf(buffer, "%8x", 720);
+ proc_put("/proc/stb/fb/dst_width", buffer, strlen(buffer));
+ sprintf(buffer, "%8x", 1);
+ proc_put("/proc/stb/fb/dst_apply", buffer, strlen(buffer));
+ }
+}
+
+int CLogoView::proc_put(const char *path, const char *value, const int len)
+{
+ int ret, ret2;
+ int pfd = open(path, O_WRONLY);
+ if (pfd < 0)
+ return pfd;
+ ret = write(pfd, value, len);
+ ret2 = close(pfd);
+ if (ret2 < 0)
+ return ret2;
+ return ret;
+}
+
+int CLogoView::getpidof(const char *process)
+{
+ DIR *dp;
+ struct dirent *entry;
+ struct stat statbuf;
+
+ if ((dp = opendir("/proc")) == NULL)
+ {
+ fprintf(stderr, "Cannot open directory /proc\n");
+ return -1;
+ }
+
+ while ((entry = readdir(dp)) != NULL)
+ {
+ // get information about the file/folder
+ lstat(entry->d_name, &statbuf);
+ // files under /proc which start with a digit are processes
+ if (S_ISDIR(statbuf.st_mode) && isdigit(entry->d_name[0]))
+ {
+ // 14 chars for /proc//status + 0
+ char procpath[14 + strlen(entry->d_name)];
+ char procname[50];
+ FILE *file;
+
+ sprintf(procpath, "/proc/%s/status", entry->d_name);
+
+ if (! (file = fopen(procpath, "r")) ) {
+ continue;
+ }
+
+ fscanf(file,"%*s %s", procname);
+ fclose(file);
+
+ // only 15 char available
+ if (strncmp(procname, process, 15) == 0) {
+ return atoi(entry->d_name);
+ }
+ }
+ }
+ closedir (dp);
+ return 0;
+}
+#endif
void CLogoView::SetScreenBuf(unsigned char *buf, int r, int g, int b, int t)
{
default: return 0;
}
}
+#if HAVE_ARM_HARDWARE
+ if (! getpidof("neutrino"))
+ InitOsd();
+#endif
+
#if 1
fb = -1;
int count = 0;
return -1;
}
TIMER_STOP("[logoview] load pic ");
-
+#if HAVE_ARM_HARDWARE
+ int skalFaktor = 1;
+#else
int skalFaktor = 8;
+#endif
int skalKorr = 2;
if ( var_screeninfo.xres <= 2*skalFaktor + (var_screeninfo.xres - (screen_StartX + (var_screeninfo.xres - screen_EndX))))
//printf("##### tmp_xres: %d, tmp_yres: %d, xres: %d, yres: %d\n", tmp_xres, tmp_yres, xres, yres);
TIMER_START();
- PicBuf = Resize(PicBuf, x, y, xres, yres, false);
+ if ( x != (int)xres || y != (int)yres)
+ PicBuf = Resize(PicBuf, x, y, xres, yres, false);
TIMER_STOP("[logoview] Resize ");
#ifdef LV_DEBUG
printf("[logoview] %s - %dx%d, resize to %dx%d\n", start_logo.c_str(), x, y, xres, yres);