[gst-devel] Init pipeline in the function
wl2776
wl2776 at gmail.com
Thu Apr 22 09:56:06 CEST 2010
You can't change the function arguments in C, as they are passed by value.
You can, however, pass a pointer (a memory address) to a function, and it
can write something to that address. This will cause changing of values of
some variables outside the function.
Igor Mironchick wrote:
>
> Why can't I init pipeline in function and then use it somewhere else?
>
You must return the pointer from the function.
Igor Mironchick wrote:
>
> Here is the code example:
>
> void initPipeline( GstElement * pipeline )
> {
> pipeline = gst_pipeline_new( "camera" )
> }
>
> void main()
> {
> GstElement * pipeline;
>
> initPipeline( pipeline );
>
> // And here pipeline == 0 !!! Why?
> }
>
gst_pipeline_new allocates the memory and stores it in the variable
pipeline, but this variable is lost when the function returns.
--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Init-pipeline-in-the-function-tp2020111p2020185.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
More information about the gstreamer-devel
mailing list