rename lt_debug => hal_debug; it's not only libtriple debugging

Origin commit data
------------------
Branch: master
Commit: 9654cb09bf
Author: vanhofen <vanhofen@gmx.de>
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
This commit is contained in:
vanhofen
2018-12-26 00:34:00 +01:00
committed by max_10
parent 824923df57
commit 8488dfa9c4
48 changed files with 1379 additions and 1387 deletions

View File

@@ -11,11 +11,11 @@
#include <proc_tools.h>
#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 <linux/soundcard.h>
@@ -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);
}

View File

@@ -36,21 +36,21 @@
#include <OpenThreads/Mutex>
#include <OpenThreads/ScopedLock>
#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<FILTER_LENGTH;i++)fprintf(stderr,"%02hhx ",s_flt.filter[i]);fprintf(stderr,"\n");
@@ -477,7 +477,7 @@ bool cDemux::pesFilter(const unsigned short _pid)
if ((pid >= 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<pes_pids>::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];
}

View File

@@ -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;
}

View File

@@ -12,17 +12,17 @@
#include "pwrmngr.h"
#include <proc_tools.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)
{
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;
}

View File

@@ -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<const GstMpegtsPMTStream*>(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;
@@ -1153,7 +1153,7 @@ int cPlayback::GetAPid(void)
{
gint current_audio = 0;
g_object_get (m_gst_playbin, "current-audio", &current_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;
}
@@ -1161,7 +1161,7 @@ int cPlayback::GetVPid(void)
{
gint current_video = 0;
g_object_get (m_gst_playbin, "current-video", &current_video, NULL);
lt_info("%s: %d video\n", __FUNCTION__, current_video);
hal_info("%s: %d video\n", __FUNCTION__, current_video);
return current_video;
}

View File

@@ -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)
@@ -746,7 +746,7 @@ void cPlayback::GetMetadata(std::vector<std::string> &keys, std::vector<std::str
cPlayback::cPlayback(int num __attribute__((unused)))
{
lt_info("%s\n", __func__);
hal_info("%s\n", __func__);
playing = false;
decoders_closed = false;
first = false;
@@ -754,7 +754,7 @@ cPlayback::cPlayback(int num __attribute__((unused)))
cPlayback::~cPlayback()
{
lt_info("%s\n", __func__);
hal_info("%s\n", __func__);
if (player)
free(player);
@@ -765,7 +765,7 @@ void cPlayback::RequestAbort()
{
if (player && player->playback && player->playback->isPlaying)
{
lt_info("%s\n", __func__);
hal_info("%s\n", __func__);
Stop();
//player->playback->abortRequested = 1;
while (player->playback->isPlaying)
@@ -801,7 +801,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

View File

@@ -28,9 +28,9 @@
#include <aio.h>
#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<pes_pids> 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);
}

View File

@@ -35,7 +35,7 @@
#include <linux/dvb/video.h>
#include <linux/fb.h>
#include "video_lib.h"
#include "lt_debug.h"
#include "hal_debug.h"
#include "hdmi_cec.h"
#include <proc_tools.h>
@@ -48,18 +48,18 @@ extern "C"
#include <libavutil/imgutils.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_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 */