[Libav-user] [libav-user] demuxing of incoming rtp stream by means of libavformat and custom IO

Andrey Utkin andrey.krieger.utkin at gmail.com
Fri Feb 24 13:05:40 CET 2012

2012/2/24 Dmitry Volyntsev <xeioexception at gmail.com>:
> OK, if so. May be I wrong.
> Could you, please, explain how can I integrate the libavformat rtsp protocol
> to my program, in case it already has own global event loop.
> Using libavformat in case of rtsp format leads to blockage of my event loop
> from time to time.

I don't quite know yet how your event loop looks like, and what
functions it serves.
I'd propose running libavformat reading in a separate thread.
Using struct/object with context data of your application, and mutex,
you can track how much data you have processed, when did you receive
last data portion, use that data actually etc.
For immediate interruption (closing) of stream reading, use
avio_open2() int_cb parameter (see libavformat/avio.h).

Andrey Utkin

More information about the Libav-user mailing list