<div dir="ltr">So basically one would never have  two elements that are the same, and only differ in the name you made/created them with?<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, May 16, 2019 at 7:19 AM Nicolas Dufresne <<a href="mailto:nicolas@ndufresne.ca">nicolas@ndufresne.ca</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le mer. 15 mai 2019 23 h 25, R C <<a href="mailto:cjvijf@gmail.com" target="_blank">cjvijf@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF">
    <p><font size="+1"><tt>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)</tt></font></p>
    <p><font size="+1"><tt><br>
        </tt></font></p>
    <p><font size="+1"><tt>in the main part the declarations I had are:</tt></font></p>
    <p><font size="+1"><tt>// Create the elements<br>
          data.source = gst_element_factory_make("uridecodebin",
          "source");<br>
          data.audioconvert = gst_element_factory_make("audioconvert",
          "audioconvert");<br>
          data.audiosink = gst_element_factory_make("autoaudiosink",
          "audiosink");<br>
          data.videoconvert = gst_element_factory_make("videoconvert",
          "videoconvert");<br>
          data.videosink = gst_element_factory_make("autovideosink",
          "videosink");</tt></font></p>
    <p><font size="+1"><tt><br>
        </tt></font></p>
    <p><font size="+1"><tt>and I forgot to make the changes in the
          second part (pad_added_handler), surprised it worked, and
          seems counter-intuitive?</tt></font></p>
    <p><font size="+1"><tt>GstPad *audiosink_pad =
          gst_element_get_static_pad(data->audioconvert, "sink");<br>
          GstPad *videosink_pad =
          gst_element_get_static_pad(data->videoconvert, "sink");<br></tt></font></p></div></blockquote></div></div><div dir="auto">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).</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div bgcolor="#FFFFFF"><p><font size="+1"><tt>
        </tt></font></p>
    <p><font size="+1"><tt><br>
        </tt></font></p>
    <p><font size="+1"><tt>but  ..  why??  How can it even find the
          right GstElement, since none of the are named "sink"?<br>
        </tt></font></p>
    <p><font size="+1"><tt><br>
        </tt></font></p>
    <p><font size="+1"><tt>docs:</tt></font></p>
    <p><font size="+1"><tt>******************************************************************<br>
        </tt></font></p>
    <h3>gst_element_get_static_pad ()</h3>
    <pre class="gmail-m_-70094805929649237m_-8735804386836938389programlisting"><a class="gmail-m_-70094805929649237m_-8735804386836938389link" href="https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstPad.html" title="GstPad" rel="noreferrer" target="_blank"><span class="gmail-m_-70094805929649237m_-8735804386836938389returnvalue">GstPad</span></a> *
gst_element_get_static_pad (<em class="gmail-m_-70094805929649237m_-8735804386836938389parameter"><code><a class="gmail-m_-70094805929649237m_-8735804386836938389link" href="https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html" title="GstElement" rel="noreferrer" target="_blank"><span class="gmail-m_-70094805929649237m_-8735804386836938389type">GstElement</span></a> *element</code></em>,
                            <em class="gmail-m_-70094805929649237m_-8735804386836938389parameter"><code>const <a href="https://gstreamer.freedesktop.org/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar" rel="noreferrer" target="_blank"><span class="gmail-m_-70094805929649237m_-8735804386836938389type">gchar</span></a> *name</code></em>);</pre>
    <p>Retrieves a pad from <em class="gmail-m_-70094805929649237m_-8735804386836938389parameter"><code>element</code></em>
      by name. This version only retrieves
      already-existing (i.e. 'static') pads.</p>
    <p><b>Parameters</b></p>
    <p>element a <a class="gmail-m_-70094805929649237m_-8735804386836938389link" href="https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html" title="GstElement" rel="noreferrer" target="_blank"><span class="gmail-m_-70094805929649237m_-8735804386836938389type">GstElement</span></a> to
      find a static pad of.</p>
    <p>name the name of the static <a class="gmail-m_-70094805929649237m_-8735804386836938389link" href="https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstPad.html" title="GstPad" rel="noreferrer" target="_blank"><span class="gmail-m_-70094805929649237m_-8735804386836938389type">GstPad</span></a> to retrieve.</p>
    <h4>Returns</h4>
    <p>the requested <a class="gmail-m_-70094805929649237m_-8735804386836938389link" href="https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstPad.html" title="GstPad" rel="noreferrer" target="_blank"><span class="gmail-m_-70094805929649237m_-8735804386836938389type">GstPad</span></a> if
      found, otherwise <a href="https://gstreamer.freedesktop.org/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS" rel="noreferrer" target="_blank"><code class="gmail-m_-70094805929649237m_-8735804386836938389literal">NULL</code></a>. unref after usage.</p>
    <p>MT safe. <br>
    </p>
    <p>************************************************************************<br>
    </p>
    <p><br>
    </p>
    <p><br>
    </p>
    <p><font size="+1"><tt>thanks,</tt></font></p>
    <p><font size="+1"><tt><br>
        </tt></font></p>
    <p><font size="+1"><tt>Ron<br>
        </tt></font></p>
    <p><font size="+1"><tt><br>
        </tt></font></p>
    <p><font size="+1"><tt></tt></font><br>
    </p>
    <div class="gmail-m_-70094805929649237m_-8735804386836938389moz-cite-prefix">On 5/15/19 8:33 PM, R C wrote:<br>
    </div>
    <blockquote type="cite">
      
      <p><tt><font size="+1">Hello,</font></tt></p>
      <p><tt><font size="+1">I am trying to get a little more familiar
            with gstreamer, and thought I'd do some</font></tt></p>
      <p><tt><font size="+1">of the "basic" programming tutorial
            examples.</font></tt></p>
      <p><tt><font size="+1"><br>
          </font></tt></p>
      <p><tt><font size="+1">I </font></tt>did play with the 3rd
        example:</p>
      <p><a class="gmail-m_-70094805929649237m_-8735804386836938389moz-txt-link-freetext" href="https://gstreamer.freedesktop.org/documentation/tutorials/basic/dynamic-pipelines.html?gi-language=c" rel="noreferrer" target="_blank">https://gstreamer.freedesktop.org/documentation/tutorials/basic/dynamic-pipelines.html?gi-language=c</a></p>
      <p><br>
      </p>
      <p>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.<br>
      </p>
      <p><br>
      </p>
      <p>What I noticed is (well I probably missed something)...  but
        the function call:</p>
      <pre class="gmail-m_-70094805929649237m_-8735804386836938389language-c"><code class="gmail-m_-70094805929649237m_-8735804386836938389language-c">data<span class="gmail-m_-70094805929649237m_-8735804386836938389token gmail-m_-70094805929649237m_-8735804386836938389punctuation">.</span>sink <span class="gmail-m_-70094805929649237m_-8735804386836938389token gmail-m_-70094805929649237m_-8735804386836938389operator">=</span> gst_element_factory_make <span class="gmail-m_-70094805929649237m_-8735804386836938389token gmail-m_-70094805929649237m_-8735804386836938389punctuation">(</span><span class="gmail-m_-70094805929649237m_-8735804386836938389token gmail-m_-70094805929649237m_-8735804386836938389string">"autoaudiosink"</span><span class="gmail-m_-70094805929649237m_-8735804386836938389token gmail-m_-70094805929649237m_-8735804386836938389punctuation">,</span> <span class="gmail-m_-70094805929649237m_-8735804386836938389token gmail-m_-70094805929649237m_-8735804386836938389string">"sink"</span><span class="gmail-m_-70094805929649237m_-8735804386836938389token gmail-m_-70094805929649237m_-8735804386836938389punctuation">)</span><span class="gmail-m_-70094805929649237m_-8735804386836938389token gmail-m_-70094805929649237m_-8735804386836938389punctuation">;

</span>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:

</code><code class="gmail-m_-70094805929649237m_-8735804386836938389language-c">  data.convert = gst_element_factory_make ("audioconvert", "convert");   (original)
  data.sink = gst_element_factory_make ("autoaudiosink", "audiosink");   (changed name)<span class="gmail-m_-70094805929649237m_-8735804386836938389token gmail-m_-70094805929649237m_-8735804386836938389punctuation"></span></code>

of course in the even handler (pad_added_handler), the name needs to be changed in to:

<code class="gmail-m_-70094805929649237m_-8735804386836938389language-c">GstPad *sink_pad = gst_element_get_static_pad (data->convert, "audiosink");<span class="gmail-m_-70094805929649237m_-8735804386836938389token gmail-m_-70094805929649237m_-8735804386836938389punctuation">

Browsing through the code, that should be it, BUT it seems "</span></code><code class="gmail-m_-70094805929649237m_-8735804386836938389language-c">sink_pad</code>"<code class="gmail-m_-70094805929649237m_-8735804386836938389language-c"><span class="gmail-m_-70094805929649237m_-8735804386836938389token gmail-m_-70094805929649237m_-8735804386836938389punctuation"></span></code><code class="gmail-m_-70094805929649237m_-8735804386836938389language-c"></code> 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)

</pre>
    </blockquote>
  </div>

_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org" rel="noreferrer" target="_blank">gstreamer-devel@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" rel="noreferrer noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a></blockquote></div></div></div>
_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org" target="_blank">gstreamer-devel@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a></blockquote></div>