mirror of
https://github.com/go-gst/go-gst.git
synced 2025-10-14 04:03:49 +08:00
Merge pull request #7 from everycastlabs/add-unlink-many
add the ability to unlink and unlink many elems
This commit is contained in:
@@ -88,6 +88,18 @@ func ElementLinkMany(elems ...*Element) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ElementUnlinkMany is a go implementation of `gst_element_unlink_many` to compensate for
|
||||
// no variadic functions in cgo.
|
||||
func ElementUnlinkMany(elems ...*Element) {
|
||||
for idx, elem := range elems {
|
||||
if idx == 0 {
|
||||
// skip the first one as the loop always links previous to current
|
||||
continue
|
||||
}
|
||||
elems[idx-1].Unlink(elem)
|
||||
}
|
||||
}
|
||||
|
||||
// Rank represents a level of importance when autoplugging elements.
|
||||
type Rank uint
|
||||
|
||||
@@ -366,6 +378,10 @@ func (e *Element) Link(elem *Element) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (e *Element) Unlink(elem *Element) {
|
||||
C.gst_element_unlink((*C.GstElement)(e.Instance()), (*C.GstElement)(elem.Instance()))
|
||||
}
|
||||
|
||||
// LinkFiltered wraps gst_element_link_filtered and link this element to the given one
|
||||
// using the provided sink caps.
|
||||
func (e *Element) LinkFiltered(elem *Element, filter *Caps) error {
|
||||
|
Reference in New Issue
Block a user