/// <summary> /// NOTE: ffmpeg cannot get device information through code, only print the display. /// </summary> /// <param name="device"></param> /// <param name="parame"></param> /// <param name="options">options for <see cref=" ffmpeg.avformat_open_input"/></param> /// <returns></returns> public static void PrintDeviceInfos(MediaFormat device, string parame, MediaDictionary options = null) { AVFormatContext *pFmtCtx = ffmpeg.avformat_alloc_context(); ffmpeg.av_log(null, (int)LogLevel.Verbose, $"--------------------------{Environment.NewLine}"); if (device is InFormat iformat) { ffmpeg.avformat_open_input(&pFmtCtx, parame, iformat, options); } else if (device is OutFormat oformat) { ffmpeg.avformat_alloc_output_context2(&pFmtCtx, oformat, null, parame); } ffmpeg.av_log(null, (int)LogLevel.Verbose, $"--------------------------{Environment.NewLine}"); ffmpeg.avformat_free_context(pFmtCtx); }
public unsafe static IReadOnlyList <IReadOnlyList <MediaDevice> > GetDeviceInfos(MediaFormat device, MediaDictionary options = null) { string parame = "list"; AVFormatContext *pFmtCtx = ffmpeg.avformat_alloc_context(); Trace.TraceInformation("--------------------------"); if (device is InFormat iformat) { ffmpeg.avformat_open_input(&pFmtCtx, parame, iformat, options); } else if (device is OutFormat oformat) { ffmpeg.avformat_alloc_output_context2(&pFmtCtx, oformat, null, parame); } Trace.TraceInformation("--------------------------"); ffmpeg.avformat_free_context(pFmtCtx); return(new List <List <MediaDevice> >()); }