linking filters with caps

Chuck Crisler ccrisler at mutualink.net
Thu Nov 1 14:23:23 PDT 2012


Please help! I am stumped and confused by the terminology. I am using
GStreamer 0.10.(not sure). I am trying to capture from V4l2 and feed into
an H264 encoder (hardly novel). I want to specify the capture size and
format (I420). So I setup a caps filter. Here is a snipit of my code.

      g_object_set (G_OBJECT (source_), "device",
inputOptions_.ParameterDetails.adapter.cDevice,
                    "always-copy", FALSE, NULL);
      GstCaps *pSrcCaps = gst_caps_new_simple("video/x-raw-yuv",
          "format", G_TYPE_STRING, "I420", "width", G_TYPE_INT, 720,
"height", G_TYPE_INT, 480,
          "framerate", GST_TYPE_FRACTION, 30, 1, NULL);

      // Initialize the encoder.
      g_object_set (G_OBJECT (encoder_), "tune", (guint)4,  // zerolatency
                    "byte-stream", (gboolean)TRUE,
                    "bitrate",
(guint)inputOptions_.ParameterDetails.adapter.iTransmitBitrate, NULL);
...

      // Add the elements to the pipeline.
      gst_bin_add_many(GST_BIN(mainPipeline_), source_, encoder_, muxer_,
sink_, NULL);
      // Link the pipeline together.
      bRet = gst_element_link_filtered(source_, encoder_, pSrcCaps);
      gst_caps_unref(pSrcCaps);
      if (!bRet)
      {
         GST_DEBUG("Failed to link filtered elements in pipeline.");
         return bRet;
      }

It is complaining that it can't link the video source to the encoder with
my caps filter.

Here is a snipit of the log.

gstutils.c:1585:gst_element_link_pads: trying to link element
VideoSrc:(any) to element capsfilter0:sink
Nov  1 17:08:39 0:00:00.064704777 22354  0x88462d8
INFO        GST_ELEMENT_PADS
gstelement.c:944:gst_element_get_static_pad: found pad capsfilter0:sink
Nov  1 17:08:39 0:00:00.064792569 22354  0x88462d8
INFO                GST_PADS
gstutils.c:1493:prepare_link_maybe_ghosting: VideoSrc and capsfilter0
in same bin, no need for ghost pads
Nov  1 17:08:39 0:00:00.064950133 22354  0x88462d8
INFO                GST_PADS
gstpad.c:1886:gst_pad_link_prepare: trying to link VideoSrc:src and
capsfilter0:sink
Nov  1 17:08:39 0:00:00.069477022 22354  0x88462d8
INFO                GST_PADS
gstpad.c:2059:gst_pad_link: linked VideoSrc:src and capsfilter0:sink,
successful
Nov  1 17:08:39 0:00:00.069674954 22354  0x88462d8
INFO        GST_ELEMENT_PADS
gstutils.c:1585:gst_element_link_pads: trying to link element
capsfilter0:src to element VideoEncoder:(any)
Nov  1 17:08:39 0:00:00.069755204 22354  0x88462d8
INFO        GST_ELEMENT_PADS
gstelement.c:944:gst_element_get_static_pad: found pad capsfilter0:src
Nov  1 17:08:39 0:00:00.069826303 22354  0x88462d8
INFO                GST_PADS
gstutils.c:1046:gst_pad_check_link: trying to link capsfilter0:src and
VideoEncoder:src
Nov  1 17:08:39 0:00:00.069883154 22354  0x88462d8
INFO                GST_PADS
gstutils.c:1066:gst_pad_check_link: Sink pad VideoEncoder:src is not
sink pad, failed
Nov  1 17:08:39 0:00:00.069939587 22354  0x88462d8
INFO                GST_PADS
gstutils.c:1046:gst_pad_check_link: trying to link capsfilter0:src and
VideoEncoder:sink
Nov  1 17:08:39 0:00:00.084800392 22354  0x88462d8
INFO        GST_ELEMENT_PADS
gstutils.c:1209:gst_element_get_compatible_pad:<VideoEncoder> Could
not find a compatible pad to link to capsfilter0:src
Nov  1 17:08:39 0:00:00.084907739 22354  0x88462d8
INFO                 default
gstutils.c:1873:gst_element_link_pads_filtered: Could not link elements


Can anyone see my (probably silly/simple) mistake and point me in the right
direction?

Thank you very much!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20121101/6dd4a8a8/attachment.html>


More information about the gstreamer-devel mailing list