private void Select(string key)
        {
            if (_model.SceneState.Device.VideoInputs.TryGetValue(key, out var input))
            {
                var source = new SceneItemSource
                {
                    Device = new SceneItemSourceDevice {
                        DeviceName = new DeviceName {
                            DeviceId = key, Name = input.Name
                        }
                    }
                };

                if (_editedItem != null)
                {
                    _editedItem.Source = source;
                }
                else
                {
                    _model.AddSourceToScene(source);
                }
            }
            else
            {
                Log.Warning($"Unable to find selected video input {key}");
            }
        }
Beispiel #2
0
 private VideoInputConfigBase RebuildInputSource(string id, SceneItemSource source, ISceneItem item, StreamerRebuildContext rebuildContext)
 {
     rebuildContext.SetVideoSource(id, source);
     if (source.Device != null)
     {
         return(RebuildInputSource_Device(id, source.Device, item, rebuildContext));
     }
     else if (source.Image != null)
     {
         return(RebuildInputSource_Image(id, source.Image, rebuildContext));
     }
     else if (source.Lovense != null)
     {
         return(RebuildInputSource_Lovense(id, rebuildContext));
     }
     else if (source.Web != null)
     {
         return(RebuildInputSource_Web(id, source.Web, rebuildContext));
     }
     else if (source.CaptureDisplay != null)
     {
         return(RebuildInputSource_Capture(id, source.CaptureDisplay, false, rebuildContext));
     }
     else if (source.CaptureWindow != null)
     {
         return(RebuildInputSource_Capture(id, source.CaptureWindow, true, rebuildContext));
     }
     else
     {
         return(GetFailedInputSource(id, rebuildContext, InputIssueDesc.UnknownTypOfSource, "Video source is unknown"));
     }
 }
        public static void GoToCreate(SceneEditingModel model)
        {
            if (!CapturePageNotSupported.IsCaptureSupported(model))
            {
                model.GoToPage(new CapturePageNotSupported());
            }
            else
            {
                var items = model.SceneState.Device.Displays;
                if (items != null && items.Length > 0)
                {
                    var first = model.SceneState.Device.Displays[0];

                    var source = new SceneItemSource
                    {
                        CaptureDisplay = new SceneItemSourceCapture
                        {
                            CaptureCursor = true,
                            Source        = first
                        }
                    };

                    model.AddSourceToScene(source);
                }
                else
                {
                    model.SelectAddLayer();
                }
            }
        }
Beispiel #4
0
        private static void AddPlugin(SceneEditingModel model)
        {
            var source = new SceneItemSource {
                Lovense = new SceneItemSourceLovense()
            };

            model.AddSourceToScene(source, true);
        }
        protected void DoSelect(CaptureSource model)
        {
            var source = new SceneItemSource();

            _setConfig(source, new SceneItemSourceCapture {
                Source = model, CaptureCursor = CaptureCursor.Value
            });
            if (_editing != null)
            {
                _editing.Source = source;
            }
            else
            {
                _model.AddSourceToScene(source, false, GetRect(model));
            }
        }
Beispiel #6
0
        private void UpdateOrCreateItem(string id, byte[] data)
        {
            var source = new SceneItemSource {
                Image = new SceneItemSourceImage {
                    ResourceId = id
                }
            };

            if (Editing)
            {
                _editedItem.Source = source;
            }
            else
            {
                var size = _model.ImageHelper.GetSize(data);

                SceneRect rect = null;
                if (size.width > 0 && size.height > 0)
                {
                    var ratio = (double)size.width / (double)size.height;

                    var baseExtent = 0.5;
                    var baseRatio  = 16.0 / 9.0;

                    if (ratio > baseRatio)
                    {
                        rect = new SceneRect {
                            W = baseExtent, H = baseExtent * baseRatio / ratio
                        }
                    }
                    ;
                    else
                    {
                        rect = new SceneRect {
                            W = baseExtent * ratio / baseRatio, H = baseExtent
                        }
                    };
                }

                _model.AddSourceToScene(source, false, rect);
            }
        }
Beispiel #7
0
 internal void SetVideoSource(string id, SceneItemSource source) => Videos[id] = new RebuildInfo
 {
     Video = source
 };