From 44ab0651cb407db95c0d6da23b329cf21ed1dbff Mon Sep 17 00:00:00 2001 From: eduard256 Date: Fri, 3 Apr 2026 21:01:39 +0000 Subject: [PATCH] Add DVRIP protocol support - Register dvrip stream handler using go2rtc pkg/dvrip - Add default port 34567 for dvrip scheme in URL builder --- pkg/camdb/streams.go | 1 + pkg/tester/source.go | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/pkg/camdb/streams.go b/pkg/camdb/streams.go index 2404e8b..fb9df18 100644 --- a/pkg/camdb/streams.go +++ b/pkg/camdb/streams.go @@ -12,6 +12,7 @@ import ( var defaultPorts = map[string]int{ "rtsp": 554, "rtsps": 322, "http": 80, "https": 443, "rtmp": 1935, "mms": 554, "rtp": 5004, "bubble": 80, + "dvrip": 34567, } // protocols where port must always be explicit in URL (raw TCP dial without default port logic) diff --git a/pkg/tester/source.go b/pkg/tester/source.go index dc4e226..c02bb0f 100644 --- a/pkg/tester/source.go +++ b/pkg/tester/source.go @@ -6,6 +6,7 @@ import ( "github.com/AlexxIT/go2rtc/pkg/bubble" "github.com/AlexxIT/go2rtc/pkg/core" + "github.com/AlexxIT/go2rtc/pkg/dvrip" "github.com/AlexxIT/go2rtc/pkg/rtmp" "github.com/AlexxIT/go2rtc/pkg/rtsp" ) @@ -34,6 +35,13 @@ func init() { RegisterSource("rtmp", rtmpHandler) RegisterSource("rtmps", rtmpHandler) RegisterSource("rtmpx", rtmpHandler) + RegisterSource("dvrip", dvripHandler) +} + +// dvripHandler -- Dial handles TCP connect, Sofia MD5 auth, and OPMonitor stream negotiation. +// ex. "dvrip://admin:pass@192.168.1.100:34567?channel=0&subtype=0" +func dvripHandler(rawURL string) (core.Producer, error) { + return dvrip.Dial(rawURL) } // bubbleHandler -- Dial handles TCP connect, HTTP handshake, XML parsing, and auth.