Reading a file located in memory with libavformat

前端 未结 3 808
独厮守ぢ
独厮守ぢ 2020-12-12 18:30

I\'m currently trying to read small video files sent from a server

In order to read a file using libavformat, you are supposed to call

av_open_input_         


        
3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-12 18:55

    This is great information and helped me out quite a bit, but there are a couple of issues people should be aware of. libavformat can and will mess with your buffer that you gave to avio_alloc_context. This leads to really annoying double-free errors or possibly memory leaks. When I started searching for the problem, I found https://lists.ffmpeg.org/pipermail/libav-user/2012-December/003257.html which nailed it perfectly.

    My workaround when cleaning up from this work is to just go ahead and call

        av_free(avioContext->buffer)
    

    and then setting your own buffer pointer (that you allocated for your avio_alloc_context call) to NULL if you care.

提交回复
热议问题