appsink to appscr mixes up color channels

Richard Cagley rcagley at gmail.com
Sun May 26 10:50:10 PDT 2013


Tim,
Love to use 1.0 but this is eventually for an embedded target so I'm stuck
with 0.10.

At any rate, if I don't set the appsrc/appsink caps with
gst_app_sink/src_set_caps then I get a GST_MESSAGE_ERROR
"Error in pipeline: Internal data flow error."
That is why I initially started heading down the road of explicitly setting
the caps. I like your idea of setting src caps off the first frame but that
gives me a pipeline error "Could not negotiate format"

But, then I found that even when setting the caps the color channels were
mixed up, but your great tip of setting the masks greatly helped.
If I set the caps for the appsink (videotestsrc) to this
          "blue_mask", G_TYPE_INT, 65280,
          "green_mask", G_TYPE_INT, 16711680,
          "red_mask", G_TYPE_INT, -16777216,
And the caps for the appsrc (ximagesink) to this
          "red_mask", G_TYPE_INT, 65280,
          "green_mask", G_TYPE_INT, 16711680,
          "blue_mask", G_TYPE_INT, -16777216,
I get RGBA on the sink and BGRA on the src.
What's sorta fascinating/annoying is that ximagesink really wants BGR
ordering. If I try to use the RGB ordering from the videotestsrc caps the
pipeline bails and says it "Could not negotiate format"

So, to summarize, my pipeline works but has BGRA ordering, which is fine
but weird. Whoever wrote the ximagesink filter must have been an OpenCV
developer ;)
-rich








On Sun, May 26, 2013 at 7:37 AM, Tim-Philipp Müller <t.i.m at zen.co.uk> wrote:

> 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-capsand 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
>
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20130526/8c9891a8/attachment-0001.html>


More information about the gstreamer-devel mailing list