Skip to content

Add SRT Monitor Data Provider widget - #71

Open
rafalau wants to merge 12 commits into
elgarf:master-HTTPClientfrom
rafalau:master-HTTPClient
Open

Add SRT Monitor Data Provider widget#71
rafalau wants to merge 12 commits into
elgarf:master-HTTPClientfrom
rafalau:master-HTTPClient

Conversation

@rafalau

@rafalau rafalau commented Jun 10, 2026

Copy link
Copy Markdown

SRT Monitor — Data Provider para vMixUTC

Widget de monitoramento de streams SRT integrado ao vMixUTC, desenvolvido como um Data Provider externo.


O que é

O SRT Monitor permite receber e visualizar streams de vídeo via protocolo SRT (Secure Reliable Transport) diretamente dentro do vMixUTC, sem precisar abrir um player externo. Ideal para monitorar sinais de entrada antes de colocá-los no ar no vMix.


Funcionalidades

Recurso Descrição
Modo Listener Aguarda conexão de entrada na porta configurada
Modo Caller Conecta ativamente em um host remoto (IP + Porta)
Preview de vídeo Janela de preview embutida no widget com redimensionamento vertical
Controle de áudio Checkbox por instância — isola completamente o áudio de cada widget
IP padrão automático Pré-preenche o IP do host vMix já configurado no UTC
Configurações avançadas Latência, AES passphrase, key length (128/192/256 bits), Stream ID
Ícones ▶ / ■ Botões conectar/desconectar com ícones Font Awesome
Múltiplas instâncias Cada widget opera de forma completamente independente

Requisitos

libvlc (VLC nativo)

O widget depende das DLLs nativas do VLC. Elas não estão incluídas no repositório (são grandes demais).

  1. Baixe o VLC 3.x para Windows 64-bit em videolan.org
  2. Copie as pastas libvlc e plugins do diretório de instalação do VLC para:
vMixController/bin/Debug/DataProviders/libvlc/win-x64/

A estrutura esperada:

DataProviders/
├── SrtMonitorDataProvider.dll
└── libvlc/
    └── win-x64/
        ├── libvlc.dll
        ├── libvlccore.dll
        └── plugins/
            └── ...

Tecnologias utilizadas

Biblioteca Versão Finalidade
LibVLCSharp 3.8.5 Wrapper .NET para libvlc
LibVLCSharp.WPF 3.8.5 Controle WPF para preview de vídeo
libvlc (VLC) 3.x Engine de reprodução / SRT decoder
.NET Framework 4.7.2 Target framework do vMixUTC
Costura.Fody Embute as DLLs gerenciadas no assembly final

Arquitetura

O plugin implementa a interface IvMixDataProvider do vMixUTC:

vMixControlExternalData  (host widget no UTC)
    └── SRTDataProvider  (IvMixDataProvider)
            ├── LibVLC   (instância por widget — isolamento de áudio)
            └── OnWidgetUI  (UI WPF com VideoView embutido)
                    └── MediaPlayer  (por instância)

Cada widget cria sua própria instância de LibVLC e MediaPlayer, garantindo isolamento total de vídeo e áudio entre múltiplos monitores na mesma tela.

O controle de áudio usa a opção :no-audio diretamente na mídia quando o checkbox é desmarcado, e reconecta automaticamente ao alternar — evitando qualquer compartilhamento de estado no pipeline de áudio do Windows.


Como compilar

# Restaurar pacotes NuGet e compilar (gera o DLL em vMixController/bin/Debug/DataProviders/)
MSBuild vMixUTCSRTDataProvider.csproj /p:Configuration=Debug /p:Platform=AnyCPU /t:Build

Créditos

Idealizado por rafalau.
Implementado com assistência de Claude Sonnet 4.6 (Anthropic).

rafalau and others added 12 commits June 10, 2026 13:04
New widget that receives and previews SRT (Secure Reliable Transport)
streams directly inside vMixUTC using LibVLCSharp + libvlc.

Features:
- Listener and Caller modes
- Configurable port, latency, AES passphrase, key length and stream ID
- Embedded video preview with VideoView (Win32 HWND via LibVLCSharp.WPF)
- Per-instance audio control via :no-audio media option — isolated between
  multiple SRT Monitor instances on the same layout
- Default IP pre-filled from the current vMix connection
- Vertical resize support (IsResizeableVertical)
- Play/Stop icon buttons (Font Awesome)
- State persisted through vMixUTC's DataProvider serialization mechanism

Core changes:
- vMixUTCSRTDataProvider: new project (SrtMonitorDataProvider.dll)
- vMixControlExternalData: IsResizeableVertical = true
- vMixControlContainer.xaml: vertical resize thumb
- ControlTemplates.xaml: Height binding on ExternalDataWidgetControl
- MainViewModel: ProcessHotkey skips focus steal when TextBox has focus
- HighPrecisionTimer / Popcron.Sheets: target framework bump to v4.7.2

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The main vMixController.exe is built with 32BITPREF=1 (runs as WoW64/32-bit).
The SRT plugin was compiled as x64 (PE32+), causing BadImageFormatException on load.
Changed PlatformTarget from x64 to AnyCPU (PE32) so the managed DLL loads in both
32-bit and 64-bit host processes. VLC native DLLs remain in libvlc/win-x64/ and are
loaded at runtime only when the user connects.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Detect process architecture at runtime and load libvlc from win-x86
when the host process is 32-bit (WoW64), instead of always hardcoding
win-x64 which fails to load under the 32BITPREF=1 Release binary.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- vMixController Release: add Prefer32Bit=false so process runs as 64-bit
  (same as Debug), allowing win-x64 VLC to load correctly
- SRTDataProvider: detect process arch at runtime for VLC path selection
- OnWidgetUI: surface real VLC init error instead of hardcoded message
- README: add download link and install instructions for the prebuilt ZIP

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
New toggle "Enable Auto Sync" in the menu. When enabled, a background
TCP connection subscribes to SUBSCRIBE ACTS on vMix port 8099. Any
event fired by vMix (input added, switched, changed) triggers an
immediate SyncTovMixState() with 300ms debounce, instead of waiting
for the 20s polling cycle.

- VmixTcpSubscriber: connects TCP 8099, sends SUBSCRIBE ACTS, fires
  debounced event on any ACTS line; auto-reconnects on disconnect
- MainWindowSettings.AutoSync: persisted bool property
- MainViewModel: starts/stops subscriber when AutoSync or IP changes
- MainWindow.xaml: checkable "Enable Auto Sync" menu item

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
SUBSCRIBE ACTS only fires on function calls, missing text edits and
other direct vMix UI changes. Add a 2-second XML polling loop that
compares the full vMix XML hash — if anything changed, triggers sync.
TCP subscriber is kept as a complement for instant ACTS notification.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Remove complex hash/TCP approach. When Enable Auto Sync is active,
a DispatcherTimer fires SyncTovMixState() every second — guaranteed
to catch any change in vMix regardless of type.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- UpdateAsync(ignoreCache): new param passes ignoreCache:true to
  SendFunction so the batcher doesn't return stale data every 1s
- AutoSyncTick calls Model.UpdateAsync(ignoreCache:true) directly
- UpdateAutoSync() is now also called when WindowSettings is set,
  so the timer starts immediately if AutoSync was saved as true

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ructions

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant