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

Origin commit data
------------------
Branch: master
Commit: ef4ad293cc
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
parent abb5767d1e
commit 81c977318b
48 changed files with 1379 additions and 1387 deletions

View File

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

View File

@@ -9,9 +9,9 @@
#include <avs/avs_inf.h>
#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 <linux/soundcard.h>
@@ -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)
{

View File

@@ -32,17 +32,17 @@
#include <string>
#include <hardware/tddevices.h>
#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<pes_pids>::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<pes_pids>::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<pes_pids>::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<FILTER_LENGTH;i++)fprintf(stderr,"%02hhx ",s_flt.filter[i]);fprintf(stderr,"\n");
@@ -495,7 +495,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]);
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<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", (*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 */

View File

@@ -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)

View File

@@ -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 <tddevices.h>
#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<uint16_t, AStream>::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;
}

View File

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

View File

@@ -37,17 +37,17 @@
#include "video_td.h"
#include <hardware/tddevices.h>
#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__);
}