baseparse: how should I set "ANY" caps?

Vivia Nikolaidou n.vivia at gmail.com
Tue Dec 13 15:35:14 UTC 2016


Hi,

You shouldn't set ANY caps there. You could in theory set no caps at
all, but GstBaseParse doesn't allow that, so you really have to set
some caps, depending on what you're trying to parse.

>From what I can see, your element is a GstTextParse, correct? So you
are probably parsing text. In this case,
gst_caps_new_empty_simple("text/x-raw") should work.

This is just to prevent e.g. an audio parser getting a video buffer,
or (in your case) a text parser getting a non-text buffer.

Let me know if you have more questions.

Best regards,

Vivia

On 6 December 2016 at 14:09, Yasushi SHOJI <yashi at atmark-techno.com> wrote:
> 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
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


More information about the gstreamer-devel mailing list