Make the AppSrc example work on big endian architectures too
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Fri, 14 Aug 2009 06:40:47 +0000 (08:40 +0200)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Fri, 14 Aug 2009 06:40:47 +0000 (08:40 +0200)
Cairo's ARGB32 format is defined to be native endianness, i.e.
we have to use GST_VIDEO_FORMAT_ARGB or _BGRA depending on
endianness.

samples/AppSrc.cs

index 7cdead9..13d5ff2 100644 (file)
@@ -36,7 +36,8 @@ public class AppSrcDemo
                Element.Link(appsrc, color, sink);
 
                // Set the caps on the AppSrc to RGBA, 640x480, 4 fps, square pixels
-               appsrc.Caps = Gst.Video.VideoUtil.FormatNewCaps(Gst.Video.VideoFormat.BGRA, 640, 480, 4, 1, 1, 1);
+               Gst.Video.VideoFormat fmt = (BitConverter.IsLittleEndian) ? Gst.Video.VideoFormat.BGRA : Gst.Video.VideoFormat.ARGB;
+               appsrc.Caps = Gst.Video.VideoUtil.FormatNewCaps(fmt, 640, 480, 4, 1, 1, 1);
 
                // Connect the handlers
                appsrc.NeedData += PushAppData;