ffmpeg av_read_frame不阻塞方法
static int interrupt_cb(void* ctx)
{
static int64_t time_out = 0;
// do something
//printf("%lld\n", time_out++);
if (time_out > 40)
{
static int firsttimeplay = 0;
//printf("------%d\n", firsttimeplay);
time_out = 0;
if (firsttimeplay)
{
firsttimeplay = 0;
//printf("++++++++\n");
return 1;//这个就是超时的返回
}
}
return 0;
}
...
pAVFormatContext->interrupt_callback.callback = interrupt_cb; //--------注册回调函数
pAVFormatContext->interrupt_callback.opaque = pAVFormatContext;
...