internal Capabilities(NativeHandle handle) { SupportedVideoCodecs = Load <RecorderVideoCodec>(handle, GetVideoEncoders); SupportedAudioCodecs = Load <RecorderAudioCodec>(handle, GetAudioEncoders); SupportedFileFormats = Load <RecorderFileFormat>(handle, GetFileFormats); }
private static IEnumerable <T> Load <T>(NativeHandle handle, Func <NativeHandle, List <T>, RecorderErrorCode> loadFunc) { var result = new List <T>(); var ret = loadFunc(handle, result); if (ret == RecorderErrorCode.NotSupported) { return(null); } ret.ThrowIfError("Failed to load the capabilities"); return(result.AsReadOnly()); }
private static IEnumerable <Size> GetVideoResolutions(NativeHandle handle) { var result = new List <Size>(); var ret = Native.GetVideoResolutions(handle, (w, h, _) => { result.Add(new Size(w, h)); return(true); }); if (ret == RecorderErrorCode.NotSupported) { throw new NotSupportedException("Video recording is not supported."); } ret.ThrowIfError("Failed to load the resolutions"); return(result.AsReadOnly()); }
internal Recorder(NativeHandle handle) { _handle = handle; try { RegisterEvents(); SetState(State); } catch (Exception) { _handle.Dispose(); throw; } }
private RecorderErrorCode GetVideoEncoders(NativeHandle handle, List <RecorderVideoCodec> result) => Native.GetVideoEncoders(handle, (codec, _) => { result.Add(codec); return(true); });
private RecorderErrorCode GetFileFormats(NativeHandle handle, List <RecorderFileFormat> result) => Native.GetFileFormats(handle, (format, _) => { result.Add(format); return(true); });