Simple Example of Appsrc. How to get pointer to appsrc from pipeline.

Lad, Prabhakar prabhakar.csengg at gmail.com
Tue Aug 30 17:30:10 UTC 2016


On Tue, Aug 30, 2016 at 3:42 PM, BogdanS <bodyaf at gmail.com> wrote:
> Hi!
> I am trying to do really simple example of using appsrc.
> I have a sound card that outputs audio frame to buffer cardBuff (by
> callback).
>  I am building pipeline On the start of program
> */pipeline /= gst_parse_launch ("appsrc name= MySource ! audioparse
> channels=1 rate=8000 ! alawenc ! rtppcmapay ! udpsink host=192.168.2.50
> port=6010", NULL);*
>
> When buffer of card receive audioframe, will call a function *SendToStream*{
> Inside this function  I wrap CardBuff with *gst_buffer_new_wrapped*
>
> */buffer/=gst_buffer_new_wrapped ((gpointer)CardBuff, (gsize)CardBuffSize);*
>
> And here I want to use gst_app_src_push_buffer(GstAppSrc *appsrc, GstBuffer
> *buffer);
>
> As you see pointer to buffer I already have (*/buffer/*), But how I can get
> from pipeline that I already build with gst_parse_launch */pipeline /* a
> pointer to appsrc.  Maybe some function like
> pipeline->GetPointerToObjectByName("MySource")?
>

GstElement *appsrc;
appsrc = gst_bin_get_by_name(GST_BIN(pipeline), "MySource");

Cheers,
--Prabhakar Lad


More information about the gstreamer-devel mailing list