RTP: Backport gst_caps_copy_nth from GStreamer 1.16

This commit is contained in:
Marvin W 2021-03-21 15:42:58 +01:00
parent c6c677d62d
commit cde1e38f5d
No known key found for this signature in database
GPG key ID: 072E9235DB996F2A

View file

@ -104,14 +104,22 @@ public class Dino.Plugins.Rtp.Device : MediaDevice, Object {
best_index = i;
}
}
return device.caps.copy_nth(best_index);
return caps_copy_nth(device.caps, best_index);
} else if (device.caps.get_size() > 0) {
return device.caps.copy_nth(0);
return caps_copy_nth(device.caps, 0);
} else {
return new Gst.Caps.any();
}
}
// Backport from gst_caps_copy_nth added in GStreamer 1.16
private static Gst.Caps caps_copy_nth(Gst.Caps source, uint index) {
Gst.Caps target = new Gst.Caps.empty();
target.flags = source.flags;
target.append_structure_full(source.get_structure(index).copy(), source.get_features(index).copy());
return target;
}
private void create() {
debug("Creating device %s", id);
plugin.pause();