Closed
Description
The facedetect plugin from gst-plugins-bad posts bus messages about detected faces which contain value lists of structures.
Trying to get the values via Structure.getValues(Class<T> type, String fieldName)
results in an exception:
if (message.getStructure() != null && message.getStructure().hasField("faces")) {
List<Structure> faces = message.getStructure().getValues(Structure.class, "faces");
}
->
org.freedesktop.gstreamer.Structure$InvalidFieldException: Structure does not contain Structure field 'faces'
at org.freedesktop.gstreamer.Structure.getValues(Structure.java:462)
My current workaround was to use register(TypeRegistration<?> registration)
for adding a registration like this: Natives.<Structure>registration(Structure.class, "GstStructure", Structure::new)
. This requires using a non-public API though.
If there is no other reason for omitting it, Gst.init()
should probably register a type adapter like this in Gst.loadAllClasses()
. I'm not exactly sure which TypeProvider
should provide it though.
If this seems like a good idea, I'll throw together a PR.