forked from AlexxIT/go2rtc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'AlexxIT:master' into master
- Loading branch information
Showing
41 changed files
with
3,492 additions
and
361 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/AlexxIT/go2rtc/internal/api" | ||
"github.com/AlexxIT/go2rtc/internal/api/ws" | ||
"github.com/AlexxIT/go2rtc/internal/app" | ||
"github.com/AlexxIT/go2rtc/internal/ffmpeg" | ||
"github.com/AlexxIT/go2rtc/internal/mjpeg" | ||
"github.com/AlexxIT/go2rtc/internal/streams" | ||
"github.com/AlexxIT/go2rtc/internal/v4l2" | ||
"github.com/AlexxIT/go2rtc/pkg/shell" | ||
) | ||
|
||
func main() { | ||
app.Init() | ||
streams.Init() | ||
|
||
api.Init() | ||
ws.Init() | ||
|
||
ffmpeg.Init() | ||
mjpeg.Init() | ||
v4l2.Init() | ||
|
||
shell.RunUntilSignal() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package main | ||
|
||
import ( | ||
"log" | ||
"net" | ||
"net/url" | ||
"os" | ||
|
||
"github.com/AlexxIT/go2rtc/pkg/onvif" | ||
) | ||
|
||
func main() { | ||
var rawURL = os.Args[1] | ||
var operation = os.Args[2] | ||
var token string | ||
if len(os.Args) > 3 { | ||
token = os.Args[3] | ||
} | ||
|
||
client, err := onvif.NewClient(rawURL) | ||
if err != nil { | ||
log.Panic(err) | ||
} | ||
|
||
var b []byte | ||
|
||
switch operation { | ||
case onvif.ServiceGetServiceCapabilities: | ||
b, err = client.MediaRequest(operation) | ||
case onvif.DeviceGetCapabilities, | ||
onvif.DeviceGetDeviceInformation, | ||
onvif.DeviceGetDiscoveryMode, | ||
onvif.DeviceGetDNS, | ||
onvif.DeviceGetHostname, | ||
onvif.DeviceGetNetworkDefaultGateway, | ||
onvif.DeviceGetNetworkInterfaces, | ||
onvif.DeviceGetNetworkProtocols, | ||
onvif.DeviceGetNTP, | ||
onvif.DeviceGetScopes, | ||
onvif.DeviceGetServices, | ||
onvif.DeviceGetSystemDateAndTime, | ||
onvif.DeviceSystemReboot: | ||
b, err = client.DeviceRequest(operation) | ||
case onvif.MediaGetProfiles, onvif.MediaGetVideoSources: | ||
b, err = client.MediaRequest(operation) | ||
case onvif.MediaGetProfile: | ||
b, err = client.GetProfile(token) | ||
case onvif.MediaGetVideoSourceConfiguration: | ||
b, err = client.GetVideoSourceConfiguration(token) | ||
case onvif.MediaGetStreamUri: | ||
b, err = client.GetStreamUri(token) | ||
case onvif.MediaGetSnapshotUri: | ||
b, err = client.GetSnapshotUri(token) | ||
default: | ||
log.Printf("unknown action\n") | ||
} | ||
|
||
if err != nil { | ||
log.Printf("%s\n", err) | ||
} | ||
|
||
u, err := url.Parse(rawURL) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
host, _, _ := net.SplitHostPort(u.Host) | ||
|
||
if err = os.WriteFile(host+"_"+operation+".xml", b, 0644); err != nil { | ||
log.Printf("%s\n", err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# ONVIF | ||
|
||
A regular camera has a single video source (`GetVideoSources`) and two profiles (`GetProfiles`). | ||
|
||
Go2rtc has one video source and one profile per stream. | ||
|
||
## Tested clients | ||
|
||
Go2rtc works as ONVIF server: | ||
|
||
- Happytime onvif client (windows) | ||
- Home Assistant ONVIF integration (linux) | ||
- Onvier (android) | ||
- ONVIF Device Manager (windows) | ||
|
||
PS. Support only TCP transport for RTSP protocol. UDP and HTTP transports - unsupported yet. | ||
|
||
## Tested cameras | ||
|
||
Go2rtc works as ONVIF client: | ||
|
||
- Dahua IPC-K42 | ||
- OpenIPC | ||
- Reolink RLC-520A | ||
- TP-Link Tapo TC60 |
Oops, something went wrong.