GST: Use GL acceleration
Signed-off-by: Vasiliy Doylov <nekocwd@mainlining.org>
This commit is contained in:
parent
d57a6b4475
commit
d0920db024
3 changed files with 17 additions and 12 deletions
|
@ -39,6 +39,7 @@ public class EyeNeko.Application : Adw.Application {
|
||||||
|
|
||||||
public override void activate () {
|
public override void activate () {
|
||||||
base.activate ();
|
base.activate ();
|
||||||
|
Gstreamer.instance.init ();
|
||||||
var win = this.active_window ?? new EyeNeko.Window (this);
|
var win = this.active_window ?? new EyeNeko.Window (this);
|
||||||
win.present ();
|
win.present ();
|
||||||
var styling = new Gtk.CssProvider ();
|
var styling = new Gtk.CssProvider ();
|
||||||
|
|
25
src/gst.vala
25
src/gst.vala
|
@ -152,11 +152,13 @@ public class EyeNeko.Gstreamer : Object {
|
||||||
|
|
||||||
private bool is_initialised = false;
|
private bool is_initialised = false;
|
||||||
public void init () {
|
public void init () {
|
||||||
if (is_initialised)
|
if (is_initialised) {
|
||||||
|
warning ("Gstreamer init duplicated");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
is_initialised = true;
|
is_initialised = true;
|
||||||
|
viewfinder.bind_property ("paintable", this, "viewfinder-paintable", GLib.BindingFlags.SYNC_CREATE);
|
||||||
camerabin.set_property ("camera-source", camerasrc_wrapper);
|
camerabin.set_property ("camera-source", camerasrc_wrapper);
|
||||||
camerabin.set_property ("viewfinder-sink", viewfinder);
|
|
||||||
color_correction_matrix.red_in_red = 1f;
|
color_correction_matrix.red_in_red = 1f;
|
||||||
color_correction_matrix.blue_in_blue = 1f;
|
color_correction_matrix.blue_in_blue = 1f;
|
||||||
color_correction_matrix.green_in_green = 0.9f;
|
color_correction_matrix.green_in_green = 0.9f;
|
||||||
|
@ -192,11 +194,18 @@ public class EyeNeko.Gstreamer : Object {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
viewfinder.bind_property ("paintable", this, "viewfinder-paintable", GLib.BindingFlags.SYNC_CREATE);
|
|
||||||
Gdk.GLContext context;
|
Gdk.GLContext context;
|
||||||
viewfinder_paintable.get ("gl-context", out context);
|
viewfinder_paintable.get ("gl-context", out context);
|
||||||
if (context != null)
|
if (context != null) {
|
||||||
message ("GL supported");
|
message ("GL supported <3");
|
||||||
|
var gl_sink = Gst.ElementFactory.make ("glsinkbin");
|
||||||
|
gl_sink.set_property ("sink", viewfinder);
|
||||||
|
camerabin.set_property ("viewfinder-sink", gl_sink);
|
||||||
|
} else {
|
||||||
|
warning ("GL NOT supported. Viewfinder will be slow as shit");
|
||||||
|
camerabin.set_property ("viewfinder-sink", viewfinder);
|
||||||
|
}
|
||||||
|
|
||||||
camerabin.bus.add_watch (0, bus_callback);
|
camerabin.bus.add_watch (0, bus_callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,10 +260,4 @@ public class EyeNeko.Gstreamer : Object {
|
||||||
return _instance;
|
return _instance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static string[] gst_args = {};
|
|
||||||
static construct {
|
|
||||||
unowned var a = gst_args;
|
|
||||||
Gst.init (ref a);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,11 +19,12 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int main (string[] args) {
|
int main (string[] args) {
|
||||||
|
Gst.init (ref args);
|
||||||
|
|
||||||
Intl.bindtextdomain (Config.GETTEXT_PACKAGE, Config.LOCALEDIR);
|
Intl.bindtextdomain (Config.GETTEXT_PACKAGE, Config.LOCALEDIR);
|
||||||
Intl.bind_textdomain_codeset (Config.GETTEXT_PACKAGE, "UTF-8");
|
Intl.bind_textdomain_codeset (Config.GETTEXT_PACKAGE, "UTF-8");
|
||||||
Intl.textdomain (Config.GETTEXT_PACKAGE);
|
Intl.textdomain (Config.GETTEXT_PACKAGE);
|
||||||
|
|
||||||
var app = new EyeNeko.Application ();
|
var app = new EyeNeko.Application ();
|
||||||
EyeNeko.Gstreamer.instance.init ();
|
|
||||||
return app.run (args);
|
return app.run (args);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue