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 577847 - gst.Buffer undocumented slices usage
gst.Buffer undocumented slices usage
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-python
0.10.14
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2009-04-03 13:44 UTC by Luca Bruno
Modified: 2012-12-17 11:35 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Luca Bruno 2009-04-03 13:44:57 UTC
Hello,
first thanks for this Python wrapper and for GStreamer.
I had to deal with appsrc which wants a GstBuffer as input and I had to read the wrapper code to realize that setting data happens using slices. Please consider documenting it.
Comment 1 Edward Hervey 2009-04-04 09:56:13 UTC
do you mean strings ? If so, that's the normal way of using 'data' in python AFAIK (i.e. if you read from a file you'll get a string).
Comment 2 Luca Bruno 2009-04-04 10:34:00 UTC
Strings in Python don't support mutable slices. Reading from the buffer is easy and intuitive, but writing data on a buffer is not documented.
buf = gst.Buffer (size); buf[:size] = data
Comment 3 Edward Hervey 2009-04-04 13:18:00 UTC
proper usage :
  buf.data = "this is the content of my buffer"
or even simpler:
  buf = gst.Buffer ("this is the content of my buffer")

The example you gave is completely bogus, you can't create a gst.Buffer() with an integer argument. That should have errored out.

There's no gst-python specific documentation. Closing bug.
Comment 4 Luca Bruno 2009-04-04 20:41:37 UTC
I'm sorry for the wrong constructor.

>>> buf = gst.Buffer ()
>>> buf.data = "test"
Traceback (most recent call last):
  • File "<stdin>", line 1 in <module>
AttributeError: attribute 'data' of 'gst.Buffer' objects is not writable

This is what I'm using now:
>>> buf = gst.buffer_new_and_alloc (4)
>>> buf[:4] = "test"
>>> print buf
test
>>> 

So please document:
1. gst.Buffer (str) constructor, which is not in the C core reference so I couldn't realize that and the only constructor in the pygst reference has clearly no arguments
2. assignable/deletable slices
Comment 5 Sebastian Dröge (slomo) 2012-12-17 11:35:06 UTC
Closing this bug now, gst-python is only an extension module to pygi now and this bug doesn't make much sense anymore in this context.