mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 16:50:47 +00:00
da03fde054
Original commit message from CVS: WARNING: Don't grab this updated unless you're really, REALLY sure. WARNING: Wait for the next one. Whole lotta changes here, including a few random bits: examples/*/Makefile: updated to use `libtool gcc`, not just `gcc` gst/ gstbuffer.h: updated to new flag style gst.c, gstdebug.h: added new debugging for function ptrs gstpipeline.c: set type of parent_class to the class, not the object gstthread.c: ditto plugins/ cdparanoia/cdparanoia.c: added an argument type, updated some defaults cobin/spindentity.c: updated to new do/while loopfunction style mp3encode/lame/gstlame.c: argument types, whole lotta lame options tests/: various changes Now, for the big changes: Once again, the scheduling system has changed. And once again, it broke a whole bunch of things. The gist of the change is that there is now a function pointer for gst_pad_push and gst_pad_pull, instead of a hard-wired function. Well, currently they are functions, but that's for debugging purposes only, they just call the function pointer after spewing lots of DEBUG(). This changed the GstPad structure a bit, and the GstPad API as well. Where elements used to provide chain() and pull() functions, they provide chain() and get() functions. gst_pad_set_pull[region]_function has been changed to get_pad_set_get[region]_function. This means all the elements out there that used to have pull functions need to be updated. The calls to that function have been changed in the normal elements, but the names of the functions passed is still _pull[region](), which is an aesthetic issue more than anything. As for what doesn't work yet, just about anything dealing with Connections is hosed, meaning threaded stuff won't work. This will be fixed about 12 hours from now, after I've slept, etc. The simplefake.c test works in both cothreaded and chained cases, but not much else will work due to the Connection problem. Needless to say, don't grab this unless you *need* these features *now*, else wait to update this stuff until tomorrow. I'm going to sleep now.
324 lines
11 KiB
Text
324 lines
11 KiB
Text
There are a number of different ways of coding a GstSrc. I'll try to
|
|
outline them and how the function here:
|
|
|
|
1a) Simple push-function based with single output
|
|
|
|
|
|
*------* *------
|
|
! ! !
|
|
! src !--->--! plugin
|
|
! ! !
|
|
*------* *------
|
|
|
|
This is the style that all the existing sources use. There is a single
|
|
output pad, and a _push function that's global to the whole element. The
|
|
_push function simply constructs buffers and pushes them out the pad.
|
|
|
|
Chained (current implementation):
|
|
|
|
|
|
bin src pad1 pad2 plugin
|
|
! (= pad1->peer)
|
|
gst_bin_iterate
|
|
!
|
|
! (find entry)
|
|
!
|
|
! gst_src_push
|
|
!---------------->!
|
|
! (create buffer)
|
|
!
|
|
! gst_pad_push
|
|
!---------------->!
|
|
!
|
|
! pad1->chainfunc (pad1->peer)
|
|
!------------------------------->!
|
|
! !
|
|
: :
|
|
(more chaining)
|
|
: :
|
|
!<-------------------------------!
|
|
!<----------------!
|
|
!<-----------------!
|
|
!
|
|
iteration ends
|
|
!
|
|
---
|
|
-
|
|
|
|
Typically this will be the/an entry into the Bin. The Bin's iterate
|
|
function simply calls the Src's _push function. When the _push function
|
|
pushes a buffer out it's pad, the chain function of the peer pad is
|
|
called, presumably causing a push out the other side of that element, and
|
|
eventually data gets to the other end. The stack unrolls, and the
|
|
iteration ends for that Src.
|
|
|
|
|
|
|
|
Cothreaded:
|
|
|
|
Again, the source would generally be an entry into the Bin. A loopfunc
|
|
will be constructed around it, which will simply loop calling the Src's
|
|
_push function as in the non-cothreaded case. When the _push function
|
|
pushes a buffer, it finds a pushfunc attached to the pad, drops the buffer
|
|
in the pen, and calls the pushfunc provided by the Bin. This causes a
|
|
switch to the next element, then the next, to the end, at which point a
|
|
buffer pull will travel back down the chain. The _push function gets
|
|
context and finishes, at which point the loopfunc wrapper simply calls it
|
|
again in the next iteration.
|
|
|
|
(current implementation):
|
|
|
|
|
|
bin cothread1 src pad1 pad2 cothread2 plugin
|
|
! (src) (= pad2->peer) (plugin)
|
|
gst_bin_iterate
|
|
!
|
|
! (first entry)
|
|
!
|
|
! cothread_switch
|
|
!---------------->!
|
|
! gst_src_push
|
|
!---------------->!
|
|
! (create buffer)
|
|
!
|
|
! gst_pad_push (pad1)
|
|
!
|
|
!--------------------!
|
|
! (fill bufpen)
|
|
!
|
|
! cothread switch
|
|
----------------------->!
|
|
! gst_pad_pull (pad2)
|
|
!
|
|
!<----------!
|
|
!
|
|
! (get buffer from bufpen)
|
|
!
|
|
!---------->!
|
|
! pad2->chainfunc
|
|
!------------->!
|
|
!
|
|
:
|
|
|
|
:
|
|
!<-------------!
|
|
! gst_pad_pull (pad2)
|
|
!<----------!
|
|
!
|
|
! (bufpen empty)
|
|
!<----------!
|
|
!<-------------------------------------! cothread switch
|
|
!<----------------!
|
|
!
|
|
iteration ends
|
|
!
|
|
:
|
|
|
|
:
|
|
!
|
|
next iteration
|
|
!
|
|
! cothread_switch
|
|
!---------------->!
|
|
! gst_src_push
|
|
!---------------->!
|
|
! (create buffer)
|
|
!
|
|
! gst_pad_push (pad1)
|
|
!
|
|
!--------------------!
|
|
! (fill bufpen)
|
|
!
|
|
! cothread switch
|
|
!---------->!
|
|
! (get buffer from bufpen)
|
|
!
|
|
!---------->!
|
|
! pad2->chainfunc
|
|
!------------->!
|
|
!
|
|
:
|
|
|
|
:
|
|
!<-------------!
|
|
! gst_pad_pull (pad2)
|
|
!<----------!
|
|
!
|
|
! (bufpen empty)
|
|
!<----------!
|
|
!<-------------------------------------! cothread switch
|
|
!<----------------!
|
|
!
|
|
iteration ends
|
|
!
|
|
:
|
|
|
|
|
|
-----------------------------------------------------------------------------------------------
|
|
1b) Simple push-function based with multiple output
|
|
|
|
Chained:
|
|
|
|
Similar to the single output variant, except several chains are spawned
|
|
off, one per push, hanging off whichever pad the buffer is pushed off of.
|
|
The stack will grow and unwind as many times as buffers are pushed out.
|
|
|
|
(current implementation)
|
|
|
|
bin src pad1 pad2 plugin
|
|
! (= pad1->peer)
|
|
gst_bin_iterate
|
|
!
|
|
! (find entry)
|
|
!
|
|
! gst_src_push
|
|
!---------------->!
|
|
! (create buffer)
|
|
!
|
|
! gst_pad_push
|
|
!---------------->!
|
|
!
|
|
! pad1->chainfunc (pad1->peer)
|
|
!------------------------------->!
|
|
! !
|
|
: :
|
|
(more chaining)
|
|
: :
|
|
!<-------------------------------!
|
|
!<----------------!
|
|
! (create buffer)
|
|
!
|
|
! gst_pad_push
|
|
!---------------->!
|
|
!
|
|
! pad1->chainfunc (pad1->peer)
|
|
!------------------------------->!
|
|
! !
|
|
: :
|
|
(more chaining)
|
|
: :
|
|
!<-------------------------------!
|
|
!<----------------!
|
|
:
|
|
(more pushes)
|
|
:
|
|
!<-----------------!
|
|
!
|
|
iteration ends
|
|
!
|
|
---
|
|
-
|
|
|
|
|
|
Cothreaded:
|
|
|
|
Also similar to the single output variant. When the pull winds its way
|
|
back from the first push, execution returns to the Src's _push function,
|
|
which simply goes off and pushes out another buffer, causing another
|
|
series of context switches. Eventually the loopfunc wrapper starts over,
|
|
round and round we go.
|
|
|
|
|
|
|
|
-----------------------------------------------------------------------------------------------
|
|
2) Pull-function based with single output
|
|
|
|
Similar to a regular filter with a chain function associated with each
|
|
pad, this kind of source doesn't provide a src-wide push function, but
|
|
does provide pullfuncs for its pad. A pullfunc puts a buffer in the pen
|
|
and exits.
|
|
|
|
Chained:
|
|
|
|
bin src pad1 pad2 plugin
|
|
! (= pad1->peer)
|
|
gst_bin_iterate
|
|
!
|
|
! (find entry)
|
|
!
|
|
! (find src pad
|
|
! of entry element)
|
|
!
|
|
! gst_pad_pull
|
|
!------------------------------------------------>!
|
|
? !
|
|
!<------------------------------!
|
|
!
|
|
! (create buffer)
|
|
!
|
|
! gst_pad_push
|
|
!------------------------------>!
|
|
! (bufpen filled)
|
|
(return buffer) !
|
|
!<------------------------------------------------!
|
|
!
|
|
! gst_pad_chain
|
|
!------------------------------------------------------------------->!
|
|
!
|
|
:
|
|
(more chaining)
|
|
:
|
|
!<-------------------------------------------------------------------!
|
|
!
|
|
iteration ends
|
|
!
|
|
---
|
|
-
|
|
|
|
As usual, is likely to be an entry into a Bin. The Bin iterate code must
|
|
explicitely pull a buffer and pass it on to the peer.
|
|
|
|
Cothreaded:
|
|
|
|
|
|
bin cothread1 src pad1 pad2 cothread2 plugin
|
|
! (src) (= pad2->peer) (plugin)
|
|
gst_bin_iterate
|
|
!
|
|
! (first entry)
|
|
!
|
|
! cothread_switch
|
|
!---------------->! gst_pad_pull
|
|
!------------------------------------------------>!
|
|
? !
|
|
!<------------------------------!
|
|
!
|
|
! (create buffer)
|
|
!
|
|
! gst_pad_push
|
|
!------------------------------>!
|
|
! (bufpen filled)
|
|
(return buffer) !
|
|
!<------------------------------------------------!
|
|
!
|
|
! pad_chain
|
|
!--------------------------------------! cothread switch
|
|
|---------------------->!
|
|
! gst_pad_pull (pad2)
|
|
!
|
|
!<----------!
|
|
!
|
|
! (get buffer from bufpen)
|
|
!
|
|
!---------->!
|
|
! pad2->chainfunc
|
|
!------------->!
|
|
!
|
|
:
|
|
|
|
:
|
|
!<-------------!
|
|
! gst_pad_pull (pad2)
|
|
!<----------!
|
|
!
|
|
! (bufpen empty)
|
|
!<-----------!
|
|
! cothread switch
|
|
!-------------------!
|
|
!<----------------!
|
|
!<----------------!
|
|
!
|
|
iteration ends
|
|
!
|
|
:
|
|
|