1
0
mirror of https://github.com/rofafor/vdr-plugin-femon.git synced 2023-10-10 13:36:53 +02:00

Added support for tracing modes.

This commit is contained in:
Rolf Ahrenberg 2015-03-07 22:09:18 +02:00
parent 6875f81c60
commit 9d9a8f5a49
9 changed files with 137 additions and 65 deletions

34
femon.c
View File

@ -5,12 +5,13 @@
*
*/
#include <getopt.h>
#include <vdr/menu.h>
#include <vdr/remote.h>
#include <vdr/player.h>
#include "femonconfig.h"
#include "femonreceiver.h"
#include "log.h"
#include "femonosd.h"
#include "femonsetup.h"
#include "femonservice.h"
@ -56,24 +57,40 @@ cPluginFemon::cPluginFemon()
// Initialize any member variables here.
// DON'T DO ANYTHING ELSE THAT MAY HAVE SIDE EFFECTS, REQUIRE GLOBAL
// VDR OBJECTS TO EXIST OR PRODUCE ANY OUTPUT!
debug("%s()\n", __PRETTY_FUNCTION__);
debug1("%s", __PRETTY_FUNCTION__);
}
cPluginFemon::~cPluginFemon()
{
// Clean up after yourself!
debug("%s()\n", __PRETTY_FUNCTION__);
debug1("%s", __PRETTY_FUNCTION__);
}
const char *cPluginFemon::CommandLineHelp(void)
{
// Return a string that describes all known command line options.
return NULL;
return " -t <mode>, --trace=<mode> set the tracing mode\n";
}
bool cPluginFemon::ProcessArgs(int argc, char *argv[])
{
// Implement command line argument processing here if applicable.
static const struct option long_options[] = {
{ "trace", required_argument, NULL, 't' },
{ NULL, no_argument, NULL, 0 }
};
cString server;
int c;
while ((c = getopt_long(argc, argv, "t:", long_options, NULL)) != -1) {
switch (c) {
case 't':
FemonConfig.SetTraceMode(strtol(optarg, NULL, 0));
break;
default:
return false;
}
}
return true;
}
@ -102,7 +119,7 @@ void cPluginFemon::Housekeeping(void)
cOsdObject *cPluginFemon::MainMenuAction(void)
{
// Perform the action when selected from the main VDR menu.
debug("%s()\n", __PRETTY_FUNCTION__);
debug1("%s", __PRETTY_FUNCTION__);
if (cControl::Control() || (Channels.Count() <= 0))
Skins.Message(mtInfo, tr("Femon not available"));
else
@ -212,6 +229,8 @@ const char **cPluginFemon::SVDRPHelpPages(void)
" Print the current audio bitrate [kbit/s].",
"DDBR\n"
" Print the current dolby bitrate [kbit/s].",
"TRAC [ <mode> ]\n"
" Gets and/or sets used tracing mode.\n",
NULL
};
return HelpPages;
@ -220,6 +239,11 @@ const char **cPluginFemon::SVDRPHelpPages(void)
cString cPluginFemon::SVDRPCommand(const char *commandP, const char *optionP, int &replyCodeP)
{
cDvbDevice *dev = getDvbDevice(cDevice::ActualDevice());
if (strcasecmp(commandP, "TRAC") == 0) {
if (optionP && *optionP)
FemonConfig.SetTraceMode(strtol(optionP, NULL, 0));
return cString::sprintf("Tracing mode: 0x%04X\n", FemonConfig.GetTraceMode());
}
if (*optionP && isnumber(optionP)) {
cDvbDevice *dev2 = dynamic_cast<cDvbDevice*>(cDevice::GetDevice(int(strtol(optionP, NULL, 10))));
if (dev2)

View File

@ -5,6 +5,7 @@
*
*/
#include "log.h"
#include "femontools.h"
#include "femonh264.h"
@ -120,7 +121,7 @@ bool cFemonH264::processVideo(const uint8_t *bufP, int lenP)
if (!aud_found) {
switch (buf[4] >> 5) {
case 0: case 3: case 5: // I_FRAME
//debug("H.264: Found NAL AUD at offset %d/%d\n", int(buf - start), lenP);
debug2("%s Found NAL AUD at offset %d/%d", __PRETTY_FUNCTION__, int(buf - start), lenP);
aud_found = true;
break;
case 1: case 4: case 6: // P_FRAME;
@ -133,7 +134,7 @@ bool cFemonH264::processVideo(const uint8_t *bufP, int lenP)
case NAL_SPS:
if (!sps_found) {
//debug("H.264: Found NAL SPS at offset %d/%d\n", int(buf - start), lenP);
debug2("%s Found NAL SPS at offset %d/%d", __PRETTY_FUNCTION__, int(buf - start), lenP);
int nal_len = nalUnescape(nal_data, buf + 4, int(end - buf - 4));
consumed = parseSPS(nal_data, nal_len);
if (consumed > 0)
@ -143,7 +144,7 @@ bool cFemonH264::processVideo(const uint8_t *bufP, int lenP)
case NAL_SEI:
if (!sei_found) {
//debug("H.264: Found NAL SEI at offset %d/%d\n", int(buf - start), lenP);
debug2("%s Found NAL SEI at offset %d/%d", __PRETTY_FUNCTION__, int(buf - start), lenP);
int nal_len = nalUnescape(nal_data, buf + 4, int(end - buf - 4));
consumed = parseSEI(nal_data, nal_len);
if (consumed > 0)
@ -164,14 +165,14 @@ bool cFemonH264::processVideo(const uint8_t *bufP, int lenP)
if (aud_found) {
videoHandlerM->SetVideoCodec(VIDEO_CODEC_H264);
if (sps_found) {
//debug("H.264: size %dx%d, aspect %d format %d bitrate %.0f\n", widthM, heightM, aspectRatioM, formatM, bitRateM);
debug2("%s width=%d height=%d, aspect=%d format=%d bitrate=%.0f", __PRETTY_FUNCTION__, widthM, heightM, aspectRatioM, formatM, bitRateM);
videoHandlerM->SetVideoFormat(formatM);
videoHandlerM->SetVideoSize(widthM, heightM);
videoHandlerM->SetVideoAspectRatio(aspectRatioM);
videoHandlerM->SetVideoBitrate(bitRateM);
}
if (sps_found || sei_found) {
//debug("H.264: scan %d framerate %.2f\n", scanM, (scanM == VIDEO_SCAN_PROGRESSIVE) ? (frameRateM / 2) : frameRateM);
debug2("%s scan=%d framerate=%.2f", __PRETTY_FUNCTION__, scanM, (scanM == VIDEO_SCAN_PROGRESSIVE) ? (frameRateM / 2) : frameRateM);
videoHandlerM->SetVideoScan(scanM);
videoHandlerM->SetVideoFramerate((scanM == VIDEO_SCAN_PROGRESSIVE) ? (frameRateM / 2) : frameRateM);
}
@ -245,7 +246,7 @@ int cFemonH264::parseSPS(const uint8_t *bufP, int lenP)
bs.SkipBits(4); // reserved_zero_4bits
level_idc = bs.GetBits(8); // level_idc
bs.SkipUeGolomb(); // seq_parameter_set_id
//debug("H.264 SPS: profile_idc %d level_idc %d\n", profile_idc, level_idc);
debug2("%s profile_idc=%d level_idc=%d", __PRETTY_FUNCTION__, profile_idc, level_idc);
switch (profile_idc) {
case 66: // baseline profile
case 77: // main profile
@ -493,9 +494,9 @@ int cFemonH264::parseSPS(const uint8_t *bufP, int lenP)
width = bs.GetUeGolomb() + 1; // pic_width_in_mbs_minus1
height = bs.GetUeGolomb() + 1; // pic_height_in_mbs_minus1
frame_mbs_only_flag = bs.GetBit(); // frame_mbs_only_flag
//debug("H.264 SPS: pic_width: %u mbs\n", width);
//debug("H.264 SPS: pic_height: %u mbs\n", height);
//debug("H.264 SPS: frame only flag: %d\n", frame_mbs_only_flag);
debug2("%s pic_width=%u", __PRETTY_FUNCTION__, width);
debug2("%s pic_height=%u", __PRETTY_FUNCTION__, height);
debug2("%s frame_mbs_only_flag=%d", __PRETTY_FUNCTION__, frame_mbs_only_flag);
width *= 16;
height *= 16 * (frame_mbs_only_flag ? 1 : 2);
if (!frame_mbs_only_flag)
@ -507,7 +508,7 @@ int cFemonH264::parseSPS(const uint8_t *bufP, int lenP)
crop_right = bs.GetUeGolomb(); // frame_crop_rigth_offset
crop_top = bs.GetUeGolomb(); // frame_crop_top_offset
crop_bottom = bs.GetUeGolomb(); // frame_crop_bottom_offset
//debug("H.264 SPS: cropping %d %d %d %d\n", crop_left, crop_top, crop_right, crop_bottom);
debug2("%s crop_left=%d crop_top=%d crop_right=%d crop_bottom=%d", __PRETTY_FUNCTION__, crop_left, crop_top, crop_right, crop_bottom);
width -= 2 * (crop_left + crop_right);
if (frame_mbs_only_flag)
height -= 2 * (crop_top + crop_bottom);
@ -519,7 +520,7 @@ int cFemonH264::parseSPS(const uint8_t *bufP, int lenP)
if (bs.GetBit()) { // aspect_ratio_info_present
uint32_t aspect_ratio_idc, sar_width = 0, sar_height = 0;
aspect_ratio_idc = bs.GetBits(8); // aspect_ratio_idc
//debug("H.264 SPS: aspect_ratio_idc %d\n", aspect_ratio_idc);
debug2("%s aspect_ratio_idc=%d", __PRETTY_FUNCTION__, aspect_ratio_idc);
if (aspect_ratio_idc == 255) { // extended sar
sar_width = bs.GetBits(16); // sar_width
sar_height = bs.GetBits(16); // sar_height
@ -544,7 +545,7 @@ int cFemonH264::parseSPS(const uint8_t *bufP, int lenP)
}
else
aspect_ratio = darS[index].dar;
//debug("H.264 SPS: DAR %dx%d (%d)\n", sar_width, sar_height, aspect_ratio);
debug2("%s sar_width=%d sar_height=%d aspect_ratio=%d", __PRETTY_FUNCTION__, sar_width, sar_height, aspect_ratio);
}
}
if (bs.GetBit()) // overscan_info_present_flag
@ -554,7 +555,7 @@ int cFemonH264::parseSPS(const uint8_t *bufP, int lenP)
video_format = bs.GetBits(3); // video_format
if (video_format < sizeof(videoFormatS) / sizeof(videoFormatS[0])) {
format = videoFormatS[video_format];
//debug("H.264 SPS: video format %d\n", format);
debug2("%s video_format=%d", __PRETTY_FUNCTION__, format);
}
bs.SkipBit(); // video_full_range_flag
if (bs.GetBit()) { // colour_description_present_flag
@ -691,12 +692,12 @@ int cFemonH264::parseSEI(const uint8_t *bufP, int lenP)
break;
}
}
//debug("H.264 SEI: pic struct %d scan type %d\n", pic_struct, scan);
debug2("%s pic_struct=%d scan_type=%d", __PRETTY_FUNCTION__, pic_struct, scan);
for (i = 0; i < seiNumClockTsTableS[pic_struct]; ++i) {
if (bs.GetBit()) { // clock_timestamp_flag[i]
int full_timestamp_flag;
ct_type |= (1 << bs.GetBits(2)); // ct_type
//debug("H.264 SEI: ct type %04X\n", ct_type);
debug2("%s ct_type=%04X", __PRETTY_FUNCTION__, ct_type);
bs.SkipBit(); // nuit_field_based_flag
bs.SkipBits(5); // counting_type
full_timestamp_flag = bs.GetBit(); // full_timestamp_flag

View File

@ -11,8 +11,10 @@
#include <ctype.h>
#include <math.h>
#include "iptvservice.h"
#include "femonconfig.h"
#include "log.h"
#include "femonreceiver.h"
#include "femontools.h"
#include "femonsymbol.h"
@ -153,7 +155,7 @@ cFemonOsd *cFemonOsd::pInstanceS = NULL;
cFemonOsd *cFemonOsd::Instance(bool createP)
{
debug("%s()\n", __PRETTY_FUNCTION__);
debug1("%s (%d)", __PRETTY_FUNCTION__, createP);
if ((pInstanceS == NULL) && createP)
{
pInstanceS = new cFemonOsd();
@ -197,7 +199,7 @@ cFemonOsd::cFemonOsd()
mutexM()
{
int tmp;
debug("%s()\n", __PRETTY_FUNCTION__);
debug1("%s", __PRETTY_FUNCTION__);
memset(&frontendStatusM, 0, sizeof(frontendStatusM));
memset(&frontendInfoM, 0, sizeof(frontendInfoM));
svdrpConnectionM.handle = -1;
@ -205,23 +207,23 @@ cFemonOsd::cFemonOsd()
fontM = cFont::CreateFont(Setup.FontSml, constrain(Setup.FontSmlSize, MINFONTSIZE, MAXFONTSIZE));
if (!fontM || !fontM->Height()) {
fontM = new cFemonDummyFont;
error("cFemonOsd::cFemonOsd() cannot create required font.");
error("%s Cannot create required font", __PRETTY_FUNCTION__);
}
tmp = 5 * OSDSYMBOL(SYMBOL_LOCK).Width() + 6 * OSDSPACING;
if (OSDWIDTH < tmp) {
error("cFemonOsd::cFemonOsd() OSD width (%d) smaller than required (%d).", OSDWIDTH, tmp);
error("%s OSD width (%d) smaller than required (%d).", __PRETTY_FUNCTION__, OSDWIDTH, tmp);
OSDWIDTH = tmp;
}
tmp = OSDINFOHEIGHT + OSDROWHEIGHT + OSDSTATUSHEIGHT;
if (OSDHEIGHT < tmp) {
error("cFemonOsd::cFemonOsd() OSD height (%d) smaller than required (%d).", OSDHEIGHT, tmp);
error("%s OSD height (%d) smaller than required (%d).", __PRETTY_FUNCTION__, OSDHEIGHT, tmp);
OSDHEIGHT = tmp;
}
}
cFemonOsd::~cFemonOsd(void)
{
debug("%s()\n", __PRETTY_FUNCTION__);
debug1("%s", __PRETTY_FUNCTION__);
sleepM.Signal();
if (Running())
Cancel(3);
@ -572,7 +574,7 @@ void cFemonOsd::DrawInfoWindow(void)
void cFemonOsd::Action(void)
{
debug("%s()\n", __PRETTY_FUNCTION__);
debug1("%s", __PRETTY_FUNCTION__);
cTimeMs t;
SvdrpCommand_v1_0 cmd;
cmd.command = cString::sprintf("PLUG %s INFO\r\n", PLUGIN_NAME_I18N);
@ -712,7 +714,7 @@ void cFemonOsd::Action(void)
void cFemonOsd::Show(void)
{
debug("%s()\n", __PRETTY_FUNCTION__);
debug1("%s", __PRETTY_FUNCTION__);
eTrackType track = cDevice::PrimaryDevice()->GetCurrentAudioTrack();
const cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel());
@ -731,7 +733,7 @@ void cFemonOsd::Show(void)
if (frontendM >= 0) {
if (ioctl(frontendM, FE_GET_INFO, &frontendInfoM) < 0) {
if (!FemonConfig.GetUseSvdrp())
error("cFemonOsd::Show() cannot read frontend info.");
error("%s Cannot read frontend info", __PRETTY_FUNCTION__);
close(frontendM);
frontendM = -1;
memset(&frontendInfoM, 0, sizeof(frontendInfoM));
@ -743,7 +745,7 @@ void cFemonOsd::Show(void)
return;
}
else {
error("cFemonOsd::Show() cannot open frontend device.");
error("%s Cannot open frontend device", __PRETTY_FUNCTION__);
return;
}
}
@ -780,7 +782,7 @@ void cFemonOsd::Show(void)
void cFemonOsd::ChannelSwitch(const cDevice * deviceP, int channelNumberP, bool liveViewP)
{
debug("%s(%d,%d)\n", __PRETTY_FUNCTION__, deviceP->DeviceNumber(), channelNumberP);
debug1("%s (%d, %d, %d)", __PRETTY_FUNCTION__, deviceP->DeviceNumber(), channelNumberP, liveViewP);
eTrackType track = cDevice::PrimaryDevice()->GetCurrentAudioTrack();
const cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel());
@ -814,7 +816,7 @@ void cFemonOsd::ChannelSwitch(const cDevice * deviceP, int channelNumberP, bool
if (frontendM >= 0) {
if (ioctl(frontendM, FE_GET_INFO, &frontendInfoM) < 0) {
if (!FemonConfig.GetUseSvdrp())
error("cFemonOsd::ChannelSwitch() cannot read frontend info.");
error("%s Cannot read frontend info", __PRETTY_FUNCTION__);
close(frontendM);
frontendM = -1;
memset(&frontendInfoM, 0, sizeof(frontendInfoM));
@ -826,7 +828,7 @@ void cFemonOsd::ChannelSwitch(const cDevice * deviceP, int channelNumberP, bool
return;
}
else {
error("cFemonOsd::ChannelSwitch() cannot open frontend device.");
error("%s Cannot open frontend device", __PRETTY_FUNCTION__);
return;
}
}
@ -843,7 +845,7 @@ void cFemonOsd::ChannelSwitch(const cDevice * deviceP, int channelNumberP, bool
void cFemonOsd::SetAudioTrack(int indexP, const char * const *tracksP)
{
debug("%s()\n", __PRETTY_FUNCTION__);
debug1("%s (%d, )", __PRETTY_FUNCTION__, indexP);
eTrackType track = cDevice::PrimaryDevice()->GetCurrentAudioTrack();
if (receiverM) {
receiverM->Deactivate();
@ -860,7 +862,7 @@ void cFemonOsd::SetAudioTrack(int indexP, const char * const *tracksP)
bool cFemonOsd::DeviceSwitch(int directionP)
{
debug("%s()\n", __PRETTY_FUNCTION__);
debug1("%s (%d)", __PRETTY_FUNCTION__, directionP);
int device = cDevice::ActualDevice()->DeviceNumber();
int direction = sgn(directionP);
if (device >= 0) {
@ -908,7 +910,7 @@ bool cFemonOsd::DeviceSwitch(int directionP)
if (NumUsableSlots && !HasInternalCam && !CamSlots.Get(j)->Assign(d, true))
continue; // CAM slot can't be used with this device
if (d->ProvidesChannel(channel, 0, &NeedsDetachAllReceivers)) { // this device is basically able to do the job
debug("%s(%d) device(%d)\n", __PRETTY_FUNCTION__, direction, device);
debug1("%s (%d) device=%d", __PRETTY_FUNCTION__, direction, device);
if (NumUsableSlots && !HasInternalCam && d->CamSlot() && d->CamSlot() != CamSlots.Get(j))
NeedsDetachAllReceivers = true; // using a different CAM slot requires detaching receivers
if (NumUsableSlots && !HasInternalCam)
@ -961,14 +963,14 @@ bool cFemonOsd::SvdrpConnect(void)
svdrpPluginM->Service("SvdrpCommand-v1.0", &cmd);
if (cmd.responseCode != 214) {
svdrpPluginM->Service("SvdrpConnection-v1.0", &svdrpConnectionM); // close connection
error("cFemonOsd::SvdrpConnect() cannot find plugin '%s' on server %s.", PLUGIN_NAME_I18N, *svdrpConnectionM.serverIp);
error("%s Cannot find plugin '%s' on server %s", __PRETTY_FUNCTION__, PLUGIN_NAME_I18N, *svdrpConnectionM.serverIp);
}
}
else
error("cFemonOsd::SvdrpConnect() cannot connect to SVDRP server.");
error("%s Cannot connect to SVDRP server", __PRETTY_FUNCTION__);
}
else
error("cFemonOsd::SvdrpConnect() cannot find plugin '%s'.", SVDRPPLUGIN);
error("%s Cannot find plugin '%s'", __PRETTY_FUNCTION__, SVDRPPLUGIN);
}
return svdrpConnectionM.handle >= 0;
}
@ -984,19 +986,19 @@ bool cFemonOsd::SvdrpTune(void)
svdrpPluginM->Service("SvdrpCommand-v1.0", &cmd);
if (cmd.responseCode == 250)
return true;
error("cFemonOsd::SvdrpTune() cannot tune server channel.");
error("%s Cannot tune server channel", __PRETTY_FUNCTION__);
}
else
error("cFemonOsd::SvdrpTune() invalid channel.");
error("%s Invalid channel", __PRETTY_FUNCTION__);
}
else
error("cFemonOsd::SvdrpTune() unexpected connection state.");
error("%s Unexpected connection state", __PRETTY_FUNCTION__);
return false;
}
double cFemonOsd::GetVideoBitrate(void)
{
debug("%s()\n", __PRETTY_FUNCTION__);
debug1("%s", __PRETTY_FUNCTION__);
double value = 0.0;
if (receiverM)
@ -1007,7 +1009,7 @@ double cFemonOsd::GetVideoBitrate(void)
double cFemonOsd::GetAudioBitrate(void)
{
debug("%s()\n", __PRETTY_FUNCTION__);
debug1("%s", __PRETTY_FUNCTION__);
double value = 0.0;
if (receiverM)
@ -1018,7 +1020,7 @@ double cFemonOsd::GetAudioBitrate(void)
double cFemonOsd::GetDolbyBitrate(void)
{
debug("%s()\n", __PRETTY_FUNCTION__);
debug1("%s", __PRETTY_FUNCTION__);
double value = 0.0;
if (receiverM)

View File

@ -18,6 +18,8 @@
#include <vdr/channels.h>
#include <vdr/transfer.h>
#include <vdr/tools.h>
#include "femonreceiver.h"
#include "svdrpservice.h"
#define MAX_BM_NUMBER 8

View File

@ -6,8 +6,9 @@
*/
#include <unistd.h>
#include "femontools.h"
#include "femonconfig.h"
#include "log.h"
#include "femontools.h"
#include "femonreceiver.h"
cFemonReceiver::cFemonReceiver(const cChannel *channelP, int aTrackP, int dTrackP)
@ -38,7 +39,7 @@ cFemonReceiver::cFemonReceiver(const cChannel *channelP, int aTrackP, int dTrack
ac3BitRateM(0),
ac3ValidM(false)
{
debug("%s()\n", __PRETTY_FUNCTION__);
debug1("%s (, %d, %d)", __PRETTY_FUNCTION__, aTrackP, dTrackP);
SetPids(NULL);
AddPid(videoPidM);
@ -74,13 +75,13 @@ cFemonReceiver::cFemonReceiver(const cChannel *channelP, int aTrackP, int dTrack
cFemonReceiver::~cFemonReceiver(void)
{
debug("%s()\n", __PRETTY_FUNCTION__);
debug1("%s", __PRETTY_FUNCTION__);
Deactivate();
}
void cFemonReceiver::Deactivate(void)
{
debug("%s()\n", __PRETTY_FUNCTION__);
debug1("%s", __PRETTY_FUNCTION__);
Detach();
if (activeM) {
activeM = false;
@ -92,7 +93,7 @@ void cFemonReceiver::Deactivate(void)
void cFemonReceiver::Activate(bool onP)
{
debug("%s(%d)\n", __PRETTY_FUNCTION__, onP);
debug1("%s (%d)", __PRETTY_FUNCTION__, onP);
if (onP)
Start();
else
@ -133,7 +134,7 @@ void cFemonReceiver::Receive(uchar *dataP, int lengthP)
void cFemonReceiver::Action(void)
{
debug("%s()\n", __PRETTY_FUNCTION__);
debug1("%s", __PRETTY_FUNCTION__);
cTimeMs calcPeriod(0);
activeM = true;

View File

@ -7,6 +7,7 @@
#include <vdr/menu.h>
#include "femonconfig.h"
#include "log.h"
#include "femontools.h"
#include "femonsetup.h"
@ -25,7 +26,7 @@ cMenuFemonSetup::cMenuFemonSetup()
useSvdrpM(FemonConfig.GetUseSvdrp()),
svdrpPortM(FemonConfig.GetSvdrpPort())
{
debug("%s()\n", __PRETTY_FUNCTION__);
debug1("%s", __PRETTY_FUNCTION__);
strn0cpy(svdrpIpM, FemonConfig.GetSvdrpIp(), sizeof(svdrpIpM));
dispModesM[eFemonModeBasic] = tr("basic");
@ -110,7 +111,7 @@ void cMenuFemonSetup::Setup(void)
void cMenuFemonSetup::Store(void)
{
debug("%s()\n", __PRETTY_FUNCTION__);
debug1("%s", __PRETTY_FUNCTION__);
// Store values into setup.conf
SetupStore("HideMenu", hideMenuM);
SetupStore("DisplayMode", displayModeM);

View File

@ -6,6 +6,7 @@
*/
#include <vdr/device.h>
#include "log.h"
#include "femontools.h"
#include "femonsymbol.h"
@ -118,7 +119,7 @@ void cFemonSymbolCache::Refresh()
int width, height;
double aspect, xfactor, yfactor;
cDevice::PrimaryDevice()->GetOsdSize(width, height, aspect);
debug("%s(): %dx%d\n", __PRETTY_FUNCTION__, width, height);
debug1("%s width=%d height=%d", __PRETTY_FUNCTION__, width, height);
xfactor = (double)width / DEFAULT_WIDTH;
yfactor = (double)height / DEFAULT_HEIGHT;
if (!DoubleEqual(xfactor, xFactorM) || !DoubleEqual(yfactor, yFactorM)) {
@ -130,7 +131,7 @@ void cFemonSymbolCache::Refresh()
bool cFemonSymbolCache::Populate(void)
{
debug("%s(): %.02fx%.02f\n", __PRETTY_FUNCTION__, xFactorM, yFactorM);
debug1("%s xFactor=%.02f yFactor=%.02f", __PRETTY_FUNCTION__, xFactorM, yFactorM);
if (!DoubleEqual(0.0, xFactorM) || !DoubleEqual(0.0, yFactorM)) {
Flush();
@ -188,7 +189,7 @@ bool cFemonSymbolCache::Populate(void)
bool cFemonSymbolCache::Flush(void)
{
debug("%s()\n", __PRETTY_FUNCTION__);
debug1("%s", __PRETTY_FUNCTION__);
for (int i = 0; i < cacheM.Size(); ++i) {
cBitmap *bmp = cacheM[i];
DELETENULL(bmp);
@ -204,7 +205,7 @@ cBitmap& cFemonSymbolCache::Get(eSymbols symbolP)
if (symbolP < cacheM.Size())
bitmapM = cacheM[symbolP];
else
error("%s(): Invalid symbol %d\n", __PRETTY_FUNCTION__, symbolP);
error("%s (%d) Invalid symbol", __PRETTY_FUNCTION__, symbolP);
return *bitmapM;
}

View File

@ -14,14 +14,6 @@
#include <vdr/remux.h>
#include <vdr/tools.h>
#ifdef DEBUG
#define debug(x...) dsyslog("FEMON: " x);
#define error(x...) esyslog("ERROR: " x);
#else
#define debug(x...) ;
#define error(x...) esyslog("ERROR: " x);
#endif
#define ELEMENTS(x) (sizeof(x) / sizeof(x[0]))
#define FRONTEND_DEVICE "/dev/dvb/adapter%d/frontend%d"

48
log.h Normal file
View File

@ -0,0 +1,48 @@
/*
* log.h: Frontend Status Monitor plugin for the Video Disk Recorder
*
* See the README file for copyright information and how to reach the author.
*
*/
#ifndef __FEMON_LOG_H
#define __FEMON_LOG_H
#include "femonconfig.h"
#define error(x...) esyslog("FEMON-ERROR: " x)
#define info(x...) isyslog("FEMON: " x)
// 0x0001: Generic call stack
#define debug1(x...) void( FemonConfig.IsTraceMode(cFemonConfig::eTraceModeDebug1) ? dsyslog("FEMON1: " x) : void() )
// 0x0002: H.264
#define debug2(x...) void( FemonConfig.IsTraceMode(cFemonConfig::eTraceModeDebug2) ? dsyslog("FEMON2: " x) : void() )
// 0x0004: TBD
#define debug3(x...) void( FemonConfig.IsTraceMode(cFemonConfig::eTraceModeDebug3) ? dsyslog("FEMON3: " x) : void() )
// 0x0008: TBD
#define debug4(x...) void( FemonConfig.IsTraceMode(cFemonConfig::eTraceModeDebug4) ? dsyslog("FEMON4: " x) : void() )
// 0x0010: TBD
#define debug5(x...) void( FemonConfig.IsTraceMode(cFemonConfig::eTraceModeDebug5) ? dsyslog("FEMON5: " x) : void() )
// 0x0020: TBD
#define debug6(x...) void( FemonConfig.IsTraceMode(cFemonConfig::eTraceModeDebug6) ? dsyslog("FEMON6: " x) : void() )
// 0x0040: TBD
#define debug7(x...) void( FemonConfig.IsTraceMode(cFemonConfig::eTraceModeDebug7) ? dsyslog("FEMON7: " x) : void() )
// 0x0080: TBD
#define debug8(x...) void( FemonConfig.IsTraceMode(cFemonConfig::eTraceModeDebug8) ? dsyslog("FEMON8: " x) : void() )
// 0x0100: TBD
#define debug9(x...) void( FemonConfig.IsTraceMode(cFemonConfig::eTraceModeDebug9) ? dsyslog("FEMON9: " x) : void() )
// 0x0200: TBD
#define debug10(x...) void( FemonConfig.IsTraceMode(cFemonConfig::eTraceModeDebug10) ? dsyslog("FEMON10: " x) : void() )
// 0x0400: TBD
#define debug11(x...) void( FemonConfig.IsTraceMode(cFemonConfig::eTraceModeDebug11) ? dsyslog("FEMON11: " x) : void() )
// 0x0800: TBD
#define debug12(x...) void( FemonConfig.IsTraceMode(cFemonConfig::eTraceModeDebug12) ? dsyslog("FEMON12: " x) : void() )
// 0x1000: TBD
#define debug13(x...) void( FemonConfig.IsTraceMode(cFemonConfig::eTraceModeDebug13) ? dsyslog("FEMON13: " x) : void() )
// 0x2000: TBD
#define debug14(x...) void( FemonConfig.IsTraceMode(cFemonConfig::eTraceModeDebug14) ? dsyslog("FEMON14: " x) : void() )
// 0x4000: TBD
#define debug15(x...) void( FemonConfig.IsTraceMode(cFemonConfig::eTraceModeDebug15) ? dsyslog("FEMON15: " x) : void() )
// 0x8000; Extra call stack
#define debug16(x...) void( FemonConfig.IsTraceMode(cFemonConfig::eTraceModeDebug16) ? dsyslog("FEMON16: " x) : void() )
#endif // __FEMON_LOG_H