mac环境下 av_read_frame 读取数据失败 提示 -35 Resource temporarily unavailable
来源:6-9 从音频设备中读取音频数据

eaglelin
2020-08-15
int ret = 0;
char* deviceName = ":0";
AVFormatContext *ps = NULL;
char errors [1024];
//注册设备
avdevice_register_all();
//设置格式
AVInputFormat *iformat = av_find_input_format("avfoundation");
//打开设备
ret = avformat_open_input(&ps, deviceName, iformat, NULL);
//小于0表示打开失败
if(ret <0){
//打开失败
av_strerror(ret, errors, 1024);
printf("Faild to open audio devices ,%d%s\n",ret,errors);
}
av_log(NULL, AV_LOG_DEBUG, "open audio ret is %d\n",ret);
//读取数据
AVPacket pkt;
av_init_packet(&pkt);
int count = 0;
ret = av_read_frame(ps, &pkt);
if(ret != 0){
av_strerror(ret, errors, 1024);
printf("Faild to read audio data ,%d %s\n",ret,errors);
}else{
printf("pack size is %d",pkt.size);
}
写回答
2回答
-
qq_驰马奥_0
2021-04-17
哪个群呀 我也遇到同样问题了
012021-04-17 -
李超
2020-08-15
进入课程QQ群,在公告中有答案
00
相似问题