4 Commits

Author SHA1 Message Date
GetAway
3ff02b06f2 ShowPicture: return boolean expression 2019-01-12 11:48:14 +01:00
Thilo Graf
da0d4290a3 version_hal: simplify methodes
adopt method names similar to cs name convention
2019-01-02 17:30:05 +01:00
Thilo Graf
9bd798def2 configure: remove config from separat include dir
Not really needed
2019-01-02 17:29:34 +01:00
Thilo Graf
3869c32e82 configure: add missing entry
build was broken
2019-01-01 21:03:12 +01:00
14 changed files with 90 additions and 69 deletions

View File

@@ -1,3 +1,7 @@
2018-01-12 GetAway1 <get-away@t-online.de>
ShowPicture: return boolean expression
2017-11-02 Thilo Graf <dbt@novatux.de> 2017-11-02 Thilo Graf <dbt@novatux.de>
version 0.2.0-generic-pc version 0.2.0-generic-pc

View File

@@ -351,13 +351,14 @@ void cVideo::SetVideoMode(analog_mode_t mode)
proc_put("/proc/stb/avs/0/colorformat", m, strlen(m)); proc_put("/proc/stb/avs/0/colorformat", m, strlen(m));
} }
void cVideo::ShowPicture(const char * fname) bool cVideo::ShowPicture(const char * fname)
{ {
vdec->ShowPicture(fname); return vdec->ShowPicture(fname);
} }
void VDec::ShowPicture(const char * fname) bool VDec::ShowPicture(const char * fname)
{ {
bool ret = false;
lt_debug("%s(%s)\n", __func__, fname); lt_debug("%s(%s)\n", __func__, fname);
char destname[512]; char destname[512];
char cmd[512]; char cmd[512];
@@ -369,18 +370,18 @@ void VDec::ShowPicture(const char * fname)
{ {
/* does not work and the driver does not seem to like it */ /* does not work and the driver does not seem to like it */
lt_info("%s: video_standby == true\n", __func__); lt_info("%s: video_standby == true\n", __func__);
return; return ret;
} }
if (fd < 0) if (fd < 0)
{ {
lt_info("%s: decoder not opened?\n", __func__); lt_info("%s: decoder not opened\n", __func__);
return; return ret;
} }
strcpy(destname, "/var/cache"); strcpy(destname, "/var/cache");
if (stat(fname, &st2)) if (stat(fname, &st2))
{ {
lt_info("%s: could not stat %s (%m)\n", __func__, fname); lt_info("%s: could not stat %s (%m)\n", __func__, fname);
return; return ret;
} }
mkdir(destname, 0755); mkdir(destname, 0755);
/* the cache filename is (example for /share/tuxbox/neutrino/icons/radiomode.jpg): /* the cache filename is (example for /share/tuxbox/neutrino/icons/radiomode.jpg):
@@ -430,10 +431,11 @@ void VDec::ShowPicture(const char * fname)
read(mfd, iframe, st.st_size); read(mfd, iframe, st.st_size);
show_iframe(fd, iframe, st.st_size); show_iframe(fd, iframe, st.st_size);
free(iframe); free(iframe);
ret = true;
out: out:
close(mfd); close(mfd);
pthread_mutex_unlock(&stillp_mutex); pthread_mutex_unlock(&stillp_mutex);
return; return ret;
} }
void cVideo::StopPicture() void cVideo::StopPicture()

View File

@@ -46,7 +46,7 @@ public:
int setBlank(int blank); int setBlank(int blank);
int SetStreamType(VIDEO_FORMAT type); int SetStreamType(VIDEO_FORMAT type);
void SetSyncMode(AVSYNC_TYPE mode); void SetSyncMode(AVSYNC_TYPE mode);
void ShowPicture(const char * fname); bool ShowPicture(const char * fname);
void Standby(unsigned int bOn); void Standby(unsigned int bOn);
void Pig(int x, int y, int w, int h, int osd_w, int osd_h); void Pig(int x, int y, int w, int h, int osd_w, int osd_h);

View File

@@ -19,37 +19,33 @@
#include <version_hal.h> #include <version_hal.h>
std::string getPackageVersion() void hal_get_lib_version(hal_libversion_t *ver)
{ {
return PACKAGE_VERSION; if (!ver)
} return;
int getPackageVersionMajor() //init struct
{ *ver = {"",0,0,0,"","",""};
return PACKAGE_VERSION_MAJOR;
}
int getPackageVersionMinor() #ifdef VERSION
{ ver->vVersion = VERSION;
return PACKAGE_VERSION_MINOR; #endif
} #ifdef PACKAGE_VERSION_MAJOR
ver->vMajor = PACKAGE_VERSION_MAJOR;
int getPackageVersionMicro() #endif
{ #ifdef PACKAGE_VERSION_MAJOR
return PACKAGE_VERSION_MICRO; ver->vMinor = PACKAGE_VERSION_MINOR;
} #endif
#ifdef PACKAGE_VERSION_MINOR
std::string getPackagenName() ver->vPatch = PACKAGE_VERSION_MICRO;
{ #endif
return PACKAGE_NAME; #ifdef PACKAGE_NAME
} ver->vName = PACKAGE_NAME;
#endif
std::string getPackageString() #ifdef PACKAGE_STRING
{ ver->vStr = PACKAGE_STRING;
return PACKAGE_STRING; #endif
} #ifdef PACKAGE_VERSION_GIT
ver->vGitDescribe = PACKAGE_VERSION_GIT;
std::string getPackageVersionGit() #endif
{
return PACKAGE_VERSION_GIT;
} }

View File

@@ -13,7 +13,7 @@ define(ver_git, m4_esyscmd([
AC_PACKAGE_NAME, PACKAGE_NAME_LIBSTB_HAL AC_PACKAGE_NAME, PACKAGE_NAME_LIBSTB_HAL
AC_INIT([Tuxbox-libstb-hal], [ver_major.ver_minor.ver_micro]) AC_INIT([Tuxbox-libstb-hal], [ver_major.ver_minor.ver_micro])
AM_INIT_AUTOMAKE AM_INIT_AUTOMAKE
AC_CONFIG_HEADERS([include/libstb-hal-config.h]) AC_CONFIG_HEADERS([libstb-hal-config.h:config.h.in])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])
AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_MACRO_DIR([m4])
AC_GNU_SOURCE AC_GNU_SOURCE

View File

@@ -282,16 +282,17 @@ void cVideo::SetVideoMode(analog_mode_t)
{ {
} }
void cVideo::ShowPicture(const char *fname) bool cVideo::ShowPicture(const char *fname)
{ {
vdec->ShowPicture(fname); return vdec->ShowPicture(fname);
} }
void VDec::ShowPicture(const char *fname) bool VDec::ShowPicture(const char *fname)
{ {
bool ret = false;
lt_info("%s(%s)\n", __func__, fname); lt_info("%s(%s)\n", __func__, fname);
if (access(fname, R_OK)) if (access(fname, R_OK))
return; return ret;
still_m.lock(); still_m.lock();
stillpicture = true; stillpicture = true;
buf_num = 0; buf_num = 0;
@@ -312,7 +313,7 @@ void VDec::ShowPicture(const char *fname)
if (avformat_open_input(&avfc, fname, NULL, NULL) < 0) { if (avformat_open_input(&avfc, fname, NULL, NULL) < 0) {
lt_info("%s: Could not open file %s\n", __func__, fname); lt_info("%s: Could not open file %s\n", __func__, fname);
return; return ret;
} }
if (avformat_find_stream_info(avfc, NULL) < 0) { if (avformat_find_stream_info(avfc, NULL) < 0) {
@@ -385,6 +386,7 @@ void VDec::ShowPicture(const char *fname)
buf_num--; buf_num--;
} }
buf_m.unlock(); buf_m.unlock();
ret = true;
} }
} }
av_packet_unref(&avpkt); av_packet_unref(&avpkt);
@@ -396,6 +398,7 @@ void VDec::ShowPicture(const char *fname)
out_close: out_close:
avformat_close_input(&avfc); avformat_close_input(&avfc);
lt_debug("%s(%s) end\n", __func__, fname); lt_debug("%s(%s) end\n", __func__, fname);
return ret;
} }
void cVideo::StopPicture() void cVideo::StopPicture()

View File

@@ -80,7 +80,7 @@ class VDec : public OpenThreads::Thread
int Stop(bool blank = true); int Stop(bool blank = true);
int SetStreamType(VIDEO_FORMAT type); int SetStreamType(VIDEO_FORMAT type);
void ShowPicture(const char * fname); bool ShowPicture(const char * fname);
void Pig(int x, int y, int w, int h); void Pig(int x, int y, int w, int h);
bool GetScreenImage(unsigned char * &data, int &xres, int &yres, bool get_video = true, bool get_osd = false, bool scale_to_video = false); bool GetScreenImage(unsigned char * &data, int &xres, int &yres, bool get_video = true, bool get_osd = false, bool scale_to_video = false);
SWFramebuffer *getDecBuf(void); SWFramebuffer *getDecBuf(void);

View File

@@ -3,13 +3,19 @@
#include <string> #include <string>
std::string getPackageVersion(); // library version functions
int getPackageVersionMajor(); typedef struct hal_libversion_t
int getPackageVersionMinor(); {
int getPackageVersionMicro(); std::string vVersion;
std::string getPackagenName(); int vMajor;
std::string getPackageString(); int vMinor;
std::string getPackageVersionGit(); int vPatch;;
std::string vName;
std::string vStr;
std::string vGitDescribe;
} hal_libversion_struct_t;
void hal_get_lib_version(hal_libversion_t *ver);
#endif //__VERSION_HAL_H__ #endif //__VERSION_HAL_H__

View File

@@ -189,7 +189,7 @@ class cVideo
bool SetCECMode(VIDEO_HDMI_CEC_MODE) { return true; }; bool SetCECMode(VIDEO_HDMI_CEC_MODE) { return true; };
void SetCECAutoView(bool) { return; }; void SetCECAutoView(bool) { return; };
void SetCECAutoStandby(bool) { return; }; void SetCECAutoStandby(bool) { return; };
void ShowPicture(const char * fname); bool ShowPicture(const char * fname);
void StopPicture(); void StopPicture();
void Standby(unsigned int bOn); void Standby(unsigned int bOn);
void Pig(int x, int y, int w, int h, int osd_w = 1064, int osd_h = 600); void Pig(int x, int y, int w, int h, int osd_w = 1064, int osd_h = 600);

View File

@@ -394,13 +394,14 @@ void cVideo::SetVideoMode(analog_mode_t mode)
proc_put("/proc/stb/avs/0/colorformat", m, strlen(m)); proc_put("/proc/stb/avs/0/colorformat", m, strlen(m));
} }
void cVideo::ShowPicture(const char * fname) bool cVideo::ShowPicture(const char * fname)
{ {
vdec->ShowPicture(fname); return vdec->ShowPicture(fname);
} }
void VDec::ShowPicture(const char * fname) bool VDec::ShowPicture(const char * fname)
{ {
bool ret = false;
lt_debug("%s(%s)\n", __func__, fname); lt_debug("%s(%s)\n", __func__, fname);
char destname[512]; char destname[512];
char cmd[512]; char cmd[512];
@@ -411,13 +412,19 @@ void VDec::ShowPicture(const char * fname)
{ {
/* does not work and the driver does not seem to like it */ /* does not work and the driver does not seem to like it */
lt_info("%s: video_standby == true\n", __func__); lt_info("%s: video_standby == true\n", __func__);
return; return ret;
} }
if (fd == -1)
{
lt_info("%s: decoder not opened\n", __func__);
return ret;
}
strcpy(destname, "/var/cache"); strcpy(destname, "/var/cache");
if (stat(fname, &st2)) if (stat(fname, &st2))
{ {
lt_info("%s: could not stat %s (%m)\n", __func__, fname); lt_info("%s: could not stat %s (%m)\n", __func__, fname);
return; return ret;
} }
mkdir(destname, 0755); mkdir(destname, 0755);
/* the cache filename is (example for /share/tuxbox/neutrino/icons/radiomode.jpg): /* the cache filename is (example for /share/tuxbox/neutrino/icons/radiomode.jpg):
@@ -470,10 +477,11 @@ void VDec::ShowPicture(const char * fname)
video_still_picture sp = { iframe, st.st_size }; video_still_picture sp = { iframe, st.st_size };
fop(ioctl, VIDEO_STILLPICTURE, &sp); fop(ioctl, VIDEO_STILLPICTURE, &sp);
free(iframe); free(iframe);
ret = true;
} }
out: out:
close(mfd); close(mfd);
return; return ret;
} }
void cVideo::StopPicture() void cVideo::StopPicture()

View File

@@ -46,7 +46,7 @@ public:
int Stop(bool blank = true); int Stop(bool blank = true);
int SetStreamType(VIDEO_FORMAT type); int SetStreamType(VIDEO_FORMAT type);
void SetSyncMode(AVSYNC_TYPE mode); void SetSyncMode(AVSYNC_TYPE mode);
void ShowPicture(const char * fname); bool ShowPicture(const char * fname);
void Standby(unsigned int bOn); void Standby(unsigned int bOn);
/* used internally by dmx */ /* used internally by dmx */

View File

@@ -75,7 +75,7 @@ public:
/* set video_system */ /* set video_system */
int SetVideoSystem(int video_system, bool remember = true); int SetVideoSystem(int video_system, bool remember = true);
void ShowPicture(const char * fname); bool ShowPicture(const char * fname);
void StopPicture(); void StopPicture();
void Standby(unsigned int bOn); void Standby(unsigned int bOn);
void Pig(int x, int y, int w, int h); void Pig(int x, int y, int w, int h);

View File

@@ -469,13 +469,14 @@ void VDec::SetVideoMode(analog_mode_t mode)
fop(ioctl, MPEG_VID_SET_OUTFMT, outputformat); fop(ioctl, MPEG_VID_SET_OUTFMT, outputformat);
} }
void cVideo::ShowPicture(const char * fname) bool cVideo::ShowPicture(const char * fname)
{ {
_vdec->ShowPicture(fname); return _vdec->ShowPicture(fname);
} }
void VDec::ShowPicture(const char * fname) bool VDec::ShowPicture(const char * fname)
{ {
bool ret = false;
lt_debug("%s(%s)\n", __FUNCTION__, fname); lt_debug("%s(%s)\n", __FUNCTION__, fname);
char destname[512]; char destname[512];
char cmd[512]; char cmd[512];
@@ -487,7 +488,7 @@ void VDec::ShowPicture(const char * fname)
if (stat(fname, &st2)) if (stat(fname, &st2))
{ {
lt_info("%s: could not stat %s (%m)\n", __func__, fname); lt_info("%s: could not stat %s (%m)\n", __func__, fname);
return; return ret;
} }
mkdir(destname, 0755); mkdir(destname, 0755);
/* the cache filename is (example for /share/tuxbox/neutrino/icons/radiomode.jpg): /* the cache filename is (example for /share/tuxbox/neutrino/icons/radiomode.jpg):
@@ -542,13 +543,14 @@ void VDec::ShowPicture(const char * fname)
/* writing twice seems to be more reliable */ /* writing twice seems to be more reliable */
fop(ioctl, MPEG_VID_STILLP_WRITE, &buf); fop(ioctl, MPEG_VID_STILLP_WRITE, &buf);
fop(ioctl, MPEG_VID_STILLP_WRITE, &buf); fop(ioctl, MPEG_VID_STILLP_WRITE, &buf);
ret = true;
} }
free(data); free(data);
} }
close(mfd); close(mfd);
out: out:
pthread_mutex_unlock(&stillp_mutex); pthread_mutex_unlock(&stillp_mutex);
return; return ret;
#if 0 #if 0
/* DirectFB based picviewer: works, but is slow and the infobar /* DirectFB based picviewer: works, but is slow and the infobar
draws in the same plane */ draws in the same plane */

View File

@@ -129,11 +129,11 @@ void cVideo::SetVideoMode(analog_mode_t)
{ {
} }
void cVideo::ShowPicture(const char *fname) bool cVideo::ShowPicture(const char *fname)
{ {
lt_info("%s(%s)\n", __func__, fname); lt_info("%s(%s)\n", __func__, fname);
if (access(fname, R_OK)) if (access(fname, R_OK))
return; return true;
} }
void cVideo::StopPicture() void cVideo::StopPicture()