niimaqdx: show attributes via DEBUG instead of printf

This commit is contained in:
Joshua M. Doe 2013-02-13 16:58:58 -05:00
parent 881a75b1f8
commit 5970685580

View File

@ -941,12 +941,13 @@ error:
} }
void void
listAttributes (IMAQdxSession session) gst_niimaqdxsrc_list_attributes (GstNiImaqDxSrc * niimaqdxsrc)
{ {
IMAQdxAttributeInformation *attributeInfoArray = NULL; IMAQdxAttributeInformation *attributeInfoArray = NULL;
uInt32 attributeCount; uInt32 attributeCount;
int i; int i;
IMAQdxError rval; IMAQdxError rval;
IMAQdxSession session = niimaqdxsrc->session;
char *attributeTypeStrings[] = { "U32", "I64", char *attributeTypeStrings[] = { "U32", "I64",
"F64", "F64",
"String", "String",
@ -960,12 +961,11 @@ listAttributes (IMAQdxSession session)
rval = rval =
IMAQdxEnumerateAttributes2 (session, NULL, &attributeCount, "", IMAQdxEnumerateAttributes2 (session, NULL, &attributeCount, "",
IMAQdxAttributeVisibilityAdvanced); IMAQdxAttributeVisibilityAdvanced);
GST_DEBUG ("Found %d attributes", attributeCount);
attributeInfoArray = g_new (IMAQdxAttributeInformation, attributeCount); attributeInfoArray = g_new (IMAQdxAttributeInformation, attributeCount);
rval = rval =
IMAQdxEnumerateAttributes2 (session, attributeInfoArray, &attributeCount, IMAQdxEnumerateAttributes2 (session, attributeInfoArray, &attributeCount,
"", IMAQdxAttributeVisibilityAdvanced); "", IMAQdxAttributeVisibilityAdvanced);
GST_DEBUG ("Enumerating %d attributes", attributeCount); GST_DEBUG_OBJECT (niimaqdxsrc, "Enumerating %d attributes", attributeCount);
for (i = 0; i < attributeCount; i++) { for (i = 0; i < attributeCount; i++) {
IMAQdxAttributeInformation *info = attributeInfoArray + i; IMAQdxAttributeInformation *info = attributeInfoArray + i;
g_assert (info); g_assert (info);
@ -975,19 +975,17 @@ listAttributes (IMAQdxSession session)
IMAQdxGetAttribute (session, info->Name, IMAQdxValueTypeString, IMAQdxGetAttribute (session, info->Name, IMAQdxValueTypeString,
attributeString); attributeString);
if (rval != IMAQdxErrorSuccess) { if (rval != IMAQdxErrorSuccess) {
GST_WARNING ("Failed to read value of attribute %s", info->Name); GST_WARNING_OBJECT (niimaqdxsrc,
"Failed to read value of attribute %s", info->Name);
continue; continue;
} }
} else } else
attributeString[0] = 0; attributeString[0] = 0;
printf ("%s, %s/%s, %s, %s\n", info->Name, info->Readable ? "R" : "-", GST_DEBUG_OBJECT (niimaqdxsrc, "%s, %s/%s, %s, %s\n",
info->Writable ? "W" : "-", attributeTypeStrings[info->Type], info->Name, info->Readable ? "R" : "-",
attributeString); info->Writable ? "W" : "-",
//gchar *newOutput = g_strconcat(output, line, NULL); attributeTypeStrings[info->Type], attributeString);
//g_free (output);
//g_free (line);
//output = newOutput;
} }
g_free (attributeInfoArray); g_free (attributeInfoArray);
} }
@ -1019,8 +1017,6 @@ gst_niimaqdxsrc_get_cam_caps (GstNiImaqDxSrc * niimaqdxsrc)
GST_LOG_OBJECT (niimaqdxsrc, "Retrieving attributes from IMAQdx device"); GST_LOG_OBJECT (niimaqdxsrc, "Retrieving attributes from IMAQdx device");
listAttributes (niimaqdxsrc->session);
rval = IMAQdxGetAttribute (niimaqdxsrc->session, IMAQdxAttributePixelFormat, rval = IMAQdxGetAttribute (niimaqdxsrc->session, IMAQdxAttributePixelFormat,
IMAQdxValueTypeString, &pixel_format); IMAQdxValueTypeString, &pixel_format);
gst_niimaqdxsrc_report_imaq_error (rval); gst_niimaqdxsrc_report_imaq_error (rval);
@ -1134,6 +1130,8 @@ gst_niimaqdxsrc_start (GstBaseSrc * src)
goto error; goto error;
} }
gst_niimaqdxsrc_list_attributes (niimaqdxsrc);
GST_LOG_OBJECT (niimaqdxsrc, "Creating ring with %d buffers", GST_LOG_OBJECT (niimaqdxsrc, "Creating ring with %d buffers",
niimaqdxsrc->ringbuffer_count); niimaqdxsrc->ringbuffer_count);