Using appsrc in push mode

Antonio Ospite ao2 at ao2.it
Fri Mar 2 09:07:58 UTC 2018


On Thu, 1 Mar 2018 22:07:35 -0700 (MST)
Nostalgia <akra.hanine at gmail.com> wrote:

> Hi everyone,
> 
> I am interested in using appsrc for pushing data from an application to a
> gstreamer pipeline, and this for my university final project. Till now, they
> don't tell me what application I should use to produce multimedia data
> (probably it is yuv video/file) to be pushed to the pipeline (to processing
> the data and encode it ...). But I should, as first step, to understand the
> concept of gstreamer's pipeline and to make an example using appsrc. But I
> don't succeed to understand very well the concept of appsrc, so I found a
> code (this one is used by many people, and I put it in the end of my
> message) and I try it, but I didn't understand where is the data that we
> should push to the pipeline ?

Hi

appsrc is used BY/IN the program which produces the data, to push
the data TO a GStreamer pipeline.

Conversely appsink is used to get data FROM a GStreamer pipeline.

These are mechanisms to integrate GStreamer *inside* the code of a
program.

If you are interfacing with *external* applications on which you have
no control, there could be other mechanisms you could use to pass data
to GStreamer, depending on how the external application "exposes" the
produced data: does it write it to a file? Does it stream it via some
network protocol?

> From where the data will be pushed when executing the code ?

In the example you posted the data is *created* and pushed in
push_buffer() its' just that it's some dummy uninitialized data
because this is a trivial test application.

> What is the meaning of "is-live" property of appsrc ?

It affects how the synchronization with the other GStreamer elements in
the pipeline is performed, in this case it shouldn't really matter
if it's true or false because the sink is a file.

However others may provide better info on this point.

More details on live sources are here:
https://gstreamer.freedesktop.org/documentation/design/live-source.html

> When executing the code, from where data will be pushed to the appsrc ?

In this case the application is using some trivial data obtained
directly in push_buffer(), but in a real case you would have the data
provided by some other mechanism and then you'd have to wrap it into a
GstBuffer before pushing it.

> Thanks for helping me to understand the concept of using appsrc in general
> and how we can test the following code :
>

You just compile it and run it, and it will create an audio file with
unspecified content. It may be silence, it may be clicks, depending on
the memory content at the time of allocation.

You can compile it with this command line:

gcc $(pkg-config --cflags gstreamer-1.0 gstreamer-app-1.0) appsrc-test.c -o appsrc-test $(pkg-config --libs gstreamer-1.0 gstreamer-app-1.0)

Ciao,
   Antonio

-- 
Antonio Ospite
https://ao2.it
https://twitter.com/ao2it

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?


More information about the gstreamer-devel mailing list