video-overlay-composition: fix ayuv/argb conversion
authorArnaud Vrac <avrac@freebox.fr>
Tue, 19 Feb 2013 16:49:08 +0000 (17:49 +0100)
committerTim-Philipp Müller <tim@centricular.net>
Tue, 19 Feb 2013 20:39:29 +0000 (20:39 +0000)
Helps when using dvbsuboverlay in connection with vaapisink
or some other video sink that wants ARGB pixels (dvbsuboverlay
attaches pixels in AYUV format, and we then convert as needed).

Alignment should not be a problem here.

gst-libs/gst/video/video-overlay-composition.c

index b18ec3f..6f22877 100644 (file)
@@ -1060,7 +1060,7 @@ gst_video_overlay_rectangle_convert (GstVideoInfo * src, GstBuffer * src_buffer,
         b = CLAMP (b, 0, 255);
 
         /* native endian ARGB */
-        *ddata = ((a << 24) | (r << 16) | (g << 8) | b);
+        *(guint32 *) ddata = ((a << 24) | (r << 16) | (g << 8) | b);
 
         sdata += 4;
         ddata += 4;
@@ -1075,7 +1075,7 @@ gst_video_overlay_rectangle_convert (GstVideoInfo * src, GstBuffer * src_buffer,
     for (k = 0; k < height; k++) {
       for (l = 0; l < width; l++) {
         /* native endian ARGB */
-        argb = *sdata;
+        argb = *(guint32 *) sdata;
         a = argb >> 24;
         r = (argb >> 16) & 0xff;
         g = (argb >> 8) & 0xff;