func NewBin(name string) *Bin { s := (*C.gchar)(C.CString(name)) defer C.free(unsafe.Pointer(s)) b := new(Bin) b.SetPtr(glib.Pointer(C.gst_bin_new(s))) return b }
func NewGhostPadNoTarget(name string, dir PadDirection) *GhostPad { s := (*C.gchar)(C.CString(name)) defer C.free(unsafe.Pointer(s)) p := new(GhostPad) p.SetPtr(glib.Pointer(C.gst_ghost_pad_new_no_target(s, dir.g()))) return p }
func NewButtonWithLabel(label string) *Button { b := new(Button) b.SetPtr( glib.Pointer(C.gtk_button_new_with_label((*C.gchar)(C.CString(label)))), ) return b }
func NewButtonFromStock(stock string) *Button { b := new(Button) b.SetPtr( glib.Pointer(C.gtk_button_new_from_stock((*C.gchar)(C.CString(stock)))), ) return b }
func NewGhostPad(name string, target *Pad) *GhostPad { s := (*C.gchar)(C.CString(name)) defer C.free(unsafe.Pointer(s)) p := new(GhostPad) p.SetPtr(glib.Pointer(C.gst_ghost_pad_new(s, target.g()))) return p }
func NewFileChooserButton(title string, action FileChooserAction) *FileChooserButton { f := new(FileChooserButton) f.SetPtr(glib.Pointer(C.gtk_file_chooser_button_new( (*C.gchar)(C.CString(title)), action.g(), ))) return f }
func NewHBox(homogeneous bool, spacing int) *HBox { b := new(HBox) var h C.gboolean if homogeneous { h = 1 } b.SetPtr(glib.Pointer(C.gtk_hbox_new(h, C.gint(spacing)))) return b }
// TODO: Move ElementFactoryMake to element_factory.go func ElementFactoryMake(factory_name, name string) *Element { fn := (*C.gchar)(C.CString(factory_name)) defer C.free(unsafe.Pointer(fn)) n := (*C.gchar)(C.CString(name)) defer C.free(unsafe.Pointer(n)) e := new(Element) e.SetPtr(glib.Pointer(C.gst_element_factory_make(fn, n))) return e }
func (e *Element) GetBus() *Bus { bus := C.gst_element_get_bus(e.g()) if bus == nil { return nil } b := new(Bus) b.SetPtr(glib.Pointer(bus)) return b }
func (e *Element) GetStaticPad(name string) *Pad { s := (*C.gchar)(C.CString(name)) defer C.free(unsafe.Pointer(s)) cp := C.gst_element_get_static_pad(e.g(), s) if cp == nil { return nil } p := new(Pad) p.SetPtr(glib.Pointer(cp)) return p }
// 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 }
// Similar to gst_parse_launch, but makes a bin instead of a pipeline func ParseBinFromDescription(desc string) (*Bin, error) { en := (*C.gchar)(C.CString(desc)) defer C.free(unsafe.Pointer(en)) ghost_unlinked_pads := C.gboolean(1) // probably should be true? http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstParse.html#gst-parse-bin-from-description var Cerr *C.GError p := glib.Pointer(C.gst_parse_bin_from_description(en, ghost_unlinked_pads, &Cerr)) if Cerr != nil { errStr := (*glib.Error)(unsafe.Pointer(Cerr)).Error() C.g_error_free(Cerr) return nil, errors.New(errStr) } if p == nil { return nil, nil } b := new(Bin) b.SetPtr(p) return b, nil }
func (m *Message) GetSrc() *GstObj { src := new(GstObj) src.SetPtr(glib.Pointer(m.src)) return src }
func NewEntry() *Entry { e := new(Entry) e.SetPtr(glib.Pointer(C.gtk_entry_new())) return e }
func NewButton() *Button { b := new(Button) b.SetPtr(glib.Pointer(C.gtk_button_new())) return b }
func (w *Widget) GetSettings() *Settings { s := new(Settings) s.SetPtr(glib.Pointer(C.gtk_widget_get_settings(w.g()))) return s }
func (w *Widget) GetWindow() *gdk.Window { gw := new(gdk.Window) gw.SetPtr(glib.Pointer(C.gtk_widget_get_window(w.g()))) //gw.SetPtr(glib.Pointer(w.g().window)) return gw }
func (o *GstObj) ImplementsInterfaceCast(typ glib.Type) glib.Pointer { return glib.Pointer(C.gst_implements_interface_cast(C.gpointer(o.GetPtr()), C.GType(typ))) }
func (p *GhostPad) GetTarget() *Pad { r := new(Pad) r.SetPtr(glib.Pointer(C.gst_ghost_pad_get_target(p.g()))) return r }
// Returns C pointer func NewWindow(t WindowType) *Window { w := new(Window) w.SetPtr(glib.Pointer(C.gtk_window_new(C.GtkWindowType(t)))) return w }
func NewDrawingArea() *DrawingArea { d := new(DrawingArea) d.SetPtr(glib.Pointer(C.gtk_drawing_area_new())) return d }
// Returns the parent of o. Increases the refcount of the parent object so you // should Unref it after usage. func (o *GstObj) GetParent() *GstObj { p := new(GstObj) p.SetPtr(glib.Pointer(C.gst_object_get_parent(o.g()))) return p }
func (b *Bin) GetChild() *Widget { w := new(Widget) w.SetPtr(glib.Pointer(C.gtk_bin_get_child(b.g()))) return w }
func NewBus() *Bus { b := new(Bus) b.SetPtr(glib.Pointer(C.gst_bus_new())) return b }