Exemplo n.º 1
0
Arquivo: bin.go Projeto: revmischa/gst
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
}
Exemplo n.º 2
0
Arquivo: pad.go Projeto: revmischa/gst
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
}
Exemplo n.º 3
0
Arquivo: button.go Projeto: ziutek/gtk
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
}
Exemplo n.º 4
0
Arquivo: button.go Projeto: ziutek/gtk
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
}
Exemplo n.º 5
0
Arquivo: pad.go Projeto: revmischa/gst
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
}
Exemplo n.º 6
0
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
}
Exemplo n.º 7
0
Arquivo: box.go Projeto: ziutek/gtk
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
}
Exemplo n.º 8
0
// 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
}
Exemplo n.º 9
0
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
}
Exemplo n.º 10
0
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
}
Exemplo n.º 11
0
Arquivo: bin.go Projeto: revmischa/gst
// 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
}
Exemplo n.º 12
0
Arquivo: bin.go Projeto: revmischa/gst
// 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
}
Exemplo n.º 13
0
func (m *Message) GetSrc() *GstObj {
	src := new(GstObj)
	src.SetPtr(glib.Pointer(m.src))
	return src
}
Exemplo n.º 14
0
Arquivo: entry.go Projeto: ziutek/gtk
func NewEntry() *Entry {
	e := new(Entry)
	e.SetPtr(glib.Pointer(C.gtk_entry_new()))
	return e
}
Exemplo n.º 15
0
Arquivo: button.go Projeto: ziutek/gtk
func NewButton() *Button {
	b := new(Button)
	b.SetPtr(glib.Pointer(C.gtk_button_new()))
	return b
}
Exemplo n.º 16
0
Arquivo: widget.go Projeto: ziutek/gtk
func (w *Widget) GetSettings() *Settings {
	s := new(Settings)
	s.SetPtr(glib.Pointer(C.gtk_widget_get_settings(w.g())))
	return s
}
Exemplo n.º 17
0
Arquivo: widget.go Projeto: ziutek/gtk
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
}
Exemplo n.º 18
0
func (o *GstObj) ImplementsInterfaceCast(typ glib.Type) glib.Pointer {
	return glib.Pointer(C.gst_implements_interface_cast(C.gpointer(o.GetPtr()),
		C.GType(typ)))
}
Exemplo n.º 19
0
Arquivo: pad.go Projeto: revmischa/gst
func (p *GhostPad) GetTarget() *Pad {
	r := new(Pad)
	r.SetPtr(glib.Pointer(C.gst_ghost_pad_get_target(p.g())))
	return r
}
Exemplo n.º 20
0
Arquivo: window.go Projeto: ziutek/gtk
// Returns C pointer
func NewWindow(t WindowType) *Window {
	w := new(Window)
	w.SetPtr(glib.Pointer(C.gtk_window_new(C.GtkWindowType(t))))
	return w
}
Exemplo n.º 21
0
func NewDrawingArea() *DrawingArea {
	d := new(DrawingArea)
	d.SetPtr(glib.Pointer(C.gtk_drawing_area_new()))
	return d
}
Exemplo n.º 22
0
// 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
}
Exemplo n.º 23
0
Arquivo: bin.go Projeto: ziutek/gtk
func (b *Bin) GetChild() *Widget {
	w := new(Widget)
	w.SetPtr(glib.Pointer(C.gtk_bin_get_child(b.g())))
	return w
}
Exemplo n.º 24
0
Arquivo: bus.go Projeto: sergey789/gst
func NewBus() *Bus {
	b := new(Bus)
	b.SetPtr(glib.Pointer(C.gst_bus_new()))
	return b
}