mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-26 23:13:16 +02:00
libtriple: improve debug architecture
every libtriple module can have its debug output enabled separately by exporting the TRIPLE_DEBUG variable
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#define AUDIO_DEVICE "/dev/" DEVICE_NAME_AUDIO
|
||||
#include "audio_td.h"
|
||||
#include "lt_debug.h"
|
||||
#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_AUDIO, args)
|
||||
|
||||
#include <linux/soundcard.h>
|
||||
|
||||
@@ -50,7 +51,7 @@ void cAudio::closeDevice(void)
|
||||
|
||||
int cAudio::do_mute(bool enable, bool remember)
|
||||
{
|
||||
lt_debug("cAudio::%s(%d, %d)\n", __FUNCTION__, enable, remember);
|
||||
lt_debug("%s(%d, %d)\n", __FUNCTION__, enable, remember);
|
||||
int ret;
|
||||
if (remember)
|
||||
Muted = enable;
|
||||
@@ -131,13 +132,13 @@ bool cAudio::Pause(bool /*Pcm*/)
|
||||
|
||||
void cAudio::SetSyncMode(AVSYNC_TYPE /*Mode*/)
|
||||
{
|
||||
lt_debug("cAudio::%s\n", __FUNCTION__);
|
||||
lt_debug("%s\n", __FUNCTION__);
|
||||
};
|
||||
|
||||
void cAudio::SetStreamType(AUDIO_FORMAT type)
|
||||
{
|
||||
int bypass_disable;
|
||||
lt_debug("cAudio::%s\n", __FUNCTION__);
|
||||
lt_debug("%s\n", __FUNCTION__);
|
||||
StreamType = type;
|
||||
|
||||
if (StreamType != AUDIO_FMT_DOLBY_DIGITAL && StreamType != AUDIO_FMT_MPEG && StreamType != AUDIO_FMT_MPG1)
|
||||
@@ -154,14 +155,14 @@ void cAudio::SetStreamType(AUDIO_FORMAT type)
|
||||
|
||||
int cAudio::setChannel(int /*channel*/)
|
||||
{
|
||||
lt_debug("cAudio::%s\n", __FUNCTION__);
|
||||
lt_debug("%s\n", __FUNCTION__);
|
||||
return 0;
|
||||
};
|
||||
|
||||
int cAudio::PrepareClipPlay(int ch, int srate, int bits, int little_endian)
|
||||
{
|
||||
int fmt;
|
||||
lt_debug("cAudio::%s ch %d srate %d bits %d le %d\n", __FUNCTION__, ch, srate, bits, little_endian);
|
||||
lt_debug("%s ch %d srate %d bits %d le %d\n", __FUNCTION__, ch, srate, bits, little_endian);
|
||||
if (clipfd >= 0) {
|
||||
fprintf(stderr, "cAudio::%s: clipfd already opened (%d)\n", __FUNCTION__, clipfd);
|
||||
return -1;
|
||||
@@ -207,7 +208,7 @@ int cAudio::WriteClip(unsigned char *buffer, int size)
|
||||
|
||||
int cAudio::StopClip()
|
||||
{
|
||||
lt_debug("cAudio::%s\n", __FUNCTION__);
|
||||
lt_debug("%s\n", __FUNCTION__);
|
||||
if (clipfd <= 0) {
|
||||
fprintf(stderr, "cAudio::%s: clipfd not yet opened\n", __FUNCTION__);
|
||||
return -1;
|
||||
@@ -219,7 +220,7 @@ int cAudio::StopClip()
|
||||
|
||||
void cAudio::getAudioInfo(int &type, int &layer, int &freq, int &bitrate, int &mode)
|
||||
{
|
||||
lt_debug("cAudio::%s\n", __FUNCTION__);
|
||||
lt_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};
|
||||
@@ -261,26 +262,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("cAudio::%s\n", __FUNCTION__);
|
||||
lt_debug("%s\n", __FUNCTION__);
|
||||
};
|
||||
|
||||
void cAudio::SetSpdifDD(bool /*enable*/)
|
||||
{
|
||||
lt_debug("cAudio::%s\n", __FUNCTION__);
|
||||
lt_debug("%s\n", __FUNCTION__);
|
||||
};
|
||||
|
||||
void cAudio::ScheduleMute(bool /*On*/)
|
||||
{
|
||||
lt_debug("cAudio::%s\n", __FUNCTION__);
|
||||
lt_debug("%s\n", __FUNCTION__);
|
||||
};
|
||||
|
||||
void cAudio::EnableAnalogOut(bool /*enable*/)
|
||||
{
|
||||
lt_debug("cAudio::%s\n", __FUNCTION__);
|
||||
lt_debug("%s\n", __FUNCTION__);
|
||||
};
|
||||
|
||||
void cAudio::setBypassMode(bool disable)
|
||||
{
|
||||
lt_debug("%s %d\n", __FUNCTION__, disable);
|
||||
/* disable = true: audio is MPEG, disable = false: audio is AC3 */
|
||||
if (disable)
|
||||
{
|
||||
|
@@ -2,25 +2,25 @@
|
||||
|
||||
#include "ca.h"
|
||||
#include "lt_debug.h"
|
||||
#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_CA, args)
|
||||
|
||||
static const char *FILENAME = "ca.cpp";
|
||||
|
||||
static cCA *inst = NULL;
|
||||
|
||||
/* those are all dummies for now.. */
|
||||
cCA::cCA(void)
|
||||
{
|
||||
lt_debug("%s:%s\n", FILENAME, __FUNCTION__);
|
||||
lt_debug("%s\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
cCA::~cCA()
|
||||
{
|
||||
lt_debug("%s:%s\n", FILENAME, __FUNCTION__);
|
||||
lt_debug("%s\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
cCA *cCA::GetInstance()
|
||||
{
|
||||
lt_debug("%s:%s\n", FILENAME, __FUNCTION__);
|
||||
lt_debug("%s\n", __FUNCTION__);
|
||||
if (inst == NULL)
|
||||
inst = new cCA();
|
||||
|
||||
@@ -29,82 +29,82 @@ cCA *cCA::GetInstance()
|
||||
|
||||
void cCA::MenuEnter(enum CA_SLOT_TYPE, uint32_t p)
|
||||
{
|
||||
lt_debug("%s:%s param:%d\n", FILENAME, __FUNCTION__, (int)p);
|
||||
lt_debug("%s param:%d\n", __FUNCTION__, (int)p);
|
||||
}
|
||||
|
||||
void cCA::MenuAnswer(enum CA_SLOT_TYPE, uint32_t p, uint32_t /*choice*/)
|
||||
{
|
||||
lt_debug("%s:%s param:%d\n", FILENAME, __FUNCTION__, (int)p);
|
||||
lt_debug("%s param:%d\n", __FUNCTION__, (int)p);
|
||||
}
|
||||
|
||||
void cCA::InputAnswer(enum CA_SLOT_TYPE, uint32_t p, uint8_t * /*Data*/, int /*Len*/)
|
||||
{
|
||||
lt_debug("%s:%s param:%d\n", FILENAME, __FUNCTION__, (int)p);
|
||||
lt_debug("%s param:%d\n", __FUNCTION__, (int)p);
|
||||
}
|
||||
|
||||
void cCA::MenuClose(enum CA_SLOT_TYPE, uint32_t p)
|
||||
{
|
||||
lt_debug("%s:%s param:%d\n", FILENAME, __FUNCTION__, (int)p);
|
||||
lt_debug("%s param:%d\n", __FUNCTION__, (int)p);
|
||||
}
|
||||
|
||||
uint32_t cCA::GetNumberCISlots(void)
|
||||
{
|
||||
lt_debug("%s:%s\n", FILENAME, __FUNCTION__);
|
||||
lt_debug("%s\n", __FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t cCA::GetNumberSmartCardSlots(void)
|
||||
{
|
||||
lt_debug("%s:%s\n", FILENAME, __FUNCTION__);
|
||||
lt_debug("%s\n", __FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void cCA::ModuleName(enum CA_SLOT_TYPE, uint32_t p, char * /*Name*/)
|
||||
{
|
||||
/* TODO: waht to do with *Name? */
|
||||
lt_debug("%s:%s param:%d\n", FILENAME, __FUNCTION__, (int)p);
|
||||
lt_debug("%s param:%d\n", __FUNCTION__, (int)p);
|
||||
}
|
||||
|
||||
bool cCA::ModulePresent(enum CA_SLOT_TYPE, uint32_t p)
|
||||
{
|
||||
lt_debug("%s:%s param:%d\n", FILENAME, __FUNCTION__, (int)p);
|
||||
lt_debug("%s param:%d\n", __FUNCTION__, (int)p);
|
||||
return false;
|
||||
}
|
||||
|
||||
void cCA::ModuleReset(enum CA_SLOT_TYPE, uint32_t p)
|
||||
{
|
||||
lt_debug("%s:%s param:%d\n", FILENAME, __FUNCTION__, (int)p);
|
||||
lt_debug("%s param:%d\n", __FUNCTION__, (int)p);
|
||||
}
|
||||
|
||||
bool cCA::SendPMT(int, unsigned char *, int, CA_SLOT_TYPE)
|
||||
{
|
||||
lt_debug("%s:%s\n", FILENAME, __FUNCTION__);
|
||||
lt_debug("%s\n", __FUNCTION__);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool cCA::SendMessage(const CA_MESSAGE *)
|
||||
{
|
||||
lt_debug("%s:%s\n", FILENAME, __FUNCTION__);
|
||||
lt_debug("%s\n", __FUNCTION__);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool cCA::Start(void)
|
||||
{
|
||||
lt_debug("%s:%s\n", FILENAME, __FUNCTION__);
|
||||
lt_debug("%s\n", __FUNCTION__);
|
||||
return true;
|
||||
}
|
||||
|
||||
void cCA::Stop(void)
|
||||
{
|
||||
lt_debug("%s:%s\n", FILENAME, __FUNCTION__);
|
||||
lt_debug("%s\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
void cCA::Ready(bool p)
|
||||
{
|
||||
lt_debug("%s:%s param:%d\n", FILENAME, __FUNCTION__, (int)p);
|
||||
lt_debug("%s param:%d\n", __FUNCTION__, (int)p);
|
||||
}
|
||||
|
||||
void cCA::SetInitMask(enum CA_INIT_MASK p)
|
||||
{
|
||||
lt_debug("%s:%s param:%d\n", FILENAME, __FUNCTION__, (int)p);
|
||||
lt_debug("%s param:%d\n", __FUNCTION__, (int)p);
|
||||
}
|
||||
|
@@ -12,6 +12,8 @@
|
||||
#include "dmx_td.h"
|
||||
#include "lt_debug.h"
|
||||
|
||||
#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_DEMUX, args)
|
||||
|
||||
cDemux *videoDemux = NULL;
|
||||
cDemux *audioDemux = NULL;
|
||||
//cDemux *pcrDemux = NULL;
|
||||
@@ -48,7 +50,7 @@ cDemux::cDemux(int n)
|
||||
|
||||
cDemux::~cDemux()
|
||||
{
|
||||
lt_debug("cDemux::%s #%d fd: %d\n", __FUNCTION__, num, fd);
|
||||
lt_debug("%s #%d fd: %d\n", __FUNCTION__, num, fd);
|
||||
Close();
|
||||
}
|
||||
|
||||
@@ -62,7 +64,7 @@ bool cDemux::Open(DMX_CHANNEL_TYPE pes_type, void * /*hVideoBuffer*/, int uBuffe
|
||||
fprintf(stderr, "cDemux::Open %s: %m", devname[num]);
|
||||
return false;
|
||||
}
|
||||
lt_debug("cDemux::Open #%d pes_type: %s (%d), uBufferSize: %d devname: %s fd: %d\n",
|
||||
lt_debug("Open #%d pes_type: %s (%d), uBufferSize: %d devname: %s fd: %d\n",
|
||||
num, DMX_T[pes_type], pes_type, uBufferSize, devname[num], fd);
|
||||
|
||||
dmx_type = pes_type;
|
||||
@@ -95,7 +97,7 @@ bool cDemux::Open(DMX_CHANNEL_TYPE pes_type, void * /*hVideoBuffer*/, int uBuffe
|
||||
|
||||
void cDemux::Close(void)
|
||||
{
|
||||
lt_debug("cDemux::%s #%d, fd = %d\n", __FUNCTION__, num, fd);
|
||||
lt_debug("%s #%d, fd = %d\n", __FUNCTION__, num, fd);
|
||||
if (fd < 0)
|
||||
{
|
||||
fprintf(stderr, "cDemux::%s #%d: not open!\n", __FUNCTION__, num);
|
||||
@@ -104,7 +106,7 @@ void cDemux::Close(void)
|
||||
|
||||
for (std::vector<pes_pids>::const_iterator i = pesfds.begin(); i != pesfds.end(); ++i)
|
||||
{
|
||||
lt_debug("cDemux::Close: stopping and closing demux fd %d pid 0x%04x\n", (*i).fd, (*i).pid);
|
||||
lt_debug("Close: stopping and closing demux fd %d pid 0x%04x\n", (*i).fd, (*i).pid);
|
||||
if (ioctl((*i).fd, DEMUX_STOP) < 0)
|
||||
perror("DEMUX_STOP");
|
||||
if (close((*i).fd) < 0)
|
||||
@@ -126,7 +128,7 @@ bool cDemux::Start(void)
|
||||
|
||||
for (std::vector<pes_pids>::const_iterator i = pesfds.begin(); i != pesfds.end(); ++i)
|
||||
{
|
||||
lt_debug("cDemux::Start: starting demux fd %d pid 0x%04x\n", (*i).fd, (*i).pid);
|
||||
lt_debug("Start: starting demux fd %d pid 0x%04x\n", (*i).fd, (*i).pid);
|
||||
if (ioctl((*i).fd, DEMUX_START) < 0)
|
||||
perror("DEMUX_START");
|
||||
}
|
||||
@@ -143,7 +145,7 @@ bool cDemux::Stop(void)
|
||||
}
|
||||
for (std::vector<pes_pids>::const_iterator i = pesfds.begin(); i != pesfds.end(); ++i)
|
||||
{
|
||||
lt_debug("cDemux::Stop: stopping demux fd %d pid 0x%04x\n", (*i).fd, (*i).pid);
|
||||
lt_debug("Stop: stopping demux fd %d pid 0x%04x\n", (*i).fd, (*i).pid);
|
||||
if (ioctl((*i).fd, DEMUX_STOP) < 0)
|
||||
perror("DEMUX_STOP");
|
||||
}
|
||||
@@ -327,7 +329,7 @@ bool cDemux::pesFilter(const unsigned short pid)
|
||||
if ((pid >= 0x0002 && pid <= 0x000f) || pid >= 0x1fff)
|
||||
return false;
|
||||
|
||||
lt_debug("cDemux::%s #%d pid: 0x%04hx fd: %d type: %s\n", __FUNCTION__, num, pid, fd, DMX_T[dmx_type]);
|
||||
lt_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)
|
||||
{
|
||||
@@ -364,18 +366,18 @@ bool cDemux::pesFilter(const unsigned short pid)
|
||||
|
||||
void cDemux::SetSyncMode(AVSYNC_TYPE /*mode*/)
|
||||
{
|
||||
lt_debug("cDemux::%s #%d\n", __FUNCTION__, num);
|
||||
lt_debug("%s #%d\n", __FUNCTION__, num);
|
||||
}
|
||||
|
||||
void *cDemux::getBuffer()
|
||||
{
|
||||
lt_debug("cDemux::%s #%d\n", __FUNCTION__, num);
|
||||
lt_debug("%s #%d\n", __FUNCTION__, num);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void *cDemux::getChannel()
|
||||
{
|
||||
lt_debug("cDemux::%s #%d\n", __FUNCTION__, num);
|
||||
lt_debug("%s #%d\n", __FUNCTION__, num);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -397,7 +399,7 @@ void cDemux::addPid(unsigned short Pid)
|
||||
fprintf(stderr, "cDemux::%s #%d Pid = %hx open failed (%m)\n", __FUNCTION__, num, Pid);
|
||||
return;
|
||||
}
|
||||
lt_debug("cDemux::%s #%d Pid = %hx pfd = %d\n", __FUNCTION__, num, Pid, pfd);
|
||||
lt_debug("%s #%d Pid = %hx pfd = %d\n", __FUNCTION__, num, Pid, pfd);
|
||||
|
||||
p.pid = Pid;
|
||||
p.pesType = DMX_PES_OTHER;
|
||||
@@ -436,7 +438,7 @@ void cDemux::removePid(unsigned short Pid)
|
||||
for (std::vector<pes_pids>::iterator i = pesfds.begin(); i != pesfds.end(); ++i)
|
||||
{
|
||||
if ((*i).pid == Pid) {
|
||||
lt_debug("cDemux::removePid: removing demux fd %d pid 0x%04x\n", (*i).fd, Pid);
|
||||
lt_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)
|
||||
@@ -450,7 +452,7 @@ void cDemux::removePid(unsigned short Pid)
|
||||
|
||||
void cDemux::getSTC(int64_t * STC)
|
||||
{
|
||||
lt_debug("cDemux::%s #%d\n", __FUNCTION__, num);
|
||||
lt_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;
|
||||
@@ -461,7 +463,7 @@ void cDemux::getSTC(int64_t * STC)
|
||||
|
||||
int cDemux::getUnit(void)
|
||||
{
|
||||
lt_debug("cDemux::%s #%d\n", __FUNCTION__, num);
|
||||
lt_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 */
|
||||
|
@@ -16,7 +16,9 @@ extern "C" {
|
||||
#include <hardware/avs/bios_system_config.h>
|
||||
}
|
||||
|
||||
static const char * FILENAME = "init_td.cpp";
|
||||
#include "lt_debug.h"
|
||||
#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_INIT, args)
|
||||
#define lt_info(args...) _lt_info(TRIPLE_DEBUG_INIT, args)
|
||||
|
||||
static bool initialized = false;
|
||||
|
||||
@@ -105,12 +107,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);
|
||||
printf("%s: rc_addr=0x%02hx\n", __FUNCTION__, rc_addr);
|
||||
lt_info("%s rc_addr=0x%02hx\n", __FUNCTION__, rc_addr);
|
||||
}
|
||||
|
||||
void init_td_api()
|
||||
{
|
||||
fprintf(stderr, "%s:%s begin, initialized = %d\n", FILENAME, __FUNCTION__, (int)initialized);
|
||||
if (!initialized)
|
||||
lt_debug_init();
|
||||
lt_info("%s begin, initialized=%d, debug=0x%02x\n", __FUNCTION__, (int)initialized, debuglevel);
|
||||
if (!initialized)
|
||||
{
|
||||
/* DirectFB does setpgid(0,0), which disconnects us from controlling terminal
|
||||
@@ -125,12 +129,12 @@ void init_td_api()
|
||||
perror("open /dev/stb/tdgfx");
|
||||
}
|
||||
initialized = true;
|
||||
fprintf(stderr, "%s:%s end\n", FILENAME, __FUNCTION__);
|
||||
lt_info("%s end\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
void shutdown_td_api()
|
||||
{
|
||||
fprintf(stderr, "%s:%s, initialized = %d\n", FILENAME, __FUNCTION__, (int)initialized);
|
||||
lt_info("%s, initialized = %d\n", __FUNCTION__, (int)initialized);
|
||||
if (initialized)
|
||||
dfb_deinit();
|
||||
if (gfxfd > -1)
|
||||
|
@@ -2,17 +2,74 @@
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int cnxt_debug = 0;
|
||||
int cnxt_debug = 0; /* compat, unused */
|
||||
|
||||
void lt_debug(const char *fmt, ...)
|
||||
int debuglevel = -1;
|
||||
|
||||
static const char* lt_facility[] = {
|
||||
"audio ",
|
||||
"video ",
|
||||
"demux ",
|
||||
"record",
|
||||
"play ",
|
||||
"power ",
|
||||
"init ",
|
||||
"ca ",
|
||||
NULL
|
||||
};
|
||||
|
||||
void _lt_info(int facility, const char *fmt, ...)
|
||||
{
|
||||
if (! cnxt_debug)
|
||||
return;
|
||||
|
||||
fprintf(stderr, "[libtriple:%s] ", lt_facility[facility]);
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vfprintf(stderr, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
|
||||
void _lt_debug(int facility, const char *fmt, ...)
|
||||
{
|
||||
if (debuglevel < 0)
|
||||
fprintf(stderr, "lt_debug: debuglevel not initialized!\n");
|
||||
|
||||
if (! ((1 << facility) & debuglevel))
|
||||
return;
|
||||
|
||||
fprintf(stderr, "[libtriple:%s] ", lt_facility[facility]);
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vfprintf(stderr, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void lt_debug_init(void)
|
||||
{
|
||||
int i = 0;
|
||||
char *tmp = getenv("TRIPLE_DEBUG");
|
||||
if (! tmp)
|
||||
debuglevel = 0;
|
||||
else
|
||||
debuglevel = (int) strtol(tmp, NULL, 0);
|
||||
|
||||
if (debuglevel == 0)
|
||||
{
|
||||
fprintf(stderr, "libtriple debug options can be set by exporting TRIPLE_DEBUG.\n");
|
||||
fprintf(stderr, "The following values (or bitwise OR combinations) are valid:\n");
|
||||
while (lt_facility[i]) {
|
||||
fprintf(stderr, "\tcomponent: %s 0x%02x\n", lt_facility[i], 1 << i);
|
||||
i++;
|
||||
}
|
||||
fprintf(stderr, "\tall components: 0x%02x\n", (1 << i) - 1);
|
||||
} else {
|
||||
fprintf(stderr, "libtriple debug is active for the following components:\n");
|
||||
while (lt_facility[i]) {
|
||||
if (debuglevel & (1 << i))
|
||||
fprintf(stderr, "%s ", lt_facility[i]);
|
||||
i++;
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,19 @@
|
||||
#ifndef __LT_DEBUG_H
|
||||
#define __LT_DEBUG_H
|
||||
void lt_debug(const char *fmt, ...);
|
||||
|
||||
#define TRIPLE_DEBUG_AUDIO 0
|
||||
#define TRIPLE_DEBUG_VIDEO 1
|
||||
#define TRIPLE_DEBUG_DEMUX 2
|
||||
#define TRIPLE_DEBUG_RECORD 3
|
||||
#define TRIPLE_DEBUG_PLAYBACK 4
|
||||
#define TRIPLE_DEBUG_PWRMNGR 5
|
||||
#define TRIPLE_DEBUG_INIT 6
|
||||
#define TRIPLE_DEBUG_CA 7
|
||||
#define TRIPLE_DEBUG_ALL ((1<<8)-1)
|
||||
|
||||
extern int debuglevel;
|
||||
|
||||
void _lt_debug(int facility, const char *fmt, ...);
|
||||
void _lt_info(int facility, const char *fmt, ...);
|
||||
void lt_debug_init(void);
|
||||
#endif
|
||||
|
@@ -11,6 +11,8 @@
|
||||
#include "audio_td.h"
|
||||
#include "video_td.h"
|
||||
#include "lt_debug.h"
|
||||
#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_PLAYBACK, args)
|
||||
#define lt_info(args...) _lt_info(TRIPLE_DEBUG_PLAYBACK, args)
|
||||
|
||||
#include <tddevices.h>
|
||||
#define DVR "/dev/" DEVICE_NAME_PVR
|
||||
@@ -497,7 +499,7 @@ bool cPlayback::GetPosition(int &position, int &duration)
|
||||
if (update && duration >= 4000)
|
||||
{
|
||||
bytes_per_second = currsize / (duration / 1000);
|
||||
lt_debug("cPlayback:%s: updated bps: %lld size: %lld duration %d\n",
|
||||
lt_debug("%s: updated bps: %lld size: %lld duration %d\n",
|
||||
__FUNCTION__, bytes_per_second, currsize, duration);
|
||||
}
|
||||
return true;
|
||||
|
@@ -10,26 +10,25 @@
|
||||
|
||||
#include <avs/avs_inf.h>
|
||||
|
||||
static const char * FILENAME = "pwrmngr.cpp";
|
||||
|
||||
void cCpuFreqManager::Up(void) { lt_debug("%s:%s\n", FILENAME, __FUNCTION__); }
|
||||
void cCpuFreqManager::Down(void) { lt_debug("%s:%s\n", FILENAME, __FUNCTION__); }
|
||||
void cCpuFreqManager::Reset(void) { lt_debug("%s:%s\n", FILENAME, __FUNCTION__); }
|
||||
#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_PWRMNGR, args)
|
||||
void cCpuFreqManager::Up(void) { lt_debug("%s\n", __FUNCTION__); }
|
||||
void cCpuFreqManager::Down(void) { lt_debug("%s\n", __FUNCTION__); }
|
||||
void cCpuFreqManager::Reset(void) { lt_debug("%s\n", __FUNCTION__); }
|
||||
/* those function dummies return true or "harmless" values */
|
||||
bool cCpuFreqManager::SetDelta(unsigned long) { lt_debug("%s:%s\n", FILENAME, __FUNCTION__); return true; }
|
||||
unsigned long cCpuFreqManager::GetCpuFreq(void) { lt_debug("%s:%s\n", FILENAME, __FUNCTION__); return 0; }
|
||||
unsigned long cCpuFreqManager::GetDelta(void) { lt_debug("%s:%s\n", FILENAME, __FUNCTION__); return 0; }
|
||||
bool cCpuFreqManager::SetDelta(unsigned long) { lt_debug("%s\n", __FUNCTION__); return true; }
|
||||
unsigned long cCpuFreqManager::GetCpuFreq(void) { lt_debug("%s\n", __FUNCTION__); return 0; }
|
||||
unsigned long cCpuFreqManager::GetDelta(void) { lt_debug("%s\n", __FUNCTION__); return 0; }
|
||||
//
|
||||
cCpuFreqManager::cCpuFreqManager(void) { lt_debug("%s:%s\n", FILENAME, __FUNCTION__); }
|
||||
cCpuFreqManager::cCpuFreqManager(void) { lt_debug("%s\n", __FUNCTION__); }
|
||||
|
||||
bool cPowerManager::SetState(PWR_STATE) { lt_debug("%s:%s\n", FILENAME, __FUNCTION__); return true; }
|
||||
bool cPowerManager::SetState(PWR_STATE) { lt_debug("%s\n", __FUNCTION__); return true; }
|
||||
|
||||
bool cPowerManager::Open(void) { lt_debug("%s:%s\n", FILENAME, __FUNCTION__); return true; }
|
||||
void cPowerManager::Close(void) { lt_debug("%s:%s\n", FILENAME, __FUNCTION__); }
|
||||
bool cPowerManager::Open(void) { lt_debug("%s\n", __FUNCTION__); return true; }
|
||||
void cPowerManager::Close(void) { lt_debug("%s\n", __FUNCTION__); }
|
||||
//
|
||||
bool cPowerManager::SetStandby(bool Active, bool Passive)
|
||||
{
|
||||
lt_debug("%s:%s(%d, %d)\n", FILENAME, __FUNCTION__, Active, Passive);
|
||||
lt_debug("%s(%d, %d)\n", __FUNCTION__, Active, Passive);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -45,7 +44,7 @@ bool cCpuFreqManager::SetCpuFreq(unsigned long f)
|
||||
* f == 0 => max => not standby
|
||||
* f == 50000000 => min => standby
|
||||
*/
|
||||
lt_debug("%s:%s(%lu)\n", FILENAME, __FUNCTION__, f);
|
||||
lt_debug("%s(%lu) => set standby = %s\n", __FUNCTION__, f, f?"true":"false");
|
||||
int fd = open("/dev/stb/tdsystem", O_RDONLY);
|
||||
if (fd < 0)
|
||||
{
|
||||
@@ -62,6 +61,6 @@ bool cCpuFreqManager::SetCpuFreq(unsigned long f)
|
||||
}
|
||||
|
||||
//
|
||||
cPowerManager::cPowerManager(void) { lt_debug("%s:%s\n", FILENAME, __FUNCTION__); }
|
||||
cPowerManager::~cPowerManager() { lt_debug("%s:%s\n", FILENAME, __FUNCTION__); }
|
||||
cPowerManager::cPowerManager(void) { lt_debug("%s\n", __FUNCTION__); }
|
||||
cPowerManager::~cPowerManager() { lt_debug("%s\n", __FUNCTION__); }
|
||||
|
||||
|
@@ -40,6 +40,7 @@
|
||||
#include <hardware/tddevices.h>
|
||||
#define VIDEO_DEVICE "/dev/" DEVICE_NAME_VIDEO
|
||||
#include "lt_debug.h"
|
||||
#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_VIDEO, args)
|
||||
|
||||
cVideo * videoDecoder = NULL;
|
||||
int system_rev = 0;
|
||||
@@ -201,7 +202,7 @@ int cVideo::setAspectRatio(int aspect, int mode)
|
||||
d = ds[dsize];
|
||||
else
|
||||
d = "invalid!";
|
||||
lt_debug("cVideo::setAspectRatio:dispsize(%d) (%s)\n", dsize, d);
|
||||
lt_debug("setAspectRatio:dispsize(%d) (%s)\n", dsize, d);
|
||||
fop(ioctl, MPEG_VID_SET_DISPSIZE, dsize);
|
||||
|
||||
int avsfd = open("/dev/stb/tdsystem", O_RDONLY);
|
||||
@@ -210,7 +211,7 @@ int cVideo::setAspectRatio(int aspect, int mode)
|
||||
perror("open tdsystem");
|
||||
return 0;
|
||||
}
|
||||
lt_debug("cVideo::setAspectRatio: setting SCART_PIN_8 to %dV\n", scartvoltage);
|
||||
lt_debug("setAspectRatio: setting SCART_PIN_8 to %dV\n", scartvoltage);
|
||||
if (scartvoltage > 0 && ioctl(avsfd, IOC_AVS_SCART_PIN8_SET, scartvoltage) < 0)
|
||||
perror("IOC_AVS_SCART_PIN8_SET");
|
||||
close(avsfd);
|
||||
@@ -251,13 +252,13 @@ int cVideo::setCroppingMode(vidDispMode_t format)
|
||||
f = format_string[format];
|
||||
else
|
||||
f = "ILLEGAL format!";
|
||||
lt_debug("cVideo::setCroppingMode(%d) => %s\n", format, f);
|
||||
lt_debug("setCroppingMode(%d) => %s\n", 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("cVideo::Start playstate = %d\n", playstate);
|
||||
lt_debug("Start playstate = %d\n", playstate);
|
||||
if (playstate == VIDEO_PLAYING)
|
||||
return 0;
|
||||
if (playstate == VIDEO_FREEZED) /* in theory better, but not in practice :-) */
|
||||
@@ -269,7 +270,7 @@ int cVideo::Start(void * /*PcrChannel*/, unsigned short /*PcrPid*/, unsigned sho
|
||||
|
||||
int cVideo::Stop(bool blank)
|
||||
{
|
||||
lt_debug("cVideo::Stop %d\n", blank);
|
||||
lt_debug("Stop %d\n", blank);
|
||||
if (blank)
|
||||
{
|
||||
playstate = VIDEO_STOPPED;
|
||||
@@ -282,7 +283,7 @@ int cVideo::Stop(bool blank)
|
||||
|
||||
int cVideo::setBlank(int)
|
||||
{
|
||||
lt_debug("cVideo::setBlank\n");
|
||||
lt_debug("setBlank\n");
|
||||
/* 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
|
||||
@@ -344,7 +345,7 @@ int cVideo::getPlayState(void)
|
||||
|
||||
void cVideo::SetVideoMode(analog_mode_t mode)
|
||||
{
|
||||
lt_debug("cVideo::setVideoMode(%d)\n", mode);
|
||||
lt_debug("setVideoMode(%d)\n", mode);
|
||||
switch(mode)
|
||||
{
|
||||
case ANALOG_SD_YPRPB_SCART:
|
||||
@@ -362,7 +363,7 @@ void cVideo::SetVideoMode(analog_mode_t mode)
|
||||
|
||||
void cVideo::ShowPicture(const char * fname)
|
||||
{
|
||||
lt_debug("cVideo::ShowPicture: %s\n", fname);
|
||||
lt_debug("ShowPicture: %s\n", fname);
|
||||
char destname[512];
|
||||
char cmd[512];
|
||||
char *p;
|
||||
@@ -448,13 +449,13 @@ void cVideo::ShowPicture(const char * fname)
|
||||
|
||||
void cVideo::StopPicture()
|
||||
{
|
||||
lt_debug("cVideo::StopPicture()\n");
|
||||
lt_debug("StopPicture()\n");
|
||||
fop(ioctl, MPEG_VID_SELECT_SOURCE, VID_SOURCE_DEMUX);
|
||||
}
|
||||
|
||||
void cVideo::Standby(unsigned int bOn)
|
||||
{
|
||||
lt_debug("cVideo::Standby: %d\n", bOn);
|
||||
lt_debug("Standby: %d\n", bOn);
|
||||
if (bOn)
|
||||
{
|
||||
setBlank(1);
|
||||
@@ -466,7 +467,7 @@ void cVideo::Standby(unsigned int bOn)
|
||||
|
||||
int cVideo::getBlank(void)
|
||||
{
|
||||
lt_debug("cVideo::getBlank\n");
|
||||
lt_debug("getBlank\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -534,7 +535,7 @@ int cVideo::setZoom(int zoom)
|
||||
s.des.vert_off = (576 - s.des.vert_size) / 2;
|
||||
}
|
||||
*/
|
||||
DBG("setZoom: %d%% src: %d:%d:%d:%d dst: %d:%d:%d:%d", zoom,
|
||||
lt_debug("setZoom: %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_SET_DISPMODE, VID_DISPMODE_SCALE);
|
||||
@@ -568,7 +569,7 @@ void cVideo::VideoParamWatchdog(void)
|
||||
fop(ioctl, MPEG_VID_GET_V_INFO_RAW, &v_info);
|
||||
if (_v_info != v_info)
|
||||
{
|
||||
lt_debug("cVideo::VPWdog: params changed. old: %08x new: %08x\n", _v_info, v_info);
|
||||
lt_debug("VPWdog: params changed. old: %08x new: %08x\n", _v_info, v_info);
|
||||
setAspectRatio(-1, -1);
|
||||
}
|
||||
_v_info = v_info;
|
||||
@@ -591,7 +592,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;
|
||||
DBG("setPig src: %d:%d:%d:%d dst: %d:%d:%d:%d",
|
||||
lt_debug("setPig src: %d:%d:%d:%d dst: %d:%d:%d:%d",
|
||||
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 +614,7 @@ void cVideo::getPictureInfo(int &width, int &height, int &rate)
|
||||
|
||||
void cVideo::SetSyncMode(AVSYNC_TYPE /*Mode*/)
|
||||
{
|
||||
lt_debug("cVideo::%s\n", __FUNCTION__);
|
||||
lt_debug("%s\n", __FUNCTION__);
|
||||
};
|
||||
|
||||
int cVideo::SetStreamType(VIDEO_FORMAT type)
|
||||
@@ -627,13 +628,13 @@ int cVideo::SetStreamType(VIDEO_FORMAT type)
|
||||
"VIDEO_FORMAT_PNG"
|
||||
};
|
||||
|
||||
lt_debug("cVideo::SetStreamType - type=%s\n", VF[type]);
|
||||
lt_debug("SetStreamType - type=%s\n", VF[type]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void cVideo::routeVideo(int standby)
|
||||
{
|
||||
lt_debug("cVideo::routeVideo(%d)\n", standby);
|
||||
lt_debug("routeVideo(%d)\n", standby);
|
||||
|
||||
int avsfd = open("/dev/stb/tdsystem", O_RDONLY);
|
||||
if (avsfd < 0)
|
||||
@@ -669,6 +670,6 @@ void cVideo::routeVideo(int standby)
|
||||
|
||||
void cVideo::FastForwardMode(int mode)
|
||||
{
|
||||
lt_debug("cVideo::%s\n", __FUNCTION__);
|
||||
lt_debug("%s\n", __FUNCTION__);
|
||||
fop(ioctl, MPEG_VID_FASTFORWARD, mode);
|
||||
}
|
||||
|
Reference in New Issue
Block a user