Elements: FocusAnalyze: Use BinBase, add focus mark
Signed-off-by: Vasiliy Doylov <nekocwd@mainlining.org>
This commit is contained in:
parent
0d3ef9652a
commit
06406bb455
1 changed files with 44 additions and 49 deletions
|
@ -1,59 +1,54 @@
|
||||||
public class EyeNeko.Elements.FocusAnalyze : Gst.Bin {
|
public class EyeNeko.Elements.FocusAnalyze : BinBase {
|
||||||
public Gst.Element tee = Gst.ElementFactory.make("tee");
|
public Gst.Element tee = Gst.ElementFactory.make ("tee");
|
||||||
public Gst.Element queue_analyze = Gst.ElementFactory.make("queue");
|
public Gst.Element queue_analyze = Gst.ElementFactory.make ("queue");
|
||||||
public Gst.Element glupload = Gst.ElementFactory.make("glupload");
|
public Gst.Element laplacian = Gst.ElementFactory.make ("gleffects_laplacian");
|
||||||
public Gst.Element laplacian = Gst.ElementFactory.make("gleffects_laplacian");
|
public Gst.Element gldownload = Gst.ElementFactory.make ("gldownload");
|
||||||
public Gst.Element gldownload = Gst.ElementFactory.make("gldownload");
|
public Gst.Element videoconvert = Gst.ElementFactory.make ("videoconvert");
|
||||||
public Gst.Element videoconvert = Gst.ElementFactory.make("videoconvert");
|
public Gst.Element videoanalyze = Gst.ElementFactory.make ("videoanalyse");
|
||||||
public Gst.Element videoanalyze = Gst.ElementFactory.make("videoanalyse");
|
public Gst.Element videoconvert2 = Gst.ElementFactory.make ("videoconvert");
|
||||||
public Gst.Element videoconvert2 = Gst.ElementFactory.make("videoconvert");
|
public Gst.Element gtk4paintablesink = Gst.ElementFactory.make ("gtk4paintablesink");
|
||||||
public Gst.Element gtk4paintablesink = Gst.ElementFactory.make("gtk4paintablesink");
|
|
||||||
|
|
||||||
public Gst.Element queue_passthrough = Gst.ElementFactory.make("queue");
|
public Gst.Element queue_passthrough = Gst.ElementFactory.make ("queue");
|
||||||
Gst.Pad sinkpad;
|
public double focus_mark { get; private set; }
|
||||||
Gst.Pad srcpad;
|
|
||||||
|
|
||||||
public Gdk.Paintable get_paintable() {
|
public Gdk.Paintable paintable {
|
||||||
|
owned get {
|
||||||
Gdk.Paintable paintable;
|
Gdk.Paintable paintable;
|
||||||
gtk4paintablesink.get("paintable", out paintable);
|
gtk4paintablesink.get ("paintable", out paintable);
|
||||||
return paintable;
|
return paintable;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool bus_callback (Gst.Bus bus, Gst.Message message) {
|
||||||
|
switch (message.type) {
|
||||||
|
case Gst.MessageType.ELEMENT:
|
||||||
|
if (message.get_structure ().get_name () == "GstVideoAnalyse") {
|
||||||
|
double val;
|
||||||
|
message.get_structure ().get_double ("luma-average", out val);
|
||||||
|
focus_mark = val;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
static construct {
|
static construct {
|
||||||
set_static_metadata(
|
set_static_metadata ("focusanalyze",
|
||||||
"focusanalyze",
|
|
||||||
"Filter",
|
"Filter",
|
||||||
"Focus analyze video filter.",
|
"Focus analyze video filter.",
|
||||||
"nekocwd@mainlining.org");
|
"nekocwd@mainlining.org");
|
||||||
|
|
||||||
add_static_pad_template(
|
|
||||||
{
|
|
||||||
"sink",
|
|
||||||
Gst.PadDirection.SINK,
|
|
||||||
Gst.PadPresence.ALWAYS,
|
|
||||||
{ null, "video/x-raw" }
|
|
||||||
});
|
|
||||||
add_static_pad_template(
|
|
||||||
{
|
|
||||||
"src",
|
|
||||||
Gst.PadDirection.SRC,
|
|
||||||
Gst.PadPresence.ALWAYS,
|
|
||||||
{ null, "video/x-raw" }
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public FocusAnalyze() {}
|
|
||||||
|
|
||||||
construct {
|
construct {
|
||||||
// Child elements
|
add_many (tee, queue_analyze, laplacian, gldownload, videoconvert, videoanalyze, videoconvert2, gtk4paintablesink, queue_passthrough);
|
||||||
add_many(tee, queue_analyze, glupload, laplacian, gldownload, videoconvert, videoanalyze, videoconvert2, gtk4paintablesink, queue_passthrough);
|
tee.link_many (queue_analyze, laplacian, gldownload, videoconvert, videoanalyze, videoconvert2, gtk4paintablesink);
|
||||||
tee.link_many(queue_analyze, glupload, laplacian, gldownload, videoconvert, videoanalyze, videoconvert2, gtk4paintablesink);
|
tee.link_many (queue_passthrough);
|
||||||
tee.link_many(queue_passthrough);
|
add_pads (tee, queue_passthrough);
|
||||||
// Sink Pad
|
var bus = new Gst.Bus ();
|
||||||
sinkpad = new Gst.GhostPad("sink", tee.get_static_pad("sink"));
|
videoanalyze.set_bus (bus);
|
||||||
add_pad(sinkpad);
|
bus.add_watch (0, bus_callback);
|
||||||
// Src Pad
|
|
||||||
srcpad = new Gst.GhostPad("src", queue_passthrough.get_static_pad("src"));
|
|
||||||
add_pad(srcpad);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue