videotee linking to muxer queue Q

mattes effemm at mykmk.com
Mon Jun 23 12:19:57 PDT 2014


In case somebody is interested. Here is how I link the videotee src
to the muxer queue:

   // linkup pipeline
   gst_element_link_many( sourcvE, capsvE, vrateE, encodervE, identvE,
videotee, NULL ); 
   gst_element_link_many( squeuvE, rtmpvE, udpvE, NULL );
   gst_element_link_many( mqueuE, valvevE, identmE, NULL );

   // link src pad of video queue to sink pad of muxer
   GstPad *srcpadvideo = gst_element_get_static_pad( identmE, "src" );
   GstPad *sinkpadvideo = gst_element_get_request_pad( muxerE, "video_%d" );
   if (gst_pad_link ( srcpadvideo, sinkpadvideo) != GST_PAD_LINK_OK ){
      g_critical (" mqueue and muxer could not be linked.\n");
      gst_object_unref( pipeline );
      return 0;
   }
   gst_element_link( muxerE, sinkE );

   // Manually link the Tee, which has "Request" pads
   if ( !(tee_src_pad_template = gst_element_class_get_pad_template
(GST_ELEMENT_GET_CLASS (videotee), "src%d"))) {
      gst_object_unref (pipeline);
      g_printerr ("Unable to get pad template");
      return 0;  
   }
 
   // Obtaining request pads for the tee elements
   tee_q1_pad = gst_element_request_pad( videotee, tee_src_pad_template, NULL,
NULL );
   g_print ("Obtained request pad %s for qS branch.\n", gst_pad_get_name
(tee_q1_pad));
   qS_pad = gst_element_get_static_pad( squeuvE, "sink" );

   tee_q2_pad = gst_element_request_pad( videotee, tee_src_pad_template, NULL,
NULL );
   qM_pad = gst_element_get_static_pad( mqueuE, "sink" );

   // Link the tee to the stream queue
   if (gst_pad_link (tee_q1_pad, qS_pad) != GST_PAD_LINK_OK ){
      g_critical ("Tee for q1 could not be linked.\n");
      gst_object_unref( pipeline );
      return 0;
   }

   // Link the tee to the muxer queue
   if (gst_pad_link (tee_q2_pad, qM_pad) != GST_PAD_LINK_OK) {
      g_critical ("Tee for q2 could not be linked.\n");
      gst_object_unref (pipeline);
      return 0;

Now it successfully links to video source to both the muxer and streaming
queue.


On Thu, 05 Jun 2014 21:48:44 -0700 "mattes" <effemm at mykmk.com> wrote

> Try to link a capture queue via a videotee to streamer and  muxer queue.
> But having some trouble get the correct sink pad from the muxer queue.
> 
> It actually fails because it can't negotiate the caps. the video tee
> src pad carries video caps but for some reason the muxer queue sink shows
> audio caps.
> 
> How do I get the correct video sink from the muxer queue?
> 
> here my example:
> 
> -----
>    // linkup pipeline
>    gst_element_link_many( sourcvE, capsvE, vrateE, encodervE, identvE,
> videotee, NULL );
>    gst_element_link_many( squeuvE, rtmpvE, udpvE, NULL );
>    gst_element_link_many( mqueuE, identmE, muxerE, sinkE, NULL );
>    
>    GstPadTemplate *tee_src_pad_template;
>    GstPad *tee_q1_pad, *tee_q2_pad;
>    GstPad *qS_pad, *qM_pad;
> 
>    tee_src_pad_template = gst_element_class_get_pad_template
> (GST_ELEMENT_GET_CLASS (videotee), "src%d"))) {
>    tee_q1_pad = gst_element_request_pad( videotee, tee_src_pad_template,
> NULL, NULL );
>    qS_pad = gst_element_get_static_pad( squeuvE, "sink" );
>    gst_pad_link (tee_q1_pad, qS_pad) != GST_PAD_LINK_OK ){
> 
>    tee_q2_pad = gst_element_request_pad( videotee, tee_src_pad_template,
> NULL, NULL );
>    qM_pad = gst_element_get_static_pad( mqueuE, "sink" );
>    if (gst_pad_link (tee_q2_pad, qM_pad) != GST_PAD_LINK_OK) {
>       g_critical ("Tee for q2 could not be linked.\n");   /* it fails here */
>       gst_object_unref (pipeline);
>       return 0;
>    }
> --------
> 
> I already did the exact same thing successfully for audio streaming
> and it works fine there.
> 
> I stepped thru the video example with GST_DEBUG=5 and it complains about caps
> mismatch. I think it just get the wrong sink (audio instead video) and that's
> why it fails.
> 
> Any suggestions what I am doing wrong?
> 
> Mat



Matthias Kattanek

(831) 419-7924 [c]
(831) 786-9034 [h]
mkattanek at mykmk.com
mattesg1 at gmail.com




More information about the gstreamer-devel mailing list