上一篇文章说了一下媒体文件解码的流程,在该基础上再对其中的第一个过程Demux在ffmpeg中是如何实现的进行说明。
ffmpeg中用来进行Demux的关键函数是avformat_open_input,这里先贴一下源码中的定义:
头文件:avformat.h
<span style="font-size:18px;"><span style="font-size:18px;">/**
* Open an input stream and read the header. The codecs are not opened.
* The stream must be closed with av_close_input_file().
*
* @param ps Pointer to user-supplied AVFormatContext (allocated by avformat_alloc_context).
* May be a pointer to NULL, in which case an AVFormatContext is allocated by this
* function and written into ps.
* Note that a user-supplied AVFormatContext will be freed on failure.
* @param filename Name of the stream to