public static bool IsObsAudioVideoAndItIsOff(string name)
        {
            var obsStream = ObsHelper.GetObsStream(name);

            if (obsStream != null)
            {
                // obs camera;
                if (ObsHelper.TryGetStreamInfo(obsStream.QueueName, out var header))
                {
                    lock (s_loggedNames)
                    {
                        if (!s_loggedNames.Contains(name))
                        {
                            s_loggedNames.Add(name);
                            if (obsStream.Index < 0)
                            {
                                Log.Information($"OBS check {name}: {header.recommended_width}");
                            }
                            else
                            {
                                Log.Information($"OBS check {name}: {header.recommended_width}x{header.recommended_height}x{header.delay_frame}x{header.frame_time}x{header.aspect_ratio_type}");
                            }
                        }
                    }
                }
                else
                {
                    return(true);
                }
            }
            return(false);
        }
Example #2
0
        private LocalVideoSource GetVideoSource(DsDevice s)
        {
            var caps = GetCapabilities(s);

            var state = caps.state;

            if (ObsHelper.IsObsAudioVideoAndItIsOff(s.Name))
            {
                state = InputDeviceState.NotStarted;
            }

            return(new LocalVideoSource
            {
                Name = s.Name,
                Id = s.DevicePath,
                Type = s.DevicePath.ToLowerInvariant().Contains("?\\usb#") ? InputDeviceType.USB : InputDeviceType.Virtual,
                State = state,
                Capabilities = caps.caps
            });
        }
        private LocalAudioSource GetAudioSource(DsDevice s, bool getCaps)
        {
            var caps = getCaps ? GetCapabilities(s) : (null, true);

            var state = InputDeviceState.Ready;

            if (ObsHelper.IsObsAudioVideoAndItIsOff(s.Name))
            {
                state = InputDeviceState.NotStarted;
            }
            else if (!caps.success)
            {
                state = InputDeviceState.Failed;
            }

            return(new LocalAudioSource
            {
                Name = s.Name,
                Id = s.DevicePath,
                Type = s.DevicePath.ToLowerInvariant().Contains(":sw:") ? InputDeviceType.Virtual : InputDeviceType.USB,
                State = state,
                Capabilities = caps.caps
            });
        }