HELP: RGB buffer format query (I am trying to pass a buffer to appsrc)

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

HELP: RGB buffer format query (I am trying to pass a buffer to appsrc)

GStreamer-devel mailing list
Before figuring out how to make an appsrc take an OpenGL texture, I wanted to pass an RGB buffer.  I played with this example for a while and ended up with this code.

Like the example, I can happily get the screen to alternate between white and black. However, I don't understand the structure of the buffer GStreamer expects.

Why does GStreamer seem to expect the minimum buffer size to be WIDTH * HEIGHT * CHANNELS + HEIGHT? Why is it not just WIDTH * HEIGHT * CHANNELS for an RGB buffer (where the array passed as the buffer is an array of bytes)? Why would I want to pass a larger buffer?

Also, when I try to set the colour to green, red or blue and only write to the first WIDTH * CHANNELS bytes in the buffer I get one clean row of the expected colour. However, this row changes colour when I write to the next WIDTH * CHANNELS bytes. Why is this? How do I fix it?

I suspect the queries are related. Thanks in advance.

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

Re: HELP: RGB buffer format query (I am trying to pass a buffer to appsrc)

GStreamer-devel mailing list
My bad - the buffer sizing is incorrect. If the width is a multiple of 3 it works.

On Sun, Jun 20, 2021 at 4:03 PM Edward Anon <[hidden email]> wrote:
Before figuring out how to make an appsrc take an OpenGL texture, I wanted to pass an RGB buffer.  I played with this example for a while and ended up with this code.

Like the example, I can happily get the screen to alternate between white and black. However, I don't understand the structure of the buffer GStreamer expects.

Why does GStreamer seem to expect the minimum buffer size to be WIDTH * HEIGHT * CHANNELS + HEIGHT? Why is it not just WIDTH * HEIGHT * CHANNELS for an RGB buffer (where the array passed as the buffer is an array of bytes)? Why would I want to pass a larger buffer?

Also, when I try to set the colour to green, red or blue and only write to the first WIDTH * CHANNELS bytes in the buffer I get one clean row of the expected colour. However, this row changes colour when I write to the next WIDTH * CHANNELS bytes. Why is this? How do I fix it?

I suspect the queries are related. Thanks in advance.

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel