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

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

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

BogdanS
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")?

I am started to learn gstreamer a few days ago. Please point me to my problems/


}
Reply | Threaded
Open this post in threaded view
|

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

Prabhakar Lad
On Tue, Aug 30, 2016 at 3:42 PM, BogdanS <[hidden email]> 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
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel