From 81c977318bc6f21d6a2e001045ff34b490d0f32c Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 26 Dec 2018 00:34:00 +0100 Subject: [PATCH] rename lt_debug => hal_debug; it's not only libtriple debugging Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/ef4ad293cc45d7371ffb41ef435ef6aa8a812b43 Author: vanhofen Date: 2018-12-26 (Wed, 26 Dec 2018) Origin message was: ------------------ - rename lt_debug => hal_debug; it's not only libtriple debugging ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- common/Makefile.am | 2 +- common/ca.cpp | 40 +++---- common/ca_ci.cpp | 6 +- common/{lt_debug.cpp => hal_debug.cpp} | 22 ++-- common/hal_debug.h | 22 ++++ common/lt_debug.h | 30 ----- common/pwrmngr.cpp | 36 +++--- libarmbox/audio.cpp | 70 ++++++------ libarmbox/dmx.cpp | 100 ++++++++--------- libarmbox/hdmi_cec.cpp | 48 ++++---- libarmbox/init.cpp | 14 +-- libarmbox/playback_gst.cpp | 92 +++++++-------- libarmbox/playback_libeplayer3.cpp | 48 ++++---- libarmbox/record.cpp | 68 +++++------ libarmbox/video.cpp | 102 ++++++++--------- libazbox/audio.cpp | 82 +++++++------- libazbox/dmx.cpp | 80 ++++++------- libazbox/init.cpp | 12 +- libazbox/playback.cpp | 74 ++++++------ libazbox/video.cpp | 102 ++++++++--------- libduckbox/init.cpp | 16 +-- libgeneric-pc/audio.cpp | 92 +++++++-------- libgeneric-pc/clutterfb.cpp | 56 ++++----- libgeneric-pc/dmx.cpp | 78 ++++++------- libgeneric-pc/glfb.cpp | 54 ++++----- libgeneric-pc/init.cpp | 16 +-- libgeneric-pc/playback_gst_01.cpp | 70 ++++++------ libgeneric-pc/playback_gst_10.cpp | 92 +++++++-------- libgeneric-pc/video.cpp | 94 ++++++++-------- libraspi/audio.cpp | 46 ++++---- libraspi/dmx.cpp | 78 ++++++------- libraspi/glfb.cpp | 20 ++-- libraspi/init.cpp | 30 ++--- libraspi/video.cpp | 26 ++--- libspark/audio.cpp | 70 ++++++------ libspark/dmx.cpp | 100 ++++++++--------- libspark/init.cpp | 22 ++-- libspark/lirmp_input.cpp | 26 ++--- libspark/playback_libeplayer3.cpp | 36 +++--- libspark/record.cpp | 68 +++++------ libspark/video.cpp | 150 ++++++++++++------------- libtriple/README.libtriple | 4 +- libtriple/audio_td.cpp | 70 ++++++------ libtriple/dmx_td.cpp | 84 +++++++------- libtriple/init_td.cpp | 16 +-- libtriple/playback_td.cpp | 140 +++++++++++------------ libtriple/record_td.cpp | 56 ++++----- libtriple/video_td.cpp | 106 ++++++++--------- 48 files changed, 1379 insertions(+), 1387 deletions(-) rename common/{lt_debug.cpp => hal_debug.cpp} (73%) create mode 100644 common/hal_debug.h delete mode 100644 common/lt_debug.h diff --git a/common/Makefile.am b/common/Makefile.am index 17395fc..a6b0ee0 100644 --- a/common/Makefile.am +++ b/common/Makefile.am @@ -31,6 +31,6 @@ endif endif libcommon_la_SOURCES += \ - lt_debug.cpp \ + hal_debug.cpp \ proc_tools.c \ pwrmngr.cpp diff --git a/common/ca.cpp b/common/ca.cpp index 17f37aa..752233b 100644 --- a/common/ca.cpp +++ b/common/ca.cpp @@ -1,8 +1,8 @@ #include #include "ca_hal.h" -#include "lt_debug.h" -#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_CA, this, args) +#include "hal_debug.h" +#define hal_debug(args...) _hal_debug(HAL_DEBUG_CA, this, args) static cCA *inst = NULL; @@ -10,17 +10,17 @@ static cCA *inst = NULL; /* those are all dummies for now.. */ cCA::cCA(void) { - lt_debug("%s\n", __FUNCTION__); + hal_debug("%s\n", __FUNCTION__); } cCA::~cCA() { - lt_debug("%s\n", __FUNCTION__); + hal_debug("%s\n", __FUNCTION__); } cCA *cCA::GetInstance() { - _lt_debug(TRIPLE_DEBUG_CA, NULL, "%s\n", __FUNCTION__); + _hal_debug(HAL_DEBUG_CA, NULL, "%s\n", __FUNCTION__); if (inst == NULL) inst = new cCA(); @@ -29,82 +29,82 @@ cCA *cCA::GetInstance() void cCA::MenuEnter(enum CA_SLOT_TYPE, uint32_t p) { - lt_debug("%s param:%d\n", __FUNCTION__, (int)p); + hal_debug("%s param:%d\n", __FUNCTION__, (int)p); } void cCA::MenuAnswer(enum CA_SLOT_TYPE, uint32_t p, uint32_t /*choice*/) { - lt_debug("%s param:%d\n", __FUNCTION__, (int)p); + hal_debug("%s param:%d\n", __FUNCTION__, (int)p); } void cCA::InputAnswer(enum CA_SLOT_TYPE, uint32_t p, uint8_t * /*Data*/, int /*Len*/) { - lt_debug("%s param:%d\n", __FUNCTION__, (int)p); + hal_debug("%s param:%d\n", __FUNCTION__, (int)p); } void cCA::MenuClose(enum CA_SLOT_TYPE, uint32_t p) { - lt_debug("%s param:%d\n", __FUNCTION__, (int)p); + hal_debug("%s param:%d\n", __FUNCTION__, (int)p); } uint32_t cCA::GetNumberCISlots(void) { - lt_debug("%s\n", __FUNCTION__); + hal_debug("%s\n", __FUNCTION__); return 0; } uint32_t cCA::GetNumberSmartCardSlots(void) { - lt_debug("%s\n", __FUNCTION__); + hal_debug("%s\n", __FUNCTION__); return 0; } void cCA::ModuleName(enum CA_SLOT_TYPE, uint32_t p, char * /*Name*/) { /* TODO: waht to do with *Name? */ - lt_debug("%s param:%d\n", __FUNCTION__, (int)p); + hal_debug("%s param:%d\n", __FUNCTION__, (int)p); } bool cCA::ModulePresent(enum CA_SLOT_TYPE, uint32_t p) { - lt_debug("%s param:%d\n", __FUNCTION__, (int)p); + hal_debug("%s param:%d\n", __FUNCTION__, (int)p); return false; } void cCA::ModuleReset(enum CA_SLOT_TYPE, uint32_t p) { - lt_debug("%s param:%d\n", __FUNCTION__, (int)p); + hal_debug("%s param:%d\n", __FUNCTION__, (int)p); } bool cCA::SendPMT(int, unsigned char *, int, CA_SLOT_TYPE) { - lt_debug("%s\n", __FUNCTION__); + hal_debug("%s\n", __FUNCTION__); return true; } bool cCA::SendMessage(const CA_MESSAGE *) { - lt_debug("%s\n", __FUNCTION__); + hal_debug("%s\n", __FUNCTION__); return true; } bool cCA::Start(void) { - lt_debug("%s\n", __FUNCTION__); + hal_debug("%s\n", __FUNCTION__); return true; } void cCA::Stop(void) { - lt_debug("%s\n", __FUNCTION__); + hal_debug("%s\n", __FUNCTION__); } void cCA::Ready(bool p) { - lt_debug("%s param:%d\n", __FUNCTION__, (int)p); + hal_debug("%s param:%d\n", __FUNCTION__, (int)p); } void cCA::SetInitMask(enum CA_INIT_MASK p) { - lt_debug("%s param:%d\n", __FUNCTION__, (int)p); + hal_debug("%s param:%d\n", __FUNCTION__, (int)p); } diff --git a/common/ca_ci.cpp b/common/ca_ci.cpp index c608cdf..bab57c9 100644 --- a/common/ca_ci.cpp +++ b/common/ca_ci.cpp @@ -17,7 +17,7 @@ #include #include "ca_ci.h" -#include "lt_debug.h" +#include "hal_debug.h" #include #include @@ -34,7 +34,7 @@ #define tsb_debug 0 #define wd_debug 0 -#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_CA, this, args) +#define hal_debug(args...) _hal_debug(HAL_DEBUG_CA, this, args) static const char * FILENAME = "[ca_ci]"; #if HAVE_DUCKBOX_HARDWARE @@ -477,7 +477,7 @@ void cCA::process_tpdu(eDVBCISlot* slot, unsigned char tpdu_tag, __u8* data, int bool cCA::SendMessage(const CA_MESSAGE *msg) { - lt_debug("%s\n", __func__); + hal_debug("%s\n", __func__); if(cam_messenger) cam_messenger(EVT_CA_MESSAGE, (uint32_t) msg); #if z_debug diff --git a/common/lt_debug.cpp b/common/hal_debug.cpp similarity index 73% rename from common/lt_debug.cpp rename to common/hal_debug.cpp index 06434f7..7254f85 100644 --- a/common/lt_debug.cpp +++ b/common/hal_debug.cpp @@ -1,4 +1,4 @@ -/* libtriple debug functions */ +/* libstb-hal debug functions */ #include #include @@ -12,7 +12,7 @@ int cnxt_debug = 0; /* compat, unused */ int debuglevel = -1; -static const char* lt_facility[] = { +static const char* hal_facility[] = { "audio ", "video ", "demux ", @@ -24,10 +24,10 @@ static const char* lt_facility[] = { NULL }; -void _lt_info(int facility, const void *func, const char *fmt, ...) +void _hal_info(int facility, const void *func, const char *fmt, ...) { /* %p does print "(nil)" instead of 0x00000000 for NULL */ - fprintf(stderr, "[LT:%08lx:%s] ", (long) func, lt_facility[facility]); + fprintf(stderr, "[LT:%08lx:%s] ", (long) func, hal_facility[facility]); va_list args; va_start(args, fmt); vfprintf(stderr, fmt, args); @@ -35,7 +35,7 @@ void _lt_info(int facility, const void *func, const char *fmt, ...) } -void _lt_debug(int facility, const void *func, const char *fmt, ...) +void _hal_debug(int facility, const void *func, const char *fmt, ...) { if (debuglevel < 0) fprintf(stderr, "lt_debug: debuglevel not initialized!\n"); @@ -43,14 +43,14 @@ void _lt_debug(int facility, const void *func, const char *fmt, ...) if (! ((1 << facility) & debuglevel)) return; - fprintf(stderr, "[LT:%08lx:%s] ", (long)func, lt_facility[facility]); + fprintf(stderr, "[LT:%08lx:%s] ", (long)func, hal_facility[facility]); va_list args; va_start(args, fmt); vfprintf(stderr, fmt, args); va_end(args); } -void lt_debug_init(void) +void hal_debug_init(void) { int i = 0; char *tmp = getenv("HAL_DEBUG"); @@ -65,16 +65,16 @@ void lt_debug_init(void) { fprintf(stderr, "libstb-hal debug options can be set by exporting HAL_DEBUG.\n"); fprintf(stderr, "The following values (or bitwise OR combinations) are valid:\n"); - while (lt_facility[i]) { - fprintf(stderr, "\tcomponent: %s 0x%02x\n", lt_facility[i], 1 << i); + while (hal_facility[i]) { + fprintf(stderr, "\tcomponent: %s 0x%02x\n", hal_facility[i], 1 << i); i++; } fprintf(stderr, "\tall components: 0x%02x\n", (1 << i) - 1); } else { fprintf(stderr, "libstb-hal debug is active for the following components:\n"); - while (lt_facility[i]) { + while (hal_facility[i]) { if (debuglevel & (1 << i)) - fprintf(stderr, "%s ", lt_facility[i]); + fprintf(stderr, "%s ", hal_facility[i]); i++; } fprintf(stderr, "\n"); diff --git a/common/hal_debug.h b/common/hal_debug.h new file mode 100644 index 0000000..7c3fc2a --- /dev/null +++ b/common/hal_debug.h @@ -0,0 +1,22 @@ +#ifndef __HAL_DEBUG_H__ +#define __HAL_DEBUG_H__ + +#define HAL_DEBUG_AUDIO 0 +#define HAL_DEBUG_VIDEO 1 +#define HAL_DEBUG_DEMUX 2 +#define HAL_DEBUG_PLAYBACK 3 +#define HAL_DEBUG_PWRMNGR 4 +#define HAL_DEBUG_INIT 5 +#define HAL_DEBUG_CA 6 +#define HAL_DEBUG_RECORD 7 +#define HAL_DEBUG_ALL ((1<<8)-1) + +extern int debuglevel; + +void _hal_debug(int facility, const void *, const char *fmt, ...) __attribute__ ((format (printf, 3, 4))); +void _hal_info(int facility, const void *, const char *fmt, ...) __attribute__ ((format (printf, 3, 4))); + +void hal_debug_init(void); +void hal_set_threadname(const char *name); + +#endif // __HAL_DEBUG_H__ diff --git a/common/lt_debug.h b/common/lt_debug.h deleted file mode 100644 index 69a451a..0000000 --- a/common/lt_debug.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef __LT_DEBUG_H -#define __LT_DEBUG_H - -#define TRIPLE_DEBUG_AUDIO 0 -#define TRIPLE_DEBUG_VIDEO 1 -#define TRIPLE_DEBUG_DEMUX 2 -#define TRIPLE_DEBUG_PLAYBACK 3 -#define TRIPLE_DEBUG_PWRMNGR 4 -#define TRIPLE_DEBUG_INIT 5 -#define TRIPLE_DEBUG_CA 6 -#define TRIPLE_DEBUG_RECORD 7 -#define TRIPLE_DEBUG_ALL ((1<<8)-1) - -#define HAL_DEBUG_AUDIO 0 -#define HAL_DEBUG_VIDEO 1 -#define HAL_DEBUG_DEMUX 2 -#define HAL_DEBUG_PLAYBACK 3 -#define HAL_DEBUG_PWRMNGR 4 -#define HAL_DEBUG_INIT 5 -#define HAL_DEBUG_CA 6 -#define HAL_DEBUG_RECORD 7 -#define HAL_DEBUG_ALL ((1<<8)-1) - -extern int debuglevel; - -void hal_set_threadname(const char *name); -void _lt_debug(int facility, const void *, const char *fmt, ...) __attribute__ ((format (printf, 3, 4))); -void _lt_info(int facility, const void *, const char *fmt, ...) __attribute__ ((format (printf, 3, 4))); -void lt_debug_init(void); -#endif diff --git a/common/pwrmngr.cpp b/common/pwrmngr.cpp index 7aac8a3..3c23c30 100644 --- a/common/pwrmngr.cpp +++ b/common/pwrmngr.cpp @@ -17,7 +17,7 @@ #include #include "pwrmngr.h" -#include "lt_debug.h" +#include "hal_debug.h" #include #include @@ -33,35 +33,35 @@ #include #endif -#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_PWRMNGR, this, args) -#define lt_info(args...) _lt_info(TRIPLE_DEBUG_PWRMNGR, this, args) +#define hal_debug(args...) _hal_debug(HAL_DEBUG_PWRMNGR, this, args) +#define hal_info(args...) _hal_info(HAL_DEBUG_PWRMNGR, this, args) /* cpufreqmanager */ void cCpuFreqManager::Up(void) { - lt_debug("%s\n", __func__); + hal_debug("%s\n", __func__); } void cCpuFreqManager::Down(void) { - lt_debug("%s\n", __func__); + hal_debug("%s\n", __func__); } void cCpuFreqManager::Reset(void) { - lt_debug("%s\n", __func__); + hal_debug("%s\n", __func__); } /* those function dummies return true or "harmless" values */ bool cCpuFreqManager::SetDelta(unsigned long) { - lt_debug("%s\n", __func__); + hal_debug("%s\n", __func__); return true; } unsigned long cCpuFreqManager::GetDelta(void) { - lt_debug("%s\n", __func__); + hal_debug("%s\n", __func__); return 0; } @@ -82,14 +82,14 @@ unsigned long cCpuFreqManager::GetCpuFreq(void) { #else unsigned long cCpuFreqManager::GetCpuFreq(void) { - lt_debug("%s\n", __func__); + hal_debug("%s\n", __func__); return 0; } #endif bool cCpuFreqManager::SetCpuFreq(unsigned long f) { - lt_info("%s(%lu) => set standby = %s\n", __func__, f, f?"true":"false"); + hal_info("%s(%lu) => set standby = %s\n", __func__, f, f?"true":"false"); #if HAVE_TRIPLEDRAGON /* actually SetCpuFreq is used to determine if the system is in standby this is an "elegant" hack, because: @@ -113,11 +113,11 @@ bool cCpuFreqManager::SetCpuFreq(unsigned long f) ioctl(fd, IOC_AVS_STANDBY_ENTER); if (getenv("TRIPLE_LCDBACKLIGHT")) { - lt_info("%s: TRIPLE_LCDBACKLIGHT is set: keeping LCD backlight on\n", __func__); + hal_info("%s: TRIPLE_LCDBACKLIGHT is set: keeping LCD backlight on\n", __func__); close(fd); fd = open("/dev/stb/tdlcd", O_RDONLY); if (fd < 0) - lt_info("%s: open tdlcd error: %m\n", __func__); + hal_info("%s: open tdlcd error: %m\n", __func__); else ioctl(fd, IOC_LCD_BACKLIGHT_ON); } @@ -147,33 +147,33 @@ bool cCpuFreqManager::SetCpuFreq(unsigned long f) cCpuFreqManager::cCpuFreqManager(void) { - lt_debug("%s\n", __func__); + hal_debug("%s\n", __func__); } /* powermanager */ bool cPowerManager::Open(void) { - lt_debug("%s\n", __func__); + hal_debug("%s\n", __func__); return true; } void cPowerManager::Close(void) { - lt_debug("%s\n", __func__); + hal_debug("%s\n", __func__); } bool cPowerManager::SetStandby(bool Active, bool Passive) { - lt_debug("%s(%d, %d)\n", __func__, Active, Passive); + hal_debug("%s(%d, %d)\n", __func__, Active, Passive); return true; } cPowerManager::cPowerManager(void) { - lt_debug("%s\n", __func__); + hal_debug("%s\n", __func__); } cPowerManager::~cPowerManager() { - lt_debug("%s\n", __func__); + hal_debug("%s\n", __func__); } diff --git a/libarmbox/audio.cpp b/libarmbox/audio.cpp index 809b594..9fc7101 100644 --- a/libarmbox/audio.cpp +++ b/libarmbox/audio.cpp @@ -11,11 +11,11 @@ #include #include "audio_lib.h" -#include "lt_debug.h" +#include "hal_debug.h" #define AUDIO_DEVICE "/dev/dvb/adapter0/audio0" -#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_AUDIO, this, args) -#define lt_info(args...) _lt_info(TRIPLE_DEBUG_AUDIO, this, args) +#define hal_debug(args...) _hal_debug(HAL_DEBUG_AUDIO, this, args) +#define hal_info(args...) _hal_info(HAL_DEBUG_AUDIO, this, args) #include @@ -40,12 +40,12 @@ void cAudio::openDevice(void) if (fd < 0) { if ((fd = open(AUDIO_DEVICE, O_RDWR)) < 0) - lt_info("openDevice: open failed (%m)\n"); + hal_info("openDevice: open failed (%m)\n"); fcntl(fd, F_SETFD, FD_CLOEXEC); //do_mute(true, false); } else - lt_info("openDevice: already open (fd = %d)\n", fd); + hal_info("openDevice: already open (fd = %d)\n", fd); } void cAudio::closeDevice(void) @@ -66,7 +66,7 @@ void cAudio::closeDevice(void) int cAudio::do_mute(bool enable, bool remember) { - lt_debug("%s(%d, %d)\n", __FUNCTION__, enable, remember); + hal_debug("%s(%d, %d)\n", __FUNCTION__, enable, remember); char str[4]; @@ -97,7 +97,7 @@ int map_volume(const int volume) int cAudio::setVolume(unsigned int left, unsigned int right) { - lt_debug("%s(%d, %d)\n", __func__, left, right); + hal_debug("%s(%d, %d)\n", __func__, left, right); volume = (left + right) / 2; int v = map_volume(volume); @@ -146,7 +146,7 @@ bool cAudio::Pause(bool Pcm) void cAudio::SetSyncMode(AVSYNC_TYPE Mode) { - lt_debug("%s %d\n", __func__, Mode); + hal_debug("%s %d\n", __func__, Mode); ioctl(fd, AUDIO_SET_AV_SYNC, Mode); } @@ -159,7 +159,7 @@ void cAudio::SetSyncMode(AVSYNC_TYPE Mode) void cAudio::SetStreamType(AUDIO_FORMAT type) { int bypass = AUDIO_STREAMTYPE_MPEG; - lt_debug("%s %d\n", __FUNCTION__, type); + hal_debug("%s %d\n", __FUNCTION__, type); StreamType = type; switch (type) @@ -184,12 +184,12 @@ void cAudio::SetStreamType(AUDIO_FORMAT type) // Normaly the encoding should be set using AUDIO_SET_ENCODING // But as we implemented the behavior to bypass (cause of e2) this is correct here if (ioctl(fd, AUDIO_SET_BYPASS_MODE, bypass) < 0) - lt_info("%s: AUDIO_SET_BYPASS_MODE failed (%m)\n", __func__); + hal_info("%s: AUDIO_SET_BYPASS_MODE failed (%m)\n", __func__); } int cAudio::setChannel(int channel) { - lt_debug("%s %d\n", __FUNCTION__, channel); + hal_debug("%s %d\n", __FUNCTION__, channel); return 0; } @@ -199,9 +199,9 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int little_endian) unsigned int devmask, stereo, usable; const char *dsp_dev = getenv("DSP_DEVICE"); const char *mix_dev = getenv("MIX_DEVICE"); - lt_debug("%s ch %d srate %d bits %d le %d\n", __FUNCTION__, ch, srate, bits, little_endian); + hal_debug("%s ch %d srate %d bits %d le %d\n", __FUNCTION__, ch, srate, bits, little_endian); if (clipfd > -1) { - lt_info("%s: clipfd already opened (%d)\n", __func__, clipfd); + hal_info("%s: clipfd already opened (%d)\n", __func__, clipfd); return -1; } mixer_num = -1; @@ -216,21 +216,21 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int little_endian) */ if ((!dsp_dev) || (access(dsp_dev, W_OK))) { if (dsp_dev) - lt_info("%s: DSP_DEVICE is set (%s) but cannot be opened," + hal_info("%s: DSP_DEVICE is set (%s) but cannot be opened," " fall back to /dev/dsp\n", __func__, dsp_dev); dsp_dev = "/dev/dsp"; } if ((!mix_dev) || (access(mix_dev, W_OK))) { if (mix_dev) - lt_info("%s: MIX_DEVICE is set (%s) but cannot be opened," + hal_info("%s: MIX_DEVICE is set (%s) but cannot be opened," " fall back to /dev/mixer\n", __func__, dsp_dev); mix_dev = "/dev/mixer"; } - lt_info("%s: dsp_dev %s mix_dev %s\n", __func__, dsp_dev, mix_dev); /* NULL mix_dev is ok */ + hal_info("%s: dsp_dev %s mix_dev %s\n", __func__, dsp_dev, mix_dev); /* NULL mix_dev is ok */ /* the tdoss dsp driver seems to work only on the second open(). really. */ clipfd = open(dsp_dev, O_WRONLY); if (clipfd < 0) { - lt_info("%s open %s: %m\n", dsp_dev, __FUNCTION__); + hal_info("%s open %s: %m\n", dsp_dev, __FUNCTION__); return -1; } fcntl(clipfd, F_SETFD, FD_CLOEXEC); @@ -253,21 +253,21 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int little_endian) mixer_fd = open(mix_dev, O_RDWR); if (mixer_fd < 0) { - lt_info("%s: open mixer %s failed (%m)\n", __func__, mix_dev); + hal_info("%s: open mixer %s failed (%m)\n", __func__, mix_dev); /* not a real error */ return 0; } if (ioctl(mixer_fd, SOUND_MIXER_READ_DEVMASK, &devmask) == -1) { - lt_info("%s: SOUND_MIXER_READ_DEVMASK %m\n", __func__); + hal_info("%s: SOUND_MIXER_READ_DEVMASK %m\n", __func__); devmask = 0; } if (ioctl(mixer_fd, SOUND_MIXER_READ_STEREODEVS, &stereo) == -1) { - lt_info("%s: SOUND_MIXER_READ_STEREODEVS %m\n", __func__); + hal_info("%s: SOUND_MIXER_READ_STEREODEVS %m\n", __func__); stereo = 0; } usable = devmask & stereo; if (usable == 0) { - lt_info("%s: devmask: %08x stereo: %08x, no usable dev :-(\n", + hal_info("%s: devmask: %08x stereo: %08x, no usable dev :-(\n", __func__, devmask, stereo); close(mixer_fd); mixer_fd = -1; @@ -276,13 +276,13 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int little_endian) /* __builtin_popcount needs GCC, it counts the set bits... */ if (__builtin_popcount (usable) != 1) { /* TODO: this code is not yet tested as I have only single-mixer devices... */ - lt_info("%s: more than one mixer control: devmask %08x stereo %08x\n" + hal_info("%s: more than one mixer control: devmask %08x stereo %08x\n" "%s: querying MIX_NUMBER environment variable...\n", __func__, devmask, stereo, __func__); const char *tmp = getenv("MIX_NUMBER"); if (tmp) mixer_num = atoi(tmp); - lt_info("%s: mixer_num is %d -> device %08x\n", + hal_info("%s: mixer_num is %d -> device %08x\n", __func__, mixer_num, (mixer_num >= 0) ? (1 << mixer_num) : 0); /* no error checking, you'd better know what you are doing... */ } else { @@ -300,23 +300,23 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int little_endian) int cAudio::WriteClip(unsigned char *buffer, int size) { int ret; - // lt_debug("cAudio::%s\n", __FUNCTION__); + // hal_debug("cAudio::%s\n", __FUNCTION__); if (clipfd < 0) { - lt_info("%s: clipfd not yet opened\n", __FUNCTION__); + hal_info("%s: clipfd not yet opened\n", __FUNCTION__); return -1; } ret = write(clipfd, buffer, size); if (ret < 0) - lt_info("%s: write error (%m)\n", __FUNCTION__); + hal_info("%s: write error (%m)\n", __FUNCTION__); return ret; }; int cAudio::StopClip() { - lt_debug("%s\n", __FUNCTION__); + hal_debug("%s\n", __FUNCTION__); #if 0 if (clipfd < 0) { - lt_info("%s: clipfd not yet opened\n", __FUNCTION__); + hal_info("%s: clipfd not yet opened\n", __FUNCTION__); return -1; } close(clipfd); @@ -332,7 +332,7 @@ int cAudio::StopClip() void cAudio::getAudioInfo(int &type, int &layer, int &freq, int &bitrate, int &mode) { - lt_debug("%s\n", __FUNCTION__); + hal_debug("%s\n", __FUNCTION__); type = 0; layer = 0; freq = 0; @@ -381,13 +381,13 @@ void cAudio::getAudioInfo(int &type, int &layer, int &freq, int &bitrate, int &m void cAudio::SetSRS(int /*iq_enable*/, int /*nmgr_enable*/, int /*iq_mode*/, int /*iq_level*/) { - lt_debug("%s\n", __FUNCTION__); + hal_debug("%s\n", __FUNCTION__); }; void cAudio::SetHdmiDD(bool enable) { const char *opt[] = { "downmix", "passthrough" }; - lt_debug("%s %d\n", __func__, enable); + hal_debug("%s %d\n", __func__, enable); proc_put("/proc/stb/audio/ac3", opt[enable], strlen(opt[enable])); } @@ -395,18 +395,18 @@ void cAudio::SetSpdifDD(bool enable) { //using this function for dts passthrough const char *opt[] = { "downmix", "passthrough" }; - lt_debug("%s %d\n", __func__, enable); + hal_debug("%s %d\n", __func__, enable); proc_put("/proc/stb/audio/dts", opt[enable], strlen(opt[enable])); } void cAudio::ScheduleMute(bool On) { - lt_debug("%s %d\n", __FUNCTION__, On); + hal_debug("%s %d\n", __FUNCTION__, On); } void cAudio::EnableAnalogOut(bool enable) { - lt_debug("%s %d\n", __FUNCTION__, enable); + hal_debug("%s %d\n", __FUNCTION__, enable); } #define AUDIO_BYPASS_ON 0 @@ -415,5 +415,5 @@ void cAudio::setBypassMode(bool disable) { int mode = disable ? AUDIO_BYPASS_OFF : AUDIO_BYPASS_ON; if (ioctl(fd, AUDIO_SET_BYPASS_MODE, mode) < 0) - lt_info("%s AUDIO_SET_BYPASS_MODE %d: %m\n", __func__, mode); + hal_info("%s AUDIO_SET_BYPASS_MODE %d: %m\n", __func__, mode); } diff --git a/libarmbox/dmx.cpp b/libarmbox/dmx.cpp index 1c7ea42..6d9cade 100644 --- a/libarmbox/dmx.cpp +++ b/libarmbox/dmx.cpp @@ -36,21 +36,21 @@ #include #include #include "dmx_hal.h" -#include "lt_debug.h" +#include "hal_debug.h" #include "video_lib.h" /* needed for getSTC... */ extern cVideo *videoDecoder; -#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_DEMUX, this, args) -#define lt_info(args...) _lt_info(TRIPLE_DEBUG_DEMUX, this, args) -#define lt_debug_c(args...) _lt_debug(TRIPLE_DEBUG_DEMUX, NULL, args) -#define lt_info_c(args...) _lt_info(TRIPLE_DEBUG_DEMUX, NULL, args) -#define lt_info_z(args...) _lt_info(TRIPLE_DEBUG_DEMUX, thiz, args) -#define lt_debug_z(args...) _lt_debug(TRIPLE_DEBUG_DEMUX, thiz, args) +#define hal_debug(args...) _hal_debug(HAL_DEBUG_DEMUX, this, args) +#define hal_info(args...) _hal_info(HAL_DEBUG_DEMUX, this, args) +#define hal_debug_c(args...) _hal_debug(HAL_DEBUG_DEMUX, NULL, args) +#define hal_info_c(args...) _hal_info(HAL_DEBUG_DEMUX, NULL, args) +#define hal_info_z(args...) _hal_info(HAL_DEBUG_DEMUX, thiz, args) +#define hal_debug_z(args...) _hal_debug(HAL_DEBUG_DEMUX, thiz, args) #define dmx_err(_errfmt, _errstr, _revents) do { \ - lt_info("%s " _errfmt " fd:%d, ev:0x%x %s pid:0x%04hx flt:0x%02hx\n", \ + hal_info("%s " _errfmt " fd:%d, ev:0x%x %s pid:0x%04hx flt:0x%02hx\n", \ __func__, _errstr, fd, _revents, DMX_T[dmx_type], pid, flt); \ } while(0); @@ -126,7 +126,7 @@ cDemux::cDemux(int n) { if (n < 0 || n >= NUM_DEMUX) { - lt_info("%s ERROR: n invalid (%d)\n", __FUNCTION__, n); + hal_info("%s ERROR: n invalid (%d)\n", __FUNCTION__, n); num = 0; } else @@ -140,7 +140,7 @@ cDemux::cDemux(int n) cDemux::~cDemux() { - lt_debug("%s #%d fd: %d\n", __FUNCTION__, num, fd); + hal_debug("%s #%d fd: %d\n", __FUNCTION__, num, fd); Close(); /* wait until Read() has released the mutex */ (*P->mutex).lock(); @@ -153,7 +153,7 @@ cDemux::~cDemux() bool cDemux::Open(DMX_CHANNEL_TYPE pes_type, void * /*hVideoBuffer*/, int uBufferSize) { if (fd > -1) - lt_info("%s FD ALREADY OPENED? fd = %d\n", __FUNCTION__, fd); + hal_info("%s FD ALREADY OPENED? fd = %d\n", __FUNCTION__, fd); dmx_type = pes_type; buffersize = uBufferSize; @@ -167,13 +167,13 @@ static bool _open(cDemux *thiz, int num, int &fd, int &last_source, DMX_CHANNEL_ int flags = O_RDWR|O_CLOEXEC; int devnum = dmx_source[num]; if (last_source == devnum) { - lt_debug_z("%s #%d: source (%d) did not change\n", __func__, num, last_source); + hal_debug_z("%s #%d: source (%d) did not change\n", __func__, num, last_source); if (fd > -1) return true; } if (fd > -1) { /* we changed source -> close and reopen the fd */ - lt_debug_z("%s #%d: FD ALREADY OPENED fd = %d lastsource %d devnum %d\n", + hal_debug_z("%s #%d: FD ALREADY OPENED fd = %d lastsource %d devnum %d\n", __func__, num, fd, last_source, devnum); close(fd); } @@ -184,10 +184,10 @@ static bool _open(cDemux *thiz, int num, int &fd, int &last_source, DMX_CHANNEL_ fd = open(devname[devnum], flags); if (fd < 0) { - lt_info_z("%s %s: %m\n", __FUNCTION__, devname[devnum]); + hal_info_z("%s %s: %m\n", __FUNCTION__, devname[devnum]); return false; } - lt_debug_z("%s #%d pes_type: %s(%d), uBufferSize: %d fd: %d\n", __func__, + hal_debug_z("%s #%d pes_type: %s(%d), uBufferSize: %d fd: %d\n", __func__, num, DMX_T[dmx_type], dmx_type, buffersize, fd); /* this would actually need locking, but the worst that weill happen is, that @@ -196,9 +196,9 @@ static bool _open(cDemux *thiz, int num, int &fd, int &last_source, DMX_CHANNEL_ { /* this should not change anything... */ int n = DMX_SOURCE_FRONT0 + devnum; - lt_info_z("%s: setting %s to source %d\n", __func__, devname[devnum], n); + hal_info_z("%s: setting %s to source %d\n", __func__, devname[devnum], n); if (ioctl(fd, DMX_SET_SOURCE, &n) < 0) - lt_info_z("%s DMX_SET_SOURCE failed!\n", __func__); + hal_info_z("%s DMX_SET_SOURCE failed!\n", __func__); else init[devnum] = true; } @@ -208,7 +208,7 @@ static bool _open(cDemux *thiz, int num, int &fd, int &last_source, DMX_CHANNEL_ { /* probably uBufferSize == 0 means "use default size". TODO: find a reasonable default */ if (ioctl(fd, DMX_SET_BUFFER_SIZE, buffersize) < 0) - lt_info_z("%s DMX_SET_BUFFER_SIZE failed (%m)\n", __func__); + hal_info_z("%s DMX_SET_BUFFER_SIZE failed (%m)\n", __func__); } last_source = devnum; @@ -217,10 +217,10 @@ static bool _open(cDemux *thiz, int num, int &fd, int &last_source, DMX_CHANNEL_ void cDemux::Close(void) { - lt_debug("%s #%d, fd = %d\n", __FUNCTION__, num, fd); + hal_debug("%s #%d, fd = %d\n", __FUNCTION__, num, fd); if (fd < 0) { - lt_info("%s #%d: not open!\n", __FUNCTION__, num); + hal_info("%s #%d: not open!\n", __FUNCTION__, num); return; } @@ -232,10 +232,10 @@ void cDemux::Close(void) bool cDemux::Start(bool) { - lt_debug("%s #%d fd: %d type: %s\n", __func__, num, fd, DMX_T[dmx_type]); + hal_debug("%s #%d fd: %d type: %s\n", __func__, num, fd, DMX_T[dmx_type]); if (fd < 0) { - lt_info("%s #%d: not open!\n", __FUNCTION__, num); + hal_info("%s #%d: not open!\n", __FUNCTION__, num); return false; } ioctl(fd, DMX_START); @@ -244,10 +244,10 @@ bool cDemux::Start(bool) bool cDemux::Stop(void) { - lt_debug("%s #%d fd: %d type: %s\n", __func__, num, fd, DMX_T[dmx_type]); + hal_debug("%s #%d fd: %d type: %s\n", __func__, num, fd, DMX_T[dmx_type]); if (fd < 0) { - lt_info("%s #%d: not open!\n", __FUNCTION__, num); + hal_info("%s #%d: not open!\n", __FUNCTION__, num); return false; } ioctl(fd, DMX_STOP); @@ -263,7 +263,7 @@ int cDemux::Read(unsigned char *buff, int len, int timeout) #endif if (fd < 0) { - lt_info("%s #%d: not open!\n", __func__, num); + hal_info("%s #%d: not open!\n", __func__, num); return -1; } /* avoid race in destructor: ~cDemux needs to wait until Read() returns */ @@ -288,7 +288,7 @@ int cDemux::Read(unsigned char *buff, int len, int timeout) if (ufds.fd != fd) { /* Close() will set fd to -1, this is normal. Everything else is not. */ - lt_info("%s:1 ========== fd has changed, %d->%d ==========\n", __func__, ufds.fd, fd); + hal_info("%s:1 ========== fd has changed, %d->%d ==========\n", __func__, ufds.fd, fd); return -1; } if (!rc) @@ -303,7 +303,7 @@ int cDemux::Read(unsigned char *buff, int len, int timeout) else if (rc < 0) { dmx_err("poll: %s,", strerror(errno), 0) - //lt_info("%s poll: %m\n", __FUNCTION__); + //hal_info("%s poll: %m\n", __FUNCTION__); /* happens, when running under gdb... */ if (errno == EINTR) goto retry; @@ -330,7 +330,7 @@ int cDemux::Read(unsigned char *buff, int len, int timeout) } if (ufds.fd != fd) /* does this ever happen? and if, is it harmful? */ { /* read(-1,...) will just return EBADF anyway... */ - lt_info("%s:2 ========== fd has changed, %d->%d ==========\n", __func__, ufds.fd, fd); + hal_info("%s:2 ========== fd has changed, %d->%d ==========\n", __func__, ufds.fd, fd); return -1; } @@ -354,7 +354,7 @@ bool cDemux::sectionFilter(unsigned short _pid, const unsigned char * const filt if (len > DMX_FILTER_SIZE) { - lt_info("%s #%d: len too long: %d, DMX_FILTER_SIZE %d\n", __func__, num, len, DMX_FILTER_SIZE); + hal_info("%s #%d: len too long: %d, DMX_FILTER_SIZE %d\n", __func__, num, len, DMX_FILTER_SIZE); len = DMX_FILTER_SIZE; } flt = filter[0]; @@ -449,7 +449,7 @@ bool cDemux::sectionFilter(unsigned short _pid, const unsigned char * const filt if (timeout == 0 && negmask == NULL) s_flt.timeout = to; - lt_debug("%s #%d pid:0x%04hx fd:%d type:%s len:%d to:%d flags:%x flt[0]:%02x\n", __func__, num, + hal_debug("%s #%d pid:0x%04hx fd:%d type:%s len:%d to:%d flags:%x flt[0]:%02x\n", __func__, num, pid, fd, DMX_T[dmx_type], len, s_flt.timeout,s_flt.flags, s_flt.filter.filter[0]); #if 0 fprintf(stderr,"filt: ");for(int i=0;i= 0x0002 && pid <= 0x000f) || pid >= 0x1fff) return false; - lt_debug("%s #%d pid: 0x%04hx fd: %d type: %s\n", __FUNCTION__, num, pid, fd, DMX_T[dmx_type]); + hal_debug("%s #%d pid: 0x%04hx fd: %d type: %s\n", __FUNCTION__, num, pid, fd, DMX_T[dmx_type]); _open(this, num, fd, P->last_source, dmx_type, buffersize); @@ -510,7 +510,7 @@ bool cDemux::pesFilter(const unsigned short _pid) p_flt.output = DMX_OUT_TSDEMUX_TAP; break; default: - lt_info("%s #%d invalid dmx_type %d!\n", __func__, num, dmx_type); + hal_info("%s #%d invalid dmx_type %d!\n", __func__, num, dmx_type); return false; } return (ioctl(fd, DMX_SET_PES_FILTER, &p_flt) >= 0); @@ -518,40 +518,40 @@ bool cDemux::pesFilter(const unsigned short _pid) void cDemux::SetSyncMode(AVSYNC_TYPE /*mode*/) { - lt_debug("%s #%d\n", __FUNCTION__, num); + hal_debug("%s #%d\n", __FUNCTION__, num); } void *cDemux::getBuffer() { - lt_debug("%s #%d\n", __FUNCTION__, num); + hal_debug("%s #%d\n", __FUNCTION__, num); return NULL; } void *cDemux::getChannel() { - lt_debug("%s #%d\n", __FUNCTION__, num); + hal_debug("%s #%d\n", __FUNCTION__, num); return NULL; } bool cDemux::addPid(unsigned short Pid) { - lt_debug("%s: pid 0x%04hx\n", __func__, Pid); + hal_debug("%s: pid 0x%04hx\n", __func__, Pid); pes_pids pfd; int ret; if (dmx_type != DMX_TP_CHANNEL) { - lt_info("%s pes_type %s not implemented yet! pid=%hx\n", __FUNCTION__, DMX_T[dmx_type], Pid); + hal_info("%s pes_type %s not implemented yet! pid=%hx\n", __FUNCTION__, DMX_T[dmx_type], Pid); return false; } _open(this, num, fd, P->last_source, dmx_type, buffersize); if (fd == -1) - lt_info("%s bucketfd not yet opened? pid=%hx\n", __FUNCTION__, Pid); + hal_info("%s bucketfd not yet opened? pid=%hx\n", __FUNCTION__, Pid); pfd.fd = fd; /* dummy */ pfd.pid = Pid; pesfds.push_back(pfd); ret = (ioctl(fd, DMX_ADD_PID, &Pid)); if (ret < 0) - lt_info("%s: DMX_ADD_PID (%m) pid=%hx\n", __func__, Pid); + hal_info("%s: DMX_ADD_PID (%m) pid=%hx\n", __func__, Pid); return (ret != -1); } @@ -559,27 +559,27 @@ void cDemux::removePid(unsigned short Pid) { if (dmx_type != DMX_TP_CHANNEL) { - lt_info("%s pes_type %s not implemented yet! pid=%hx\n", __FUNCTION__, DMX_T[dmx_type], Pid); + hal_info("%s pes_type %s not implemented yet! pid=%hx\n", __FUNCTION__, DMX_T[dmx_type], Pid); return; } for (std::vector::iterator i = pesfds.begin(); i != pesfds.end(); ++i) { if ((*i).pid == Pid) { - lt_debug("removePid: removing demux fd %d pid 0x%04x\n", fd, Pid); + hal_debug("removePid: removing demux fd %d pid 0x%04x\n", fd, Pid); if (ioctl(fd, DMX_REMOVE_PID, Pid) < 0) - lt_info("%s: (DMX_REMOVE_PID, 0x%04hx): %m\n", __func__, Pid); + hal_info("%s: (DMX_REMOVE_PID, 0x%04hx): %m\n", __func__, Pid); pesfds.erase(i); return; /* TODO: what if the same PID is there multiple times */ } } - lt_info("%s pid 0x%04x not found\n", __FUNCTION__, Pid); + hal_info("%s pid 0x%04x not found\n", __FUNCTION__, Pid); } void cDemux::getSTC(int64_t * STC) { /* apparently I can only get the PTS of the video decoder, * but that's good enough for dvbsub */ - lt_debug("%s #%d\n", __func__, num); + hal_debug("%s #%d\n", __func__, num); int64_t pts = 0; if (videoDecoder) pts = videoDecoder->GetPTS(); @@ -588,7 +588,7 @@ void cDemux::getSTC(int64_t * STC) int cDemux::getUnit(void) { - lt_debug("%s #%d\n", __FUNCTION__, num); + hal_debug("%s #%d\n", __FUNCTION__, num); /* just guessed that this is the right thing to do. right now this is only used by the CA code which is stubbed out anyway */ @@ -598,12 +598,12 @@ int cDemux::getUnit(void) bool cDemux::SetSource(int unit, int source) { if (unit >= NUM_DEMUX || unit < 0) { - lt_info_c("%s: unit (%d) out of range, NUM_DEMUX %d\n", __func__, unit, NUM_DEMUX); + hal_info_c("%s: unit (%d) out of range, NUM_DEMUX %d\n", __func__, unit, NUM_DEMUX); return false; } - lt_debug_c("%s(%d, %d) => %d to %d\n", __func__, unit, source, dmx_source[unit], source); + hal_debug_c("%s(%d, %d) => %d to %d\n", __func__, unit, source, dmx_source[unit], source); if (source < 0 || source >= NUM_DEMUXDEV) - lt_info_c("%s(%d, %d) ERROR: source %d out of range!\n", __func__, unit, source, source); + hal_info_c("%s(%d, %d) ERROR: source %d out of range!\n", __func__, unit, source, source); else dmx_source[unit] = source; return true; @@ -612,9 +612,9 @@ bool cDemux::SetSource(int unit, int source) int cDemux::GetSource(int unit) { if (unit >= NUM_DEMUX || unit < 0) { - lt_info_c("%s: unit (%d) out of range, NUM_DEMUX %d\n", __func__, unit, NUM_DEMUX); + hal_info_c("%s: unit (%d) out of range, NUM_DEMUX %d\n", __func__, unit, NUM_DEMUX); return -1; } - lt_debug_c("%s(%d) => %d\n", __func__, unit, dmx_source[unit]); + hal_debug_c("%s(%d) => %d\n", __func__, unit, dmx_source[unit]); return dmx_source[unit]; } diff --git a/libarmbox/hdmi_cec.cpp b/libarmbox/hdmi_cec.cpp index 8fda736..c2265d7 100644 --- a/libarmbox/hdmi_cec.cpp +++ b/libarmbox/hdmi_cec.cpp @@ -37,23 +37,23 @@ #include "linux-uapi-cec.h" #include "hdmi_cec.h" #include "hdmi_cec_types.h" -#include "lt_debug.h" +#include "hal_debug.h" #define RED "\x1B[31m" #define NORMAL "\x1B[0m" -#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_INIT, this, args) -#define lt_info(args...) _lt_info(TRIPLE_DEBUG_INIT, this, args) -#define lt_debug_c(args...) _lt_debug(TRIPLE_DEBUG_INIT, NULL, args) -#define lt_info_c(args...) _lt_info(TRIPLE_DEBUG_INIT, NULL, args) +#define hal_debug(args...) _hal_debug(HAL_DEBUG_INIT, this, args) +#define hal_info(args...) _hal_info(HAL_DEBUG_INIT, this, args) +#define hal_debug_c(args...) _hal_debug(HAL_DEBUG_INIT, NULL, args) +#define hal_info_c(args...) _hal_info(HAL_DEBUG_INIT, NULL, args) #define fop(cmd, args...) ({ \ int _r; \ if (fd >= 0) { \ if ((_r = ::cmd(fd, args)) < 0) \ - lt_info(#cmd"(fd, "#args")\n"); \ + hal_info(#cmd"(fd, "#args")\n"); \ else \ - lt_debug(#cmd"(fd, "#args")\n");\ + hal_debug(#cmd"(fd, "#args")\n");\ } \ else { _r = fd; } \ _r; \ @@ -88,7 +88,7 @@ hdmi_cec* hdmi_cec::getInstance() if (hdmi_cec_instance == NULL) { hdmi_cec_instance = new hdmi_cec(); - lt_debug_c("[CEC] new instance created \n"); + hal_debug_c("[CEC] new instance created \n"); } return hdmi_cec_instance; } @@ -102,13 +102,13 @@ bool hdmi_cec::SetCECMode(VIDEO_HDMI_CEC_MODE _deviceType) if (_deviceType == VIDEO_HDMI_CEC_MODE_OFF) { Stop(); - lt_debug("[CEC] switch off %s\n", __func__); + hal_debug("[CEC] switch off %s\n", __func__); return false; } else deviceType = _deviceType; - lt_debug("[CEC] switch on %s\n", __func__); + hal_debug("[CEC] switch on %s\n", __func__); if (hdmiFd == -1) { @@ -121,14 +121,14 @@ bool hdmi_cec::SetCECMode(VIDEO_HDMI_CEC_MODE _deviceType) struct cec_caps caps = {}; if (ioctl(hdmiFd, CEC_ADAP_G_CAPS, &caps) < 0) - lt_debug("[CEC] %s: get caps failed (%m)\n", __func__); + hal_debug("[CEC] %s: get caps failed (%m)\n", __func__); if (caps.capabilities & CEC_CAP_LOG_ADDRS) { struct cec_log_addrs laddrs = {}; if (ioctl(hdmiFd, CEC_ADAP_S_LOG_ADDRS, &laddrs) < 0) - lt_debug("[CEC] %s: reset log addr failed (%m)\n", __func__); + hal_debug("[CEC] %s: reset log addr failed (%m)\n", __func__); memset(&laddrs, 0, sizeof(laddrs)); @@ -178,11 +178,11 @@ bool hdmi_cec::SetCECMode(VIDEO_HDMI_CEC_MODE _deviceType) laddrs.num_log_addrs++; if (ioctl(hdmiFd, CEC_ADAP_S_LOG_ADDRS, &laddrs) < 0) - lt_debug("[CEC] %s: et log addr failed (%m)\n", __func__); + hal_debug("[CEC] %s: et log addr failed (%m)\n", __func__); } if (ioctl(hdmiFd, CEC_S_MODE, &monitor) < 0) - lt_debug("[CEC] %s: monitor failed (%m)\n", __func__); + hal_debug("[CEC] %s: monitor failed (%m)\n", __func__); GetCECAddressInfo(); @@ -239,7 +239,7 @@ void hdmi_cec::GetCECAddressInfo() logicalAddress = addressinfo.logical; if (memcmp(physicalAddress, addressinfo.physical, sizeof(physicalAddress))) { - lt_info("[CEC] %s: detected physical address change: %02X%02X --> %02X%02X\n", __func__, physicalAddress[0], physicalAddress[1], addressinfo.physical[0], addressinfo.physical[1]); + hal_info("[CEC] %s: detected physical address change: %02X%02X --> %02X%02X\n", __func__, physicalAddress[0], physicalAddress[1], addressinfo.physical[0], addressinfo.physical[1]); memcpy(physicalAddress, addressinfo.physical, sizeof(physicalAddress)); ReportPhysicalAddress(); } @@ -268,7 +268,7 @@ void hdmi_cec::SendCECMessage(struct cec_message &txmessage) { sprintf(str+(i*6),"[0x%02X]", txmessage.data[i]); } - lt_info("[CEC] send message %s to %s (0x%02X>>0x%02X) '%s' (%s)\n",ToString((cec_logical_address)txmessage.initiator), txmessage.destination == 0xf ? "all" : ToString((cec_logical_address)txmessage.destination), txmessage.initiator, txmessage.destination, ToString((cec_opcode)txmessage.data[0]), str); + hal_info("[CEC] send message %s to %s (0x%02X>>0x%02X) '%s' (%s)\n",ToString((cec_logical_address)txmessage.initiator), txmessage.destination == 0xf ? "all" : ToString((cec_logical_address)txmessage.destination), txmessage.initiator, txmessage.destination, ToString((cec_opcode)txmessage.data[0]), str); struct cec_msg msg; cec_msg_init(&msg, txmessage.initiator, txmessage.destination); memcpy(&msg.msg[1], txmessage.data, txmessage.length); @@ -521,7 +521,7 @@ void hdmi_cec::Receive() { sprintf(str+(i*6),"[0x%02X]", rxmessage.data[i]); } - lt_info("[CEC] received message %s to %s (0x%02X>>0x%02X) '%s' (%s)\n",ToString((cec_logical_address)rxmessage.initiator), rxmessage.destination == 0xf ? "all" : ToString((cec_logical_address)rxmessage.destination), rxmessage.initiator, rxmessage.destination, ToString((cec_opcode)rxmessage.opcode), str); + hal_info("[CEC] received message %s to %s (0x%02X>>0x%02X) '%s' (%s)\n",ToString((cec_logical_address)rxmessage.initiator), rxmessage.destination == 0xf ? "all" : ToString((cec_logical_address)rxmessage.destination), rxmessage.initiator, rxmessage.destination, ToString((cec_opcode)rxmessage.opcode), str); switch (rxmessage.opcode) { @@ -530,9 +530,9 @@ void hdmi_cec::Receive() muted = ((rxmessage.data[1] & 0x80) == 0x80); volume = ((rxmessage.data[1] & 0x7F) / 127.0) * 100.0; if (muted) - lt_debug("[CEC] %s volume muted\n", ToString((cec_logical_address)rxmessage.initiator)); + hal_debug("[CEC] %s volume muted\n", ToString((cec_logical_address)rxmessage.initiator)); else - lt_debug("[CEC] %s volume %d \n", ToString((cec_logical_address)rxmessage.initiator), volume); + hal_debug("[CEC] %s volume %d \n", ToString((cec_logical_address)rxmessage.initiator), volume); break; } case CEC_OPCODE_DEVICE_VENDOR_ID: @@ -541,7 +541,7 @@ void hdmi_cec::Receive() uint64_t iVendorId = ((uint64_t)rxmessage.data[1] << 16) + ((uint64_t)rxmessage.data[2] << 8) + (uint64_t)rxmessage.data[3]; - lt_debug("[CEC] decoded message '%s' (%s)\n", ToString((cec_opcode)rxmessage.opcode), ToString((cec_vendor_id)iVendorId)); + hal_debug("[CEC] decoded message '%s' (%s)\n", ToString((cec_opcode)rxmessage.opcode), ToString((cec_vendor_id)iVendorId)); break; } case CEC_OPCODE_GIVE_DEVICE_POWER_STATUS: @@ -560,7 +560,7 @@ void hdmi_cec::Receive() case CEC_OPCODE_USER_CONTROL_RELEASE: /* key released */ { long code = translateKey(pressedkey); - lt_debug("[CEC] decoded key %s (%ld)\n",ToString((cec_user_control_code)pressedkey), code); + hal_debug("[CEC] decoded key %s (%ld)\n",ToString((cec_user_control_code)pressedkey), code); handleCode(code,keypressed); break; } @@ -573,14 +573,14 @@ void hdmi_cec::handleCode(long code, bool keypressed) int evd = open(RC_DEVICE, O_RDWR); if (evd < 0) { - lt_debug("[CEC] opening " RC_DEVICE " failed"); + hal_debug("[CEC] opening " RC_DEVICE " failed"); return; } if (keypressed) { if (rc_send(evd, code, CEC_KEY_PRESSED) < 0) { - lt_debug("[CEC] writing 'KEY_PRESSED' event failed"); + hal_debug("[CEC] writing 'KEY_PRESSED' event failed"); close(evd); return; } @@ -590,7 +590,7 @@ void hdmi_cec::handleCode(long code, bool keypressed) { if (rc_send(evd, code, CEC_KEY_RELEASED) < 0) { - lt_debug("[CEC] writing 'KEY_RELEASED' event failed"); + hal_debug("[CEC] writing 'KEY_RELEASED' event failed"); close(evd); return; } diff --git a/libarmbox/init.cpp b/libarmbox/init.cpp index 682bf1c..bdb8b3f 100644 --- a/libarmbox/init.cpp +++ b/libarmbox/init.cpp @@ -12,17 +12,17 @@ #include "pwrmngr.h" #include -#include "lt_debug.h" -#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_INIT, NULL, args) -#define lt_info(args...) _lt_info(TRIPLE_DEBUG_INIT, NULL, args) +#include "hal_debug.h" +#define hal_debug(args...) _hal_debug(HAL_DEBUG_INIT, NULL, args) +#define hal_info(args...) _hal_info(HAL_DEBUG_INIT, NULL, args) static bool initialized = false; void init_td_api() { if (!initialized) - lt_debug_init(); - lt_info("%s begin, initialized=%d, debug=0x%02x\n", __FUNCTION__, (int)initialized, debuglevel); + hal_debug_init(); + hal_info("%s begin, initialized=%d, debug=0x%02x\n", __FUNCTION__, (int)initialized, debuglevel); if (!initialized) { cCpuFreqManager f; @@ -39,11 +39,11 @@ void init_td_api() proc_put("/proc/stb/fb/dst_apply", buffer, strlen(buffer)); } initialized = true; - lt_info("%s end\n", __FUNCTION__); + hal_info("%s end\n", __FUNCTION__); } void shutdown_td_api() { - lt_info("%s, initialized = %d\n", __FUNCTION__, (int)initialized); + hal_info("%s, initialized = %d\n", __FUNCTION__, (int)initialized); initialized = false; } diff --git a/libarmbox/playback_gst.cpp b/libarmbox/playback_gst.cpp index 4d380be..a87a3e6 100644 --- a/libarmbox/playback_gst.cpp +++ b/libarmbox/playback_gst.cpp @@ -35,11 +35,11 @@ #include "playback_gst.h" -#include "lt_debug.h" -#define lt_debug(args...) _lt_debug(HAL_DEBUG_PLAYBACK, this, args) -#define lt_info(args...) _lt_info(HAL_DEBUG_PLAYBACK, this, args) -#define lt_debug_c(args...) _lt_debug(HAL_DEBUG_PLAYBACK, NULL, args) -#define lt_info_c(args...) _lt_info(HAL_DEBUG_PLAYBACK, NULL, args) +#include "hal_debug.h" +#define hal_debug(args...) _hal_debug(HAL_DEBUG_PLAYBACK, this, args) +#define hal_info(args...) _hal_info(HAL_DEBUG_PLAYBACK, this, args) +#define hal_debug_c(args...) _hal_debug(HAL_DEBUG_PLAYBACK, NULL, args) +#define hal_info_c(args...) _hal_info(HAL_DEBUG_PLAYBACK, NULL, args) static const char * FILENAME = "[playback_gst.cpp]"; extern cVideo * videoDecoder; @@ -102,7 +102,7 @@ void processMpegTsSection(GstMpegtsSection* section) for (guint i = 0; i < pmt->streams->len; ++i) { const GstMpegtsPMTStream* stream = static_cast(g_ptr_array_index(pmt->streams, i)); if (stream->stream_type == 0x05 || stream->stream_type >= 0x80) { - lt_info_c( "%s:%s Audio Stream pid: %d\n", FILENAME, __FUNCTION__, stream->pid); + hal_info_c( "%s:%s Audio Stream pid: %d\n", FILENAME, __FUNCTION__, stream->pid); real_apids[cnt] = stream->pid; cnt++; } @@ -166,7 +166,7 @@ void playbinNotifySource(GObject *object, GParamSpec *param_spec, gpointer user_ if (!name.empty() && !value.empty()) { GValue header; - lt_info_c( "%s:%s setting extra-header '%s:%s'\n", FILENAME, __FUNCTION__, name.c_str(), value.c_str()); + hal_info_c( "%s:%s setting extra-header '%s:%s'\n", FILENAME, __FUNCTION__, name.c_str(), value.c_str()); memset(&header, 0, sizeof(GValue)); g_value_init(&header, G_TYPE_STRING); g_value_set_string(&header, value.c_str()); @@ -174,7 +174,7 @@ void playbinNotifySource(GObject *object, GParamSpec *param_spec, gpointer user_ } else { - lt_info_c( "%s:%s Invalid header format %s\n", FILENAME, __FUNCTION__, _this->extra_headers.c_str()); + hal_info_c( "%s:%s Invalid header format %s\n", FILENAME, __FUNCTION__, _this->extra_headers.c_str()); break; } } @@ -213,15 +213,15 @@ GstBusSyncReply Gst_bus_call(GstBus *bus, GstMessage *msg, gpointer user_data) gst_message_parse_error(msg, &err, &debug); g_free (debug); gchar * sourceName = gst_object_get_name(source); - lt_info_c( "%s:%s - GST_MESSAGE_ERROR: %s (%i) from %s\n", FILENAME, __FUNCTION__, err->message, err->code, sourceName ); + hal_info_c( "%s:%s - GST_MESSAGE_ERROR: %s (%i) from %s\n", FILENAME, __FUNCTION__, err->message, err->code, sourceName ); if ( err->domain == GST_STREAM_ERROR ) { if ( err->code == GST_STREAM_ERROR_CODEC_NOT_FOUND ) { if ( g_strrstr(sourceName, "videosink") ) - lt_info_c( "%s:%s - GST_MESSAGE_ERROR: videosink\n", FILENAME, __FUNCTION__ ); //FIXME: how shall playback handle this event??? + hal_info_c( "%s:%s - GST_MESSAGE_ERROR: videosink\n", FILENAME, __FUNCTION__ ); //FIXME: how shall playback handle this event??? else if ( g_strrstr(sourceName, "audiosink") ) - lt_info_c( "%s:%s - GST_MESSAGE_ERROR: audioSink\n", FILENAME, __FUNCTION__ ); //FIXME: how shall playback handle this event??? + hal_info_c( "%s:%s - GST_MESSAGE_ERROR: audioSink\n", FILENAME, __FUNCTION__ ); //FIXME: how shall playback handle this event??? } } g_error_free(err); @@ -244,7 +244,7 @@ GstBusSyncReply Gst_bus_call(GstBus *bus, GstMessage *msg, gpointer user_data) { gchar * sourceName = gst_object_get_name(source); if ( g_strrstr(sourceName, "videosink") ) - lt_info_c( "%s:%s - GST_MESSAGE_INFO: videosink\n", FILENAME, __FUNCTION__ ); //FIXME: how shall playback handle this event??? + hal_info_c( "%s:%s - GST_MESSAGE_INFO: videosink\n", FILENAME, __FUNCTION__ ); //FIXME: how shall playback handle this event??? if(sourceName) g_free(sourceName); @@ -303,12 +303,12 @@ GstBusSyncReply Gst_bus_call(GstBus *bus, GstMessage *msg, gpointer user_data) int ret = write(fd, data, size); gst_buffer_unmap(buf_image, &map); close(fd); - lt_info_c("%s:%s - /tmp/.id3coverart %d bytes written\n", FILENAME, __FUNCTION__, ret); + hal_info_c("%s:%s - /tmp/.id3coverart %d bytes written\n", FILENAME, __FUNCTION__, ret); } } if (tags) gst_tag_list_unref(tags); - lt_debug_c( "%s:%s - GST_MESSAGE_INFO: update info tags\n", FILENAME, __FUNCTION__); //FIXME: how shall playback handle this event??? + hal_debug_c( "%s:%s - GST_MESSAGE_INFO: update info tags\n", FILENAME, __FUNCTION__); //FIXME: how shall playback handle this event??? break; } case GST_MESSAGE_ELEMENT: @@ -329,7 +329,7 @@ GstBusSyncReply Gst_bus_call(GstBus *bus, GstMessage *msg, gpointer user_data) if(old_state == new_state) break; - lt_info_c( "%s:%s - GST_MESSAGE_STATE_CHANGED: state transition %s -> %s\n", FILENAME, __FUNCTION__, gst_element_state_get_name(old_state), gst_element_state_get_name(new_state)); + hal_info_c( "%s:%s - GST_MESSAGE_STATE_CHANGED: state transition %s -> %s\n", FILENAME, __FUNCTION__, gst_element_state_get_name(old_state), gst_element_state_get_name(new_state)); GstStateChange transition = (GstStateChange)GST_STATE_TRANSITION(old_state, new_state); @@ -359,7 +359,7 @@ GstBusSyncReply Gst_bus_call(GstBus *bus, GstMessage *msg, gpointer user_data) { audioSink = GST_ELEMENT_CAST(g_value_dup_object (&r)); g_value_unset (&r); - lt_info_c( "%s %s - audio sink created\n", FILENAME, __FUNCTION__); + hal_info_c( "%s %s - audio sink created\n", FILENAME, __FUNCTION__); } gst_iterator_free(children); @@ -368,7 +368,7 @@ GstBusSyncReply Gst_bus_call(GstBus *bus, GstMessage *msg, gpointer user_data) { videoSink = GST_ELEMENT_CAST(g_value_dup_object (&r)); g_value_unset (&r); - lt_info_c( "%s %s - video sink created\n", FILENAME, __FUNCTION__); + hal_info_c( "%s %s - video sink created\n", FILENAME, __FUNCTION__); } gst_iterator_free(children); @@ -411,7 +411,7 @@ GstBusSyncReply Gst_bus_call(GstBus *bus, GstMessage *msg, gpointer user_data) cPlayback::cPlayback(int num) { - lt_info( "%s:%s\n", FILENAME, __FUNCTION__); + hal_info( "%s:%s\n", FILENAME, __FUNCTION__); const gchar *nano_str; guint major, minor, micro, nano; @@ -430,7 +430,7 @@ cPlayback::cPlayback(int num) else nano_str = ""; - lt_info( "%s:%s - This program is linked against GStreamer %d.%d.%d %s\n", + hal_info( "%s:%s - This program is linked against GStreamer %d.%d.%d %s\n", FILENAME, __FUNCTION__, major, minor, micro, nano_str); @@ -445,7 +445,7 @@ cPlayback::cPlayback(int num) cPlayback::~cPlayback() { - lt_info( "%s:%s\n", FILENAME, __FUNCTION__); + hal_info( "%s:%s\n", FILENAME, __FUNCTION__); //FIXME: all deleting stuff is done in Close() pthread_mutex_lock (&mutex_tag_ist); if (m_stream_tags) @@ -456,7 +456,7 @@ cPlayback::~cPlayback() //Used by Fileplay bool cPlayback::Open(playmode_t PlayMode) { - lt_info("%s: PlayMode %d\n", __func__, PlayMode); + hal_info("%s: PlayMode %d\n", __func__, PlayMode); if (PlayMode != PLAYMODE_TS) { @@ -472,7 +472,7 @@ bool cPlayback::Open(playmode_t PlayMode) // used by movieplay void cPlayback::Close(void) { - lt_info( "%s:%s\n", FILENAME, __FUNCTION__); + hal_info( "%s:%s\n", FILENAME, __FUNCTION__); Stop(); @@ -484,7 +484,7 @@ void cPlayback::Close(void) gst_bus_set_sync_handler(bus, NULL, NULL, NULL); if (bus) gst_object_unref(bus); - lt_info( "%s:%s - GST bus handler closed\n", FILENAME, __FUNCTION__); + hal_info( "%s:%s - GST bus handler closed\n", FILENAME, __FUNCTION__); } // close gst @@ -495,7 +495,7 @@ void cPlayback::Close(void) gst_object_unref(GST_OBJECT(audioSink)); audioSink = NULL; - lt_info( "%s:%s - GST audio Sink closed\n", FILENAME, __FUNCTION__); + hal_info( "%s:%s - GST audio Sink closed\n", FILENAME, __FUNCTION__); } if (videoSink) @@ -503,12 +503,12 @@ void cPlayback::Close(void) gst_object_unref(GST_OBJECT(videoSink)); videoSink = NULL; - lt_info( "%s:%s - GST video Sink closed\n", FILENAME, __FUNCTION__); + hal_info( "%s:%s - GST video Sink closed\n", FILENAME, __FUNCTION__); } // unref m_gst_playbin gst_object_unref (GST_OBJECT (m_gst_playbin)); - lt_info( "%s:%s - GST playbin closed\n", FILENAME, __FUNCTION__); + hal_info( "%s:%s - GST playbin closed\n", FILENAME, __FUNCTION__); m_gst_playbin = NULL; @@ -530,7 +530,7 @@ bool cPlayback::Start(std::string filename, std::string headers) bool cPlayback::Start(char *filename, int /*vpid*/, int /*vtype*/, int /*apid*/, int /*ac3*/, int /*duration*/, std::string headers) { - lt_info( "%s:%s\n", FILENAME, __FUNCTION__); + hal_info( "%s:%s\n", FILENAME, __FUNCTION__); if (!headers.empty()) extra_headers = headers; @@ -587,7 +587,7 @@ bool cPlayback::Start(char *filename, int /*vpid*/, int /*vtype*/, int /*apid*/, else uri = g_filename_to_uri(filename, NULL, NULL); - lt_info("%s:%s - filename=%s\n", FILENAME, __FUNCTION__, filename); + hal_info("%s:%s - filename=%s\n", FILENAME, __FUNCTION__, filename); guint flags = GST_PLAY_FLAG_AUDIO | GST_PLAY_FLAG_VIDEO | GST_PLAY_FLAG_NATIVE_VIDEO; @@ -599,7 +599,7 @@ bool cPlayback::Start(char *filename, int /*vpid*/, int /*vtype*/, int /*apid*/, if(m_gst_playbin) { - lt_info("%s:%s - m_gst_playbin\n", FILENAME, __FUNCTION__); + hal_info("%s:%s - m_gst_playbin\n", FILENAME, __FUNCTION__); if(isHTTP) { @@ -639,7 +639,7 @@ bool cPlayback::Start(char *filename, int /*vpid*/, int /*vtype*/, int /*apid*/, } else { - lt_info("%s:%s - failed to create GStreamer pipeline!, sorry we can not play\n", FILENAME, __FUNCTION__); + hal_info("%s:%s - failed to create GStreamer pipeline!, sorry we can not play\n", FILENAME, __FUNCTION__); playing = false; return false; @@ -652,7 +652,7 @@ bool cPlayback::Start(char *filename, int /*vpid*/, int /*vtype*/, int /*apid*/, bool cPlayback::Play(void) { - lt_info( "%s:%s playing %d\n", FILENAME, __FUNCTION__, playing); + hal_info( "%s:%s playing %d\n", FILENAME, __FUNCTION__, playing); if(playing == true) return true; @@ -664,7 +664,7 @@ bool cPlayback::Play(void) playing = true; playstate = STATE_PLAY; } - lt_info("%s:%s playing %d\n", FILENAME, __FUNCTION__, playing); + hal_info("%s:%s playing %d\n", FILENAME, __FUNCTION__, playing); return playing; } @@ -673,7 +673,7 @@ bool cPlayback::Stop(void) { if(playing == false) return false; - lt_info( "%s:%s playing %d\n", FILENAME, __FUNCTION__, playing); + hal_info( "%s:%s playing %d\n", FILENAME, __FUNCTION__, playing); // stop if(m_gst_playbin) @@ -683,7 +683,7 @@ bool cPlayback::Stop(void) playing = false; - lt_info( "%s:%s playing %d\n", FILENAME, __FUNCTION__, playing); + hal_info( "%s:%s playing %d\n", FILENAME, __FUNCTION__, playing); playstate = STATE_STOP; @@ -692,7 +692,7 @@ bool cPlayback::Stop(void) bool cPlayback::SetAPid(int pid, bool /*ac3*/) { - lt_info("%s: pid %i\n", __func__, pid); + hal_info("%s: pid %i\n", __func__, pid); int to_audio = pid; @@ -730,7 +730,7 @@ void cPlayback::trickSeek(int ratio) bool cPlayback::SetSpeed(int speed) { - lt_info( "%s:%s speed %d\n", FILENAME, __FUNCTION__, speed); + hal_info( "%s:%s speed %d\n", FILENAME, __FUNCTION__, speed); if (!decoders_closed) { @@ -789,7 +789,7 @@ bool cPlayback::SetSpeed(int speed) bool cPlayback::SetSlow(int slow) { - lt_info( "%s:%s playing %d\n", FILENAME, __FUNCTION__, playing); + hal_info( "%s:%s playing %d\n", FILENAME, __FUNCTION__, playing); if(playing == false) return false; @@ -836,14 +836,14 @@ bool cPlayback::GetPosition(int &position, int &duration) g_signal_emit_by_name(audioSink ? audioSink : videoSink, "get-decoder-time", &pts); if (!GST_CLOCK_TIME_IS_VALID(pts)) { - lt_info( "%s - %d failed\n", __FUNCTION__, __LINE__); + hal_info( "%s - %d failed\n", __FUNCTION__, __LINE__); } } else { if(!gst_element_query_position(m_gst_playbin, fmt, &pts)) { - lt_info( "%s - %d failed\n", __FUNCTION__, __LINE__); + hal_info( "%s - %d failed\n", __FUNCTION__, __LINE__); } } position = pts / 1000000.0; @@ -865,7 +865,7 @@ bool cPlayback::GetPosition(int &position, int &duration) bool cPlayback::SetPosition(int position, bool absolute) { - lt_info("%s: pos %d abs %d playing %d\n", __func__, position, absolute, playing); + hal_info("%s: pos %d abs %d playing %d\n", __func__, position, absolute, playing); if(m_gst_playbin) @@ -904,7 +904,7 @@ bool cPlayback::SetPosition(int position, bool absolute) void cPlayback::FindAllPids(int *apids, unsigned int *ac3flags, unsigned int *numpida, std::string * language) { - lt_info( "%s:%s\n", FILENAME, __FUNCTION__); + hal_info( "%s:%s\n", FILENAME, __FUNCTION__); language->clear(); *numpida = 0; @@ -915,7 +915,7 @@ void cPlayback::FindAllPids(int *apids, unsigned int *ac3flags, unsigned int *nu // get audio g_object_get (m_gst_playbin, "n-audio", &n_audio, NULL); - lt_info("%s: %d audio\n", __FUNCTION__, n_audio); + hal_info("%s: %d audio\n", __FUNCTION__, n_audio); if(n_audio == 0) return; @@ -991,7 +991,7 @@ void cPlayback::FindAllPids(int *apids, unsigned int *ac3flags, unsigned int *nu language[i] = "unk"; else language[i] = slang.c_str(); - lt_info("%s: language:%s\n", __FUNCTION__, language[i].c_str()); + hal_info("%s: language:%s\n", __FUNCTION__, language[i].c_str()); g_free(g_lang); } gst_tag_list_free(tags); @@ -1009,7 +1009,7 @@ void cPlayback::getMeta() bool cPlayback::SyncAV(void) { - lt_info( "%s:%s playing %d\n", FILENAME, __FUNCTION__, playing); + hal_info( "%s:%s playing %d\n", FILENAME, __FUNCTION__, playing); if(playing == false ) return false; @@ -1164,7 +1164,7 @@ int cPlayback::GetAPid(void) { gint current_audio = 0; g_object_get (m_gst_playbin, "current-audio", ¤t_audio, NULL); - lt_info("%s: %d audio\n", __FUNCTION__, current_audio); + hal_info("%s: %d audio\n", __FUNCTION__, current_audio); return real_apids[current_audio] ? real_apids[current_audio] : current_audio; } @@ -1172,7 +1172,7 @@ int cPlayback::GetVPid(void) { gint current_video = 0; g_object_get (m_gst_playbin, "current-video", ¤t_video, NULL); - lt_info("%s: %d video\n", __FUNCTION__, current_video); + hal_info("%s: %d video\n", __FUNCTION__, current_video); return current_video; } diff --git a/libarmbox/playback_libeplayer3.cpp b/libarmbox/playback_libeplayer3.cpp index 2cb61e4..4e038a0 100644 --- a/libarmbox/playback_libeplayer3.cpp +++ b/libarmbox/playback_libeplayer3.cpp @@ -15,10 +15,10 @@ extern ContainerHandler_t ContainerHandler; extern ManagerHandler_t ManagerHandler; #include "playback_libeplayer3.h" -#include "lt_debug.h" +#include "hal_debug.h" -#define lt_debug(args...) _lt_debug(HAL_DEBUG_PLAYBACK, this, args) -#define lt_info(args...) _lt_info(HAL_DEBUG_PLAYBACK, this, args) +#define hal_debug(args...) _hal_debug(HAL_DEBUG_PLAYBACK, this, args) +#define hal_info(args...) _hal_info(HAL_DEBUG_PLAYBACK, this, args) static Context_t *player = NULL; @@ -63,7 +63,7 @@ bool cPlayback::Open(playmode_t PlayMode) player->container = &ContainerHandler; player->manager = &ManagerHandler; - lt_info("%s - player output name: %s PlayMode: %s\n", __func__, player->output->Name, aPLAYMODE[PlayMode]); + hal_info("%s - player output name: %s PlayMode: %s\n", __func__, player->output->Name, aPLAYMODE[PlayMode]); } //Registration of output devices @@ -79,7 +79,7 @@ bool cPlayback::Open(playmode_t PlayMode) void cPlayback::Close(void) { - lt_info("%s\n", __func__); + hal_info("%s\n", __func__); //Dagobert: movieplayer does not call stop, it calls close ;) if(playing) @@ -104,7 +104,7 @@ bool cPlayback::Start(char *filename, int vpid, int vtype, int apid, int ac3, in bool isHTTP = false; no_probe = false; - lt_info("%s - filename=%s vpid=%u vtype=%d apid=%u ac3=%d\n", __func__, filename, vpid, vtype, apid, ac3); + hal_info("%s - filename=%s vpid=%u vtype=%d apid=%u ac3=%d\n", __func__, filename, vpid, vtype, apid, ac3); init_jump = -1; //create playback path @@ -240,7 +240,7 @@ bool cPlayback::Start(char *filename, int vpid, int vtype, int apid, int ac3, in bool cPlayback::Stop(void) { - lt_info("%s playing %d\n", __func__, playing); + hal_info("%s playing %d\n", __func__, playing); if (player && player->playback) player->playback->Command(player, PLAYBACK_STOP, NULL); @@ -264,7 +264,7 @@ bool cPlayback::Stop(void) bool cPlayback::SetAPid(int pid, bool /* ac3 */) { - lt_info("%s\n", __func__); + hal_info("%s\n", __func__); int i = pid; if (pid != mAudioStream) @@ -278,13 +278,13 @@ bool cPlayback::SetAPid(int pid, bool /* ac3 */) bool cPlayback::SetVPid(int /*pid*/) { - lt_info("%s\n", __func__); + hal_info("%s\n", __func__); return true; } bool cPlayback::SetSubtitlePid(int pid) { - lt_info("%s\n", __func__); + hal_info("%s\n", __func__); int i = pid; if (pid != mSubtitleStream) @@ -298,7 +298,7 @@ bool cPlayback::SetSubtitlePid(int pid) bool cPlayback::SetTeletextPid(int pid) { - lt_info("%s\n", __func__); + hal_info("%s\n", __func__); //int i = pid; @@ -313,7 +313,7 @@ bool cPlayback::SetTeletextPid(int pid) bool cPlayback::SetSpeed(int speed) { - lt_info("%s playing %d speed %d\n", __func__, playing, speed); + hal_info("%s playing %d speed %d\n", __func__, playing, speed); if (!decoders_closed) { @@ -391,7 +391,7 @@ bool cPlayback::SetSpeed(int speed) bool cPlayback::GetSpeed(int &speed) const { - lt_debug("%s\n", __func__); + hal_debug("%s\n", __func__); speed = nPlaybackSpeed; return true; } @@ -406,7 +406,7 @@ void cPlayback::GetPts(uint64_t &pts) bool cPlayback::GetPosition(int &position, int &duration) { bool got_duration = false; - lt_debug("%s %d %d\n", __func__, position, duration); + hal_debug("%s %d %d\n", __func__, position, duration); /* hack: if the file is growing (timeshift), then determine its length * by comparing the mtime with the mtime of the xml file */ @@ -435,7 +435,7 @@ bool cPlayback::GetPosition(int &position, int &duration) if (player && player->playback && !player->playback->isPlaying) { - lt_info("%s !!!!EOF!!!! < -1\n", __func__); + hal_info("%s !!!!EOF!!!! < -1\n", __func__); position = duration + 1000; return false; } @@ -485,7 +485,7 @@ bool cPlayback::GetPosition(int &position, int &duration) bool cPlayback::SetPosition(int position, bool absolute) { - lt_info("%s %d\n", __func__, position); + hal_info("%s %d\n", __func__, position); if (playing && first) { @@ -510,7 +510,7 @@ bool cPlayback::SetPosition(int position, bool absolute) void cPlayback::FindAllPids(int *apids, unsigned int *ac3flags, unsigned int *numpida, std::string *language) { - lt_info("%s\n", __func__); + hal_info("%s\n", __func__); int max_numpida = *numpida; *numpida = 0; @@ -573,7 +573,7 @@ void cPlayback::FindAllPids(int *apids, unsigned int *ac3flags, unsigned int *nu void cPlayback::FindAllSubtitlePids(int *pids, unsigned int *numpids, std::string *language) { - lt_info("%s\n", __func__); + hal_info("%s\n", __func__); int max_numpids = *numpids; *numpids = 0; @@ -610,7 +610,7 @@ void cPlayback::FindAllSubtitlePids(int *pids, unsigned int *numpids, std::strin void cPlayback::FindAllTeletextsubtitlePids(int */*pids*/, unsigned int *numpids, std::string */*language*/, int */*mags*/, int */*pages*/) { - lt_info("%s\n", __func__); + hal_info("%s\n", __func__); //int max_numpids = *numpids; *numpids = 0; @@ -648,7 +648,7 @@ void cPlayback::FindAllTeletextsubtitlePids(int */*pids*/, unsigned int *numpids int cPlayback::GetTeletextPid(void) { - lt_info("%s\n", __func__); + hal_info("%s\n", __func__); int pid = -1; /* if (player && player->manager && player->manager->teletext) @@ -755,7 +755,7 @@ void cPlayback::GetMetadata(std::vector &keys, std::vectorplayback && player->playback->isPlaying) { - lt_info("%s\n", __func__); + hal_info("%s\n", __func__); Stop(); //player->playback->abortRequested = 1; while (player->playback->isPlaying) @@ -810,7 +810,7 @@ void cPlayback::ReleaseAVFormatContext() #if 0 bool cPlayback::IsPlaying(void) const { - lt_info("%s\n", __func__); + hal_info("%s\n", __func__); /* konfetti: there is no event/callback mechanism in libeplayer2 * so in case of ending playback we have no information on a diff --git a/libarmbox/record.cpp b/libarmbox/record.cpp index b411e34..6662aa8 100644 --- a/libarmbox/record.cpp +++ b/libarmbox/record.cpp @@ -28,9 +28,9 @@ #include #include "record_lib.h" -#include "lt_debug.h" -#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_RECORD, this, args) -#define lt_info(args...) _lt_info(TRIPLE_DEBUG_RECORD, this, args) +#include "hal_debug.h" +#define hal_debug(args...) _hal_debug(HAL_DEBUG_RECORD, this, args) +#define hal_info(args...) _hal_info(HAL_DEBUG_RECORD, this, args) /* helper function to call the cpp thread loop */ void *execute_record_thread(void *c) @@ -49,7 +49,7 @@ void *execute_writer_thread(void *c) cRecord::cRecord(int num, int bs_dmx, int bs) { - lt_info("%s %d\n", __func__, num); + hal_info("%s %d\n", __func__, num); dmx = NULL; record_thread_running = false; file_fd = -1; @@ -63,14 +63,14 @@ cRecord::cRecord(int num, int bs_dmx, int bs) cRecord::~cRecord() { - lt_info("%s: calling ::Stop()\n", __func__); + hal_info("%s: calling ::Stop()\n", __func__); Stop(); - lt_info("%s: end\n", __func__); + hal_info("%s: end\n", __func__); } bool cRecord::Open(void) { - lt_info("%s\n", __func__); + hal_info("%s\n", __func__); exit_flag = RECORD_STOPPED; return true; } @@ -79,13 +79,13 @@ bool cRecord::Open(void) // unused void cRecord::Close(void) { - lt_info("%s: \n", __func__); + hal_info("%s: \n", __func__); } #endif bool cRecord::Start(int fd, unsigned short vpid, unsigned short *apids, int numpids, uint64_t) { - lt_info("%s: fd %d, vpid 0x%03x\n", __func__, fd, vpid); + hal_info("%s: fd %d, vpid 0x%03x\n", __func__, fd, vpid); int i; if (!dmx) @@ -107,7 +107,7 @@ bool cRecord::Start(int fd, unsigned short vpid, unsigned short *apids, int nump { exit_flag = RECORD_FAILED_READ; errno = i; - lt_info("%s: error creating thread! (%m)\n", __func__); + hal_info("%s: error creating thread! (%m)\n", __func__); delete dmx; dmx = NULL; return false; @@ -118,10 +118,10 @@ bool cRecord::Start(int fd, unsigned short vpid, unsigned short *apids, int nump bool cRecord::Stop(void) { - lt_info("%s\n", __func__); + hal_info("%s\n", __func__); if (exit_flag != RECORD_RUNNING) - lt_info("%s: status not RUNNING? (%d)\n", __func__, exit_flag); + hal_info("%s: status not RUNNING? (%d)\n", __func__, exit_flag); exit_flag = RECORD_STOPPED; if (record_thread_running) @@ -130,7 +130,7 @@ bool cRecord::Stop(void) /* We should probably do that from the destructor... */ if (!dmx) - lt_info("%s: dmx == NULL?\n", __func__); + hal_info("%s: dmx == NULL?\n", __func__); else delete dmx; dmx = NULL; @@ -138,7 +138,7 @@ bool cRecord::Stop(void) if (file_fd != -1) close(file_fd); else - lt_info("%s: file_fd not open??\n", __func__); + hal_info("%s: file_fd not open??\n", __func__); file_fd = -1; return true; } @@ -149,9 +149,9 @@ bool cRecord::ChangePids(unsigned short /*vpid*/, unsigned short *apids, int num int j; bool found; unsigned short pid; - lt_info("%s\n", __func__); + hal_info("%s\n", __func__); if (!dmx) { - lt_info("%s: DMX = NULL\n", __func__); + hal_info("%s: DMX = NULL\n", __func__); return false; } pids = dmx->pesfds; @@ -185,9 +185,9 @@ bool cRecord::ChangePids(unsigned short /*vpid*/, unsigned short *apids, int num bool cRecord::AddPid(unsigned short pid) { std::vector pids; - lt_info("%s: \n", __func__); + hal_info("%s: \n", __func__); if (!dmx) { - lt_info("%s: DMX = NULL\n", __func__); + hal_info("%s: DMX = NULL\n", __func__); return false; } pids = dmx->pesfds; @@ -226,7 +226,7 @@ void cRecord::WriterThread() void cRecord::RecordThread() { - lt_info("%s: begin\n", __func__); + hal_info("%s: begin\n", __func__); char threadname[17]; strncpy(threadname, "RecordThread", sizeof(threadname)); threadname[16] = 0; @@ -239,20 +239,20 @@ void cRecord::RecordThread() struct aiocb a; buf = (uint8_t *)malloc(bufsize); - lt_info("BUFSIZE=0x%x READSIZE=0x%x\n", bufsize, readsize); + hal_info("BUFSIZE=0x%x READSIZE=0x%x\n", bufsize, readsize); if (!buf) { exit_flag = RECORD_FAILED_MEMORY; - lt_info("%s: unable to allocate buffer! (out of memory)\n", __func__); + hal_info("%s: unable to allocate buffer! (out of memory)\n", __func__); if (failureCallback) failureCallback(failureData); - lt_info("%s: end\n", __func__); + hal_info("%s: end\n", __func__); pthread_exit(NULL); } int val = fcntl(file_fd, F_GETFL); if (fcntl(file_fd, F_SETFL, val|O_APPEND)) - lt_info("%s: O_APPEND? (%m)\n", __func__); + hal_info("%s: O_APPEND? (%m)\n", __func__); memset(&a, 0, sizeof(a)); a.aio_fildes = file_fd; @@ -267,20 +267,20 @@ void cRecord::RecordThread() if (buf_pos < bufsize) { if (overflow_count) { - lt_info("%s: Overflow cleared after %d iterations\n", __func__, overflow_count); + hal_info("%s: Overflow cleared after %d iterations\n", __func__, overflow_count); overflow_count = 0; } int toread = bufsize - buf_pos; if (toread > readsize) toread = readsize; ssize_t s = dmx->Read(buf + buf_pos, toread, 50); - lt_debug("%s: buf_pos %6d s %6d / %6d\n", __func__, + hal_debug("%s: buf_pos %6d s %6d / %6d\n", __func__, buf_pos, (int)s, bufsize - buf_pos); if (s < 0) { if (errno != EAGAIN && (errno != EOVERFLOW || !overflow)) { - lt_info("%s: read failed: %m\n", __func__); + hal_info("%s: read failed: %m\n", __func__); exit_flag = RECORD_FAILED_READ; state = REC_STATUS_OVERFLOW; break; @@ -307,13 +307,13 @@ void cRecord::RecordThread() overflow_count = 0; overflow = true; if (!(overflow_count % 10)) - lt_info("%s: buffer full! Overflow? (%d)\n", __func__, ++overflow_count); + hal_info("%s: buffer full! Overflow? (%d)\n", __func__, ++overflow_count); state = REC_STATUS_SLOW; } r = aio_error(&a); if (r == EINPROGRESS) { - lt_debug("%s: aio in progress, free: %d\n", __func__, bufsize - buf_pos); + hal_debug("%s: aio in progress, free: %d\n", __func__, bufsize - buf_pos); continue; } // not calling aio_return causes a memory leak --martii @@ -321,11 +321,11 @@ void cRecord::RecordThread() if (r < 0) { exit_flag = RECORD_FAILED_FILE; - lt_debug("%s: aio_return = %d (%m)\n", __func__, r); + hal_debug("%s: aio_return = %d (%m)\n", __func__, r); break; } else - lt_debug("%s: aio_return = %d, free: %d\n", __func__, r, bufsize - buf_pos); + hal_debug("%s: aio_return = %d, free: %d\n", __func__, r, bufsize - buf_pos); if (posix_fadvise(file_fd, 0, 0, POSIX_FADV_DONTNEED)) perror("posix_fadvise"); if (queued) @@ -339,7 +339,7 @@ void cRecord::RecordThread() r = aio_write(&a); if (r) { - lt_info("%s: aio_write %d (%m)\n", __func__, r); + hal_info("%s: aio_write %d (%m)\n", __func__, r); exit_flag = RECORD_FAILED_FILE; break; } @@ -347,7 +347,7 @@ void cRecord::RecordThread() dmx->Stop(); while (true) /* write out the unwritten buffer content */ { - lt_debug("%s: run-out write, buf_pos %d\n", __func__, buf_pos); + hal_debug("%s: run-out write, buf_pos %d\n", __func__, buf_pos); r = aio_error(&a); if (r == EINPROGRESS) { @@ -358,7 +358,7 @@ void cRecord::RecordThread() if (r < 0) { exit_flag = RECORD_FAILED_FILE; - lt_info("%s: aio_result: %d (%m)\n", __func__, r); + hal_info("%s: aio_result: %d (%m)\n", __func__, r); break; } if (!queued) @@ -388,7 +388,7 @@ void cRecord::RecordThread() if ((exit_flag != RECORD_STOPPED) && failureCallback) failureCallback(failureData); - lt_info("%s: end\n", __func__); + hal_info("%s: end\n", __func__); pthread_exit(NULL); } diff --git a/libarmbox/video.cpp b/libarmbox/video.cpp index e05f3c3..ee79529 100644 --- a/libarmbox/video.cpp +++ b/libarmbox/video.cpp @@ -35,7 +35,7 @@ #include #include #include "video_lib.h" -#include "lt_debug.h" +#include "hal_debug.h" #include "hdmi_cec.h" #include @@ -48,18 +48,18 @@ extern "C" #include } -#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_VIDEO, this, args) -#define lt_info(args...) _lt_info(TRIPLE_DEBUG_VIDEO, this, args) -#define lt_debug_c(args...) _lt_debug(TRIPLE_DEBUG_VIDEO, NULL, args) -#define lt_info_c(args...) _lt_info(TRIPLE_DEBUG_VIDEO, NULL, args) +#define hal_debug(args...) _hal_debug(HAL_DEBUG_VIDEO, this, args) +#define hal_info(args...) _hal_info(HAL_DEBUG_VIDEO, this, args) +#define hal_debug_c(args...) _hal_debug(HAL_DEBUG_VIDEO, NULL, args) +#define hal_info_c(args...) _hal_info(HAL_DEBUG_VIDEO, NULL, args) #define fop(cmd, args...) ({ \ int _r; \ if (fd >= 0) { \ if ((_r = ::cmd(fd, args)) < 0) \ - lt_info(#cmd"(fd, "#args")\n"); \ + hal_info(#cmd"(fd, "#args")\n"); \ else \ - lt_debug(#cmd"(fd, "#args")\n");\ + hal_debug(#cmd"(fd, "#args")\n");\ } \ else { _r = fd; } \ _r; \ @@ -313,7 +313,7 @@ void setAVInput(int val) cVideo::cVideo(int, void *, void *, unsigned int unit) { - lt_debug("%s unit %u\n", __func__, unit); + hal_debug("%s unit %u\n", __func__, unit); brightness = -1; contrast = -1; @@ -321,7 +321,7 @@ cVideo::cVideo(int, void *, void *, unsigned int unit) hue = -1; video_standby = 0; if (unit > 1) { - lt_info("%s: unit %d out of range, setting to 0\n", __func__, unit); + hal_info("%s: unit %d out of range, setting to 0\n", __func__, unit); devnum = 0; } else devnum = unit; @@ -343,7 +343,7 @@ cVideo::~cVideo(void) void cVideo::openDevice(void) { int n = 0; - lt_debug("#%d: %s\n", devnum, __func__); + hal_debug("#%d: %s\n", devnum, __func__); /* todo: this fd checking is racy, should be protected by a lock */ if (fd != -1) /* already open */ return; @@ -357,14 +357,14 @@ retry: if (++n < 10) goto retry; } - lt_info("#%d: %s cannot open %s: %m, retries %d\n", devnum, __func__, VDEV[devnum], n); + hal_info("#%d: %s cannot open %s: %m, retries %d\n", devnum, __func__, VDEV[devnum], n); } playstate = VIDEO_STOPPED; } void cVideo::closeDevice(void) { - lt_debug("%s\n", __func__); + hal_debug("%s\n", __func__); /* looks like sometimes close is unhappy about non-empty buffers */ // Start(); if (fd >= 0) @@ -381,22 +381,22 @@ int cVideo::setAspectRatio(int aspect, int mode) int n; int mo = (mode < 0||mode > 3) ? 4 : mode; - lt_debug("%s: a:%d m:%d %s\n", __func__, aspect, mode, m[mo]); + hal_debug("%s: a:%d m:%d %s\n", __func__, aspect, mode, m[mo]); if (aspect > 3 || aspect == 0) - lt_info("%s: invalid aspect: %d\n", __func__, aspect); + hal_info("%s: invalid aspect: %d\n", __func__, aspect); else if (aspect > 0) /* -1 == don't set */ { - lt_debug("%s: /proc/stb/video/aspect -> %s\n", __func__, a[aspect]); + hal_debug("%s: /proc/stb/video/aspect -> %s\n", __func__, a[aspect]); n = proc_put("/proc/stb/video/aspect", a[aspect], strlen(a[aspect])); if (n < 0) - lt_info("%s: proc_put /proc/stb/video/aspect (%m)\n", __func__); + hal_info("%s: proc_put /proc/stb/video/aspect (%m)\n", __func__); } if (mode == -1) return 0; - lt_debug("%s: /proc/stb/video/policy -> %s\n", __func__, m[mo]); + hal_debug("%s: /proc/stb/video/policy -> %s\n", __func__, m[mo]); n = proc_put("/proc/stb/video/policy", m[mo], strlen(m[mo])); if (n < 0) return 1; @@ -414,10 +414,10 @@ int cVideo::getAspectRatio(void) } if (fop(ioctl, VIDEO_GET_SIZE, &s) < 0) { - lt_info("%s: VIDEO_GET_SIZE %m\n", __func__); + hal_info("%s: VIDEO_GET_SIZE %m\n", __func__); return -1; } - lt_debug("#%d: %s: %d\n", devnum, __func__, s.aspect_ratio); + hal_debug("#%d: %s: %d\n", devnum, __func__, s.aspect_ratio); return s.aspect_ratio * 2 + 1; } @@ -432,14 +432,14 @@ int cVideo::setCroppingMode(int /*vidDispMode_t format*/) f = format_string[format]; else f = "ILLEGAL format!"; - lt_debug("%s(%d) => %s\n", __FUNCTION__, format, f); + hal_debug("%s(%d) => %s\n", __FUNCTION__, format, f); return fop(ioctl, MPEG_VID_SET_DISPMODE, format); #endif } int cVideo::Start(void * /*PcrChannel*/, unsigned short /*PcrPid*/, unsigned short /*VideoPid*/, void * /*hChannel*/) { - lt_debug("#%d: %s playstate=%d\n", devnum, __func__, playstate); + hal_debug("#%d: %s playstate=%d\n", devnum, __func__, playstate); #if 0 if (playstate == VIDEO_PLAYING) return 0; @@ -448,7 +448,7 @@ int cVideo::Start(void * /*PcrChannel*/, unsigned short /*PcrPid*/, unsigned sho #endif /* implicitly do StopPicture() on video->Start() */ if (stillpicture) { - lt_info("%s: stillpicture == true, doing implicit StopPicture()\n", __func__); + hal_info("%s: stillpicture == true, doing implicit StopPicture()\n", __func__); stillpicture = false; Stop(1); } @@ -476,10 +476,10 @@ int cVideo::Start(void * /*PcrChannel*/, unsigned short /*PcrPid*/, unsigned sho int cVideo::Stop(bool blank) { - lt_debug("#%d: %s(%d)\n", devnum, __func__, blank); + hal_debug("#%d: %s(%d)\n", devnum, __func__, blank); if (stillpicture) { - lt_debug("%s: stillpicture == true\n", __func__); + hal_debug("%s: stillpicture == true\n", __func__); return -1; } playstate = blank ? VIDEO_STOPPED : VIDEO_FREEZED; @@ -497,25 +497,25 @@ int cVideo::setBlank(int) int cVideo::SetVideoSystem(int video_system, bool remember) { - lt_debug("%s(%d, %d)\n", __func__, video_system, remember); + hal_debug("%s(%d, %d)\n", __func__, video_system, remember); char current[32]; if (video_system > VIDEO_STD_MAX) { - lt_info("%s: video_system (%d) > VIDEO_STD_MAX (%d)\n", __func__, video_system, VIDEO_STD_MAX); + hal_info("%s: video_system (%d) > VIDEO_STD_MAX (%d)\n", __func__, video_system, VIDEO_STD_MAX); return -1; } int ret = proc_get("/proc/stb/video/videomode", current, 32); if (strcmp(current, vid_modes[video_system]) == 0) { - lt_info("%s: video_system %d (%s) already set, skipping\n", __func__, video_system, current); + hal_info("%s: video_system %d (%s) already set, skipping\n", __func__, video_system, current); return 0; } - lt_info("%s: old: '%s' new: '%s'\n", __func__, current, vid_modes[video_system]); + hal_info("%s: old: '%s' new: '%s'\n", __func__, current, vid_modes[video_system]); bool stopped = false; if (playstate == VIDEO_PLAYING) { - lt_info("%s: playstate == VIDEO_PLAYING, stopping video\n", __func__); + hal_info("%s: playstate == VIDEO_PLAYING, stopping video\n", __func__); Stop(); stopped = true; } @@ -535,7 +535,7 @@ int cVideo::GetVideoSystem(void) if (strcmp(current, vid_modes[i]) == 0) return i; } - lt_info("%s: could not find '%s' mode, returning VIDEO_STD_720P50\n", __func__, current); + hal_info("%s: could not find '%s' mode, returning VIDEO_STD_720P50\n", __func__, current); return VIDEO_STD_720P50; } @@ -544,7 +544,7 @@ void cVideo::GetVideoSystemFormatName(cs_vs_format_t *format, int system) if (system == -1) system = GetVideoSystem(); if (system < 0 || system > VIDEO_STD_1080P50) { - lt_info("%s: invalid system %d\n", __func__, system); + hal_info("%s: invalid system %d\n", __func__, system); strcpy(format->format, "invalid"); } else strcpy(format->format, vid_modes[system]); @@ -557,10 +557,10 @@ int cVideo::getPlayState(void) void cVideo::SetVideoMode(analog_mode_t mode) { - lt_debug("#%d: %s(%d)\n", devnum, __func__, mode); + hal_debug("#%d: %s(%d)\n", devnum, __func__, mode); if (!(mode & ANALOG_SCART_MASK)) { - lt_debug("%s: non-SCART mode ignored\n", __func__); + hal_debug("%s: non-SCART mode ignored\n", __func__); return; } const char *m; @@ -573,7 +573,7 @@ void cVideo::SetVideoMode(analog_mode_t mode) m = "rgb"; break; default: - lt_info("%s unknown mode %d\n", __func__, mode); + hal_info("%s unknown mode %d\n", __func__, mode); m = "rgb"; break; /* default to rgb */ } @@ -582,11 +582,11 @@ void cVideo::SetVideoMode(analog_mode_t mode) void cVideo::ShowPicture(const char * fname) { - lt_debug("%s(%s)\n", __func__, fname); + hal_debug("%s(%s)\n", __func__, fname); if (video_standby) { /* does not work and the driver does not seem to like it */ - lt_info("%s: video_standby == true\n", __func__); + hal_info("%s: video_standby == true\n", __func__); return; } struct stat st; @@ -617,7 +617,7 @@ void cVideo::ShowPicture(const char * fname) void cVideo::StopPicture() { - lt_debug("%s\n", __func__); + hal_debug("%s\n", __func__); stillpicture = false; Stop(1); closeDevice(); @@ -626,7 +626,7 @@ void cVideo::StopPicture() void cVideo::Standby(unsigned int bOn) { - lt_debug("%s(%d)\n", __func__, bOn); + hal_debug("%s(%d)\n", __func__, bOn); if (bOn) { closeDevice(); @@ -644,7 +644,7 @@ void cVideo::Standby(unsigned int bOn) int cVideo::getBlank(void) { int ret = proc_get_hex(VMPEG_xres[devnum]); - lt_debug("%s => %d\n", __func__, !ret); + hal_debug("%s => %d\n", __func__, !ret); return !ret; } @@ -656,7 +656,7 @@ void cVideo::Pig(int x, int y, int w, int h, int osd_w, int osd_h, int startx, i * TODO: check this in the driver sources */ int xres = 720; /* proc_get_hex("/proc/stb/vmpeg/0/xres") */ int yres = 576; /* proc_get_hex("/proc/stb/vmpeg/0/yres") */ - lt_debug("#%d %s: x:%d y:%d w:%d h:%d ow:%d oh:%d\n", devnum, __func__, x, y, w, h, osd_w, osd_h); + hal_debug("#%d %s: x:%d y:%d w:%d h:%d ow:%d oh:%d\n", devnum, __func__, x, y, w, h, osd_w, osd_h); if (x == -1 && y == -1 && w == -1 && h == -1) { _w = xres; @@ -682,7 +682,7 @@ void cVideo::Pig(int x, int y, int w, int h, int osd_w, int osd_h, int startx, i _w /= 1280; _h /= 720; } - lt_debug("#%d %s: x:%d y:%d w:%d h:%d xr:%d yr:%d\n", devnum, __func__, _x, _y, _w, _h, xres, yres); + hal_debug("#%d %s: x:%d y:%d w:%d h:%d xr:%d yr:%d\n", devnum, __func__, _x, _y, _w, _h, xres, yres); sprintf(buffer, "%x", _x); proc_put(VMPEG_dst_left[devnum], buffer, strlen(buffer)); @@ -743,12 +743,12 @@ void cVideo::getPictureInfo(int &width, int &height, int &rate) rate = rate2csapi(r); height = s.h; width = s.w; - lt_debug("#%d: %s: rate: %d, width: %d height: %d\n", devnum, __func__, rate, width, height); + hal_debug("#%d: %s: rate: %d, width: %d height: %d\n", devnum, __func__, rate, width, height); } void cVideo::SetSyncMode(AVSYNC_TYPE mode) { - lt_debug("%s %d\n", __func__, mode); + hal_debug("%s %d\n", __func__, mode); /* * { 0, LOCALE_OPTIONS_OFF }, * { 1, LOCALE_OPTIONS_ON }, @@ -767,7 +767,7 @@ int cVideo::SetStreamType(VIDEO_FORMAT type) "VIDEO_FORMAT_PNG" }; int t; - lt_debug("#%d: %s type=%s\n", devnum, __func__, VF[type]); + hal_debug("#%d: %s type=%s\n", devnum, __func__, VF[type]); switch (type) { @@ -790,7 +790,7 @@ int cVideo::SetStreamType(VIDEO_FORMAT type) } if (ioctl(fd, VIDEO_SET_STREAMTYPE, t) < 0) - lt_info("%s VIDEO_SET_STREAMTYPE(%d) failed: %m\n", __func__, t); + hal_info("%s VIDEO_SET_STREAMTYPE(%d) failed: %m\n", __func__, t); return 0; } @@ -798,13 +798,13 @@ int64_t cVideo::GetPTS(void) { int64_t pts = 0; if (ioctl(fd, VIDEO_GET_PTS, &pts) < 0) - lt_info("%s: GET_PTS failed (%m)\n", __func__); + hal_info("%s: GET_PTS failed (%m)\n", __func__); return pts; } void cVideo::SetDemux(cDemux *) { - lt_debug("#%d %s not implemented yet\n", devnum, __func__); + hal_debug("#%d %s not implemented yet\n", devnum, __func__); } void cVideo::SetControl(int control, int value) @@ -934,7 +934,7 @@ static bool swscale(unsigned char *src, unsigned char *dst, int sw, int sh, int struct SwsContext *scale = NULL; scale = sws_getCachedContext(scale, sw, sh, sfmt, dw, dh, AV_PIX_FMT_RGB32, SWS_BICUBIC, 0, 0, 0); if (!scale) { - lt_info_c("%s: ERROR setting up SWS context\n", __func__); + hal_info_c("%s: ERROR setting up SWS context\n", __func__); return ret; } AVFrame *sframe = av_frame_alloc(); @@ -952,7 +952,7 @@ static bool swscale(unsigned char *src, unsigned char *dst, int sw, int sh, int else ret = true; }else{ - lt_info_c("%s: could not alloc sframe (%p) or dframe (%p)\n", __func__, sframe, dframe); + hal_info_c("%s: could not alloc sframe (%p) or dframe (%p)\n", __func__, sframe, dframe); ret = false; } @@ -968,7 +968,7 @@ static bool swscale(unsigned char *src, unsigned char *dst, int sw, int sh, int sws_freeContext(scale); scale = NULL; } - lt_info_c("%s: %s scale %ix%i to %ix%i ,len %i\n",ret?" ":"ERROR",__func__, sw, sh, dw, dh,len); + hal_info_c("%s: %s scale %ix%i to %ix%i ,len %i\n",ret?" ":"ERROR",__func__, sw, sh, dw, dh,len); return ret; } @@ -1055,7 +1055,7 @@ bool cVideo::GetScreenImage(unsigned char * &out_data, int &xres, int &yres, boo { #define VDEC_PIXFMT AV_PIX_FMT_BGR24 - lt_info("%s: out_data 0x%p xres %d yres %d vid %d osd %d scale %d\n", + hal_info("%s: out_data 0x%p xres %d yres %d vid %d osd %d scale %d\n", __func__, out_data, xres, yres, get_video, get_osd, scale_to_video); int aspect = 0; getPictureInfo(xres, yres, aspect); /* aspect is dummy here */ diff --git a/libazbox/audio.cpp b/libazbox/audio.cpp index 329b8f9..a5a6e66 100644 --- a/libazbox/audio.cpp +++ b/libazbox/audio.cpp @@ -10,11 +10,11 @@ #include #include "audio_lib.h" -#include "lt_debug.h" +#include "hal_debug.h" #define AUDIO_DEVICE "/dev/dvb/adapter0/audio0" -#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_AUDIO, this, args) -#define lt_info(args...) _lt_info(TRIPLE_DEBUG_AUDIO, this, args) +#define hal_debug(args...) _hal_debug(HAL_DEBUG_AUDIO, this, args) +#define hal_info(args...) _hal_info(HAL_DEBUG_AUDIO, this, args) #include @@ -36,20 +36,20 @@ cAudio::~cAudio(void) void cAudio::openDevice(void) { - lt_debug("%s\n", __func__); + hal_debug("%s\n", __func__); if (fd < 0) { if ((fd = open(AUDIO_DEVICE, O_RDONLY|O_CLOEXEC)) < 0) - lt_info("openDevice: open failed (%m)\n"); + hal_info("openDevice: open failed (%m)\n"); do_mute(true, false); } else - lt_info("openDevice: already open (fd = %d)\n", fd); + hal_info("openDevice: already open (fd = %d)\n", fd); } void cAudio::closeDevice(void) { - lt_debug("%s\n", __func__); + hal_debug("%s\n", __func__); ioctl(fd, AUDIO_CONTINUE); /* enigma2 also does CONTINUE before close... */ if (fd >= 0) close(fd); @@ -64,14 +64,14 @@ void cAudio::closeDevice(void) int cAudio::do_mute(bool enable, bool remember) { - lt_debug("%s(%d, %d)\n", __func__, enable, remember); + hal_debug("%s(%d, %d)\n", __func__, enable, remember); if (remember) Muted = enable; #if 0 /* does not work? */ if (ioctl(fd, AUDIO_SET_MUTE, enable) < 0 ) - lt_info("%s: AUDIO_SET_MUTE failed (%m)\n", __func__); + hal_info("%s: AUDIO_SET_MUTE failed (%m)\n", __func__); #else char s[2] = { 0, 0 }; s[0] = '0' + (int)enable; @@ -93,7 +93,7 @@ int map_volume(const int volume) int cAudio::setVolume(unsigned int left, unsigned int right) { - lt_debug("%s(%d, %d)\n", __func__, left, right); + hal_debug("%s(%d, %d)\n", __func__, left, right); volume = (left + right) / 2; if (clipfd != -1 && mixer_fd != -1) { @@ -103,7 +103,7 @@ int cAudio::setVolume(unsigned int left, unsigned int right) tmp = left << 8 | right; int ret = ioctl(mixer_fd, MIXER_WRITE(mixer_num), &tmp); if (ret == -1) - lt_info("%s: MIXER_WRITE(%d),%04x: %m\n", __func__, mixer_num, tmp); + hal_info("%s: MIXER_WRITE(%d),%04x: %m\n", __func__, mixer_num, tmp); return ret; } @@ -112,14 +112,14 @@ int cAudio::setVolume(unsigned int left, unsigned int right) mixer.volume_right = map_volume(right); if (ioctl(fd, AUDIO_SET_MIXER, &mixer) < 0) - lt_info("%s: AUDIO_SET_MIXER failed (%m)\n", __func__); + hal_info("%s: AUDIO_SET_MIXER failed (%m)\n", __func__); return 0; } int cAudio::Start(void) { - lt_debug("%s\n", __func__); + hal_debug("%s\n", __func__); int ret; ioctl(fd, AUDIO_CONTINUE); ret = ioctl(fd, AUDIO_PLAY); @@ -128,7 +128,7 @@ int cAudio::Start(void) int cAudio::Stop(void) { - lt_debug("%s\n", __func__); + hal_debug("%s\n", __func__); ioctl(fd, AUDIO_STOP); ioctl(fd, AUDIO_CONTINUE); /* no idea why we have to stop and then continue => enigma2 does it, too */ return 0; @@ -141,7 +141,7 @@ bool cAudio::Pause(bool /*Pcm*/) void cAudio::SetSyncMode(AVSYNC_TYPE Mode) { - lt_debug("%s %d\n", __func__, Mode); + hal_debug("%s %d\n", __func__, Mode); ioctl(fd, AUDIO_SET_AV_SYNC, Mode); }; @@ -157,7 +157,7 @@ void cAudio::SetSyncMode(AVSYNC_TYPE Mode) void cAudio::SetStreamType(AUDIO_FORMAT type) { int bypass = AUDIO_STREAMTYPE_MPEG; - lt_debug("%s %d\n", __func__, type); + hal_debug("%s %d\n", __func__, type); StreamType = type; switch (type) @@ -176,7 +176,7 @@ void cAudio::SetStreamType(AUDIO_FORMAT type) // Normaly the encoding should be set using AUDIO_SET_ENCODING // But as we implemented the behavior to bypass (cause of e2) this is correct here if (ioctl(fd, AUDIO_SET_BYPASS_MODE, bypass) < 0) - lt_info("%s: AUDIO_SET_BYPASS_MODE failed (%m)\n", __func__); + hal_info("%s: AUDIO_SET_BYPASS_MODE failed (%m)\n", __func__); }; int cAudio::setChannel(int channel) @@ -190,9 +190,9 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int little_endian) unsigned int devmask, stereo, usable; const char *dsp_dev = getenv("DSP_DEVICE"); const char *mix_dev = getenv("MIX_DEVICE"); - lt_debug("%s ch %d srate %d bits %d le %d\n", __FUNCTION__, ch, srate, bits, little_endian); + hal_debug("%s ch %d srate %d bits %d le %d\n", __FUNCTION__, ch, srate, bits, little_endian); if (clipfd >= 0) { - lt_info("%s: clipfd already opened (%d)\n", __FUNCTION__, clipfd); + hal_info("%s: clipfd already opened (%d)\n", __FUNCTION__, clipfd); return -1; } mixer_num = -1; @@ -207,15 +207,15 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int little_endian) */ if ((!dsp_dev) || (access(dsp_dev, W_OK))) { if (dsp_dev) - lt_info("%s: DSP_DEVICE is set (%s) but cannot be opened," + hal_info("%s: DSP_DEVICE is set (%s) but cannot be opened," " fall back to /dev/dsp1\n", __func__, dsp_dev); dsp_dev = "/dev/dsp1"; } - lt_info("%s: dsp_dev %s mix_dev %s\n", __func__, dsp_dev, mix_dev); /* NULL mix_dev is ok */ + hal_info("%s: dsp_dev %s mix_dev %s\n", __func__, dsp_dev, mix_dev); /* NULL mix_dev is ok */ /* the tdoss dsp driver seems to work only on the second open(). really. */ clipfd = open(dsp_dev, O_WRONLY|O_CLOEXEC); if (clipfd < 0) { - lt_info("%s open %s: %m\n", dsp_dev, __FUNCTION__); + hal_info("%s open %s: %m\n", dsp_dev, __FUNCTION__); return -1; } /* no idea if we ever get little_endian == 0 */ @@ -237,21 +237,21 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int little_endian) mixer_fd = open(mix_dev, O_RDWR|O_CLOEXEC); if (mixer_fd < 0) { - lt_info("%s: open mixer %s failed (%m)\n", __func__, mix_dev); + hal_info("%s: open mixer %s failed (%m)\n", __func__, mix_dev); /* not a real error */ return 0; } if (ioctl(mixer_fd, SOUND_MIXER_READ_DEVMASK, &devmask) == -1) { - lt_info("%s: SOUND_MIXER_READ_DEVMASK %m\n", __func__); + hal_info("%s: SOUND_MIXER_READ_DEVMASK %m\n", __func__); devmask = 0; } if (ioctl(mixer_fd, SOUND_MIXER_READ_STEREODEVS, &stereo) == -1) { - lt_info("%s: SOUND_MIXER_READ_STEREODEVS %m\n", __func__); + hal_info("%s: SOUND_MIXER_READ_STEREODEVS %m\n", __func__); stereo = 0; } usable = devmask & stereo; if (usable == 0) { - lt_info("%s: devmask: %08x stereo: %08x, no usable dev :-(\n", + hal_info("%s: devmask: %08x stereo: %08x, no usable dev :-(\n", __func__, devmask, stereo); close(mixer_fd); mixer_fd = -1; @@ -260,13 +260,13 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int little_endian) /* __builtin_popcount needs GCC, it counts the set bits... */ if (__builtin_popcount (usable) != 1) { /* TODO: this code is not yet tested as I have only single-mixer devices... */ - lt_info("%s: more than one mixer control: devmask %08x stereo %08x\n" + hal_info("%s: more than one mixer control: devmask %08x stereo %08x\n" "%s: querying MIX_NUMBER environment variable...\n", __func__, devmask, stereo, __func__); const char *tmp = getenv("MIX_NUMBER"); if (tmp) mixer_num = atoi(tmp); - lt_info("%s: mixer_num is %d -> device %08x\n", + hal_info("%s: mixer_num is %d -> device %08x\n", __func__, mixer_num, (mixer_num >= 0) ? (1 << mixer_num) : 0); /* no error checking, you'd better know what you are doing... */ } else { @@ -284,22 +284,22 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int little_endian) int cAudio::WriteClip(unsigned char *buffer, int size) { int ret; - // lt_debug("cAudio::%s\n", __FUNCTION__); + // hal_debug("cAudio::%s\n", __FUNCTION__); if (clipfd <= 0) { - lt_info("%s: clipfd not yet opened\n", __FUNCTION__); + hal_info("%s: clipfd not yet opened\n", __FUNCTION__); return -1; } ret = write(clipfd, buffer, size); if (ret < 0) - lt_info("%s: write error (%m)\n", __FUNCTION__); + hal_info("%s: write error (%m)\n", __FUNCTION__); return ret; }; int cAudio::StopClip() { - lt_debug("%s\n", __FUNCTION__); + hal_debug("%s\n", __FUNCTION__); if (clipfd <= 0) { - lt_info("%s: clipfd not yet opened\n", __FUNCTION__); + hal_info("%s: clipfd not yet opened\n", __FUNCTION__); return -1; } close(clipfd); @@ -313,7 +313,7 @@ int cAudio::StopClip() void cAudio::getAudioInfo(int &type, int &layer, int &freq, int &bitrate, int &mode) { - lt_debug("%s\n", __FUNCTION__); + hal_debug("%s\n", __FUNCTION__); type = 0; layer = 0; freq = 0; @@ -362,37 +362,37 @@ void cAudio::getAudioInfo(int &type, int &layer, int &freq, int &bitrate, int &m void cAudio::SetSRS(int /*iq_enable*/, int /*nmgr_enable*/, int /*iq_mode*/, int /*iq_level*/) { - lt_debug("%s\n", __FUNCTION__); + hal_debug("%s\n", __FUNCTION__); }; void cAudio::SetHdmiDD(bool enable) { - lt_debug("%s %d\n", __func__, enable); + hal_debug("%s %d\n", __func__, enable); }; void cAudio::SetSpdifDD(bool enable) { - lt_debug("%s %d\n", __func__, enable); + hal_debug("%s %d\n", __func__, enable); setBypassMode(!enable); }; void cAudio::ScheduleMute(bool On) { - lt_debug("%s %d\n", __FUNCTION__, On); + hal_debug("%s %d\n", __FUNCTION__, On); }; void cAudio::EnableAnalogOut(bool enable) { - lt_debug("%s %d\n", __FUNCTION__, enable); + hal_debug("%s %d\n", __FUNCTION__, enable); }; #define AUDIO_BYPASS_ON 0 #define AUDIO_BYPASS_OFF 1 void cAudio::setBypassMode(bool disable) { - lt_debug("%s %d\n", __func__, disable); + hal_debug("%s %d\n", __func__, disable); int mode = disable ? AUDIO_BYPASS_OFF : AUDIO_BYPASS_ON; if (ioctl(fd, AUDIO_SET_BYPASS_MODE, mode) < 0) - lt_info("%s AUDIO_SET_BYPASS_MODE %d: %m\n", __func__, mode); + hal_info("%s AUDIO_SET_BYPASS_MODE %d: %m\n", __func__, mode); return; } diff --git a/libazbox/dmx.cpp b/libazbox/dmx.cpp index a6ca5ed..2944cf8 100644 --- a/libazbox/dmx.cpp +++ b/libazbox/dmx.cpp @@ -32,18 +32,18 @@ #include #include #include "dmx_hal.h" -#include "lt_debug.h" +#include "hal_debug.h" #include "video_lib.h" /* needed for getSTC... */ extern cVideo *videoDecoder; -#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_DEMUX, this, args) -#define lt_info(args...) _lt_info(TRIPLE_DEBUG_DEMUX, this, args) -#define lt_info_c(args...) _lt_info(TRIPLE_DEBUG_DEMUX, NULL, args) +#define hal_debug(args...) _hal_debug(HAL_DEBUG_DEMUX, this, args) +#define hal_info(args...) _hal_info(HAL_DEBUG_DEMUX, this, args) +#define hal_info_c(args...) _hal_info(HAL_DEBUG_DEMUX, NULL, args) #define dmx_err(_errfmt, _errstr, _revents) do { \ - lt_info("%s " _errfmt " fd:%d, ev:0x%x %s pid:0x%04hx flt:0x%02hx\n", \ + hal_info("%s " _errfmt " fd:%d, ev:0x%x %s pid:0x%04hx flt:0x%02hx\n", \ __func__, _errstr, fd, _revents, DMX_T[dmx_type], pid, flt); \ } while(0); @@ -77,7 +77,7 @@ cDemux::cDemux(int n) { if (n < 0 || n > 2) { - lt_info("%s ERROR: n invalid (%d)\n", __FUNCTION__, n); + hal_info("%s ERROR: n invalid (%d)\n", __FUNCTION__, n); num = 0; } else @@ -87,7 +87,7 @@ cDemux::cDemux(int n) cDemux::~cDemux() { - lt_debug("%s #%d fd: %d\n", __FUNCTION__, num, fd); + hal_debug("%s #%d fd: %d\n", __FUNCTION__, num, fd); Close(); /* in zapit.cpp, videoDemux is deleted after videoDecoder * in the video watchdog, we access videoDecoder @@ -108,7 +108,7 @@ bool cDemux::Open(DMX_CHANNEL_TYPE pes_type, void * /*hVideoBuffer*/, int uBuffe int devnum = num; int flags = O_RDWR|O_CLOEXEC; if (fd > -1) - lt_info("%s FD ALREADY OPENED? fd = %d\n", __FUNCTION__, fd); + hal_info("%s FD ALREADY OPENED? fd = %d\n", __FUNCTION__, fd); if (pes_type != DMX_PSI_CHANNEL) flags |= O_NONBLOCK; @@ -116,28 +116,28 @@ bool cDemux::Open(DMX_CHANNEL_TYPE pes_type, void * /*hVideoBuffer*/, int uBuffe fd = open(devname[devnum], flags); if (fd < 0) { - lt_info("%s %s: %m\n", __FUNCTION__, devname[devnum]); + hal_info("%s %s: %m\n", __FUNCTION__, devname[devnum]); return false; } - lt_debug("%s #%d pes_type: %s(%d), uBufferSize: %d fd: %d\n", __func__, + hal_debug("%s #%d pes_type: %s(%d), uBufferSize: %d fd: %d\n", __func__, num, DMX_T[pes_type], pes_type, uBufferSize, fd); dmx_type = pes_type; #if 0 if (!pesfds.empty()) { - lt_info("%s ERROR! pesfds not empty!\n", __FUNCTION__); /* TODO: error handling */ + hal_info("%s ERROR! pesfds not empty!\n", __FUNCTION__); /* TODO: error handling */ return false; } int n = DMX_SOURCE_FRONT0; if (ioctl(fd, DMX_SET_SOURCE, &n) < 0) - lt_info("%s DMX_SET_SOURCE failed!\n", __func__); + hal_info("%s DMX_SET_SOURCE failed!\n", __func__); #endif if (uBufferSize > 0) { /* probably uBufferSize == 0 means "use default size". TODO: find a reasonable default */ if (ioctl(fd, DMX_SET_BUFFER_SIZE, uBufferSize) < 0) - lt_info("%s DMX_SET_BUFFER_SIZE failed (%m)\n", __func__); + hal_info("%s DMX_SET_BUFFER_SIZE failed (%m)\n", __func__); } buffersize = uBufferSize; @@ -146,10 +146,10 @@ bool cDemux::Open(DMX_CHANNEL_TYPE pes_type, void * /*hVideoBuffer*/, int uBuffe void cDemux::Close(void) { - lt_debug("%s #%d, fd = %d\n", __FUNCTION__, num, fd); + hal_debug("%s #%d, fd = %d\n", __FUNCTION__, num, fd); if (fd < 0) { - lt_info("%s #%d: not open!\n", __FUNCTION__, num); + hal_info("%s #%d: not open!\n", __FUNCTION__, num); return; } @@ -162,7 +162,7 @@ void cDemux::Close(void) dmx_tp_count--; if (dmx_tp_count < 0) { - lt_info("%s dmx_tp_count < 0!!\n", __func__); + hal_info("%s dmx_tp_count < 0!!\n", __func__); dmx_tp_count = 0; } } @@ -170,10 +170,10 @@ void cDemux::Close(void) bool cDemux::Start(bool) { - lt_debug("%s #%d fd: %d type: %s\n", __func__, num, fd, DMX_T[dmx_type]); + hal_debug("%s #%d fd: %d type: %s\n", __func__, num, fd, DMX_T[dmx_type]); if (fd < 0) { - lt_info("%s #%d: not open!\n", __FUNCTION__, num); + hal_info("%s #%d: not open!\n", __FUNCTION__, num); return false; } ioctl(fd, DMX_START); @@ -182,10 +182,10 @@ bool cDemux::Start(bool) bool cDemux::Stop(void) { - lt_debug("%s #%d fd: %d type: %s\n", __func__, num, fd, DMX_T[dmx_type]); + hal_debug("%s #%d fd: %d type: %s\n", __func__, num, fd, DMX_T[dmx_type]); if (fd < 0) { - lt_info("%s #%d: not open!\n", __FUNCTION__, num); + hal_info("%s #%d: not open!\n", __FUNCTION__, num); return false; } ioctl(fd, DMX_STOP); @@ -229,7 +229,7 @@ int cDemux::Read(unsigned char *buff, int len, int timeout) else if (rc < 0) { dmx_err("poll: %s,", strerror(errno), 0) - //lt_info("%s poll: %m\n", __FUNCTION__); + //hal_info("%s poll: %m\n", __FUNCTION__); /* happens, when running under gdb... */ if (errno == EINTR) goto retry; @@ -273,7 +273,7 @@ bool cDemux::sectionFilter(unsigned short _pid, const unsigned char * const filt if (len > DMX_FILTER_SIZE) { - lt_info("%s #%d: len too long: %d, DMX_FILTER_SIZE %d\n", __func__, num, len, DMX_FILTER_SIZE); + hal_info("%s #%d: len too long: %d, DMX_FILTER_SIZE %d\n", __func__, num, len, DMX_FILTER_SIZE); len = DMX_FILTER_SIZE; } s_flt.pid = pid; @@ -367,7 +367,7 @@ bool cDemux::sectionFilter(unsigned short _pid, const unsigned char * const filt if (timeout == 0 && negmask == NULL) s_flt.timeout = to; - lt_debug("%s #%d pid:0x%04hx fd:%d type:%s len:%d to:%d flags:%x flt[0]:%02x\n", __func__, num, + hal_debug("%s #%d pid:0x%04hx fd:%d type:%s len:%d to:%d flags:%x flt[0]:%02x\n", __func__, num, pid, fd, DMX_T[dmx_type], len, s_flt.timeout,s_flt.flags, s_flt.filter.filter[0]); #if 0 fprintf(stderr,"filt: ");for(int i=0;i= 0x0002 && pid <= 0x000f) || pid >= 0x1fff) return false; - lt_debug("%s #%d pid: 0x%04hx fd: %d type: %s\n", __FUNCTION__, num, pid, fd, DMX_T[dmx_type]); + hal_debug("%s #%d pid: 0x%04hx fd: %d type: %s\n", __FUNCTION__, num, pid, fd, DMX_T[dmx_type]); memset(&p_flt, 0, sizeof(p_flt)); p_flt.pid = pid; @@ -422,7 +422,7 @@ bool cDemux::pesFilter(const unsigned short _pid) p_flt.output = DMX_OUT_TSDEMUX_TAP; break; default: - lt_info("%s #%d invalid dmx_type %d!\n", __func__, num, dmx_type); + hal_info("%s #%d invalid dmx_type %d!\n", __func__, num, dmx_type); return false; } return (ioctl(fd, DMX_SET_PES_FILTER, &p_flt) >= 0); @@ -430,39 +430,39 @@ bool cDemux::pesFilter(const unsigned short _pid) void cDemux::SetSyncMode(AVSYNC_TYPE /*mode*/) { - lt_debug("%s #%d\n", __FUNCTION__, num); + hal_debug("%s #%d\n", __FUNCTION__, num); } void *cDemux::getBuffer() { - lt_debug("%s #%d\n", __FUNCTION__, num); + hal_debug("%s #%d\n", __FUNCTION__, num); return NULL; } void *cDemux::getChannel() { - lt_debug("%s #%d\n", __FUNCTION__, num); + hal_debug("%s #%d\n", __FUNCTION__, num); return NULL; } bool cDemux::addPid(unsigned short Pid) { - lt_debug("%s: pid 0x%04hx\n", __func__, Pid); + hal_debug("%s: pid 0x%04hx\n", __func__, Pid); pes_pids pfd; int ret; if (dmx_type != DMX_TP_CHANNEL) { - lt_info("%s pes_type %s not implemented yet! pid=%hx\n", __FUNCTION__, DMX_T[dmx_type], Pid); + hal_info("%s pes_type %s not implemented yet! pid=%hx\n", __FUNCTION__, DMX_T[dmx_type], Pid); return false; } if (fd == -1) - lt_info("%s bucketfd not yet opened? pid=%hx\n", __FUNCTION__, Pid); + hal_info("%s bucketfd not yet opened? pid=%hx\n", __FUNCTION__, Pid); pfd.fd = fd; /* dummy */ pfd.pid = Pid; pesfds.push_back(pfd); ret = (ioctl(fd, DMX_ADD_PID, &Pid)); if (ret < 0) - lt_info("%s: DMX_ADD_PID (%m)\n", __func__); + hal_info("%s: DMX_ADD_PID (%m)\n", __func__); return (ret != -1); } @@ -470,27 +470,27 @@ void cDemux::removePid(unsigned short Pid) { if (dmx_type != DMX_TP_CHANNEL) { - lt_info("%s pes_type %s not implemented yet! pid=%hx\n", __FUNCTION__, DMX_T[dmx_type], Pid); + hal_info("%s pes_type %s not implemented yet! pid=%hx\n", __FUNCTION__, DMX_T[dmx_type], Pid); return; } for (std::vector::iterator i = pesfds.begin(); i != pesfds.end(); ++i) { if ((*i).pid == Pid) { - lt_debug("removePid: removing demux fd %d pid 0x%04x\n", fd, Pid); + hal_debug("removePid: removing demux fd %d pid 0x%04x\n", fd, Pid); if (ioctl(fd, DMX_REMOVE_PID, Pid) < 0) - lt_info("%s: (DMX_REMOVE_PID, 0x%04hx): %m\n", __func__, Pid); + hal_info("%s: (DMX_REMOVE_PID, 0x%04hx): %m\n", __func__, Pid); pesfds.erase(i); return; /* TODO: what if the same PID is there multiple times */ } } - lt_info("%s pid 0x%04x not found\n", __FUNCTION__, Pid); + hal_info("%s pid 0x%04x not found\n", __FUNCTION__, Pid); } void cDemux::getSTC(int64_t * STC) { /* apparently I can only get the PTS of the video decoder, * but that's good enough for dvbsub */ - lt_debug("%s #%d\n", __func__, num); + hal_debug("%s #%d\n", __func__, num); int64_t pts = 0; if (videoDecoder) pts = videoDecoder->GetPTS(); @@ -499,7 +499,7 @@ void cDemux::getSTC(int64_t * STC) int cDemux::getUnit(void) { - lt_debug("%s #%d\n", __FUNCTION__, num); + hal_debug("%s #%d\n", __FUNCTION__, num); /* just guessed that this is the right thing to do. right now this is only used by the CA code which is stubbed out anyway */ @@ -508,12 +508,12 @@ int cDemux::getUnit(void) bool cDemux::SetSource(int unit, int source) { - lt_info_c("%s(%d, %d): not implemented yet\n", __func__, unit, source); + hal_info_c("%s(%d, %d): not implemented yet\n", __func__, unit, source); return true; } int cDemux::GetSource(int unit) { - lt_info_c("%s(%d): not implemented yet\n", __func__, unit); + hal_info_c("%s(%d): not implemented yet\n", __func__, unit); return 0; } diff --git a/libazbox/init.cpp b/libazbox/init.cpp index 7c930f1..1f6cce7 100644 --- a/libazbox/init.cpp +++ b/libazbox/init.cpp @@ -2,22 +2,22 @@ #include "init.h" -#include "lt_debug.h" -#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_INIT, NULL, args) -#define lt_info(args...) _lt_info(TRIPLE_DEBUG_INIT, NULL, args) +#include "hal_debug.h" +#define hal_debug(args...) _hal_debug(HAL_DEBUG_INIT, NULL, args) +#define hal_info(args...) _hal_info(HAL_DEBUG_INIT, NULL, args) static bool initialized = false; void init_td_api() { if (!initialized) - lt_debug_init(); - lt_info("%s begin, initialized=%d, debug=0x%02x\n", __func__, (int)initialized, debuglevel); + hal_debug_init(); + hal_info("%s begin, initialized=%d, debug=0x%02x\n", __func__, (int)initialized, debuglevel); initialized = true; } void shutdown_td_api() { - lt_info("%s, initialized = %d\n", __func__, (int)initialized); + hal_info("%s, initialized = %d\n", __func__, (int)initialized); initialized = false; } diff --git a/libazbox/playback.cpp b/libazbox/playback.cpp index c387c6f..5ebf0ca 100644 --- a/libazbox/playback.cpp +++ b/libazbox/playback.cpp @@ -38,10 +38,10 @@ #include #include -#include "lt_debug.h" -#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_PLAYBACK, this, args) -#define lt_info(args...) _lt_info(TRIPLE_DEBUG_PLAYBACK, this, args) -#define lt_info_c(args...) _lt_info(TRIPLE_DEBUG_PLAYBACK, NULL, args) +#include "hal_debug.h" +#define hal_debug(args...) _hal_debug(HAL_DEBUG_PLAYBACK, this, args) +#define hal_info(args...) _hal_info(HAL_DEBUG_PLAYBACK, this, args) +#define hal_info_c(args...) _hal_info(HAL_DEBUG_PLAYBACK, NULL, args) #include @@ -76,7 +76,7 @@ static time_t monotonic_ms(void) /* the mutex makes sure that commands are not interspersed */ bool cPlayback::rmfp_command(int cmd, int param, bool has_param, char *buf, int buflen) { - lt_info("%s: %d %d %d %d\n", __func__, cmd, param, has_param, buflen); + hal_info("%s: %d %d %d %d\n", __func__, cmd, param, has_param, buflen); bool ret = true; int fd; if (cmd == 222) @@ -101,7 +101,7 @@ bool cPlayback::rmfp_command(int cmd, int param, bool has_param, char *buf, int { while ((fd = open(OUT_FILE, O_RDONLY)) == -1) { if (++m > 500) { /* don't wait more than 5 seconds */ - lt_info("%s: timed out waiting for %s (cmd %d par %d buflen %d\n", + hal_info("%s: timed out waiting for %s (cmd %d par %d buflen %d\n", __func__, OUT_FILE, cmd, param, buflen); ret = false; goto out; @@ -131,7 +131,7 @@ bool cPlayback::rmfp_command(int cmd, int param, bool has_param, char *buf, int out: pthread_mutex_unlock(&rmfp_cmd_mutex); if (cmd != 222) /* called tooo often :-) */ - lt_info("%s: reply: '%s' ret: %d m:%d\n", __func__, buf?buf:"(none)", ret, m); + hal_info("%s: reply: '%s' ret: %d m:%d\n", __func__, buf?buf:"(none)", ret, m); return ret; } @@ -143,7 +143,7 @@ bool cPlayback::rmfp_command(int cmd, int param, bool has_param, char *buf, int */ void cPlayback::run_rmfp() { - lt_debug("%s: starting\n", __func__); + hal_debug("%s: starting\n", __func__); thread_started = true; //Watch for the space at the end std::string base = "rmfp_player -dram 1 -ve 1 -waitexit "; @@ -163,7 +163,7 @@ void cPlayback::run_rmfp() pid = forkpty(&master, NULL, NULL, NULL); if (! pid) { execl("/bin/sh", "sh", "-c", final.c_str(), (char *)0); - lt_info("%s: execl returned: %m\n", __func__); + hal_info("%s: execl returned: %m\n", __func__); exit(0); } @@ -181,17 +181,17 @@ void cPlayback::run_rmfp() break; output[len] = '\0'; } - lt_info("%s out: '%s'\n", __func__, output); + hal_info("%s out: '%s'\n", __func__, output); if (strstr(output, "Playback has started...")) { playing = 1; - lt_info("%s: ===================> playing = true\n", __func__); + hal_info("%s: ===================> playing = true\n", __func__); } else if (strstr(output, "End of file...")) { playing = 1; /* this can happen without "Playback has started..." */ eof_reached = true; - lt_info("%s: ===================> eof_reached = true\n", __func__); + hal_info("%s: ===================> eof_reached = true\n", __func__); } } fclose(f); @@ -201,7 +201,7 @@ void cPlayback::run_rmfp() free(output); } - lt_info("%s: terminating\n", __func__); + hal_info("%s: terminating\n", __func__); if (playing == 0) /* playback did not start */ playing = 2; else @@ -214,7 +214,7 @@ void cPlayback::run_rmfp() void *execute_rua_thread(void *c) { cPlayback *obj = (cPlayback *)c; - lt_info_c("%s\n", __func__); + hal_info_c("%s\n", __func__); obj->run_rmfp(); /* free(obj); // this is most likely wrong */ @@ -231,11 +231,11 @@ bool cPlayback::Open(playmode_t PlayMode) playMode = PlayMode; if (playMode > 1) { - lt_info("%s: PlayMode %d out of range!\n", __func__, PlayMode); + hal_info("%s: PlayMode %d out of range!\n", __func__, PlayMode); playMode = PLAYMODE_FILE; } - lt_info("%s: mode %d (%s)\n", __func__, PlayMode, aPLAYMODE[PlayMode]); + hal_info("%s: mode %d (%s)\n", __func__, PlayMode, aPLAYMODE[PlayMode]); #if 0 while (access("/tmp/continue", R_OK)) sleep(1); @@ -252,7 +252,7 @@ bool cPlayback::Open(playmode_t PlayMode) i++; if (i > 10) { - lt_info("%s: ERROR - player is not idle after 10 seconds!\n", __func__); + hal_info("%s: ERROR - player is not idle after 10 seconds!\n", __func__); open_success = false; return false; } @@ -260,7 +260,7 @@ bool cPlayback::Open(playmode_t PlayMode) } proc_put("/proc/player", "2", 2); - lt_info("%s: /proc/player switched to '2'\n", __func__); + hal_info("%s: /proc/player switched to '2'\n", __func__); unlink(CMD_FILE); unlink(IN_FILE); @@ -276,8 +276,8 @@ bool cPlayback::Start(char *filename, unsigned short vpid, int vtype, unsigned s { bool ret = true; - lt_info("%s: filename=%s\n", __func__, filename); - lt_info("%s: vpid=%u vtype=%d apid=%u ac3=%d duration=%i open_success=%d\n", + hal_info("%s: filename=%s\n", __func__, filename); + hal_info("%s: vpid=%u vtype=%d apid=%u ac3=%d duration=%i open_success=%d\n", __func__, vpid, vtype, _apid, ac3, duration, open_success); if (!open_success) @@ -291,7 +291,7 @@ bool cPlayback::Start(char *filename, unsigned short vpid, int vtype, unsigned s mduration = duration; if (pthread_create(&thread, 0, execute_rua_thread, this) != 0) { - lt_info("%s: error creating rmfp_player thread! (out of memory?)\n", __func__); + hal_info("%s: error creating rmfp_player thread! (out of memory?)\n", __func__); ret = false; } while (! playing) @@ -303,32 +303,32 @@ bool cPlayback::Start(char *filename, unsigned short vpid, int vtype, unsigned s void cPlayback::Close(void) { - lt_info("%s: playing %d thread_started %d\n", __func__, playing, thread_started); + hal_info("%s: playing %d thread_started %d\n", __func__, playing, thread_started); if (thread_started) { rmfp_command(KEY_COMMAND_QUIT_ALL, 0, false, NULL, 0); if (pthread_join(thread, NULL)) - lt_info("%s: error joining rmfp thread (%m)\n", __func__); + hal_info("%s: error joining rmfp thread (%m)\n", __func__); playing = 0; thread_started = false; } else - lt_info("%s: Warning: thread_started == false!\n", __func__); + hal_info("%s: Warning: thread_started == false!\n", __func__); if (open_success) { proc_put("/proc/player", "1", 2); open_success = false; - lt_info("%s: /proc/player switched to '1'\n", __func__); + hal_info("%s: /proc/player switched to '1'\n", __func__); usleep(1000000); } } bool cPlayback::SetAPid(unsigned short pid, int /*ac3*/) { - lt_info("%s: pid %i\n", __func__, pid); + hal_info("%s: pid %i\n", __func__, pid); if (pid != apid) { rmfp_command(KEY_COMMAND_SWITCH_AUDIO, pid, true, NULL, 0); apid = pid; @@ -338,7 +338,7 @@ bool cPlayback::SetAPid(unsigned short pid, int /*ac3*/) bool cPlayback::SelectSubtitles(int pid) { - lt_info("%s: pid %i\n", __func__, pid); + hal_info("%s: pid %i\n", __func__, pid); if (pid != subpid) { rmfp_command(KEY_COMMAND_SWITCH_SUBS, pid, true, NULL, 0); @@ -349,7 +349,7 @@ bool cPlayback::SelectSubtitles(int pid) bool cPlayback::SetSpeed(int speed) { - lt_info("%s: playing %d speed %d\n", __func__, playing, speed); + hal_info("%s: playing %d speed %d\n", __func__, playing, speed); if (!playing) return false; @@ -369,7 +369,7 @@ bool cPlayback::SetSpeed(int speed) bool cPlayback::GetSpeed(int &/*speed*/) const { #if 0 - lt_info("%s:\n", __func__); + hal_info("%s:\n", __func__); speed = playback_speed; #endif return true; @@ -378,7 +378,7 @@ bool cPlayback::GetSpeed(int &/*speed*/) const // in milliseconds bool cPlayback::GetPosition(int &position, int &duration) { - lt_debug("%s: playing %d\n", __func__, playing); + hal_debug("%s: playing %d\n", __func__, playing); if (eof_reached) { @@ -416,7 +416,7 @@ bool cPlayback::GetPosition(int &position, int &duration) bool cPlayback::SetPosition(int position, bool absolute) { - lt_info("%s: pos %d abs %d playing %d\n", __func__, position, absolute, playing); + hal_info("%s: pos %d abs %d playing %d\n", __func__, position, absolute, playing); if (!playing) return false; @@ -438,7 +438,7 @@ bool cPlayback::SetPosition(int position, bool absolute) void cPlayback::FindAllPids(uint16_t *apids, unsigned short *ac3flags, uint16_t *numpida, std::string *language) { - lt_info("%s\n", __func__); + hal_info("%s\n", __func__); char buf[32]; rmfp_command(CUSTOM_COMMAND_AUDIO_COUNT, 0, false, buf, 3); unsigned int audio_count = atoi(buf); @@ -459,14 +459,14 @@ void cPlayback::FindAllPids(uint16_t *apids, unsigned short *ac3flags, uint16_t apids[aid] = atoi(streamidstring); ac3flags[aid] = 0; language[aid] = audio_lang; - lt_info("%s: #%d apid:%d lang: %s\n", __func__, aid, apids[aid], audio_lang); + hal_info("%s: #%d apid:%d lang: %s\n", __func__, aid, apids[aid], audio_lang); } } } void cPlayback::FindAllSubs(uint16_t *spids, unsigned short *supported, uint16_t *numpids, std::string *language) { - lt_info("%s\n", __func__); + hal_info("%s\n", __func__); char buf[32]; rmfp_command(CUSTOM_COMMAND_SUBS_COUNT, 0, false, buf, 3); @@ -488,7 +488,7 @@ void cPlayback::FindAllSubs(uint16_t *spids, unsigned short *supported, uint16_t spids[sid] = atoi(streamidstring); language[sid] = spu_lang; supported[sid] = 1; - lt_info("%s: #%d apid:%d lang: %s\n", __func__, sid, spids[sid], spu_lang); + hal_info("%s: #%d apid:%d lang: %s\n", __func__, sid, spids[sid], spu_lang); } } //Add streamid -1 to be able to disable subtitles @@ -506,7 +506,7 @@ void cPlayback::GetChapters(std::vector &positions, std::vector= 0) { \ if ((_r = ::cmd(fd, args)) < 0) \ - lt_info(#cmd"(fd, "#args")\n"); \ + hal_info(#cmd"(fd, "#args")\n"); \ else \ - lt_debug(#cmd"(fd, "#args")\n");\ + hal_debug(#cmd"(fd, "#args")\n");\ } \ else { _r = fd; } \ _r; \ @@ -76,7 +76,7 @@ static void show_iframe(int fd, unsigned char *iframe, size_t st_size); cVideo::cVideo(int, void *, void *, unsigned int) { - lt_debug("%s\n", __FUNCTION__); + hal_debug("%s\n", __FUNCTION__); //croppingMode = VID_DISPMODE_NORM; //outputformat = VID_OUTFMT_RGBC_SVIDEO; @@ -92,7 +92,7 @@ cVideo::cVideo(int, void *, void *, unsigned int) blank_size = 0; blankfd = open(blankname, O_RDONLY|O_CLOEXEC); if (blankfd < 0) - lt_info("%s cannot open %s: %m", __func__, blankname); + hal_info("%s cannot open %s: %m", __func__, blankname); else { if (fstat(blankfd, &st) != -1 && st.st_size > 0) @@ -100,10 +100,10 @@ cVideo::cVideo(int, void *, void *, unsigned int) blank_size = st.st_size; blank_data = (unsigned char *)malloc(blank_size); if (! blank_data) - lt_info("%s malloc failed (%m)\n", __func__); + hal_info("%s malloc failed (%m)\n", __func__); else if (read(blankfd, blank_data, blank_size) != blank_size) { - lt_info("%s short read (%m)\n", __func__); + hal_info("%s short read (%m)\n", __func__); free(blank_data); /* don't leak... */ blank_data = NULL; } @@ -124,7 +124,7 @@ cVideo::~cVideo(void) void cVideo::openDevice(void) { int n = 0; - lt_debug("%s\n", __func__); + hal_debug("%s\n", __func__); /* todo: this fd checking is racy, should be protected by a lock */ if (fd != -1) /* already open */ return; @@ -138,14 +138,14 @@ retry: if (++n < 10) goto retry; } - lt_info("%s cannot open %s: %m, retries %d\n", __func__, VIDEO_DEVICE, n); + hal_info("%s cannot open %s: %m, retries %d\n", __func__, VIDEO_DEVICE, n); } playstate = VIDEO_STOPPED; } void cVideo::closeDevice(void) { - lt_debug("%s\n", __func__); + hal_debug("%s\n", __func__); if (fd >= 0) close(fd); fd = -1; @@ -160,22 +160,22 @@ int cVideo::setAspectRatio(int aspect, int mode) int n; int mo = (mode < 0||mode > 3) ? 4 : mode; - lt_debug("%s: a:%d m:%d %s\n", __func__, aspect, mode, m[(mo]); + hal_debug("%s: a:%d m:%d %s\n", __func__, aspect, mode, m[(mo]); if (aspect > 3 || aspect == 0) - lt_info("%s: invalid aspect: %d\n", __func__, aspect); + hal_info("%s: invalid aspect: %d\n", __func__, aspect); else if (aspect > 0) /* -1 == don't set */ { - lt_debug("%s: /proc/stb/video/aspect -> %s\n", __func__, a[aspect]); + hal_debug("%s: /proc/stb/video/aspect -> %s\n", __func__, a[aspect]); n = proc_put("/proc/stb/video/aspect", a[aspect], strlen(a[aspect])); if (n < 0) - lt_info("%s: proc_put /proc/stb/video/aspect (%m)\n", __func__); + hal_info("%s: proc_put /proc/stb/video/aspect (%m)\n", __func__); } if (mode == -1) return 0; - lt_debug("%s: /proc/scalingmode -> %s\n", __func__, m[mo]); + hal_debug("%s: /proc/scalingmode -> %s\n", __func__, m[mo]); n = proc_put("/proc/scalingmode", m[mo], strlen(m[mo])); if (n < 0) return 1; @@ -193,10 +193,10 @@ int cVideo::getAspectRatio(void) } if (fop(ioctl, VIDEO_GET_SIZE, &s) < 0) { - lt_info("%s: VIDEO_GET_SIZE %m\n", __func__); + hal_info("%s: VIDEO_GET_SIZE %m\n", __func__); return -1; } - lt_debug("%s: %d\n", __func__, s.aspect_ratio); + hal_debug("%s: %d\n", __func__, s.aspect_ratio); return s.aspect_ratio * 2 + 1; } @@ -211,14 +211,14 @@ int cVideo::setCroppingMode(int /*vidDispMode_t format*/) f = format_string[format]; else f = "ILLEGAL format!"; - lt_debug("%s(%d) => %s\n", __FUNCTION__, format, f); + hal_debug("%s(%d) => %s\n", __FUNCTION__, format, f); return fop(ioctl, MPEG_VID_SET_DISPMODE, format); #endif } int cVideo::Start(void * /*PcrChannel*/, unsigned short /*PcrPid*/, unsigned short /*VideoPid*/, void * /*hChannel*/) { - lt_debug("%s playstate=%d\n", __FUNCTION__, playstate); + hal_debug("%s playstate=%d\n", __FUNCTION__, playstate); #if 0 if (playstate == VIDEO_PLAYING) return 0; @@ -231,10 +231,10 @@ int cVideo::Start(void * /*PcrChannel*/, unsigned short /*PcrPid*/, unsigned sho int cVideo::Stop(bool blank) { - lt_debug("%s(%d)\n", __FUNCTION__, blank); + hal_debug("%s(%d)\n", __FUNCTION__, blank); if (stillpicture) { - lt_debug("%s: stillpicture == true\n", __func__); + hal_debug("%s: stillpicture == true\n", __func__); return -1; } /* blank parameter seems to not work on VIDEO_STOP */ @@ -255,7 +255,7 @@ int cVideo::setBlank(int) int cVideo::SetVideoSystem(int video_system, bool remember) { - lt_debug("%s(%d, %d)\n", __func__, video_system, remember); + hal_debug("%s(%d, %d)\n", __func__, video_system, remember); char current[32]; static const char *modes[] = { "480i", // VIDEO_STD_NTSC @@ -276,16 +276,16 @@ int cVideo::SetVideoSystem(int video_system, bool remember) if (video_system > VIDEO_STD_MAX) { - lt_info("%s: video_system (%d) > VIDEO_STD_MAX (%d)\n", __func__, video_system, VIDEO_STD_MAX); + hal_info("%s: video_system (%d) > VIDEO_STD_MAX (%d)\n", __func__, video_system, VIDEO_STD_MAX); return -1; } int ret = proc_get("/proc/stb/video/videomode", current, 32); if (strcmp(current, modes[video_system]) == 0) { - lt_info("%s: video_system %d (%s) already set, skipping\n", __func__, video_system, current); + hal_info("%s: video_system %d (%s) already set, skipping\n", __func__, video_system, current); return 0; } - lt_info("%s: old: '%s' new: '%s'\n", __func__, current, modes[video_system]); + hal_info("%s: old: '%s' new: '%s'\n", __func__, current, modes[video_system]); ret = proc_put("/proc/stb/video/videomode", modes[video_system],strlen(modes[video_system])); return ret; @@ -298,10 +298,10 @@ int cVideo::getPlayState(void) void cVideo::SetVideoMode(analog_mode_t mode) { - lt_debug("%s(%d)\n", __func__, mode); + hal_debug("%s(%d)\n", __func__, mode); if (!(mode & ANALOG_SCART_MASK)) { - lt_debug("%s: non-SCART mode ignored\n", __func__); + hal_debug("%s: non-SCART mode ignored\n", __func__); return; } const char *m; @@ -314,7 +314,7 @@ void cVideo::SetVideoMode(analog_mode_t mode) m = "rgb"; break; default: - lt_info("%s unknown mode %d\n", __func__, mode); + hal_info("%s unknown mode %d\n", __func__, mode); m = "rgb"; break; /* default to rgb */ } @@ -323,7 +323,7 @@ void cVideo::SetVideoMode(analog_mode_t mode) void cVideo::ShowPicture(const char * fname) { - lt_debug("%s(%s)\n", __func__, fname); + hal_debug("%s(%s)\n", __func__, fname); char destname[512]; char cmd[512]; char *p; @@ -333,18 +333,18 @@ void cVideo::ShowPicture(const char * fname) if (video_standby) { /* does not work and the driver does not seem to like it */ - lt_info("%s: video_standby == true\n", __func__); + hal_info("%s: video_standby == true\n", __func__); return; } if (fd < 0) { - lt_info("%s: decoder not opened?\n", __func__); + hal_info("%s: decoder not opened?\n", __func__); return; } strcpy(destname, "/var/cache"); if (stat(fname, &st2)) { - lt_info("%s: could not stat %s (%m)\n", __func__, fname); + hal_info("%s: could not stat %s (%m)\n", __func__, fname); return; } mkdir(destname, 0755); @@ -379,7 +379,7 @@ void cVideo::ShowPicture(const char * fname) mfd = open(destname, O_RDONLY|O_CLOEXEC); if (mfd < 0) { - lt_info("%s cannot open %s: %m", __func__, destname); + hal_info("%s cannot open %s: %m", __func__, destname); goto out; } fstat(mfd, &st); @@ -389,7 +389,7 @@ void cVideo::ShowPicture(const char * fname) iframe = (unsigned char *)malloc(st.st_size); if (! iframe) { - lt_info("%s: malloc failed (%m)\n", __func__); + hal_info("%s: malloc failed (%m)\n", __func__); goto out; } read(mfd, iframe, st.st_size); @@ -403,13 +403,13 @@ void cVideo::ShowPicture(const char * fname) void cVideo::StopPicture() { - lt_debug("%s\n", __func__); + hal_debug("%s\n", __func__); stillpicture = false; } void cVideo::Standby(unsigned int bOn) { - lt_debug("%s(%d)\n", __func__, bOn); + hal_debug("%s(%d)\n", __func__, bOn); if (bOn) { closeDevice(); @@ -426,7 +426,7 @@ void cVideo::Standby(unsigned int bOn) int cVideo::getBlank(void) { int ret = proc_get_hex("/proc/stb/vmpeg/0/xres"); - lt_debug("%s => %d\n", __func__, !ret); + hal_debug("%s => %d\n", __func__, !ret); return !ret; } @@ -442,7 +442,7 @@ void cVideo::VideoParamWatchdog(void) ioctl(fd, MPEG_VID_GET_V_INFO_RAW, &v_info); if (_v_info != v_info) { - lt_debug("%s params changed. old: %08x new: %08x\n", __FUNCTION__, _v_info, v_info); + hal_debug("%s params changed. old: %08x new: %08x\n", __FUNCTION__, _v_info, v_info); setAspectRatio(-1, -1); } _v_info = v_info; @@ -457,7 +457,7 @@ void cVideo::Pig(int x, int y, int w, int h, int osd_w, int osd_h) * TODO: check this in the driver sources */ int xres = 720; /* proc_get_hex("/proc/stb/vmpeg/0/xres") */ int yres = 576; /* proc_get_hex("/proc/stb/vmpeg/0/yres") */ - lt_debug("%s: x:%d y:%d w:%d h:%d ow:%d oh:%d\n", __func__, x, y, w, h, osd_w, osd_h); + hal_debug("%s: x:%d y:%d w:%d h:%d ow:%d oh:%d\n", __func__, x, y, w, h, osd_w, osd_h); if (x == -1 && y == -1 && w == -1 && h == -1) { _w = xres; @@ -472,7 +472,7 @@ void cVideo::Pig(int x, int y, int w, int h, int osd_w, int osd_h) _y = y * yres / osd_h; _h = h * yres / osd_h; } - lt_debug("%s: x:%d y:%d w:%d h:%d xr:%d yr:%d\n", __func__, _x, _y, _w, _h, xres, yres); + hal_debug("%s: x:%d y:%d w:%d h:%d xr:%d yr:%d\n", __func__, _x, _y, _w, _h, xres, yres); sprintf(buffer, "%x", _x); proc_put("/proc/stb/vmpeg/0/dst_left", buffer, strlen(buffer)); sprintf(buffer, "%x", _y); @@ -528,12 +528,12 @@ void cVideo::getPictureInfo(int &width, int &height, int &rate) rate = rate2csapi(r); height = s.h; width = s.w; - lt_debug("%s: rate: %d, width: %d height: %d\n", __func__, rate, width, height); + hal_debug("%s: rate: %d, width: %d height: %d\n", __func__, rate, width, height); } void cVideo::SetSyncMode(AVSYNC_TYPE mode) { - lt_debug("%s %d\n", __func__, mode); + hal_debug("%s %d\n", __func__, mode); /* * { 0, LOCALE_OPTIONS_OFF }, * { 1, LOCALE_OPTIONS_ON }, @@ -566,7 +566,7 @@ int cVideo::SetStreamType(VIDEO_FORMAT type) "VIDEO_FORMAT_PNG" }; int t; - lt_debug("%s type=%s\n", __FUNCTION__, VF[type]); + hal_debug("%s type=%s\n", __FUNCTION__, VF[type]); switch (type) { @@ -583,7 +583,7 @@ int cVideo::SetStreamType(VIDEO_FORMAT type) } if (ioctl(fd, VIDEO_SET_STREAMTYPE, t) < 0) - lt_info("%s VIDEO_SET_STREAMTYPE(%d) failed: %m\n", __func__, t); + hal_info("%s VIDEO_SET_STREAMTYPE(%d) failed: %m\n", __func__, t); return 0; } @@ -591,7 +591,7 @@ int64_t cVideo::GetPTS(void) { int64_t pts = 0; if (ioctl(fd, VIDEO_GET_PTS, &pts) < 0) - lt_info("%s: GET_PTS failed (%m)\n", __func__); + hal_info("%s: GET_PTS failed (%m)\n", __func__); return pts; } @@ -604,7 +604,7 @@ static void show_iframe(int fd, unsigned char *iframe, size_t st_size) size_t pos = 0; int count = 7; if (ioctl(fd, VIDEO_SET_FORMAT, VIDEO_FORMAT_16_9) < 0) - lt_info_c("%s: VIDEO_SET_FORMAT failed (%m)\n", __func__); + hal_info_c("%s: VIDEO_SET_FORMAT failed (%m)\n", __func__); ioctl(fd, VIDEO_SET_STREAMTYPE, VIDEO_FORMAT_MPEG2); ioctl(fd, VIDEO_SELECT_SOURCE, VIDEO_SOURCE_MEMORY); ioctl(fd, VIDEO_PLAY); @@ -633,5 +633,5 @@ static void show_iframe(int fd, unsigned char *iframe, size_t st_size) void cVideo::SetDemux(cDemux *) { - lt_debug("%s: not implemented yet\n", __func__); + hal_debug("%s: not implemented yet\n", __func__); } diff --git a/libduckbox/init.cpp b/libduckbox/init.cpp index 3abc241..738bd46 100644 --- a/libduckbox/init.cpp +++ b/libduckbox/init.cpp @@ -13,17 +13,17 @@ #include "init.h" #include "pwrmngr.h" -#include "lt_debug.h" -#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_INIT, NULL, args) -#define lt_info(args...) _lt_info(TRIPLE_DEBUG_INIT, NULL, args) +#include "hal_debug.h" +#define hal_debug(args...) _hal_debug(HAL_DEBUG_INIT, NULL, args) +#define hal_info(args...) _hal_info(HAL_DEBUG_INIT, NULL, args) static bool initialized = false; void init_td_api() { if (!initialized) - lt_debug_init(); - lt_info("%s begin, initialized=%d, debug=0x%02x\n", __FUNCTION__, (int)initialized, debuglevel); + hal_debug_init(); + hal_info("%s begin, initialized=%d, debug=0x%02x\n", __FUNCTION__, (int)initialized, debuglevel); if (!initialized) { /* this is a strange hack: the drivers seem to only work correctly after @@ -31,7 +31,7 @@ void init_td_api() struct dmx_pes_filter_params p; int dmx = open("/dev/dvb/adapter0/demux0", O_RDWR|O_CLOEXEC); if (dmx < 0) - lt_info("%s: ERROR open /dev/dvb/adapter0/demux0 (%m)\n", __func__); + hal_info("%s: ERROR open /dev/dvb/adapter0/demux0 (%m)\n", __func__); else { memset(&p, 0, sizeof(p)); @@ -45,11 +45,11 @@ void init_td_api() } } initialized = true; - lt_info("%s end\n", __FUNCTION__); + hal_info("%s end\n", __FUNCTION__); } void shutdown_td_api() { - lt_info("%s, initialized = %d\n", __FUNCTION__, (int)initialized); + hal_info("%s, initialized = %d\n", __FUNCTION__, (int)initialized); initialized = false; } diff --git a/libgeneric-pc/audio.cpp b/libgeneric-pc/audio.cpp index e3ea30a..ce13a9b 100644 --- a/libgeneric-pc/audio.cpp +++ b/libgeneric-pc/audio.cpp @@ -24,10 +24,10 @@ #include "audio_lib.h" #include "dmx_hal.h" -#include "lt_debug.h" +#include "hal_debug.h" -#define lt_debug(args...) _lt_debug(HAL_DEBUG_AUDIO, this, args) -#define lt_info(args...) _lt_info(HAL_DEBUG_AUDIO, this, args) +#define hal_debug(args...) _hal_debug(HAL_DEBUG_AUDIO, this, args) +#define hal_info(args...) _hal_info(HAL_DEBUG_AUDIO, this, args) #include @@ -81,44 +81,44 @@ cAudio::~cAudio(void) void cAudio::openDevice(void) { - lt_debug("%s\n", __func__); + hal_debug("%s\n", __func__); } void cAudio::closeDevice(void) { - lt_debug("%s\n", __func__); + hal_debug("%s\n", __func__); } int cAudio::do_mute(bool enable, bool remember) { - lt_debug("%s(%d, %d)\n", __func__, enable, remember); + hal_debug("%s(%d, %d)\n", __func__, enable, remember); return 0; } int cAudio::setVolume(unsigned int left, unsigned int right) { - lt_debug("%s(%d, %d)\n", __func__, left, right); + hal_debug("%s(%d, %d)\n", __func__, left, right); return 0; } int cAudio::Start(void) { - lt_debug("%s >\n", __func__); + hal_debug("%s >\n", __func__); if (! HAL_nodec) OpenThreads::Thread::start(); - lt_debug("%s <\n", __func__); + hal_debug("%s <\n", __func__); return 0; } int cAudio::Stop(void) { - lt_debug("%s >\n", __func__); + hal_debug("%s >\n", __func__); if (thread_started) { thread_started = false; OpenThreads::Thread::join(); } - lt_debug("%s <\n", __func__); + hal_debug("%s <\n", __func__); return 0; } @@ -129,12 +129,12 @@ bool cAudio::Pause(bool /*Pcm*/) void cAudio::SetSyncMode(AVSYNC_TYPE Mode) { - lt_debug("%s %d\n", __func__, Mode); + hal_debug("%s %d\n", __func__, Mode); }; void cAudio::SetStreamType(AUDIO_FORMAT type) { - lt_debug("%s %d\n", __func__, type); + hal_debug("%s %d\n", __func__, type); }; int cAudio::setChannel(int /*channel*/) @@ -144,7 +144,7 @@ int cAudio::setChannel(int /*channel*/) int cAudio::PrepareClipPlay(int ch, int srate, int bits, int le) { - lt_debug("%s ch %d srate %d bits %d le %d adevice %p\n", __func__, ch, srate, bits, le, adevice);; + hal_debug("%s ch %d srate %d bits %d le %d adevice %p\n", __func__, ch, srate, bits, le, adevice);; int driver; int byte_format = le ? AO_FMT_LITTLE : AO_FMT_BIG; if (sformat.bits != bits || sformat.channels != ch || sformat.rate != srate || @@ -160,9 +160,9 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int le) ao_close(adevice); adevice = ao_open_live(driver, &sformat, NULL); ao_info *ai = ao_driver_info(driver); - lt_info("%s: changed params ch %d srate %d bits %d le %d adevice %p\n", + hal_info("%s: changed params ch %d srate %d bits %d le %d adevice %p\n", __func__, ch, srate, bits, le, adevice);; - lt_info("libao driver: %d name '%s' short '%s' author '%s'\n", + hal_info("libao driver: %d name '%s' short '%s' author '%s'\n", driver, ai->name, ai->short_name, ai->author); } return 0; @@ -170,9 +170,9 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int le) int cAudio::WriteClip(unsigned char *buffer, int size) { - lt_debug("cAudio::%s buf 0x%p size %d\n", __func__, buffer, size); + hal_debug("cAudio::%s buf 0x%p size %d\n", __func__, buffer, size); if (!adevice) { - lt_info("%s: adevice not opened?\n", __func__); + hal_info("%s: adevice not opened?\n", __func__); return 0; } ao_play(adevice, (char *)buffer, size); @@ -181,12 +181,12 @@ int cAudio::WriteClip(unsigned char *buffer, int size) int cAudio::StopClip() { - lt_debug("%s\n", __func__); + hal_debug("%s\n", __func__); #if 0 /* don't do anything - closing / reopening ao all the time makes for long delays * reinit on-demand (e.g. for changed parameters) instead */ if (!adevice) { - lt_info("%s: adevice not opened?\n", __func__); + hal_info("%s: adevice not opened?\n", __func__); return 0; } ao_close(adevice); @@ -261,43 +261,43 @@ void cAudio::getAudioInfo(int &type, int &layer, int &freq, int &bitrate, int &m mode = 7; // "L/C/R/SL/SR" break; default: - lt_info("%s: unknown ch_layout 0x%" PRIx64 "\n", + hal_info("%s: unknown ch_layout 0x%" PRIx64 "\n", __func__, c->channel_layout); } } } - lt_debug("%s t: %d l: %d f: %d b: %d m: %d codec_id: %x\n", + hal_debug("%s t: %d l: %d f: %d b: %d m: %d codec_id: %x\n", __func__, type, layer, freq, bitrate, mode, c?c->codec_id:-1); }; void cAudio::SetSRS(int /*iq_enable*/, int /*nmgr_enable*/, int /*iq_mode*/, int /*iq_level*/) { - lt_debug("%s\n", __func__); + hal_debug("%s\n", __func__); }; void cAudio::SetHdmiDD(bool enable) { - lt_debug("%s %d\n", __func__, enable); + hal_debug("%s %d\n", __func__, enable); }; void cAudio::SetSpdifDD(bool enable) { - lt_debug("%s %d\n", __func__, enable); + hal_debug("%s %d\n", __func__, enable); }; void cAudio::ScheduleMute(bool On) { - lt_debug("%s %d\n", __func__, On); + hal_debug("%s %d\n", __func__, On); }; void cAudio::EnableAnalogOut(bool enable) { - lt_debug("%s %d\n", __func__, enable); + hal_debug("%s %d\n", __func__, enable); }; void cAudio::setBypassMode(bool disable) { - lt_debug("%s %d\n", __func__, disable); + hal_debug("%s %d\n", __func__, disable); } static int _my_read(void *, uint8_t *buf, int buf_size) @@ -319,7 +319,7 @@ int cAudio::my_read(uint8_t *buf, int buf_size) } if (bufpos == 0) return 0; - //lt_info("%s buf_size %d bufpos %d th %d tmp %d\n", __func__, buf_size, bufpos, thread_started, tmp); + //hal_info("%s buf_size %d bufpos %d th %d tmp %d\n", __func__, buf_size, bufpos, thread_started, tmp); if (bufpos > buf_size) { memcpy(buf, dmxbuf, buf_size); memmove(dmxbuf, dmxbuf + buf_size, bufpos - buf_size); @@ -334,7 +334,7 @@ int cAudio::my_read(uint8_t *buf, int buf_size) void cAudio::run() { - lt_info("====================== start decoder thread ================================\n"); + hal_info("====================== start decoder thread ================================\n"); /* libavcodec & friends */ av_register_all(); @@ -374,35 +374,35 @@ void cAudio::run() thread_started = true; if (avformat_open_input(&avfc, NULL, inp, NULL) < 0) { - lt_info("%s: avformat_open_input() failed.\n", __func__); + hal_info("%s: avformat_open_input() failed.\n", __func__); goto out; } ret = avformat_find_stream_info(avfc, NULL); - lt_debug("%s: avformat_find_stream_info: %d\n", __func__, ret); + hal_debug("%s: avformat_find_stream_info: %d\n", __func__, ret); if (avfc->nb_streams != 1) { - lt_info("%s: nb_streams: %d, should be 1!\n", __func__, avfc->nb_streams); + hal_info("%s: nb_streams: %d, should be 1!\n", __func__, avfc->nb_streams); goto out; } p = avfc->streams[0]->codecpar; if (p->codec_type != AVMEDIA_TYPE_AUDIO) - lt_info("%s: stream 0 no audio codec? 0x%x\n", __func__, p->codec_type); + hal_info("%s: stream 0 no audio codec? 0x%x\n", __func__, p->codec_type); codec = avcodec_find_decoder(p->codec_id); if (!codec) { - lt_info("%s: Codec for %s not found\n", __func__, avcodec_get_name(p->codec_id)); + hal_info("%s: Codec for %s not found\n", __func__, avcodec_get_name(p->codec_id)); goto out; } if (c) av_free(c); c = avcodec_alloc_context3(codec); if (avcodec_open2(c, codec, NULL) < 0) { - lt_info("%s: avcodec_open2() failed\n", __func__); + hal_info("%s: avcodec_open2() failed\n", __func__); goto out; } frame = av_frame_alloc(); if (!frame) { - lt_info("%s: av_frame_alloc failed\n", __func__); + hal_info("%s: av_frame_alloc failed\n", __func__); goto out2; } /* output sample rate, channels, layout could be set here if necessary */ @@ -422,27 +422,27 @@ void cAudio::run() ao_close(adevice); 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", + hal_info("%s: changed params ch %d srate %d bits %d adevice %p\n", __func__, o_ch, o_sr, 16, adevice); if(ai) - lt_info("libao driver: %d name '%s' short '%s' author '%s'\n", + hal_info("libao driver: %d name '%s' short '%s' author '%s'\n", driver, ai->name, ai->short_name, ai->author); } #if 0 - lt_info(" driver options:"); + hal_info(" driver options:"); for (int i = 0; i < ai->option_count; ++i) fprintf(stderr, " %s", ai->options[i]); fprintf(stderr, "\n"); #endif av_get_sample_fmt_string(tmp, sizeof(tmp), c->sample_fmt); - lt_info("decoding %s, sample_fmt %d (%s) sample_rate %d channels %d\n", + hal_info("decoding %s, sample_fmt %d (%s) sample_rate %d channels %d\n", avcodec_get_name(p->codec_id), c->sample_fmt, tmp, p->sample_rate, p->channels); swr = swr_alloc_set_opts(swr, o_layout, AV_SAMPLE_FMT_S16, o_sr, /* output */ p->channel_layout, c->sample_fmt, p->sample_rate, /* input */ 0, NULL); if (! swr) { - lt_info("could not alloc resample context\n"); + hal_info("could not alloc resample context\n"); goto out3; } swr_init(swr); @@ -456,11 +456,11 @@ void cAudio::run() obuf_sz = av_rescale_rnd(swr_get_delay(swr, p->sample_rate) + frame->nb_samples, o_sr, p->sample_rate, AV_ROUND_UP); if (obuf_sz > obuf_sz_max) { - lt_info("obuf_sz: %d old: %d\n", obuf_sz, obuf_sz_max); + hal_info("obuf_sz: %d old: %d\n", obuf_sz, obuf_sz_max); av_free(obuf); if (av_samples_alloc(&obuf, &out_linesize, o_ch, frame->nb_samples, AV_SAMPLE_FMT_S16, 1) < 0) { - lt_info("av_samples_alloc failed\n"); + hal_info("av_samples_alloc failed\n"); av_packet_unref(&avpkt); break; /* while (thread_started) */ } @@ -469,7 +469,7 @@ void cAudio::run() obuf_sz = swr_convert(swr, &obuf, obuf_sz, (const uint8_t **)frame->extended_data, frame->nb_samples); curr_pts = av_frame_get_best_effort_timestamp(frame); - lt_debug("%s: pts 0x%" PRIx64 " %3f\n", __func__, curr_pts, curr_pts/90000.0); + hal_debug("%s: pts 0x%" PRIx64 " %3f\n", __func__, curr_pts, curr_pts/90000.0); int o_buf_sz = av_samples_get_buffer_size(&out_linesize, o_ch, obuf_sz, AV_SAMPLE_FMT_S16, 1); ao_play(adevice, (char *)obuf, o_buf_sz); @@ -489,5 +489,5 @@ void cAudio::run() avformat_close_input(&avfc); av_free(pIOCtx->buffer); av_free(pIOCtx); - lt_info("======================== end decoder thread ================================\n"); + hal_info("======================== end decoder thread ================================\n"); } diff --git a/libgeneric-pc/clutterfb.cpp b/libgeneric-pc/clutterfb.cpp index 2c61def..1d5e2fb 100644 --- a/libgeneric-pc/clutterfb.cpp +++ b/libgeneric-pc/clutterfb.cpp @@ -44,12 +44,12 @@ #include -#include "lt_debug.h" +#include "hal_debug.h" -#define lt_debug_c(args...) _lt_debug(HAL_DEBUG_INIT, NULL, args) -#define lt_info_c(args...) _lt_info(HAL_DEBUG_INIT, NULL, args) -#define lt_debug(args...) _lt_debug(HAL_DEBUG_INIT, this, args) -#define lt_info(args...) _lt_info(HAL_DEBUG_INIT, this, args) +#define hal_debug_c(args...) _hal_debug(HAL_DEBUG_INIT, NULL, args) +#define hal_info_c(args...) _hal_info(HAL_DEBUG_INIT, NULL, args) +#define hal_debug(args...) _hal_debug(HAL_DEBUG_INIT, this, args) +#define hal_info(args...) _hal_info(HAL_DEBUG_INIT, this, args) extern VDec *vdec; @@ -123,7 +123,7 @@ GLFbPC::GLFbPC(int x, int y, std::vector &buf): mReInit(true), mS mkfifo("/tmp/neutrino.input", 0600); input_fd = open("/tmp/neutrino.input", O_RDWR|O_CLOEXEC|O_NONBLOCK); if (input_fd < 0) - lt_info("%s: could not open /tmp/neutrino.input FIFO: %m\n", __func__); + hal_info("%s: could not open /tmp/neutrino.input FIFO: %m\n", __func__); initKeys(); } @@ -193,12 +193,12 @@ void GLFramebuffer::run() char **argv = (char **)malloc(sizeof(char *) * 2); argv[0] = a; argv[1] = NULL; - lt_info("GLFB: GL thread starting x %d y %d\n", x, y); + hal_info("GLFB: GL thread starting x %d y %d\n", x, y); if (clutter_init(&argc, &argv) != CLUTTER_INIT_SUCCESS) { - lt_info("GLFB: error initializing clutter\n"); + hal_info("GLFB: error initializing clutter\n"); return; } - lt_info("GLFB: %s:%d\n", __func__, __LINE__); + hal_info("GLFB: %s:%d\n", __func__, __LINE__); ClutterColor stage_color = { 0, 0, 0, 255 }; stage = clutter_stage_new(); clutter_actor_set_size(stage, x, y); @@ -214,14 +214,14 @@ void GLFramebuffer::run() /* 32bit FB depth, *2 because tuxtxt uses a shadow buffer */ int fbmem = x * y * 4 * 2; osd_buf.resize(fbmem); - lt_info("GLFB: OSD buffer set to %d bytes at 0x%p\n", fbmem, osd_buf.data()); + hal_info("GLFB: OSD buffer set to %d bytes at 0x%p\n", fbmem, osd_buf.data()); /* video plane is below FB plane, so it comes first */ vid_actor = clutter_actor_new(); ClutterContent *fb = clutter_image_new(); /* osd_buf, because it starts up black */ if (!clutter_image_set_data(CLUTTER_IMAGE(fb), osd_buf.data(), COGL_PIXEL_FORMAT_BGR_888, x, y, x*3, NULL)) { - lt_info("GLFB::%s clutter_image_set_data failed? (vid)\n", __func__); + hal_info("GLFB::%s clutter_image_set_data failed? (vid)\n", __func__); _exit(1); /* life is hard */ } clutter_actor_set_content(vid_actor, fb); @@ -240,7 +240,7 @@ void GLFramebuffer::run() fb_actor = clutter_actor_new(); fb = clutter_image_new(); if (!clutter_image_set_data(CLUTTER_IMAGE(fb), osd_buf.data(), COGL_PIXEL_FORMAT_BGRA_8888, x, y, x*4, NULL)) { - lt_info("GLFB::%s clutter_image_set_data failed? (osd)\n", __func__); + hal_info("GLFB::%s clutter_image_set_data failed? (osd)\n", __func__); _exit(1); /* life is hard */ } clutter_actor_set_content(fb_actor, fb); @@ -261,7 +261,7 @@ void GLFramebuffer::run() clutter_timeline_set_repeat_count(tl, -1); clutter_timeline_start(tl); clutter_main(); - lt_info("GLFB: GL thread stopping\n"); + hal_info("GLFB: GL thread stopping\n"); } /* static */ void GLFbPC::rendercb() @@ -273,12 +273,12 @@ void GLFramebuffer::run() { guint key = clutter_event_get_key_symbol (event); int keystate = user_data ? 1 : 0; - lt_info_c("GLFB::%s: 0x%x, %d\n", __func__, key, keystate); + hal_info_c("GLFB::%s: 0x%x, %d\n", __func__, key, keystate); struct input_event ev; if (key == 'f' && keystate) { - lt_info_c("GLFB::%s: toggle fullscreen %s\n", __func__, glfb_priv->mFullscreen?"off":"on"); + hal_info_c("GLFB::%s: toggle fullscreen %s\n", __func__, glfb_priv->mFullscreen?"off":"on"); glfb_priv->mFullscreen = !(glfb_priv->mFullscreen); glfb_priv->mReInit = true; return true; @@ -290,7 +290,7 @@ void GLFramebuffer::run() ev.value = keystate; /* key own */ ev.type = EV_KEY; gettimeofday(&ev.time, NULL); - lt_debug_c("GLFB::%s: pushing 0x%x\n", __func__, ev.code); + hal_debug_c("GLFB::%s: pushing 0x%x\n", __func__, ev.code); write(glfb_priv->input_fd, &ev, sizeof(ev)); return true; } @@ -323,7 +323,7 @@ void GLFbPC::render() // *mX = *mY * mOA.num / mOA.den; clutter_actor_set_size(stage, *mX, *mY); } - lt_info("%s: reinit mX:%d mY:%d xoff:%d yoff:%d fs %d\n", + hal_info("%s: reinit mX:%d mY:%d xoff:%d yoff:%d fs %d\n", __func__, *mX, *mY, xoff, yoff, mFullscreen); } mReInitLock.unlock(); @@ -332,7 +332,7 @@ void GLFbPC::render() if (mState.blit) { /* only blit manually after fb->blit(), this helps to find missed blit() calls */ mState.blit = false; - lt_debug("GLFB::%s blit!\n", __func__); + hal_debug("GLFB::%s blit!\n", __func__); bltOSDBuffer(); /* OSD */ } @@ -348,10 +348,10 @@ void GLFbPC::render() default: case INT_MIN: /* invalid */ case 0: /* identical */ - lt_debug("%s: mVA == mOA (or fullscreen mode :-)\n", __func__); + hal_debug("%s: mVA == mOA (or fullscreen mode :-)\n", __func__); break; case 1: /* mVA > mOA -- video is wider than display */ - lt_debug("%s: mVA > mOA\n", __func__); + hal_debug("%s: mVA > mOA\n", __func__); switch (mCrop) { case DISPLAY_AR_MODE_PANSCAN: zoom = av_q2d(mVA) / av_q2d(mOA); @@ -370,7 +370,7 @@ void GLFbPC::render() } break; case -1: /* mVA < mOA -- video is taller than display */ - lt_debug("%s: mVA < mOA\n", __func__); + hal_debug("%s: mVA < mOA\n", __func__); switch (mCrop) { case DISPLAY_AR_MODE_LETTERBOX: break; @@ -391,7 +391,7 @@ void GLFbPC::render() } break; } - lt_debug("zoom: %f xscale: %f xzoom: %f\n", zoom, xscale,xzoom); + hal_debug("zoom: %f xscale: %f xzoom: %f\n", zoom, xscale,xzoom); clutter_actor_set_scale(vid_actor, xscale*zoom*xzoom, zoom); } clutter_timeline_stop(tl); @@ -401,12 +401,12 @@ void GLFbPC::render() void GLFbPC::bltOSDBuffer() { - // lt_info("%s\n", __func__); + // hal_info("%s\n", __func__); int x = glfb_priv->mState.width; int y = glfb_priv->mState.height; ClutterContent *fb = clutter_image_new(); if (!clutter_image_set_data(CLUTTER_IMAGE(fb), osd_buf->data(), COGL_PIXEL_FORMAT_BGRA_8888, x, y, x*4, NULL)) { - lt_info("GLFB::%s clutter_image_set_data failed?\n", __func__); + hal_info("GLFB::%s clutter_image_set_data failed?\n", __func__); _exit(1); /* life is hard */ } clutter_actor_set_content(fb_actor, fb); @@ -416,14 +416,14 @@ void GLFbPC::bltOSDBuffer() void GLFbPC::bltDisplayBuffer() { - // lt_info("GLFB::%s vdec: %p\n", __func__, vdec); + // hal_info("GLFB::%s vdec: %p\n", __func__, vdec); if (!vdec) /* cannot start yet */ return; static bool warn = true; VDec::SWFramebuffer *buf = vdec->getDecBuf(); if (!buf) { if (warn) - lt_info("GLFB::%s did not get a buffer...\n", __func__); + hal_info("GLFB::%s did not get a buffer...\n", __func__); warn = false; return; } @@ -445,7 +445,7 @@ void GLFbPC::bltDisplayBuffer() ClutterContent *fb = clutter_image_new(); if (!clutter_image_set_data(CLUTTER_IMAGE(fb), &(*buf)[0], COGL_PIXEL_FORMAT_BGR_888, w, h, w*3, NULL)) { - lt_info("GLFB::%s clutter_image_set_data failed?\n", __func__); + hal_info("GLFB::%s clutter_image_set_data failed?\n", __func__); _exit(1); /* life is hard */ } clutter_actor_set_content(vid_actor, fb); @@ -476,6 +476,6 @@ void GLFbPC::bltDisplayBuffer() else if (sleep_us < 1) sleep_us = 1; } - lt_debug("vpts: 0x%" PRIx64 " apts: 0x%" PRIx64 " diff: %6.3f sleep_us %d buf %d\n", + hal_debug("vpts: 0x%" PRIx64 " apts: 0x%" PRIx64 " diff: %6.3f sleep_us %d buf %d\n", buf->pts(), apts, (buf->pts() - apts)/90000.0, sleep_us, vdec->buf_num); } diff --git a/libgeneric-pc/dmx.cpp b/libgeneric-pc/dmx.cpp index 769a971..60f02c1 100644 --- a/libgeneric-pc/dmx.cpp +++ b/libgeneric-pc/dmx.cpp @@ -33,18 +33,18 @@ #include #include #include "dmx_hal.h" -#include "lt_debug.h" +#include "hal_debug.h" #include "video_lib.h" /* needed for getSTC... */ extern cVideo *videoDecoder; -#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_DEMUX, this, args) -#define lt_info(args...) _lt_info(TRIPLE_DEBUG_DEMUX, this, args) -#define lt_info_c(args...) _lt_info(TRIPLE_DEBUG_DEMUX, NULL, args) +#define hal_debug(args...) _hal_debug(HAL_DEBUG_DEMUX, this, args) +#define hal_info(args...) _hal_info(HAL_DEBUG_DEMUX, this, args) +#define hal_info_c(args...) _hal_info(HAL_DEBUG_DEMUX, NULL, args) #define dmx_err(_errfmt, _errstr, _revents) do { \ - lt_info("%s " _errfmt " fd:%d, ev:0x%x %s pid:0x%04hx flt:0x%02hx\n", \ + hal_info("%s " _errfmt " fd:%d, ev:0x%x %s pid:0x%04hx flt:0x%02hx\n", \ __func__, _errstr, fd, _revents, DMX_T[dmx_type], pid, flt); \ } while(0); @@ -80,7 +80,7 @@ cDemux::cDemux(int n) { if (n < 0 || n > 2) { - lt_info("%s ERROR: n invalid (%d)\n", __FUNCTION__, n); + hal_info("%s ERROR: n invalid (%d)\n", __FUNCTION__, n); num = 0; } else @@ -90,7 +90,7 @@ cDemux::cDemux(int n) cDemux::~cDemux() { - lt_debug("%s #%d fd: %d\n", __FUNCTION__, num, fd); + hal_debug("%s #%d fd: %d\n", __FUNCTION__, num, fd); Close(); } @@ -99,7 +99,7 @@ bool cDemux::Open(DMX_CHANNEL_TYPE pes_type, void * /*hVideoBuffer*/, int uBuffe int devnum = num; int flags = O_RDWR|O_CLOEXEC; if (fd > -1) - lt_info("%s FD ALREADY OPENED? fd = %d\n", __FUNCTION__, fd); + hal_info("%s FD ALREADY OPENED? fd = %d\n", __FUNCTION__, fd); dmx_type = pes_type; if (pes_type != DMX_PSI_CHANNEL) @@ -108,10 +108,10 @@ bool cDemux::Open(DMX_CHANNEL_TYPE pes_type, void * /*hVideoBuffer*/, int uBuffe fd = open(devname[devnum], flags); if (fd < 0) { - lt_info("%s %s: %m\n", __FUNCTION__, devname[devnum]); + hal_info("%s %s: %m\n", __FUNCTION__, devname[devnum]); return false; } - lt_debug("%s #%d pes_type: %s(%d), uBufferSize: %d fd: %d\n", __func__, + hal_debug("%s #%d pes_type: %s(%d), uBufferSize: %d fd: %d\n", __func__, num, DMX_T[pes_type], pes_type, uBufferSize, fd); if (dmx_type == DMX_VIDEO_CHANNEL) @@ -121,18 +121,18 @@ bool cDemux::Open(DMX_CHANNEL_TYPE pes_type, void * /*hVideoBuffer*/, int uBuffe #if 0 if (!pesfds.empty()) { - lt_info("%s ERROR! pesfds not empty!\n", __FUNCTION__); /* TODO: error handling */ + hal_info("%s ERROR! pesfds not empty!\n", __FUNCTION__); /* TODO: error handling */ return false; } int n = DMX_SOURCE_FRONT0; if (ioctl(fd, DMX_SET_SOURCE, &n) < 0) - lt_info("%s DMX_SET_SOURCE %d failed! (%m)\n", __func__, n); + hal_info("%s DMX_SET_SOURCE %d failed! (%m)\n", __func__, n); #endif if (uBufferSize > 0) { /* probably uBufferSize == 0 means "use default size". TODO: find a reasonable default */ if (ioctl(fd, DMX_SET_BUFFER_SIZE, uBufferSize) < 0) - lt_info("%s DMX_SET_BUFFER_SIZE failed (%m)\n", __func__); + hal_info("%s DMX_SET_BUFFER_SIZE failed (%m)\n", __func__); } buffersize = uBufferSize; @@ -141,10 +141,10 @@ bool cDemux::Open(DMX_CHANNEL_TYPE pes_type, void * /*hVideoBuffer*/, int uBuffe void cDemux::Close(void) { - lt_debug("%s #%d, fd = %d\n", __FUNCTION__, num, fd); + hal_debug("%s #%d, fd = %d\n", __FUNCTION__, num, fd); if (fd < 0) { - lt_info("%s #%d: not open!\n", __FUNCTION__, num); + hal_info("%s #%d: not open!\n", __FUNCTION__, num); return; } pesfds.clear(); @@ -156,7 +156,7 @@ void cDemux::Close(void) dmx_tp_count--; if (dmx_tp_count < 0) { - lt_info("%s dmx_tp_count < 0!!\n", __func__); + hal_info("%s dmx_tp_count < 0!!\n", __func__); dmx_tp_count = 0; } } @@ -164,10 +164,10 @@ void cDemux::Close(void) bool cDemux::Start(bool) { - lt_debug("%s #%d fd: %d type: %s\n", __func__, num, fd, DMX_T[dmx_type]); + hal_debug("%s #%d fd: %d type: %s\n", __func__, num, fd, DMX_T[dmx_type]); if (fd < 0) { - lt_info("%s #%d: not open!\n", __FUNCTION__, num); + hal_info("%s #%d: not open!\n", __FUNCTION__, num); return false; } ioctl(fd, DMX_START); @@ -176,10 +176,10 @@ bool cDemux::Start(bool) bool cDemux::Stop(void) { - lt_debug("%s #%d fd: %d type: %s\n", __func__, num, fd, DMX_T[dmx_type]); + hal_debug("%s #%d fd: %d type: %s\n", __func__, num, fd, DMX_T[dmx_type]); if (fd < 0) { - lt_info("%s #%d: not open!\n", __FUNCTION__, num); + hal_info("%s #%d: not open!\n", __FUNCTION__, num); return false; } ioctl(fd, DMX_STOP); @@ -208,7 +208,7 @@ int cDemux::Read(unsigned char *buff, int len, int timeout) else if (rc < 0) { dmx_err("poll: %s,", strerror(errno), 0) - //lt_info("%s poll: %m\n", __FUNCTION__); + //hal_info("%s poll: %m\n", __FUNCTION__); /* happens, when running under gdb... */ if (errno == EINTR) goto retry; @@ -252,7 +252,7 @@ bool cDemux::sectionFilter(unsigned short _pid, const unsigned char * const filt if (len > DMX_FILTER_SIZE) { - lt_info("%s #%d: len too long: %d, DMX_FILTER_SIZE %d\n", __func__, num, len, DMX_FILTER_SIZE); + hal_info("%s #%d: len too long: %d, DMX_FILTER_SIZE %d\n", __func__, num, len, DMX_FILTER_SIZE); len = DMX_FILTER_SIZE; } s_flt.pid = pid; @@ -344,7 +344,7 @@ bool cDemux::sectionFilter(unsigned short _pid, const unsigned char * const filt if (timeout == 0 && negmask == NULL) s_flt.timeout = to; - lt_debug("%s #%d pid:0x%04hx fd:%d type:%s len:%d to:%d flags:%x flt[0]:%02x\n", __func__, num, + hal_debug("%s #%d pid:0x%04hx fd:%d type:%s len:%d to:%d flags:%x flt[0]:%02x\n", __func__, num, pid, fd, DMX_T[dmx_type], len, s_flt.timeout,s_flt.flags, s_flt.filter.filter[0]); #if 0 fprintf(stderr,"filt: ");for(int i=0;i= 0x0002 && pid <= 0x000f) || pid >= 0x1fff) return false; - lt_debug("%s #%d pid: 0x%04hx fd: %d type: %s\n", __FUNCTION__, num, pid, fd, DMX_T[dmx_type]); + hal_debug("%s #%d pid: 0x%04hx fd: %d type: %s\n", __FUNCTION__, num, pid, fd, DMX_T[dmx_type]); memset(&p_flt, 0, sizeof(p_flt)); p_flt.pid = pid; @@ -406,7 +406,7 @@ bool cDemux::pesFilter(const unsigned short _pid) p_flt.output = DMX_OUT_TSDEMUX_TAP; break; default: - lt_info("%s #%d invalid dmx_type %d!\n", __func__, num, dmx_type); + hal_info("%s #%d invalid dmx_type %d!\n", __func__, num, dmx_type); return false; } return (ioctl(fd, DMX_SET_PES_FILTER, &p_flt) >= 0); @@ -414,39 +414,39 @@ bool cDemux::pesFilter(const unsigned short _pid) void cDemux::SetSyncMode(AVSYNC_TYPE /*mode*/) { - lt_debug("%s #%d\n", __FUNCTION__, num); + hal_debug("%s #%d\n", __FUNCTION__, num); } void *cDemux::getBuffer() { - lt_debug("%s #%d\n", __FUNCTION__, num); + hal_debug("%s #%d\n", __FUNCTION__, num); return NULL; } void *cDemux::getChannel() { - lt_debug("%s #%d\n", __FUNCTION__, num); + hal_debug("%s #%d\n", __FUNCTION__, num); return NULL; } bool cDemux::addPid(unsigned short Pid) { - lt_debug("%s: pid 0x%04hx\n", __func__, Pid); + hal_debug("%s: pid 0x%04hx\n", __func__, Pid); pes_pids pfd; int ret; if (dmx_type != DMX_TP_CHANNEL) { - lt_info("%s pes_type %s not implemented yet! pid=%hx\n", __FUNCTION__, DMX_T[dmx_type], Pid); + hal_info("%s pes_type %s not implemented yet! pid=%hx\n", __FUNCTION__, DMX_T[dmx_type], Pid); return false; } if (fd == -1) - lt_info("%s bucketfd not yet opened? pid=%hx\n", __FUNCTION__, Pid); + hal_info("%s bucketfd not yet opened? pid=%hx\n", __FUNCTION__, Pid); pfd.fd = fd; /* dummy */ pfd.pid = Pid; pesfds.push_back(pfd); ret = (ioctl(fd, DMX_ADD_PID, &Pid)); if (ret < 0) - lt_info("%s: DMX_ADD_PID (%m)\n", __func__); + hal_info("%s: DMX_ADD_PID (%m)\n", __func__); return (ret != -1); } @@ -454,20 +454,20 @@ void cDemux::removePid(unsigned short Pid) { if (dmx_type != DMX_TP_CHANNEL) { - lt_info("%s pes_type %s not implemented yet! pid=%hx\n", __FUNCTION__, DMX_T[dmx_type], Pid); + hal_info("%s pes_type %s not implemented yet! pid=%hx\n", __FUNCTION__, DMX_T[dmx_type], Pid); return; } for (std::vector::iterator i = pesfds.begin(); i != pesfds.end(); ++i) { if ((*i).pid == Pid) { - lt_debug("removePid: removing demux fd %d pid 0x%04x\n", fd, Pid); + hal_debug("removePid: removing demux fd %d pid 0x%04x\n", fd, Pid); if (ioctl(fd, DMX_REMOVE_PID, Pid) < 0) - lt_info("%s: (DMX_REMOVE_PID, 0x%04hx): %m\n", __func__, Pid); + hal_info("%s: (DMX_REMOVE_PID, 0x%04hx): %m\n", __func__, Pid); pesfds.erase(i); return; /* TODO: what if the same PID is there multiple times */ } } - lt_info("%s pid 0x%04x not found\n", __FUNCTION__, Pid); + hal_info("%s pid 0x%04x not found\n", __FUNCTION__, Pid); } void cDemux::getSTC(int64_t * STC) @@ -480,7 +480,7 @@ void cDemux::getSTC(int64_t * STC) int cDemux::getUnit(void) { - lt_debug("%s #%d\n", __FUNCTION__, num); + hal_debug("%s #%d\n", __FUNCTION__, num); /* just guessed that this is the right thing to do. right now this is only used by the CA code which is stubbed out anyway */ @@ -489,12 +489,12 @@ int cDemux::getUnit(void) bool cDemux::SetSource(int unit, int source) { - lt_info_c("%s(%d, %d): not implemented yet\n", __func__, unit, source); + hal_info_c("%s(%d, %d): not implemented yet\n", __func__, unit, source); return true; } int cDemux::GetSource(int unit) { - lt_info_c("%s(%d): not implemented yet\n", __func__, unit); + hal_info_c("%s(%d): not implemented yet\n", __func__, unit); return 0; } diff --git a/libgeneric-pc/glfb.cpp b/libgeneric-pc/glfb.cpp index 19d1f29..2ce0fc8 100644 --- a/libgeneric-pc/glfb.cpp +++ b/libgeneric-pc/glfb.cpp @@ -42,12 +42,12 @@ #include "video_lib.h" #include "audio_lib.h" -#include "lt_debug.h" +#include "hal_debug.h" -#define lt_debug_c(args...) _lt_debug(HAL_DEBUG_INIT, NULL, args) -#define lt_info_c(args...) _lt_info(HAL_DEBUG_INIT, NULL, args) -#define lt_debug(args...) _lt_debug(HAL_DEBUG_INIT, this, args) -#define lt_info(args...) _lt_info(HAL_DEBUG_INIT, this, args) +#define hal_debug_c(args...) _hal_debug(HAL_DEBUG_INIT, NULL, args) +#define hal_info_c(args...) _hal_info(HAL_DEBUG_INIT, NULL, args) +#define hal_debug(args...) _hal_debug(HAL_DEBUG_INIT, this, args) +#define hal_info(args...) _hal_info(HAL_DEBUG_INIT, this, args) extern cVideo *videoDecoder; @@ -121,7 +121,7 @@ GLFbPC::GLFbPC(int x, int y, std::vector &buf): mReInit(true), mS mkfifo("/tmp/neutrino.input", 0600); input_fd = open("/tmp/neutrino.input", O_RDWR|O_CLOEXEC|O_NONBLOCK); if (input_fd < 0) - lt_info("%s: could not open /tmp/neutrino.input FIFO: %m\n", __func__); + hal_info("%s: could not open /tmp/neutrino.input FIFO: %m\n", __func__); initKeys(); } @@ -208,7 +208,7 @@ void GLFramebuffer::run() int y = glfb_priv->mState.height; /* some dummy commandline for GLUT to be happy */ char const *argv[2] = { "neutrino", 0 }; - lt_info("GLFB: GL thread starting x %d y %d\n", x, y); + hal_info("GLFB: GL thread starting x %d y %d\n", x, y); glutInit(&argc, const_cast(argv)); glutInitWindowSize(x, y); glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH); @@ -216,7 +216,7 @@ void GLFramebuffer::run() /* 32bit FB depth, *2 because tuxtxt uses a shadow buffer */ int fbmem = x * y * 4 * 2; osd_buf.resize(fbmem); - lt_info("GLFB: OSD buffer set to %d bytes at 0x%p\n", fbmem, osd_buf.data()); + hal_info("GLFB: OSD buffer set to %d bytes at 0x%p\n", fbmem, osd_buf.data()); glfb_priv->mInitDone = true; /* signal that setup is finished */ /* init the good stuff */ @@ -225,9 +225,9 @@ void GLFramebuffer::run() { if((!GLEW_VERSION_1_5)||(!GLEW_EXT_pixel_buffer_object)||(!GLEW_ARB_texture_non_power_of_two)) { - lt_info("GLFB: Sorry, your graphics card is not supported. " + hal_info("GLFB: Sorry, your graphics card is not supported. " "Needs at least OpenGL 1.5, pixel buffer objects and NPOT textures.\n"); - lt_info("incompatible graphics card: %m"); + hal_info("incompatible graphics card: %m"); _exit(1); /* Life is hard */ } else @@ -244,8 +244,8 @@ void GLFramebuffer::run() } } else - lt_info("GLFB: error initializing glew: %d\n", err); - lt_info("GLFB: GL thread stopping\n"); + hal_info("GLFB: error initializing glew: %d\n", err); + hal_info("GLFB: GL thread stopping\n"); } #if 0 @@ -254,7 +254,7 @@ void GLFbPC::setupCtx() int argc = 1; /* some dummy commandline for GLUT to be happy */ char const *argv[2] = { "neutrino", 0 }; - lt_info("GLFB: GL thread starting x %d y %d\n", mX[0], mY[0]); + hal_info("GLFB: GL thread starting x %d y %d\n", mX[0], mY[0]); glutInit(&argc, const_cast(argv)); glutInitWindowSize(mX[0], mY[0]); glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH); @@ -271,7 +271,7 @@ void GLFbPC::setupOSDBuffer() /* 32bit FB depth, *2 because tuxtxt uses a shadow buffer */ int fbmem = mState.width * mState.height * 4 * 2; osd_buf->resize(fbmem); - lt_info("GLFB: OSD buffer set to %d bytes at 0x%p\n", fbmem, osd_buf->data()); + hal_info("GLFB: OSD buffer set to %d bytes at 0x%p\n", fbmem, osd_buf->data()); } } #endif @@ -321,11 +321,11 @@ void GLFbPC::releaseGLObjects() /* static */ void GLFbPC::keyboardcb(unsigned char key, int /*x*/, int /*y*/) { - lt_debug_c("GLFB::%s: 0x%x\n", __func__, key); + hal_debug_c("GLFB::%s: 0x%x\n", __func__, key); struct input_event ev; if (key == 'f') { - lt_info_c("GLFB::%s: toggle fullscreen %s\n", __func__, glfb_priv->mFullscreen?"off":"on"); + hal_info_c("GLFB::%s: toggle fullscreen %s\n", __func__, glfb_priv->mFullscreen?"off":"on"); glfb_priv->mFullscreen = !(glfb_priv->mFullscreen); glfb_priv->mReInit = true; return; @@ -337,7 +337,7 @@ void GLFbPC::releaseGLObjects() ev.value = 1; /* key own */ ev.type = EV_KEY; gettimeofday(&ev.time, NULL); - lt_debug_c("GLFB::%s: pushing 0x%x\n", __func__, ev.code); + hal_debug_c("GLFB::%s: pushing 0x%x\n", __func__, ev.code); write(glfb_priv->input_fd, &ev, sizeof(ev)); ev.value = 0; /* neutrino is stupid, so push key up directly after key down */ write(glfb_priv->input_fd, &ev, sizeof(ev)); @@ -345,7 +345,7 @@ void GLFbPC::releaseGLObjects() /* static */ void GLFbPC::specialcb(int key, int /*x*/, int /*y*/) { - lt_debug_c("GLFB::%s: 0x%x\n", __func__, key); + hal_debug_c("GLFB::%s: 0x%x\n", __func__, key); struct input_event ev; std::map::const_iterator i = glfb_priv->mSpecialMap.find(key); if (i == glfb_priv->mSpecialMap.end()) @@ -354,7 +354,7 @@ void GLFbPC::releaseGLObjects() ev.value = 1; ev.type = EV_KEY; gettimeofday(&ev.time, NULL); - lt_debug_c("GLFB::%s: pushing 0x%x\n", __func__, ev.code); + hal_debug_c("GLFB::%s: pushing 0x%x\n", __func__, ev.code); write(glfb_priv->input_fd, &ev, sizeof(ev)); ev.value = 0; write(glfb_priv->input_fd, &ev, sizeof(ev)); @@ -391,7 +391,7 @@ void GLFbPC::render() glutFullScreen(); } else *mX = *mY * mOA.num / mOA.den; - lt_info("%s: reinit mX:%d mY:%d xoff:%d yoff:%d fs %d\n", + hal_info("%s: reinit mX:%d mY:%d xoff:%d yoff:%d fs %d\n", __func__, *mX, *mY, xoff, yoff, mFullscreen); glViewport(xoff, yoff, *mX, *mY); glMatrixMode(GL_PROJECTION); @@ -417,7 +417,7 @@ void GLFbPC::render() if (mState.blit) { /* only blit manually after fb->blit(), this helps to find missed blit() calls */ mState.blit = false; - lt_debug("GLFB::%s blit!\n", __func__); + hal_debug("GLFB::%s blit!\n", __func__); bltOSDBuffer(); /* OSD */ } @@ -435,10 +435,10 @@ void GLFbPC::render() default: case INT_MIN: /* invalid */ case 0: /* identical */ - lt_debug("%s: mVA == mOA (or fullscreen mode :-)\n", __func__); + hal_debug("%s: mVA == mOA (or fullscreen mode :-)\n", __func__); break; case 1: /* mVA > mOA -- video is wider than display */ - lt_debug("%s: mVA > mOA\n", __func__); + hal_debug("%s: mVA > mOA\n", __func__); xscale = av_q2d(mVA) / av_q2d(mOA); switch (mCrop) { case DISPLAY_AR_MODE_PANSCAN: @@ -454,7 +454,7 @@ void GLFbPC::render() } break; case -1: /* mVA < mOA -- video is taller than display */ - lt_debug("%s: mVA < mOA\n", __func__); + hal_debug("%s: mVA < mOA\n", __func__); xscale = av_q2d(mVA) / av_q2d(mOA); switch (mCrop) { case DISPLAY_AR_MODE_LETTERBOX: @@ -484,7 +484,7 @@ void GLFbPC::render() GLuint err = glGetError(); if (err != 0) - lt_info("GLFB::%s: GLError:%d 0x%04x\n", __func__, err, err); + hal_info("GLFB::%s: GLError:%d 0x%04x\n", __func__, err, err); if (sleep_us > 0) usleep(sleep_us); glutPostRedisplay(); @@ -591,7 +591,7 @@ void GLFbPC::bltDisplayBuffer() cVideo::SWFramebuffer *buf = videoDecoder->getDecBuf(); if (!buf) { if (warn) - lt_info("GLFB::%s did not get a buffer...\n", __func__); + hal_info("GLFB::%s did not get a buffer...\n", __func__); warn = false; return; } @@ -641,6 +641,6 @@ void GLFbPC::bltDisplayBuffer() else if (sleep_us < 1) sleep_us = 1; } - lt_debug("vpts: 0x%" PRIx64 " apts: 0x%" PRIx64 " diff: %6.3f sleep_us %d buf %d\n", + hal_debug("vpts: 0x%" PRIx64 " apts: 0x%" PRIx64 " diff: %6.3f sleep_us %d buf %d\n", buf->pts(), apts, (buf->pts() - apts)/90000.0, sleep_us, videoDecoder->buf_num); } diff --git a/libgeneric-pc/init.cpp b/libgeneric-pc/init.cpp index 6a8d89e..8997ee5 100644 --- a/libgeneric-pc/init.cpp +++ b/libgeneric-pc/init.cpp @@ -5,9 +5,9 @@ #include "init.h" #include "glfb.h" -#include "lt_debug.h" -#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_INIT, NULL, args) -#define lt_info(args...) _lt_info(TRIPLE_DEBUG_INIT, NULL, args) +#include "hal_debug.h" +#define hal_debug(args...) _hal_debug(HAL_DEBUG_INIT, NULL, args) +#define hal_info(args...) _hal_info(HAL_DEBUG_INIT, NULL, args) static bool initialized = false; GLFramebuffer *glfb = NULL; @@ -16,8 +16,8 @@ bool HAL_nodec = false; void init_td_api() { if (!initialized) - lt_debug_init(); - lt_info("%s begin, initialized=%d, debug=0x%02x\n", __func__, (int)initialized, debuglevel); + hal_debug_init(); + hal_info("%s begin, initialized=%d, debug=0x%02x\n", __func__, (int)initialized, debuglevel); if (! glfb) { int x = 1280, y = 720; /* default OSD FB resolution */ /* @@ -32,9 +32,9 @@ void init_td_api() x = atoi(tmp); y = atoi(p + 1); } - lt_info("%s: setting GL Framebuffer size to %dx%d\n", __func__, x, y); + hal_info("%s: setting GL Framebuffer size to %dx%d\n", __func__, x, y); if (!p) - lt_info("%s: export GLFB_RESOLUTION=\",\" to set another resolution\n", __func__); + hal_info("%s: export GLFB_RESOLUTION=\",\" to set another resolution\n", __func__); glfb = new GLFramebuffer(x, y); /* hard coded to PAL resolution for now */ } @@ -49,7 +49,7 @@ void init_td_api() void shutdown_td_api() { - lt_info("%s, initialized = %d\n", __func__, (int)initialized); + hal_info("%s, initialized = %d\n", __func__, (int)initialized); if (glfb) delete glfb; glfb = NULL; diff --git a/libgeneric-pc/playback_gst_01.cpp b/libgeneric-pc/playback_gst_01.cpp index 0527be2..8694724 100644 --- a/libgeneric-pc/playback_gst_01.cpp +++ b/libgeneric-pc/playback_gst_01.cpp @@ -37,11 +37,11 @@ #include "playback_gst.h" -#include "lt_debug.h" -#define lt_debug(args...) _lt_debug(HAL_DEBUG_PLAYBACK, this, args) -#define lt_info(args...) _lt_info(HAL_DEBUG_PLAYBACK, this, args) -#define lt_debug_c(args...) _lt_debug(HAL_DEBUG_PLAYBACK, NULL, args) -#define lt_info_c(args...) _lt_info(HAL_DEBUG_PLAYBACK, NULL, args) +#include "hal_debug.h" +#define hal_debug(args...) _hal_debug(HAL_DEBUG_PLAYBACK, this, args) +#define hal_info(args...) _hal_info(HAL_DEBUG_PLAYBACK, this, args) +#define hal_debug_c(args...) _hal_debug(HAL_DEBUG_PLAYBACK, NULL, args) +#define hal_info_c(args...) _hal_info(HAL_DEBUG_PLAYBACK, NULL, args) static const char * FILENAME = "[playback.cpp]"; @@ -104,15 +104,15 @@ GstBusSyncReply Gst_bus_call(GstBus * bus, GstMessage *msg, gpointer user_data) GError *err; gst_message_parse_error(msg, &err, &debug); g_free (debug); - lt_info_c( "%s:%s - GST_MESSAGE_ERROR: %s (%i) from %s\n", FILENAME, __FUNCTION__, err->message, err->code, sourceName ); + hal_info_c( "%s:%s - GST_MESSAGE_ERROR: %s (%i) from %s\n", FILENAME, __FUNCTION__, err->message, err->code, sourceName ); if ( err->domain == GST_STREAM_ERROR ) { if ( err->code == GST_STREAM_ERROR_CODEC_NOT_FOUND ) { if ( g_strrstr(sourceName, "videosink") ) - lt_info_c( "%s:%s - GST_MESSAGE_ERROR: videosink\n", FILENAME, __FUNCTION__ ); //FIXME: how shall playback handle this event??? + hal_info_c( "%s:%s - GST_MESSAGE_ERROR: videosink\n", FILENAME, __FUNCTION__ ); //FIXME: how shall playback handle this event??? else if ( g_strrstr(sourceName, "audiosink") ) - lt_info_c( "%s:%s - GST_MESSAGE_ERROR: audioSink\n", FILENAME, __FUNCTION__ ); //FIXME: how shall playback handle this event??? + hal_info_c( "%s:%s - GST_MESSAGE_ERROR: audioSink\n", FILENAME, __FUNCTION__ ); //FIXME: how shall playback handle this event??? } } g_error_free(err); @@ -132,7 +132,7 @@ GstBusSyncReply Gst_bus_call(GstBus * bus, GstMessage *msg, gpointer user_data) if ( inf->domain == GST_STREAM_ERROR && inf->code == GST_STREAM_ERROR_DECODE ) { if ( g_strrstr(sourceName, "videosink") ) - lt_info_c( "%s:%s - GST_MESSAGE_INFO: videosink\n", FILENAME, __FUNCTION__ ); //FIXME: how shall playback handle this event??? + hal_info_c( "%s:%s - GST_MESSAGE_INFO: videosink\n", FILENAME, __FUNCTION__ ); //FIXME: how shall playback handle this event??? } g_error_free(inf); break; @@ -161,12 +161,12 @@ GstBusSyncReply Gst_bus_call(GstBus * bus, GstMessage *msg, gpointer user_data) { int ret = write(fd, GST_BUFFER_DATA(buf_image), GST_BUFFER_SIZE(buf_image)); close(fd); - lt_info_c( "%s:%s - GST_MESSAGE_INFO: cPlayback::state /tmp/.id3coverart %d bytes written\n", FILENAME, __FUNCTION__ , ret); + hal_info_c( "%s:%s - GST_MESSAGE_INFO: cPlayback::state /tmp/.id3coverart %d bytes written\n", FILENAME, __FUNCTION__ , ret); } //FIXME: how shall playback handle this event??? } gst_tag_list_free(tags); - lt_info_c( "%s:%s - GST_MESSAGE_INFO: update info tags\n", FILENAME, __FUNCTION__); //FIXME: how shall playback handle this event??? + hal_info_c( "%s:%s - GST_MESSAGE_INFO: update info tags\n", FILENAME, __FUNCTION__); //FIXME: how shall playback handle this event??? break; } @@ -180,7 +180,7 @@ GstBusSyncReply Gst_bus_call(GstBus * bus, GstMessage *msg, gpointer user_data) if(old_state == new_state) break; - lt_info_c( "%s:%s - GST_MESSAGE_STATE_CHANGED: state transition %s -> %s\n", FILENAME, __FUNCTION__, gst_element_state_get_name(old_state), gst_element_state_get_name(new_state)); + hal_info_c( "%s:%s - GST_MESSAGE_STATE_CHANGED: state transition %s -> %s\n", FILENAME, __FUNCTION__, gst_element_state_get_name(old_state), gst_element_state_get_name(new_state)); GstStateChange transition = (GstStateChange)GST_STATE_TRANSITION(old_state, new_state); @@ -261,7 +261,7 @@ GstBusSyncReply Gst_bus_call(GstBus * bus, GstMessage *msg, gpointer user_data) cPlayback::cPlayback(int num) { - lt_info( "%s:%s\n", FILENAME, __FUNCTION__); + hal_info( "%s:%s\n", FILENAME, __FUNCTION__); const gchar *nano_str; guint major, minor, micro, nano; @@ -276,7 +276,7 @@ cPlayback::cPlayback(int num) else nano_str = ""; - lt_info( "%s:%s - This program is linked against GStreamer %d.%d.%d %s\n", + hal_info( "%s:%s - This program is linked against GStreamer %d.%d.%d %s\n", FILENAME, __FUNCTION__, major, minor, micro, nano_str); @@ -289,21 +289,21 @@ cPlayback::cPlayback(int num) cPlayback::~cPlayback() { - lt_info( "%s:%s\n", FILENAME, __FUNCTION__); + hal_info( "%s:%s\n", FILENAME, __FUNCTION__); //FIXME: all deleting stuff is done in Close() } //Used by Fileplay bool cPlayback::Open(playmode_t PlayMode) { - lt_info("%s: PlayMode %d\n", __func__, PlayMode); + hal_info("%s: PlayMode %d\n", __func__, PlayMode); return true; } // used by movieplay void cPlayback::Close(void) { - lt_info( "%s:%s\n", FILENAME, __FUNCTION__); + hal_info( "%s:%s\n", FILENAME, __FUNCTION__); Stop(); @@ -314,7 +314,7 @@ void cPlayback::Close(void) GstBus * bus = gst_pipeline_get_bus(GST_PIPELINE (m_gst_playbin)); gst_bus_set_sync_handler(bus, NULL, NULL); gst_object_unref(bus); - lt_info( "%s:%s - GST bus handler closed\n", FILENAME, __FUNCTION__); + hal_info( "%s:%s - GST bus handler closed\n", FILENAME, __FUNCTION__); } if (m_stream_tags) @@ -328,7 +328,7 @@ void cPlayback::Close(void) gst_object_unref(GST_OBJECT(audioSink)); audioSink = NULL; - lt_info( "%s:%s - GST audio Sink closed\n", FILENAME, __FUNCTION__); + hal_info( "%s:%s - GST audio Sink closed\n", FILENAME, __FUNCTION__); } if (videoSink) @@ -336,12 +336,12 @@ void cPlayback::Close(void) gst_object_unref(GST_OBJECT(videoSink)); videoSink = NULL; - lt_info( "%s:%s - GST video Sink closed\n", FILENAME, __FUNCTION__); + hal_info( "%s:%s - GST video Sink closed\n", FILENAME, __FUNCTION__); } // unref m_gst_playbin gst_object_unref (GST_OBJECT (m_gst_playbin)); - lt_info( "%s:%s - GST playbin closed\n", FILENAME, __FUNCTION__); + hal_info( "%s:%s - GST playbin closed\n", FILENAME, __FUNCTION__); m_gst_playbin = NULL; } @@ -355,7 +355,7 @@ bool cPlayback::Start(std::string filename, std::string headers) bool cPlayback::Start(char *filename, int /*vpid*/, int /*vtype*/, int /*apid*/, int /*ac3*/, int /*duration*/, std::string headers) { - lt_info( "%s:%s\n", FILENAME, __FUNCTION__); + hal_info( "%s:%s\n", FILENAME, __FUNCTION__); mAudioStream = 0; @@ -397,14 +397,14 @@ bool cPlayback::Start(char *filename, int /*vpid*/, int /*vtype*/, int /*apid*/, else uri = g_filename_to_uri(filename, NULL, NULL); - lt_info("%s:%s - filename=%s\n", FILENAME, __FUNCTION__, filename); + hal_info("%s:%s - filename=%s\n", FILENAME, __FUNCTION__, filename); // create gst pipeline m_gst_playbin = gst_element_factory_make("playbin2", "playbin"); if(m_gst_playbin) { - lt_info("%s:%s - m_gst_playbin\n", FILENAME, __FUNCTION__); + hal_info("%s:%s - m_gst_playbin\n", FILENAME, __FUNCTION__); guint flags; g_object_get(G_OBJECT (m_gst_playbin), "flags", &flags, NULL); @@ -429,7 +429,7 @@ bool cPlayback::Start(char *filename, int /*vpid*/, int /*vtype*/, int /*apid*/, } else { - lt_info("%s:%s - failed to create GStreamer pipeline!, sorry we can not play\n", FILENAME, __FUNCTION__); + hal_info("%s:%s - failed to create GStreamer pipeline!, sorry we can not play\n", FILENAME, __FUNCTION__); playing = false; return false; @@ -448,7 +448,7 @@ bool cPlayback::Start(char *filename, int /*vpid*/, int /*vtype*/, int /*apid*/, bool cPlayback::Play(void) { - lt_info( "%s:%s playing %d\n", FILENAME, __FUNCTION__, playing); + hal_info( "%s:%s playing %d\n", FILENAME, __FUNCTION__, playing); if(playing == true) return true; @@ -460,7 +460,7 @@ bool cPlayback::Play(void) playing = true; playstate = STATE_PLAY; } - lt_info("%s:%s playing %d\n", FILENAME, __FUNCTION__, playing); + hal_info("%s:%s playing %d\n", FILENAME, __FUNCTION__, playing); return playing; } @@ -469,7 +469,7 @@ bool cPlayback::Stop(void) { if(playing == false) return false; - lt_info( "%s:%s playing %d\n", FILENAME, __FUNCTION__, playing); + hal_info( "%s:%s playing %d\n", FILENAME, __FUNCTION__, playing); // stop if(m_gst_playbin) @@ -479,7 +479,7 @@ bool cPlayback::Stop(void) playing = false; - lt_info( "%s:%s playing %d\n", FILENAME, __FUNCTION__, playing); + hal_info( "%s:%s playing %d\n", FILENAME, __FUNCTION__, playing); playstate = STATE_STOP; @@ -488,7 +488,7 @@ bool cPlayback::Stop(void) bool cPlayback::SetAPid(int pid , bool /*ac3*/) { - lt_info("%s: pid %i\n", __func__, pid); + hal_info("%s: pid %i\n", __func__, pid); int current_audio; @@ -528,7 +528,7 @@ void cPlayback::trickSeek(int ratio) bool cPlayback::SetSpeed(int speed) { - lt_info( "%s:%s speed %d\n", FILENAME, __FUNCTION__, speed); + hal_info( "%s:%s speed %d\n", FILENAME, __FUNCTION__, speed); if(playing == false) return false; @@ -573,7 +573,7 @@ bool cPlayback::SetSpeed(int speed) bool cPlayback::SetSlow(int slow) { - lt_info( "%s:%s playing %d\n", FILENAME, __FUNCTION__, playing); + hal_info( "%s:%s playing %d\n", FILENAME, __FUNCTION__, playing); if(playing == false) return false; @@ -639,7 +639,7 @@ bool cPlayback::GetPosition(int &position, int &duration) bool cPlayback::SetPosition(int position, bool absolute) { - lt_info("%s: pos %d abs %d playing %d\n", __func__, position, absolute, playing); + hal_info("%s: pos %d abs %d playing %d\n", __func__, position, absolute, playing); if(playing == false) return false; @@ -663,7 +663,7 @@ bool cPlayback::SetPosition(int position, bool absolute) void cPlayback::FindAllPids(int *apids, unsigned int *ac3flags, unsigned int *numpida, std::string * language) { - lt_info( "%s:%s\n", FILENAME, __FUNCTION__); + hal_info( "%s:%s\n", FILENAME, __FUNCTION__); if(m_gst_playbin) { @@ -756,7 +756,7 @@ void cPlayback::getMeta() bool cPlayback::SyncAV(void) { - lt_info( "%s:%s playing %d\n", FILENAME, __FUNCTION__, playing); + hal_info( "%s:%s playing %d\n", FILENAME, __FUNCTION__, playing); if(playing == false ) return false; diff --git a/libgeneric-pc/playback_gst_10.cpp b/libgeneric-pc/playback_gst_10.cpp index 58a9915..68c621b 100644 --- a/libgeneric-pc/playback_gst_10.cpp +++ b/libgeneric-pc/playback_gst_10.cpp @@ -36,11 +36,11 @@ #include "playback_gst.h" -#include "lt_debug.h" -#define lt_debug(args...) _lt_debug(HAL_DEBUG_PLAYBACK, this, args) -#define lt_info(args...) _lt_info(HAL_DEBUG_PLAYBACK, this, args) -#define lt_debug_c(args...) _lt_debug(HAL_DEBUG_PLAYBACK, NULL, args) -#define lt_info_c(args...) _lt_info(HAL_DEBUG_PLAYBACK, NULL, args) +#include "hal_debug.h" +#define hal_debug(args...) _hal_debug(HAL_DEBUG_PLAYBACK, this, args) +#define hal_info(args...) _hal_info(HAL_DEBUG_PLAYBACK, this, args) +#define hal_debug_c(args...) _hal_debug(HAL_DEBUG_PLAYBACK, NULL, args) +#define hal_info_c(args...) _hal_info(HAL_DEBUG_PLAYBACK, NULL, args) static const char * FILENAME = "[playback.cpp]"; @@ -104,7 +104,7 @@ void processMpegTsSection(GstMpegtsSection* section) for (guint i = 0; i < pmt->streams->len; ++i) { const GstMpegtsPMTStream* stream = static_cast(g_ptr_array_index(pmt->streams, i)); if (stream->stream_type == 0x05 || stream->stream_type >= 0x80) { - lt_info_c( "%s:%s Audio Stream pid: %d\n", FILENAME, __FUNCTION__, stream->pid); + hal_info_c( "%s:%s Audio Stream pid: %d\n", FILENAME, __FUNCTION__, stream->pid); real_apids[cnt] = stream->pid; cnt++; } @@ -168,7 +168,7 @@ void playbinNotifySource(GObject *object, GParamSpec *param_spec, gpointer user_ if (!name.empty() && !value.empty()) { GValue header; - lt_info_c( "%s:%s setting extra-header '%s:%s'\n", FILENAME, __FUNCTION__, name.c_str(), value.c_str()); + hal_info_c( "%s:%s setting extra-header '%s:%s'\n", FILENAME, __FUNCTION__, name.c_str(), value.c_str()); memset(&header, 0, sizeof(GValue)); g_value_init(&header, G_TYPE_STRING); g_value_set_string(&header, value.c_str()); @@ -176,7 +176,7 @@ void playbinNotifySource(GObject *object, GParamSpec *param_spec, gpointer user_ } else { - lt_info_c( "%s:%s Invalid header format %s\n", FILENAME, __FUNCTION__, _this->extra_headers.c_str()); + hal_info_c( "%s:%s Invalid header format %s\n", FILENAME, __FUNCTION__, _this->extra_headers.c_str()); break; } } @@ -215,15 +215,15 @@ GstBusSyncReply Gst_bus_call(GstBus *bus, GstMessage *msg, gpointer user_data) gst_message_parse_error(msg, &err, &debug); g_free (debug); gchar * sourceName = gst_object_get_name(source); - lt_info_c( "%s:%s - GST_MESSAGE_ERROR: %s (%i) from %s\n", FILENAME, __FUNCTION__, err->message, err->code, sourceName ); + hal_info_c( "%s:%s - GST_MESSAGE_ERROR: %s (%i) from %s\n", FILENAME, __FUNCTION__, err->message, err->code, sourceName ); if ( err->domain == GST_STREAM_ERROR ) { if ( err->code == GST_STREAM_ERROR_CODEC_NOT_FOUND ) { if ( g_strrstr(sourceName, "videosink") ) - lt_info_c( "%s:%s - GST_MESSAGE_ERROR: videosink\n", FILENAME, __FUNCTION__ ); //FIXME: how shall playback handle this event??? + hal_info_c( "%s:%s - GST_MESSAGE_ERROR: videosink\n", FILENAME, __FUNCTION__ ); //FIXME: how shall playback handle this event??? else if ( g_strrstr(sourceName, "audiosink") ) - lt_info_c( "%s:%s - GST_MESSAGE_ERROR: audioSink\n", FILENAME, __FUNCTION__ ); //FIXME: how shall playback handle this event??? + hal_info_c( "%s:%s - GST_MESSAGE_ERROR: audioSink\n", FILENAME, __FUNCTION__ ); //FIXME: how shall playback handle this event??? } } g_error_free(err); @@ -246,7 +246,7 @@ GstBusSyncReply Gst_bus_call(GstBus *bus, GstMessage *msg, gpointer user_data) { gchar * sourceName = gst_object_get_name(source); if ( g_strrstr(sourceName, "videosink") ) - lt_info_c( "%s:%s - GST_MESSAGE_INFO: videosink\n", FILENAME, __FUNCTION__ ); //FIXME: how shall playback handle this event??? + hal_info_c( "%s:%s - GST_MESSAGE_INFO: videosink\n", FILENAME, __FUNCTION__ ); //FIXME: how shall playback handle this event??? if(sourceName) g_free(sourceName); @@ -305,12 +305,12 @@ GstBusSyncReply Gst_bus_call(GstBus *bus, GstMessage *msg, gpointer user_data) int ret = write(fd, data, size); gst_buffer_unmap(buf_image, &map); close(fd); - lt_info_c("%s:%s - /tmp/.id3coverart %d bytes written\n", FILENAME, __FUNCTION__, ret); + hal_info_c("%s:%s - /tmp/.id3coverart %d bytes written\n", FILENAME, __FUNCTION__, ret); } } if (tags) gst_tag_list_unref(tags); - lt_debug_c( "%s:%s - GST_MESSAGE_INFO: update info tags\n", FILENAME, __FUNCTION__); //FIXME: how shall playback handle this event??? + hal_debug_c( "%s:%s - GST_MESSAGE_INFO: update info tags\n", FILENAME, __FUNCTION__); //FIXME: how shall playback handle this event??? break; } case GST_MESSAGE_ELEMENT: @@ -344,7 +344,7 @@ GstBusSyncReply Gst_bus_call(GstBus *bus, GstMessage *msg, gpointer user_data) if(old_state == new_state) break; - lt_info_c( "%s:%s - GST_MESSAGE_STATE_CHANGED: state transition %s -> %s\n", FILENAME, __FUNCTION__, gst_element_state_get_name(old_state), gst_element_state_get_name(new_state)); + hal_info_c( "%s:%s - GST_MESSAGE_STATE_CHANGED: state transition %s -> %s\n", FILENAME, __FUNCTION__, gst_element_state_get_name(old_state), gst_element_state_get_name(new_state)); GstStateChange transition = (GstStateChange)GST_STATE_TRANSITION(old_state, new_state); @@ -374,7 +374,7 @@ GstBusSyncReply Gst_bus_call(GstBus *bus, GstMessage *msg, gpointer user_data) { audioSink = GST_ELEMENT_CAST(g_value_dup_object (&r)); g_value_unset (&r); - lt_info_c( "%s %s - audio sink created\n", FILENAME, __FUNCTION__); + hal_info_c( "%s %s - audio sink created\n", FILENAME, __FUNCTION__); } gst_iterator_free(children); @@ -383,7 +383,7 @@ GstBusSyncReply Gst_bus_call(GstBus *bus, GstMessage *msg, gpointer user_data) { videoSink = GST_ELEMENT_CAST(g_value_dup_object (&r)); g_value_unset (&r); - lt_info_c( "%s %s - video sink created\n", FILENAME, __FUNCTION__); + hal_info_c( "%s %s - video sink created\n", FILENAME, __FUNCTION__); } gst_iterator_free(children); @@ -426,7 +426,7 @@ GstBusSyncReply Gst_bus_call(GstBus *bus, GstMessage *msg, gpointer user_data) cPlayback::cPlayback(int num) { - lt_info( "%s:%s\n", FILENAME, __FUNCTION__); + hal_info( "%s:%s\n", FILENAME, __FUNCTION__); const gchar *nano_str; guint major, minor, micro, nano; @@ -445,7 +445,7 @@ cPlayback::cPlayback(int num) else nano_str = ""; - lt_info( "%s:%s - This program is linked against GStreamer %d.%d.%d %s\n", + hal_info( "%s:%s - This program is linked against GStreamer %d.%d.%d %s\n", FILENAME, __FUNCTION__, major, minor, micro, nano_str); @@ -460,7 +460,7 @@ cPlayback::cPlayback(int num) cPlayback::~cPlayback() { - lt_info( "%s:%s\n", FILENAME, __FUNCTION__); + hal_info( "%s:%s\n", FILENAME, __FUNCTION__); //FIXME: all deleting stuff is done in Close() pthread_mutex_lock (&mutex_tag_ist); if (m_stream_tags) @@ -471,7 +471,7 @@ cPlayback::~cPlayback() //Used by Fileplay bool cPlayback::Open(playmode_t PlayMode) { - lt_info("%s: PlayMode %d\n", __func__, PlayMode); + hal_info("%s: PlayMode %d\n", __func__, PlayMode); init_jump = -1; return true; @@ -480,7 +480,7 @@ bool cPlayback::Open(playmode_t PlayMode) // used by movieplay void cPlayback::Close(void) { - lt_info( "%s:%s\n", FILENAME, __FUNCTION__); + hal_info( "%s:%s\n", FILENAME, __FUNCTION__); Stop(); @@ -492,7 +492,7 @@ void cPlayback::Close(void) gst_bus_set_sync_handler(bus, NULL, NULL, NULL); if (bus) gst_object_unref(bus); - lt_info( "%s:%s - GST bus handler closed\n", FILENAME, __FUNCTION__); + hal_info( "%s:%s - GST bus handler closed\n", FILENAME, __FUNCTION__); } // close gst @@ -503,7 +503,7 @@ void cPlayback::Close(void) gst_object_unref(GST_OBJECT(audioSink)); audioSink = NULL; - lt_info( "%s:%s - GST audio Sink closed\n", FILENAME, __FUNCTION__); + hal_info( "%s:%s - GST audio Sink closed\n", FILENAME, __FUNCTION__); } if (videoSink) @@ -511,12 +511,12 @@ void cPlayback::Close(void) gst_object_unref(GST_OBJECT(videoSink)); videoSink = NULL; - lt_info( "%s:%s - GST video Sink closed\n", FILENAME, __FUNCTION__); + hal_info( "%s:%s - GST video Sink closed\n", FILENAME, __FUNCTION__); } // unref m_gst_playbin gst_object_unref (GST_OBJECT (m_gst_playbin)); - lt_info( "%s:%s - GST playbin closed\n", FILENAME, __FUNCTION__); + hal_info( "%s:%s - GST playbin closed\n", FILENAME, __FUNCTION__); m_gst_playbin = NULL; @@ -532,7 +532,7 @@ bool cPlayback::Start(std::string filename, std::string headers) bool cPlayback::Start(char *filename, int /*vpid*/, int /*vtype*/, int /*apid*/, int /*ac3*/, int /*duration*/, std::string headers) { - lt_info( "%s:%s\n", FILENAME, __FUNCTION__); + hal_info( "%s:%s\n", FILENAME, __FUNCTION__); if (!headers.empty()) extra_headers = headers; @@ -589,7 +589,7 @@ bool cPlayback::Start(char *filename, int /*vpid*/, int /*vtype*/, int /*apid*/, else uri = g_filename_to_uri(filename, NULL, NULL); - lt_info("%s:%s - filename=%s\n", FILENAME, __FUNCTION__, filename); + hal_info("%s:%s - filename=%s\n", FILENAME, __FUNCTION__, filename); guint flags = GST_PLAY_FLAG_AUDIO | GST_PLAY_FLAG_VIDEO | GST_PLAY_FLAG_NATIVE_VIDEO; @@ -601,7 +601,7 @@ bool cPlayback::Start(char *filename, int /*vpid*/, int /*vtype*/, int /*apid*/, if(m_gst_playbin) { - lt_info("%s:%s - m_gst_playbin\n", FILENAME, __FUNCTION__); + hal_info("%s:%s - m_gst_playbin\n", FILENAME, __FUNCTION__); if(isHTTP) { @@ -641,7 +641,7 @@ bool cPlayback::Start(char *filename, int /*vpid*/, int /*vtype*/, int /*apid*/, } else { - lt_info("%s:%s - failed to create GStreamer pipeline!, sorry we can not play\n", FILENAME, __FUNCTION__); + hal_info("%s:%s - failed to create GStreamer pipeline!, sorry we can not play\n", FILENAME, __FUNCTION__); playing = false; return false; @@ -654,7 +654,7 @@ bool cPlayback::Start(char *filename, int /*vpid*/, int /*vtype*/, int /*apid*/, bool cPlayback::Play(void) { - lt_info( "%s:%s playing %d\n", FILENAME, __FUNCTION__, playing); + hal_info( "%s:%s playing %d\n", FILENAME, __FUNCTION__, playing); if(playing == true) return true; @@ -666,7 +666,7 @@ bool cPlayback::Play(void) playing = true; playstate = STATE_PLAY; } - lt_info("%s:%s playing %d\n", FILENAME, __FUNCTION__, playing); + hal_info("%s:%s playing %d\n", FILENAME, __FUNCTION__, playing); return playing; } @@ -675,7 +675,7 @@ bool cPlayback::Stop(void) { if(playing == false) return false; - lt_info( "%s:%s playing %d\n", FILENAME, __FUNCTION__, playing); + hal_info( "%s:%s playing %d\n", FILENAME, __FUNCTION__, playing); // stop if(m_gst_playbin) @@ -685,7 +685,7 @@ bool cPlayback::Stop(void) playing = false; - lt_info( "%s:%s playing %d\n", FILENAME, __FUNCTION__, playing); + hal_info( "%s:%s playing %d\n", FILENAME, __FUNCTION__, playing); playstate = STATE_STOP; @@ -694,7 +694,7 @@ bool cPlayback::Stop(void) bool cPlayback::SetAPid(int pid, bool /*ac3*/) { - lt_info("%s: pid %i\n", __func__, pid); + hal_info("%s: pid %i\n", __func__, pid); int to_audio = pid; @@ -732,7 +732,7 @@ void cPlayback::trickSeek(int ratio) bool cPlayback::SetSpeed(int speed) { - lt_info( "%s:%s speed %d\n", FILENAME, __FUNCTION__, speed); + hal_info( "%s:%s speed %d\n", FILENAME, __FUNCTION__, speed); if(playing == false) return false; @@ -783,7 +783,7 @@ bool cPlayback::SetSpeed(int speed) bool cPlayback::SetSlow(int slow) { - lt_info( "%s:%s playing %d\n", FILENAME, __FUNCTION__, playing); + hal_info( "%s:%s playing %d\n", FILENAME, __FUNCTION__, playing); if(playing == false) return false; @@ -830,14 +830,14 @@ bool cPlayback::GetPosition(int &position, int &duration) g_signal_emit_by_name(audioSink ? audioSink : videoSink, "get-decoder-time", &pts); if (!GST_CLOCK_TIME_IS_VALID(pts)) { - lt_info( "%s - %d failed\n", __FUNCTION__, __LINE__); + hal_info( "%s - %d failed\n", __FUNCTION__, __LINE__); } } else { if(!gst_element_query_position(m_gst_playbin, fmt, &pts)) { - lt_info( "%s - %d failed\n", __FUNCTION__, __LINE__); + hal_info( "%s - %d failed\n", __FUNCTION__, __LINE__); } } position = pts / 1000000.0; @@ -859,7 +859,7 @@ bool cPlayback::GetPosition(int &position, int &duration) bool cPlayback::SetPosition(int position, bool absolute) { - lt_info("%s: pos %d abs %d playing %d\n", __func__, position, absolute, playing); + hal_info("%s: pos %d abs %d playing %d\n", __func__, position, absolute, playing); if(m_gst_playbin) @@ -898,7 +898,7 @@ bool cPlayback::SetPosition(int position, bool absolute) void cPlayback::FindAllPids(int *apids, unsigned int *ac3flags, unsigned int *numpida, std::string * language) { - lt_info( "%s:%s\n", FILENAME, __FUNCTION__); + hal_info( "%s:%s\n", FILENAME, __FUNCTION__); if(m_gst_playbin) { @@ -906,7 +906,7 @@ void cPlayback::FindAllPids(int *apids, unsigned int *ac3flags, unsigned int *nu // get audio g_object_get (m_gst_playbin, "n-audio", &n_audio, NULL); - lt_info("%s: %d audio\n", __FUNCTION__, n_audio); + hal_info("%s: %d audio\n", __FUNCTION__, n_audio); if(n_audio == 0) return; @@ -984,7 +984,7 @@ void cPlayback::FindAllPids(int *apids, unsigned int *ac3flags, unsigned int *nu language[i] = "unk"; else language[i] = slang.c_str(); - lt_info("%s: language:%s\n", __FUNCTION__, language[i].c_str()); + hal_info("%s: language:%s\n", __FUNCTION__, language[i].c_str()); g_free(g_lang); } gst_tag_list_free(tags); @@ -1002,7 +1002,7 @@ void cPlayback::getMeta() bool cPlayback::SyncAV(void) { - lt_info( "%s:%s playing %d\n", FILENAME, __FUNCTION__, playing); + hal_info( "%s:%s playing %d\n", FILENAME, __FUNCTION__, playing); if(playing == false ) return false; @@ -1157,7 +1157,7 @@ int cPlayback::GetAPid(void) { gint current_audio = 0; g_object_get (m_gst_playbin, "current-audio", ¤t_audio, NULL); - lt_info("%s: %d audio\n", __FUNCTION__, current_audio); + hal_info("%s: %d audio\n", __FUNCTION__, current_audio); return real_apids[current_audio] ? real_apids[current_audio] : current_audio; } @@ -1165,7 +1165,7 @@ int cPlayback::GetVPid(void) { gint current_video = 0; g_object_get (m_gst_playbin, "current-video", ¤t_video, NULL); - lt_info("%s: %d video\n", __FUNCTION__, current_video); + hal_info("%s: %d video\n", __FUNCTION__, current_video); return current_video; } diff --git a/libgeneric-pc/video.cpp b/libgeneric-pc/video.cpp index ed0c32a..102ea7b 100644 --- a/libgeneric-pc/video.cpp +++ b/libgeneric-pc/video.cpp @@ -50,10 +50,10 @@ extern "C" { #include "video_lib.h" #include "dmx_hal.h" #include "glfb_priv.h" -#include "lt_debug.h" -#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_VIDEO, this, args) -#define lt_info(args...) _lt_info(TRIPLE_DEBUG_VIDEO, this, args) -#define lt_info_c(args...) _lt_info(TRIPLE_DEBUG_VIDEO, NULL, args) +#include "hal_debug.h" +#define hal_debug(args...) _hal_debug(HAL_DEBUG_VIDEO, this, args) +#define hal_info(args...) _hal_info(HAL_DEBUG_VIDEO, this, args) +#define hal_info_c(args...) _hal_info(HAL_DEBUG_VIDEO, NULL, args) cVideo *videoDecoder = NULL; extern cDemux *videoDemux; @@ -76,7 +76,7 @@ static const AVRational aspect_ratios[6] = { cVideo::cVideo(int, void *, void *, unsigned int) { - lt_debug("%s\n", __func__); + hal_debug("%s\n", __func__); av_register_all(); if (!HAL_nodec) dmxbuf = (uint8_t *)malloc(DMX_BUF_SZ); @@ -105,7 +105,7 @@ cVideo::~cVideo(void) int cVideo::setAspectRatio(int vformat, int cropping) { - lt_info("%s(%d, %d)\n", __func__, vformat, cropping); + hal_info("%s(%d, %d)\n", __func__, vformat, cropping); if (vformat >= 0) display_aspect = (DISPLAY_AR) vformat; if (cropping >= 0) @@ -151,21 +151,21 @@ int cVideo::setCroppingMode(int) int cVideo::Start(void *, unsigned short, unsigned short, void *) { - lt_debug("%s running %d >\n", __func__, thread_running); + hal_debug("%s running %d >\n", __func__, thread_running); if (!thread_running && !HAL_nodec) OpenThreads::Thread::start(); - lt_debug("%s running %d <\n", __func__, thread_running); + hal_debug("%s running %d <\n", __func__, thread_running); return 0; } int cVideo::Stop(bool) { - lt_debug("%s running %d >\n", __func__, thread_running); + hal_debug("%s running %d >\n", __func__, thread_running); if (thread_running) { thread_running = false; OpenThreads::Thread::join(); } - lt_debug("%s running %d <\n", __func__, thread_running); + hal_debug("%s running %d <\n", __func__, thread_running); return 0; } @@ -208,7 +208,7 @@ int cVideo::SetVideoSystem(int system, bool) h = 720; break; case VIDEO_STD_AUTO: - lt_info("%s: VIDEO_STD_AUTO not implemented\n", __func__); + hal_info("%s: VIDEO_STD_AUTO not implemented\n", __func__); // fallthrough case VIDEO_STD_SECAM: case VIDEO_STD_PAL: @@ -216,7 +216,7 @@ int cVideo::SetVideoSystem(int system, bool) h = 576; break; default: - lt_info("%s: unhandled value %d\n", __func__, system); + hal_info("%s: unhandled value %d\n", __func__, system); return 0; } // v_std = (VIDEO_STD) system; @@ -237,7 +237,7 @@ void cVideo::SetVideoMode(analog_mode_t) void cVideo::ShowPicture(const char *fname) { - lt_info("%s(%s)\n", __func__, fname); + hal_info("%s(%s)\n", __func__, fname); if (access(fname, R_OK)) return; still_m.lock(); @@ -259,12 +259,12 @@ void cVideo::ShowPicture(const char *fname) AVPacket avpkt; if (avformat_open_input(&avfc, fname, NULL, NULL) < 0) { - lt_info("%s: Could not open file %s\n", __func__, fname); + hal_info("%s: Could not open file %s\n", __func__, fname); return; } if (avformat_find_stream_info(avfc, NULL) < 0) { - lt_info("%s: Could not find file info %s\n", __func__, fname); + hal_info("%s: Could not find file info %s\n", __func__, fname); goto out_close; } for (i = 0; i < avfc->nb_streams; i++) { @@ -279,35 +279,35 @@ void cVideo::ShowPicture(const char *fname) codec = avcodec_find_decoder(p->codec_id); c = avcodec_alloc_context3(codec); if (avcodec_open2(c, codec, NULL) < 0) { - lt_info("%s: Could not find/open the codec, id 0x%x\n", __func__, p->codec_id); + hal_info("%s: Could not find/open the codec, id 0x%x\n", __func__, p->codec_id); goto out_close; } frame = av_frame_alloc(); rgbframe = av_frame_alloc(); if (!frame || !rgbframe) { - lt_info("%s: Could not allocate video frame\n", __func__); + hal_info("%s: Could not allocate video frame\n", __func__); goto out_free; } av_init_packet(&avpkt); if (av_read_frame(avfc, &avpkt) < 0) { - lt_info("%s: av_read_frame < 0\n", __func__); + hal_info("%s: av_read_frame < 0\n", __func__); goto out_free; } len = avcodec_decode_video2(c, frame, &got_frame, &avpkt); if (len < 0) { - lt_info("%s: avcodec_decode_video2 %d\n", __func__, len); + hal_info("%s: avcodec_decode_video2 %d\n", __func__, len); av_packet_unref(&avpkt); goto out_free; } if (avpkt.size > len) - lt_info("%s: WARN: pkt->size %d != len %d\n", __func__, avpkt.size, len); + hal_info("%s: WARN: pkt->size %d != len %d\n", __func__, avpkt.size, len); if (got_frame) { unsigned int need = av_image_get_buffer_size(VDEC_PIXFMT, c->width, c->height, 1); struct SwsContext *convert = sws_getContext(c->width, c->height, c->pix_fmt, c->width, c->height, VDEC_PIXFMT, SWS_BICUBIC, 0, 0, 0); if (!convert) - lt_info("%s: ERROR setting up SWS context\n", __func__); + hal_info("%s: ERROR setting up SWS context\n", __func__); else { buf_m.lock(); SWFramebuffer *f = &buffers[buf_in]; @@ -327,7 +327,7 @@ void cVideo::ShowPicture(const char *fname) buf_in %= VDEC_MAXBUFS; buf_num++; if (buf_num > (VDEC_MAXBUFS - 1)) { - lt_debug("%s: buf_num overflow\n", __func__); + hal_debug("%s: buf_num overflow\n", __func__); buf_out++; buf_out %= VDEC_MAXBUFS; buf_num--; @@ -343,12 +343,12 @@ void cVideo::ShowPicture(const char *fname) av_frame_free(&rgbframe); out_close: avformat_close_input(&avfc); - lt_debug("%s(%s) end\n", __func__, fname); + hal_debug("%s(%s) end\n", __func__, fname); } void cVideo::StopPicture() { - lt_info("%s\n", __func__); + hal_info("%s\n", __func__); still_m.lock(); stillpicture = false; still_m.unlock(); @@ -455,7 +455,7 @@ static int my_read(void *, uint8_t *buf, int buf_size) void cVideo::run(void) { - lt_info("====================== start decoder thread ================================\n"); + hal_info("====================== start decoder thread ================================\n"); AVCodec *codec; AVCodecParameters *p = NULL; AVCodecContext *c= NULL; @@ -490,14 +490,14 @@ void cVideo::run(void) thread_running = true; if (avformat_open_input(&avfc, NULL, inp, NULL) < 0) { - lt_info("%s: Could not open input\n", __func__); + hal_info("%s: Could not open input\n", __func__); goto out; } while (avfc->nb_streams < 1) { - lt_info("%s: nb_streams %d, should be 1 => retry\n", __func__, avfc->nb_streams); + hal_info("%s: nb_streams %d, should be 1 => retry\n", __func__, avfc->nb_streams); if (av_read_frame(avfc, &avpkt) < 0) - lt_info("%s: av_read_frame < 0\n", __func__); + hal_info("%s: av_read_frame < 0\n", __func__); av_packet_unref(&avpkt); if (! thread_running) goto out; @@ -505,29 +505,29 @@ void cVideo::run(void) p = avfc->streams[0]->codecpar; if (p->codec_type != AVMEDIA_TYPE_VIDEO) - lt_info("%s: no video codec? 0x%x\n", __func__, p->codec_type); + hal_info("%s: no video codec? 0x%x\n", __func__, p->codec_type); codec = avcodec_find_decoder(p->codec_id); if (!codec) { - lt_info("%s: Codec for %s not found\n", __func__, avcodec_get_name(p->codec_id)); + hal_info("%s: Codec for %s not found\n", __func__, avcodec_get_name(p->codec_id)); goto out; } c = avcodec_alloc_context3(codec); if (avcodec_open2(c, codec, NULL) < 0) { - lt_info("%s: Could not open codec\n", __func__); + hal_info("%s: Could not open codec\n", __func__); goto out; } frame = av_frame_alloc(); rgbframe = av_frame_alloc(); if (!frame || !rgbframe) { - lt_info("%s: Could not allocate video frame\n", __func__); + hal_info("%s: Could not allocate video frame\n", __func__); goto out2; } - lt_info("decoding %s\n", avcodec_get_name(c->codec_id)); + hal_info("decoding %s\n", avcodec_get_name(c->codec_id)); while (thread_running) { if (av_read_frame(avfc, &avpkt) < 0) { if (warn_r - time(NULL) > 4) { - lt_info("%s: av_read_frame < 0\n", __func__); + hal_info("%s: av_read_frame < 0\n", __func__); warn_r = time(NULL); } usleep(10000); @@ -537,14 +537,14 @@ void cVideo::run(void) int len = avcodec_decode_video2(c, frame, &got_frame, &avpkt); if (len < 0) { if (warn_d - time(NULL) > 4) { - lt_info("%s: avcodec_decode_video2 %d\n", __func__, len); + hal_info("%s: avcodec_decode_video2 %d\n", __func__, len); warn_d = time(NULL); } av_packet_unref(&avpkt); continue; } if (avpkt.size > len) - lt_info("%s: WARN: pkt->size %d != len %d\n", __func__, avpkt.size, len); + hal_info("%s: WARN: pkt->size %d != len %d\n", __func__, avpkt.size, len); still_m.lock(); if (got_frame && ! stillpicture) { unsigned int need = av_image_get_buffer_size(VDEC_PIXFMT, c->width, c->height, 1); @@ -553,7 +553,7 @@ void cVideo::run(void) c->width, c->height, VDEC_PIXFMT, SWS_BICUBIC, 0, 0, 0); if (!convert) - lt_info("%s: ERROR setting up SWS context\n", __func__); + hal_info("%s: ERROR setting up SWS context\n", __func__); else { buf_m.lock(); SWFramebuffer *f = &buffers[buf_in]; @@ -564,7 +564,7 @@ void cVideo::run(void) sws_scale(convert, frame->data, frame->linesize, 0, c->height, rgbframe->data, rgbframe->linesize); if (dec_w != c->width || dec_h != c->height) { - lt_info("%s: pic changed %dx%d -> %dx%d\n", __func__, + hal_info("%s: pic changed %dx%d -> %dx%d\n", __func__, dec_w, dec_h, c->width, c->height); dec_w = c->width; dec_h = c->height; @@ -592,7 +592,7 @@ void cVideo::run(void) buf_in %= VDEC_MAXBUFS; buf_num++; if (buf_num > (VDEC_MAXBUFS - 1)) { - lt_debug("%s: buf_num overflow\n", __func__); + hal_debug("%s: buf_num overflow\n", __func__); buf_out++; buf_out %= VDEC_MAXBUFS; buf_num--; @@ -600,11 +600,11 @@ void cVideo::run(void) dec_r = c->time_base.den/(c->time_base.num * c->ticks_per_frame); buf_m.unlock(); } - lt_debug("%s: time_base: %d/%d, ticks: %d rate: %d pts 0x%" PRIx64 "\n", __func__, + hal_debug("%s: time_base: %d/%d, ticks: %d rate: %d pts 0x%" PRIx64 "\n", __func__, c->time_base.num, c->time_base.den, c->ticks_per_frame, dec_r, av_frame_get_best_effort_timestamp(frame)); } else - lt_debug("%s: got_frame: %d stillpicture: %d\n", __func__, got_frame, stillpicture); + hal_debug("%s: got_frame: %d stillpicture: %d\n", __func__, got_frame, stillpicture); still_m.unlock(); av_packet_unref(&avpkt); } @@ -627,7 +627,7 @@ void cVideo::run(void) buf_out = 0; } still_m.unlock(); - lt_info("======================== end decoder thread ================================\n"); + hal_info("======================== end decoder thread ================================\n"); } static bool swscale(unsigned char *src, unsigned char *dst, int sw, int sh, int dw, int dh, AVPixelFormat sfmt) @@ -637,7 +637,7 @@ static bool swscale(unsigned char *src, unsigned char *dst, int sw, int sh, int struct SwsContext *scale = NULL; scale = sws_getCachedContext(scale, sw, sh, sfmt, dw, dh, AV_PIX_FMT_RGB32, SWS_BICUBIC, 0, 0, 0); if (!scale) { - lt_info_c("%s: ERROR setting up SWS context\n", __func__); + hal_info_c("%s: ERROR setting up SWS context\n", __func__); return ret; } AVFrame *sframe = av_frame_alloc(); @@ -655,7 +655,7 @@ static bool swscale(unsigned char *src, unsigned char *dst, int sw, int sh, int else ret = true; }else{ - lt_info_c("%s: could not alloc sframe (%p) or dframe (%p)\n", __func__, sframe, dframe); + hal_info_c("%s: could not alloc sframe (%p) or dframe (%p)\n", __func__, sframe, dframe); ret = false; } @@ -671,14 +671,14 @@ static bool swscale(unsigned char *src, unsigned char *dst, int sw, int sh, int sws_freeContext(scale); scale = NULL; } - lt_info_c("%s: %s scale %ix%i to %ix%i ,len %i\n",ret?" ":"ERROR",__func__, sw, sh, dw, dh,len); + hal_info_c("%s: %s scale %ix%i to %ix%i ,len %i\n",ret?" ":"ERROR",__func__, sw, sh, dw, dh,len); return ret; } bool cVideo::GetScreenImage(unsigned char * &data, int &xres, int &yres, bool get_video, bool get_osd, bool scale_to_video) { - lt_info("%s: data 0x%p xres %d yres %d vid %d osd %d scale %d\n", + hal_info("%s: data 0x%p xres %d yres %d vid %d osd %d scale %d\n", __func__, data, xres, yres, get_video, get_osd, scale_to_video); SWFramebuffer video; std::vector *osd = NULL; @@ -784,5 +784,5 @@ int64_t cVideo::GetPTS(void) void cVideo::SetDemux(cDemux *) { - lt_debug("%s: not implemented yet\n", __func__); + hal_debug("%s: not implemented yet\n", __func__); } diff --git a/libraspi/audio.cpp b/libraspi/audio.cpp index da85d47..e3af057 100644 --- a/libraspi/audio.cpp +++ b/libraspi/audio.cpp @@ -22,54 +22,54 @@ #include "audio_lib.h" #include "dmx_hal.h" -#include "lt_debug.h" +#include "hal_debug.h" -#define lt_debug(args...) _lt_debug(HAL_DEBUG_AUDIO, this, args) -#define lt_info(args...) _lt_info(HAL_DEBUG_AUDIO, this, args) +#define hal_debug(args...) _hal_debug(HAL_DEBUG_AUDIO, this, args) +#define hal_info(args...) _hal_info(HAL_DEBUG_AUDIO, this, args) cAudio * audioDecoder = NULL; cAudio::cAudio(void *, void *, void *) { - lt_debug("%s\n", __func__); + hal_debug("%s\n", __func__); } cAudio::~cAudio(void) { - lt_debug("%s\n", __func__); + hal_debug("%s\n", __func__); } void cAudio::openDevice(void) { - lt_debug("%s\n", __func__); + hal_debug("%s\n", __func__); } void cAudio::closeDevice(void) { - lt_debug("%s\n", __func__); + hal_debug("%s\n", __func__); } int cAudio::do_mute(bool enable, bool remember) { - lt_debug("%s(%d, %d)\n", __func__, enable, remember); + hal_debug("%s(%d, %d)\n", __func__, enable, remember); return 0; } int cAudio::setVolume(unsigned int left, unsigned int right) { - lt_debug("%s(%d, %d)\n", __func__, left, right); + hal_debug("%s(%d, %d)\n", __func__, left, right); return 0; } int cAudio::Start(void) { - lt_debug("%s >\n", __func__); + hal_debug("%s >\n", __func__); return 0; } int cAudio::Stop(void) { - lt_debug("%s >\n", __func__); + hal_debug("%s >\n", __func__); return 0; } @@ -80,12 +80,12 @@ bool cAudio::Pause(bool /*Pcm*/) void cAudio::SetSyncMode(AVSYNC_TYPE Mode) { - lt_debug("%s %d\n", __func__, Mode); + hal_debug("%s %d\n", __func__, Mode); }; void cAudio::SetStreamType(AUDIO_FORMAT type) { - lt_debug("%s %d\n", __func__, type); + hal_debug("%s %d\n", __func__, type); }; int cAudio::setChannel(int /*channel*/) @@ -95,19 +95,19 @@ int cAudio::setChannel(int /*channel*/) int cAudio::PrepareClipPlay(int ch, int srate, int bits, int le) { - lt_debug("%s ch %d srate %d bits %d le %d\n", __func__, ch, srate, bits, le);; + hal_debug("%s ch %d srate %d bits %d le %d\n", __func__, ch, srate, bits, le);; return 0; }; int cAudio::WriteClip(unsigned char *buffer, int size) { - lt_debug("cAudio::%s buf 0x%p size %d\n", __func__, buffer, size); + hal_debug("cAudio::%s buf 0x%p size %d\n", __func__, buffer, size); return size; }; int cAudio::StopClip() { - lt_debug("%s\n", __func__); + hal_debug("%s\n", __func__); return 0; }; @@ -118,36 +118,36 @@ void cAudio::getAudioInfo(int &type, int &layer, int &freq, int &bitrate, int &m freq = 0; bitrate = 0; /* not used, but easy to get :-) */ mode = 0; /* default: stereo */ - lt_debug("%s t: %d l: %d f: %d b: %d m: %d\n", + hal_debug("%s t: %d l: %d f: %d b: %d m: %d\n", __func__, type, layer, freq, bitrate, mode); }; void cAudio::SetSRS(int /*iq_enable*/, int /*nmgr_enable*/, int /*iq_mode*/, int /*iq_level*/) { - lt_debug("%s\n", __func__); + hal_debug("%s\n", __func__); }; void cAudio::SetHdmiDD(bool enable) { - lt_debug("%s %d\n", __func__, enable); + hal_debug("%s %d\n", __func__, enable); }; void cAudio::SetSpdifDD(bool enable) { - lt_debug("%s %d\n", __func__, enable); + hal_debug("%s %d\n", __func__, enable); }; void cAudio::ScheduleMute(bool On) { - lt_debug("%s %d\n", __func__, On); + hal_debug("%s %d\n", __func__, On); }; void cAudio::EnableAnalogOut(bool enable) { - lt_debug("%s %d\n", __func__, enable); + hal_debug("%s %d\n", __func__, enable); }; void cAudio::setBypassMode(bool disable) { - lt_debug("%s %d\n", __func__, disable); + hal_debug("%s %d\n", __func__, disable); } diff --git a/libraspi/dmx.cpp b/libraspi/dmx.cpp index e09ecbc..ee9c9f7 100644 --- a/libraspi/dmx.cpp +++ b/libraspi/dmx.cpp @@ -33,18 +33,18 @@ #include #include #include "dmx_lib.h" -#include "lt_debug.h" +#include "hal_debug.h" #include "video_lib.h" /* needed for getSTC... */ extern cVideo *videoDecoder; -#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_DEMUX, this, args) -#define lt_info(args...) _lt_info(TRIPLE_DEBUG_DEMUX, this, args) -#define lt_info_c(args...) _lt_info(TRIPLE_DEBUG_DEMUX, NULL, args) +#define hal_debug(args...) _hal_debug(HAL_DEBUG_DEMUX, this, args) +#define hal_info(args...) _hal_info(HAL_DEBUG_DEMUX, this, args) +#define hal_info_c(args...) _hal_info(HAL_DEBUG_DEMUX, NULL, args) #define dmx_err(_errfmt, _errstr, _revents) do { \ - lt_info("%s " _errfmt " fd:%d, ev:0x%x %s pid:0x%04hx flt:0x%02hx\n", \ + hal_info("%s " _errfmt " fd:%d, ev:0x%x %s pid:0x%04hx flt:0x%02hx\n", \ __func__, _errstr, fd, _revents, DMX_T[dmx_type], pid, flt); \ } while(0); @@ -78,7 +78,7 @@ cDemux::cDemux(int n) { if (n < 0 || n > 2) { - lt_info("%s ERROR: n invalid (%d)\n", __FUNCTION__, n); + hal_info("%s ERROR: n invalid (%d)\n", __FUNCTION__, n); num = 0; } else @@ -88,7 +88,7 @@ cDemux::cDemux(int n) cDemux::~cDemux() { - lt_debug("%s #%d fd: %d\n", __FUNCTION__, num, fd); + hal_debug("%s #%d fd: %d\n", __FUNCTION__, num, fd); Close(); } @@ -97,7 +97,7 @@ bool cDemux::Open(DMX_CHANNEL_TYPE pes_type, void * /*hVideoBuffer*/, int uBuffe int devnum = num; int flags = O_RDWR|O_CLOEXEC; if (fd > -1) - lt_info("%s FD ALREADY OPENED? fd = %d\n", __FUNCTION__, fd); + hal_info("%s FD ALREADY OPENED? fd = %d\n", __FUNCTION__, fd); dmx_type = pes_type; if (pes_type != DMX_PSI_CHANNEL) @@ -106,10 +106,10 @@ bool cDemux::Open(DMX_CHANNEL_TYPE pes_type, void * /*hVideoBuffer*/, int uBuffe fd = open(devname[devnum], flags); if (fd < 0) { - lt_info("%s %s: %m\n", __FUNCTION__, devname[devnum]); + hal_info("%s %s: %m\n", __FUNCTION__, devname[devnum]); return false; } - lt_debug("%s #%d pes_type: %s(%d), uBufferSize: %d fd: %d\n", __func__, + hal_debug("%s #%d pes_type: %s(%d), uBufferSize: %d fd: %d\n", __func__, num, DMX_T[pes_type], pes_type, uBufferSize, fd); if (dmx_type == DMX_VIDEO_CHANNEL) @@ -119,18 +119,18 @@ bool cDemux::Open(DMX_CHANNEL_TYPE pes_type, void * /*hVideoBuffer*/, int uBuffe #if 0 if (!pesfds.empty()) { - lt_info("%s ERROR! pesfds not empty!\n", __FUNCTION__); /* TODO: error handling */ + hal_info("%s ERROR! pesfds not empty!\n", __FUNCTION__); /* TODO: error handling */ return false; } int n = DMX_SOURCE_FRONT0; if (ioctl(fd, DMX_SET_SOURCE, &n) < 0) - lt_info("%s DMX_SET_SOURCE %d failed! (%m)\n", __func__, n); + hal_info("%s DMX_SET_SOURCE %d failed! (%m)\n", __func__, n); #endif if (uBufferSize > 0) { /* probably uBufferSize == 0 means "use default size". TODO: find a reasonable default */ if (ioctl(fd, DMX_SET_BUFFER_SIZE, uBufferSize) < 0) - lt_info("%s DMX_SET_BUFFER_SIZE failed (%m)\n", __func__); + hal_info("%s DMX_SET_BUFFER_SIZE failed (%m)\n", __func__); } buffersize = uBufferSize; @@ -139,10 +139,10 @@ bool cDemux::Open(DMX_CHANNEL_TYPE pes_type, void * /*hVideoBuffer*/, int uBuffe void cDemux::Close(void) { - lt_debug("%s #%d, fd = %d\n", __FUNCTION__, num, fd); + hal_debug("%s #%d, fd = %d\n", __FUNCTION__, num, fd); if (fd < 0) { - lt_info("%s #%d: not open!\n", __FUNCTION__, num); + hal_info("%s #%d: not open!\n", __FUNCTION__, num); return; } @@ -155,7 +155,7 @@ void cDemux::Close(void) dmx_tp_count--; if (dmx_tp_count < 0) { - lt_info("%s dmx_tp_count < 0!!\n", __func__); + hal_info("%s dmx_tp_count < 0!!\n", __func__); dmx_tp_count = 0; } } @@ -163,10 +163,10 @@ void cDemux::Close(void) bool cDemux::Start(bool) { - lt_debug("%s #%d fd: %d type: %s\n", __func__, num, fd, DMX_T[dmx_type]); + hal_debug("%s #%d fd: %d type: %s\n", __func__, num, fd, DMX_T[dmx_type]); if (fd < 0) { - lt_info("%s #%d: not open!\n", __FUNCTION__, num); + hal_info("%s #%d: not open!\n", __FUNCTION__, num); return false; } ioctl(fd, DMX_START); @@ -175,10 +175,10 @@ bool cDemux::Start(bool) bool cDemux::Stop(void) { - lt_debug("%s #%d fd: %d type: %s\n", __func__, num, fd, DMX_T[dmx_type]); + hal_debug("%s #%d fd: %d type: %s\n", __func__, num, fd, DMX_T[dmx_type]); if (fd < 0) { - lt_info("%s #%d: not open!\n", __FUNCTION__, num); + hal_info("%s #%d: not open!\n", __FUNCTION__, num); return false; } ioctl(fd, DMX_STOP); @@ -207,7 +207,7 @@ int cDemux::Read(unsigned char *buff, int len, int timeout) else if (rc < 0) { dmx_err("poll: %s,", strerror(errno), 0) - //lt_info("%s poll: %m\n", __FUNCTION__); + //hal_info("%s poll: %m\n", __FUNCTION__); /* happens, when running under gdb... */ if (errno == EINTR) goto retry; @@ -251,7 +251,7 @@ bool cDemux::sectionFilter(unsigned short _pid, const unsigned char * const filt if (len > DMX_FILTER_SIZE) { - lt_info("%s #%d: len too long: %d, DMX_FILTER_SIZE %d\n", __func__, num, len, DMX_FILTER_SIZE); + hal_info("%s #%d: len too long: %d, DMX_FILTER_SIZE %d\n", __func__, num, len, DMX_FILTER_SIZE); len = DMX_FILTER_SIZE; } flt = filter[0]; @@ -343,7 +343,7 @@ bool cDemux::sectionFilter(unsigned short _pid, const unsigned char * const filt if (timeout == 0 && negmask == NULL) s_flt.timeout = to; - lt_debug("%s #%d pid:0x%04hx fd:%d type:%s len:%d to:%d flags:%x flt[0]:%02x\n", __func__, num, + hal_debug("%s #%d pid:0x%04hx fd:%d type:%s len:%d to:%d flags:%x flt[0]:%02x\n", __func__, num, pid, fd, DMX_T[dmx_type], len, s_flt.timeout,s_flt.flags, s_flt.filter.filter[0]); #if 0 fprintf(stderr,"filt: ");for(int i=0;i= 0x0002 && pid <= 0x000f) || pid >= 0x1fff) return false; - lt_debug("%s #%d pid: 0x%04hx fd: %d type: %s\n", __FUNCTION__, num, pid, fd, DMX_T[dmx_type]); + hal_debug("%s #%d pid: 0x%04hx fd: %d type: %s\n", __FUNCTION__, num, pid, fd, DMX_T[dmx_type]); memset(&p_flt, 0, sizeof(p_flt)); p_flt.pid = pid; @@ -401,7 +401,7 @@ bool cDemux::pesFilter(const unsigned short _pid) p_flt.output = DMX_OUT_TSDEMUX_TAP; break; default: - lt_info("%s #%d invalid dmx_type %d!\n", __func__, num, dmx_type); + hal_info("%s #%d invalid dmx_type %d!\n", __func__, num, dmx_type); return false; } return (ioctl(fd, DMX_SET_PES_FILTER, &p_flt) >= 0); @@ -409,39 +409,39 @@ bool cDemux::pesFilter(const unsigned short _pid) void cDemux::SetSyncMode(AVSYNC_TYPE /*mode*/) { - lt_debug("%s #%d\n", __FUNCTION__, num); + hal_debug("%s #%d\n", __FUNCTION__, num); } void *cDemux::getBuffer() { - lt_debug("%s #%d\n", __FUNCTION__, num); + hal_debug("%s #%d\n", __FUNCTION__, num); return NULL; } void *cDemux::getChannel() { - lt_debug("%s #%d\n", __FUNCTION__, num); + hal_debug("%s #%d\n", __FUNCTION__, num); return NULL; } bool cDemux::addPid(unsigned short Pid) { - lt_debug("%s: pid 0x%04hx\n", __func__, Pid); + hal_debug("%s: pid 0x%04hx\n", __func__, Pid); pes_pids pfd; int ret; if (dmx_type != DMX_TP_CHANNEL) { - lt_info("%s pes_type %s not implemented yet! pid=%hx\n", __FUNCTION__, DMX_T[dmx_type], Pid); + hal_info("%s pes_type %s not implemented yet! pid=%hx\n", __FUNCTION__, DMX_T[dmx_type], Pid); return false; } if (fd == -1) - lt_info("%s bucketfd not yet opened? pid=%hx\n", __FUNCTION__, Pid); + hal_info("%s bucketfd not yet opened? pid=%hx\n", __FUNCTION__, Pid); pfd.fd = fd; /* dummy */ pfd.pid = Pid; pesfds.push_back(pfd); ret = (ioctl(fd, DMX_ADD_PID, &Pid)); if (ret < 0) - lt_info("%s: DMX_ADD_PID (%m)\n", __func__); + hal_info("%s: DMX_ADD_PID (%m)\n", __func__); return (ret != -1); } @@ -449,20 +449,20 @@ void cDemux::removePid(unsigned short Pid) { if (dmx_type != DMX_TP_CHANNEL) { - lt_info("%s pes_type %s not implemented yet! pid=%hx\n", __FUNCTION__, DMX_T[dmx_type], Pid); + hal_info("%s pes_type %s not implemented yet! pid=%hx\n", __FUNCTION__, DMX_T[dmx_type], Pid); return; } for (std::vector::iterator i = pesfds.begin(); i != pesfds.end(); ++i) { if ((*i).pid == Pid) { - lt_debug("removePid: removing demux fd %d pid 0x%04x\n", fd, Pid); + hal_debug("removePid: removing demux fd %d pid 0x%04x\n", fd, Pid); if (ioctl(fd, DMX_REMOVE_PID, Pid) < 0) - lt_info("%s: (DMX_REMOVE_PID, 0x%04hx): %m\n", __func__, Pid); + hal_info("%s: (DMX_REMOVE_PID, 0x%04hx): %m\n", __func__, Pid); pesfds.erase(i); return; /* TODO: what if the same PID is there multiple times */ } } - lt_info("%s pid 0x%04x not found\n", __FUNCTION__, Pid); + hal_info("%s pid 0x%04x not found\n", __FUNCTION__, Pid); } void cDemux::getSTC(int64_t * STC) @@ -475,7 +475,7 @@ void cDemux::getSTC(int64_t * STC) int cDemux::getUnit(void) { - lt_debug("%s #%d\n", __FUNCTION__, num); + hal_debug("%s #%d\n", __FUNCTION__, num); /* just guessed that this is the right thing to do. right now this is only used by the CA code which is stubbed out anyway */ @@ -484,12 +484,12 @@ int cDemux::getUnit(void) bool cDemux::SetSource(int unit, int source) { - lt_info_c("%s(%d, %d): not implemented yet\n", __func__, unit, source); + hal_info_c("%s(%d, %d): not implemented yet\n", __func__, unit, source); return true; } int cDemux::GetSource(int unit) { - lt_info_c("%s(%d): not implemented yet\n", __func__, unit); + hal_info_c("%s(%d): not implemented yet\n", __func__, unit); return 0; } diff --git a/libraspi/glfb.cpp b/libraspi/glfb.cpp index 45d6473..74c2dda 100644 --- a/libraspi/glfb.cpp +++ b/libraspi/glfb.cpp @@ -24,15 +24,15 @@ #include "glfb.h" #include "bcm_host.h" -#include "lt_debug.h" +#include "hal_debug.h" -#define lt_debug_c(args...) _lt_debug(HAL_DEBUG_INIT, NULL, args) -#define lt_info_c(args...) _lt_info(HAL_DEBUG_INIT, NULL, args) -#define lt_debug(args...) _lt_debug(HAL_DEBUG_INIT, this, args) -#define lt_info(args...) _lt_info(HAL_DEBUG_INIT, this, args) +#define hal_debug_c(args...) _hal_debug(HAL_DEBUG_INIT, NULL, args) +#define hal_info_c(args...) _hal_info(HAL_DEBUG_INIT, NULL, args) +#define hal_debug(args...) _hal_debug(HAL_DEBUG_INIT, this, args) +#define hal_info(args...) _hal_info(HAL_DEBUG_INIT, this, args) /* I don't want to assert right now */ -#define CHECK(x) if (!(x)) { lt_info("GLFB: %s:%d warning: %s\n", __func__, __LINE__, #x); } +#define CHECK(x) if (!(x)) { hal_info("GLFB: %s:%d warning: %s\n", __func__, __LINE__, #x); } /* TODO: encapsulate this into pdata? */ static DISPMANX_RESOURCE_HANDLE_T res[2]; @@ -95,7 +95,7 @@ void GLFramebuffer::run() blit_osd(); } blit_mutex.unlock(); - lt_info("GLFB: GL thread stopping\n"); + hal_info("GLFB: GL thread stopping\n"); } void GLFramebuffer::blit() @@ -107,13 +107,13 @@ void GLFramebuffer::blit() void GLFramebuffer::setup() { - lt_info("GLFB: raspi OMX fb setup\n"); + hal_info("GLFB: raspi OMX fb setup\n"); int ret; VC_RECT_T src_rect, dsp_rect; /* source and display size will not change. period. */ pitch = ALIGN_UP(width * 4, 32); /* broadcom example code has this ALIGN_UP in there for a reasin, I suppose */ if (pitch != width * 4) - lt_info("GLFB: WARNING: width not a multiple of 8? I doubt this will work...\n"); + hal_info("GLFB: WARNING: width not a multiple of 8? I doubt this will work...\n"); /* global alpha nontransparent (255) */ VC_DISPMANX_ALPHA_T alpha = { DISPMANX_FLAGS_ALPHA_FROM_SOURCE, 255, 0 }; @@ -125,7 +125,7 @@ void GLFramebuffer::setup() CHECK(ret == 0); /* 32bit FB depth, *2 because tuxtxt uses a shadow buffer */ osd_buf.resize(pitch * height * 2); - lt_info("GLFB: Display is %d x %d, FB is %d x %d, memory size %d\n", + hal_info("GLFB: Display is %d x %d, FB is %d x %d, memory size %d\n", info.width, info.height, width, height, osd_buf.size()); image = &osd_buf[0]; /* initialize to half-transparent grey */ diff --git a/libraspi/init.cpp b/libraspi/init.cpp index 20809c6..ce1521f 100644 --- a/libraspi/init.cpp +++ b/libraspi/init.cpp @@ -35,10 +35,10 @@ #include #include "init.h" -#include "lt_debug.h" +#include "hal_debug.h" #include "glfb.h" -#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_INIT, NULL, args) -#define lt_info(args...) _lt_info(TRIPLE_DEBUG_INIT, NULL, args) +#define hal_debug(args...) _hal_debug(HAL_DEBUG_INIT, NULL, args) +#define hal_info(args...) _hal_info(HAL_DEBUG_INIT, NULL, args) static bool initialized = false; GLFramebuffer *glfb = NULL; @@ -113,11 +113,11 @@ void Input::run() mkfifo("/tmp/neutrino.input", 0600); out_fd = open("/tmp/neutrino.input", O_RDWR|O_CLOEXEC|O_NONBLOCK); if (out_fd < 0) - lt_info("could not create /tmp/neutrino.input. good luck. error: %m\n"); + hal_info("could not create /tmp/neutrino.input. good luck. error: %m\n"); n = scandir("/dev/input", &namelist, dirfilter, NULL); if (n < 0) - lt_info("no input devices /dev/input/eventX??\n"); + hal_info("no input devices /dev/input/eventX??\n"); else { while (n--) { @@ -125,7 +125,7 @@ void Input::run() free(namelist[n]); int fd = open(inputstr, O_RDWR|O_CLOEXEC|O_NONBLOCK); if (fd < 0) { - lt_info("could not open %s:%m\n", inputstr); + hal_info("could not open %s:%m\n", inputstr); continue; } ioctl(fd, EVIOCGBIT(0, EV_MAX), &bit); @@ -133,7 +133,7 @@ void Input::run() close(fd); continue; } - lt_info("input dev: %s bit: 0x%08lx fd: %d\n", inputstr, bit, fd); + hal_info("input dev: %s bit: 0x%08lx fd: %d\n", inputstr, bit, fd); in_fds.insert(fd); if (fd > fd_max) fd_max = fd; @@ -155,7 +155,7 @@ void Input::run() if (ret == 0) /* timed out */ continue; if (ret < 0) { - lt_info("input: select returned %d (%m)\n", ret); + hal_info("input: select returned %d (%m)\n", ret); continue; } @@ -167,7 +167,7 @@ void Input::run() if (ret != sizeof(in)) { if (errno == ENODEV) { close(*i); - lt_info("input fd %d vanished?\n", *i); + hal_info("input fd %d vanished?\n", *i); in_fds.erase(i); } continue; @@ -177,7 +177,7 @@ void Input::run() keymap_t::const_iterator j = kmap.find(in.code); if (j != kmap.end()) in.code = j->second; - lt_debug("GLFB::%s:(fd %d) pushing 0x%x, value %d\n", __func__, *i, in.code, in.value); + hal_debug("GLFB::%s:(fd %d) pushing 0x%x, value %d\n", __func__, *i, in.code, in.value); write(out_fd, &in, sizeof(in)); } } @@ -191,8 +191,8 @@ static Input *thread = NULL; void init_td_api() { if (!initialized) - lt_debug_init(); - lt_info("%s begin, initialized=%d, debug=0x%02x\n", __func__, (int)initialized, debuglevel); + hal_debug_init(); + hal_info("%s begin, initialized=%d, debug=0x%02x\n", __func__, (int)initialized, debuglevel); if (! glfb) { int x = 1280, y = 720; /* default OSD FB resolution */ /* @@ -207,9 +207,9 @@ void init_td_api() x = atoi(tmp); y = atoi(p + 1); } - lt_info("%s: setting Framebuffer size to %dx%d\n", __func__, x, y); + hal_info("%s: setting Framebuffer size to %dx%d\n", __func__, x, y); if (!p) - lt_info("%s: export GLFB_RESOLUTION=\",\" to set another resolution\n", __func__); + hal_info("%s: export GLFB_RESOLUTION=\",\" to set another resolution\n", __func__); glfb = new GLFramebuffer(x, y); /* hard coded to PAL resolution for now */ } @@ -220,7 +220,7 @@ void init_td_api() void shutdown_td_api() { - lt_info("%s, initialized = %d\n", __func__, (int)initialized); + hal_info("%s, initialized = %d\n", __func__, (int)initialized); if (glfb) delete glfb; if (thread) diff --git a/libraspi/video.cpp b/libraspi/video.cpp index 91c18d1..7aa8f4c 100644 --- a/libraspi/video.cpp +++ b/libraspi/video.cpp @@ -24,17 +24,17 @@ #include #include "video_lib.h" -#include "lt_debug.h" -#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_VIDEO, this, args) -#define lt_info(args...) _lt_info(TRIPLE_DEBUG_VIDEO, this, args) -#define lt_info_c(args...) _lt_info(TRIPLE_DEBUG_VIDEO, NULL, args) +#include "hal_debug.h" +#define hal_debug(args...) _hal_debug(HAL_DEBUG_VIDEO, this, args) +#define hal_info(args...) _hal_info(HAL_DEBUG_VIDEO, this, args) +#define hal_info_c(args...) _hal_info(HAL_DEBUG_VIDEO, NULL, args) cVideo *videoDecoder = NULL; int system_rev = 0; cVideo::cVideo(int, void *, void *, unsigned int) { - lt_debug("%s\n", __func__); + hal_debug("%s\n", __func__); display_aspect = DISPLAY_AR_16_9; display_crop = DISPLAY_AR_MODE_LETTERBOX; v_format = VIDEO_FORMAT_MPEG2; @@ -46,7 +46,7 @@ cVideo::~cVideo(void) int cVideo::setAspectRatio(int vformat, int cropping) { - lt_info("%s(%d, %d)\n", __func__, vformat, cropping); + hal_info("%s(%d, %d)\n", __func__, vformat, cropping); return 0; } @@ -63,13 +63,13 @@ int cVideo::setCroppingMode(int) int cVideo::Start(void *, unsigned short, unsigned short, void *) { - lt_debug("%s running %d >\n", __func__, thread_running); + hal_debug("%s running %d >\n", __func__, thread_running); return 0; } int cVideo::Stop(bool) { - lt_debug("%s running %d >\n", __func__, thread_running); + hal_debug("%s running %d >\n", __func__, thread_running); return 0; } @@ -100,7 +100,7 @@ int cVideo::SetVideoSystem(int system, bool) h = 720; break; case VIDEO_STD_AUTO: - lt_info("%s: VIDEO_STD_AUTO not implemented\n", __func__); + hal_info("%s: VIDEO_STD_AUTO not implemented\n", __func__); // fallthrough case VIDEO_STD_SECAM: case VIDEO_STD_PAL: @@ -108,7 +108,7 @@ int cVideo::SetVideoSystem(int system, bool) h = 576; break; default: - lt_info("%s: unhandled value %d\n", __func__, system); + hal_info("%s: unhandled value %d\n", __func__, system); return 0; } v_std = (VIDEO_STD) system; @@ -127,7 +127,7 @@ void cVideo::SetVideoMode(analog_mode_t) void cVideo::ShowPicture(const char *fname) { - lt_info("%s(%s)\n", __func__, fname); + hal_info("%s(%s)\n", __func__, fname); if (access(fname, R_OK)) return; } @@ -172,7 +172,7 @@ int cVideo::SetStreamType(VIDEO_FORMAT v) bool cVideo::GetScreenImage(unsigned char * &data, int &xres, int &yres, bool get_video, bool get_osd, bool scale_to_video) { - lt_info("%s: data 0x%p xres %d yres %d vid %d osd %d scale %d\n", + hal_info("%s: data 0x%p xres %d yres %d vid %d osd %d scale %d\n", __func__, data, xres, yres, get_video, get_osd, scale_to_video); return false; } @@ -185,5 +185,5 @@ int64_t cVideo::GetPTS(void) void cVideo::SetDemux(cDemux *) { - lt_debug("%s: not implemented yet\n", __func__); + hal_debug("%s: not implemented yet\n", __func__); } diff --git a/libspark/audio.cpp b/libspark/audio.cpp index fed273a..f725a64 100644 --- a/libspark/audio.cpp +++ b/libspark/audio.cpp @@ -12,11 +12,11 @@ #include "audio_lib.h" #include "audio_mixer.h" -#include "lt_debug.h" +#include "hal_debug.h" #define AUDIO_DEVICE "/dev/dvb/adapter0/audio0" -#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_AUDIO, this, args) -#define lt_info(args...) _lt_info(TRIPLE_DEBUG_AUDIO, this, args) +#define hal_debug(args...) _hal_debug(HAL_DEBUG_AUDIO, this, args) +#define hal_info(args...) _hal_info(HAL_DEBUG_AUDIO, this, args) #include @@ -49,12 +49,12 @@ void cAudio::openDevice(void) if (fd < 0) { if ((fd = open(AUDIO_DEVICE, O_RDWR)) < 0) - lt_info("openDevice: open failed (%m)\n"); + hal_info("openDevice: open failed (%m)\n"); fcntl(fd, F_SETFD, FD_CLOEXEC); do_mute(true, false); } else - lt_info("openDevice: already open (fd = %d)\n", fd); + hal_info("openDevice: already open (fd = %d)\n", fd); } void cAudio::closeDevice(void) @@ -77,7 +77,7 @@ void cAudio::closeDevice(void) int cAudio::do_mute(bool enable, bool remember) { - lt_debug("%s(%d, %d)\n", __FUNCTION__, enable, remember); + hal_debug("%s(%d, %d)\n", __FUNCTION__, enable, remember); char str[4]; if (remember) @@ -109,7 +109,7 @@ int map_volume(const int volume) int cAudio::setVolume(unsigned int left, unsigned int right) { - lt_debug("%s(%d, %d)\n", __func__, left, right); + hal_debug("%s(%d, %d)\n", __func__, left, right); volume = (left + right) / 2; int v = map_volume(volume); @@ -121,7 +121,7 @@ int cAudio::setVolume(unsigned int left, unsigned int right) tmp = left << 8 | right; int ret = ioctl(mixer_fd, MIXER_WRITE(mixer_num), &tmp); if (ret == -1) - lt_info("%s: MIXER_WRITE(%d),%04x: %m\n", __func__, mixer_num, tmp); + hal_info("%s: MIXER_WRITE(%d),%04x: %m\n", __func__, mixer_num, tmp); return ret; } #endif @@ -153,7 +153,7 @@ bool cAudio::Pause(bool Pcm) void cAudio::SetSyncMode(AVSYNC_TYPE Mode) { - lt_debug("%s %d\n", __func__, Mode); + hal_debug("%s %d\n", __func__, Mode); ioctl(fd, AUDIO_SET_AV_SYNC, Mode); } @@ -168,7 +168,7 @@ void cAudio::SetSyncMode(AVSYNC_TYPE Mode) void cAudio::SetStreamType(AUDIO_FORMAT type) { int bypass = AUDIO_STREAMTYPE_MPEG; - lt_debug("%s %d\n", __FUNCTION__, type); + hal_debug("%s %d\n", __FUNCTION__, type); StreamType = type; switch (type) @@ -193,12 +193,12 @@ void cAudio::SetStreamType(AUDIO_FORMAT type) // Normaly the encoding should be set using AUDIO_SET_ENCODING // But as we implemented the behavior to bypass (cause of e2) this is correct here if (ioctl(fd, AUDIO_SET_BYPASS_MODE, bypass) < 0) - lt_info("%s: AUDIO_SET_BYPASS_MODE failed (%m)\n", __func__); + hal_info("%s: AUDIO_SET_BYPASS_MODE failed (%m)\n", __func__); } int cAudio::setChannel(int channel) { - lt_debug("%s %d\n", __FUNCTION__, channel); + hal_debug("%s %d\n", __FUNCTION__, channel); return 0; } @@ -208,9 +208,9 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int little_endian) unsigned int devmask, stereo, usable; const char *dsp_dev = getenv("DSP_DEVICE"); const char *mix_dev = getenv("MIX_DEVICE"); - lt_debug("%s ch %d srate %d bits %d le %d\n", __FUNCTION__, ch, srate, bits, little_endian); + hal_debug("%s ch %d srate %d bits %d le %d\n", __FUNCTION__, ch, srate, bits, little_endian); if (clipfd > -1) { - lt_info("%s: clipfd already opened (%d)\n", __FUNCTION__, clipfd); + hal_info("%s: clipfd already opened (%d)\n", __FUNCTION__, clipfd); return -1; } mixer_num = -1; @@ -224,15 +224,15 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int little_endian) */ if ((!dsp_dev) || (access(dsp_dev, W_OK))) { if (dsp_dev) - lt_info("%s: DSP_DEVICE is set (%s) but cannot be opened," + hal_info("%s: DSP_DEVICE is set (%s) but cannot be opened," " fall back to /dev/dsp1\n", __func__, dsp_dev); dsp_dev = "/dev/dsp1"; } - lt_info("%s: dsp_dev %s mix_dev %s\n", __func__, dsp_dev, mix_dev); /* NULL mix_dev is ok */ + hal_info("%s: dsp_dev %s mix_dev %s\n", __func__, dsp_dev, mix_dev); /* NULL mix_dev is ok */ /* the tdoss dsp driver seems to work only on the second open(). really. */ clipfd = open(dsp_dev, O_WRONLY); if (clipfd < 0) { - lt_info("%s open %s: %m\n", dsp_dev, __FUNCTION__); + hal_info("%s open %s: %m\n", dsp_dev, __FUNCTION__); return -1; } fcntl(clipfd, F_SETFD, FD_CLOEXEC); @@ -255,21 +255,21 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int little_endian) mixer_fd = open(mix_dev, O_RDWR); if (mixer_fd < 0) { - lt_info("%s: open mixer %s failed (%m)\n", __func__, mix_dev); + hal_info("%s: open mixer %s failed (%m)\n", __func__, mix_dev); /* not a real error */ return 0; } if (ioctl(mixer_fd, SOUND_MIXER_READ_DEVMASK, &devmask) == -1) { - lt_info("%s: SOUND_MIXER_READ_DEVMASK %m\n", __func__); + hal_info("%s: SOUND_MIXER_READ_DEVMASK %m\n", __func__); devmask = 0; } if (ioctl(mixer_fd, SOUND_MIXER_READ_STEREODEVS, &stereo) == -1) { - lt_info("%s: SOUND_MIXER_READ_STEREODEVS %m\n", __func__); + hal_info("%s: SOUND_MIXER_READ_STEREODEVS %m\n", __func__); stereo = 0; } usable = devmask & stereo; if (usable == 0) { - lt_info("%s: devmask: %08x stereo: %08x, no usable dev :-(\n", + hal_info("%s: devmask: %08x stereo: %08x, no usable dev :-(\n", __func__, devmask, stereo); close(mixer_fd); mixer_fd = -1; @@ -278,13 +278,13 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int little_endian) /* __builtin_popcount needs GCC, it counts the set bits... */ if (__builtin_popcount (usable) != 1) { /* TODO: this code is not yet tested as I have only single-mixer devices... */ - lt_info("%s: more than one mixer control: devmask %08x stereo %08x\n" + hal_info("%s: more than one mixer control: devmask %08x stereo %08x\n" "%s: querying MIX_NUMBER environment variable...\n", __func__, devmask, stereo, __func__); const char *tmp = getenv("MIX_NUMBER"); if (tmp) mixer_num = atoi(tmp); - lt_info("%s: mixer_num is %d -> device %08x\n", + hal_info("%s: mixer_num is %d -> device %08x\n", __func__, mixer_num, (mixer_num >= 0) ? (1 << mixer_num) : 0); /* no error checking, you'd better know what you are doing... */ } else { @@ -302,22 +302,22 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int little_endian) int cAudio::WriteClip(unsigned char *buffer, int size) { int ret; - // lt_debug("cAudio::%s\n", __FUNCTION__); + // hal_debug("cAudio::%s\n", __FUNCTION__); if (clipfd < 0) { - lt_info("%s: clipfd not yet opened\n", __FUNCTION__); + hal_info("%s: clipfd not yet opened\n", __FUNCTION__); return -1; } ret = write(clipfd, buffer, size); if (ret < 0) - lt_info("%s: write error (%m)\n", __FUNCTION__); + hal_info("%s: write error (%m)\n", __FUNCTION__); return ret; }; int cAudio::StopClip() { - lt_debug("%s\n", __FUNCTION__); + hal_debug("%s\n", __FUNCTION__); if (clipfd < 0) { - lt_info("%s: clipfd not yet opened\n", __FUNCTION__); + hal_info("%s: clipfd not yet opened\n", __FUNCTION__); return -1; } close(clipfd); @@ -332,7 +332,7 @@ int cAudio::StopClip() void cAudio::getAudioInfo(int &type, int &layer, int &freq, int &bitrate, int &mode) { - lt_debug("%s\n", __FUNCTION__); + hal_debug("%s\n", __FUNCTION__); type = 0; layer = 0; freq = 0; @@ -381,30 +381,30 @@ void cAudio::getAudioInfo(int &type, int &layer, int &freq, int &bitrate, int &m void cAudio::SetSRS(int /*iq_enable*/, int /*nmgr_enable*/, int /*iq_mode*/, int /*iq_level*/) { - lt_debug("%s\n", __FUNCTION__); + hal_debug("%s\n", __FUNCTION__); }; void cAudio::SetHdmiDD(bool enable) { const char *opt[] = { "pcm", "spdif" }; - lt_debug("%s %d\n", __func__, enable); + hal_debug("%s %d\n", __func__, enable); proc_put("/proc/stb/hdmi/audio_source", opt[enable], strlen(opt[enable])); } void cAudio::SetSpdifDD(bool enable) { - lt_debug("%s %d\n", __func__, enable); + hal_debug("%s %d\n", __func__, enable); setBypassMode(!enable); } void cAudio::ScheduleMute(bool On) { - lt_debug("%s %d\n", __FUNCTION__, On); + hal_debug("%s %d\n", __FUNCTION__, On); } void cAudio::EnableAnalogOut(bool enable) { - lt_debug("%s %d\n", __FUNCTION__, enable); + hal_debug("%s %d\n", __FUNCTION__, enable); } #define AUDIO_BYPASS_ON 0 @@ -412,7 +412,7 @@ void cAudio::EnableAnalogOut(bool enable) void cAudio::setBypassMode(bool disable) { const char *opt[] = { "passthrough", "downmix" }; - lt_debug("%s %d\n", __func__, disable); + hal_debug("%s %d\n", __func__, disable); proc_put("/proc/stb/audio/ac3", opt[disable], strlen(opt[disable])); } diff --git a/libspark/dmx.cpp b/libspark/dmx.cpp index 68dc13e..b7130b7 100644 --- a/libspark/dmx.cpp +++ b/libspark/dmx.cpp @@ -70,21 +70,21 @@ #include #include #include "dmx_hal.h" -#include "lt_debug.h" +#include "hal_debug.h" #include "video_lib.h" /* needed for getSTC... */ extern cVideo *videoDecoder; -#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_DEMUX, this, args) -#define lt_info(args...) _lt_info(TRIPLE_DEBUG_DEMUX, this, args) -#define lt_debug_c(args...) _lt_debug(TRIPLE_DEBUG_DEMUX, NULL, args) -#define lt_info_c(args...) _lt_info(TRIPLE_DEBUG_DEMUX, NULL, args) -#define lt_info_z(args...) _lt_info(TRIPLE_DEBUG_DEMUX, thiz, args) -#define lt_debug_z(args...) _lt_debug(TRIPLE_DEBUG_DEMUX, thiz, args) +#define hal_debug(args...) _hal_debug(HAL_DEBUG_DEMUX, this, args) +#define hal_info(args...) _hal_info(HAL_DEBUG_DEMUX, this, args) +#define hal_debug_c(args...) _hal_debug(HAL_DEBUG_DEMUX, NULL, args) +#define hal_info_c(args...) _hal_info(HAL_DEBUG_DEMUX, NULL, args) +#define hal_info_z(args...) _hal_info(HAL_DEBUG_DEMUX, thiz, args) +#define hal_debug_z(args...) _hal_debug(HAL_DEBUG_DEMUX, thiz, args) #define dmx_err(_errfmt, _errstr, _revents) do { \ - lt_info("%s " _errfmt " fd:%d, ev:0x%x %s pid:0x%04hx flt:0x%02hx\n", \ + hal_info("%s " _errfmt " fd:%d, ev:0x%x %s pid:0x%04hx flt:0x%02hx\n", \ __func__, _errstr, fd, _revents, DMX_T[dmx_type], pid, flt); \ } while(0); @@ -129,7 +129,7 @@ cDemux::cDemux(int n) { if (n < 0 || n >= NUM_DEMUX) { - lt_info("%s ERROR: n invalid (%d)\n", __FUNCTION__, n); + hal_info("%s ERROR: n invalid (%d)\n", __FUNCTION__, n); num = 0; } else @@ -143,7 +143,7 @@ cDemux::cDemux(int n) cDemux::~cDemux() { - lt_debug("%s #%d fd: %d\n", __FUNCTION__, num, fd); + hal_debug("%s #%d fd: %d\n", __FUNCTION__, num, fd); Close(); /* wait until Read() has released the mutex */ (*P->mutex).lock(); @@ -156,7 +156,7 @@ cDemux::~cDemux() bool cDemux::Open(DMX_CHANNEL_TYPE pes_type, void * /*hVideoBuffer*/, int uBufferSize) { if (fd > -1) - lt_info("%s FD ALREADY OPENED? fd = %d\n", __FUNCTION__, fd); + hal_info("%s FD ALREADY OPENED? fd = %d\n", __FUNCTION__, fd); dmx_type = pes_type; buffersize = uBufferSize; @@ -170,13 +170,13 @@ static bool _open(cDemux *thiz, int num, int &fd, int &last_source, DMX_CHANNEL_ int flags = O_RDWR|O_CLOEXEC; int devnum = dmx_source[num]; if (last_source == devnum) { - lt_debug_z("%s #%d: source (%d) did not change\n", __func__, num, last_source); + hal_debug_z("%s #%d: source (%d) did not change\n", __func__, num, last_source); if (fd > -1) return true; } if (fd > -1) { /* we changed source -> close and reopen the fd */ - lt_debug_z("%s #%d: FD ALREADY OPENED fd = %d lastsource %d devnum %d\n", + hal_debug_z("%s #%d: FD ALREADY OPENED fd = %d lastsource %d devnum %d\n", __func__, num, fd, last_source, devnum); close(fd); } @@ -187,10 +187,10 @@ static bool _open(cDemux *thiz, int num, int &fd, int &last_source, DMX_CHANNEL_ fd = open(devname[devnum], flags); if (fd < 0) { - lt_info_z("%s %s: %m\n", __FUNCTION__, devname[devnum]); + hal_info_z("%s %s: %m\n", __FUNCTION__, devname[devnum]); return false; } - lt_debug_z("%s #%d pes_type: %s(%d), uBufferSize: %d fd: %d\n", __func__, + hal_debug_z("%s #%d pes_type: %s(%d), uBufferSize: %d fd: %d\n", __func__, num, DMX_T[dmx_type], dmx_type, buffersize, fd); /* this would actually need locking, but the worst that weill happen is, that @@ -199,9 +199,9 @@ static bool _open(cDemux *thiz, int num, int &fd, int &last_source, DMX_CHANNEL_ { /* this should not change anything... */ int n = DMX_SOURCE_FRONT0 + devnum; - lt_info_z("%s: setting %s to source %d\n", __func__, devname[devnum], n); + hal_info_z("%s: setting %s to source %d\n", __func__, devname[devnum], n); if (ioctl(fd, DMX_SET_SOURCE, &n) < 0) - lt_info_z("%s DMX_SET_SOURCE failed!\n", __func__); + hal_info_z("%s DMX_SET_SOURCE failed!\n", __func__); else init[devnum] = true; } @@ -211,7 +211,7 @@ static bool _open(cDemux *thiz, int num, int &fd, int &last_source, DMX_CHANNEL_ { /* probably uBufferSize == 0 means "use default size". TODO: find a reasonable default */ if (ioctl(fd, DMX_SET_BUFFER_SIZE, buffersize) < 0) - lt_info_z("%s DMX_SET_BUFFER_SIZE failed (%m)\n", __func__); + hal_info_z("%s DMX_SET_BUFFER_SIZE failed (%m)\n", __func__); } last_source = devnum; @@ -220,10 +220,10 @@ static bool _open(cDemux *thiz, int num, int &fd, int &last_source, DMX_CHANNEL_ void cDemux::Close(void) { - lt_debug("%s #%d, fd = %d\n", __FUNCTION__, num, fd); + hal_debug("%s #%d, fd = %d\n", __FUNCTION__, num, fd); if (fd < 0) { - lt_info("%s #%d: not open!\n", __FUNCTION__, num); + hal_info("%s #%d: not open!\n", __FUNCTION__, num); return; } @@ -235,10 +235,10 @@ void cDemux::Close(void) bool cDemux::Start(bool) { - lt_debug("%s #%d fd: %d type: %s\n", __func__, num, fd, DMX_T[dmx_type]); + hal_debug("%s #%d fd: %d type: %s\n", __func__, num, fd, DMX_T[dmx_type]); if (fd < 0) { - lt_info("%s #%d: not open!\n", __FUNCTION__, num); + hal_info("%s #%d: not open!\n", __FUNCTION__, num); return false; } ioctl(fd, DMX_START); @@ -247,10 +247,10 @@ bool cDemux::Start(bool) bool cDemux::Stop(void) { - lt_debug("%s #%d fd: %d type: %s\n", __func__, num, fd, DMX_T[dmx_type]); + hal_debug("%s #%d fd: %d type: %s\n", __func__, num, fd, DMX_T[dmx_type]); if (fd < 0) { - lt_info("%s #%d: not open!\n", __FUNCTION__, num); + hal_info("%s #%d: not open!\n", __FUNCTION__, num); return false; } ioctl(fd, DMX_STOP); @@ -266,7 +266,7 @@ int cDemux::Read(unsigned char *buff, int len, int timeout) #endif if (fd < 0) { - lt_info("%s #%d: not open!\n", __func__, num); + hal_info("%s #%d: not open!\n", __func__, num); return -1; } /* avoid race in destructor: ~cDemux needs to wait until Read() returns */ @@ -291,7 +291,7 @@ int cDemux::Read(unsigned char *buff, int len, int timeout) if (ufds.fd != fd) { /* Close() will set fd to -1, this is normal. Everything else is not. */ - lt_info("%s:1 ========== fd has changed, %d->%d ==========\n", __func__, ufds.fd, fd); + hal_info("%s:1 ========== fd has changed, %d->%d ==========\n", __func__, ufds.fd, fd); return -1; } if (!rc) @@ -306,7 +306,7 @@ int cDemux::Read(unsigned char *buff, int len, int timeout) else if (rc < 0) { dmx_err("poll: %s,", strerror(errno), 0) - //lt_info("%s poll: %m\n", __FUNCTION__); + //hal_info("%s poll: %m\n", __FUNCTION__); /* happens, when running under gdb... */ if (errno == EINTR) goto retry; @@ -333,7 +333,7 @@ int cDemux::Read(unsigned char *buff, int len, int timeout) } if (ufds.fd != fd) /* does this ever happen? and if, is it harmful? */ { /* read(-1,...) will just return EBADF anyway... */ - lt_info("%s:2 ========== fd has changed, %d->%d ==========\n", __func__, ufds.fd, fd); + hal_info("%s:2 ========== fd has changed, %d->%d ==========\n", __func__, ufds.fd, fd); return -1; } @@ -357,7 +357,7 @@ bool cDemux::sectionFilter(unsigned short _pid, const unsigned char * const filt if (len > DMX_FILTER_SIZE) { - lt_info("%s #%d: len too long: %d, DMX_FILTER_SIZE %d\n", __func__, num, len, DMX_FILTER_SIZE); + hal_info("%s #%d: len too long: %d, DMX_FILTER_SIZE %d\n", __func__, num, len, DMX_FILTER_SIZE); len = DMX_FILTER_SIZE; } flt = filter[0]; @@ -452,7 +452,7 @@ bool cDemux::sectionFilter(unsigned short _pid, const unsigned char * const filt if (timeout == 0 && negmask == NULL) s_flt.timeout = to; - lt_debug("%s #%d pid:0x%04hx fd:%d type:%s len:%d to:%d flags:%x flt[0]:%02x\n", __func__, num, + hal_debug("%s #%d pid:0x%04hx fd:%d type:%s len:%d to:%d flags:%x flt[0]:%02x\n", __func__, num, pid, fd, DMX_T[dmx_type], len, s_flt.timeout,s_flt.flags, s_flt.filter.filter[0]); #if 0 fprintf(stderr,"filt: ");for(int i=0;i= 0x0002 && pid <= 0x000f) || pid >= 0x1fff) return false; - lt_debug("%s #%d pid: 0x%04hx fd: %d type: %s\n", __FUNCTION__, num, pid, fd, DMX_T[dmx_type]); + hal_debug("%s #%d pid: 0x%04hx fd: %d type: %s\n", __FUNCTION__, num, pid, fd, DMX_T[dmx_type]); _open(this, num, fd, P->last_source, dmx_type, buffersize); @@ -513,7 +513,7 @@ bool cDemux::pesFilter(const unsigned short _pid) p_flt.output = DMX_OUT_TSDEMUX_TAP; break; default: - lt_info("%s #%d invalid dmx_type %d!\n", __func__, num, dmx_type); + hal_info("%s #%d invalid dmx_type %d!\n", __func__, num, dmx_type); return false; } return (ioctl(fd, DMX_SET_PES_FILTER, &p_flt) >= 0); @@ -521,40 +521,40 @@ bool cDemux::pesFilter(const unsigned short _pid) void cDemux::SetSyncMode(AVSYNC_TYPE /*mode*/) { - lt_debug("%s #%d\n", __FUNCTION__, num); + hal_debug("%s #%d\n", __FUNCTION__, num); } void *cDemux::getBuffer() { - lt_debug("%s #%d\n", __FUNCTION__, num); + hal_debug("%s #%d\n", __FUNCTION__, num); return NULL; } void *cDemux::getChannel() { - lt_debug("%s #%d\n", __FUNCTION__, num); + hal_debug("%s #%d\n", __FUNCTION__, num); return NULL; } bool cDemux::addPid(unsigned short Pid) { - lt_debug("%s: pid 0x%04hx\n", __func__, Pid); + hal_debug("%s: pid 0x%04hx\n", __func__, Pid); pes_pids pfd; int ret; if (dmx_type != DMX_TP_CHANNEL) { - lt_info("%s pes_type %s not implemented yet! pid=%hx\n", __FUNCTION__, DMX_T[dmx_type], Pid); + hal_info("%s pes_type %s not implemented yet! pid=%hx\n", __FUNCTION__, DMX_T[dmx_type], Pid); return false; } _open(this, num, fd, P->last_source, dmx_type, buffersize); if (fd == -1) - lt_info("%s bucketfd not yet opened? pid=%hx\n", __FUNCTION__, Pid); + hal_info("%s bucketfd not yet opened? pid=%hx\n", __FUNCTION__, Pid); pfd.fd = fd; /* dummy */ pfd.pid = Pid; pesfds.push_back(pfd); ret = (ioctl(fd, DMX_ADD_PID, &Pid)); if (ret < 0) - lt_info("%s: DMX_ADD_PID (%m) pid=%hx\n", __func__, Pid); + hal_info("%s: DMX_ADD_PID (%m) pid=%hx\n", __func__, Pid); return (ret != -1); } @@ -562,27 +562,27 @@ void cDemux::removePid(unsigned short Pid) { if (dmx_type != DMX_TP_CHANNEL) { - lt_info("%s pes_type %s not implemented yet! pid=%hx\n", __FUNCTION__, DMX_T[dmx_type], Pid); + hal_info("%s pes_type %s not implemented yet! pid=%hx\n", __FUNCTION__, DMX_T[dmx_type], Pid); return; } for (std::vector::iterator i = pesfds.begin(); i != pesfds.end(); ++i) { if ((*i).pid == Pid) { - lt_debug("removePid: removing demux fd %d pid 0x%04x\n", fd, Pid); + hal_debug("removePid: removing demux fd %d pid 0x%04x\n", fd, Pid); if (ioctl(fd, DMX_REMOVE_PID, Pid) < 0) - lt_info("%s: (DMX_REMOVE_PID, 0x%04hx): %m\n", __func__, Pid); + hal_info("%s: (DMX_REMOVE_PID, 0x%04hx): %m\n", __func__, Pid); pesfds.erase(i); return; /* TODO: what if the same PID is there multiple times */ } } - lt_info("%s pid 0x%04x not found\n", __FUNCTION__, Pid); + hal_info("%s pid 0x%04x not found\n", __FUNCTION__, Pid); } void cDemux::getSTC(int64_t * STC) { /* apparently I can only get the PTS of the video decoder, * but that's good enough for dvbsub */ - lt_debug("%s #%d\n", __func__, num); + hal_debug("%s #%d\n", __func__, num); int64_t pts = 0; if (videoDecoder) pts = videoDecoder->GetPTS(); @@ -591,7 +591,7 @@ void cDemux::getSTC(int64_t * STC) int cDemux::getUnit(void) { - lt_debug("%s #%d\n", __FUNCTION__, num); + hal_debug("%s #%d\n", __FUNCTION__, num); /* just guessed that this is the right thing to do. right now this is only used by the CA code which is stubbed out anyway */ @@ -601,12 +601,12 @@ int cDemux::getUnit(void) bool cDemux::SetSource(int unit, int source) { if (unit >= NUM_DEMUX || unit < 0) { - lt_info_c("%s: unit (%d) out of range, NUM_DEMUX %d\n", __func__, unit, NUM_DEMUX); + hal_info_c("%s: unit (%d) out of range, NUM_DEMUX %d\n", __func__, unit, NUM_DEMUX); return false; } - lt_debug_c("%s(%d, %d) => %d to %d\n", __func__, unit, source, dmx_source[unit], source); + hal_debug_c("%s(%d, %d) => %d to %d\n", __func__, unit, source, dmx_source[unit], source); if (source < 0 || source >= NUM_DEMUXDEV) - lt_info_c("%s(%d, %d) ERROR: source %d out of range!\n", __func__, unit, source, source); + hal_info_c("%s(%d, %d) ERROR: source %d out of range!\n", __func__, unit, source, source); else dmx_source[unit] = source; return true; @@ -615,9 +615,9 @@ bool cDemux::SetSource(int unit, int source) int cDemux::GetSource(int unit) { if (unit >= NUM_DEMUX || unit < 0) { - lt_info_c("%s: unit (%d) out of range, NUM_DEMUX %d\n", __func__, unit, NUM_DEMUX); + hal_info_c("%s: unit (%d) out of range, NUM_DEMUX %d\n", __func__, unit, NUM_DEMUX); return -1; } - lt_debug_c("%s(%d) => %d\n", __func__, unit, dmx_source[unit]); + hal_debug_c("%s(%d) => %d\n", __func__, unit, dmx_source[unit]); return dmx_source[unit]; } diff --git a/libspark/init.cpp b/libspark/init.cpp index 0c3e92a..fac983a 100644 --- a/libspark/init.cpp +++ b/libspark/init.cpp @@ -16,9 +16,9 @@ #include "init.h" #include "pwrmngr.h" -#include "lt_debug.h" -#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_INIT, NULL, args) -#define lt_info(args...) _lt_info(TRIPLE_DEBUG_INIT, NULL, args) +#include "hal_debug.h" +#define hal_debug(args...) _hal_debug(HAL_DEBUG_INIT, NULL, args) +#define hal_info(args...) _hal_info(HAL_DEBUG_INIT, NULL, args) #include #include @@ -202,7 +202,7 @@ static void poll_input_devices(void) { int r = poll(fds, nfds, 60000 /* ms */); if (r < 0) { if (errno != EAGAIN) { - lt_info("%s: poll(): %m\n", __func__); + hal_info("%s: poll(): %m\n", __func__); inmux_thread_running = 0; } return; @@ -243,12 +243,12 @@ void start_inmux_thread(void) { input_device[0].fd = open(input_device[0].name, O_RDWR | O_NONBLOCK); // nevis_ir. This is mandatory. if (input_device[0].fd < 0){ - lt_info("%s: open(%s): %m\n", __func__, input_device[0].name); + hal_info("%s: open(%s): %m\n", __func__, input_device[0].name); return; } if (pthread_create(&inmux_task, 0, inmux_thread, NULL) != 0) { - lt_info("%s: inmux thread pthread_create: %m\n", __func__); + hal_info("%s: inmux thread pthread_create: %m\n", __func__); inmux_thread_running = 0; return; } @@ -265,8 +265,8 @@ static bool initialized = false; void init_td_api() { if (!initialized) - lt_debug_init(); - lt_info("%s begin, initialized=%d, debug=0x%02x\n", __FUNCTION__, (int)initialized, debuglevel); + hal_debug_init(); + hal_info("%s begin, initialized=%d, debug=0x%02x\n", __FUNCTION__, (int)initialized, debuglevel); if (!initialized) { cCpuFreqManager f; @@ -279,7 +279,7 @@ void init_td_api() struct dmx_pes_filter_params p; int dmx = open("/dev/dvb/adapter0/demux0", O_RDWR|O_CLOEXEC); if (dmx < 0) - lt_info("%s: ERROR open /dev/dvb/adapter0/demux0 (%m)\n", __func__); + hal_info("%s: ERROR open /dev/dvb/adapter0/demux0 (%m)\n", __func__); else { memset(&p, 0, sizeof(p)); @@ -295,12 +295,12 @@ void init_td_api() else reopen_input_devices(); initialized = true; - lt_info("%s end\n", __FUNCTION__); + hal_info("%s end\n", __FUNCTION__); } void shutdown_td_api() { - lt_info("%s, initialized = %d\n", __FUNCTION__, (int)initialized); + hal_info("%s, initialized = %d\n", __FUNCTION__, (int)initialized); if (initialized) { stop_inmux_thread(); close_input_devices(); diff --git a/libspark/lirmp_input.cpp b/libspark/lirmp_input.cpp index 73dcc06..b0b917d 100644 --- a/libspark/lirmp_input.cpp +++ b/libspark/lirmp_input.cpp @@ -46,9 +46,9 @@ extern "C" { } static uint8_t IRMP_PIN; -#include -#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_INIT, NULL, args) -#define lt_info(args...) _lt_info(TRIPLE_DEBUG_INIT, NULL, args) +#include +#define hal_debug(args...) _hal_debug(HAL_DEBUG_INIT, NULL, args) +#define hal_info(args...) _hal_info(HAL_DEBUG_INIT, NULL, args) /* same defines as in neutrino's rcinput.h */ #define KEY_TTTV KEY_FN_1 @@ -197,7 +197,7 @@ static void *input_thread(void *) int aotom_fd = -1; IRMP_DATA d; - lt_info("LIRC/IRMP input converter thread starting...\n"); + hal_info("LIRC/IRMP input converter thread starting...\n"); /* modprobe does not complain if the module is already loaded... */ system("/sbin/modprobe uinput"); @@ -208,7 +208,7 @@ static void *input_thread(void *) if (uinput < 0) { - lt_info("LIRC/IRMP input thread: unable to open /dev/uinput (%m)\n"); + hal_info("LIRC/IRMP input thread: unable to open /dev/uinput (%m)\n"); thread_running = 2; return NULL; } @@ -234,7 +234,7 @@ static void *input_thread(void *) if (ioctl(uinput, UI_DEV_CREATE)) { - lt_info("LIRC/IRMP input thread UI_DEV_CREATE: %m\n"); + hal_info("LIRC/IRMP input thread UI_DEV_CREATE: %m\n"); close(uinput); return NULL; } @@ -270,7 +270,7 @@ static void *input_thread(void *) } evdev = atoi(p + 6); sprintf(newdev, "event%d", evdev); - lt_info("LIRC/IRMP input thread: symlink /dev/input/nevis_ir to %s\n", newdev); + hal_info("LIRC/IRMP input thread: symlink /dev/input/nevis_ir to %s\n", newdev); unlink("/dev/input/nevis_ir"); symlink(newdev, "/dev/input/nevis_ir"); break; @@ -290,7 +290,7 @@ static void *input_thread(void *) lircfd = open("/dev/lirc", O_RDONLY); if (lircfd < 0) { - lt_info("%s: open /dev/lirc: %m\n", __func__); + hal_info("%s: open /dev/lirc: %m\n", __func__); goto out; } IRMP_PIN = 0xFF; @@ -299,7 +299,7 @@ static void *input_thread(void *) #define POLL_MS (100 * 1000) #define LIRC_PULSE 0x01000000 #define LIRC_PULSE_MASK 0x00FFFFFF - lt_info("LIRC/IRMP input converter going into main loop...\n"); + hal_info("LIRC/IRMP input converter going into main loop...\n"); aotom_fd = open("/dev/vfd", O_RDONLY); @@ -323,7 +323,7 @@ static void *input_thread(void *) if (ret == -1) { /* errno != EINTR... */ - lt_info("%s: lirmp: lircfd select: %m\n", __func__); + hal_info("%s: lirmp: lircfd select: %m\n", __func__); break; } @@ -375,7 +375,7 @@ static void *input_thread(void *) if (irmp_get_data (&d)) { nodec = 0; - lt_debug("irmp_get_data proto: %2d addr: 0x%04x cmd: 0x%04x fl: %d\n", + hal_debug("irmp_get_data proto: %2d addr: 0x%04x cmd: 0x%04x fl: %d\n", d.protocol, d.address, d.command, d.flags); /* todo: do we need to complete the loop if we already @@ -394,7 +394,7 @@ static void *input_thread(void *) } u.code = key_map[i].code; u.value = (d.flags & 0x1) + 1; - //lt_debug("uinput write: value: %d code: %d\n", u.value, u.code); + //hal_debug("uinput write: value: %d code: %d\n", u.value, u.code); last_code = u.code; write(uinput, &u, sizeof(u)); if (aotom_fd > -1) { @@ -425,7 +425,7 @@ void start_input_thread(void) { if (pthread_create(&thread, 0, input_thread, NULL) != 0) { - lt_info("%s: LIRC/IRMP input thread pthread_create: %m\n", __func__); + hal_info("%s: LIRC/IRMP input thread pthread_create: %m\n", __func__); thread_running = 0; return; } diff --git a/libspark/playback_libeplayer3.cpp b/libspark/playback_libeplayer3.cpp index b1e9ac3..644da57 100644 --- a/libspark/playback_libeplayer3.cpp +++ b/libspark/playback_libeplayer3.cpp @@ -10,10 +10,10 @@ #include "player.h" #include "playback_libeplayer3.h" -#include "lt_debug.h" +#include "hal_debug.h" -#define lt_debug(args...) _lt_debug(HAL_DEBUG_PLAYBACK, this, args) -#define lt_info(args...) _lt_info(HAL_DEBUG_PLAYBACK, this, args) +#define hal_debug(args...) _hal_debug(HAL_DEBUG_PLAYBACK, this, args) +#define hal_info(args...) _hal_info(HAL_DEBUG_PLAYBACK, this, args) extern cAudio *audioDecoder; extern cVideo *videoDecoder; @@ -40,7 +40,7 @@ bool cPlayback::Open(playmode_t PlayMode) void cPlayback::Close(void) { - lt_info("%s\n", __func__); + hal_info("%s\n", __func__); //Dagobert: movieplayer does not call stop, it calls close ;) Stop(); @@ -63,7 +63,7 @@ bool cPlayback::Start(char *filename, int vpid, int vtype, int apid, int ac3, in bool isHTTP = false; no_probe = false; - lt_info("%s - filename=%s vpid=%u vtype=%d apid=%u ac3=%d\n", __func__, filename, vpid, vtype, apid, ac3); + hal_info("%s - filename=%s vpid=%u vtype=%d apid=%u ac3=%d\n", __func__, filename, vpid, vtype, apid, ac3); init_jump = -1; @@ -129,7 +129,7 @@ bool cPlayback::Start(char *filename, int vpid, int vtype, int apid, int ac3, in bool cPlayback::Stop(void) { - lt_info("%s playing %d\n", __func__, playing); + hal_info("%s playing %d\n", __func__, playing); player->Stop(); player->output.Close(); @@ -141,7 +141,7 @@ bool cPlayback::Stop(void) bool cPlayback::SetAPid(int pid, bool /* ac3 */) { - lt_info("%s\n", __func__); + hal_info("%s\n", __func__); return player->SwitchAudio(pid); } @@ -162,7 +162,7 @@ bool cPlayback::SetTeletextPid(int pid) bool cPlayback::SetSpeed(int speed) { - lt_info("%s playing %d speed %d\n", __func__, playing, speed); + hal_info("%s playing %d speed %d\n", __func__, playing, speed); if (!decoders_closed) { @@ -211,7 +211,7 @@ bool cPlayback::SetSpeed(int speed) bool cPlayback::GetSpeed(int &speed) const { - lt_debug("%s\n", __func__); + hal_debug("%s\n", __func__); speed = nPlaybackSpeed; return true; } @@ -225,7 +225,7 @@ void cPlayback::GetPts(uint64_t &pts) bool cPlayback::GetPosition(int &position, int &duration) { bool got_duration = false; - lt_debug("%s %d %d\n", __func__, position, duration); + hal_debug("%s %d %d\n", __func__, position, duration); /* hack: if the file is growing (timeshift), then determine its length * by comparing the mtime with the mtime of the xml file */ @@ -253,7 +253,7 @@ bool cPlayback::GetPosition(int &position, int &duration) return false; if (!player->isPlaying) { - lt_info("%s !!!!EOF!!!! < -1\n", __func__); + hal_info("%s !!!!EOF!!!! < -1\n", __func__); position = duration + 1000; // duration = 0; // this is stupid @@ -287,7 +287,7 @@ bool cPlayback::GetPosition(int &position, int &duration) bool cPlayback::SetPosition(int position, bool absolute) { - lt_info("%s %d\n", __func__, position); + hal_info("%s %d\n", __func__, position); if (!playing) { /* the calling sequence is: @@ -305,7 +305,7 @@ bool cPlayback::SetPosition(int position, bool absolute) void cPlayback::FindAllPids(int *pids, unsigned int *ac3flags, unsigned int *numpids, std::string *language) { - lt_info("%s\n", __func__); + hal_info("%s\n", __func__); unsigned int i = 0; std::vector tracks = player->manager.getAudioTracks(); @@ -320,7 +320,7 @@ void cPlayback::FindAllPids(int *pids, unsigned int *ac3flags, unsigned int *num void cPlayback::FindAllSubtitlePids(int *pids, unsigned int *numpids, std::string *language) { - lt_info("%s\n", __func__); + hal_info("%s\n", __func__); unsigned int i = 0; std::vector tracks = player->manager.getSubtitleTracks(); @@ -335,7 +335,7 @@ void cPlayback::FindAllSubtitlePids(int *pids, unsigned int *numpids, std::strin void cPlayback::FindAllTeletextsubtitlePids(int *pids, unsigned int *numpids, std::string *language, int *mags, int *pages) { - lt_info("%s\n", __func__); + hal_info("%s\n", __func__); unsigned int i = 0; std::vector tracks = player->manager.getTeletextTracks(); @@ -396,7 +396,7 @@ void cPlayback::GetMetadata(std::vector &keys, std::vectorGetAudioPid(); } diff --git a/libspark/record.cpp b/libspark/record.cpp index 7b626c7..4232a3e 100644 --- a/libspark/record.cpp +++ b/libspark/record.cpp @@ -12,9 +12,9 @@ #include #include "record_lib.h" -#include "lt_debug.h" -#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_RECORD, this, args) -#define lt_info(args...) _lt_info(TRIPLE_DEBUG_RECORD, this, args) +#include "hal_debug.h" +#define hal_debug(args...) _hal_debug(HAL_DEBUG_RECORD, this, args) +#define hal_info(args...) _hal_info(HAL_DEBUG_RECORD, this, args) /* helper function to call the cpp thread loop */ void *execute_record_thread(void *c) @@ -33,7 +33,7 @@ void *execute_writer_thread(void *c) cRecord::cRecord(int num, int bs_dmx, int bs) { - lt_info("%s %d\n", __func__, num); + hal_info("%s %d\n", __func__, num); dmx = NULL; record_thread_running = false; file_fd = -1; @@ -47,14 +47,14 @@ cRecord::cRecord(int num, int bs_dmx, int bs) cRecord::~cRecord() { - lt_info("%s: calling ::Stop()\n", __func__); + hal_info("%s: calling ::Stop()\n", __func__); Stop(); - lt_info("%s: end\n", __func__); + hal_info("%s: end\n", __func__); } bool cRecord::Open(void) { - lt_info("%s\n", __func__); + hal_info("%s\n", __func__); exit_flag = RECORD_STOPPED; return true; } @@ -63,13 +63,13 @@ bool cRecord::Open(void) // unused void cRecord::Close(void) { - lt_info("%s: \n", __func__); + hal_info("%s: \n", __func__); } #endif bool cRecord::Start(int fd, unsigned short vpid, unsigned short *apids, int numpids, uint64_t) { - lt_info("%s: fd %d, vpid 0x%03x\n", __func__, fd, vpid); + hal_info("%s: fd %d, vpid 0x%03x\n", __func__, fd, vpid); int i; if (!dmx) @@ -91,7 +91,7 @@ bool cRecord::Start(int fd, unsigned short vpid, unsigned short *apids, int nump { exit_flag = RECORD_FAILED_READ; errno = i; - lt_info("%s: error creating thread! (%m)\n", __func__); + hal_info("%s: error creating thread! (%m)\n", __func__); delete dmx; dmx = NULL; return false; @@ -102,10 +102,10 @@ bool cRecord::Start(int fd, unsigned short vpid, unsigned short *apids, int nump bool cRecord::Stop(void) { - lt_info("%s\n", __func__); + hal_info("%s\n", __func__); if (exit_flag != RECORD_RUNNING) - lt_info("%s: status not RUNNING? (%d)\n", __func__, exit_flag); + hal_info("%s: status not RUNNING? (%d)\n", __func__, exit_flag); exit_flag = RECORD_STOPPED; if (record_thread_running) @@ -114,7 +114,7 @@ bool cRecord::Stop(void) /* We should probably do that from the destructor... */ if (!dmx) - lt_info("%s: dmx == NULL?\n", __func__); + hal_info("%s: dmx == NULL?\n", __func__); else delete dmx; dmx = NULL; @@ -122,7 +122,7 @@ bool cRecord::Stop(void) if (file_fd != -1) close(file_fd); else - lt_info("%s: file_fd not open??\n", __func__); + hal_info("%s: file_fd not open??\n", __func__); file_fd = -1; return true; } @@ -133,9 +133,9 @@ bool cRecord::ChangePids(unsigned short /*vpid*/, unsigned short *apids, int num int j; bool found; unsigned short pid; - lt_info("%s\n", __func__); + hal_info("%s\n", __func__); if (!dmx) { - lt_info("%s: DMX = NULL\n", __func__); + hal_info("%s: DMX = NULL\n", __func__); return false; } pids = dmx->pesfds; @@ -169,9 +169,9 @@ bool cRecord::ChangePids(unsigned short /*vpid*/, unsigned short *apids, int num bool cRecord::AddPid(unsigned short pid) { std::vector pids; - lt_info("%s: \n", __func__); + hal_info("%s: \n", __func__); if (!dmx) { - lt_info("%s: DMX = NULL\n", __func__); + hal_info("%s: DMX = NULL\n", __func__); return false; } pids = dmx->pesfds; @@ -210,7 +210,7 @@ void cRecord::WriterThread() void cRecord::RecordThread() { - lt_info("%s: begin\n", __func__); + hal_info("%s: begin\n", __func__); char threadname[17]; strncpy(threadname, "RecordThread", sizeof(threadname)); threadname[16] = 0; @@ -223,20 +223,20 @@ void cRecord::RecordThread() struct aiocb a; buf = (uint8_t *)malloc(bufsize); - lt_info("BUFSIZE=0x%x READSIZE=0x%x\n", bufsize, readsize); + hal_info("BUFSIZE=0x%x READSIZE=0x%x\n", bufsize, readsize); if (!buf) { exit_flag = RECORD_FAILED_MEMORY; - lt_info("%s: unable to allocate buffer! (out of memory)\n", __func__); + hal_info("%s: unable to allocate buffer! (out of memory)\n", __func__); if (failureCallback) failureCallback(failureData); - lt_info("%s: end\n", __func__); + hal_info("%s: end\n", __func__); pthread_exit(NULL); } int val = fcntl(file_fd, F_GETFL); if (fcntl(file_fd, F_SETFL, val|O_APPEND)) - lt_info("%s: O_APPEND? (%m)\n", __func__); + hal_info("%s: O_APPEND? (%m)\n", __func__); memset(&a, 0, sizeof(a)); a.aio_fildes = file_fd; @@ -251,20 +251,20 @@ void cRecord::RecordThread() if (buf_pos < bufsize) { if (overflow_count) { - lt_info("%s: Overflow cleared after %d iterations\n", __func__, overflow_count); + hal_info("%s: Overflow cleared after %d iterations\n", __func__, overflow_count); overflow_count = 0; } int toread = bufsize - buf_pos; if (toread > readsize) toread = readsize; ssize_t s = dmx->Read(buf + buf_pos, toread, 50); - lt_debug("%s: buf_pos %6d s %6d / %6d\n", __func__, + hal_debug("%s: buf_pos %6d s %6d / %6d\n", __func__, buf_pos, (int)s, bufsize - buf_pos); if (s < 0) { if (errno != EAGAIN && (errno != EOVERFLOW || !overflow)) { - lt_info("%s: read failed: %m\n", __func__); + hal_info("%s: read failed: %m\n", __func__); exit_flag = RECORD_FAILED_READ; state = REC_STATUS_OVERFLOW; break; @@ -291,13 +291,13 @@ void cRecord::RecordThread() overflow_count = 0; overflow = true; if (!(overflow_count % 10)) - lt_info("%s: buffer full! Overflow? (%d)\n", __func__, ++overflow_count); + hal_info("%s: buffer full! Overflow? (%d)\n", __func__, ++overflow_count); state = REC_STATUS_SLOW; } r = aio_error(&a); if (r == EINPROGRESS) { - lt_debug("%s: aio in progress, free: %d\n", __func__, bufsize - buf_pos); + hal_debug("%s: aio in progress, free: %d\n", __func__, bufsize - buf_pos); continue; } // not calling aio_return causes a memory leak --martii @@ -305,11 +305,11 @@ void cRecord::RecordThread() if (r < 0) { exit_flag = RECORD_FAILED_FILE; - lt_debug("%s: aio_return = %d (%m)\n", __func__, r); + hal_debug("%s: aio_return = %d (%m)\n", __func__, r); break; } else - lt_debug("%s: aio_return = %d, free: %d\n", __func__, r, bufsize - buf_pos); + hal_debug("%s: aio_return = %d, free: %d\n", __func__, r, bufsize - buf_pos); if (posix_fadvise(file_fd, 0, 0, POSIX_FADV_DONTNEED)) perror("posix_fadvise"); if (queued) @@ -323,7 +323,7 @@ void cRecord::RecordThread() r = aio_write(&a); if (r) { - lt_info("%s: aio_write %d (%m)\n", __func__, r); + hal_info("%s: aio_write %d (%m)\n", __func__, r); exit_flag = RECORD_FAILED_FILE; break; } @@ -331,7 +331,7 @@ void cRecord::RecordThread() dmx->Stop(); while (true) /* write out the unwritten buffer content */ { - lt_debug("%s: run-out write, buf_pos %d\n", __func__, buf_pos); + hal_debug("%s: run-out write, buf_pos %d\n", __func__, buf_pos); r = aio_error(&a); if (r == EINPROGRESS) { @@ -342,7 +342,7 @@ void cRecord::RecordThread() if (r < 0) { exit_flag = RECORD_FAILED_FILE; - lt_info("%s: aio_result: %d (%m)\n", __func__, r); + hal_info("%s: aio_result: %d (%m)\n", __func__, r); break; } if (!queued) @@ -372,7 +372,7 @@ void cRecord::RecordThread() if ((exit_flag != RECORD_STOPPED) && failureCallback) failureCallback(failureData); - lt_info("%s: end\n", __func__); + hal_info("%s: end\n", __func__); pthread_exit(NULL); } diff --git a/libspark/video.cpp b/libspark/video.cpp index f4c0b34..a7b56f2 100644 --- a/libspark/video.cpp +++ b/libspark/video.cpp @@ -37,7 +37,7 @@ #include #include #include "video_lib.h" -#include "lt_debug.h" +#include "hal_debug.h" #include @@ -48,18 +48,18 @@ extern "C" #include } -#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_VIDEO, this, args) -#define lt_info(args...) _lt_info(TRIPLE_DEBUG_VIDEO, this, args) -#define lt_debug_c(args...) _lt_debug(TRIPLE_DEBUG_VIDEO, NULL, args) -#define lt_info_c(args...) _lt_info(TRIPLE_DEBUG_VIDEO, NULL, args) +#define hal_debug(args...) _hal_debug(HAL_DEBUG_VIDEO, this, args) +#define hal_info(args...) _hal_info(HAL_DEBUG_VIDEO, this, args) +#define hal_debug_c(args...) _hal_debug(HAL_DEBUG_VIDEO, NULL, args) +#define hal_info_c(args...) _hal_info(HAL_DEBUG_VIDEO, NULL, args) #define fop(cmd, args...) ({ \ int _r; \ if (fd >= 0) { \ if ((_r = ::cmd(fd, args)) < 0) \ - lt_info(#cmd"(fd, "#args")\n"); \ + hal_info(#cmd"(fd, "#args")\n"); \ else \ - lt_debug(#cmd"(fd, "#args")\n");\ + hal_debug(#cmd"(fd, "#args")\n");\ } \ else { _r = fd; } \ _r; \ @@ -133,17 +133,17 @@ static int hdmi_out(bool enable) { struct stmfbio_output_configuration out; int ret = -1; - lt_info_c("%s(%d)\n", __func__, enable); + hal_info_c("%s(%d)\n", __func__, enable); int fb = open("/dev/fb0", O_RDWR); if (fb < 0) { - lt_debug_c("%s: can't open /dev/fb0 (%m)\n", __func__); + hal_debug_c("%s: can't open /dev/fb0 (%m)\n", __func__); return -1; } out.outputid = STMFBIO_OUTPUTID_MAIN; if (ioctl(fb, STMFBIO_GET_OUTPUT_CONFIG, &out) < 0) { - lt_debug_c("%s: STMFBIO_GET_OUTPUT_CONFIG (%m)\n", __func__); + hal_debug_c("%s: STMFBIO_GET_OUTPUT_CONFIG (%m)\n", __func__); goto out; } hdmi_enabled = enable; @@ -157,7 +157,7 @@ static int hdmi_out(bool enable) ret = ioctl(fb, STMFBIO_SET_OUTPUT_CONFIG, &out); if (ret < 0) - _lt_debug(TRIPLE_DEBUG_VIDEO, NULL, "%s: STMFBIO_SET_OUTPUT_CONFIG (%m)\n", __func__); + _hal_debug(HAL_DEBUG_VIDEO, NULL, "%s: STMFBIO_SET_OUTPUT_CONFIG (%m)\n", __func__); out: close(fb); return ret; @@ -300,7 +300,7 @@ int image_to_mpeg2(const char *image_name, const char *encode_name) cVideo::cVideo(int, void *, void *, unsigned int unit) { - lt_debug("%s unit %u\n", __func__, unit); + hal_debug("%s unit %u\n", __func__, unit); brightness = -1; contrast = -1; @@ -310,7 +310,7 @@ cVideo::cVideo(int, void *, void *, unsigned int unit) scartvoltage = -1; video_standby = 0; if (unit > 1) { - lt_info("%s: unit %d out of range, setting to 0\n", __func__, unit); + hal_info("%s: unit %d out of range, setting to 0\n", __func__, unit); devnum = 0; } else devnum = unit; @@ -326,7 +326,7 @@ cVideo::~cVideo(void) void cVideo::openDevice(void) { int n = 0; - lt_debug("#%d: %s\n", devnum, __func__); + hal_debug("#%d: %s\n", devnum, __func__); /* todo: this fd checking is racy, should be protected by a lock */ if (fd != -1) /* already open */ return; @@ -340,14 +340,14 @@ retry: if (++n < 10) goto retry; } - lt_info("#%d: %s cannot open %s: %m, retries %d\n", devnum, __func__, VDEV[devnum], n); + hal_info("#%d: %s cannot open %s: %m, retries %d\n", devnum, __func__, VDEV[devnum], n); } playstate = VIDEO_STOPPED; } void cVideo::closeDevice(void) { - lt_debug("%s\n", __func__); + hal_debug("%s\n", __func__); /* looks like sometimes close is unhappy about non-empty buffers */ Start(); if (fd >= 0) @@ -363,22 +363,22 @@ int cVideo::setAspectRatio(int aspect, int mode) int n; int mo = (mode < 0||mode > 3) ? 4 : mode; - lt_debug("%s: a:%d m:%d %s\n", __func__, aspect, mode, m[mo]); + hal_debug("%s: a:%d m:%d %s\n", __func__, aspect, mode, m[mo]); if (aspect > 3 || aspect == 0) - lt_info("%s: invalid aspect: %d\n", __func__, aspect); + hal_info("%s: invalid aspect: %d\n", __func__, aspect); else if (aspect > 0) /* -1 == don't set */ { - lt_debug("%s: /proc/stb/video/aspect -> %s\n", __func__, a[aspect]); + hal_debug("%s: /proc/stb/video/aspect -> %s\n", __func__, a[aspect]); n = proc_put("/proc/stb/video/aspect", a[aspect], strlen(a[aspect])); if (n < 0) - lt_info("%s: proc_put /proc/stb/video/aspect (%m)\n", __func__); + hal_info("%s: proc_put /proc/stb/video/aspect (%m)\n", __func__); } if (mode == -1) return 0; - lt_debug("%s: /proc/stb/video/policy -> %s\n", __func__, m[mo]); + hal_debug("%s: /proc/stb/video/policy -> %s\n", __func__, m[mo]); n = proc_put("/proc/stb/video/policy", m[mo], strlen(m[mo])); if (n < 0) return 1; @@ -396,10 +396,10 @@ int cVideo::getAspectRatio(void) } if (fop(ioctl, VIDEO_GET_SIZE, &s) < 0) { - lt_info("%s: VIDEO_GET_SIZE %m\n", __func__); + hal_info("%s: VIDEO_GET_SIZE %m\n", __func__); return -1; } - lt_debug("#%d: %s: %d\n", devnum, __func__, s.aspect_ratio); + hal_debug("#%d: %s: %d\n", devnum, __func__, s.aspect_ratio); return s.aspect_ratio * 2 + 1; } @@ -414,14 +414,14 @@ int cVideo::setCroppingMode(int /*vidDispMode_t format*/) f = format_string[format]; else f = "ILLEGAL format!"; - lt_debug("%s(%d) => %s\n", __FUNCTION__, format, f); + hal_debug("%s(%d) => %s\n", __FUNCTION__, format, f); return fop(ioctl, MPEG_VID_SET_DISPMODE, format); #endif } int cVideo::Start(void * /*PcrChannel*/, unsigned short /*PcrPid*/, unsigned short /*VideoPid*/, void * /*hChannel*/) { - lt_debug("#%d: %s playstate=%d\n", devnum, __func__, playstate); + hal_debug("#%d: %s playstate=%d\n", devnum, __func__, playstate); #if 0 if (playstate == VIDEO_PLAYING) return 0; @@ -430,7 +430,7 @@ int cVideo::Start(void * /*PcrChannel*/, unsigned short /*PcrPid*/, unsigned sho #endif /* implicitly do StopPicture() on video->Start() */ if (stillpicture) { - lt_info("%s: stillpicture == true, doing implicit StopPicture()\n", __func__); + hal_info("%s: stillpicture == true, doing implicit StopPicture()\n", __func__); stillpicture = false; Stop(1); } @@ -458,10 +458,10 @@ int cVideo::Start(void * /*PcrChannel*/, unsigned short /*PcrPid*/, unsigned sho int cVideo::Stop(bool blank) { - lt_debug("#%d: %s(%d)\n", devnum, __func__, blank); + hal_debug("#%d: %s(%d)\n", devnum, __func__, blank); if (stillpicture) { - lt_debug("%s: stillpicture == true\n", __func__); + hal_debug("%s: stillpicture == true\n", __func__); return -1; } playstate = blank ? VIDEO_STOPPED : VIDEO_FREEZED; @@ -479,25 +479,25 @@ int cVideo::setBlank(int) int cVideo::SetVideoSystem(int video_system, bool remember) { - lt_debug("%s(%d, %d)\n", __func__, video_system, remember); + hal_debug("%s(%d, %d)\n", __func__, video_system, remember); char current[32]; if (video_system > VIDEO_STD_MAX) { - lt_info("%s: video_system (%d) > VIDEO_STD_MAX (%d)\n", __func__, video_system, VIDEO_STD_MAX); + hal_info("%s: video_system (%d) > VIDEO_STD_MAX (%d)\n", __func__, video_system, VIDEO_STD_MAX); return -1; } int ret = proc_get("/proc/stb/video/videomode", current, 32); if (strcmp(current, vid_modes[video_system]) == 0) { - lt_info("%s: video_system %d (%s) already set, skipping\n", __func__, video_system, current); + hal_info("%s: video_system %d (%s) already set, skipping\n", __func__, video_system, current); return 0; } - lt_info("%s: old: '%s' new: '%s'\n", __func__, current, vid_modes[video_system]); + hal_info("%s: old: '%s' new: '%s'\n", __func__, current, vid_modes[video_system]); bool stopped = false; if (playstate == VIDEO_PLAYING) { - lt_info("%s: playstate == VIDEO_PLAYING, stopping video\n", __func__); + hal_info("%s: playstate == VIDEO_PLAYING, stopping video\n", __func__); Stop(); stopped = true; } @@ -519,7 +519,7 @@ int cVideo::GetVideoSystem(void) if (strcmp(current, vid_modes[i]) == 0) return i; } - lt_info("%s: could not find '%s' mode, returning VIDEO_STD_720P50\n", __func__, current); + hal_info("%s: could not find '%s' mode, returning VIDEO_STD_720P50\n", __func__, current); return VIDEO_STD_720P50; } @@ -528,7 +528,7 @@ void cVideo::GetVideoSystemFormatName(cs_vs_format_t *format, int system) if (system == -1) system = GetVideoSystem(); if (system < 0 || system > VIDEO_STD_1080P50) { - lt_info("%s: invalid system %d\n", __func__, system); + hal_info("%s: invalid system %d\n", __func__, system); strcpy(format->format, "invalid"); } else strcpy(format->format, vid_modes[system]); @@ -541,10 +541,10 @@ int cVideo::getPlayState(void) void cVideo::SetVideoMode(analog_mode_t mode) { - lt_debug("#%d: %s(%d)\n", devnum, __func__, mode); + hal_debug("#%d: %s(%d)\n", devnum, __func__, mode); if (!(mode & ANALOG_SCART_MASK)) { - lt_debug("%s: non-SCART mode ignored\n", __func__); + hal_debug("%s: non-SCART mode ignored\n", __func__); return; } const char *m; @@ -557,7 +557,7 @@ void cVideo::SetVideoMode(analog_mode_t mode) m = "rgb"; break; default: - lt_info("%s unknown mode %d\n", __func__, mode); + hal_info("%s unknown mode %d\n", __func__, mode); m = "rgb"; break; /* default to rgb */ } @@ -566,7 +566,7 @@ void cVideo::SetVideoMode(analog_mode_t mode) void cVideo::ShowPicture(const char * fname, const char *_destname) { - lt_debug("%s(%s)\n", __func__, fname); + hal_debug("%s(%s)\n", __func__, fname); //static const unsigned char pes_header[] = { 0x00, 0x00, 0x01, 0xE0, 0x00, 0x00, 0x80, 0x00, 0x00 }; static const unsigned char pes_header[] = {0x0, 0x0, 0x1, 0xe0, 0x00, 0x00, 0x80, 0x80, 0x5, 0x21, 0x0, 0x1, 0x0, 0x1}; static const unsigned char seq_end[] = { 0x00, 0x00, 0x01, 0xB7 }; @@ -577,7 +577,7 @@ void cVideo::ShowPicture(const char * fname, const char *_destname) if (video_standby) { /* does not work and the driver does not seem to like it */ - lt_info("%s: video_standby == true\n", __func__); + hal_info("%s: video_standby == true\n", __func__); return; } const char *lastDot = strrchr(fname, '.'); @@ -590,7 +590,7 @@ void cVideo::ShowPicture(const char * fname, const char *_destname) strcpy(destname, "/tmp/cache"); if (stat(fname, &st2)) { - lt_info("%s: could not stat %s (%m)\n", __func__, fname); + hal_info("%s: could not stat %s (%m)\n", __func__, fname); return; } mkdir(destname, 0755); @@ -618,7 +618,7 @@ void cVideo::ShowPicture(const char * fname, const char *_destname) mfd = open(destname, O_RDONLY); if (mfd < 0) { - lt_info("%s cannot open %s: %m\n", __func__, destname); + hal_info("%s cannot open %s: %m\n", __func__, destname); goto out; } fstat(mfd, &st); @@ -631,13 +631,13 @@ void cVideo::ShowPicture(const char * fname, const char *_destname) stillpicture = true; if (ioctl(fd, VIDEO_SET_FORMAT, VIDEO_FORMAT_16_9) < 0) - lt_info("%s: VIDEO_SET_FORMAT failed (%m)\n", __func__); + hal_info("%s: VIDEO_SET_FORMAT failed (%m)\n", __func__); bool seq_end_avail = false; off_t pos=0; unsigned char *iframe = (unsigned char *)malloc((st.st_size < 8192) ? 8192 : st.st_size); if (! iframe) { - lt_info("%s: malloc failed (%m)\n", __func__); + hal_info("%s: malloc failed (%m)\n", __func__); goto out; } read(mfd, iframe, st.st_size); @@ -665,14 +665,14 @@ void cVideo::ShowPicture(const char * fname, const char *_destname) void cVideo::StopPicture() { - lt_debug("%s\n", __func__); + hal_debug("%s\n", __func__); stillpicture = false; Stop(1); } void cVideo::Standby(unsigned int bOn) { - lt_debug("%s(%d)\n", __func__, bOn); + hal_debug("%s(%d)\n", __func__, bOn); if (bOn) { closeDevice(); @@ -721,7 +721,7 @@ int cVideo::getBlank(void) free(line); fclose(f); int ret = (count == lastcount); /* no new decode -> return 1 */ - lt_debug("#%d: %s: %d (irq++: %d)\n", devnum, __func__, ret, count - lastcount); + hal_debug("#%d: %s: %d (irq++: %d)\n", devnum, __func__, ret, count - lastcount); lastcount = count; return ret; } @@ -738,7 +738,7 @@ void cVideo::VideoParamWatchdog(void) ioctl(fd, MPEG_VID_GET_V_INFO_RAW, &v_info); if (_v_info != v_info) { - lt_debug("%s params changed. old: %08x new: %08x\n", __FUNCTION__, _v_info, v_info); + hal_debug("%s params changed. old: %08x new: %08x\n", __FUNCTION__, _v_info, v_info); setAspectRatio(-1, -1); } _v_info = v_info; @@ -753,7 +753,7 @@ void cVideo::Pig(int x, int y, int w, int h, int osd_w, int osd_h, int startx, i * TODO: check this in the driver sources */ int xres = 720; /* proc_get_hex("/proc/stb/vmpeg/0/xres") */ int yres = 576; /* proc_get_hex("/proc/stb/vmpeg/0/yres") */ - lt_debug("#%d %s: x:%d y:%d w:%d h:%d ow:%d oh:%d\n", devnum, __func__, x, y, w, h, osd_w, osd_h); + hal_debug("#%d %s: x:%d y:%d w:%d h:%d ow:%d oh:%d\n", devnum, __func__, x, y, w, h, osd_w, osd_h); if (x == -1 && y == -1 && w == -1 && h == -1) { _w = xres; @@ -779,7 +779,7 @@ void cVideo::Pig(int x, int y, int w, int h, int osd_w, int osd_h, int startx, i _w /= 1280; _h /= 720; } - lt_debug("#%d %s: x:%d y:%d w:%d h:%d xr:%d yr:%d\n", devnum, __func__, _x, _y, _w, _h, xres, yres); + hal_debug("#%d %s: x:%d y:%d w:%d h:%d xr:%d yr:%d\n", devnum, __func__, _x, _y, _w, _h, xres, yres); sprintf(buffer, "%x %x %x %x", _x, _y, _w, _h); proc_put(VMPEG_dst_all[devnum], buffer, strlen(buffer)); } @@ -831,12 +831,12 @@ void cVideo::getPictureInfo(int &width, int &height, int &rate) rate = rate2csapi(r); height = s.h; width = s.w; - lt_debug("#%d: %s: rate: %d, width: %d height: %d\n", devnum, __func__, rate, width, height); + hal_debug("#%d: %s: rate: %d, width: %d height: %d\n", devnum, __func__, rate, width, height); } void cVideo::SetSyncMode(AVSYNC_TYPE mode) { - lt_debug("%s %d\n", __func__, mode); + hal_debug("%s %d\n", __func__, mode); /* * { 0, LOCALE_OPTIONS_OFF }, * { 1, LOCALE_OPTIONS_ON }, @@ -861,7 +861,7 @@ int cVideo::SetStreamType(VIDEO_FORMAT type) "VIDEO_FORMAT_PNG" }; int t; - lt_debug("#%d: %s type=%s\n", devnum, __func__, VF[type]); + hal_debug("#%d: %s type=%s\n", devnum, __func__, VF[type]); switch (type) { @@ -884,7 +884,7 @@ int cVideo::SetStreamType(VIDEO_FORMAT type) } if (ioctl(fd, VIDEO_SET_STREAMTYPE, t) < 0) - lt_info("%s VIDEO_SET_STREAMTYPE(%d) failed: %m\n", __func__, t); + hal_info("%s VIDEO_SET_STREAMTYPE(%d) failed: %m\n", __func__, t); return 0; } @@ -892,13 +892,13 @@ int64_t cVideo::GetPTS(void) { int64_t pts = 0; if (ioctl(fd, VIDEO_GET_PTS, &pts) < 0) - lt_info("%s: GET_PTS failed (%m)\n", __func__); + hal_info("%s: GET_PTS failed (%m)\n", __func__); return pts; } void cVideo::SetDemux(cDemux *) { - lt_debug("#%d %s not implemented yet\n", devnum, __func__); + hal_debug("#%d %s not implemented yet\n", devnum, __func__); } void cVideo::SetControl(int control, int value) { @@ -1177,7 +1177,7 @@ static const uint32_t yuv2rgbtable_bv[256] = { /* TODO: aspect ratio correction and PIP */ bool cVideo::GetScreenImage(unsigned char * &video, int &xres, int &yres, bool get_video, bool get_osd, bool scale_to_video) { - lt_info("%s: get_video: %d get_osd: %d scale_to_video: %d\n", + hal_info("%s: get_video: %d get_osd: %d scale_to_video: %d\n", __func__, get_video, get_osd, scale_to_video); int fbfd = -1, bpafd = -1; @@ -1189,26 +1189,26 @@ bool cVideo::GetScreenImage(unsigned char * &video, int &xres, int &yres, bool g /* this hints at incorrect usage */ if (video != NULL) - lt_info("%s: WARNING, video != NULL?\n", __func__); + hal_info("%s: WARNING, video != NULL?\n", __func__); fbfd = open("/dev/fb0", O_RDWR); if (fbfd < 0) { - lt_info("%s: cannot open open /dev/fb0 (%m)\n", __func__); + hal_info("%s: cannot open open /dev/fb0 (%m)\n", __func__); return false; } if (ioctl(fbfd, FBIOGET_FSCREENINFO, &fix_screeninfo) == -1) - lt_info("%s: FBIOGET_FSCREENINFO (%m)\n", __func__); + hal_info("%s: FBIOGET_FSCREENINFO (%m)\n", __func__); if (ioctl(fbfd, FBIOGET_VSCREENINFO, &var_screeninfo) == -1) - lt_info("%s: FBIOGET_VSCREENINFO (%m)\n", __func__); + hal_info("%s: FBIOGET_VSCREENINFO (%m)\n", __func__); if (var_screeninfo.bits_per_pixel != 32) { - lt_info("%s: only 32bit framebuffer supported.\n", __func__); + hal_info("%s: only 32bit framebuffer supported.\n", __func__); close(fbfd); return false; } if (fix_screeninfo.line_length - (var_screeninfo.xres * 4) != 0) { - lt_info("%s: framebuffer with offset not supported.\n", __func__); + hal_info("%s: framebuffer with offset not supported.\n", __func__); close(fbfd); return false; } @@ -1255,7 +1255,7 @@ bool cVideo::GetScreenImage(unsigned char * &video, int &xres, int &yres, bool g bpafd = open("/dev/bpamem0", O_RDWR | O_CLOEXEC); if (bpafd < 0) { - lt_info("%s: cannot open /dev/bpamem0: %m\n", __func__); + hal_info("%s: cannot open /dev/bpamem0: %m\n", __func__); goto error_cleanup; } BPAMemAllocMemData bpa_data; @@ -1263,7 +1263,7 @@ bool cVideo::GetScreenImage(unsigned char * &video, int &xres, int &yres, bool g bpa_data.mem_size = outmem + osdmem + vidmem + 4096; if (ioctl(bpafd, BPAMEMIO_ALLOCMEM, &bpa_data)) { - lt_info("%s: cannot allocate %lu bytes of BPA2 memory\n", __func__, bpa_data.mem_size); + hal_info("%s: cannot allocate %lu bytes of BPA2 memory\n", __func__, bpa_data.mem_size); goto error_cleanup; } close(bpafd); @@ -1273,13 +1273,13 @@ bool cVideo::GetScreenImage(unsigned char * &video, int &xres, int &yres, bool g bpafd = open(bpa_mem_device, O_RDWR | O_CLOEXEC); if (bpafd < 0) { - lt_info("%s: cannot open secondary bpamem device %s: %m\n", __func__, bpa_mem_device); + hal_info("%s: cannot open secondary bpamem device %s: %m\n", __func__, bpa_mem_device); goto error_cleanup; } bpa = (uint8_t *)mmap(0, bpa_data.mem_size, PROT_WRITE|PROT_READ, MAP_SHARED, bpafd, 0); if (bpa == MAP_FAILED) { - lt_info("%s: cannot map from bpamem: %m\n", __func__); + hal_info("%s: cannot map from bpamem: %m\n", __func__); ioctl(bpafd, BPAMEMIO_FREEMEM); goto error_cleanup; } @@ -1318,19 +1318,19 @@ bool cVideo::GetScreenImage(unsigned char * &video, int &xres, int &yres, bool g fclose(pipe); } if (vid_phys_addr == 0) { - lt_info("%s: primary display pane not found in /proc/bpa2\n", __func__); + hal_info("%s: primary display pane not found in /proc/bpa2\n", __func__); } mfd = open("/dev/mem", O_RDWR | O_CLOEXEC); if (mfd < 0) { - lt_info("%s: cannot open open /dev/mem (%m)\n", __func__); + hal_info("%s: cannot open open /dev/mem (%m)\n", __func__); goto error_cleanup; } - lt_info("%s: Using bpa2 part LMI_VID - 0x%lx %lu\n", __func__, vid_phys_addr, vid_mem_size); + hal_info("%s: Using bpa2 part LMI_VID - 0x%lx %lu\n", __func__, vid_phys_addr, vid_mem_size); decode_surface = (uint8_t *)mmap(0, vid_mem_size, PROT_READ, MAP_SHARED, mfd, vid_phys_addr); if (decode_surface == MAP_FAILED) { - lt_info("%s: cannot mmap /dev/mem for VIDEO (%m)\n", __func__); + hal_info("%s: cannot mmap /dev/mem for VIDEO (%m)\n", __func__); close(mfd); goto error_cleanup; } @@ -1503,7 +1503,7 @@ bool cVideo::GetScreenImage(unsigned char * &video, int &xres, int &yres, bool g { uint8_t *lfb = (uint8_t *)mmap(0, fix_screeninfo.smem_len, PROT_READ, MAP_SHARED, fbfd, 0); if (lfb == MAP_FAILED) - lt_info("%s: mmap fb memory failed (%m)\n", __func__); + hal_info("%s: mmap fb memory failed (%m)\n", __func__); else { memcpy(osd, lfb, fix_screeninfo.line_length*var_screeninfo.yres); munmap(lfb, fix_screeninfo.smem_len); @@ -1566,7 +1566,7 @@ bool cVideo::GetScreenImage(unsigned char * &video, int &xres, int &yres, bool g blt_data.srcMemSize = vidmem; blt_data.dstMemSize = outmem; if (ioctl(fbfd, STMFBIO_BLT_EXTERN, &blt_data) < 0) - lt_info("%s: STMFBIO_BLT_EXTERN video: %m\n", __func__); + hal_info("%s: STMFBIO_BLT_EXTERN video: %m\n", __func__); } if (get_osd) { @@ -1595,7 +1595,7 @@ bool cVideo::GetScreenImage(unsigned char * &video, int &xres, int &yres, bool g blt_data.srcMemSize = osdmem; blt_data.dstMemSize = outmem; if (ioctl(fbfd, STMFBIO_BLT_EXTERN, &blt_data) < 0) - lt_info("%s: STMFBIO_BLT_EXTERN osd: %m\n", __func__); + hal_info("%s: STMFBIO_BLT_EXTERN osd: %m\n", __func__); } ioctl(fbfd, STMFBIO_SYNC_BLITTER); @@ -1603,7 +1603,7 @@ bool cVideo::GetScreenImage(unsigned char * &video, int &xres, int &yres, bool g if (video) memcpy(video, bpa, outmem); else - lt_info("%s: could not allocate screenshot buffer (%d bytes)\n", __func__, xres * yres * 4); + hal_info("%s: could not allocate screenshot buffer (%d bytes)\n", __func__, xres * yres * 4); munmap(bpa, bpa_data.mem_size); ioctl(bpafd, BPAMEMIO_FREEMEM); close(bpafd); diff --git a/libtriple/README.libtriple b/libtriple/README.libtriple index c13dbf8..1f756dc 100644 --- a/libtriple/README.libtriple +++ b/libtriple/README.libtriple @@ -23,8 +23,8 @@ HAL_DEBUG=... - controls various debugging levels in libtriple record 0x80 all 0xff multiple levels are added / ORed together, so if you want to - debug record and playback code, do "export TRIPLE_DEBUG=0x88" - for audio & video use TRIPLE_DEBUG=0x3 + debug record and playback code, do "export HAL_DEBUG=0x88" + for audio & video use HAL_DEBUG=0x3 DSP_DEVICE MIX_DEVICE - alternative audio devices for the audioplayer and internet diff --git a/libtriple/audio_td.cpp b/libtriple/audio_td.cpp index eb21456..67c293e 100644 --- a/libtriple/audio_td.cpp +++ b/libtriple/audio_td.cpp @@ -9,9 +9,9 @@ #include #define AUDIO_DEVICE "/dev/" DEVICE_NAME_AUDIO #include "audio_td.h" -#include "lt_debug.h" -#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_AUDIO, this, args) -#define lt_info(args...) _lt_info(TRIPLE_DEBUG_AUDIO, this, args) +#include "hal_debug.h" +#define hal_debug(args...) _hal_debug(HAL_DEBUG_AUDIO, this, args) +#define hal_info(args...) _hal_info(HAL_DEBUG_AUDIO, this, args) #include @@ -36,12 +36,12 @@ void cAudio::openDevice(void) if (fd < 0) { if ((fd = open(AUDIO_DEVICE, O_RDWR)) < 0) - lt_info("openDevice: open failed (%m)\n"); + hal_info("openDevice: open failed (%m)\n"); fcntl(fd, F_SETFD, FD_CLOEXEC); do_mute(true, false); } else - lt_info("openDevice: already open (fd = %d)\n", fd); + hal_info("openDevice: already open (fd = %d)\n", fd); } void cAudio::closeDevice(void) @@ -59,14 +59,14 @@ void cAudio::closeDevice(void) int cAudio::do_mute(bool enable, bool remember) { - lt_debug("%s(%d, %d)\n", __FUNCTION__, enable, remember); + hal_debug("%s(%d, %d)\n", __FUNCTION__, enable, remember); int avsfd; int ret; if (remember) Muted = enable; ret = ioctl(fd, MPEG_AUD_SET_MUTE, enable); if (ret < 0) - lt_info("%s(%d) failed (%m)\n", __FUNCTION__, (int)enable); + hal_info("%s(%d) failed (%m)\n", __FUNCTION__, (int)enable); /* are we using alternative DSP / mixer? */ if (clipfd != -1 || mixer_fd != -1) @@ -110,7 +110,7 @@ int cAudio::setVolume(unsigned int left, unsigned int right) tmp = left << 8 | right; ret = ioctl(mixer_fd, MIXER_WRITE(mixer_num), &tmp); if (ret == -1) - lt_info("%s: MIXER_WRITE(%d),%04x: %m\n", __func__, mixer_num, tmp); + hal_info("%s: MIXER_WRITE(%d),%04x: %m\n", __func__, mixer_num, tmp); return ret; } // if (settings.volume_type == CControld::TYPE_OST || forcetype == (int)CControld::TYPE_OST) @@ -124,7 +124,7 @@ int cAudio::setVolume(unsigned int left, unsigned int right) vol.lfe = v; ret = ioctl(fd, MPEG_AUD_SET_VOL, &vol); if (ret < 0) - lt_info("setVolume MPEG_AUD_SET_VOL failed (%m)\n"); + hal_info("setVolume MPEG_AUD_SET_VOL failed (%m)\n"); return ret; } #if 0 @@ -166,7 +166,7 @@ bool cAudio::Pause(bool /*Pcm*/) void cAudio::SetSyncMode(AVSYNC_TYPE Mode) { - lt_debug("%s %d\n", __FUNCTION__, Mode); + hal_debug("%s %d\n", __FUNCTION__, Mode); switch (Mode) { case 0: @@ -181,11 +181,11 @@ void cAudio::SetSyncMode(AVSYNC_TYPE Mode) void cAudio::SetStreamType(AUDIO_FORMAT type) { int bypass_disable; - lt_debug("%s %d\n", __FUNCTION__, type); + hal_debug("%s %d\n", __FUNCTION__, type); StreamType = type; if (StreamType != AUDIO_FMT_DOLBY_DIGITAL && StreamType != AUDIO_FMT_MPEG && StreamType != AUDIO_FMT_MPG1) - lt_info("%s unhandled AUDIO_FORMAT %d\n", __FUNCTION__, StreamType); + hal_info("%s unhandled AUDIO_FORMAT %d\n", __FUNCTION__, StreamType); bypass_disable = (StreamType != AUDIO_FMT_DOLBY_DIGITAL); setBypassMode(bypass_disable); @@ -198,7 +198,7 @@ void cAudio::SetStreamType(AUDIO_FORMAT type) int cAudio::setChannel(int channel) { - lt_debug("%s %d\n", __FUNCTION__, channel); + hal_debug("%s %d\n", __FUNCTION__, channel); return 0; }; @@ -208,9 +208,9 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int little_endian) unsigned int devmask, stereo, usable; const char *dsp_dev = getenv("DSP_DEVICE"); const char *mix_dev = getenv("MIX_DEVICE"); - lt_debug("%s ch %d srate %d bits %d le %d\n", __FUNCTION__, ch, srate, bits, little_endian); + hal_debug("%s ch %d srate %d bits %d le %d\n", __FUNCTION__, ch, srate, bits, little_endian); if (clipfd >= 0) { - lt_info("%s: clipfd already opened (%d)\n", __FUNCTION__, clipfd); + hal_info("%s: clipfd already opened (%d)\n", __FUNCTION__, clipfd); return -1; } mixer_num = -1; @@ -226,17 +226,17 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int little_endian) */ if ((!dsp_dev) || (access(dsp_dev, W_OK))) { if (dsp_dev) - lt_info("%s: DSP_DEVICE is set (%s) but cannot be opened," + hal_info("%s: DSP_DEVICE is set (%s) but cannot be opened," " fall back to /dev/sound/dsp\n", __func__, dsp_dev); dsp_dev = "/dev/sound/dsp"; } - lt_info("%s: dsp_dev %s mix_dev %s\n", __func__, dsp_dev, mix_dev); /* NULL mix_dev is ok */ + hal_info("%s: dsp_dev %s mix_dev %s\n", __func__, dsp_dev, mix_dev); /* NULL mix_dev is ok */ /* the tdoss dsp driver seems to work only on the second open(). really. */ clipfd = open(dsp_dev, O_WRONLY); close(clipfd); clipfd = open(dsp_dev, O_WRONLY); if (clipfd < 0) { - lt_info("%s open %s: %m\n", dsp_dev, __FUNCTION__); + hal_info("%s open %s: %m\n", dsp_dev, __FUNCTION__); return -1; } fcntl(clipfd, F_SETFD, FD_CLOEXEC); @@ -259,21 +259,21 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int little_endian) mixer_fd = open(mix_dev, O_RDWR); if (mixer_fd < 0) { - lt_info("%s: open mixer %s failed (%m)\n", __func__, mix_dev); + hal_info("%s: open mixer %s failed (%m)\n", __func__, mix_dev); /* not a real error */ return 0; } if (ioctl(mixer_fd, SOUND_MIXER_READ_DEVMASK, &devmask) == -1) { - lt_info("%s: SOUND_MIXER_READ_DEVMASK %m\n", __func__); + hal_info("%s: SOUND_MIXER_READ_DEVMASK %m\n", __func__); devmask = 0; } if (ioctl(mixer_fd, SOUND_MIXER_READ_STEREODEVS, &stereo) == -1) { - lt_info("%s: SOUND_MIXER_READ_STEREODEVS %m\n", __func__); + hal_info("%s: SOUND_MIXER_READ_STEREODEVS %m\n", __func__); stereo = 0; } usable = devmask & stereo; if (usable == 0) { - lt_info("%s: devmask: %08x stereo: %08x, no usable dev :-(\n", + hal_info("%s: devmask: %08x stereo: %08x, no usable dev :-(\n", __func__, devmask, stereo); close(mixer_fd); mixer_fd = -1; @@ -282,13 +282,13 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int little_endian) /* __builtin_popcount needs GCC, it counts the set bits... */ if (__builtin_popcount (usable) != 1) { /* TODO: this code is not yet tested as I have only single-mixer devices... */ - lt_info("%s: more than one mixer control: devmask %08x stereo %08x\n" + hal_info("%s: more than one mixer control: devmask %08x stereo %08x\n" "%s: querying MIX_NUMBER environment variable...\n", __func__, devmask, stereo, __func__); const char *tmp = getenv("MIX_NUMBER"); if (tmp) mixer_num = atoi(tmp); - lt_info("%s: mixer_num is %d -> device %08x\n", + hal_info("%s: mixer_num is %d -> device %08x\n", __func__, (mixer_num >= 0) ? (1 << mixer_num) : 0); /* no error checking, you'd better know what you are doing... */ } else { @@ -306,22 +306,22 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int little_endian) int cAudio::WriteClip(unsigned char *buffer, int size) { int ret; - // lt_debug("cAudio::%s\n", __FUNCTION__); + // hal_debug("cAudio::%s\n", __FUNCTION__); if (clipfd <= 0) { - lt_info("%s: clipfd not yet opened\n", __FUNCTION__); + hal_info("%s: clipfd not yet opened\n", __FUNCTION__); return -1; } ret = write(clipfd, buffer, size); if (ret < 0) - lt_info("%s: write error (%m)\n", __FUNCTION__); + hal_info("%s: write error (%m)\n", __FUNCTION__); return ret; }; int cAudio::StopClip() { - lt_debug("%s\n", __FUNCTION__); + hal_debug("%s\n", __FUNCTION__); if (clipfd <= 0) { - lt_info("%s: clipfd not yet opened\n", __FUNCTION__); + hal_info("%s: clipfd not yet opened\n", __FUNCTION__); return -1; } close(clipfd); @@ -335,7 +335,7 @@ int cAudio::StopClip() void cAudio::getAudioInfo(int &type, int &layer, int &freq, int &bitrate, int &mode) { - lt_debug("%s\n", __FUNCTION__); + hal_debug("%s\n", __FUNCTION__); unsigned int atype; static const int freq_mpg[] = {44100, 48000, 32000, 0}; static const int freq_ac3[] = {48000, 44100, 32000, 0}; @@ -377,27 +377,27 @@ void cAudio::getAudioInfo(int &type, int &layer, int &freq, int &bitrate, int &m void cAudio::SetSRS(int /*iq_enable*/, int /*nmgr_enable*/, int /*iq_mode*/, int /*iq_level*/) { - lt_debug("%s\n", __FUNCTION__); + hal_debug("%s\n", __FUNCTION__); }; void cAudio::SetSpdifDD(bool enable) { - lt_debug("%s %d\n", __FUNCTION__, enable); + hal_debug("%s %d\n", __FUNCTION__, enable); }; void cAudio::ScheduleMute(bool On) { - lt_debug("%s %d\n", __FUNCTION__, On); + hal_debug("%s %d\n", __FUNCTION__, On); }; void cAudio::EnableAnalogOut(bool enable) { - lt_debug("%s %d\n", __FUNCTION__, enable); + hal_debug("%s %d\n", __FUNCTION__, enable); }; void cAudio::setBypassMode(bool disable) { - lt_debug("%s %d\n", __FUNCTION__, disable); + hal_debug("%s %d\n", __FUNCTION__, disable); /* disable = true: audio is MPEG, disable = false: audio is AC3 */ if (disable) { diff --git a/libtriple/dmx_td.cpp b/libtriple/dmx_td.cpp index f160f83..cd1abc7 100644 --- a/libtriple/dmx_td.cpp +++ b/libtriple/dmx_td.cpp @@ -32,17 +32,17 @@ #include #include #include "dmx_hal.h" -#include "lt_debug.h" +#include "hal_debug.h" /* Ugh... see comment in destructor for details... */ #include "video_td.h" extern cVideo *videoDecoder; -#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_DEMUX, this, args) -#define lt_info(args...) _lt_info(TRIPLE_DEBUG_DEMUX, this, args) +#define hal_debug(args...) _hal_debug(HAL_DEBUG_DEMUX, this, args) +#define hal_info(args...) _hal_info(HAL_DEBUG_DEMUX, this, args) #define dmx_err(_errfmt, _errstr, _revents) do { \ - lt_info("%s " _errfmt " fd:%d, ev:0x%x %s pid:0x%04hx flt:0x%02hx\n", \ + hal_info("%s " _errfmt " fd:%d, ev:0x%x %s pid:0x%04hx flt:0x%02hx\n", \ __func__, _errstr, fd, _revents, DMX_T[dmx_type], pid, flt); \ } while(0); @@ -85,7 +85,7 @@ cDemux::cDemux(int n) { if (n < 0 || n > 2) { - lt_info("%s ERROR: n invalid (%d)\n", __FUNCTION__, n); + hal_info("%s ERROR: n invalid (%d)\n", __FUNCTION__, n); num = 0; } else @@ -100,7 +100,7 @@ cDemux::cDemux(int n) cDemux::~cDemux() { - lt_debug("%s #%d fd: %d\n", __FUNCTION__, num, fd); + hal_debug("%s #%d fd: %d\n", __FUNCTION__, num, fd); Close(); free(pdata); pdata = NULL; @@ -111,13 +111,13 @@ bool cDemux::Open(DMX_CHANNEL_TYPE pes_type, void * /*hVideoBuffer*/, int uBuffe P->devnum = num; int flags = O_RDWR; if (fd > -1) - lt_info("%s FD ALREADY OPENED? fd = %d\n", __FUNCTION__, fd); + hal_info("%s FD ALREADY OPENED? fd = %d\n", __FUNCTION__, fd); if (pes_type == DMX_TP_CHANNEL) { /* see neutrino's src/gui/streaminfo2.cpp for the buffer size */ if (num == 0 && uBufferSize == 3 * 3008 * 62) /* streaminfo measurement, let's cheat... */ { - lt_info("%s num=0 and DMX_TP_CHANNEL => measurement demux\n", __func__); + hal_info("%s num=0 and DMX_TP_CHANNEL => measurement demux\n", __func__); P->devnum = 2; /* demux 0 is used for live, demux 1 for recording */ P->measure = true; P->last_measure = 0; @@ -129,7 +129,7 @@ bool cDemux::Open(DMX_CHANNEL_TYPE pes_type, void * /*hVideoBuffer*/, int uBuffe /* it looks like the drivers can only do one TS at a time */ if (dmx_tp_count >= MAX_TS_COUNT) { - lt_info("%s too many DMX_TP_CHANNEL requests :-(\n", __FUNCTION__); + hal_info("%s too many DMX_TP_CHANNEL requests :-(\n", __FUNCTION__); dmx_type = DMX_INVALID; fd = -1; return false; @@ -141,18 +141,18 @@ bool cDemux::Open(DMX_CHANNEL_TYPE pes_type, void * /*hVideoBuffer*/, int uBuffe fd = open(devname[P->devnum], flags); if (fd < 0) { - lt_info("%s %s: %m\n", __FUNCTION__, devname[P->devnum]); + hal_info("%s %s: %m\n", __FUNCTION__, devname[P->devnum]); return false; } fcntl(fd, F_SETFD, FD_CLOEXEC); - lt_debug("%s #%d pes_type: %s(%d), uBufferSize: %d dev:%s fd: %d\n", __func__, + hal_debug("%s #%d pes_type: %s(%d), uBufferSize: %d dev:%s fd: %d\n", __func__, num, DMX_T[pes_type], pes_type, uBufferSize, devname[P->devnum] + strlen("/dev/stb/"), fd); dmx_type = pes_type; if (!pesfds.empty()) { - lt_info("%s ERROR! pesfds not empty!\n", __FUNCTION__); /* TODO: error handling */ + hal_info("%s ERROR! pesfds not empty!\n", __FUNCTION__); /* TODO: error handling */ return false; } if (pes_type == DMX_TP_CHANNEL) @@ -171,7 +171,7 @@ bool cDemux::Open(DMX_CHANNEL_TYPE pes_type, void * /*hVideoBuffer*/, int uBuffe { /* probably uBufferSize == 0 means "use default size". TODO: find a reasonable default */ if (ioctl(fd, DEMUX_SET_BUFFER_SIZE, uBufferSize) < 0) - lt_info("%s DEMUX_SET_BUFFER_SIZE failed (%m)\n", __FUNCTION__); + hal_info("%s DEMUX_SET_BUFFER_SIZE failed (%m)\n", __FUNCTION__); } buffersize = uBufferSize; @@ -180,16 +180,16 @@ bool cDemux::Open(DMX_CHANNEL_TYPE pes_type, void * /*hVideoBuffer*/, int uBuffe void cDemux::Close(void) { - lt_debug("%s #%d, fd = %d\n", __FUNCTION__, num, fd); + hal_debug("%s #%d, fd = %d\n", __FUNCTION__, num, fd); if (fd < 0) { - lt_info("%s #%d: not open!\n", __FUNCTION__, num); + hal_info("%s #%d: not open!\n", __FUNCTION__, num); return; } for (std::vector::const_iterator i = pesfds.begin(); i != pesfds.end(); ++i) { - lt_debug("%s stopping and closing demux fd %d pid 0x%04x\n", __FUNCTION__, (*i).fd, (*i).pid); + hal_debug("%s stopping and closing demux fd %d pid 0x%04x\n", __FUNCTION__, (*i).fd, (*i).pid); if (ioctl((*i).fd, DEMUX_STOP) < 0) perror("DEMUX_STOP"); if (close((*i).fd) < 0) @@ -206,7 +206,7 @@ void cDemux::Close(void) dmx_tp_count--; if (dmx_tp_count < 0) { - lt_info("%s dmx_tp_count < 0!!\n", __func__); + hal_info("%s dmx_tp_count < 0!!\n", __func__); dmx_tp_count = 0; } } @@ -216,13 +216,13 @@ bool cDemux::Start(bool) { if (fd < 0) { - lt_info("%s #%d: not open!\n", __FUNCTION__, num); + hal_info("%s #%d: not open!\n", __FUNCTION__, num); return false; } for (std::vector::const_iterator i = pesfds.begin(); i != pesfds.end(); ++i) { - lt_debug("%s starting demux fd %d pid 0x%04x\n", __FUNCTION__, (*i).fd, (*i).pid); + hal_debug("%s starting demux fd %d pid 0x%04x\n", __FUNCTION__, (*i).fd, (*i).pid); if (ioctl((*i).fd, DEMUX_START) < 0) perror("DEMUX_START"); } @@ -235,12 +235,12 @@ bool cDemux::Stop(void) { if (fd < 0) { - lt_info("%s #%d: not open!\n", __FUNCTION__, num); + hal_info("%s #%d: not open!\n", __FUNCTION__, num); return false; } for (std::vector::const_iterator i = pesfds.begin(); i != pesfds.end(); ++i) { - lt_debug("%s stopping demux fd %d pid 0x%04x\n", __FUNCTION__, (*i).fd, (*i).pid); + hal_debug("%s stopping demux fd %d pid 0x%04x\n", __FUNCTION__, (*i).fd, (*i).pid); if (ioctl((*i).fd, DEMUX_STOP) < 0) perror("DEMUX_STOP"); } @@ -264,7 +264,7 @@ int cDemux::Read(unsigned char *buff, int len, int timeout) if (dmx_type == DMX_INVALID) /* happens, if too many DMX_TP are requested, because */ { /* nobody checks the return value of Open or Start... */ - lt_debug("%s #%d: DMX_INVALID\n", __func__, num); + hal_debug("%s #%d: DMX_INVALID\n", __func__, num); usleep(timeout * 1000); /* rate-limit the debug message */ errno = EINVAL; return -1; @@ -286,7 +286,7 @@ int cDemux::Read(unsigned char *buff, int len, int timeout) S_STREAM_MEASURE m; ioctl(fd, DEMUX_STOP); rc = read(fd, dummy, 12); - lt_debug("%s measure read: %d\n", __func__, rc); + hal_debug("%s measure read: %d\n", __func__, rc); if (rc == 12) { ioctl(fd, DEMUX_GET_MEASURE_TIMING, &m); @@ -307,7 +307,7 @@ int cDemux::Read(unsigned char *buff, int len, int timeout) rc = bit_s * (now - P->last_data) / 8ULL; else rc = 0; - lt_debug("%s measure bit_s: %llu rc: %d timediff: %lld\n", + hal_debug("%s measure bit_s: %llu rc: %d timediff: %lld\n", __func__, bit_s, rc, (now - P->last_data)); P->last_data = now; } else @@ -326,7 +326,7 @@ int cDemux::Read(unsigned char *buff, int len, int timeout) else if (rc < 0) { dmx_err("poll: %s,", strerror(errno), 0) - //lt_info("%s poll: %m\n", __FUNCTION__); + //hal_info("%s poll: %m\n", __FUNCTION__); /* happens, when running under gdb... */ if (errno == EINTR) goto retry; @@ -367,9 +367,9 @@ bool cDemux::sectionFilter(unsigned short _pid, const unsigned char * const filt memset(&s_flt, 0, sizeof(s_flt)); pid = _pid; if (len > FILTER_LENGTH - 2) - lt_info("%s #%d: len too long: %d, FILTER_LENGTH: %d\n", __func__, num, len, FILTER_LENGTH); + hal_info("%s #%d: len too long: %d, FILTER_LENGTH: %d\n", __func__, num, len, FILTER_LENGTH); if (len < 1) /* memcpy below will be unhappy */ - lt_info("%s #%d: len too small: %d\n", __func__, num, len); + hal_info("%s #%d: len too small: %d\n", __func__, num, len); length = (len + 2 + 1) & 0xfe; /* reportedly, the TD drivers don't handle odd filter */ if (length > FILTER_LENGTH) /* lengths well. So make sure the length is a multiple */ @@ -466,7 +466,7 @@ bool cDemux::sectionFilter(unsigned short _pid, const unsigned char * const filt if (timeout == 0) s_flt.timeout = to; - lt_debug("%s #%d pid:0x%04hx fd:%d type:%s len:%d/%d to:%d flags:%x flt[0]:%02x\n", __func__, num, + hal_debug("%s #%d pid:0x%04hx fd:%d type:%s len:%d/%d to:%d flags:%x flt[0]:%02x\n", __func__, num, pid, fd, DMX_T[dmx_type], len,s_flt.filter_length, s_flt.timeout,s_flt.flags, s_flt.filter[0]); #if 0 fprintf(stderr,"filt: ");for(int i=0;i= 0x0002 && pid <= 0x000f) || pid >= 0x1fff) return false; - lt_debug("%s #%d pid: 0x%04hx fd: %d type: %s\n", __FUNCTION__, num, pid, fd, DMX_T[dmx_type]); + hal_debug("%s #%d pid: 0x%04hx fd: %d type: %s\n", __FUNCTION__, num, pid, fd, DMX_T[dmx_type]); if (dmx_type == DMX_TP_CHANNEL && !P->measure) { @@ -541,12 +541,12 @@ bool cDemux::pesFilter(const unsigned short _pid) void cDemux::SetSyncMode(AVSYNC_TYPE /*mode*/) { - lt_debug("%s #%d\n", __FUNCTION__, num); + hal_debug("%s #%d\n", __FUNCTION__, num); } void *cDemux::getBuffer() { - lt_debug("%s #%d\n", __FUNCTION__, num); + hal_debug("%s #%d\n", __FUNCTION__, num); if (P->running) return (void *)1; return NULL; @@ -554,7 +554,7 @@ void *cDemux::getBuffer() void *cDemux::getChannel() { - lt_debug("%s #%d\n", __FUNCTION__, num); + hal_debug("%s #%d\n", __FUNCTION__, num); return NULL; } @@ -565,24 +565,24 @@ bool cDemux::addPid(unsigned short Pid) struct demux_pes_para p; if (dmx_type != DMX_TP_CHANNEL) { - lt_info("%s pes_type %s not implemented yet! pid=%hx\n", __FUNCTION__, DMX_T[dmx_type], Pid); + hal_info("%s pes_type %s not implemented yet! pid=%hx\n", __FUNCTION__, DMX_T[dmx_type], Pid); return false; } if (P->measure) { - lt_info("%s measurement demux -> skipping\n", __func__); + hal_info("%s measurement demux -> skipping\n", __func__); return true; } if (fd == -1) - lt_info("%s bucketfd not yet opened? pid=%hx\n", __FUNCTION__, Pid); + hal_info("%s bucketfd not yet opened? pid=%hx\n", __FUNCTION__, Pid); pfd.fd = open(devname[P->devnum], O_RDWR); if (pfd.fd < 0) { - lt_info("%s #%d Pid = %hx open failed (%m)\n", __FUNCTION__, num, Pid); + hal_info("%s #%d Pid = %hx open failed (%m)\n", __FUNCTION__, num, Pid); return false; } fcntl(pfd.fd, F_SETFD, FD_CLOEXEC); - lt_debug("%s #%d Pid = %hx pfd = %d\n", __FUNCTION__, num, Pid, pfd.fd); + hal_debug("%s #%d Pid = %hx pfd = %d\n", __FUNCTION__, num, Pid, pfd.fd); p.pid = Pid; p.pesType = DMX_PES_OTHER; @@ -615,13 +615,13 @@ void cDemux::removePid(unsigned short Pid) { if (dmx_type != DMX_TP_CHANNEL) { - lt_info("%s pes_type %s not implemented yet! pid=%hx\n", __FUNCTION__, DMX_T[dmx_type], Pid); + hal_info("%s pes_type %s not implemented yet! pid=%hx\n", __FUNCTION__, DMX_T[dmx_type], Pid); return; } for (std::vector::iterator i = pesfds.begin(); i != pesfds.end(); ++i) { if ((*i).pid == Pid) { - lt_debug("removePid: removing demux fd %d pid 0x%04x\n", (*i).fd, Pid); + hal_debug("removePid: removing demux fd %d pid 0x%04x\n", (*i).fd, Pid); if (ioctl((*i).fd, DEMUX_STOP) < 0) perror("DEMUX_STOP"); if (close((*i).fd) < 0) @@ -630,12 +630,12 @@ void cDemux::removePid(unsigned short Pid) return; /* TODO: what if the same PID is there multiple times */ } } - lt_info("%s pid 0x%04x not found\n", __FUNCTION__, Pid); + hal_info("%s pid 0x%04x not found\n", __FUNCTION__, Pid); } void cDemux::getSTC(int64_t * STC) { - lt_debug("%s #%d\n", __FUNCTION__, num); + hal_debug("%s #%d\n", __FUNCTION__, num); /* this is a guess, but seems to work... int32_t gives errno 515... */ #define STC_TYPE uint64_t STC_TYPE stc; @@ -646,7 +646,7 @@ void cDemux::getSTC(int64_t * STC) int cDemux::getUnit(void) { - lt_debug("%s #%d\n", __FUNCTION__, num); + hal_debug("%s #%d\n", __FUNCTION__, num); /* just guessed that this is the right thing to do. right now this is only used by the CA code which is stubbed out anyway */ diff --git a/libtriple/init_td.cpp b/libtriple/init_td.cpp index 4500400..3456fbd 100644 --- a/libtriple/init_td.cpp +++ b/libtriple/init_td.cpp @@ -19,9 +19,9 @@ extern "C" { #include "lt_dfbinput.h" #include "pwrmngr.h" -#include "lt_debug.h" -#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_INIT, NULL, args) -#define lt_info(args...) _lt_info(TRIPLE_DEBUG_INIT, NULL, args) +#include "hal_debug.h" +#define hal_debug(args...) _hal_debug(HAL_DEBUG_INIT, NULL, args) +#define hal_info(args...) _hal_info(HAL_DEBUG_INIT, NULL, args) static bool initialized = false; @@ -116,14 +116,14 @@ static void rc_init() "key up" events during zapping */ //ioctl(fd, IOC_IR_SET_DELAY, 1); TODO: needs more work in rcinput close(fd); - lt_info("%s rc_addr=0x%02hx\n", __FUNCTION__, rc_addr); + hal_info("%s rc_addr=0x%02hx\n", __FUNCTION__, rc_addr); } void init_td_api() { if (!initialized) - lt_debug_init(); - lt_info("%s begin, initialized=%d, debug=0x%02x\n", __FUNCTION__, (int)initialized, debuglevel); + hal_debug_init(); + hal_info("%s begin, initialized=%d, debug=0x%02x\n", __FUNCTION__, (int)initialized, debuglevel); if (!initialized) { /* leave standby early, this avoids popping noise on audio device */ @@ -144,12 +144,12 @@ void init_td_api() /* load the module which converts the TD tuner to a Linux-DVB frontend... */ system("/sbin/modprobe td-dvb-frontend"); initialized = true; - lt_info("%s end\n", __FUNCTION__); + hal_info("%s end\n", __FUNCTION__); } void shutdown_td_api() { - lt_info("%s, initialized = %d\n", __FUNCTION__, (int)initialized); + hal_info("%s, initialized = %d\n", __FUNCTION__, (int)initialized); if (initialized) dfb_deinit(); if (gfxfd > -1) diff --git a/libtriple/playback_td.cpp b/libtriple/playback_td.cpp index f726e22..3669dc8 100644 --- a/libtriple/playback_td.cpp +++ b/libtriple/playback_td.cpp @@ -15,10 +15,10 @@ #include "dmx_hal.h" #include "audio_td.h" #include "video_td.h" -#include "lt_debug.h" -#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_PLAYBACK, this, args) -#define lt_info(args...) _lt_info(TRIPLE_DEBUG_PLAYBACK, this, args) -#define lt_info_c(args...) _lt_info(TRIPLE_DEBUG_PLAYBACK, NULL, args) +#include "hal_debug.h" +#define hal_debug(args...) _hal_debug(HAL_DEBUG_PLAYBACK, this, args) +#define hal_info(args...) _hal_info(HAL_DEBUG_PLAYBACK, this, args) +#define hal_info_c(args...) _hal_info(HAL_DEBUG_PLAYBACK, NULL, args) #include #define DVR "/dev/" DEVICE_NAME_PVR @@ -52,7 +52,7 @@ static const char *FILETYPE[] = { cPlayback::cPlayback(int) { - lt_debug("%s\n", __FUNCTION__); + hal_debug("%s\n", __FUNCTION__); thread_started = false; inbuf = NULL; pesbuf = NULL; @@ -64,7 +64,7 @@ cPlayback::cPlayback(int) cPlayback::~cPlayback() { - lt_debug("%s\n", __FUNCTION__); + hal_debug("%s\n", __FUNCTION__); Close(); } @@ -76,7 +76,7 @@ bool cPlayback::Open(playmode_t mode) "PLAYMODE_FILE" }; - lt_debug("%s: PlayMode = %s\n", __FUNCTION__, PMODE[mode]); + hal_debug("%s: PlayMode = %s\n", __FUNCTION__, PMODE[mode]); thread_started = false; playMode = mode; filetype = FILETYPE_TS; @@ -91,15 +91,15 @@ bool cPlayback::Open(playmode_t mode) //Used by Fileplay void cPlayback::Close(void) { - lt_info("%s\n", __FUNCTION__); + hal_info("%s\n", __FUNCTION__); playstate = STATE_STOP; if (thread_started) { - lt_info("%s: before pthread_join\n", __FUNCTION__); + hal_info("%s: before pthread_join\n", __FUNCTION__); pthread_join(thread, NULL); } thread_started = false; - lt_info("%s: after pthread_join\n", __FUNCTION__); + hal_info("%s: after pthread_join\n", __FUNCTION__); mf_close(); filelist.clear(); @@ -122,30 +122,30 @@ bool cPlayback::Start(char *filename, unsigned short vp, int vtype, unsigned sho vpid = vp; apid = ap; ac3 = _ac3; - lt_info("%s name = '%s' vpid 0x%04hx vtype %d apid 0x%04hx ac3 %d filelist.size: %u\n", + hal_info("%s name = '%s' vpid 0x%04hx vtype %d apid 0x%04hx ac3 %d filelist.size: %u\n", __FUNCTION__, filename, vpid, vtype, apid, ac3, filelist.size()); if (!filelist.empty()) { - lt_info("filelist not empty?\n"); + hal_info("filelist not empty?\n"); return false; } if (stat(filename, &s)) { - lt_info("filename does not exist? (%m)\n"); + hal_info("filename does not exist? (%m)\n"); return false; } if (!inbuf) inbuf = (uint8_t *)malloc(INBUF_SIZE); /* 256 k */ if (!inbuf) { - lt_info("allocating input buffer failed (%m)\n"); + hal_info("allocating input buffer failed (%m)\n"); return false; } if (!pesbuf) pesbuf = (uint8_t *)malloc(PESBUF_SIZE); /* 128 k */ if (!pesbuf) { - lt_info("allocating PES buffer failed (%m)\n"); + hal_info("allocating PES buffer failed (%m)\n"); return false; } filelist_t file; @@ -165,10 +165,10 @@ bool cPlayback::Start(char *filename, unsigned short vp, int vtype, unsigned sho if (p != std::string::npos) { file.Name.replace(p, std::string::npos, "001.vdr"); - lt_info("replaced filename with '%s'\n", file.Name.c_str()); + hal_info("replaced filename with '%s'\n", file.Name.c_str()); if (stat(file.Name.c_str(), &s)) { - lt_info("filename does not exist? (%m)\n"); + hal_info("filename does not exist? (%m)\n"); return false; } file.Size = s.st_size; @@ -179,7 +179,7 @@ bool cPlayback::Start(char *filename, unsigned short vp, int vtype, unsigned sho vpid = 0x40; } - lt_info("detected (ok, guessed) filetype: %s\n", FILETYPE[filetype]); + hal_info("detected (ok, guessed) filetype: %s\n", FILETYPE[filetype]); filelist.push_back(file); filelist_auto_add(); @@ -236,7 +236,7 @@ bool cPlayback::Start(char *filename, unsigned short vp, int vtype, unsigned sho int duration = (pts_end - pts_start) / 90000; if (duration > 0) bytes_per_second = mf_getsize() / duration; - lt_info("start: %lld end %lld duration %d bps %lld\n", pts_start, pts_end, duration, bytes_per_second); + hal_info("start: %lld end %lld duration %d bps %lld\n", pts_start, pts_end, duration, bytes_per_second); /* yes, we start in pause mode... */ playback_speed = 0; if (pts_start == -1) @@ -245,7 +245,7 @@ bool cPlayback::Start(char *filename, unsigned short vp, int vtype, unsigned sho playstate = STATE_PAUSE; pthread_mutex_lock(&playback_ready_mutex); if (pthread_create(&thread, 0, start_playthread, this) != 0) - lt_info("pthread_create failed\n"); + hal_info("pthread_create failed\n"); else pthread_cond_wait(&playback_ready_cond, &playback_ready_mutex); pthread_mutex_unlock(&playback_ready_mutex); @@ -266,7 +266,7 @@ void cPlayback::playthread(void) dvrfd = open(DVR, O_WRONLY); if (dvrfd < 0) { - lt_info("%s open tdpvr failed: %m\n", __FUNCTION__); + hal_info("%s open tdpvr failed: %m\n", __FUNCTION__); pthread_exit(NULL); } fcntl(dvrfd, F_SETFD, FD_CLOEXEC); @@ -333,7 +333,7 @@ void cPlayback::playthread(void) if (!aI->second.ac3) { apid = aI->first; - lt_info("%s setting Audio pid to 0x%04hx\n", __FUNCTION__, apid); + hal_info("%s setting Audio pid to 0x%04hx\n", __FUNCTION__, apid); SetAPid(apid, 0); break; } @@ -353,7 +353,7 @@ void cPlayback::playthread(void) { if (errno == EAGAIN && playstate != STATE_STOP) goto retry; - lt_info("%s write dvr failed: %m\n", __FUNCTION__); + hal_info("%s write dvr failed: %m\n", __FUNCTION__); break; } memmove(inbuf, inbuf + ret, inbuf_pos - ret); @@ -367,7 +367,7 @@ void cPlayback::playthread(void) static void playthread_cleanup_handler(void *) { - lt_info_c("%s\n", __FUNCTION__); + hal_info_c("%s\n", __FUNCTION__); ioctl(audioDemux->getFD(), DEMUX_SELECT_SOURCE, INPUT_FROM_CHANNEL0); audioDemux->Stop(); videoDemux->Stop(); @@ -379,7 +379,7 @@ static void playthread_cleanup_handler(void *) bool cPlayback::SetAPid(unsigned short pid, int _ac3) { - lt_info("%s pid: 0x%04hx ac3: %d\n", __FUNCTION__, pid, _ac3); + hal_info("%s pid: 0x%04hx ac3: %d\n", __FUNCTION__, pid, _ac3); apid = pid; ac3 = _ac3; @@ -408,7 +408,7 @@ bool cPlayback::SetAPid(unsigned short pid, int _ac3) bool cPlayback::SetSpeed(int speed) { - lt_info("%s speed = %d\n", __FUNCTION__, speed); + hal_info("%s speed = %d\n", __FUNCTION__, speed); if (speed < 0) speed = 1; /* fast rewind not yet implemented... */ if (speed == 1 && playback_speed != 1) @@ -447,7 +447,7 @@ bool cPlayback::SetSpeed(int speed) bool cPlayback::GetSpeed(int &speed) const { - lt_debug("%s\n", __FUNCTION__); + hal_debug("%s\n", __FUNCTION__); speed = playback_speed; return true; } @@ -456,7 +456,7 @@ bool cPlayback::GetSpeed(int &speed) const bool cPlayback::GetPosition(int &position, int &duration) { int64_t tmppts; - lt_debug("%s\n", __FUNCTION__); + hal_debug("%s\n", __FUNCTION__); off_t currsize = mf_getsize(); bool update = false; /* handle a growing file, e.g. for timeshift. @@ -488,7 +488,7 @@ bool cPlayback::GetPosition(int &position, int &duration) tmppts = get_pts(pesbuf + r + s, false, n - r); if (tmppts > -1) { - lt_debug("n: %d s: %d endpts %lld size: %lld\n", n, s, tmppts, currsize); + hal_debug("n: %d s: %d endpts %lld size: %lld\n", n, s, tmppts, currsize); pts_end = tmppts; _pts_end = tmppts; update = true; @@ -519,7 +519,7 @@ bool cPlayback::GetPosition(int &position, int &duration) if (update && duration >= 4000) { bytes_per_second = currsize / (duration / 1000); - lt_debug("%s: updated bps: %lld size: %lld duration %d\n", + hal_debug("%s: updated bps: %lld size: %lld duration %d\n", __FUNCTION__, bytes_per_second, currsize, duration); } return true; @@ -531,7 +531,7 @@ bool cPlayback::GetPosition(int &position, int &duration) bool cPlayback::SetPosition(int position, bool absolute) { - lt_info("%s pos = %d abs = %d\n", __FUNCTION__, position, absolute); + hal_info("%s pos = %d abs = %d\n", __FUNCTION__, position, absolute); int currpos, target, duration, oldspeed; bool ret; @@ -541,7 +541,7 @@ bool cPlayback::SetPosition(int position, bool absolute) { GetPosition(currpos, duration); target = currpos + position; - lt_info("current position %d target %d\n", currpos, target); + hal_info("current position %d target %d\n", currpos, target); } oldspeed = playback_speed; @@ -567,7 +567,7 @@ bool cPlayback::SetPosition(int position, bool absolute) void cPlayback::FindAllPids(uint16_t *apids, unsigned short *ac3flags, uint16_t *numpida, std::string *language) { - lt_info("%s\n", __FUNCTION__); + hal_info("%s\n", __FUNCTION__); int i = 0; for (std::map::iterator aI = astreams.begin(); aI != astreams.end(); aI++) { @@ -606,14 +606,14 @@ off_t cPlayback::seek_to_pts(int64_t pts) int count = 0; if (pts_start < 0 || pts_end < 0 || bytes_per_second < 0) { - lt_info("%s pts_start (%lld) or pts_end (%lld) or bytes_per_second (%lld) not initialized\n", + hal_info("%s pts_start (%lld) or pts_end (%lld) or bytes_per_second (%lld) not initialized\n", __FUNCTION__, pts_start, pts_end, bytes_per_second); return -1; } /* sanity check: buffer is without locking, so we must only seek while in pause mode */ if (playstate != STATE_PAUSE) { - lt_info("%s playstate (%d) != STATE_PAUSE, not seeking\n", __FUNCTION__, playstate); + hal_info("%s playstate (%d) != STATE_PAUSE, not seeking\n", __FUNCTION__, playstate); return -1; } @@ -627,7 +627,7 @@ off_t cPlayback::seek_to_pts(int64_t pts) count++; ptsdiff = pts - tmppts; newpos += ptsdiff * bytes_per_second / 90000; - lt_info("%s try #%d seek from %lldms to %lldms dt %lldms pos %lldk newpos %lldk kB/s %lld\n", + hal_info("%s try #%d seek from %lldms to %lldms dt %lldms pos %lldk newpos %lldk kB/s %lld\n", __FUNCTION__, count, tmppts / 90, pts / 90, ptsdiff / 90, curr_pos / 1024, newpos / 1024, bytes_per_second / 1024); if (newpos < 0) newpos = 0; @@ -647,7 +647,7 @@ off_t cPlayback::seek_to_pts(int64_t pts) else tmppts = pts_curr - pts_start; } - lt_info("%s end after %d tries, ptsdiff now %lld sec\n", __FUNCTION__, count, (pts - tmppts) / 90000); + hal_info("%s end after %d tries, ptsdiff now %lld sec\n", __FUNCTION__, count, (pts - tmppts) / 90000); return newpos; } @@ -681,7 +681,7 @@ bool cPlayback::filelist_auto_add() filelist_t file; file.Name = std::string(nextfile); file.Size = s.st_size; - lt_info("%s auto-adding '%s' to playlist\n", __FUNCTION__, nextfile); + hal_info("%s auto-adding '%s' to playlist\n", __FUNCTION__, nextfile); filelist.push_back(file); } while (true && num < 999); @@ -710,7 +710,7 @@ int cPlayback::mf_open(int fileno) int cPlayback::mf_close(void) { int ret = 0; - lt_info("%s in_fd = %d curr_fileno = %d\n", __FUNCTION__, in_fd, curr_fileno); + hal_info("%s in_fd = %d curr_fileno = %d\n", __FUNCTION__, in_fd, curr_fileno); if (in_fd != -1) ret = close(in_fd); in_fd = curr_fileno = -1; @@ -761,11 +761,11 @@ off_t cPlayback::mf_lseek(off_t pos) if ((int)fileno != curr_fileno) { - lt_info("%s old fileno: %d new fileno: %d, offset: %lld\n", __FUNCTION__, curr_fileno, fileno, (long long)lpos); + hal_info("%s old fileno: %d new fileno: %d, offset: %lld\n", __FUNCTION__, curr_fileno, fileno, (long long)lpos); in_fd = mf_open(fileno); if (in_fd < 0) { - lt_info("cannot open file %d:%s (%m)\n", fileno, filelist[fileno].Name.c_str()); + hal_info("cannot open file %d:%s (%m)\n", fileno, filelist[fileno].Name.c_str()); return -1; } } @@ -867,7 +867,7 @@ ssize_t cPlayback::read_ts() } if (ret < 0) { - lt_info("%s failed1: %m\n", __FUNCTION__); + hal_info("%s failed1: %m\n", __FUNCTION__); pthread_mutex_unlock(&currpos_mutex); return ret; } @@ -880,7 +880,7 @@ ssize_t cPlayback::read_ts() sync = sync_ts(pesbuf, ret); if (sync != 0) { - lt_info("%s out of sync: %d\n", __FUNCTION__, sync); + hal_info("%s out of sync: %d\n", __FUNCTION__, sync); if (sync < 0) { pthread_mutex_unlock(&currpos_mutex); @@ -888,7 +888,7 @@ ssize_t cPlayback::read_ts() } memmove(pesbuf, pesbuf + sync, ret - sync); if (pesbuf[0] != 0x47) - lt_info("%s:%d??????????????????????????????\n", __FUNCTION__, __LINE__); + hal_info("%s:%d??????????????????????????????\n", __FUNCTION__, __LINE__); } for (n = 0; n < done / 188 * 188; n += 188) { @@ -921,7 +921,7 @@ ssize_t cPlayback::read_ts() /* the output buffer is full, discard the input :-( */ if (done - n > 0) { - lt_debug("%s not done: %d, resetting filepos\n", + hal_debug("%s not done: %d, resetting filepos\n", __FUNCTION__, done - n); mf_lseek(curr_pos - (done - n)); } @@ -953,7 +953,7 @@ ssize_t cPlayback::read_ts() { pthread_mutex_unlock(&currpos_mutex); if (ret < 0) - lt_info("%s failed2: %m\n", __FUNCTION__); + hal_info("%s failed2: %m\n", __FUNCTION__); return ret; } inbuf_pos += ret; @@ -963,7 +963,7 @@ ssize_t cPlayback::read_ts() sync = sync_ts(inbuf + inbuf_sync, INBUF_SIZE - inbuf_sync); if (sync < 0) { - lt_info("%s cannot sync\n", __FUNCTION__); + hal_info("%s cannot sync\n", __FUNCTION__); return ret; } inbuf_sync += sync; @@ -983,7 +983,7 @@ ssize_t cPlayback::read_ts() continue; } if (synccnt) - lt_info("%s TS went out of sync %d\n", __FUNCTION__, synccnt); + hal_info("%s TS went out of sync %d\n", __FUNCTION__, synccnt); synccnt = 0; if (!(buf[1] & 0x40)) /* PUSI */ { @@ -1006,7 +1006,7 @@ ssize_t cPlayback::read_ts() pts_curr = pts; if (pts_start < 0) { - lt_info("%s updating pts_start to %lld ", __FUNCTION__, pts); + hal_info("%s updating pts_start to %lld ", __FUNCTION__, pts); pts_start = pts; if (pts_end > -1) { @@ -1041,7 +1041,7 @@ ssize_t cPlayback::read_ts() tmp.ac3 = false; tmp.lang = ""; astreams.insert(std::make_pair(pid, tmp)); - lt_info("%s found apid #%d 0x%04hx ac3:%d\n", __func__, astreams.size(), pid, tmp.ac3); + hal_info("%s found apid #%d 0x%04hx ac3:%d\n", __func__, astreams.size(), pid, tmp.ac3); break; } i += 188; @@ -1062,7 +1062,7 @@ ssize_t cPlayback::read_mpeg() if (INBUF_SIZE - inbuf_pos < toread) { - lt_info("%s inbuf full, setting toread to %d (old: %zd)\n", __FUNCTION__, INBUF_SIZE - inbuf_pos, toread); + hal_info("%s inbuf full, setting toread to %d (old: %zd)\n", __FUNCTION__, INBUF_SIZE - inbuf_pos, toread); toread = INBUF_SIZE - inbuf_pos; } pthread_mutex_lock(&currpos_mutex); @@ -1080,7 +1080,7 @@ ssize_t cPlayback::read_mpeg() if (ret < 0) { pthread_mutex_unlock(&currpos_mutex); - lt_info("%s failed: %m, pesbuf_pos: %zd, toread: %zd\n", __FUNCTION__, pesbuf_pos, toread); + hal_info("%s failed: %m, pesbuf_pos: %zd, toread: %zd\n", __FUNCTION__, pesbuf_pos, toread); return ret; } pesbuf_pos += ret; @@ -1098,12 +1098,12 @@ ssize_t cPlayback::read_mpeg() if (sync < 0) { if (pesbuf_pos - count - 10 > 4) - lt_info("%s cannot sync (count=%d, pesbuf_pos=%zd)\n", + hal_info("%s cannot sync (count=%d, pesbuf_pos=%zd)\n", __FUNCTION__, count, pesbuf_pos); break; } if (sync) - lt_info("%s needed sync %zd\n", __FUNCTION__, sync); + hal_info("%s needed sync %zd\n", __FUNCTION__, sync); count += sync; } uint8_t *ppes = pesbuf + count; @@ -1125,7 +1125,7 @@ ssize_t cPlayback::read_mpeg() } else { - lt_info("%s weird pack header: 0x%2x\n", __FUNCTION__, ppes[4]); + hal_info("%s weird pack header: 0x%2x\n", __FUNCTION__, ppes[4]); count++; } resync = true; @@ -1140,7 +1140,7 @@ ssize_t cPlayback::read_mpeg() // if (offset == 0x24 && subid == 0x10 ) // TTX? if (subid < 0x80 || subid > 0x87) break; - lt_debug("AC3: ofs 0x%02x subid 0x%02x\n", off, subid); + hal_debug("AC3: ofs 0x%02x subid 0x%02x\n", off, subid); //subid -= 0x60; // normalize to 32...39 (hex 0x20..0x27) if (astreams.find(subid) == astreams.end()) @@ -1149,7 +1149,7 @@ ssize_t cPlayback::read_mpeg() tmp.ac3 = true; tmp.lang = ""; astreams.insert(std::make_pair(subid, tmp)); - lt_info("%s found aid: %02x\n", __FUNCTION__, subid); + hal_info("%s found aid: %02x\n", __FUNCTION__, subid); } pid = subid; av = 2; @@ -1174,7 +1174,7 @@ ssize_t cPlayback::read_mpeg() tmp.ac3 = false; tmp.lang = ""; astreams.insert(std::make_pair(id, tmp)); - lt_info("%s found aid: %02x\n", __FUNCTION__, id); + hal_info("%s found aid: %02x\n", __FUNCTION__, id); } pid = id; av = 2; @@ -1193,7 +1193,7 @@ ssize_t cPlayback::read_mpeg() break; case 0xb9: case 0xbc: - lt_debug("%s:%d %s\n", __FUNCTION__, __LINE__, + hal_debug("%s:%d %s\n", __FUNCTION__, __LINE__, (ppes[3] == 0xb9) ? "program_end_code" : "program_stream_map"); //resync = true; // fallthrough. TODO: implement properly. @@ -1209,14 +1209,14 @@ ssize_t cPlayback::read_mpeg() int pesPacketLen = ((ppes[4] << 8) | ppes[5]) + 6; if (count + pesPacketLen >= pesbuf_pos) { - lt_debug("buffer len: %ld, pesPacketLen: %d :-(\n", pesbuf_pos - count, pesPacketLen); + hal_debug("buffer len: %ld, pesPacketLen: %d :-(\n", pesbuf_pos - count, pesPacketLen); break; } int tsPacksCount = pesPacketLen / 184; if ((tsPacksCount + 1) * 188 > INBUF_SIZE - inbuf_pos) { - lt_info("not enough size in inbuf (needed %d, got %d)\n", (tsPacksCount + 1) * 188, INBUF_SIZE - inbuf_pos); + hal_info("not enough size in inbuf (needed %d, got %d)\n", (tsPacksCount + 1) * 188, INBUF_SIZE - inbuf_pos); break; } @@ -1279,7 +1279,7 @@ off_t cPlayback::mp_seekSync(off_t pos) pthread_mutex_lock(&currpos_mutex); ret = mf_lseek(npos); if (ret < 0) - lt_info("%s:%d lseek ret < 0 (%m)\n", __FUNCTION__, __LINE__); + hal_info("%s:%d lseek ret < 0 (%m)\n", __FUNCTION__, __LINE__); if (filetype != FILETYPE_TS) { @@ -1292,7 +1292,7 @@ off_t cPlayback::mp_seekSync(off_t pos) r = read(in_fd, &pkt[offset], 1024 - offset); if (r < 0) { - lt_info("%s read failed: %m\n", __FUNCTION__); + hal_info("%s read failed: %m\n", __FUNCTION__); break; } if (r == 0) // EOF? @@ -1301,7 +1301,7 @@ off_t cPlayback::mp_seekSync(off_t pos) break; if (mf_lseek(npos) < 0) /* next file in list? */ { - lt_info("%s:%d lseek ret < 0 (%m)\n", __FUNCTION__, __LINE__); + hal_info("%s:%d lseek ret < 0 (%m)\n", __FUNCTION__, __LINE__); break; } retry = true; @@ -1320,17 +1320,17 @@ off_t cPlayback::mp_seekSync(off_t pos) else { npos += s; - lt_info("%s sync after %lld\n", __FUNCTION__, npos - pos); + hal_info("%s sync after %lld\n", __FUNCTION__, npos - pos); ret = mf_lseek(npos); pthread_mutex_unlock(&currpos_mutex); if (ret < 0) - lt_info("%s:%d lseek ret < 0 (%m)\n", __FUNCTION__, __LINE__); + hal_info("%s:%d lseek ret < 0 (%m)\n", __FUNCTION__, __LINE__); return ret; } if (npos > (pos + 0x20000)) /* 128k enough? */ break; } - lt_info("%s could not sync to PES offset: %d r: %zd\n", __FUNCTION__, offset, r); + hal_info("%s could not sync to PES offset: %d r: %zd\n", __FUNCTION__, offset, r); ret = mf_lseek(pos); pthread_mutex_unlock(&currpos_mutex); return ret; @@ -1351,14 +1351,14 @@ off_t cPlayback::mp_seekSync(off_t pos) ret = mf_lseek(npos - 1); // assume sync ok pthread_mutex_unlock(&currpos_mutex); if (ret < 0) - lt_info("%s:%d lseek ret < 0 (%m)\n", __FUNCTION__, __LINE__); + hal_info("%s:%d lseek ret < 0 (%m)\n", __FUNCTION__, __LINE__); return ret; } else { ret = mf_lseek(npos); // oops, next pkt doesn't start with sync if (ret < 0) - lt_info("%s:%d lseek ret < 0 (%m)\n", __FUNCTION__, __LINE__); + hal_info("%s:%d lseek ret < 0 (%m)\n", __FUNCTION__, __LINE__); } } } @@ -1495,7 +1495,7 @@ static int mp_syncPES(uint8_t *buf, int len, bool quiet) } if (!quiet && len > 5) /* only warn if enough space was available... */ - lt_info_c("%s No valid PES signature found. %d Bytes deleted.\n", __FUNCTION__, ret); + hal_info_c("%s No valid PES signature found. %d Bytes deleted.\n", __FUNCTION__, ret); return -1; } diff --git a/libtriple/record_td.cpp b/libtriple/record_td.cpp index 6d1f2e1..119d762 100644 --- a/libtriple/record_td.cpp +++ b/libtriple/record_td.cpp @@ -11,9 +11,9 @@ #include "record_td.h" #include "dmx_hal.h" -#include "lt_debug.h" -#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_RECORD, this, args) -#define lt_info(args...) _lt_info(TRIPLE_DEBUG_RECORD, this, args) +#include "hal_debug.h" +#define hal_debug(args...) _hal_debug(HAL_DEBUG_RECORD, this, args) +#define hal_info(args...) _hal_info(HAL_DEBUG_RECORD, this, args) /* helper function to call the cpp thread loop */ void *execute_record_thread(void *c) @@ -25,7 +25,7 @@ void *execute_record_thread(void *c) cRecord::cRecord(int /*num*/) { - lt_info("%s\n", __func__); + hal_info("%s\n", __func__); dmx = NULL; record_thread_running = false; file_fd = -1; @@ -34,14 +34,14 @@ cRecord::cRecord(int /*num*/) cRecord::~cRecord() { - lt_info("%s: calling ::Stop()\n", __func__); + hal_info("%s: calling ::Stop()\n", __func__); Stop(); - lt_info("%s: end\n", __func__); + hal_info("%s: end\n", __func__); } bool cRecord::Open(void) { - lt_info("%s\n", __func__); + hal_info("%s\n", __func__); exit_flag = RECORD_STOPPED; return true; } @@ -50,13 +50,13 @@ bool cRecord::Open(void) // unused void cRecord::Close(void) { - lt_info("%s: \n", __func__); + hal_info("%s: \n", __func__); } #endif bool cRecord::Start(int fd, unsigned short vpid, unsigned short *apids, int numpids, uint64_t) { - lt_info("%s: fd %d, vpid 0x%03x\n", __func__, fd, vpid); + hal_info("%s: fd %d, vpid 0x%03x\n", __func__, fd, vpid); int i; if (!dmx) @@ -78,7 +78,7 @@ bool cRecord::Start(int fd, unsigned short vpid, unsigned short *apids, int nump { exit_flag = RECORD_FAILED_READ; errno = i; - lt_info("%s: error creating thread! (%m)\n", __func__); + hal_info("%s: error creating thread! (%m)\n", __func__); delete dmx; dmx = NULL; return false; @@ -89,10 +89,10 @@ bool cRecord::Start(int fd, unsigned short vpid, unsigned short *apids, int nump bool cRecord::Stop(void) { - lt_info("%s\n", __func__); + hal_info("%s\n", __func__); if (exit_flag != RECORD_RUNNING) - lt_info("%s: status not RUNNING? (%d)\n", __func__, exit_flag); + hal_info("%s: status not RUNNING? (%d)\n", __func__, exit_flag); exit_flag = RECORD_STOPPED; if (record_thread_running) @@ -101,7 +101,7 @@ bool cRecord::Stop(void) /* We should probably do that from the destructor... */ if (!dmx) - lt_info("%s: dmx == NULL?\n", __func__); + hal_info("%s: dmx == NULL?\n", __func__); else delete dmx; dmx = NULL; @@ -109,7 +109,7 @@ bool cRecord::Stop(void) if (file_fd != -1) close(file_fd); else - lt_info("%s: file_fd not open??\n", __func__); + hal_info("%s: file_fd not open??\n", __func__); file_fd = -1; return true; } @@ -120,9 +120,9 @@ bool cRecord::ChangePids(unsigned short /*vpid*/, unsigned short *apids, int num int j; bool found; unsigned short pid; - lt_info("%s\n", __func__); + hal_info("%s\n", __func__); if (!dmx) { - lt_info("%s: DMX = NULL\n", __func__); + hal_info("%s: DMX = NULL\n", __func__); return false; } pids = dmx->pesfds; @@ -156,9 +156,9 @@ bool cRecord::ChangePids(unsigned short /*vpid*/, unsigned short *apids, int num bool cRecord::AddPid(unsigned short pid) { std::vector pids; - lt_info("%s: \n", __func__); + hal_info("%s: \n", __func__); if (!dmx) { - lt_info("%s: DMX = NULL\n", __func__); + hal_info("%s: DMX = NULL\n", __func__); return false; } pids = dmx->pesfds; @@ -171,7 +171,7 @@ bool cRecord::AddPid(unsigned short pid) void cRecord::RecordThread() { - lt_info("%s: begin\n", __func__); + hal_info("%s: begin\n", __func__); #define BUFSIZE (1 << 19) /* 512 kB */ ssize_t r = 0; int buf_pos = 0; @@ -181,7 +181,7 @@ void cRecord::RecordThread() if (!buf) { exit_flag = RECORD_FAILED_MEMORY; - lt_info("%s: unable to allocate buffer! (out of memory)\n", __func__); + hal_info("%s: unable to allocate buffer! (out of memory)\n", __func__); } dmx->Start(); @@ -190,23 +190,23 @@ void cRecord::RecordThread() if (buf_pos < BUFSIZE) { r = dmx->Read(buf + buf_pos, BUFSIZE - 1 - buf_pos, 100); - lt_debug("%s: buf_pos %6d r %6d / %6d\n", __func__, + hal_debug("%s: buf_pos %6d r %6d / %6d\n", __func__, buf_pos, (int)r, BUFSIZE - 1 - buf_pos); if (r < 0) { if (errno != EAGAIN) { - lt_info("%s: read failed: %m\n", __func__); + hal_info("%s: read failed: %m\n", __func__); exit_flag = RECORD_FAILED_READ; break; } - lt_info("%s: EAGAIN\n", __func__); + hal_info("%s: EAGAIN\n", __func__); } else buf_pos += r; } else - lt_info("%s: buffer full! Overflow?\n", __func__); + hal_info("%s: buffer full! Overflow?\n", __func__); if (buf_pos > (BUFSIZE / 3)) /* start writeout */ { size_t towrite = BUFSIZE / 2; @@ -216,12 +216,12 @@ void cRecord::RecordThread() if (r < 0) { exit_flag = RECORD_FAILED_FILE; - lt_info("%s: write error: %m\n", __func__); + hal_info("%s: write error: %m\n", __func__); break; } buf_pos -= r; memmove(buf, buf + r, buf_pos); - lt_debug("%s: buf_pos %6d w %6d / %6d\n", __func__, buf_pos, (int)r, (int)towrite); + hal_debug("%s: buf_pos %6d w %6d / %6d\n", __func__, buf_pos, (int)r, (int)towrite); #if 0 if (fdatasync(file_fd)) perror("cRecord::FileThread() fdatasync"); @@ -237,7 +237,7 @@ void cRecord::RecordThread() if (r < 0) { exit_flag = RECORD_FAILED_FILE; - lt_info("%s: write error: %m\n", __func__); + hal_info("%s: write error: %m\n", __func__); break; } buf_pos -= r; @@ -259,7 +259,7 @@ void cRecord::RecordThread() printf("[stream2file]: pthreads exit code: %i, dir: '%s', filename: '%s' myfilename: '%s'\n", exit_flag, s.dir, s.filename, myfilename); #endif - lt_info("%s: end", __func__); + hal_info("%s: end", __func__); pthread_exit(NULL); } diff --git a/libtriple/video_td.cpp b/libtriple/video_td.cpp index f5c2fd6..33f1fc4 100644 --- a/libtriple/video_td.cpp +++ b/libtriple/video_td.cpp @@ -37,17 +37,17 @@ #include "video_td.h" #include #define VIDEO_DEVICE "/dev/" DEVICE_NAME_VIDEO -#include "lt_debug.h" -#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_VIDEO, this, args) -#define lt_info(args...) _lt_info(TRIPLE_DEBUG_VIDEO, this, args) +#include "hal_debug.h" +#define hal_debug(args...) _hal_debug(HAL_DEBUG_VIDEO, this, args) +#define hal_info(args...) _hal_info(HAL_DEBUG_VIDEO, this, args) #define fop(cmd, args...) ({ \ int _r; \ if (fd >= 0) { \ if ((_r = ::cmd(fd, args)) < 0) \ - lt_info(#cmd"(fd, "#args")\n"); \ + hal_info(#cmd"(fd, "#args")\n"); \ else \ - lt_debug(#cmd"(fd, "#args")\n");\ + hal_debug(#cmd"(fd, "#args")\n");\ } \ else { _r = fd; } \ _r; \ @@ -72,9 +72,9 @@ static bool noscart = false; cVideo::cVideo(int, void *, void *, unsigned int) { - lt_debug("%s\n", __FUNCTION__); + hal_debug("%s\n", __FUNCTION__); if ((fd = open(VIDEO_DEVICE, O_RDWR)) < 0) - lt_info("%s cannot open %s: %m\n", __FUNCTION__, VIDEO_DEVICE); + hal_info("%s cannot open %s: %m\n", __FUNCTION__, VIDEO_DEVICE); fcntl(fd, F_SETFD, FD_CLOEXEC); playstate = VIDEO_STOPPED; @@ -95,7 +95,7 @@ cVideo::cVideo(int, void *, void *, unsigned int) blankfd = open(blanknames[i], O_RDONLY); if (blankfd < 0) { - lt_info("%s cannot open %s: %m", __FUNCTION__, blanknames[i]); + hal_info("%s cannot open %s: %m", __FUNCTION__, blanknames[i]); continue; } if (fstat(blankfd, &st) != -1 && st.st_size > 0) @@ -103,10 +103,10 @@ cVideo::cVideo(int, void *, void *, unsigned int) blank_size[i] = st.st_size; blank_data[i] = malloc(blank_size[i]); if (! blank_data[i]) - lt_info("%s malloc failed (%m)\n", __FUNCTION__); + hal_info("%s malloc failed (%m)\n", __FUNCTION__); else if (read(blankfd, blank_data[i], blank_size[i]) != blank_size[i]) { - lt_info("%s short read (%m)\n", __FUNCTION__); + hal_info("%s short read (%m)\n", __FUNCTION__); free(blank_data[i]); /* don't leak... */ blank_data[i] = NULL; } @@ -121,7 +121,7 @@ cVideo::cVideo(int, void *, void *, unsigned int) video_standby = 0; noscart = (getenv("TRIPLE_NOSCART") != NULL); if (noscart) - lt_info("%s TRIPLE_NOSCART variable prevents SCART switching\n", __FUNCTION__); + hal_info("%s TRIPLE_NOSCART variable prevents SCART switching\n", __FUNCTION__); } cVideo::~cVideo(void) @@ -152,7 +152,7 @@ int cVideo::setAspectRatio(int aspect, int mode) _aspect = aspect; if (mode != -1) _mode = mode; - lt_info("%s(%d, %d)_(%d, %d) v_ar %d\n", __FUNCTION__, aspect, mode, _aspect, _mode, v_ar); + hal_info("%s(%d, %d)_(%d, %d) v_ar %d\n", __FUNCTION__, aspect, mode, _aspect, _mode, v_ar); /* values are hardcoded in neutrino_menue.cpp, "2" is 14:9 -> not used */ if (_aspect != -1) @@ -208,7 +208,7 @@ int cVideo::setAspectRatio(int aspect, int mode) } s.des.vert_off = (576 - s.des.vert_size) / 2; s.des.hori_off = (720 - s.des.hori_size) / 2; - lt_debug("PANSCAN2: %d%% src: %d:%d:%d:%d dst: %d:%d:%d:%d\n", zoom, + hal_debug("PANSCAN2: %d%% src: %d:%d:%d:%d dst: %d:%d:%d:%d\n", zoom, s.src.hori_off,s.src.vert_off,s.src.hori_size,s.src.vert_size, s.des.hori_off,s.des.vert_off,s.des.hori_size,s.des.vert_size); fop(ioctl, MPEG_VID_SCALE_ON); @@ -227,7 +227,7 @@ int cVideo::setAspectRatio(int aspect, int mode) d = ds[dsize]; else d = "invalid!"; - lt_debug("%s dispsize(%d) (%s)\n", __FUNCTION__, dsize, d); + hal_debug("%s dispsize(%d) (%s)\n", __FUNCTION__, dsize, d); fop(ioctl, MPEG_VID_SET_DISPSIZE, dsize); int avsfd = open("/dev/stb/tdsystem", O_RDONLY); @@ -238,7 +238,7 @@ int cVideo::setAspectRatio(int aspect, int mode) } if (!noscart && scartvoltage > 0 && video_standby == 0) { - lt_info("%s set SCART_PIN_8 to %dV\n", __FUNCTION__, scartvoltage); + hal_info("%s set SCART_PIN_8 to %dV\n", __FUNCTION__, scartvoltage); if (ioctl(avsfd, IOC_AVS_SCART_PIN8_SET, scartvoltage) < 0) perror("IOC_AVS_SCART_PIN8_SET"); } @@ -254,7 +254,7 @@ int cVideo::getAspectRatio(void) ioctl(fd, MPEG_VID_GET_V_INFO, &v); if (v.pel_aspect_ratio < VID_DISPSIZE_4x3 || v.pel_aspect_ratio > VID_DISPSIZE_UNKNOWN) { - lt_info("%s invalid value %d, returning 0/unknown fd: %d", __FUNCTION__, v.pel_aspect_ratio, fd); + hal_info("%s invalid value %d, returning 0/unknown fd: %d", __FUNCTION__, v.pel_aspect_ratio, fd); return 0; } /* convert to Coolstream api values. Taken from streaminfo2.cpp */ @@ -280,13 +280,13 @@ int cVideo::setCroppingMode(vidDispMode_t format) f = format_string[format]; else f = "ILLEGAL format!"; - lt_debug("%s(%d) => %s\n", __FUNCTION__, format, f); + hal_debug("%s(%d) => %s\n", __FUNCTION__, format, f); return fop(ioctl, MPEG_VID_SET_DISPMODE, format); } int cVideo::Start(void * /*PcrChannel*/, unsigned short /*PcrPid*/, unsigned short /*VideoPid*/, void * /*hChannel*/) { - lt_debug("%s playstate=%d\n", __FUNCTION__, playstate); + hal_debug("%s playstate=%d\n", __FUNCTION__, playstate); if (playstate == VIDEO_PLAYING) return 0; if (playstate == VIDEO_FREEZED) /* in theory better, but not in practice :-) */ @@ -298,7 +298,7 @@ int cVideo::Start(void * /*PcrChannel*/, unsigned short /*PcrPid*/, unsigned sho int cVideo::Stop(bool blank) { - lt_debug("%s(%d)\n", __FUNCTION__, blank); + hal_debug("%s(%d)\n", __FUNCTION__, blank); if (blank) { playstate = VIDEO_STOPPED; @@ -311,7 +311,7 @@ int cVideo::Stop(bool blank) int cVideo::setBlank(int) { - lt_debug("%s\n", __FUNCTION__); + hal_debug("%s\n", __FUNCTION__); /* The TripleDragon has no VIDEO_SET_BLANK ioctl. instead, you write a black still-MPEG Iframe into the decoder. The original software uses different files for 4:3 and 16:9 and @@ -327,7 +327,7 @@ int cVideo::setBlank(int) if ((v.v_size % 240) == 0) /* NTSC */ { - lt_info("%s NTSC format detected", __FUNCTION__); + hal_info("%s NTSC format detected", __FUNCTION__); index = 1; } @@ -360,7 +360,7 @@ int cVideo::setBlank(int) int cVideo::SetVideoSystem(int video_system, bool remember) { - lt_info("%s(%d, %d)\n", __FUNCTION__, video_system, remember); + hal_info("%s(%d, %d)\n", __FUNCTION__, video_system, remember); if (video_system > VID_DISPFMT_SECAM || video_system < 0) video_system = VID_DISPFMT_PAL; return fop(ioctl, MPEG_VID_SET_DISPFMT, video_system); @@ -373,7 +373,7 @@ int cVideo::getPlayState(void) void cVideo::SetVideoMode(analog_mode_t mode) { - lt_debug("%s(%d)\n", __FUNCTION__, mode); + hal_debug("%s(%d)\n", __FUNCTION__, mode); switch(mode) { case ANALOG_SD_YPRPB_SCART: @@ -383,7 +383,7 @@ void cVideo::SetVideoMode(analog_mode_t mode) outputformat = VID_OUTFMT_RGBC_SVIDEO; break; default: - lt_info("%s unknown mode %d\n", __FUNCTION__, mode); + hal_info("%s unknown mode %d\n", __FUNCTION__, mode); return; } fop(ioctl, MPEG_VID_SET_OUTFMT, outputformat); @@ -391,7 +391,7 @@ void cVideo::SetVideoMode(analog_mode_t mode) void cVideo::ShowPicture(const char * fname) { - lt_debug("%s(%s)\n", __FUNCTION__, fname); + hal_debug("%s(%s)\n", __FUNCTION__, fname); char destname[512]; char cmd[512]; char *p; @@ -401,7 +401,7 @@ void cVideo::ShowPicture(const char * fname) strcpy(destname, "/var/cache"); if (stat(fname, &st2)) { - lt_info("%s: could not stat %s (%m)\n", __func__, fname); + hal_info("%s: could not stat %s (%m)\n", __func__, fname); return; } mkdir(destname, 0755); @@ -434,16 +434,16 @@ void cVideo::ShowPicture(const char * fname) mfd = open(destname, O_RDONLY); if (mfd < 0) { - lt_info("%s cannot open %s: %m", __FUNCTION__, destname); + hal_info("%s cannot open %s: %m", __FUNCTION__, destname); goto out; } if (fstat(mfd, &st) != -1 && st.st_size > 0) { data = malloc(st.st_size); if (! data) - lt_info("%s malloc failed (%m)\n", __FUNCTION__); + hal_info("%s malloc failed (%m)\n", __FUNCTION__); else if (read(mfd, data, st.st_size) != st.st_size) - lt_info("%s short read (%m)\n", __FUNCTION__); + hal_info("%s short read (%m)\n", __FUNCTION__); else { BUFINFO buf; @@ -485,13 +485,13 @@ void cVideo::ShowPicture(const char * fname) void cVideo::StopPicture() { - lt_debug("%s\n", __FUNCTION__); + hal_debug("%s\n", __FUNCTION__); fop(ioctl, MPEG_VID_SELECT_SOURCE, VID_SOURCE_DEMUX); } void cVideo::Standby(unsigned int bOn) { - lt_debug("%s(%d)\n", __FUNCTION__, bOn); + hal_debug("%s(%d)\n", __FUNCTION__, bOn); if (bOn) { setBlank(1); @@ -511,7 +511,7 @@ int cVideo::getBlank(void) * setBlank() puts a 24fps black mpeg into the decoder... * regular broadcast does not have 24fps, so if it is still * there, video did not decode... */ - lt_debug("%s: %hu (blank = 2)\n", __func__, v.frame_rate); + hal_debug("%s: %hu (blank = 2)\n", __func__, v.frame_rate); return (v.frame_rate == 2); } @@ -579,7 +579,7 @@ int cVideo::setZoom(int zoom) s.des.vert_off = (576 - s.des.vert_size) / 2; } */ - lt_debug("%s %d%% src: %d:%d:%d:%d dst: %d:%d:%d:%d\n", __FUNCTION__, zoom, + hal_debug("%s %d%% src: %d:%d:%d:%d dst: %d:%d:%d:%d\n", __FUNCTION__, zoom, s.src.hori_off,s.src.vert_off,s.src.hori_size,s.src.vert_size, s.des.hori_off,s.des.vert_off,s.des.hori_size,s.des.vert_size); fop(ioctl, MPEG_VID_SET_DISPMODE, VID_DISPMODE_SCALE); @@ -613,7 +613,7 @@ void cVideo::VideoParamWatchdog(void) ioctl(fd, MPEG_VID_GET_V_INFO_RAW, &v_info); if (_v_info != v_info) { - lt_debug("%s params changed. old: %08x new: %08x\n", __FUNCTION__, _v_info, v_info); + hal_debug("%s params changed. old: %08x new: %08x\n", __FUNCTION__, _v_info, v_info); setAspectRatio(-1, -1); } _v_info = v_info; @@ -636,7 +636,7 @@ void cVideo::Pig(int x, int y, int w, int h, int /*osd_w*/, int /*osd_h*/) s.des.vert_off = y; s.des.hori_size = w; s.des.vert_size = h; - lt_debug("%s src: %d:%d:%d:%d dst: %d:%d:%d:%d", __FUNCTION__, + hal_debug("%s src: %d:%d:%d:%d dst: %d:%d:%d:%d", __FUNCTION__, s.src.hori_off,s.src.vert_off,s.src.hori_size,s.src.vert_size, s.des.hori_off,s.des.vert_off,s.des.hori_size,s.des.vert_size); fop(ioctl, MPEG_VID_SET_DISPMODE, VID_DISPMODE_SCALE); @@ -658,7 +658,7 @@ void cVideo::getPictureInfo(int &width, int &height, int &rate) void cVideo::SetSyncMode(AVSYNC_TYPE Mode) { - lt_debug("%s %d\n", __FUNCTION__, Mode); + hal_debug("%s %d\n", __FUNCTION__, Mode); /* * { 0, LOCALE_OPTIONS_OFF }, * { 1, LOCALE_OPTIONS_ON }, @@ -689,13 +689,13 @@ int cVideo::SetStreamType(VIDEO_FORMAT type) "VIDEO_FORMAT_PNG" }; - lt_debug("%s type=%s\n", __FUNCTION__, VF[type]); + hal_debug("%s type=%s\n", __FUNCTION__, VF[type]); return 0; } void cVideo::routeVideo(int standby) { - lt_debug("%s(%d)\n", __FUNCTION__, standby); + hal_debug("%s(%d)\n", __FUNCTION__, standby); int avsfd = open("/dev/stb/tdsystem", O_RDONLY); if (avsfd < 0) @@ -708,7 +708,7 @@ void cVideo::routeVideo(int standby) to configure this, we can think more about this... */ if (standby) { - lt_info("%s set fastblank and pin8 to follow VCR SCART, route VCR to TV\n", __FUNCTION__); + hal_info("%s set fastblank and pin8 to follow VCR SCART, route VCR to TV\n", __FUNCTION__); if (ioctl(avsfd, IOC_AVS_FASTBLANK_SET, (unsigned char)3) < 0) perror("IOC_AVS_FASTBLANK_SET, 3"); /* TODO: should probably depend on aspect ratio setting */ @@ -718,7 +718,7 @@ void cVideo::routeVideo(int standby) perror("IOC_AVS_ROUTE_VCR2TV"); } else { unsigned char fblk = 1; - lt_info("%s set fastblank=%d pin8=%dV, route encoder to TV\n", __FUNCTION__, fblk, scartvoltage); + hal_info("%s set fastblank=%d pin8=%dV, route encoder to TV\n", __FUNCTION__, fblk, scartvoltage); if (ioctl(avsfd, IOC_AVS_FASTBLANK_SET, fblk) < 0) perror("IOC_AVS_FASTBLANK_SET, fblk"); if (!noscart && ioctl(avsfd, IOC_AVS_SCART_PIN8_SET, scartvoltage) < 0) @@ -731,7 +731,7 @@ void cVideo::routeVideo(int standby) void cVideo::FastForwardMode(int mode) { - lt_debug("%s\n", __FUNCTION__); + hal_debug("%s\n", __FUNCTION__); fop(ioctl, MPEG_VID_FASTFORWARD, mode); } @@ -921,29 +921,29 @@ static const int yuv2rgbtable_bv[256] = { /* TODO: aspect ratio correction and PIP */ bool cVideo::GetScreenImage(unsigned char * &video, int &xres, int &yres, bool get_video, bool get_osd, bool /*scale_to_video*/) { - lt_info("%s: get_video: %d get_osd: %d\n", __func__, get_video, get_osd); + hal_info("%s: get_video: %d get_osd: %d\n", __func__, get_video, get_osd); uint8_t *map; int mfd = open("/dev/mem", O_RDWR); if (mfd < 0) { - lt_info("%s: cannot open open /dev/mem (%m)\n", __func__); + hal_info("%s: cannot open open /dev/mem (%m)\n", __func__); return false; } /* this hints at incorrect usage */ if (video != NULL) - lt_info("%s: WARNING, video != NULL?\n", __func__); + hal_info("%s: WARNING, video != NULL?\n", __func__); if (get_video) { map = (uint8_t *)mmap(NULL, VIDEO_SIZE, PROT_READ, MAP_SHARED, mfd, VIDEO_MEM); if (map == MAP_FAILED) { - lt_info("%s: cannot mmap /dev/mem vor VIDEO (%m)\n", __func__); + hal_info("%s: cannot mmap /dev/mem vor VIDEO (%m)\n", __func__); close(mfd); return false; } uint16_t w = *(uint16_t *)(map + WIDTH_OFF); uint16_t h = *(uint16_t *)(map + HEIGHT_OFF); if (w > 720 || h > 576) { - lt_info("%s: unhandled resolution %dx%d, is the tuner locked?\n", __func__, w, h); + hal_info("%s: unhandled resolution %dx%d, is the tuner locked?\n", __func__, w, h); munmap(map, VIDEO_SIZE); close(mfd); return false; @@ -954,7 +954,7 @@ bool cVideo::GetScreenImage(unsigned char * &video, int &xres, int &yres, bool g int chromasize = needmem - lumasize; uint8_t *buf = (uint8_t *)malloc(needmem); if (!buf) { - lt_info("%s: cannot allocate %d bytes (%m)\n", __func__, needmem); + hal_info("%s: cannot allocate %d bytes (%m)\n", __func__, needmem); munmap(map, VIDEO_SIZE); close(mfd); return false; @@ -978,7 +978,7 @@ bool cVideo::GetScreenImage(unsigned char * &video, int &xres, int &yres, bool g } video = (unsigned char *)malloc(xres * yres * 4); if (!video) { - lt_info("%s: cannot allocate %d bytes for video buffer (%m)\n", __func__, yres * yres * 4); + hal_info("%s: cannot allocate %d bytes for video buffer (%m)\n", __func__, yres * yres * 4); free(buf); close(mfd); return false; @@ -990,7 +990,7 @@ bool cVideo::GetScreenImage(unsigned char * &video, int &xres, int &yres, bool g int Y, U, V, y, x, out1, pos, RU, GU, GV, BV, rgbstride, i; // yuv2rgb conversion (4:2:0) - lt_info("%s: converting Video from YUV to RGB color space\n", __func__); + hal_info("%s: converting Video from YUV to RGB color space\n", __func__); out1 = pos = 0; rgbstride = w * 4; @@ -1047,7 +1047,7 @@ bool cVideo::GetScreenImage(unsigned char * &video, int &xres, int &yres, bool g } } } - lt_info("%s: Video-Size: %d x %d\n", __func__, xres, yres); + hal_info("%s: Video-Size: %d x %d\n", __func__, xres, yres); free(buf); } if (get_osd) @@ -1060,7 +1060,7 @@ bool cVideo::GetScreenImage(unsigned char * &video, int &xres, int &yres, bool g video = (unsigned char *)calloc(xres * yres, 4); if (!video) { - lt_info("%s: cannot allocate %d bytes for video buffer (%m)\n", __func__, yres * yres * 4); + hal_info("%s: cannot allocate %d bytes for video buffer (%m)\n", __func__, yres * yres * 4); close(mfd); return false; } @@ -1068,7 +1068,7 @@ bool cVideo::GetScreenImage(unsigned char * &video, int &xres, int &yres, bool g /* we don't need the framebufferdevice, we know where the FB is located */ map = (uint8_t *)mmap(NULL, GFXFB_SIZE, PROT_READ, MAP_SHARED, mfd, GFXFB_MEM); if (map == MAP_FAILED) { - lt_info("%s: cannot mmap /dev/mem for GFXFB (%m)\n", __func__); + hal_info("%s: cannot mmap /dev/mem for GFXFB (%m)\n", __func__); close(mfd); return false; } @@ -1101,5 +1101,5 @@ bool cVideo::GetScreenImage(unsigned char * &video, int &xres, int &yres, bool g void cVideo::SetDemux(cDemux *) { - lt_debug("%s: not implemented yet\n", __func__); + hal_debug("%s: not implemented yet\n", __func__); }