Correcting code formatting after #1567
This commit is contained in:
+40
-40
@@ -8,57 +8,57 @@ import (
|
||||
)
|
||||
|
||||
type SnapshotProducer struct {
|
||||
core.Connection
|
||||
core.Connection
|
||||
|
||||
client *RingRestClient
|
||||
camera *CameraData
|
||||
client *RingRestClient
|
||||
camera *CameraData
|
||||
}
|
||||
|
||||
func NewSnapshotProducer(client *RingRestClient, camera *CameraData) *SnapshotProducer {
|
||||
return &SnapshotProducer{
|
||||
Connection: core.Connection{
|
||||
ID: core.NewID(),
|
||||
FormatName: "ring/snapshot",
|
||||
Protocol: "https",
|
||||
Medias: []*core.Media{
|
||||
{
|
||||
Kind: core.KindVideo,
|
||||
Direction: core.DirectionRecvonly,
|
||||
Codecs: []*core.Codec{
|
||||
{
|
||||
Name: core.CodecJPEG,
|
||||
ClockRate: 90000,
|
||||
PayloadType: core.PayloadTypeRAW,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
client: client,
|
||||
camera: camera,
|
||||
}
|
||||
return &SnapshotProducer{
|
||||
Connection: core.Connection{
|
||||
ID: core.NewID(),
|
||||
FormatName: "ring/snapshot",
|
||||
Protocol: "https",
|
||||
Medias: []*core.Media{
|
||||
{
|
||||
Kind: core.KindVideo,
|
||||
Direction: core.DirectionRecvonly,
|
||||
Codecs: []*core.Codec{
|
||||
{
|
||||
Name: core.CodecJPEG,
|
||||
ClockRate: 90000,
|
||||
PayloadType: core.PayloadTypeRAW,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
client: client,
|
||||
camera: camera,
|
||||
}
|
||||
}
|
||||
|
||||
func (p *SnapshotProducer) Start() error {
|
||||
// Fetch snapshot
|
||||
response, err := p.client.Request("GET", fmt.Sprintf("https://app-snaps.ring.com/snapshots/next/%d", int(p.camera.ID)), nil)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to get snapshot: %w", err)
|
||||
}
|
||||
// Fetch snapshot
|
||||
response, err := p.client.Request("GET", fmt.Sprintf("https://app-snaps.ring.com/snapshots/next/%d", int(p.camera.ID)), nil)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to get snapshot: %w", err)
|
||||
}
|
||||
|
||||
pkt := &rtp.Packet{
|
||||
Header: rtp.Header{Timestamp: core.Now90000()},
|
||||
Payload: response,
|
||||
}
|
||||
pkt := &rtp.Packet{
|
||||
Header: rtp.Header{Timestamp: core.Now90000()},
|
||||
Payload: response,
|
||||
}
|
||||
|
||||
// Send to all receivers
|
||||
// Send to all receivers
|
||||
for _, receiver := range p.Receivers {
|
||||
receiver.WriteRTP(pkt)
|
||||
}
|
||||
receiver.WriteRTP(pkt)
|
||||
}
|
||||
|
||||
return nil
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *SnapshotProducer) Stop() error {
|
||||
return p.Connection.Stop()
|
||||
}
|
||||
return p.Connection.Stop()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user