-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Class struct methods are not exposed #283
Comments
From what I can see in the GIR file, GstElementClass is a gtype struct that isn't normally meant to be exposed in bindings (IIUC). We're currently filtering those out here: Line 402 in d68a407
Can you give an example use-case that you have for them? I'd prefer not to expose them, but if it's absolutely necessary so be it. |
For example from gi.repository import Gst
class MyBin(Gst.Bin):
def __init__(self):
super().__init__(self)
self._element = Gst.ElementFactory.make('someelement')
self.add(self._element)
tpl = Gst.PadTemplate.new(
'audio_%u',
Gst.PadDirection.SRC,
Gst.PadPresence.REQUEST,
Gst.Caps.from_string('audio/x-raw'),
)
self.add_pad_template(tpl)
def do_request_new_pad(self, tpl: Gst.PadTemplate, name: str, caps: Gst.Caps):
target = self._element.get_request_pad('src_%u')
ghost_pad: Gst.GhostPad = Gst.GhostPad.new_from_template(name, target, tpl)
self.add_pad(ghost_pad)
return ghost_pad and through the from gi.repository import Gst
class MyBin(Gst.Bin):
__gsttemplates__ = (
Gst.PadTemplate.new(
'audio_%u',
Gst.PadDirection.SRC,
Gst.PadPresence.REQUEST,
Gst.Caps.from_string('audio/x-raw'),
),
)
def __init__(self):
super().__init__(self)
self._element = Gst.ElementFactory.make('someelement')
self.add(self._element)
def do_request_new_pad(self, tpl: Gst.PadTemplate, name: str, caps: Gst.Caps):
target = self._element.get_request_pad('src_%u')
ghost_pad: Gst.GhostPad = Gst.GhostPad.new_from_template(name, target, tpl)
self.add_pad(ghost_pad)
return ghost_pad |
Oh ok, pygobject approach seems to be more involved than I would like it to be, they probably have some custom code just for GST :/ Do you happen to have a minimal example in C showing what you're trying to do? I can work from that and add the missing parts. Maybe just removing the if-guard will work but I'm not sure. |
No, the The |
So, I just wrote script to inspect the class struct methods, and it appears they are all exposed in vala. CellAreaClassmethod: method: method: CellRendererClassmethod: ContainerClassmethod:
method: method: method: method:
WidgetClassmethod: method: method: method: method:
method: method: method: method: method: method: method: |
And here's the output for the Gst-1.0 module: DeviceProviderClassmethod: method: method:
method: method: ElementClassmethod: method: method: method: method: method:
method:
method:
method: method: |
Output for the GObject 2.0 module: ObjectClassmethod: method: method: method: method: |
Using PyGObject: import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
btn = Gtk.Button()
print(btn.list_properties())
Using GJS: imports.gi.versions.GObject = '2.0'
imports.gi.versions.Gtk = '3.0'
const GObject = imports.gi.GObject
const Gtk = imports.gi.Gtk
const btn = new Gtk.Button()
const propNames = GObject.Object.list_properties.call(btn).map(prop => prop.name)
print(propNames)
Using node-gtk: const gi = require('node-gtk')
const Gtk = gi.require('Gtk', '3.0')
Gtk.init()
const btn = new Gtk.Button()
console.log(GObject.Object.listProperties.call(btn)) // Uncaught TypeError: GObject.Object.listProperties is not a function
console.log(btn.listProperties()) // Uncaught TypeError: btn.listProperties is not a function |
In the light of the previous comments, I think you might want to reassess this statement (and thus maybe reopen #100 ?). |
I'd be very interested in access to |
I found I don't think it would be very hard to fix, the entry point to setup GIR entries is here if someone wants to have a go at it. |
Hi,
It seems the gst_element_class_* methods are missing (i.e. gst_element_class_add_pad_template):
Btw, congrats for this ambitious project ! 👍🏻
The text was updated successfully, but these errors were encountered: