public static LibMWCapture.MWCAP_VIDEO_SIGNAL_STATUS?GetSignalStatus(int channelIndex, out LibMWCapture.MWCAP_AUDIO_VOLUME? audioStatus) { audioStatus = null; ushort[] wpath = new ushort[512]; IntPtr pwpath = GCHandle.Alloc(wpath, GCHandleType.Pinned).AddrOfPinnedObject(); LibMWCapture.MWGetDevicePath(channelIndex, pwpath); var videoChannel = LibMWCapture.MWOpenChannelByPath(pwpath); if (videoChannel == IntPtr.Zero) { return(null); } try { audioStatus = PInvokeTools.ReadStruct <LibMWCapture.MWCAP_AUDIO_VOLUME>(ptr => LibMWCapture.MWGetAudioVolume(videoChannel, LibMWCapture.MWCAP_AUDIO_NODE.MWCAP_AUDIO_EMBEDDED_CAPTURE, ptr)); return(PInvokeTools.ReadStruct <LibMWCapture.MWCAP_VIDEO_SIGNAL_STATUS>( ptr => LibMWCapture.MWGetVideoSignalStatus(videoChannel, ptr))); } finally { LibMWCapture.MWCloseChannel(videoChannel); } }
public static void SetMute(this LibMWCapture.MWCAP_AUDIO_VOLUME audioStatus, IntPtr videoChannel, bool mute) { for (int i = 0; i < audioStatus.abMute.Length; i++) { audioStatus.abMute[i] = mute; } PInvokeTools.WriteStruct(audioStatus, ptr => LibMWCapture.MWSetAudioVolume(videoChannel, LibMWCapture.MWCAP_AUDIO_NODE.MWCAP_AUDIO_EMBEDDED_CAPTURE, ptr)); }
public static void SetAudioVolume(this LibMWCapture.MWCAP_AUDIO_VOLUME audioStatus, IntPtr videoChannel, int percent) { var volumeIndex = (int)(AudioVolumes.Length / 100.0 * percent); volumeIndex = Math.Min(Math.Max(volumeIndex, 0), AudioVolumes.Length - 1); var volume = AudioVolumes[volumeIndex]; for (int i = 0; i < audioStatus.asVolume.Length; i++) { audioStatus.asVolume[i] = volume; } PInvokeTools.WriteStruct(audioStatus, ptr => LibMWCapture.MWSetAudioVolume(videoChannel, LibMWCapture.MWCAP_AUDIO_NODE.MWCAP_AUDIO_EMBEDDED_CAPTURE, ptr)); }
public LibMWCapture.MWCAP_AUDIO_VOLUME GetMWAudioVolume() { return(PInvokeTools.ReadStruct <LibMWCapture.MWCAP_AUDIO_VOLUME>(ptr => LibMWCapture.MWGetAudioVolume(VideoChannel, LibMWCapture.MWCAP_AUDIO_NODE.MWCAP_AUDIO_EMBEDDED_CAPTURE, ptr))); }
public LibMWCapture.MWCAP_VIDEO_SIGNAL_STATUS GetVideoSignalStatus() { return(PInvokeTools.ReadStruct <LibMWCapture.MWCAP_VIDEO_SIGNAL_STATUS>(ptr => LibMWCapture.MWGetVideoSignalStatus(VideoChannel, ptr))); }
public static void GetChannelInfobyIndex(int nChannelIndex, ref LibMWCapture.MWCAP_CHANNEL_INFO channelInfo) { channelInfo = PInvokeTools.ReadStruct <LibMWCapture.MWCAP_CHANNEL_INFO>(ptr => LibMWCapture.MWGetChannelInfoByIndex(nChannelIndex, ptr)); }