Documentation ¶
Overview ¶
Connecting to different camera sources and make it recording to disk.
Index ¶
- func Base64Image(captureDevice *Capture, communication *models.Communication) string
- func CleanupRecordingDirectory(configDirectory string, configuration *models.Configuration)
- func FindMPEG4Audio(desc *description.Session, isBackChannel bool) (*format.MPEG4Audio, *description.Media)
- func FindOPUS(desc *description.Session, isBackChannel bool) (*format.Opus, *description.Media)
- func FindPCMU(desc *description.Session, isBackChannel bool) (*format.G711, *description.Media)
- func HandleRecordStream(queue *packets.Queue, configDirectory string, ...)
- func JpegImage(captureDevice *Capture, communication *models.Communication) image.YCbCr
- func VerifyCamera(c *gin.Context)
- func WriteMPEG4Audio(forma *format.MPEG4Audio, aus [][]byte) ([]byte, error)
- type Capture
- type Decoder
- type Golibrtsp
- func (g *Golibrtsp) Close() error
- func (g *Golibrtsp) Connect(ctx context.Context) (err error)
- func (g *Golibrtsp) ConnectBackChannel(ctx context.Context) (err error)
- func (g *Golibrtsp) DecodePacket(pkt packets.Packet) (image.YCbCr, error)
- func (g *Golibrtsp) DecodePacketRaw(pkt packets.Packet) (image.Gray, error)
- func (g *Golibrtsp) GetAudioStreams() ([]packets.Stream, error)
- func (j *Golibrtsp) GetStreams() ([]packets.Stream, error)
- func (g *Golibrtsp) GetVideoStreams() ([]packets.Stream, error)
- func (g *Golibrtsp) Start(ctx context.Context, streamType string, queue *packets.Queue, ...) (err error)
- func (g *Golibrtsp) StartBackChannel(ctx context.Context) (err error)
- func (g *Golibrtsp) WritePacket(pkt packets.Packet) error
- type RTSPClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Base64Image ¶
func Base64Image(captureDevice *Capture, communication *models.Communication) string
func CleanupRecordingDirectory ¶
func CleanupRecordingDirectory(configDirectory string, configuration *models.Configuration)
func FindMPEG4Audio ¶
func FindMPEG4Audio(desc *description.Session, isBackChannel bool) (*format.MPEG4Audio, *description.Media)
func FindOPUS ¶
func FindOPUS(desc *description.Session, isBackChannel bool) (*format.Opus, *description.Media)
func FindPCMU ¶
func FindPCMU(desc *description.Session, isBackChannel bool) (*format.G711, *description.Media)
func HandleRecordStream ¶
func HandleRecordStream(queue *packets.Queue, configDirectory string, configuration *models.Configuration, communication *models.Communication, rtspClient RTSPClient)
func JpegImage ¶
func JpegImage(captureDevice *Capture, communication *models.Communication) image.YCbCr
func VerifyCamera ¶
VerifyCamera godoc @Router /api/camera/verify/{streamType} [post] @ID verify-camera @Tags camera @Param streamType path string true "Stream Type" Enums(primary, secondary) @Param cameraStreams body models.CameraStreams true "Camera Streams" @Summary Validate a specific RTSP profile camera connection. @Description This method will validate a specific profile connection from an RTSP camera, and try to get the codec. @Success 200 {object} models.APIResponse
func WriteMPEG4Audio ¶
func WriteMPEG4Audio(forma *format.MPEG4Audio, aus [][]byte) ([]byte, error)
WriteMPEG4Audio writes MPEG-4 Audio access units.
Types ¶
type Capture ¶
type Capture struct { RTSPClient *Golibrtsp RTSPSubClient *Golibrtsp RTSPBackChannelClient *Golibrtsp }
func (*Capture) SetBackChannelClient ¶
func (*Capture) SetMainClient ¶
func (*Capture) SetSubClient ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
h264Decoder is a wrapper around FFmpeg's H264 decoder.
type Golibrtsp ¶
type Golibrtsp struct { RTSPClient Url string Client gortsplib.Client VideoDecoderMutex *sync.Mutex VideoH264Index int8 VideoH264Media *description.Media VideoH264Forma *format.H264 VideoH264Decoder *rtph264.Decoder VideoH264FrameDecoder *Decoder VideoH265Index int8 VideoH265Media *description.Media VideoH265Forma *format.H265 VideoH265Decoder *rtph265.Decoder VideoH265FrameDecoder *Decoder AudioLPCMIndex int8 AudioLPCMMedia *description.Media AudioLPCMForma *format.LPCM AudioLPCMDecoder *rtplpcm.Decoder AudioG711Index int8 AudioG711Media *description.Media AudioG711Forma *format.G711 AudioG711Decoder *rtplpcm.Decoder AudioOpusIndex int8 AudioOpusMedia *description.Media AudioOpusForma *format.Opus AudioOpusDecoder *rtpsimpleaudio.Decoder HasBackChannel bool AudioG711IndexBackChannel int8 AudioG711MediaBackChannel *description.Media AudioG711FormaBackChannel *format.G711 AudioMPEG4Index int8 AudioMPEG4Media *description.Media AudioMPEG4Forma *format.MPEG4Audio AudioMPEG4Decoder *rtpmpeg4audio.Decoder Streams []packets.Stream }
Implements the RTSPClient interface.
func (*Golibrtsp) ConnectBackChannel ¶
func (*Golibrtsp) DecodePacket ¶
Decode a packet to an image.
func (*Golibrtsp) DecodePacketRaw ¶
Decode a packet to a Gray image.
func (*Golibrtsp) GetAudioStreams ¶
Get a list of audio streams from the RTSP server.
func (*Golibrtsp) GetStreams ¶
Get a list of streams from the RTSP server.
func (*Golibrtsp) GetVideoStreams ¶
Get a list of video streams from the RTSP server.
func (*Golibrtsp) Start ¶
func (g *Golibrtsp) Start(ctx context.Context, streamType string, queue *packets.Queue, configuration *models.Configuration, communication *models.Communication) (err error)
Start the RTSP client, and start reading packets.
func (*Golibrtsp) StartBackChannel ¶
Start the RTSP client, and start reading packets.
type RTSPClient ¶
type RTSPClient interface { // Connect to the RTSP server. Connect(ctx context.Context) error // Connect to a backchannel RTSP server. ConnectBackChannel(ctx context.Context) error // Start the RTSP client, and start reading packets. Start(ctx context.Context, streamType string, queue *packets.Queue, configuration *models.Configuration, communication *models.Communication) error // Start the RTSP client, and start reading packets. StartBackChannel(ctx context.Context) (err error) // Decode a packet into a image. DecodePacket(pkt packets.Packet) (image.YCbCr, error) // Decode a packet into a image. DecodePacketRaw(pkt packets.Packet) (image.Gray, error) // Write a packet to the RTSP server. WritePacket(pkt packets.Packet) error // Close the connection to the RTSP server. Close() error // Get a list of streams from the RTSP server. GetStreams() ([]packets.Stream, error) // Get a list of video streams from the RTSP server. GetVideoStreams() ([]packets.Stream, error) // Get a list of audio streams from the RTSP server. GetAudioStreams() ([]packets.Stream, error) }
RTSPClient is a interface that abstracts the RTSP client implementation.