ffmepg 解码的一般流程如下:
av_register_all();
avformat_network_init();
url = "http://ltsbsy.qq.com/GB8lF6TL4NgUddNDzdolIN4HvPZ8zz5daxlsXsx5-6cZSDGZ6BCCX3rCl-gReh6iEaTVGJs0ZmqZVbOCYENLACEvBl-LtHkj-r6V9gAo4IcLvTrdg_yHcA/r0023flooix.320092.ts.m3u8?ver=4&sdtfrom=v4000&platform=10103&appver=5.0.2.4720";
//这个链接过一会儿就失效了
m_pFormatCtx = avformat_alloc_context();
AVDictionary *dic2 = NULL;
AVInputFormat *m_pInFmt = NULL;
int ret2 = avformat_open_input(&m_pFormatCtx, url.toLocal8Bit(), m_pInFmt, &dic2);
AVDictionary *dic3 = NULL;
ret3 = avformat_find_stream_info(m_pFormatCtx, &dic3);//这里寻找流的信息,会卡个1s左右,因为它在寻找流的信息
然后 avformat_find_stream_info 就崩溃了
为什么呢?
后来在以为大神的指导下,改为了
avformat_find_stream_info(m_pFormatCtx, NULL);
就OK了
以前以为传入一个指向NULL的指针,和 NULL一样,现在看来是不一样的
具体的解释,看这个函数的文档就知道了
* @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.
av_register_all();
avformat_network_init();
url = "http://ltsbsy.qq.com/GB8lF6TL4NgUddNDzdolIN4HvPZ8zz5daxlsXsx5-6cZSDGZ6BCCX3rCl-gReh6iEaTVGJs0ZmqZVbOCYENLACEvBl-LtHkj-r6V9gAo4IcLvTrdg_yHcA/r0023flooix.320092.ts.m3u8?ver=4&sdtfrom=v4000&platform=10103&appver=5.0.2.4720";
//这个链接过一会儿就失效了
m_pFormatCtx = avformat_alloc_context();
AVDictionary *dic2 = NULL;
AVInputFormat *m_pInFmt = NULL;
int ret2 = avformat_open_input(&m_pFormatCtx, url.toLocal8Bit(), m_pInFmt, &dic2);
AVDictionary *dic3 = NULL;
ret3 = avformat_find_stream_info(m_pFormatCtx, &dic3);//这里寻找流的信息,会卡个1s左右,因为它在寻找流的信息
然后 avformat_find_stream_info 就崩溃了
为什么呢?
后来在以为大神的指导下,改为了
avformat_find_stream_info(m_pFormatCtx, NULL);
就OK了
以前以为传入一个指向NULL的指针,和 NULL一样,现在看来是不一样的
具体的解释,看这个函数的文档就知道了
* @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.