Esempio n. 1
0
        private VideoInputConfigBase RebuildInputSource_Device(string id, SceneItemSourceDevice device, ISceneItem item, StreamerRebuildContext rebuildContext)
        {
            var localDevice = _sources.GetLocalVideoDevice(device.DeviceName);

            if (localDevice != null)
            {
                var options = DShowOptionsSelector.GetVideoOptions(localDevice, _coreData.Settings.Fps, _coreData.Settings.Resolution, item);
                return(new VideoInputConfigFull(new InputSetup(
                                                    Type: "dshow",
                                                    Input: $"video={DShowOptionsSelector.GetDeviceName(localDevice)}",
                                                    Options: options)));
            }
            else
            {
                return(GetFailedInputSource(id, rebuildContext, InputIssueDesc.VideoRemoved, $"Video device '{device?.DeviceName}' not found"));
            }
        }
Esempio n. 2
0
        private AudioInputTrunkConfig RebuildSceneAudio(string id, ISceneAudio s, StreamerRebuildContext rebuildContext)
        {
            rebuildContext.SetAudioSource(id, s.Source);
            var level = s.Muted ? -1000.0 : s.Volume;

            if (s.Source == null)
            {
                rebuildContext.AddAudio(id, InputIssueDesc.NoAudioSelected);
                Log.Warning($"Audio source is null for '{id}'");
                return(null);
            }
            else if (s.Source.DesktopAudio)
            {
                return(new AudioInputTrunkConfig(id, new InputSetup(DesktopAudioContext.Name, String.Empty), level, f => OnAudioFrame(id, f)));
            }
            else if (s.Source.DeviceName != null)
            {
                var device = _sources.GetLocalAudioDevice(s.Source.DeviceName);
                if (device != null)
                {
                    var opts = DShowOptionsSelector.GetAudioOptions(device);
                    return(new AudioInputTrunkConfig(id, new InputSetup("dshow", $"audio={DShowOptionsSelector.GetDeviceName(device)}", opts), level, f => OnAudioFrame(id, f)));
                }
                else
                {
                    rebuildContext.AddAudio(id, InputIssueDesc.AudioRemoved);
                    Log.Warning($"Audio device not found for '{id}'-{s.Source.DeviceName}");
                    return(null);
                }
            }
            else
            {
                rebuildContext.AddAudio(id, InputIssueDesc.NoAudioSelected);
                Log.Warning($"Audio source is not specified for '{id}'");
                return(null);
            }
        }