private static IEnumerable <RecorderAudioCodec> LoadAudioCodecs(StreamRecorder recorder)
        {
            var result = new List <RecorderAudioCodec>();

            Native.AudioEncoders(recorder.Handle, (codec, _) =>
            {
                result.Add(codec.ToRecorderEnum());
                return(true);
            }).ThrowIfError("Failed to get the supported audio codecs.");

            return(result.AsReadOnly());
        }
        private static IEnumerable <RecorderFileFormat> LoadFileFormats(StreamRecorder recorder)
        {
            var result = new List <RecorderFileFormat>();

            Native.FileFormats(recorder.Handle, (fileFormat, _) =>
            {
                result.Add(fileFormat.ToRecorderEnum());
                return(true);
            }).ThrowIfError("Failed to get the supported file formats.");

            return(result.AsReadOnly());
        }
        private static IEnumerable <RecorderVideoCodec> LoadVideoCodecs(StreamRecorder recorder)
        {
            var result = new List <RecorderVideoCodec>();

            Native.VideoEncoderCallback callback = (codec, _) =>
            {
                result.Add(codec.ToRecorderEnum());
                return(true);
            };

            Native.VideoEncoders(recorder.Handle, callback).ThrowIfError("Failed to get the supported video codecs.");

            return(result.AsReadOnly());
        }
        private static IEnumerable <Size> LoadResolutions(StreamRecorder recorder)
        {
            List <Size> result = new List <Size>();

            Native.VideoResolutionCallback callback = (width, height, _) =>
            {
                result.Add(new Size(width, height));
                return(true);
            };

            Native.VideoResolution(recorder.Handle, callback).
            ThrowIfError("Failed to get the supported video resolutions.");

            return(result.AsReadOnly());
        }