如何为长春城乡建设部网站首页上的付费文章设置支付机制?
摘要:长春城乡建设部网站首页,网站上的付费文章怎么做,做那种事免费网站,南充个人急售二手房demux模块 从前面一篇文章中可以得知,demux模块的使用方法大致如下: 分配AVFormatContext通过avfor
长春城乡建设部网站首页,网站上的付费文章怎么做,做那种事免费网站,南充个人急售二手房demux模块
从前面一篇文章中可以得知#xff0c;demux模块的使用方法大致如下:
分配AVFormatContext通过avformat_open_input(…)传入AVFormatContext指针和文件路径#xff0c;启动demux通过av_read_frame(…) 从AVFormatContext中读取demux后的audio/video/subtitle数据包…demux模块
从前面一篇文章中可以得知demux模块的使用方法大致如下:
分配AVFormatContext通过avformat_open_input(…)传入AVFormatContext指针和文件路径启动demux通过av_read_frame(…) 从AVFormatContext中读取demux后的audio/video/subtitle数据包AVPacket
AVFormatContext *ic avformat_alloc_context();
avformat_open_input(ic, filename, null, null);
while(1) {AVPacket *pkt av_packet_alloc();av_read_frame(ic, pkt);..... use pkt data to do something.........;
}在阅读源码之前我们先提几个问题再顺着问题阅读源码:
AVFormatContext如何下载数据 ?如何匹配到具体的demuxer demuxer的模板是什么样的 如何新增一个demuxer ?demuxer是如何驱动起来的
下面我们分别看下avformat_alloc_context(…), avformat_open_input(…), av_read_frame(…)分别做了什么在文章结尾看看能否回答上面这几个问题。
avformat_alloc_context
ffmpeg\libavformat\option.c
AVFormatContext *avformat_alloc_context(void)
{FFFormatContext *const si av_mallocz(sizeof(*si));AVFormatContext *s;s si-pub;s-av_class av_format_context_class;s-io_open io_open_default;s-io_close ff_format_io_close_default;s-io_close2 io_close2_default;av_opt_set_defaults(s);si-pkt av_packet_alloc();si-parse_pkt av_packet_alloc();si-shortest_end AV_NOPTS_VALUE;return s;
}上面代码中比较重要的函数是io_open这个函数会创建AVIOContext数据下载模块。
