[FFmpeg-devel] Reopenning streams with av_open_input_file

Nicolas George nicolas.george at normalesup.org
Thu Jan 12 10:07:58 CET 2012


Le duodi 22 nivôse, an CCXX, Ratin a écrit :
> I have a query regarding re-openning streams but not overwrite whats
> already has been populated inside AVFormatContext. Lets say we have
> opened a file stream  (could be an RTMP stream) and we successfully
> populated the format context and the codec context
> (pFormatCtx->streams[streamIndex]->codec) within it are going to be
> used elsewhere. Then at some point connection breaks and we want to
> re-connect to the stream but we want to reuse the format context from
> before keeping most of the data within pFormatCtx intact (specially
> the same pointer pFormatCtx->streams[streamIndex]->codec needs to
> remain allocated).

I think what you must try to do is reopen the stream at the protocol level,
not at the demuxer level: call avio_open on the pb field of your format
context (after closing it, of course). It may work or not, depending on how
much the protocol and the demuxer are tied; you may need to re-seek to the
place the context was, too.

Please also note that this question is not about developing ffmpeg but
developing with ffmpeg libraries, and as such you were supposed to post on
libav-user at ffmpeg.org.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120112/9983e38a/attachment.asc>


More information about the ffmpeg-devel mailing list