Modify buffer data in probe callback in python

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Modify buffer data in probe callback in python

Sebastian de Castelberg
Hi list,

I was wondering if it is possible to modify audio data in a buffer
probe callback in python. Basically, I'd like to do something like
'cb_have_data' in [1] but in python. There's a data attribute on the
buffer object that looks like a string representation of the binary
audio data, but I wasn't able to modify it's content. Did anyone
already try something similar?

  def data_probe(pad, buffer):
    # modify buffer.data
  element.get_pad('sink').add_buffer_probe(data_probe)

I appreciate your hints.

[1] http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/chapter-dataaccess.html

--
sebastian de castelberg
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Modify buffer data in probe callback in python

michael smith-6-3
Buffer probes may not modify the buffer they receive. They're read-only.

Mike


On Tue, Nov 22, 2011 at 2:00 AM, Sebastian de Castelberg
<[hidden email]> wrote:

> Hi list,
>
> I was wondering if it is possible to modify audio data in a buffer
> probe callback in python. Basically, I'd like to do something like
> 'cb_have_data' in [1] but in python. There's a data attribute on the
> buffer object that looks like a string representation of the binary
> audio data, but I wasn't able to modify it's content. Did anyone
> already try something similar?
>
>  def data_probe(pad, buffer):
>    # modify buffer.data
>  element.get_pad('sink').add_buffer_probe(data_probe)
>
> I appreciate your hints.
>
> [1] http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/chapter-dataaccess.html
>
> --
> sebastian de castelberg
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel