Documentation ¶
Overview ¶
Package axvdo provides a Go wrapper around the libvdo C library. This package abstracts the complexities of direct C interaction, offering Go developers a more accessible and idiomatic way to work with Video capture API.
This wrapper aims to simplify the development of applications interacting with the Axis vdo system.
Index ¶
- func VdoErrorIsExpected(gerr **C.GError) bool
- func VdoFormatIsEncoded(format VdoFormat) bool
- func VdoFormatIsMotionEncoded(format VdoFormat) bool
- func VdoFrameIsEncoded(frameType VdoFrameType) bool
- type CropArea
- type StreamRotation
- type StreamStats
- type VdoBuffer
- func (b *VdoBuffer) GetBytes() ([]byte, error)
- func (b *VdoBuffer) GetBytesUnsafe() ([]byte, error)
- func (b *VdoBuffer) GetCapacity() uint
- func (b *VdoBuffer) GetData() (unsafe.Pointer, error)
- func (b *VdoBuffer) GetFd() (int, error)
- func (b *VdoBuffer) GetFrame() (*VdoFrame, error)
- func (b *VdoBuffer) GetId() int
- func (b *VdoBuffer) GetOffset() int64
- func (b *VdoBuffer) GetOpaque() unsafe.Pointer
- func (b *VdoBuffer) IsComplete() bool
- func (b *VdoBuffer) Unref()
- type VdoBufferAccess
- type VdoBufferStrategy
- type VdoChannel
- func (c *VdoChannel) ChooseStreamResolution(reqWidth, reqHeight int) (*VdoResolution, error)
- func (c *VdoChannel) GetId() (channel_id uint)
- func (c *VdoChannel) GetInfo() (*VdoMap, error)
- func (c *VdoChannel) GetResolutions(filter *VdoMap) ([]VdoResolution, error)
- func (c *VdoChannel) GetSettings() (*VdoMap, error)
- func (c *VdoChannel) SetFramerate(framerate float32) error
- func (c *VdoChannel) SetSettings(settings *VdoMap) error
- type VdoChunk
- type VdoChunkType
- type VdoError
- type VdoErrorCode
- type VdoFormat
- type VdoFrame
- func (f *VdoFrame) GetCustomTimestamp() int64
- func (f *VdoFrame) GetExtraInfo() *VdoMap
- func (f *VdoFrame) GetFd() int
- func (f *VdoFrame) GetFrameType() VdoFrameType
- func (f *VdoFrame) GetHeaderSize() int
- func (f *VdoFrame) GetIsLastBuffer() bool
- func (f *VdoFrame) GetOpaque() unsafe.Pointer
- func (f *VdoFrame) GetSequenceNbr() uint
- func (f *VdoFrame) GetSize() uint
- func (f *VdoFrame) GetTimestamp() uint64
- func (f *VdoFrame) Memmap() unsafe.Pointer
- func (f *VdoFrame) SetCustomTimestamp(timestamp int64)
- func (f *VdoFrame) SetExtraInfo(extraInfo *VdoMap)
- func (f *VdoFrame) SetFrameType(frameType VdoFrameType)
- func (f *VdoFrame) SetHeaderSize(size int)
- func (f *VdoFrame) SetIsLastBuffer(isLastBuffer bool)
- func (f *VdoFrame) SetSequenceNbr(seqNum uint)
- func (f *VdoFrame) SetSize(size uint)
- func (f *VdoFrame) SetTimestamp(timestamp uint64)
- func (f *VdoFrame) Unmap()
- func (b *VdoFrame) Unref()
- type VdoFrameType
- type VdoH264Profile
- type VdoH265Profile
- type VdoIntent
- type VdoMap
- func (v *VdoMap) Clear()
- func (v *VdoMap) Contains(name string) bool
- func (v *VdoMap) Dump()
- func (v *VdoMap) Empty() bool
- func (v *VdoMap) Equal(amp *VdoMap) bool
- func (m *VdoMap) GetBoolean(name string, defaultValue bool) bool
- func (m *VdoMap) GetByte(name string, defaultValue byte) byte
- func (m *VdoMap) GetDouble(name string, defaultValue float64) float64
- func (m *VdoMap) GetInt16(name string, defaultValue int16) int16
- func (m *VdoMap) GetInt32(name string, defaultValue int32) int32
- func (m *VdoMap) GetInt64(name string, defaultValue int64) int64
- func (m *VdoMap) GetString(name string, defaultValue string) string
- func (m *VdoMap) GetUint16(name string, defaultValue uint16) uint16
- func (m *VdoMap) GetUint32(name string, defaultValue uint32) uint32
- func (m *VdoMap) GetUint64(name string, defaultValue uint64) uint64
- func (v *VdoMap) Merge(amp *VdoMap)
- func (v *VdoMap) Remove(name string)
- func (m *VdoMap) SetBoolean(name string, value bool)
- func (m *VdoMap) SetByte(name string, value byte)
- func (m *VdoMap) SetDouble(name string, value float64)
- func (m *VdoMap) SetInt16(name string, value int16)
- func (m *VdoMap) SetInt32(name string, value int32)
- func (m *VdoMap) SetInt64(name string, value int64)
- func (m *VdoMap) SetString(name string, value string)
- func (m *VdoMap) SetUint16(name string, value uint16)
- func (m *VdoMap) SetUint32(name string, value uint32)
- func (m *VdoMap) SetUint64(name string, value uint64)
- func (v *VdoMap) Size() int
- func (v *VdoMap) Swap(rhs *VdoMap)
- func (v *VdoMap) Unref()
- type VdoMemChunk
- type VdoOverlayAlign
- type VdoOverlayColor
- type VdoOverlayTextSize
- type VdoRateControlMode
- type VdoRateControlPriority
- type VdoRect
- type VdoResolution
- type VdoStream
- func NewStream(settings *VdoMap) (*VdoStream, error)
- func NewVideoStreamFromConfig(stream_cfg VideoSteamConfiguration) (*VdoStream, error)
- func StreamGet(id int) (*VdoStream, error)
- func StreamGetAll() ([]*VdoStream, error)
- func VdoChannelGetAll() ([]*VdoStream, error)
- func VdoChannelGetFilterd(filter *VdoMap) ([]*VdoStream, error)
- func (v *VdoStream) Attach(intent *VdoMap) error
- func (v *VdoStream) BufferAlloc() (*VdoBuffer, error)
- func (v *VdoStream) BufferEnqueue(buffer *VdoBuffer) error
- func (v *VdoStream) BufferUnref(buffer *VdoBuffer) error
- func (v *VdoStream) ForceKeyFrame() error
- func (v *VdoStream) GetBuffer() (*VdoBuffer, error)
- func (v *VdoStream) GetEvent() (*VdoMap, error)
- func (v *VdoStream) GetEventFd() (int, error)
- func (v *VdoStream) GetFd() (int, error)
- func (v *VdoStream) GetId() int
- func (v *VdoStream) GetInfo() (*VdoMap, error)
- func (v *VdoStream) GetSettings() (*VdoMap, error)
- func (v *VdoStream) SetFramerate(framerate float64) error
- func (v *VdoStream) SetSettings(settings *VdoMap) error
- func (v *VdoStream) Start() error
- func (v *VdoStream) Stop()
- func (v *VdoStream) Unref()
- type VdoStreamEvent
- type VdoStreamTimestamp
- type VdoWdrMode
- type VdoZipStreamProfile
- type VideoFrame
- type VideoSteamConfiguration
- type ZipFPSMode
- type ZipGopMode
- type ZipSkipMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func VdoErrorIsExpected ¶
Check if error is expected. Expected errors typically occur as a result of force stopping 'com.axis.Vdo1.System'. This class of errors should not be logged as failures, when they occur the recipient is expected to either silently recover or exit informing the user that vdo is currently unavailable. https://axiscommunications.github.io/acap-documentation/docs/acap-sdk-version-3/api/src/api/vdostream/html/vdo-error_8h.html#ac748fae792da6c96a4cba4619a3a3d90
func VdoFormatIsEncoded ¶
VdoFormatIsEncoded checks if the given format is one of the encoded formats (H264, H265, or JPEG).
func VdoFormatIsMotionEncoded ¶
VdoFormatIsMotionEncoded checks if the given format is one of the motion encoded formats. It is considered motion encoded if it is encoded but not JPEG.
func VdoFrameIsEncoded ¶
func VdoFrameIsEncoded(frameType VdoFrameType) bool
VdoFrameIsEncoded checks if the given frame type is one of the encoded types.
Types ¶
type CropArea ¶
CropArea defines the dimensions and position of the crop area.
func CalculateCropDimensions ¶
calculateCropDimensions calculates the cropping dimensions and position based on input and stream sizes.
type StreamRotation ¶
type StreamRotation int
const ( StreamRotationNone StreamRotation = 0 StreamRotation90 StreamRotation = 90 StreamRotation180 StreamRotation = 180 StreamRotation270 StreamRotation = 270 )
type StreamStats ¶
type StreamStats struct { // Bitrate of the video stream in bits per second. Bitrate uint32 // BufferType describes the type of buffering strategy used for the stream. BufferType string // Channel represents the specific channel or stream identifier. Channel uint32 // Format specifies the video format used in the stream. Format uint32 // Framerate is the number of frames per second in the video stream. Framerate uint32 // GOPLength represents the length of a Group of Pictures in frames. GOPLength uint32 // H26xIntraRefresh indicates the intra refresh rate for H.264/H.265 video streams. H26xIntraRefresh uint32 // Height of the video stream in pixels. Height uint32 // HorizontalFlip indicates whether the video stream is flipped horizontally. HorizontalFlip bool // ID is a unique identifier for the stream. ID uint32 // InitialBitrate is the initial bitrate of the video stream in bits per second. InitialBitrate uint32 // InitialQPb is the initial quantization parameter for B-frames. InitialQPb uint32 // InitialQPi is the initial quantization parameter for I-frames. InitialQPi uint32 // InitialQPp is the initial quantization parameter for P-frames. InitialQPp uint32 // Overlays describes any overlays applied to the video stream. Overlays string // Peers represents the number of peers connected to the video stream. Peers uint32 // QPb is the current quantization parameter for B-frames. QPb uint32 // QPi is the current quantization parameter for I-frames. QPi uint32 // QPp is the current quantization parameter for P-frames. QPp uint32 // Rotation indicates the rotation applied to the video stream, in degrees. Rotation uint32 // Running indicates whether the video stream is currently active. Running bool // SquarePixel indicates whether square pixels are used in the video stream. SquarePixel uint32 // StatisticsAccumulatedBytes is the total number of bytes processed by the stream. StatisticsAccumulatedBytes uint64 // StatisticsAccumulatedIDRBytes is the total number of IDR frame bytes processed by the stream. StatisticsAccumulatedIDRBytes uint64 // StatisticsBitCount is the total number of bits processed by the stream. StatisticsBitCount uint32 // StatisticsBitrate is the current bitrate of the video stream in bits per second. StatisticsBitrate uint32 // StatisticsDuration is the total duration of video processed by the stream, in milliseconds. StatisticsDuration int64 // StatisticsDynamicFramerate is the current dynamic frame rate of the video stream. StatisticsDynamicFramerate uint32 // StatisticsFailedFrames is the total number of frames that failed to process. StatisticsFailedFrames uint32 // StatisticsFrameCount is the total number of frames processed by the stream. StatisticsFrameCount uint32 // StatisticsFramerate is the current frame rate of the video stream. StatisticsFramerate uint32 // StatisticsIDRFrameCount is the total number of IDR frames processed by the stream. StatisticsIDRFrameCount uint32 // StatisticsLastFrameTS is the timestamp of the last frame processed. StatisticsLastFrameTS uint64 // StatisticsReclaimCount is the number of times stream resources have been reclaimed. StatisticsReclaimCount uint32 // Width of the video stream in pixels. Width uint32 // ZipProfile indicates the compression profile used for the video stream. ZipProfile uint32 }
StreamStats holds statistical information about a video stream, including metrics such as bitrate, frame rate, resolution, and more. It provides a detailed view of the stream's current configuration and performance.
func (*StreamStats) PrintStreamStats ¶
func (s *StreamStats) PrintStreamStats()
PrintStreamStats prints the fields of the StreamStats.
type VdoBuffer ¶
func NewVdoBuffer ¶
NewVdoBuffer creates a buffer owned by an external framework. TODO: opaque https://axiscommunications.github.io/acap-documentation/docs/acap-sdk-version-3/api/src/api/vdostream/html/vdo-buffer_8h.html#ad35e3382fa9f9bb4024af62cec90b034
func NewVdoBufferFull ¶
NewVdoBufferFull creates a buffer with custom properties. Default: VDO_BUFFER_ACCESS_ANY_RW (suitable for producers) The fd will not be closed by unref. TODO: opaque https://axiscommunications.github.io/acap-documentation/docs/acap-sdk-version-3/api/src/api/vdostream/html/vdo-buffer_8h.html#a097843481f6052a45fa46a6ca359750a
func Snapshot ¶
Fetches a single VdoBuffer containing a frame. Convenience function for fetching a single frame. Free the buffer with unref.
func (*VdoBuffer) GetBytes ¶
GetBytes returns the data of the VdoBuffer as a Go byte slice. Note: This operation copies the data from C memory to Go memory.
func (*VdoBuffer) GetBytesUnsafe ¶
GetBytes returns the data of the VdoBuffer as a directly mapped byte slice. Note: This operation should be use carefully regarding the lifetime of the memory and avoiding memory corruption or access violations It's critical to ensure that returned bytes slice is not used after buffer unref
func (*VdoBuffer) GetCapacity ¶
GetCapacity returns the entire buffer capacity of the VdoBuffer.
func (*VdoBuffer) GetData ¶
GetData returns a pointer to the underlying buffer data. Note: Beware this pointer is only valid for as long as the VdoBuffer itself is valid.
func (*VdoBuffer) GetFrame ¶
GetFrame returns a pointer to the underlying frame. Note: The returned frame type and handling would depend on further definitions and usage.
func (*VdoBuffer) GetOpaque ¶
GetOpaque returns user-provided custom information. The opaque pointer has no predefined meaning inside the vdo framework itself, it is meant to facilitate interoperability with other existing frameworks as well as caching the buffer data pointer(see vdo_buffer_get_data).
func (*VdoBuffer) IsComplete ¶
IsComplete indicates whether the buffer is complete.
type VdoBufferAccess ¶
type VdoBufferAccess uint
const ( VdoBufferAccessNone VdoBufferAccess = 0 VdoBufferAccessCPURd VdoBufferAccess = 1 << 0 VdoBufferAccessDEVRd VdoBufferAccess = 1 << 1 VdoBufferAccessAnyRd VdoBufferAccess = VdoBufferAccessCPURd | VdoBufferAccessDEVRd VdoBufferAccessCPUWr VdoBufferAccess = 1 << 8 VdoBufferAccessDEVWr VdoBufferAccess = 1 << 9 VdoBufferAccessAnyWr VdoBufferAccess = VdoBufferAccessCPUWr | VdoBufferAccessDEVWr VdoBufferAccessCPURW VdoBufferAccess = VdoBufferAccessCPURd | VdoBufferAccessCPUWr VdoBufferAccessDEVRW VdoBufferAccess = VdoBufferAccessDEVRd | VdoBufferAccessDEVWr VdoBufferAccessAnyRW VdoBufferAccess = VdoBufferAccessCPURW | VdoBufferAccessDEVRW )
type VdoBufferStrategy ¶
type VdoBufferStrategy int
const ( VdoBufferStrategyNone VdoBufferStrategy = 0 VdoBufferStrategyInput VdoBufferStrategy = 1 VdoBufferStrategyExternal VdoBufferStrategy = 2 VdoBufferStrategyExplicit VdoBufferStrategy = 3 VdoBufferStrategyInfinite VdoBufferStrategy = 4 )
type VdoChannel ¶
type VdoChannel struct {
Ptr *C.VdoChannel
}
func VdoChannelGet ¶
func VdoChannelGet(channel_nbr uint) (*VdoChannel, error)
Get an existing channel. Create a new VdoChannel object representing an existing channel session with the specified channel number.
func (*VdoChannel) ChooseStreamResolution ¶
func (c *VdoChannel) ChooseStreamResolution(reqWidth, reqHeight int) (*VdoResolution, error)
ChooseStreamResolution finds the smallest resolution that meets or exceeds the requested dimensions
func (*VdoChannel) GetId ¶
func (c *VdoChannel) GetId() (channel_id uint)
Get the ID for this channel.
func (*VdoChannel) GetInfo ¶
func (c *VdoChannel) GetInfo() (*VdoMap, error)
Get the info for this channel. This function is called in order to get a pointer to the info map for this channel. The returned pointer is a pointer to a newly allocated VdoMap owned by the caller of this function
func (*VdoChannel) GetResolutions ¶
func (c *VdoChannel) GetResolutions(filter *VdoMap) ([]VdoResolution, error)
Fetch all valid resolutions for a channel with specified stream format. Get a VdoResolutionSet of valid resolutions. Specifying filter or NULL for default.
func (*VdoChannel) GetSettings ¶
func (c *VdoChannel) GetSettings() (*VdoMap, error)
Get the settings for this channel. This function is called in order to get a pointer to the settings map for this channel. The returned pointer is a pointer to a newly allocated VdoMap owned by the caller of this function. For example:
func (*VdoChannel) SetFramerate ¶
func (c *VdoChannel) SetFramerate(framerate float32) error
Update the framerate for the specified channel. This function is invoked in order to update the framerate of a channel. All streams that are connected to this channel may be changed. Only streams with a higher fps set than the channel framerate will be affected.
func (*VdoChannel) SetSettings ¶
func (c *VdoChannel) SetSettings(settings *VdoMap) error
Update the settings for this channel.
type VdoChunk ¶
type VdoChunk struct { Data unsafe.Pointer // Pointer to data Size uintptr // Size of the data in bytes Type VdoChunkType // Type of the chunk, based on the VdoChunkType enum }
VdoChunk represents a chunk of data with a specified type.
type VdoChunkType ¶
type VdoChunkType uint
const ( VdoChunkNone VdoChunkType = 0 VdoChunkError VdoChunkType = 1 << 31 )
type VdoError ¶
type VdoError struct { Code VdoErrorCode Message string Expected bool }
VdoStream Error, a glib error but with vdo error codes
func (*VdoError) ErrorCodeString ¶
type VdoErrorCode ¶
type VdoErrorCode int
https://axiscommunications.github.io/acap-documentation/docs/acap-sdk-version-3/api/src/api/vdostream/html/vdo-types_8h_source.html VdoError represents the error codes for VDO operations. Used internaly
const ( VdoErrorCodeNotFound VdoErrorCode = iota + 1 VdoErrorCodeExists VdoErrorCodeInvalidArgument VdoErrorCodePermissionDenied VdoErrorCodeNotSupported VdoErrorCodeClosed VdoErrorCodeBusy VdoErrorCodeIO VdoErrorCodeHAL VdoErrorCodeDBus VdoErrorCodeOOM VdoErrorCodeIdle VdoErrorCodeNoData VdoErrorCodeNoBufferSpace VdoErrorCodeBufferFailure VdoErrorCodeInterfaceDown VdoErrorCodeFailed VdoErrorCodeFatal VdoErrorCodeNotControlled VdoErrorCodeNoEvent )
type VdoFormat ¶
type VdoFormat int
VdoFormat corresponds to the C enum VdoFormat.
const ( VdoFormatNone VdoFormat = C.VDO_FORMAT_NONE VdoFormatH264 VdoFormat = C.VDO_FORMAT_H264 VdoFormatH265 VdoFormat = C.VDO_FORMAT_H265 VdoFormatJPEG VdoFormat = C.VDO_FORMAT_JPEG VdoFormatYUV VdoFormat = C.VDO_FORMAT_YUV VdoFormatBayer VdoFormat = C.VDO_FORMAT_BAYER VdoFormatIVS VdoFormat = C.VDO_FORMAT_IVS VdoFormatRAW VdoFormat = C.VDO_FORMAT_RAW VdoFormatRGBA VdoFormat = C.VDO_FORMAT_RGBA VdoFormatRGB VdoFormat = C.VDO_FORMAT_RGB VdoFormatPlanarRGB VdoFormat = C.VDO_FORMAT_PLANAR_RGB )
func VdoFrameIsOfFormat ¶
func VdoFrameIsOfFormat(frameType VdoFrameType) VdoFormat
VdoFrameIsOfFormat returns the VdoFormat corresponding to the given VdoFrameType.
type VdoFrame ¶
func (*VdoFrame) GetCustomTimestamp ¶
GetCustomTimestamp returns a custom timestamp for this frame.
func (*VdoFrame) GetExtraInfo ¶
GetExtraInfo returns the extra info of this frame.
func (*VdoFrame) GetFrameType ¶
func (f *VdoFrame) GetFrameType() VdoFrameType
GetFrameType returns the type of this frame.
func (*VdoFrame) GetHeaderSize ¶
GetHeaderSize returns the size of any H264/H265 headers contained in this frame.
func (*VdoFrame) GetIsLastBuffer ¶
GetIsLastBuffer tests whether this frame is the last buffer.
func (*VdoFrame) GetSequenceNbr ¶
GetSequenceNbr returns the sequence number of this frame.
func (*VdoFrame) GetTimestamp ¶
GetTimestamp returns the timestamp of this frame.
func (*VdoFrame) Memmap ¶
Memmap maps the frame into current process memory. Returns a pointer to the data.
func (*VdoFrame) SetCustomTimestamp ¶
SetCustomTimestamp sets a custom timestamp for this frame.
func (*VdoFrame) SetExtraInfo ¶
SetExtraInfo sets the extra info of this frame.
func (*VdoFrame) SetFrameType ¶
func (f *VdoFrame) SetFrameType(frameType VdoFrameType)
SetFrameType sets the type of this frame.
func (*VdoFrame) SetHeaderSize ¶
SetHeaderSize sets the header size of this frame, used for H26x frames.
func (*VdoFrame) SetIsLastBuffer ¶
SetIsLastBuffer marks this frame as the last buffer.
func (*VdoFrame) SetSequenceNbr ¶
SetSequenceNbr sets the sequence number of this frame.
func (*VdoFrame) SetTimestamp ¶
SetTimestamp sets the timestamp of this frame.
type VdoFrameType ¶
type VdoFrameType int
VdoRateControlPriority corresponds to the C enum VdoRateControlPriority.
const ( VdoFrameTypeNone VdoFrameType = iota VdoFrameTypeH264SPS VdoFrameTypeH264PPS VdoFrameTypeH264SEI VdoFrameTypeH264IDR VdoFrameTypeH264I VdoFrameTypeH264P VdoFrameTypeH264B VdoFrameTypeH265SPS VdoFrameTypeH265PPS VdoFrameTypeH265VPS VdoFrameTypeH265SEI VdoFrameTypeH265IDR VdoFrameTypeH265I VdoFrameTypeH265P VdoFrameTypeH265B VdoFrameTypeJPEG VdoFrameTypeYUV VdoFrameTypeRAW VdoFrameTypeRGBA VdoFrameTypeRGB VdoFrameTypePlanarRGB )
func (VdoFrameType) String ¶
func (v VdoFrameType) String() string
type VdoH264Profile ¶
type VdoH264Profile int
VdoH264Profile corresponds to the C enum VdoH264Profile.
const ( VdoH264ProfileNone VdoH264Profile = C.VDO_H264_PROFILE_NONE VdoH264ProfileBaseline VdoH264Profile = C.VDO_H264_PROFILE_BASELINE VdoH264ProfileMain VdoH264Profile = C.VDO_H264_PROFILE_MAIN VdoH264ProfileHigh VdoH264Profile = C.VDO_H264_PROFILE_HIGH )
type VdoH265Profile ¶
type VdoH265Profile int
VdoH265Profile corresponds to the C enum VdoH265Profile.
const ( VdoH265ProfileNone VdoH265Profile = C.VDO_H265_PROFILE_NONE VdoH265ProfileMain VdoH265Profile = C.VDO_H265_PROFILE_MAIN VdoH265ProfileMain10 VdoH265Profile = C.VDO_H265_PROFILE_MAIN_10 )
type VdoIntent ¶
type VdoIntent uint
const ( VdoIntentNone VdoIntent = 0 VdoIntentControl VdoIntent = 1 VdoIntentMonitor VdoIntent = 2 VdoIntentConsume VdoIntent = 4 VdoIntentProduce VdoIntent = 8 VdoIntentDefault VdoIntent = VdoIntentConsume | VdoIntentControl VdoIntentEventFD VdoIntent = 16 VdoIntentUniverse VdoIntent = ^VdoIntent(0) )
type VdoMap ¶
func GetGlobalVdoChannelInfo ¶
Get the info for this channel. This function is called in order to get a pointer to the info map for this channel. The returned pointer is a pointer to a newly allocated VdoMap owned by the caller of this function
func VideoStreamConfigToVdoMap ¶
func VideoStreamConfigToVdoMap(cfg VideoSteamConfiguration) *VdoMap
VideoStreamConfigToVdoMap converts a VideoSteamConfiguration object into a VdoMap. This conversion allows the configuration to be applied to the video stream by translating high-level configuration options into the format expected by the streaming system.
func (*VdoMap) GetBoolean ¶
GetBoolean gets a bool value by name from VdoMap.
func (*VdoMap) SetBoolean ¶
Sets bool value in VdoMap
type VdoMemChunk ¶
type VdoMemChunk struct { Data unsafe.Pointer // Pointer to the data DataSize uintptr // Size of the data in bytes }
VdoMemChunk represents a memory chunk with its data pointer and size.
type VdoOverlayAlign ¶
type VdoOverlayAlign int
const ( VdoOverlayAlignNone VdoOverlayAlign = -1 VdoOverlayAlignTop VdoOverlayAlign = 0 VdoOverlayAlignBottom VdoOverlayAlign = 1 )
type VdoOverlayColor ¶
type VdoOverlayColor uint16
const ( VdoOverlayColorTransparent VdoOverlayColor = 0x0000 VdoOverlayColorBlack VdoOverlayColor = 0xF000 VdoOverlayColorWhite VdoOverlayColor = 0xFFFF )
type VdoOverlayTextSize ¶
type VdoOverlayTextSize int
const ( VdoOverlayTextSizeSmall VdoOverlayTextSize = 16 VdoOverlayTextSizeMedium VdoOverlayTextSize = 32 VdoOverlayTextSizeLarge VdoOverlayTextSize = 48 )
type VdoRateControlMode ¶
type VdoRateControlMode int
VdoRateControlMode corresponds to the C enum VdoRateControlMode.
const ( VdoRateControlModeNone VdoRateControlMode = C.VDO_RATE_CONTROL_MODE_NONE VdoRateControlModeCBR VdoRateControlMode = C.VDO_RATE_CONTROL_MODE_CBR VdoRateControlModeVBR VdoRateControlMode = C.VDO_RATE_CONTROL_MODE_VBR VdoRateControlModeMBR VdoRateControlMode = C.VDO_RATE_CONTROL_MODE_MBR VdoRateControlModeABR VdoRateControlMode = C.VDO_RATE_CONTROL_MODE_ABR )
type VdoRateControlPriority ¶
type VdoRateControlPriority int
VdoRateControlPriority corresponds to the C enum VdoRateControlPriority.
const ( VdoRateControlPriorityNone VdoRateControlPriority = C.VDO_RATE_CONTROL_PRIORITY_NONE VdoRateControlPriorityFramerate VdoRateControlPriority = C.VDO_RATE_CONTROL_PRIORITY_FRAMERATE VdoRateControlPriorityQuality VdoRateControlPriority = C.VDO_RATE_CONTROL_PRIORITY_QUALITY VdoRateControlPriorityFullFramerate VdoRateControlPriority = C.VDO_RATE_CONTROL_PRIORITY_FULL_FRAMERATE )
type VdoRect ¶
type VdoRect struct { Width uint // Width of the rectangle Height uint // Height of the rectangle X uint // X coordinate of the rectangle's origin Y uint // Y coordinate of the rectangle's origin }
VdoRect represents a rectangular area with width, height, and position (x, y).
type VdoResolution ¶
VdoResolution represents the resolution of a video or an image.
func GetVdoChannelMaxResolution ¶
func GetVdoChannelMaxResolution(video_channel int) (*VdoResolution, error)
Returns the higest resolution for a video channel Video channel, 0 is overview, 1, 2, ... are view areas.
func GetVdoChannelResolutions ¶
func GetVdoChannelResolutions(video_channel int) ([]VdoResolution, error)
Returns a list of resolutions for the given video channel Video channel, 0 is overview, 1, 2, ... are view areas.
func (VdoResolution) RgbSize ¶ added in v1.0.2
func (r VdoResolution) RgbSize() int
type VdoStream ¶
func NewVideoStreamFromConfig ¶
func NewVideoStreamFromConfig(stream_cfg VideoSteamConfiguration) (*VdoStream, error)
NewVideoStreamFromConfig creates and initializes a new video stream based on the provided configuration. It converts the configuration into a format understood by the underlying video streaming system and starts the stream.
func StreamGetAll ¶
Gets all existing video streams
func VdoChannelGetAll ¶
Gets all existing channels. Create new VdoChannel objects representing each existing channel and return those in a GList.
func VdoChannelGetFilterd ¶
Gets all existing channels matching a filter. Create new VdoChannel objects representing existing channels matching a filter and return those in a VdoStream List.
func (*VdoStream) Attach ¶
Attach to a Stream. This function is intended to be used with vdo_stream_get, it is redundant to attach to a stream which was created by NewVdoStream. VDO_INTENT_CONTROL Grants start, stop, info, settings, keyframe VDO_INTENT_MONITOR Monitor events using g_signal VDO_INTENT_CONSUME The client intends to stream VDO_INTENT_PRODUCE The client intends to inject frames VDO_INTENT_DEFAULT Grants CONSUME and CONTROL VDO_INTENT_EVENTFD Monitor events using file descriptors VDO_INTENT_UNIVERSE Everything except VDO_INTENT_EVENTFD
vdoMap.SetUint32("intent", VdoIntentEventFD)
func (*VdoStream) BufferAlloc ¶
Allocates a new buffer for this stream. Invoke this function in order to allocate a new buffer for this video stream. The vdo service performs the actual memory allocation and owns the buffer. A handle to the allocated buffer is returned in the form of a VdoBuffer
Note:
This function is synchronous and will block until a response from the vdo service is received. This function can only be invoked for non-encoded video streams.
func (*VdoStream) BufferEnqueue ¶
Enqueue a buffer for this video stream. Invoking this function equeues the specified VdoBuffer in the internal queue of this video stream in order to be subsequently filled with frame data.
func (*VdoStream) BufferUnref ¶
Decreases the reference count for the specified buffer. The buffer is freed by the vdo service when the reference count reaches 0. Note:
This function is synchronous and will block until a response from the vdo service is received.
func (*VdoStream) ForceKeyFrame ¶
Forces this video stream to insert a key frame. This function is invoked in order to force a key frame into a video stream. Invoking this functionon a video stream with a format that is not a video format (e.g. H.264 or H.265) will have no effect.
func (*VdoStream) GetBuffer ¶
Fetches a VdoBuffer containing a frame. Stream global settings which control the behavior of this function: "socket.blocking" (default: TRUE) "socket.timeout_ms" The following errors are transient: VDO_ERROR_NO_DATA Recover by fetching the next buffer. The following errors are expected to occur during maintenance: VDO_ERROR_INTERFACE_DOWN Recover by waiting for the service to restart. Complete VdoStream reinitialization is necessary. All remaining errors are fatal: Complete VdoStream reinitialization is necessary.
func (*VdoStream) GetEvent ¶
Fetches the next Event. See VdoStreamEvent for the list of possible events, the current event is returned in the VdoMap "event" field. The following errors are transient: VDO_ERROR_NO_EVENT The equivalent of EAGAIN, i.e. there's currently no event. The following errors are expected to occur during maintenance: VDO_ERROR_INTERFACE_DOWN Recover by waiting for the service to restart. Complete VdoStream reinitialization is necessary. All remaining errors are fatal: Complete VdoStream reinitialization is necessary.
func (*VdoStream) GetEventFd ¶
Returns a file descriptor for prioritized events. This requires VDO_INTENT_EVENTFD and is intended to be used together with the vdo_stream_get_event function.
func (*VdoStream) GetFd ¶
Returns a file descriptor representing the underlying socket connection. The file descriptor returned by this function represents the underlying socket based connection to the vdo service. The returned file descriptor can by used as an event source in an event loop to handle asynchronous I/O events.
func (*VdoStream) GetInfo ¶
Get the info for this video stream.
https://axiscommunications.github.io/acap-documentation/docs/acap-sdk-version-3/api/src/api/vdostream/html/vdo-stream_8h.html#a6368c8c989cbea997947d433dce6a3cb VdoMap must unref by user
func (*VdoStream) GetSettings ¶
Get the settings for this video stream.
https://axiscommunications.github.io/acap-documentation/docs/acap-sdk-version-3/api/src/api/vdostream/html/vdo-stream_8h.html#ad1279257f13b9a406a0df2558f10123e VdoMap must unref by user
func (*VdoStream) SetFramerate ¶
Update the framerate for this video stream. This function is invoked in order to update the framerate of a video stream. For this API to be used, the stream needs one or more of the following stream settings to be applied before the stream is started: 1) Dynamic framerate is enabled (dynamic.framerate = TRUE) 2) Zipstream fps mode is set to dynamic (zip.fps_mode = 1)
func (*VdoStream) SetSettings ¶
Update the settings for this video stream.
type VdoStreamEvent ¶
type VdoStreamEvent uint
const ( VdoStreamEventNone VdoStreamEvent = 0x00 VdoStreamEventStarted VdoStreamEvent = 0x01 VdoStreamEventStopped VdoStreamEvent = 0x02 VdoStreamEventResource VdoStreamEvent = 0x10 VdoStreamEventQuotaSoft VdoStreamEvent = 0x11 VdoStreamEventQuotaHard VdoStreamEvent = 0x12 VdoStreamEventZipstream VdoStreamEvent = 0x20 VdoStreamEventInvalid VdoStreamEvent = ^VdoStreamEvent(0) )
type VdoStreamTimestamp ¶
type VdoStreamTimestamp uint
const ( VdoTimestampNone VdoStreamTimestamp = 0 VdoTimestampUTC VdoStreamTimestamp = 1 VdoTimestampZipstream VdoStreamTimestamp = 2 VdoTimestampDiff VdoStreamTimestamp = 4 VdoTimestampMonoCapture VdoStreamTimestamp = 8 VdoTimestampMonoServer VdoStreamTimestamp = 16 VdoTimestampMonoClient VdoStreamTimestamp = 32 VdoTimestampMonoClientServerDiff VdoStreamTimestamp = VdoTimestampDiff | VdoTimestampMonoClient | VdoTimestampMonoServer VdoTimestampMonoClientCaptureDiff VdoStreamTimestamp = VdoTimestampDiff | VdoTimestampMonoClient | VdoTimestampMonoCapture )
type VdoWdrMode ¶
type VdoWdrMode int
VdoWdrMode corresponds to the C enum VdoWdrMode.
const ( VdoWdrModeNone VdoWdrMode = C.VDO_WDR_MODE_NONE VdoWdrModeLinear VdoWdrMode = C.VDO_WDR_MODE_LINEAR VdoWdrMode2X VdoWdrMode = C.VDO_WDR_MODE_2X VdoWdrMode3X VdoWdrMode = C.VDO_WDR_MODE_3X VdoWdrMode4X VdoWdrMode = C.VDO_WDR_MODE_4X VdoWdrModeSensor VdoWdrMode = C.VDO_WDR_MODE_SENSOR )
type VdoZipStreamProfile ¶
type VdoZipStreamProfile int
const ( VdoZipStreamProfileNone VdoZipStreamProfile = -1 VdoZipStreamProfileClassic VdoZipStreamProfile = 0 VdoZipStreamProfileStorage VdoZipStreamProfile = 1 VdoZipStreamProfileLive VdoZipStreamProfile = 2 )
type VideoFrame ¶
type VideoFrame struct { SequenceNbr uint // The sequence number of the frame. Timestamp time.Time // The timestamp when the frame was captured. Size uint // The size of the frame data in bytes. Data []byte // The raw data of the video frame Type VdoFrameType // Type describes the frame type (e.g., I-frame, P-frame, B-frame). Error error // Error contains any error that occurred while processing the frame. ErrorExpected bool // ErrorExpected indicates whether the error was expected on vdo maintance HeaderSize int // HeaderSize is the size of the frame header }
VideoFrame represents a single frame of video data, including metadata such as the sequence number, timestamp, and size. It also includes information about the type of frame and any errors encountered.
func GetVideoFrame ¶
func GetVideoFrame(vdo_stream *VdoStream) *VideoFrame
GetVideoFrame retrieves a video frame from a video stream. If an expected error occurs (e.g., for stream maintenance), the function returns a VideoFrame with the Error and ErrorExpected fields set. This function is recursive and will retry fetching a frame if a recoverable error occurs.
func NewVideoFrame ¶
func NewVideoFrame(frame *VdoFrame, data []byte, header_size int) *VideoFrame
NewVideoFrame creates a new VideoFrame instance from a VdoFrame and its data. This function extracts relevant information from the VdoFrame, including the sequence number, timestamp, size, and frame type, and packages it into a VideoFrame structure.
func (*VideoFrame) HeaderData ¶
func (f *VideoFrame) HeaderData() []byte
func (*VideoFrame) String ¶
func (f *VideoFrame) String() string
String returns a string representation of the VideoFrame, including sequence number, timestamp, size, and frame type.
type VideoSteamConfiguration ¶
type VideoSteamConfiguration struct { Format *VdoFormat //Video stream format as VdoFormat. BufferCount *int // How many in-flight buffers are desired. BufferStrategy *VdoBufferStrategy // Buffering Strategy as VdoBufferStrategy. Input *int // Video input, 1 ... inmax. 0 is invalid. No view areas. Channel *int // Video channel, 0 is overview, 1, 2, ... are view areas. Width *int // Video stream horizontal resolution. Height *int // Video stream vertical resolution. Framerate *int // Video stream vertical resolution. Compression *int // Video stream compression, Axis standard range [0:100] Rotation *StreamRotation // Video stream rotation, normally [0,90,180,270]. HorizontalFlip *bool // Video stream horizontal flip (mirroring). VerticalFlip *bool // Video stream vertical flip. Monochrome *bool // Video stream monochrome encoding. DynamicGOP *bool // Enable dynamic gop DynamicBitrate *bool // Enable dynamic bitrate DynamicFramerate *bool // Enable dynamic framerate DynamicCompression *bool // Enable dynamic compression Qpi *uint32 // QP value for I-frames. Qpp *uint32 // QP value for P-frames. Bitrate *uint32 // Video stream bitrate (bps) RateControlMode *VdoRateControlMode // Bitrate control mode. RateControlPriority *VdoRateControlPriority // Bitrate control priority. GOPLength *uint32 // GOP length. // H.264 Specific Settings H264Profile *VdoH264Profile // H.265 profile as VdoH264Profile H265Profile *VdoH265Profile // H.264 profile as VdoH264Profile // Zipstream Specific Settings ZipStrength *uint32 // Zipstream strength. ZipMaxGOPLength *uint32 // Zipstream maximum GOP length. ZipGOPMode *ZipGopMode // Zipstream GOP mode [0 = fixed, 1 = dynamic]. ZipFPSMode *ZipFPSMode // Zipstream framerate control mode: [0 = fixed, 1 = dynamic]. ZipSkipMode *ZipSkipMode // Zipstream frame skip mode: [0 = drop, 1 = empty]. ZipMinFPSNum *uint32 // Zipstream minimum framerate numerator. ZipMinFPSDen *uint32 // Zipstream minimum framerate denominator. ZipProfile *VdoZipStreamProfile // Zipstream profile. // ABR Specific Settings // The following ABR specific settings are supported with VDO_RATE_CONTROL_MODE_ABR. AbrTarget_bitrate *uint32 // Stream target bitrate (bps) AbrRetention_time *uint32 // Retention time in seconds }
func (*VideoSteamConfiguration) GetChannel ¶
func (vsc *VideoSteamConfiguration) GetChannel() int
GetChannel extracts the channel number from a VideoSteamConfiguration if it's set, otherwise returns a default value of 0. This method simplifies accessing the channel value, providing a safe way to handle nil pointers within the configuration.
func (*VideoSteamConfiguration) RgbFrameSize ¶ added in v1.0.2
func (vsc *VideoSteamConfiguration) RgbFrameSize() int
type ZipFPSMode ¶
type ZipFPSMode int
const ( ZipFPSModeFixed ZipFPSMode = 0 ZipFPSModeDynamic ZipFPSMode = 1 )
type ZipGopMode ¶
type ZipGopMode int
const ( ZipGOPModeFixed ZipGopMode = 0 ZipGOPModeDynamic ZipGopMode = 1 )
type ZipSkipMode ¶
type ZipSkipMode int
const ( ZipSkipModeDrop ZipSkipMode = 0 ZipSkipModeEmpty ZipSkipMode = 1 )