Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pylon Feature Duplicates #49

Merged
merged 9 commits into from
Feb 18, 2021
Merged

Pylon Feature Duplicates #49

merged 9 commits into from
Feb 18, 2021

Conversation

mrstecklo
Copy link
Contributor

This PR generally resolves issues #47 and #48. And property handling modifications I've mentioned here
I've tested it on acA720-290gm and acA2040-55uc. This pair is a fairly good example of feature name duplicates. However they do not cover all of the possible aliases.

@joshdoe
Copy link
Owner

joshdoe commented Feb 12, 2021

Had a few minutes to test. I got an error when pixel format is left to "auto", setting to "Mono8" got past that. Got error setting BlackLevelRaw to 0.0 (had to set as Integer)

   // Configure black level
   if (is_prop_implicit (src, PROP_BLACKLEVEL)) {
-    const char *name =
-        feature_alias_available (src, "BlackLevel", "BlackLevelRaw");
-    if (name != NULL) {
-      GST_DEBUG_OBJECT (src, "Setting black level to %0.2lf", src->blacklevel);
+    if (feature_available (src, "BlackLevel")) {
+      GST_DEBUG_OBJECT (src, "Setting BlackLevel to %0.2lf", src->blacklevel);
       res =
-          PylonDeviceSetFloatFeature (src->deviceHandle, name, src->blacklevel);
+          PylonDeviceSetFloatFeature (src->deviceHandle, "BlackLevel", src->blacklevel);
       PYLONC_CHECK_ERROR (src, res);
+    } else if (feature_available(src, "BlackLevelRaw")) {
+      GST_DEBUG_OBJECT(src, "Setting BlackLevelRaw to %d", (int)src->blacklevel);
+      res =
+        PylonDeviceSetIntegerFeature(src->deviceHandle, "BlackLevelRaw", (int)src->blacklevel);
+      PYLONC_CHECK_ERROR(src, res);
     }
     reset_prop (src, PROP_BLACKLEVEL);
   }

I'll see what's up with the auto not working.

@joshdoe
Copy link
Owner

joshdoe commented Feb 12, 2021

pixel-format=auto no longer works, because _set_caps() doesn't get called until after _start(). If I change this:

@@ -3632,7 +3635,7 @@ gst_pylonsrc_start (GstBaseSrc * bsrc)


   if (!gst_pylonsrc_select_device (src) ||
-      !gst_pylonsrc_connect_device (src) || !gst_pylonsrc_set_properties (src))
+      !gst_pylonsrc_connect_device (src))
     goto error;

   src->caps = gst_pylonsrc_get_supported_caps (src);

I get past that, but then width and height are set to zero, so then I have to manually set both width and height.

I'll have to think of a way to fix the auto format issue, if fixed I should also set the width, height, and framerate from the negotiated caps.

If you have insights for these fixes let me know, I can't look at it again until next week. Thanks for the PR!

@mrstecklo
Copy link
Contributor Author

Found and fixed some more float features with integer aliases. Wonder how I've missed them at first time.
Moved resolving pixel format to negotiation phase. Probably _set_caps() could be improved to handle resolution and framerate in the same manner as pixel-format.

@joshdoe
Copy link
Owner

joshdoe commented Feb 17, 2021

Ok seems to work pretty now. @mrstecklo ready to merge then?

@mrstecklo
Copy link
Contributor Author

@joshdoe sure

@joshdoe joshdoe merged commit 19a1988 into joshdoe:master Feb 18, 2021
@mrstecklo mrstecklo deleted the duplicates branch February 19, 2021 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants