rtsp

package module
v0.1.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 24, 2024 License: MIT Imports: 7 Imported by: 0

README

FFmpeg rtsp implementation

need FFmpeg libs
sudo apt install ffmpeg libswscale-dev libavformat-dev

GitHub go.mod Go version LICENSE Releases Linter

Documentation

Overview

Package go-rtsp is a Golang audio/video library based on FFmpeg. go-rtsp is powerful library to help convert streams/files to jpeg/wav.

Index

Constants

View Source
const (
	AV_LOG_QUIET   = C.AV_LOG_QUIET
	AV_LOG_PANIC   = C.AV_LOG_PANIC
	AV_LOG_FATAL   = C.AV_LOG_FATAL
	AV_LOG_ERROR   = C.AV_LOG_ERROR
	AV_LOG_WARNING = C.AV_LOG_WARNING
	AV_LOG_INFO    = C.AV_LOG_INFO
	AV_LOG_VERBOSE = C.AV_LOG_VERBOSE
	AV_LOG_DEBUG   = C.AV_LOG_DEBUG
	AV_LOG_TRACE   = C.AV_LOG_TRACE
)
View Source
const (
	// Tcp use tcp transport protocol
	Tcp = iota
	// Udp use udp transport  protocol
	Udp
)

Variables

This section is empty.

Functions

func CErr2Str added in v0.1.2

func CErr2Str(code C.int) string

CErr2Str convert C error code to Go string

func SetLogLevel added in v0.1.6

func SetLogLevel(logLevel LogLevel)

SetLogLevel ffmpeg log level

Types

type Audio

type Audio struct {
	// contains filtered or unexported fields
}

Audio audio meta

func (*Audio) BitRate

func (audio *Audio) BitRate() int

BitRate if audio or 0 if image

func (*Audio) Channels

func (audio *Audio) Channels() int

Channels if audio or 0 if image

func (*Audio) SampleRate

func (audio *Audio) SampleRate() int

SampleRate if audio or 0 if image

type ErrTimeout added in v0.1.2

type ErrTimeout struct {
	// contains filtered or unexported fields
}

ErrTimeout ETIMEDOUT

func (ErrTimeout) Error added in v0.1.2

func (e ErrTimeout) Error() string

Error error interface

type Image

type Image struct {
	// contains filtered or unexported fields
}

Image image meta

func (*Image) Height

func (image *Image) Height() int

Height if image or 0 if audio

func (*Image) Width

func (image *Image) Width() int

Width if image or 0 if audio

type LogLevel added in v0.1.6

type LogLevel C.int

type Packet

type Packet struct {
	Image
	Audio
	// contains filtered or unexported fields
}

Packet decoded media packet

func (*Packet) Data

func (packet *Packet) Data() []byte

Data encoded jpeg if image or wav if audio

func (*Packet) Duration added in v0.1.4

func (packet *Packet) Duration() int64

Position frame duration

func (*Packet) IsAudio

func (packet *Packet) IsAudio() bool

IsAudio is audio packet type

func (*Packet) IsVideo

func (packet *Packet) IsVideo() bool

IsVideo is video packet type

func (*Packet) Position added in v0.1.4

func (packet *Packet) Position() int64

Position frame position

func (*Packet) Type added in v0.1.4

func (packet *Packet) Type() int

Type packet type

type Stream

type Stream struct {
	// contains filtered or unexported fields
}

Stream media stream

func New

func New(uri string, opts ...StreamOption) (stream *Stream)

New media stream

func Open

func Open(uri string, opts ...StreamOption) (*Stream, error)

Open rtsp stream or file

func (*Stream) ReadPacket

func (stream *Stream) ReadPacket() (pkt *Packet, err error)

ReadPacket read frame from stream and decode it to Packet

func (*Stream) Setup

func (stream *Stream) Setup() (err error)

Setup stream

type StreamOption added in v0.1.6

type StreamOption func(*Stream)

func WithTimeout added in v0.1.6

func WithTimeout(timeout string) StreamOption

func WithType added in v0.1.6

func WithType(streamType Type) StreamOption

type Type

type Type int

Type rtsp transport protocol

Directories

Path Synopsis
example
url

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL