mirror of
https://github.com/go-gst/go-gst.git
synced 2025-10-06 16:36:51 +08:00
add tagsetter and tocsetter interfaces
This commit is contained in:
34
gst/gst_toc_setter.go
Normal file
34
gst/gst_toc_setter.go
Normal 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()) }
|
Reference in New Issue
Block a user