gstreamer-graphix/gstreamer/types.go

108 lines
2.1 KiB
Go

package gstreamer
import (
"context"
"github.com/rs/zerolog"
"github.com/tinyzimmer/go-gst/gst"
"sync"
"time"
)
type Gstreamer struct {
pipelineSlots map[string][]string
Pipelines map[string]*Pipeline
notifyOnUpdate map[string][]NotifyOnPipelineUpdate
*Decklink
ctx context.Context
sync.RWMutex
}
type NotifyOnPipelineUpdate func(pipeline *Pipeline)
type Pipeline struct {
Name string
ID string
InputElement InputElement
OutputElement OutputElement
Overlays map[string]Overlay
PipelineUpdates chan PipelineUpdates
notifyOnUpdate []NotifyOnPipelineUpdate
pipeline *gst.Pipeline
logger zerolog.Logger
elements map[string]element
ctx context.Context
ctxCancel context.CancelFunc
sync.RWMutex
}
type Decklink struct {
Slots map[string]string
sync.RWMutex
}
type PipelineUpdates struct {
Overlays map[string]Overlay
}
type element struct {
prev, next string
element *gst.Element
name string
inputCaps []string
outputCaps []string
}
type Overlay interface {
getName() string
create(log zerolog.Logger) (*gst.Element, error)
getBlendInTime() time.Duration
getBlendOutTime() time.Duration
show() gst.ClockCallback
hide() gst.ClockCallback
update(log zerolog.Logger)
getElement() *gst.Element
setElement(element *gst.Element)
getType() string
}
type ImageOverlay struct {
element *gst.Element
Name string
Path string
X, Y int
Display bool
BlendIn time.Duration
BlendOut time.Duration
}
type TextOverlay struct {
element *gst.Element
Name string
X, Y int
Font string
FontSize int
FontWeight string
Color uint32
Value string
Display bool
MaxWidth uint
BlendIn time.Duration
BlendOut time.Duration
}
type InputElement struct {
Name string
Type string
Properties map[string]string
Caps []string
elements map[string]element
}
type OutputElement struct {
Name string
Type string
Properties map[string]string
Caps []string
elements map[string]element
}