[gst-devel] Simple Q: How to set Caps programmatically when assembly a pipeline in C

thiagossantos at gmail.com thiagossantos at gmail.com
Sat Nov 6 13:29:51 CET 2010


On Sat, Nov 6, 2010 at 9:23 AM, HaroldJRoth <dlafferty at gmail.com> wrote:

>
> This is a really simple question that for some reason I can't find an
> answer
> to in the docs.  This probably means I'm going about it all wrong, but here
> goes:
>
> I want to convert the following pipeline spec into 'C' code:
>
> gst-launch filesrc location=videotestsrc.ogg ! decodebin2 ! videoscale !
> video/x-raw-yuv, width=50 ! queue ! appsrc
>
> E.g. I want to scale the video output coming from decodebin2 to a width and
> format, then I want to pass it through a queue to my appsrc element.
>
> And I want to do it with the 'C' API.
>
> So, I'm thinking the bit in the middle needs to be something like:
>
> GstElement mVideoScaler = gst_element_factory_make("videoscale",
> "videoscaler");
> GstElement mDecoderOutput = gst_element_factory_make("decodebin2",
> "decoder");
> GstElement mVideoQueue = gst_element_factory_make("queue", "videoqueue");
>
> GstCaps* videoCaps = gst_caps_new_simple ("video/x-raw-yuv",
>             "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('I', '4', '2',
> '0'),
>             "width", G_TYPE_INT, 50,
>             NULL);
>
> gst_bin_add_many(GST_BIN(mGstPipeline), mDecoderOutput, mVideoScaler,
> mVideoQueue, NULL);
> gst_element_link_filtered (mDecoderOutput, mVideoScaler, videoCaps)
> gst_element_link_filtered (mVideoScaler, mVideoQueue)
>
>
> Does this seem sensible?
>

The caps on the middle of your gst-launch line is syntactic sugar. In the
pipeline it is converted to a 'capsfilter' element with the 'caps' property
set to the caps you provide. Try creating a capsfilter and setting its
property with g_object_set.


>
>
> --
> View this message in context:
> http://gstreamer-devel.966125.n4.nabble.com/Simple-Q-How-to-set-Caps-programmatically-when-assembly-a-pipeline-in-C-tp3029913p3029913.html
> Sent from the GStreamer-devel mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> The Next 800 Companies to Lead America's Growth: New Video Whitepaper
> David G. Thomson, author of the best-selling book "Blueprint to a
> Billion" shares his insights and actions to help propel your
> business during the next growth cycle. Listen Now!
> http://p.sf.net/sfu/SAP-dev2dev
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>



-- 
Thiago Sousa Santos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20101106/1e7d5699/attachment.htm>


More information about the gstreamer-devel mailing list