[gst-devel] Loop-based elements and pause state

Ramón García ramon_garcia_f at yahoo.com
Thu Aug 19 04:26:00 CEST 2004


 --- David Schleef <ds at schleef.org> escribió: 
> Loop-based elements are not "infinite loops", they
> are supposed to
> do as little as possible and then return. 
> Infinite-loop elements
> will fail miserably.

Are you sure?

A loop-based element should implement the
release_locks function. Before a state change, that
callback will be called. That function should arrange
things so that it causes the termination of the loop.
For instance, the element might contain a variable
that if set the loop terminates, or the element
contains a pipe, so that the loop terminates when
there is data available in the pipe, and the
release_locks function writes data to the pipe.

The release_locks callback is specified in
GstElementClass.

The release_locks function runs in the thread that
caused the state change, such as the application
thread. For the mechanism above to work, that thread
must be different from the thread of the loop function
(the thread of the element). Placing the element in
its own thread would be enough.

Ramon


		
______________________________________________
Renovamos el Correo Yahoo!: ¡100 MB GRATIS!
Nuevos servicios, más seguridad
http://correo.yahoo.es




More information about the gstreamer-devel mailing list