Skip to content

Commit

Permalink
Convert VERBOSE -> LOG in libmythui
Browse files Browse the repository at this point in the history
  • Loading branch information
Beirdo committed Jun 29, 2011
1 parent 17f19ae commit 8c4064d
Show file tree
Hide file tree
Showing 49 changed files with 708 additions and 695 deletions.
19 changes: 9 additions & 10 deletions mythtv/libs/libmythui/AppleRemote.cpp
Expand Up @@ -67,7 +67,7 @@ void AppleRemote::startListening()
!_createDeviceInterface(hidDevice) ||
!_initCookies() || !_openDevice())
{
VERBOSE(VB_IMPORTANT, LOC + "startListening() failed");
LOG(VB_GENERAL, LOG_ERR, "startListening() failed");
stopListening();
return;
}
Expand Down Expand Up @@ -220,7 +220,7 @@ static io_object_t _findAppleRemoteDevice(const char *devName)
if ((ioReturnValue == kIOReturnSuccess) && (hidObjectIterator != 0))
hidDevice = IOIteratorNext(hidObjectIterator);
else
VERBOSE(VB_IMPORTANT, (LOC + "_findAppleRemoteDevice(%1) failed")
LOG(VB_GENERAL, LOG_ERR, QString("_findAppleRemoteDevice(%1) failed")
.arg(devName));

// IOServiceGetMatchingServices consumes a reference to the dictionary,
Expand Down Expand Up @@ -290,7 +290,7 @@ bool AppleRemote::_createDeviceInterface(io_object_t hidDevice)
(LPVOID*) (&hidDeviceInterface));

if (plugInResult != S_OK)
VERBOSE(VB_IMPORTANT, LOC + "_createDeviceInterface() failed");
LOG(VB_GENERAL, LOG_ERR, "_createDeviceInterface() failed");

// Release
if (plugInInterface)
Expand All @@ -315,19 +315,19 @@ bool AppleRemote::_openDevice()

if (ioReturnValue != KERN_SUCCESS)
{
VERBOSE(VB_IMPORTANT, LOC + "_openDevice() failed");
LOG(VB_GENERAL, LOG_ERR, "_openDevice() failed");
return false;
}
queue = (*hidDeviceInterface)->allocQueue(hidDeviceInterface);
if (!queue)
{
VERBOSE(VB_IMPORTANT, LOC + "_openDevice() - error allocating queue");
LOG(VB_GENERAL, LOG_ERR, "_openDevice() - error allocating queue");
return false;
}

HRESULT result = (*queue)->create(queue, 0, 12);
if (result != S_OK || !queue)
VERBOSE(VB_IMPORTANT, LOC + "_openDevice() - error creating queue");
LOG(VB_GENERAL, LOG_ERR, "_openDevice() - error creating queue");

for (std::vector<int>::iterator iter = cookies.begin();
iter != cookies.end();
Expand All @@ -340,17 +340,16 @@ bool AppleRemote::_openDevice()
ioReturnValue = (*queue)->createAsyncEventSource(queue, &eventSource);
if (ioReturnValue != KERN_SUCCESS)
{
VERBOSE(VB_IMPORTANT,
LOC + "_openDevice() - failed to create async event source");
LOG(VB_GENERAL, LOG_ERR,
"_openDevice() - failed to create async event source");
return false;
}

ioReturnValue = (*queue)->setEventCallout(queue, QueueCallbackFunction,
this, NULL);
if (ioReturnValue != KERN_SUCCESS)
{
VERBOSE(VB_IMPORTANT,
LOC + "_openDevice() - error registering callback");
LOG(VB_GENERAL, LOG_ERR, "_openDevice() - error registering callback");
return false;
}

Expand Down
22 changes: 11 additions & 11 deletions mythtv/libs/libmythui/DisplayRes.cpp
Expand Up @@ -60,7 +60,7 @@ bool DisplayRes::Initialize(void)
GetDisplayInfo(tW, tH, tW_mm, tH_mm, tRate, pixelAspectRatio);
mode[DESKTOP].Init();
mode[DESKTOP] = DisplayResScreen(tW, tH, tW_mm, tH_mm, -1.0, tRate);
VERBOSE(VB_GENERAL, QString("Desktop video mode: %1x%2 %3 Hz")
LOG(VB_GENERAL, LOG_NOTICE, QString("Desktop video mode: %1x%2 %3 Hz")
.arg(tW).arg(tH).arg(tRate, 0, 'f', 3));

// Initialize GUI mode
Expand Down Expand Up @@ -105,7 +105,7 @@ bool DisplayRes::Initialize(void)
max_width = std::max(max_width, screens[i].Width());
max_height = std::max(max_height, screens[i].Height());
}
VERBOSE(VB_PLAYBACK, QString("max_width: %1 max_height: %2")
LOG(VB_PLAYBACK, LOG_INFO, QString("max_width: %1 max_height: %2")
.arg(max_width).arg(max_height));

return true;
Expand All @@ -123,14 +123,14 @@ bool DisplayRes::SwitchToVideo(int iwidth, int iheight, double frate)
if (key != 0)
{
mode[next_mode = CUSTOM_VIDEO] = next = in_size_to_output_mode[key];
VERBOSE(VB_PLAYBACK, QString("Found custom screen override %1x%2")
LOG(VB_PLAYBACK, LOG_INFO, QString("Found custom screen override %1x%2")
.arg(next.Width()).arg(next.Height()));
}

// If requested refresh rate is 0, attempt to match video fps
if ((int) next.RefreshRate() == 0)
{
VERBOSE(VB_PLAYBACK,
LOG(VB_PLAYBACK, LOG_INFO,
QString("Trying to match best refresh rate %1Hz")
.arg(frate, 0, 'f', 3));
next.AddRefreshRate(frate);
Expand All @@ -142,14 +142,14 @@ bool DisplayRes::SwitchToVideo(int iwidth, int iheight, double frate)
bool chg = !(next == last) ||
!(DisplayResScreen::compare_rates(last.RefreshRate(),target_rate));

VERBOSE(VB_PLAYBACK, QString("Trying %1x%2 %3 Hz")
LOG(VB_PLAYBACK, LOG_INFO, QString("Trying %1x%2 %3 Hz")
.arg(next.Width()).arg(next.Height())
.arg(target_rate, 0, 'f', 3));

if (chg && !SwitchToVideoMode(next.Width(), next.Height(), target_rate))
{
VERBOSE(VB_IMPORTANT, QString("SwitchToVideo: Video size %1 x %2: "
"xrandr failed for %3 x %4")
LOG(VB_GENERAL, LOG_ERR, QString("SwitchToVideo: Video size %1 x %2: "
"xrandr failed for %3 x %4")
.arg(iwidth).arg(iheight)
.arg(next.Width()).arg(next.Height()));
return false;
Expand All @@ -158,7 +158,7 @@ bool DisplayRes::SwitchToVideo(int iwidth, int iheight, double frate)
cur_mode = next_mode;
last = next;

VERBOSE(VB_PLAYBACK,
LOG(VB_PLAYBACK, LOG_INFO,
QString("SwitchToVideo: Video size %1 x %2: \n"
" %7 displaying resolution %3 x %4, %5mm x %6mm")
.arg(iwidth).arg(iheight).arg(GetWidth()).arg(GetHeight())
Expand All @@ -181,12 +181,12 @@ bool DisplayRes::SwitchToGUI(tmode next_mode)
&& !(DisplayResScreen::compare_rates(last.RefreshRate(),
target_rate))));

VERBOSE(VB_GENERAL, QString("Trying %1x%2 %3 Hz")
LOG(VB_GENERAL, LOG_INFO, QString("Trying %1x%2 %3 Hz")
.arg(next.Width()).arg(next.Height()).arg(target_rate, 0, 'f', 3));

if (chg && !SwitchToVideoMode(next.Width(), next.Height(), target_rate))
{
VERBOSE(VB_IMPORTANT,
LOG(VB_GENERAL, LOG_ERR,
QString("SwitchToGUI: xrandr failed for %1x%2 %3 Hz")
.arg(next.Width()).arg(next.Height())
.arg(next.RefreshRate(), 0, 'f', 3));
Expand All @@ -196,7 +196,7 @@ bool DisplayRes::SwitchToGUI(tmode next_mode)
cur_mode = next_mode;
last = next;

VERBOSE(VB_GENERAL, QString("SwitchToGUI: Switched to %1x%2 %3 Hz")
LOG(VB_GENERAL, LOG_INFO, QString("SwitchToGUI: Switched to %1x%2 %3 Hz")
.arg(GetWidth()).arg(GetHeight()).arg(GetRefreshRate(), 0, 'f', 3));

return chg;
Expand Down
22 changes: 15 additions & 7 deletions mythtv/libs/libmythui/DisplayResX.cpp
Expand Up @@ -59,12 +59,15 @@ bool DisplayResX::SwitchToVideoMode(int width, int height, double desired_rate)
finalrate = (short) rate;
for (uint i=0; i < m_video_modes.size(); i++)
{
if ((m_video_modes[i].Width() == width) && (m_video_modes[i].Height() == height))
if ((m_video_modes[i].Width() == width) &&
(m_video_modes[i].Height() == height))
{
if (m_video_modes[i].Custom())
{
finalrate = m_video_modes[i].realRates[rate];
VERBOSE(VB_PLAYBACK, QString("Dynamic TwinView rate found, set %1Hz as XRandR %2") .arg(rate) .arg(finalrate));
LOG(VB_PLAYBACK, LOG_INFO,
QString("Dynamic TwinView rate found, set %1Hz as "
"XRandR %2") .arg(rate) .arg(finalrate));
}
break;
}
Expand All @@ -79,10 +82,11 @@ bool DisplayResX::SwitchToVideoMode(int width, int height, double desired_rate)
delete display;

if (RRSetConfigSuccess != status)
VERBOSE(VB_GENERAL, "XRRSetScreenConfigAndRate() call failed.");
LOG(VB_GENERAL, LOG_ERR,
"XRRSetScreenConfigAndRate() call failed.");
return RRSetConfigSuccess == status;
}
VERBOSE(VB_GENERAL, "Desired Resolution and FrameRate not found.");
LOG(VB_GENERAL, LOG_ERR, "Desired Resolution and FrameRate not found.");
return false;
}

Expand Down Expand Up @@ -137,7 +141,11 @@ const DisplayResVector& DisplayResX::GetVideoModes(void) const
newrates.push_back(screenmap[key]);
realRates[screenmap[key]] = (int) round(*it);
found = true;
// VERBOSE(VB_PLAYBACK, QString("CustomRate Found, set %1x%2@%3 as %4Hz") .arg(w) .arg(h) .arg(*it) .arg(screenmap[key]));
#if 0
LOG(VB_PLAYBACK, LOG_INFO,
QString("CustomRate Found, set %1x%2@%3 as %4Hz")
.arg(w) .arg(h) .arg(*it) .arg(screenmap[key]));
#endif
}
}
if (found)
Expand All @@ -162,7 +170,7 @@ static XRRScreenConfiguration *GetScreenConfig(MythXDisplay*& display)
display = OpenMythXDisplay();
if (!display)
{
VERBOSE(VB_IMPORTANT, "DisplaResX: MythXOpenDisplay call failed");
LOG(VB_GENERAL, LOG_ERR, "DisplaResX: MythXOpenDisplay call failed");
return NULL;
}

Expand All @@ -177,7 +185,7 @@ static XRRScreenConfiguration *GetScreenConfig(MythXDisplay*& display)
{
delete display;
display = NULL;
VERBOSE(VB_IMPORTANT, "DisplaResX: Unable to XRRgetScreenInfo");
LOG(VB_GENERAL, LOG_ERR, "DisplaResX: Unable to XRRgetScreenInfo");
}

return cfg;
Expand Down
33 changes: 14 additions & 19 deletions mythtv/libs/libmythui/jsmenu.cpp
Expand Up @@ -88,9 +88,8 @@ int JoystickMenuThread::Init(QString &config_file)
rc = ReadConfig(config_file);
if (rc)
{
VERBOSE(VB_GENERAL, LOC + QString("Joystick disabled - Failed "
"to read %1")
.arg(config_file));
LOG(VB_GENERAL, LOG_ERR,
QString("Joystick disabled - Failed to read %1") .arg(config_file));
return(rc);
}

Expand All @@ -100,25 +99,25 @@ int JoystickMenuThread::Init(QString &config_file)
m_fd = open(qPrintable(m_devicename), O_RDONLY);
if (m_fd == -1)
{
VERBOSE(VB_IMPORTANT, LOC_ERROR + QString("Joystick disabled - Failed "
"to open device %1")
LOG(VB_GENERAL, LOG_ERR,
QString("Joystick disabled - Failed to open device %1")
.arg(m_devicename));
return -1;
}

rc = ioctl(m_fd, JSIOCGAXES, &m_axesCount);
if (rc == -1)
{
VERBOSE(VB_IMPORTANT, LOC_ERROR + "Joystick disabled - ioctl "
"JSIOCGAXES failed");
LOG(VB_GENERAL, LOG_ERR,
"Joystick disabled - ioctl JSIOCGAXES failed");
return(rc);
}

ioctl(m_fd, JSIOCGBUTTONS, &m_buttonCount);
if (rc == -1)
{
VERBOSE(VB_IMPORTANT, LOC_ERROR + "Joystick disabled - ioctl "
"JSIOCGBUTTONS failed");
LOG(VB_GENERAL, LOG_ERR,
"Joystick disabled - ioctl JSIOCGBUTTONS failed");
return(rc);
}

Expand All @@ -131,10 +130,9 @@ int JoystickMenuThread::Init(QString &config_file)
m_axes = new int[m_axesCount];
memset(m_axes, '\0', sizeof(*m_axes * m_axesCount));

VERBOSE(VB_GENERAL, LOC + QString("Initialization of %1 succeeded using "
"config file %2")
.arg(m_devicename)
.arg(config_file));
LOG(VB_GENERAL, LOG_INFO,
QString("Initialization of %1 succeeded using config file %2")
.arg(m_devicename) .arg(config_file));
return 0;
}

Expand Down Expand Up @@ -183,12 +181,9 @@ int JoystickMenuThread::ReadConfig(QString config_file)
else if (firstTok.startsWith("chord") && tokens.count() == 4)
m_map.AddButton(tokens[2].toInt(), tokens[3], tokens[1].toInt());
else
VERBOSE(VB_IMPORTANT, LOC_ERROR + QString("ReadConfig(%1) "
"unrecognized or malformed line "
"\"%2\" ")
.arg(line)
.arg(rawline));

LOG(VB_GENERAL, LOG_ERR,
QString("ReadConfig(%1) unrecognized or malformed line \"%2\" ")
.arg(line) .arg(rawline));
}

fclose(fp);
Expand Down

0 comments on commit 8c4064d

Please sign in to comment.