Fix Kasa KC200 cameras
This commit is contained in:
@@ -552,11 +552,16 @@ echo -n "cloud password" | shasum -a 256 | awk '{print toupper($0)}'
|
|||||||
|
|
||||||
[TP-Link Kasa](https://www.kasasmart.com/) non-standard protocol [more info](https://medium.com/@hu3vjeen/reverse-engineering-tp-link-kc100-bac4641bf1cd).
|
[TP-Link Kasa](https://www.kasasmart.com/) non-standard protocol [more info](https://medium.com/@hu3vjeen/reverse-engineering-tp-link-kc100-bac4641bf1cd).
|
||||||
|
|
||||||
|
- `username` - urlsafe email, `alex@gmail.com` -> `alex%40gmail.com`
|
||||||
|
- `password` - base64password, `secret1` -> `c2VjcmV0MQ==`
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
streams:
|
streams:
|
||||||
kasa: kasa://user:pass@192.168.1.123:19443/https/stream/mixed
|
kc401: kasa://username:password@192.168.1.123:19443/https/stream/mixed
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Tested: KD110, KC200, KC401, KC420WS, EC71.
|
||||||
|
|
||||||
#### Source: GoPro
|
#### Source: GoPro
|
||||||
|
|
||||||
*[New in v1.8.3](https://github.com/AlexxIT/go2rtc/releases/tag/v1.8.3)*
|
*[New in v1.8.3](https://github.com/AlexxIT/go2rtc/releases/tag/v1.8.3)*
|
||||||
|
|||||||
+21
-1
@@ -37,14 +37,34 @@ func Dial(url string) (*Producer, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// KC200
|
||||||
|
// HTTP/1.0 200 OK
|
||||||
|
// Content-Type: multipart/x-mixed-replace;boundary=data-boundary--
|
||||||
|
// KD110, KC401, KC420WS:
|
||||||
|
// HTTP/1.0 200 OK
|
||||||
|
// Content-Type: multipart/x-mixed-replace;boundary=data-boundary--
|
||||||
|
// Transfer-Encoding: chunked
|
||||||
|
// HTTP/1.0 + chunked = out of standard, so golang remove this header
|
||||||
|
// and we need to check first two bytes
|
||||||
|
buf := bufio.NewReader(res.Body)
|
||||||
|
|
||||||
|
b, err := buf.Peek(2)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
rd := struct {
|
rd := struct {
|
||||||
io.Reader
|
io.Reader
|
||||||
io.Closer
|
io.Closer
|
||||||
}{
|
}{
|
||||||
httputil.NewChunkedReader(res.Body),
|
buf,
|
||||||
res.Body,
|
res.Body,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if string(b) != "--" {
|
||||||
|
rd.Reader = httputil.NewChunkedReader(buf)
|
||||||
|
}
|
||||||
|
|
||||||
prod := &Producer{rd: core.NewReadBuffer(rd)}
|
prod := &Producer{rd: core.NewReadBuffer(rd)}
|
||||||
if err = prod.probe(); err != nil {
|
if err = prod.probe(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
Reference in New Issue
Block a user