diff options
author | Ratchanan Srirattanamet <peathot@hotmail.com> | 2019-09-27 23:31:57 +0700 |
---|---|---|
committer | Ratchanan Srirattanamet <peathot@hotmail.com> | 2019-10-02 13:29:52 +0700 |
commit | 182b4b56011b70fa9afdedf53d3c25f73028c335 (patch) | |
tree | c09047028f34f365e9295fe6ef726087a7ad3da5 /src/plugins/gstreamer/camerabin/camerabinsession.cpp | |
parent | 7aa08ffafd5ac69bca02038aae80ea014f444174 (diff) |
Gstreamer: also remove features when simplifying caps
Some element can return caps with same resolution/framerate but
different features. gst_simplify_caps() won't de-duplicate this,
resulting in duplicated entries for the same resolution/framerate.
This commit add calls to also remove features from the caps in addition
to setting name to video/x-raw.
The GST_CHECK_VERSION macro is added to maintain compatibility with
earlier version of Gstreamer without GstCapsFeatures.
[ChangeLog][CameraBin] Fixed duplicated entries in supported resolution/
framerate if the underlying element uses caps' features.
Change-Id: I15101899eb0369925013ccc1d925afb890a01205
Reviewed-by: VaL Doroshchuk <valentyn.doroshchuk@qt.io>
Diffstat (limited to 'src/plugins/gstreamer/camerabin/camerabinsession.cpp')
-rw-r--r-- | src/plugins/gstreamer/camerabin/camerabinsession.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/plugins/gstreamer/camerabin/camerabinsession.cpp b/src/plugins/gstreamer/camerabin/camerabinsession.cpp index b96ba6792..3e505a413 100644 --- a/src/plugins/gstreamer/camerabin/camerabinsession.cpp +++ b/src/plugins/gstreamer/camerabin/camerabinsession.cpp @@ -1312,6 +1312,9 @@ QList< QPair<int,int> > CameraBinSession::supportedFrameRates(const QSize &frame for (uint i=0; i<gst_caps_get_size(caps); i++) { GstStructure *structure = gst_caps_get_structure(caps, i); gst_structure_set_name(structure, "video/x-raw"); +#if GST_CHECK_VERSION(1,2,0) + gst_caps_set_features(caps, i, NULL); +#endif const GValue *oldRate = gst_structure_get_value(structure, "framerate"); if (!oldRate) continue; @@ -1424,6 +1427,9 @@ QList<QSize> CameraBinSession::supportedResolutions(QPair<int,int> rate, for (uint i=0; i<gst_caps_get_size(caps); i++) { GstStructure *structure = gst_caps_get_structure(caps, i); gst_structure_set_name(structure, "video/x-raw"); +#if GST_CHECK_VERSION(1,2,0) + gst_caps_set_features(caps, i, NULL); +#endif const GValue *oldW = gst_structure_get_value(structure, "width"); const GValue *oldH = gst_structure_get_value(structure, "height"); if (!oldW || !oldH) |