Hi guys,
I followed the instructions on the gstd website to clone the repo & build
gstd. I was up and running in a matter of minutes. Gstd is awesome!
When I was using gstreamer before, I would always call gst-launch with "-v",
because I needed to parse the verbose output to get some information from
the caps output for the various elements. I was hoping I would be able to
retrieve some of this information from gst-client, but it looks like I can
only retrieve element properties (but not element pad caps).
So next I installed the Vala compiler and changed gstd-pipeline.vala, adding
the following method:
/**
Gets the actual caps for a pad of an element in the pipeline.
@param element, whose property value wants to be known
@param pad, pad name
*/
public string ? PadGetActualCaps (string element,
string pad)
{
Element e;
Pad p;
Caps caps;
Gst.Pipeline pipe;
pipe = pipeline as Gst.Pipeline;
e = pipe.get_child_by_name (element) as Element;
if (e == null) {
if (debug)
stderr.printf ("Gstd: Element %s not found on pipeline",
element);
return null;
}
p = e.get_pad (pad) as Pad;
if (p == null) {
if (debug)
stderr.printf ("Gstd: Pad %s of element %s not found", pad,
element);
return null;
}
caps = p.caps as Caps;
if (caps == null) {
if (debug)
stderr.printf ("Gstd: Caps not found for pad %s of element %s",
pad, element);
return null;
}
return caps.to_string ();
}
I was able to compile this and run it; the only problem is I need to get at
GST_PAD_CAPS(pad) rather than gst_pad_get_caps(pad), which is what Vala
seems to generate. (The macro returns whatever caps have been set on the
pad, whereas the function returns the set of caps the pad is capable of. In
my case, the former returns the same string I get from gst-launch, whereas
the latter returns "ANY".)
Now for the questions:
(1) Does my approach seem correct?
(2) Is this of any value to the project? I would be happy to push changes,
but want to make sure I'm following your standards / patterns / practices.
(3) Do you know what (if any) Vala code I can use to get GST_PAD_CAPS
instead of gst_pad_get_caps? I wound up just modifying and building the
generated C code...
Thanks for the great work on this! I'm really excited to start using it.
Thanks,
-Justin
|