baseparse: how should I set "ANY" caps?

Yasushi SHOJI yashi at atmark-techno.com
Wed Dec 14 12:23:20 UTC 2016


Hi,

Thank you for your reply.

On Wed, 14 Dec 2016 00:35:14 +0900,
Vivia Nikolaidou wrote:
>
> 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.

Ok.  So, it's just GstBaseParse's decision.

> 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.

Yes.  In fact, while I'm testing with fakesink, "foo/bar" seems to
work fine, too. ;-P

> 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.

I understand.

> Let me know if you have more questions.

I have two questions

1.  The doc[1] says that "GstBaseParse class calls set_sink_caps" in
    the Set-up phase, but I don't see it.  Does it really call the
    function?

2.  The same doc says that "Fixate the source pad caps when
    appropriate" and, at gst_base_parse_finish_frame ()[2], it says
    that "Source pad caps must be set when this is called.".  Where
    should I set srcpad' caps? I can do in handle_frame():

    	if (!gst_pad_has_current_caps(srcpad))
		gst_pad_set_caps(srcpad, caps);

    but, I don't feel it's a good place.

[1]: https://developer.gnome.org/gstreamer-libs/unstable/gstreamer-libs-GstBaseParse.html#gstreamer-libs-GstBaseParse.description
[2]: https://developer.gnome.org/gstreamer-libs/unstable/gstreamer-libs-GstBaseParse.html#gst-base-parse-finish-frame

Thanks,
--
            yashi


More information about the gstreamer-devel mailing list