16,471
社区成员
发帖
与我相关
我的任务
分享
void get_videoinfo(char bFile[MAX_PATH])
{
av_register_all();
avformat_network_init();
vs = (VideoState *)av_mallocz(sizeof(VideoState));
AVFormatContext *pFormatCtx = NULL;
pFormatCtx = avformat_alloc_context();
if (avformat_open_input(&pFormatCtx, bFile, NULL, NULL) < 0)//重新选过bFile文件,就断在这里了,是没有释放好吗?
{
return;
}
// 获取流信息
if (avformat_find_stream_info(pFormatCtx, NULL) < 0)
{
return;
}
currentvwidth = pFormatCtx->streams[0]->codec->width;
currentvheight = pFormatCtx->streams[0]->codec->height;
currentvduration = (int)pFormatCtx->duration;
avformat_close_input(&pFormatCtx);
pFormatCtx = NULL;
av_freep(vs);
vs = NULL;
avformat_network_deinit();
}