ffmpeg 打开音频设备的操作流程

260 阅读1分钟
  1. 注册设备 : 

    avdevice_register_all();
    
  2. 设置采集方式: avfoundation / dshow / alsa , 分别对应iOS、windows、Linux平台

    AVInputFormat *iformat = av_find_input_format("avfoundation");
    
  3. 打开音频设备

    int ret = 0;char errors[1024] = {0, };AVFormatContext *fmt_ctx = NULL;AVDictionary *options = NULL;char *devicename = ":0";ret = avformat_open_input(&fmt_ctx, devicename, iformat, &options);