open_input_file函数调用结构图(有些重复的函数调用就略掉了,大致是按流程往下的)。

函数大致说明:

AVFormatContext *avformat_alloc_context(void);

函数介绍:
 Allocate an AVFormatContext.
 avformat_free_context() can be used to free the context and everything
 allocated by the framework within it.

说明:为AVFormatContext分配空间,并设置缺省值,申请的空间用avformat_free_context()释放。

int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags);

函数介绍:
Set the given entry in *pm, overwriting an existing entry.
 *
 * Note: If AV_DICT_DONT_STRDUP_KEY or AV_DICT_DONT_STRDUP_VAL is set,
 * these arguments will be freed on error.
 *
 * @param pm pointer to a pointer to a dictionary struct. If *pm is NULL
 * a dictionary struct is allocated and put in *pm.
 * @param key entry key to add to *pm (will be av_strduped depending on flags)
 * @param value entry value to add to *pm (will be av_strduped depending on flags).
 *        Passing a NULL value will cause an existing entry to be deleted.
 * @return >= 0 on success otherwise an error code <0

说明:设置给定的AVDictionary数组,会覆盖已经存在的数据。

static AVCodec *find_codec_or_die(const char *name, enum AVMediaType type, int encoder)

函数说明:寻找编码器,找不到就退出程序。

AVDictionaryEntry *av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags);

函数说明:根据key来查找AVDictionaryEntry。

int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options);

函数介绍:
/**
 * Open an input stream and read the header. The codecs are not opened.
 * The stream must be closed with avformat_close_input().
 *
 * @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 open.
 * @param fmt If non-NULL, this parameter forces a specific input format.
 *            Otherwise the format is autodetected.
 * @param options  A dictionary filled with AVFormatContext and demuxer-private options.
 *                 On return this parameter will be destroyed and replaced with a dict containing
 *                 options that were not found. May be NULL.
 *
 * @return 0 on success, a negative AVERROR on failure.
 *
 * @note If you want to use custom IO, preallocate the format context and set its pb field.
 */
说明:打开input流并读取头信息,打开的流必须用avformat_close_input()关闭。

static AVCodec *choose_decoder(OptionsContext *o, AVFormatContext *s, AVStream *st)

函数说明:先调用MATCH_PER_STREAM_OPT匹配出codec_names若成功匹配,则调用find_codec_or_die查找解码器,若不成功则调用avcodec_find_decoder查找解码器。

AVDictionary **setup_find_stream_info_opts(AVFormatContext *s, AVDictionary *codec_opts);

函数介绍:
/**
 * Setup AVCodecContext options for avformat_find_stream_info().
 *
 * Create an array of dictionaries, one dictionary for each stream
 * contained in s.
 * Each dictionary will contain the options from codec_opts which can
 * be applied to the corresponding stream codec context.
 *
 * @return pointer to the created array of dictionaries, NULL if it
 * cannot be created
 */
说明:为avformat_find_stream_info函数创建AVDictionary**。

int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options);

函数介绍:
/**
 * Read packets of a media file to get stream information. This
 * is useful for file formats with no headers such as MPEG. This
 * function also computes the real framerate in case of MPEG-2 repeat
 * frame mode.
 * The logical file position is not changed by this function;
 * examined packets may be buffered for later processing.
 *
 * @param ic media file handle
 * @param options  If non-NULL, an ic.nb_streams long array of pointers to
 *                 dictionaries, where i-th member contains options for
 *                 codec corresponding to i-th stream.
 *                 On return each dictionary will be filled with options that were not found.
 * @return >=0 if OK, AVERROR_xxx on error
 *
 * @note this function isn't guaranteed to open all the codecs, so
 *       options being non-empty at return is a perfectly normal behavior.
 *
 * @todo Let the user decide somehow what information is needed so that
 *       we do not waste time getting stuff the user does not need.
 */
说明:读取media的packets来获取stram info,可用于读取没有头的MPEG文件信息,也可以计算MPEG-2 repeat frame mode的实际framerate。

static void add_input_streams(OptionsContext *o, AVFormatContext *ic)

函数介绍:
/* Add all the streams from the given input file to the global
 * list of input streams. */
说明:把给定的输入文件中的流加入全局输入流list里去。可以从函数调用图里看到,此函数用流的数目来做循环。

void av_dump_format(AVFormatContext *ic, int index, const char *url,  int is_output);

函数介绍:
/**
 * Print detailed information about the input or output format, such as
 * duration, bitrate, streams, container, programs, metadata, side data,
 * codec and time base.
 *
 * @param ic        the context to analyze
 * @param index     index of the stream to dump information about
 * @param url       the URL to print, such as source or destination file
 * @param is_output Select whether the specified context is an input(0) or output(1)
 */
说明:打印信息,如:duration, bitrate, streams, container, programs, metadata, side data, codec and time base。

static AVDictionary *strip_specifiers(AVDictionary *dict)

函数介绍:
/* return a copy of the input with the stream specifiers removed from the keys */
说明:拷贝dict。
http://blog.csdn.net/dancing_night/article/details/44962089
 

open_input_file函数调用结构图(转)的更多相关文章

  1. 转:RTMPdump使用相关

    在FFMPEG中使用libRTMP的经验 FFMPEG在编译的时候可以选择支持RTMP的类库libRTMP.这样ffmpeg就可以支持rtmp://, rtmpt://, rtmpe://, rtmp ...

  2. ffmpeg.c简单的结构功能分析(平局)

    当转码的研究看前一阵子FFmpeg资源. 因为ffmpeg.c与此相反的较长的代码.而有相当一部分人AVFilter相关代码(这部分已经不太熟悉),所以学习之前FFmpeg时间,还没有好好看看它的源代 ...

  3. FFmpeg资料来源简单分析:libswscale的sws_getContext()

    ===================================================== FFmpeg库函数的源代码的分析文章: [骨架] FFmpeg源码结构图 - 解码 FFmp ...

  4. FFmpeg源码简单分析:libswscale的sws_scale()

    ===================================================== FFmpeg的库函数源码分析文章列表: [架构图] FFmpeg源码结构图 - 解码 FFm ...

  5. RTMPdump(libRTMP)源代码分析 4: 连接第一步——握手(Hand Shake)

    ===================================================== RTMPdump(libRTMP) 源代码分析系列文章: RTMPdump 源代码分析 1: ...

  6. FFmpeg源代码简单分析:libswscale的sws_scale()

    ===================================================== FFmpeg的库函数源代码分析文章列表: [架构图] FFmpeg源代码结构图 - 解码 F ...

  7. FFmpeg源代码简单分析:libswscale的sws_getContext()

    ===================================================== FFmpeg的库函数源代码分析文章列表: [架构图] FFmpeg源代码结构图 - 解码 F ...

  8. FFmpeg源代码简单分析:日志输出系统(av_log()等)

    ===================================================== FFmpeg的库函数源代码分析文章列表: [架构图] FFmpeg源代码结构图 - 解码 F ...

  9. FFmpeg源代码简单分析:avformat_open_input()

    ===================================================== FFmpeg的库函数源代码分析文章列表: [架构图] FFmpeg源代码结构图 - 解码 F ...

随机推荐

  1. 裸眼3D全攻略3:拍摄3D—瞳距、镜距、视角偏转与空间感

    http://sd89.blog.163.com/blog/static/356041322014112532958728/ 3D图片的拍摄,与平面有着全新的不同要求,那就是空间感的表现. 简单来说, ...

  2. 2017-2018-1 JaWorld 团队作业--冲刺3

    2017-2018-1 JaWorld 团队作业--冲刺3 (20162306) 总体架构 我们本次团队项目设定为基于Android系统Java架构下的打飞机小游戏 游戏中所有模型的原型设定是精灵,因 ...

  3. 简单线性dp

    小zc现在有三个字符串,他想知道前两个字符串能不能生成第三个字符串,生成规则如下:第一个串的每个字符都可以往第二个串的任意位置插入(包括首尾位置),但必须保证来源于第一个串中的字符在生成后的串中的相对 ...

  4. jsoop_封装

    <script> //java.utils.ArrayList() //包(命名空间) /* var java = {}; java.utils = {}; java.utils.Arra ...

  5. 解决 E: Could not get lock /var/lib/apt/lists/lock

    参考:Unable to lock the administration directory (/var/lib/dpkg/) is another process using it? 在更换软件源时 ...

  6. jQuery实现鼠标点击Div区域外隐藏Div

    冒泡定义:当一个元素上的事件被触发的时候,比如说鼠标点击了一个按钮,同样的事件将会在那个元素的所有祖先元素中被触发.这一过程被称为事件冒泡:这个事件从原始元素开始一直冒泡到DOM树的最上层.(摘自网络 ...

  7. [osgearth]通过API创建一个earth模型

    通过API的方式大体需要以下几个步骤: 创建map对象—— 创建影像数据层—— 创建高程数据层—— 将影像数据层以及高程数据层加入到map对象—— 根据前面创建的map对象创建mapNode节点—— ...

  8. jsp页面中jstl标签详解[转]

    JSLT标签库,是日常开发经常使用的,也是众多标签中性能最好的.把常用的内容,放在这里备份一份,随用随查.尽量做到不用查,就可以随手就可以写出来.这算是Java程序员的基本功吧,一定要扎实. JSTL ...

  9. 雷林鹏分享:Ruby Dir 类和方法

    Ruby Dir 类和方法 Dir 是一个表示用于给出操作系统中目录中的文件名的目录流.Dir 类也拥有与目录相关的操作,比如通配符文件名匹配.改变工作目录等. 类方法 序号方法 & 描述 1 ...

  10. mysql安装不上怎么办 mysql安装失败原因和解决方法

    困难1:MySQL 5.1 安装过程中报apply security setting错误 1.卸载MySQL. 2.删除目录 C:\Documents and Settings\All Users\A ...