当前位置:网站首页>av_read_frame 阻塞,基于回调的解决办法
av_read_frame 阻塞,基于回调的解决办法
2022-08-04 05:34:00 【_杜竞宁_】
设置回调,每次 av_read_frame 前刷新时间
static int InterruptFouction(void *theTimeSpec)
{
if (!theTimeSpec) {
return 0;
}
std::cout << "InterruptFouction called~!" << std::endl;
time_t mtime;
time(&mtime);
time_t *t = (time_t*)theTimeSpec;
if( ( mtime - *t ) > 5) {
return 1;
}
return 0;
}
time_t TimeNow;
m_pFmtCtx->interrupt_callback.callback = InterruptFouction;
m_pFmtCtx->interrupt_callback.opaque = &TimeNow;
while(isRunning){
time(&TimeNow);
ret = av_read_frame(m_pFmtCtx, m_pAVPacket);
if ( ret == 0 ) {
// to do something
} else {
break;
}
}
边栏推荐
猜你喜欢
随机推荐
第九篇 ApplicationContext初始化
20170729
无一技之长学什么可以做到月入上万?
桌面右键的NVIDIA去除与恢复
【HIT-SC-MEMO3】哈工大2022软件构造 复习笔记3
树莓派 4 B 拨动开关控制风扇 Rasberry Pi 4 B Add Toggle Switch for the Fan
Operating System Kernel
[Daily Office][Miscellaneous][vscode]tab space
结构体传参-C语言
Uos统信系统 CA根证书搭建
线程池原理
【HIT-SC-MEMO2】哈工大2022软件构造 复习笔记2
Arduino之ESP8266编程学习总结体会
实现高并发服务器(二)
Object. RequireNonNull method
MVC custom configuration
MySQL索引
文件权限管理 ugo
沉浸式体验参加网络安全培训班,学习过程详细到底!
vim的介绍









