appsink to appscr mixes up color channels

Tim-Philipp Müller t.i.m at zen.co.uk
Sun May 26 07:37:14 PDT 2013


On Sat, 2013-05-25 at 21:04 -0700, Richard Cagley wrote:

Hi Richard,

> Thanks for the hint about endianness. The below gets me BGRA with B
> being the LSB. This mask stuff is confusing. How do I get RGBA? What's
> with the negative sign?
> 

Yes, it's all very confusing, that's why we changed it in 1.0 :)

> caps = gst_caps_new_simple ("video/x-raw-rgb",
>           "endianness", G_TYPE_INT, 4321,
>           "red_mask", G_TYPE_INT, 65280,
>           "green_mask", G_TYPE_INT, 16711680,
>           "blue_mask", G_TYPE_INT, -16777216,
>           "width", G_TYPE_INT, 640,
>           "height", G_TYPE_INT, 480,
>           "framerate", GST_TYPE_FRACTION, 30000, 1001,
>           NULL);

You may find
http://gstreamer.freedesktop.org/data/doc/gstreamer/0.10.36/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#gst-video-format-new-caps and other utility functions useful. Ignore the negative signs for the mask, it's basically the unsigned integer cast to a signed integer.

But again, why do you create the caps yourself?

As I see it, if you're just passing the data through you should be doing
something like this:

buffer = gst_app_sink_pull_buffer (appsink)
if (first_buffer) {
  gst_app_src_set_caps  (appsrc, GST_BUFFER_CAPS (buffer));
}
gst_app_src_push_buffer (appsrc, buffer);

Cheers
 -Tim

> On Sat, May 25, 2013 at 4:00 PM, Tim-Philipp Müller <t.i.m at zen.co.uk>
> wrote:
>         On Sat, 2013-05-25 at 15:49 -0700, Richard Cagley wrote:
>         
>         Hi,
>         
>         > I'm using videotestsrc and ximagesink and changing the
>         patterns on
>         > videotestsrc and looking at the output. I also have some
>         print
>         > statements to read the raw data pointers.
>         >
>         >
>         > What would cause this? I'm setting the caps like this...
>         >
>         >
>         > caps = gst_caps_new_simple ("video/x-raw-rgb",
>         >           "format", G_TYPE_STRING, "RGB",
>         
>         
>         Are you using 1.0 or 0.10 ? Those caps look like a mix of
>         both.
>         
>         
>         In 0.10 it's
>         video/x-raw-rgb,endianness=...,{red,blue,green,alpha}_mask=..
>         
>         In 1.0 it's video/x-raw,format=(string)xyz
>         
>         Why are you creating the caps yourself anyway? Why not just
>         forward/set
>         the caps you get on the appsink?
>         
>         Cheers
>          -Tim
>         
>         
>         _______________________________________________
>         gstreamer-devel mailing list
>         gstreamer-devel at lists.freedesktop.org
>         http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
> 
> 
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel




More information about the gstreamer-devel mailing list