#pragma warning restore 0169 public void Configure(CaptureSettings settings, IntPtr window_handle) { IntPtr err = IntPtr.Zero; EncodingQuality qual = settings.EncodingSettings.EncodingQuality; Device device = settings.Device; DeviceVideoFormat format = settings.Format; EncodingProfile enc; VideoStandard std; IntPtr outFile, sourceElement, deviceID; enc = settings.EncodingSettings.EncodingProfile; std = settings.EncodingSettings.VideoStandard; outFile = Marshaller.StringToPtrGStrdup(settings.EncodingSettings.OutputFile); sourceElement = Marshaller.StringToPtrGStrdup(device.SourceElement); deviceID = Marshaller.StringToPtrGStrdup(device.ID); gst_camera_capturer_configure(Handle, outFile, (int)settings.Device.DeviceType, sourceElement, deviceID, format.width, format.height, format.fps_n, format.fps_d, (int)enc.VideoEncoder, (int)enc.AudioEncoder, (int)enc.Muxer, qual.VideoQuality, qual.AudioQuality, settings.EncodingSettings.EnableAudio, std.Width, std.Height, window_handle, out err); Marshaller.Free(outFile); Marshaller.Free(sourceElement); Marshaller.Free(deviceID); if (err != IntPtr.Zero) { throw new GLib.GException(err); } }
static public List <Device> ListVideoDevices() { string[] devices; if (LongoMatch.Core.Common.Utils.RunningPlatform() == PlatformID.MacOSX) { devices = devices_osx; } else if (LongoMatch.Core.Common.Utils.RunningPlatform() == PlatformID.Win32NT) { devices = devices_win; } else { devices = devices_lin; } List <Device> devicesList = new List <Device> (); foreach (string source in devices) { GLib.List devices_raw = new GLib.List(lgm_device_enum_video_devices(source), typeof(IntPtr), true, false); foreach (IntPtr device_raw in devices_raw) { /* The Direct Show GStreamer element seems to have problems with the * BlackMagic DeckLink cards, so filter them out. They are also * available through the ksvideosrc element. */ if (source == "dshowvideosrc" && Regex.Match(source, ".*blackmagic.*|.*decklink.*", RegexOptions.IgnoreCase).Success) { continue; } Device device = new Device(); device.DeviceType = CaptureSourceType.System; device.SourceElement = source; device.ID = GLib.Marshaller.PtrToStringGFree(lgm_device_get_device_name(device_raw)); GLib.List formats_raw = new GLib.List(lgm_device_get_formats(device_raw), typeof(IntPtr), false, false); foreach (IntPtr format_raw in formats_raw) { DeviceVideoFormat format = new DeviceVideoFormat(); lgm_device_video_format_get_info(format_raw, out format.width, out format.height, out format.fps_n, out format.fps_d); device.Formats.Add(format); } devicesList.Add(device); lgm_device_free(device_raw); } } return(devicesList); }
static public List <Device> ListVideoDevices() { string [] devices; if (VAS.Core.Common.Utils.OS == OperatingSystemID.OSX) { devices = devices_osx; } else if (VAS.Core.Common.Utils.OS == OperatingSystemID.Windows) { devices = devices_win; } else { devices = devices_lin; } List <Device> devicesList = new List <Device> (); foreach (string source in devices) { GLib.List devices_raw = new GLib.List(lgm_device_enum_video_devices(source), typeof(IntPtr), true, false); foreach (IntPtr device_raw in devices_raw) { string deviceName = GLib.Marshaller.PtrToStringGFree(lgm_device_get_device_name(device_raw)); /* The Direct Show GStreamer element seems to have problems with the * BlackMagic DeckLink cards, so filter them out. They are also * available through the ksvideosrc element. */ if (source == DSHOWVIDEOSRC && Regex.Match(deviceName, ".*blackmagic.*|.*decklink.*", RegexOptions.IgnoreCase).Success) { continue; } Device device = new Device(); device.DeviceType = CaptureSourceType.System; device.SourceElement = source; device.ID = deviceName; if (source == GDISCREENCAPSRC || source == DX9SCREENCAPSRC) { device.Prefix = Strings.Monitor; } GLib.List formats_raw = new GLib.List(lgm_device_get_formats(device_raw), typeof(IntPtr), false, false); foreach (IntPtr format_raw in formats_raw) { DeviceVideoFormat format = new DeviceVideoFormat(); lgm_device_video_format_get_info(format_raw, out format.width, out format.height, out format.fps_n, out format.fps_d); device.Formats.Add(format); } /* Make sure the device has formats * before adding it to the device list */ if (device.Formats.Count > 0) { devicesList.Add(device); } lgm_device_free(device_raw); } } return(devicesList); }