Skip to content

Commit

Permalink
New Bin.GetByName method
Browse files Browse the repository at this point in the history
  • Loading branch information
michalderkacz committed May 21, 2013
1 parent eb5ba67 commit cb5c7a6
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion bin.go
Expand Up @@ -7,8 +7,8 @@ package gst
import "C"

import (
"unsafe"
"github.com/ziutek/glib"
"unsafe"
)

type Bin struct {
Expand Down Expand Up @@ -48,3 +48,17 @@ func (b *Bin) Remove(els ...*Element) bool {
}
return true
}

// GetByName returns the element with the given name from a bin. Returns nil
// if no element with the given name is found in the bin.
func (b *Bin) GetByName(name string) *Element {
en := (*C.gchar)(C.CString(name))
defer C.free(unsafe.Pointer(en))
p := glib.Pointer(C.gst_bin_get_by_name(b.g(), en))
if p == nil {
return nil
}
e := new(Element)
e.SetPtr(p)
return e
}

0 comments on commit cb5c7a6

Please sign in to comment.