GNOME Bugzilla – Bug 775786
gst_structure_is_subset() conflicts with the design docs
Last modified: 2016-12-08 09:26:25 UTC
The design docs say that the superset can contain extra fields that are not in the subset (which makes sense from a mathematics point of view). The API docs and implementation don't allow this. i.e. gst_structure_is_subset (SUBSET: "test/test, channels=(int)1", SUPERSET: "test/test, channels=(int)1, rate=(int)1") returns FALSE. The implementation also allows the subset to contain extra fields not in the superset. gst_structure_is_subset (SUBSET: "test/test, channels=(int)1, rate=(int)1", SUPERSET: "test/test, channels=(int)1") returns TRUE. The only condition I could think of where this makes sense is that no field means any value rather than no value in which case the design docs need updating.
The code is right, the design docs are wrong. You have to think of it in terms of what caps the structure defines. (so A=channels=1,rate=1 is a subset of B=channels=1 because the B is also compatible with C=channels=1,rate=2 while A isn't).
Right, so the no field = ANY case above.
Yes, a missing field is as if the field exists and has every possible value. With the difference that no field is fixed, while an e.g. array or range is not. Can you fix up the design docs?
commit a3fe9f6a7df6a870a6f7bf94a94631a28b3d9d00 Author: Matthew Waters <matthew@centricular.com> Date: Thu Dec 8 20:22:53 2016 +1100 design/caps: fix and clarify subset operations with empty fields https://bugzilla.gnome.org/show_bug.cgi?id=775786