shmsink question

Olivier Crête olivier.crete at collabora.com
Wed Dec 7 15:29:43 PST 2011


On Wed, 2011-12-07 at 14:49 -0800, mattes wrote:
> I feeding gstreamer via the shm interface from my custom app.
> the file shmpipe.h  outlines shortly how to interact on the server side
> (acting like a sink/server).
> 
>  * First, create a writer with sp_writer_create()
>  * And selectes() on the socket from sp_get_fd()
>  * If the socket is closed or there are errors from any function, the app
>  * should call sp_close() and assume the writer is dead
>  * The server calls sp_writer_accept_client() when there is something to read
>  * from the server fd
>  * It then needs to select() on the socket from sp_writer_get_client_fd()
>  * If it gets an error on that socket, it call sp_writer_close_client().
>  * If there is something to read, it calls sp_writer_recv().
>  *
>  * The writer allocates buffers with sp_writer_alloc_block(),
>  * writes something in the buffer (retrieved with sp_writer_block_get_buf(),
>  * then calls  sp_writer_send_buf() to send the buffer or a subsection to
>  * the other side. When it is done with the block, it calls
>  * sp_writer_free_block().
>  * If alloc fails, then the server must wait for events from the clients before
>  * trying again.
> 
> 
> One thing that's not clear to me: Do I have to call sp_writer_alloc_block()
> for every single frame I pass on to sp_writer_send_buf()?
> Or is sp_writer_alloc_block() simply done once only at startup?

For every frame you want to send, you should allocate a new block. You
should also know that you can send only a part of a block, you don't
have to send the whole block. But you should not modify the content of a
block after doing a send (as it is shared memory). The trivial case is
alloc_block();get_buf();memcpy();send_buf();free_block();

-- 
Olivier Crête
olivier.crete at collabora.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20111207/8ba0f72f/attachment.pgp>


More information about the gstreamer-devel mailing list