fixup! GST: Add caps selector
WIP Signed-off-by: Vasiliy Doylov <nekocwd@mainlining.org>
This commit is contained in:
parent
8fa4ac1e51
commit
de67da42ea
2 changed files with 10 additions and 1 deletions
|
@ -133,7 +133,12 @@ public class EyeNeko.Gstreamer : Object {
|
||||||
}
|
}
|
||||||
|
|
||||||
construct {
|
construct {
|
||||||
caps_selecton_model.set_model (available_caps);
|
var srt = new Gtk.SortListModel (available_caps, new Gtk.CustomSorter ((_a, _b) => {
|
||||||
|
var a = (FriendlyCaps) _a;
|
||||||
|
var b = (FriendlyCaps) _b;
|
||||||
|
return a.is_res_better (b) ? -1 : a.is_res_same (b) ? 0 : 1;
|
||||||
|
}));
|
||||||
|
caps_selecton_model.set_model (srt);
|
||||||
caps_selecton_model.notify["selected-item"].connect (() => start_stream_from (current_camera));
|
caps_selecton_model.notify["selected-item"].connect (() => start_stream_from (current_camera));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,10 @@ namespace EyeNeko {
|
||||||
return (width * height > cap.width * cap.height);
|
return (width * height > cap.width * cap.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool is_res_same (FriendlyCaps cap) {
|
||||||
|
return (width * height == cap.width * cap.height);
|
||||||
|
}
|
||||||
|
|
||||||
public Gst.Caps to_caps () {
|
public Gst.Caps to_caps () {
|
||||||
var res = new Gst.Caps.empty ();
|
var res = new Gst.Caps.empty ();
|
||||||
res.append_structure (struct.copy ());
|
res.append_structure (struct.copy ());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue