コード例 #1
0
 public static StudioConnectionDto ToDto(this IStudioConnection studioConnection)
 {
     return(new StudioConnectionDto
     {
         Id = studioConnection.Id,
         State = studioConnection.State,
         InputComponentId = studioConnection.Input?.Component.Id ?? -1,
         InputId = studioConnection.Input?.Id ?? -1,
         OutputComponentId = studioConnection.Output?.Component.Id ?? -1,
         OutputId = studioConnection.Output?.Id ?? -1
     });
 }
コード例 #2
0
        public void RemoveConnection(IStudioConnection connection)
        {
            if (!_connections.Contains(connection))
            {
                return;
            }

            connection.SetTargetState(Shared.ConnectionState.Destroyed);

            _connections.Remove(connection);
            ConnectionRemoved?.Invoke(this, connection);
        }
コード例 #3
0
        public void Removes_connection()
        {
            var virtualStudio = new VirtualStudio();
            var placeholder   = new PlaceholderStudioComponent();

            virtualStudio.ComponentRepository.AddPlaceholder(placeholder);
            var component = virtualStudio.AddComponent(placeholder) as PlaceholderStudioComponent;
            var input     = component.AddInput("input", DataKind.Audio, "ConnectionType");
            var output    = component.AddOutput("output", DataKind.Audio, "ConnectionType");
            IStudioConnection connection = virtualStudio.CreateConnection(output, input);

            virtualStudio.RemoveConnection(connection);

            Assert.IsTrue(virtualStudio.Connections.Count == 0);
        }
コード例 #4
0
        public void Init()
        {
            virtualStudio = new VirtualStudio();

            var placeholder = new PlaceholderStudioComponent();

            placeholder.AddInput("Input 1", DataKind.Audio, "UDP");
            virtualStudio.ComponentRepository.AddPlaceholder(placeholder);
            componentWithUdpAudioInput = virtualStudio.AddComponent(placeholder);

            placeholder = new PlaceholderStudioComponent();
            placeholder.AddOutput("Output 1", DataKind.Audio, "UDP");
            virtualStudio.ComponentRepository.AddPlaceholder(placeholder);
            componentWithUdpAudioOutput = virtualStudio.AddComponent(placeholder);

            connection = virtualStudio.CreateConnection(componentWithUdpAudioOutput.Outputs[0], componentWithUdpAudioInput.Inputs[0]);
        }
コード例 #5
0
        public void Adds_connection_between_endpoints_that_exist_in_components()
        {
            var virtualStudio = new VirtualStudio();
            var placeholder   = new PlaceholderStudioComponent();

            virtualStudio.ComponentRepository.AddPlaceholder(placeholder);
            var component = virtualStudio.AddComponent(placeholder) as PlaceholderStudioComponent;
            var input     = component.AddInput("input", DataKind.Audio, "ConnectionType");
            var output    = component.AddOutput("output", DataKind.Audio, "ConnectionType");

            Assert.IsTrue(virtualStudio.CanCreateConnection(output, input));

            IStudioConnection connection = virtualStudio.CreateConnection(output, input);

            Assert.IsNotNull(connection);
            Assert.IsTrue(virtualStudio.Connections.Count == 1);
        }
コード例 #6
0
 public WebRtcConnectProcess(IStudioConnection connection)
 {
     Connection = connection ?? throw new ArgumentNullException(nameof(connection));
 }
コード例 #7
0
 private void VirtualStudio_ConnectionRemoved(object sender, IStudioConnection connection)
 {
     connection.StateChanged -= Connection_StateChanged;
     operationHandler.RemoveConnection(VirtualStudioName, connection.Id);
 }
コード例 #8
0
 private void VirtualStudio_ConnectionAdded(object sender, IStudioConnection connection)
 {
     connection.StateChanged += Connection_StateChanged;
     operationHandler.CreateConnection(VirtualStudioName, connection.ToDto());
 }