add tagsetter and tocsetter interfaces

This commit is contained in:
tinyzimmer
2020-10-01 18:53:43 +03:00
parent 2482d413eb
commit 1496383084
6 changed files with 135 additions and 12 deletions

34
gst/gst_toc_setter.go Normal file
View File

@@ -0,0 +1,34 @@
package gst
// #include "gst.go.h"
import "C"
// TOCSetter is an interface that elements can implement to provide TOC writing capabilities.
type TOCSetter interface {
// Return current TOC the setter uses. The TOC should not be modified without making it writable first.
GetTOC() *TOC
// Set the given TOC on the setter. Previously set TOC will be unreffed before setting a new one.
SetTOC(*TOC)
// Reset the internal TOC. Elements should call this from within the state-change handler.
Reset()
}
// gstTocSetter implements a TOCSetter that is backed by an Element from the C runtime.
type gstTOCSetter struct {
ptr *C.GstElement
}
func (g *gstTOCSetter) Instance() *C.GstTocSetter {
return C.toTocSetter(g.ptr)
}
func (g *gstTOCSetter) GetTOC() *TOC {
toc := C.gst_toc_setter_get_toc(g.Instance())
if toc == nil {
return nil
}
return wrapTOC(toc)
}
func (g *gstTOCSetter) SetTOC(toc *TOC) { C.gst_toc_setter_set_toc(g.Instance(), toc.Instance()) }
func (g *gstTOCSetter) Reset() { C.gst_toc_setter_reset(g.Instance()) }