<div>I found out the answer by myself. May be it could be useful for other ffmpeg newbies.</div><div><br></div><div>It is impossible to feed only rtp stream to libav for just depacketising purpose without establishing rtsp input by means of libav</div>
<div><br></div><div><div>//! Demuxer will use avio_open, no opened file should be provided by the caller.</div><div>#define AVFMT_NOFILE        0x0001        </div><div><br></div><div>[rtp @ 0x8d2500] Custom AVIOContext makes no sense and will be ignored with AVFMT_NOFILE format.</div>
<div><br></div><div>./libavformat/rtspenc.c:    .flags = AVFMT_NOFILE | AVFMT_GLOBALHEADER,</div><div>./libavformat/rtsp.c:    .flags = AVFMT_NOFILE,</div><div>./libavformat/rtspdec.c:    .flags = AVFMT_NOFILE,</div><div>
<br></div><div><br></div><div>    /*   </div><div>     * I/O context.</div><div>     *</div><div>     * decoding: either set by the user before avformat_open_input() (then</div><div>     * the user must close it manually) or set by avformat_open_input().</div>
<div>     * encoding: set by the user.</div><div>     *</div><div>     * Do NOT set this field if AVFMT_NOFILE flag is set in                                  </div><div>     * iformat/oformat.flags. In such a case, the (de)muxer will handle</div>
<div>     * I/O in some other way and this field will be NULL.</div><div>     */</div><div>    AVIOContext *pb; </div></div><div><br></div><div class="gmail_quote">On Fri, Feb 17, 2012 at 6:48 PM, Dmitry Volyntsev <span dir="ltr"><<a href="mailto:xeioexception@gmail.com" target="_blank">xeioexception@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>Hi All!</div><div><br></div><div>I have a question related to demuxing of incoming rtp stream by means of libavformat.</div>

<div><br></div><div>1) My program has it own event loop (libevent) and I can't easily integrate libavformat routines to reading from udp and tcp sockets straightforwardly</div>
<div>2) I already wrote custom IO routines and RTSP protocol negotiator (communicates with other side and requests streaming from RTSP server to local udp ports)</div><div><br></div><div>What I tried to do:</div><div><br>


</div><div> ioBuffer_ = (unsigned char *)av_mallocz(_IO_BUFFER_SIZE </div><div>                                                + FF_INPUT_BUFFER_PADDING_SIZE);</div><div>  </div><div> ioContext_ = avio_alloc_context(ioBuffer_, _IO_BUFFER_SIZE,</div>


<div>           0, ptr, my_read, NULL, NULL); </div><div><br></div><div><br></div><div> formatCtx_ = avformat_alloc_context();</div><div> formatCtx_->flags |= AVFMT_FLAG_CUSTOM_IO | AVFMT_FLAG_NONBLOCK;</div><div> formatCtx_->pb = ioContext_;</div>


<div> res = avformat_open_input(&formatCtx_, "spf-avs", NULL, NULL);</div><div><br></div><div><br></div><div>my_read() - reads incoming raw RTP stream packets</div><div><br></div><div>Unfortunately constantly returns AVERROR(EAGAIN) </div>


<div><br></div><div>I just want to feed raw RTP data to libavformat for demuxing  purposes and just get the pure videodata back for further processing</div><div><br></div><div>What should I do for to get it done?</div><div>


<br></div><div>Thanks in advance!</div><span><font color="#888888"><div><br></div>-- <br>Be happy,<div>Best regards,<br><div>Dmitry Volyntsev</div></div><br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br>Be happy,<div>Best regards,<br><div>Dmitry Volyntsev</div></div><br>