After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 159366 - Some additions to gst-python
Some additions to gst-python
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-python
git master
Other Linux
: Normal enhancement
: 0.8.0
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2004-11-24 20:32 UTC by Martin Soto
Modified: 2005-06-30 15:31 UTC
See Also:
GNOME target: ---
GNOME version: 2.7/2.8


Attachments
Various enhancements to gst-python (7.68 KB, patch)
2004-11-24 20:34 UTC, Martin Soto
none Details | Review

Description Martin Soto 2004-11-24 20:32:16 UTC
In order to make a DVD virtual machine written almost entirely in Python work, I
had to make some enhancements to GstPython. The attached patch contains them:

	* gst/gst.override (_wrap_gst_event_new_any)
	(_wrap_gst_event_new_discontinuous) 
	(_wrap_gst_event_any_get_structure)
	(_wrap_gst_registry_pool_plugin_list):
	* gst/gst.defs (get_data, event_new_any, any_get_structure):
	Added basic support for "ANY" (navigation) events.
	Added basic support for discont events (only one value for now,
	we are limited by the GStreamer API).
	Now it is possible to access data in a GstBuffer as a string
	Added a definition for method get_data of GstBuffer.

	* gst/gst.override (_wrap_gst_structure_set_value): Add an
	optional parameter to allow selection of the right G_TYPE. If no type
	is specified, make an educated guess.

Since I never commited code to gst-python, I'm posting the patch here. Johan:
please let me know if it'd be OK to directly commit similar patches in the future.
Comment 1 Martin Soto 2004-11-24 20:34:49 UTC
Created attachment 34103 [details] [review]
Various enhancements to gst-python

Patch referenced in the main bug description.
Comment 2 Johan (not receiving bugmail) Dahlin 2004-11-26 16:19:41 UTC
Martin, thanks for submitting the patch, it looks good apart from 
_wrap_gst_structure_set_value.

I'm not really convinced that the type of the structure needs to be sent as an
argument, a most important goal of the bindings is to integrate well into the
python language, and passing the type around is not very pythonish. However, I
am aware that the type of a GstStructure might be a little hard to map properly
to a PyObject.

So I would prefer that only pyg_type_from_object should be used, and when it
doesn't work correctly pygtk itself should be fixed.
Can you please tell me why you feel that it's not working as expected and we
should work out so pyg_type_from_object gets a little smarter.

However, since it's optional I'm not so much against it.

Comment 3 Martin Soto 2004-11-26 17:00:17 UTC
The issue with _wrap_gst_structure_set_value: Unfortunately, the set of Python
types is not as wide as the set of glib types. My issue, is that I generate DVD
events directly from Python. One particular event contains two GstClockTime
fields, which are represented in the structure as guint64 fields. There is no
way to achive the right values using pyg_type_from_object, and if the type
doesn't match exactly, elements down the pipeline (dvddemux) will complain.

I really tried to find a nicer solution, but it looks hard.

My proposal is to commit the patch now as is, and look for a better solution in
the near future.
Comment 4 Johan (not receiving bugmail) Dahlin 2004-11-27 18:29:27 UTC
Martin committed this to cvs.