示例#1
0
文件: bin.go 项目: 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
}
示例#2
0
文件: pad.go 项目: 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
}
示例#3
0
文件: button.go 项目: 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
}
示例#4
0
文件: button.go 项目: 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
}
示例#5
0
文件: pad.go 项目: 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
}
示例#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
}
示例#7
0
文件: box.go 项目: 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
}
示例#8
0
文件: element.go 项目: jmrobles/gst
// 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
}
示例#9
0
文件: element.go 项目: jmrobles/gst
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
}
示例#10
0
文件: element.go 项目: jmrobles/gst
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
}
示例#11
0
文件: bin.go 项目: 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
}
示例#12
0
文件: bin.go 项目: 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
}
示例#13
0
文件: message.go 项目: TribeMedia/gst
func (m *Message) GetSrc() *GstObj {
	src := new(GstObj)
	src.SetPtr(glib.Pointer(m.src))
	return src
}
示例#14
0
文件: entry.go 项目: ziutek/gtk
func NewEntry() *Entry {
	e := new(Entry)
	e.SetPtr(glib.Pointer(C.gtk_entry_new()))
	return e
}
示例#15
0
文件: button.go 项目: ziutek/gtk
func NewButton() *Button {
	b := new(Button)
	b.SetPtr(glib.Pointer(C.gtk_button_new()))
	return b
}
示例#16
0
文件: widget.go 项目: ziutek/gtk
func (w *Widget) GetSettings() *Settings {
	s := new(Settings)
	s.SetPtr(glib.Pointer(C.gtk_widget_get_settings(w.g())))
	return s
}
示例#17
0
文件: widget.go 项目: 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
}
示例#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)))
}
示例#19
0
文件: pad.go 项目: revmischa/gst
func (p *GhostPad) GetTarget() *Pad {
	r := new(Pad)
	r.SetPtr(glib.Pointer(C.gst_ghost_pad_get_target(p.g())))
	return r
}
示例#20
0
文件: window.go 项目: 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
}
示例#21
0
func NewDrawingArea() *DrawingArea {
	d := new(DrawingArea)
	d.SetPtr(glib.Pointer(C.gtk_drawing_area_new()))
	return d
}
示例#22
0
文件: object.go 项目: revmischa/gst
// 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
}
示例#23
0
文件: bin.go 项目: ziutek/gtk
func (b *Bin) GetChild() *Widget {
	w := new(Widget)
	w.SetPtr(glib.Pointer(C.gtk_bin_get_child(b.g())))
	return w
}
示例#24
0
文件: bus.go 项目: sergey789/gst
func NewBus() *Bus {
	b := new(Bus)
	b.SetPtr(glib.Pointer(C.gst_bus_new()))
	return b
}