displaying format=(string)GRAY8 on ximagesink

Josh Doe josh at joshdoe.com
Thu Apr 23 10:55:07 UTC 2020


On Thu, Apr 23, 2020 at 5:49 AM Erik Rull <erik.rull at rdsoftware.de> wrote:

> > I ran your pipelines but with videotestsrc instead of appsink, and it
> works
> > fine. Only thing I can see going on is that your appsrc isn't actually
> producing
> > data as GRAY8, 401x404. Also, are you padding the rows to 404x404?
> GStreamer
> > assumes widths are multiples of 4-bytes, so you'll need to pad rows with
> three
> > pixels.
>
> Oh - I was not aware of that. This would explain a lot - the BGRx is
> automatically 4 byte-aligned, the 8 bit data not.
> Do you have more information on these constraints? How do I have to handle
> the
> padding? Must I pad to 4 byte and also round up the width to be a multiple
> of 4?
> Or is the pad to 4 sufficient and gstreamer leaves out what is not
> necessary?
>

Allocate enough memory for the 404x404 padded image, then memcpy each 401
pixel row to the start of each 404 pixel row, leaving the caps as saying
401. In other words you pad each row with 3 bytes, uninitialized data is
fine. GStreamer elements and the video library assume there is padding and
will account for it. I have to do this all the time in my plugins, see [0]
for an example.

[0]:
https://github.com/joshdoe/gst-plugins-vision/blob/master/sys/imperxflex/gstframelinksrc.c#L603

-Josh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20200423/f360213e/attachment.htm>


More information about the gstreamer-devel mailing list