[mythtv] [PATCH] FilterManager debug messages
Andrew Mahone
andrewmahone at eml.cc
Sun Feb 22 19:41:05 EST 2004
The attached patch makes error messages reported by FilterManager a bit
more consistent and informative. LoadFilter now uses the VERBOSE macro,
always checks for and reports the dlerror value after dlopen/dlsym, and
is a bit more paranoid (checks for FilterInfo having NULL libname or
symbol, and checks for NULL library/symbol handles, even if dlerror
returns NULL).
Also, my recent "MMX Blend" message included a patch, although I forgot
to note this in the subject. Just a heads up so it doesn't get missed ;-)
--
Andrew Mahone
andrewmahone AT eml DOT cc
-------------- next part --------------
Index: libs/libmythtv/filtermanager.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/filtermanager.cpp,v
retrieving revision 1.9
diff -u -r1.9 filtermanager.cpp
--- libs/libmythtv/filtermanager.cpp 21 Jan 2004 02:32:52 -0000 1.9
+++ libs/libmythtv/filtermanager.cpp 23 Feb 2004 00:12:24 -0000
@@ -172,7 +172,7 @@
else
{
VERBOSE(VB_IMPORTANT,QString("FilterManager: failed to load "
- "filter '%1'").arg(FiltName));
+ "filter '%1', no such filter exists").arg(FiltName));
FiltInfoChain.clear();
break;
}
@@ -249,8 +249,8 @@
}
else
{
- VERBOSE(VB_IMPORTANT, "FilterManager: failed to allocate FC "
- "for conver filter");
+ VERBOSE(VB_IMPORTANT, "FilterManager: memory allocation "
+ "failure, returning empty filter chain");
FiltInfoChain.clear();
break;
}
@@ -263,7 +263,8 @@
}
else
{
- VERBOSE(VB_IMPORTANT, "FilterManager: failed to allocate FC");
+ VERBOSE(VB_IMPORTANT, "FilterManager: memory allocation failure, "
+ "returning empty filter chain");
FiltInfoChain.clear();
break;
}
@@ -291,8 +292,8 @@
}
else
{
- VERBOSE(VB_IMPORTANT, "FilterManager: failed to allocate FC "
- "for conver filter");
+ VERBOSE(VB_IMPORTANT, "FilterManager: memory allocation "
+ "failure, returning empty filter chain");
FiltInfoChain.clear();
}
}
@@ -418,19 +419,41 @@
if (FiltInfo == NULL)
{
- cerr << "FilterManager::LoadFilter: called with NULL FilterInfo"
- << endl;
+ VERBOSE(VB_IMPORTANT, "FilterManager: LoadFilter called with NULL"
+ "FilterInfo");
+ return NULL;
+ }
+
+ if (FiltInfo->libname == NULL)
+ {
+ VERBOSE(VB_IMPORTANT, "FilterManager: LoadFilter called with invalid "
+ "FilterInfo (libname is NULL)");
+ return NULL;
+ }
+
+ if (FiltInfo->symbol == NULL)
+ {
+ VERBOSE(VB_IMPORTANT, "FilterManager: LoadFilter called with invalid "
+ "FilterInfo (symbol is NULL)");
return NULL;
}
handle = dlopen(FiltInfo->libname, RTLD_NOW);
- if (!handle)
+ if ((error = dlerror()))
+ {
+ VERBOSE(VB_IMPORTANT, QString("FilterManager: unable to load "
+ "shared library '%1', dlopen reports error '%2'")
+ .arg(FiltInfo->libname)
+ .arg(error));
+ return NULL;
+ }
+
+ if (handle == NULL)
{
- cerr << "FilterManager::LoadFilter: unable to load shared library "
- << FiltInfo->libname << endl;
- if ((error = dlerror()))
- cerr << "Dlopen error: " << error << endl;
+ VERBOSE(VB_IMPORTANT, QString("FilterManager: dlopen did not report "
+ "an error, but returned a NULL handle for shared library '%1'")
+ .arg(FiltInfo->libname));
return NULL;
}
@@ -441,16 +464,26 @@
if ((error = dlerror()))
{
- cerr << "FilterManager::LoadFilter: failed to load symbol "
- << FiltInfo->symbol << " from " << FiltInfo->libname << endl
- << "Dlopen error: " << error << endl;
- dlclose (handle);
+ VERBOSE(VB_IMPORTANT, QString("FilterManager: unable to load symbol "
+ "'%1' from shared library '%2', dlopen reports error '%3'")
+ .arg(FiltInfo->symbol)
+ .arg(FiltInfo->libname)
+ .arg(error));
+ return NULL;
+ }
+
+ if (InitFilter == NULL)
+ {
+ VERBOSE(VB_IMPORTANT, QString("FilterManager: dlopen did not report "
+ "an error, but returned NULL for symbol '%1' from shared "
+ "library '%2'")
+ .arg(FiltInfo->symbol,FiltInfo->libname));
return NULL;
}
Filter = (*InitFilter)(inpixfmt, outpixfmt, &width, &height, opts);
- if (!Filter)
+ if (Filter == NULL)
{
return NULL;
}
@@ -465,4 +498,3 @@
Filter->info = FiltInfo;
return Filter;
}
-
More information about the mythtv-dev
mailing list