当前位置:网站首页>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;
}
}
边栏推荐
猜你喜欢
随机推荐
结构体内存对齐-C语言
沉浸式体验参加网络安全培训班,学习过程详细到底!
数据库JDBC DAO层方法
实现高并发服务器(二)
对渗透测试工程师来说,学历重要嘛?
普通用户 远程桌面连接 服务器 Remote Desktop Service
IE8 打开速度慢的解决办法
硬件描述语言Verilog HDL学习笔记之模块介绍
动态内存管理-C语言
ZYNQ之FPGA LED 灯闪烁实验
JUC锁框架——CountDownLatch、CyclicBarrier和Semaphore
第九篇 ApplicationContext初始化
strlen 转义字符
一场聚会,转行渗透测试月薪13.5k,感谢那个女同学......
LeetCode刷题
数据库实体类对应daoimpl,基础的增删改查。
使用JS在浏览器中打印菱形
【HIT-SC-LAB2】哈工大2022软件构造 实验2
Uos统信系统 chrony配置
Stream API