Huh?: Gstreamer Basic Tutorial / API (3: Dynamic pipelines)

R C cjvijf at gmail.com
Thu May 16 13:22:36 UTC 2019


So basically one would never have  two elements that are the same, and only
differ in the name you made/created them with?

On Thu, May 16, 2019 at 7:19 AM Nicolas Dufresne <nicolas at ndufresne.ca>
wrote:

>
>
> Le mer. 15 mai 2019 23 h 25, R C <cjvijf at gmail.com> a écrit :
>
>> so while messing with it,  I forgot to change teh second part, and even
>> though it seems incosistent, can someone explain why this works?  (I am
>> just putting the declarations here,  rewritting to ugly got's into
>> something nicr is not the problem)
>>
>>
>> in the main part the declarations I had are:
>>
>> // Create the elements
>> data.source = gst_element_factory_make("uridecodebin", "source");
>> data.audioconvert = gst_element_factory_make("audioconvert",
>> "audioconvert");
>> data.audiosink = gst_element_factory_make("autoaudiosink", "audiosink");
>> data.videoconvert = gst_element_factory_make("videoconvert",
>> "videoconvert");
>> data.videosink = gst_element_factory_make("autovideosink", "videosink");
>>
>>
>> and I forgot to make the changes in the second part (pad_added_handler),
>> surprised it worked, and seems counter-intuitive?
>>
>> GstPad *audiosink_pad = gst_element_get_static_pad(data->audioconvert,
>> "sink");
>> GstPad *videosink_pad = gst_element_get_static_pad(data->videoconvert,
>> "sink");
>>
> The names in the first part are the element names, while in this callback,
> you are handling pad names. Pad names are chosen by the elements and follow
> the pattern in the pad template (see gst-inspect-1.0 element to see the
> template).
>
>
>
>> but  ..  why??  How can it even find the right GstElement, since none of
>> the are named "sink"?
>>
>>
>> docs:
>>
>> ******************************************************************
>> gst_element_get_static_pad ()
>>
>> GstPad <https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstPad.html> *
>> gst_element_get_static_pad (*GstElement <https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html> *element*,
>>                             *const gchar <https://gstreamer.freedesktop.org/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar> *name*);
>>
>> Retrieves a pad from *element* by name. This version only retrieves
>> already-existing (i.e. 'static') pads.
>>
>> *Parameters*
>>
>> element a GstElement
>> <https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html>
>> to find a static pad of.
>>
>> name the name of the static GstPad
>> <https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstPad.html>
>> to retrieve.
>> Returns
>>
>> the requested GstPad
>> <https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstPad.html>
>> if found, otherwise NULL
>> <https://gstreamer.freedesktop.org/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS>.
>> unref after usage.
>>
>> MT safe.
>>
>> ************************************************************************
>>
>>
>>
>> thanks,
>>
>>
>> Ron
>>
>>
>>
>> On 5/15/19 8:33 PM, R C wrote:
>>
>> Hello,
>>
>> I am trying to get a little more familiar with gstreamer, and thought I'd
>> do some
>>
>> of the "basic" programming tutorial examples.
>>
>>
>> I did play with the 3rd example:
>>
>>
>> https://gstreamer.freedesktop.org/documentation/tutorials/basic/dynamic-pipelines.html?gi-language=c
>>
>>
>> If I copy the example, and compile it, it works, no surprise there. But
>> when I change it and do the "exercise", I get some weirdness.
>>
>>
>> What I noticed is (well I probably missed something)...  but the function
>> call:
>>
>> data.sink = gst_element_factory_make ("autoaudiosink", "sink");
>> According to the docs, the 2nd parameter can be 'whatever' you want to name it.
>> Since I wanted to do the video part too, I figure I should change the name to
>> "audio-something", and changed the second function call to:
>>   data.convert = gst_element_factory_make ("audioconvert", "convert");   (original)
>>   data.sink = gst_element_factory_make ("autoaudiosink", "audiosink");   (changed name)
>>
>> of course in the even handler (pad_added_handler), the name needs to be changed in to:
>> GstPad *sink_pad = gst_element_get_static_pad (data->convert, "audiosink");
>>
>> Browsing through the code, that should be it, BUT it seems "sink_pad" always is NULL
>>  and the pipeline elements don't/can't be linked. (see errors below)
>>
>> since this is supposed to be a simple example,  what am I missing?
>>
>> thanks,
>>
>> Ron
>>
>>
>> errors:
>> # ./basic-tutorial-3
>> Pipeline state changed from NULL to READY:
>> Received new pad 'src_0' from 'source':
>>
>> (basic-tutorial-3:14679): GStreamer-CRITICAL **: 20:22:54.991: gst_pad_is_linked: assertion 'GST_IS_PAD (pad)' failed
>> It has type 'video/x-raw' which is not raw audio. Ignoring.
>>
>> (basic-tutorial-3:14679): GStreamer-CRITICAL **: 20:22:54.992: gst_object_unref: assertion 'object != NULL' failed
>> Received new pad 'src_1' from 'source':
>>
>> (basic-tutorial-3:14679): GStreamer-CRITICAL **: 20:22:54.992: gst_pad_is_linked: assertion 'GST_IS_PAD (pad)' failed
>>
>> (basic-tutorial-3:14679): GStreamer-CRITICAL **: 20:22:54.992: gst_pad_link_full: assertion 'GST_IS_PAD (sinkpad)' failed
>> Type is 'audio/x-raw' but link failed.
>>
>> (basic-tutorial-3:14679): GStreamer-CRITICAL **: 20:22:54.992: gst_object_unref: assertion 'object != NULL' failed
>> Error received from element source: Internal data stream error.
>> Debugging information: gstbasesrc.c(2950): gst_base_src_loop (): /GstPipeline:test-pipeline/GstURIDecodeBin:source/GstSoupHTTPSrc:source:
>> streaming stopped, reason not-linked (-1)
>>
>>
>> _______________________________________________
>> gstreamer-devel mailing list
>> gstreamer-devel at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20190516/fc627406/attachment.html>


More information about the gstreamer-devel mailing list