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 () {
|
||||
base.activate ();
|
||||
Gstreamer.instance.init ();
|
||||
var win = this.active_window ?? new EyeNeko.Window (this);
|
||||
win.present ();
|
||||
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;
|
||||
public void init () {
|
||||
if (is_initialised)
|
||||
if (is_initialised) {
|
||||
warning ("Gstreamer init duplicated");
|
||||
return;
|
||||
}
|
||||
is_initialised = true;
|
||||
viewfinder.bind_property ("paintable", this, "viewfinder-paintable", GLib.BindingFlags.SYNC_CREATE);
|
||||
camerabin.set_property ("camera-source", camerasrc_wrapper);
|
||||
camerabin.set_property ("viewfinder-sink", viewfinder);
|
||||
color_correction_matrix.red_in_red = 1f;
|
||||
color_correction_matrix.blue_in_blue = 1f;
|
||||
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;
|
||||
viewfinder_paintable.get ("gl-context", out context);
|
||||
if (context != null)
|
||||
message ("GL supported");
|
||||
if (context != null) {
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -251,10 +260,4 @@ public class EyeNeko.Gstreamer : Object {
|
|||
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) {
|
||||
Gst.init (ref args);
|
||||
|
||||
Intl.bindtextdomain (Config.GETTEXT_PACKAGE, Config.LOCALEDIR);
|
||||
Intl.bind_textdomain_codeset (Config.GETTEXT_PACKAGE, "UTF-8");
|
||||
Intl.textdomain (Config.GETTEXT_PACKAGE);
|
||||
|
||||
var app = new EyeNeko.Application ();
|
||||
EyeNeko.Gstreamer.instance.init ();
|
||||
return app.run (args);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue