15 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
Thilo Graf
ed8e3743d5 version_hal.cpp/h: add methodes to get package data 2019-01-01 16:03:12 +01:00
Thilo Graf
bc9eca8588 configure: add additional config header
config.h was not usable with neutrino.
2018-12-31 11:21:41 +01:00
Thilo Graf
1e47a62926 .gitignore: ignore some unneeded config and local stuff
picked from mpx branch
2018-12-31 11:20:31 +01:00
Jacek Jendrzej
4fecdd558a fix generic compil 2018-12-01 12:35:02 +01:00
Jacek Jendrzej
2e8aa93895 add getFD 2018-02-17 13:28:03 +01:00
Jacek Jendrzej
8d6b3f71c0 add dumb functions for streaminfo2 compil 2017-12-13 17:26:57 +01:00
Jacek Jendrzej
2673ba0940 fix possible segfault 2017-12-07 11:39:27 +01:00
Jacek Jendrzej
78b3403303 fix generic compil 2017-12-07 11:13:28 +01:00
Jacek Jendrzej
dd01a95ddb Revert "remove unused"
This reverts commit 3f9525e42e.
2017-11-03 19:57:28 +01:00
Jacek Jendrzej
3f9525e42e remove unused 2017-11-03 19:01:09 +01:00
Jacek Jendrzej
a47c399a19 fix generic build 2017-11-03 18:27:35 +01:00
27 changed files with 197 additions and 44 deletions

3
.gitignore vendored
View File

@@ -4,8 +4,11 @@ Makefile.in
/config.guess
/config.h.in
/config.sub
*/*-config.h
*/*-config.h.in
/configure
/compile
*.directory
/depcomp
/install-sh
/ltmain.sh

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>
version 0.2.0-generic-pc

View File

@@ -3,7 +3,7 @@ ACLOCAL_AMFLAGS = -I m4
lib_LTLIBRARIES = libstb-hal.la
libstb_hal_la_SOURCES =
SUBDIRS = common tools
bin_PROGRAMS = libstb-hal-test
#bin_PROGRAMS = libstb-hal-test
libstb_hal_la_LIBADD = \
common/libcommon.la
@@ -59,5 +59,5 @@ pkginclude_HEADERS = \
include/playback_hal.h \
include/pwrmngr.h \
include/record_hal.h \
include/video_cs.h \
include/video_hal.h
include/version_hal.h \
include/video_cs.h

View File

@@ -30,7 +30,9 @@ hw_caps_t *get_hwcaps(void)
caps.display_type = HW_DISPLAY_LINE_TEXT;
caps.has_HDMI = 1;
caps.display_xres = 8;
caps.can_set_display_brightness = 0;
caps.display_has_statusline = 0;
caps.display_can_deepstandby = 0;
caps.display_can_set_brightness = 0;
strcpy(caps.boxvendor, "AZBox");
const char *tmp;
char buf[64];

View File

@@ -351,13 +351,14 @@ void cVideo::SetVideoMode(analog_mode_t mode)
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);
char destname[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 */
lt_info("%s: video_standby == true\n", __func__);
return;
return ret;
}
if (fd < 0)
{
lt_info("%s: decoder not opened?\n", __func__);
return;
lt_info("%s: decoder not opened\n", __func__);
return ret;
}
strcpy(destname, "/var/cache");
if (stat(fname, &st2))
{
lt_info("%s: could not stat %s (%m)\n", __func__, fname);
return;
return ret;
}
mkdir(destname, 0755);
/* 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);
show_iframe(fd, iframe, st.st_size);
free(iframe);
ret = true;
out:
close(mfd);
pthread_mutex_unlock(&stillp_mutex);
return;
return ret;
}
void cVideo::StopPicture()

View File

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

View File

@@ -9,4 +9,5 @@ libcommon_la_SOURCES = \
ca.cpp \
lt_debug.c \
proc_tools.c \
pwrmngr.cpp
pwrmngr.cpp \
version_hal.cpp

51
common/version_hal.cpp Normal file
View File

@@ -0,0 +1,51 @@
/*
* (C) 2018 Thilo Graf
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <libstb-hal-config.h>
#include <version_hal.h>
void hal_get_lib_version(hal_libversion_t *ver)
{
if (!ver)
return;
//init struct
*ver = {"",0,0,0,"","",""};
#ifdef VERSION
ver->vVersion = VERSION;
#endif
#ifdef PACKAGE_VERSION_MAJOR
ver->vMajor = PACKAGE_VERSION_MAJOR;
#endif
#ifdef PACKAGE_VERSION_MAJOR
ver->vMinor = PACKAGE_VERSION_MINOR;
#endif
#ifdef PACKAGE_VERSION_MINOR
ver->vPatch = PACKAGE_VERSION_MICRO;
#endif
#ifdef PACKAGE_NAME
ver->vName = PACKAGE_NAME;
#endif
#ifdef PACKAGE_STRING
ver->vStr = PACKAGE_STRING;
#endif
#ifdef PACKAGE_VERSION_GIT
ver->vGitDescribe = PACKAGE_VERSION_GIT;
#endif
}

View File

@@ -1,9 +1,28 @@
AC_INIT([libstb-hal], [0.2.0])
# explicit defines for separate revision handling
define(ver_major, 0)
define(ver_minor, 2)
define(ver_micro, 1)
# sync with current git
define(ver_git, m4_esyscmd([
GITBRANCH=$(git rev-parse --abbrev-ref HEAD);
GITDESCRIBE=$(git describe --always --tags --dirty);
printf "$GITDESCRIBE $GITBRANCH"
]))
AC_PACKAGE_NAME, PACKAGE_NAME_LIBSTB_HAL
AC_INIT([Tuxbox-libstb-hal], [ver_major.ver_minor.ver_micro])
AM_INIT_AUTOMAKE
AC_CONFIG_HEADERS([libstb-hal-config.h:config.h.in])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])
AC_CONFIG_MACRO_DIR([m4])
AC_GNU_SOURCE
AC_DEFINE(PACKAGE_VERSION_MAJOR, ver_major, [Major version number])
AC_DEFINE(PACKAGE_VERSION_MINOR, ver_minor, [Minor version number])
AC_DEFINE(PACKAGE_VERSION_MICRO, ver_micro, [Micro version number])
AC_DEFINE(PACKAGE_VERSION_GIT, "ver_git", [internal vcs version info])
TUXBOX_APPS
TUXBOX_APPS_DIRECTORY
TUXBOX_BOXTYPE

View File

@@ -438,8 +438,9 @@ void ADec::run()
adevice = ao_open_live(driver, &sformat, NULL);
ai = ao_driver_info(driver);
lt_info("%s: changed params ch %d srate %d bits %d adevice %p\n",
__func__, o_ch, o_sr, 16, adevice);;
lt_info("libao driver: %d name '%s' short '%s' author '%s'\n",
__func__, o_ch, o_sr, 16, adevice);
if(ai)
lt_info("libao driver: %d name '%s' short '%s' author '%s'\n",
driver, ai->name, ai->short_name, ai->author);
}
#if 0

View File

@@ -28,7 +28,10 @@ hw_caps_t *get_hwcaps(void)
caps.display_type = HW_DISPLAY_LINE_TEXT;
caps.has_HDMI = 1;
caps.display_xres = 8;
caps.can_set_display_brightness = 0;
caps.display_can_deepstandby = 0;
caps.display_can_set_brightness = 0;
caps.display_has_statusline = 0;
caps.has_button_vformat = 0;
strcpy(caps.boxvendor, "Generic");
strcpy(caps.boxname, "PC");
if (! uname(&u))

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

View File

@@ -80,7 +80,7 @@ class VDec : public OpenThreads::Thread
int Stop(bool blank = true);
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);
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);

View File

@@ -7,6 +7,10 @@
#include <stdint.h>
#include "cs_types.h"
#include <vector>
#include <set>
typedef std::set<int> ca_map_t;
typedef ca_map_t::iterator ca_map_iterator_t;
typedef std::vector<u16> CaIdVector;
typedef std::vector<u16>::iterator CaIdVectorIterator;
typedef std::vector<u16>::const_iterator CaIdVectorConstIterator;
@@ -92,6 +96,8 @@ public:
static cCA *GetInstance(void);
bool SendPMT(int Unit, unsigned char *Data, int Len, CA_SLOT_TYPE SlotType = CA_SLOT_TYPE_ALL);
bool SendCAPMT(u64 /*Source*/, u8 /*DemuxSource*/, u8 /*DemuxMask*/, const unsigned char * /*CAPMT*/, u32 /*CAPMTLen*/, const unsigned char * /*RawPMT*/, u32 /*RawPMTLen*/, enum CA_SLOT_TYPE SlotType = CA_SLOT_TYPE_ALL) { (void)SlotType; return true; };
bool SendCAPMT(u64 /*Source*/, u8 /*DemuxSource*/, u8 /*DemuxMask*/, const unsigned char * /*CAPMT*/, u32 /*CAPMTLen*/, const unsigned char * /*RawPMT*/, u32 /*RawPMTLen*/, enum CA_SLOT_TYPE SlotType = CA_SLOT_TYPE_ALL, unsigned char scrambled = 0, ca_map_t camap ={0}, int mode = 0, bool enable = false) { (void)SlotType;(void)scrambled;(void)camap;(void)mode;(void)enable; return true; };
bool SendMessage(const CA_MESSAGE *Msg);
void SetInitMask(enum CA_INIT_MASK InitMask);
int GetCAIDS(CaIdVector & /*Caids*/) { return 0; };

View File

@@ -81,6 +81,7 @@ public:
static int GetSource(int unit);
cDemux(int num = 0);
~cDemux();
int getFD(void) { return fd; }; /* needed by cPlayback class */
private:
void removePid(unsigned short Pid); /* needed by cRecord class */
int num;

View File

@@ -36,7 +36,10 @@ typedef struct hw_caps
display_type_t display_type;
int display_xres; /* x resolution or chars per line */
int display_yres;
int can_set_display_brightness;
int display_can_deepstandby;
int display_can_set_brightness;
int display_has_statusline;
int has_button_vformat;
char boxvendor[64];
char boxname[64];
char boxarch[64];

View File

@@ -22,6 +22,10 @@
#include <stdint.h>
#include <vector>
extern "C" {
#include <libavformat/avformat.h>
}
/*
* This is actually the max number that could be returned by
* FindAllPids() / FindAllSubs().
@@ -49,6 +53,7 @@ public:
bool GetPosition(int &position, int &duration);
bool SetPosition(int position, bool absolute = false);
void FindAllPids(uint16_t *pids, unsigned short *aud_flags, uint16_t *num, std::string *language);
void FindAllPids(int *apids, unsigned int *ac3flags, uint32_t *numpida, std::string *language){FindAllPids((uint16_t*)apids, (unsigned short*)ac3flags, (uint16_t*) numpida, language);}
void FindAllSubs(uint16_t *pids, unsigned short *supported, uint16_t *num, std::string *language);
bool SelectSubtitles(int pid, std::string charset = "");
void GetChapters(std::vector<int> &positions, std::vector<std::string> &titles);
@@ -56,6 +61,17 @@ public:
void GetTitles(std::vector<int> &playlists, std::vector<std::string> &titles, int &current);
void SetTitle(int title);
uint64_t GetReadCount(void);
void FindAllTeletextsubtitlePids(int *, unsigned int *numpids, std::string *, int *, int *){*numpids = 0;}
void FindAllSubtitlePids(int * /*pids*/, unsigned int *numpids, std::string * /*language*/){*numpids = 0;}
int GetSubtitlePid(void){return 0;}
bool SetTeletextPid(int /*pid*/){return true;}
int GetAPid(){return 0;}
void GetMetadata(std::vector<std::string> /*&keys*/, std::vector<std::string> /*&values*/){}
void GetPts(uint64_t &/*pts*/){}
bool SetSubtitlePid(int /*pid*/){return false;}
AVFormatContext *GetAVFormatContext(){return NULL;}
void ReleaseAVFormatContext(){}
//
cPlayback(int num = 0);
~cPlayback();

22
include/version_hal.h Normal file
View File

@@ -0,0 +1,22 @@
#ifndef __VERSION_HAL_H__
#define __VERSION_HAL_H__
#include <string>
// library version functions
typedef struct hal_libversion_t
{
std::string vVersion;
int vMajor;
int vMinor;
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__

View File

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

View File

@@ -37,7 +37,9 @@ hw_caps_t *get_hwcaps(void)
caps.has_HDMI = 1;
caps.has_SCART = 1;
caps.display_xres = 4;
caps.can_set_display_brightness = 0;
caps.display_has_statusline = 0;
caps.display_can_deepstandby = 0;
caps.display_can_set_brightness = 0;
caps.force_tuner_2G = 1; /* I have patched the drivers to fix this, but not everyone has */
strcpy(caps.boxvendor, "SPARK");
const char *tmp;

View File

@@ -394,13 +394,14 @@ void cVideo::SetVideoMode(analog_mode_t mode)
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);
char destname[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 */
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");
if (stat(fname, &st2))
{
lt_info("%s: could not stat %s (%m)\n", __func__, fname);
return;
return ret;
}
mkdir(destname, 0755);
/* 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 };
fop(ioctl, VIDEO_STILLPICTURE, &sp);
free(iframe);
ret = true;
}
out:
close(mfd);
return;
return ret;
}
void cVideo::StopPicture()

View File

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

View File

@@ -23,7 +23,9 @@ static hw_caps_t caps = {
.display_type = HW_DISPLAY_GFX,
.display_xres = 128,
.display_yres = 64,
.can_set_display_brightness = 0,
.display_has_statusline = 0,
.display_can_deepstandby = 0;
.display_can_set_brightness = 0;
.boxvendor = "Armas",
.boxname = "TripleDragon",
.boxarch = "ppc405"

View File

@@ -75,7 +75,7 @@ public:
/* set video_system */
int SetVideoSystem(int video_system, bool remember = true);
void ShowPicture(const char * fname);
bool ShowPicture(const char * fname);
void StopPicture();
void Standby(unsigned int bOn);
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);
}
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);
char destname[512];
char cmd[512];
@@ -487,7 +488,7 @@ void VDec::ShowPicture(const char * fname)
if (stat(fname, &st2))
{
lt_info("%s: could not stat %s (%m)\n", __func__, fname);
return;
return ret;
}
mkdir(destname, 0755);
/* 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 */
fop(ioctl, MPEG_VID_STILLP_WRITE, &buf);
fop(ioctl, MPEG_VID_STILLP_WRITE, &buf);
ret = true;
}
free(data);
}
close(mfd);
out:
pthread_mutex_unlock(&stillp_mutex);
return;
return ret;
#if 0
/* DirectFB based picviewer: works, but is slow and the infobar
draws in the same plane */

View File

@@ -29,7 +29,9 @@ hw_caps_t *get_hwcaps(void)
caps.display_type = HW_DISPLAY_LINE_TEXT;
caps.has_HDMI = 1;
caps.display_xres = 8;
caps.can_set_display_brightness = 0;
caps.display_has_statusline = 0;
caps.display_can_deepstandby = 0;
caps.display_can_set_brightness = 0;
strcpy(caps.boxvendor, "Raspberry");
strcpy(caps.boxname, "Pi");
if (! uname(&u))

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);
if (access(fname, R_OK))
return;
return true;
}
void cVideo::StopPicture()