baseparse: how should I set "ANY" caps?

Yasushi SHOJI yashi at atmark-techno.com
Tue Dec 6 12:09:58 UTC 2016


Hello,

I'm tring to use GstBaseParse class. I've coded a subclass of it and got the following message at runtime.

** (gst-launch-1.0:30706): CRITICAL **: gst_pad_set_caps: assertion 'caps != NULL && gst_caps_is_fixed (caps)' failed
ERROR: from element /GstPipeline:pipeline0/GstTextParse:textparse0: No caps set

So, I added the following code right before calling
gst_base_parse_finish_frame().

	GstCaps *caps = gst_caps_new_any();
	gst_pad_set_caps(GST_BASE_PARSE_SRC_PAD(parse), caps);
	gst_caps_unref(caps);

Then I realized that caps returned by gst_caps_new_any() is not fixed.
I can do this to make my code work:

	GstCaps *caps = gst_caps_new_empty_simple("foo");

But it doesn't look right.

Is it odd to have cap ANY on pads for parser?  Why does
BaseParse::handle_frame() insist having caps set before calling
gst_base_parse_finish_frame()?

BTW, document[1] states that:

    GstBaseParse class calls set_sink_caps to inform the subclass
    about incoming sinkpad caps. Subclass could already set the srcpad
    caps accordingly, but this might be delayed until calling
    gst_base_parse_finish_frame() with a non-queued frame.

So I override set_sink_caps() with my function but doesn't seem to be called.

[1]: https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-libs/html/GstBaseParse.html#GstBaseParseFrame

Thanks,
-- 
           yashi


More information about the gstreamer-devel mailing list