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 [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
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 <[hidden email]> 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 > [hidden email] > https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
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 _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |