--- orig/gst/ffmpegcolorspace/gstffmpegcodecmap.c
+++ mod/gst/ffmpegcolorspace/gstffmpegcodecmap.c
@@ -148,7 +148,7 @@
       fmt = GST_MAKE_FOURCC ('Y', '4', '2', 'B');
       break;
     case PIX_FMT_YUV444P:
-      /* .. */
+      fmt = GST_MAKE_FOURCC ('Y', '4', '4', '4');
       break;
     case PIX_FMT_RGB32:
       bpp = 32;
@@ -199,15 +199,16 @@
       depth = 32;
       endianness = G_BIG_ENDIAN;
 #if (G_BYTE_ORDER == G_BIG_ENDIAN)
-      r_mask = 0x00ff0000;
-      g_mask = 0x0000ff00;
-      b_mask = 0x000000ff;
-      a_mask = 0xff000000;
-#else
       r_mask = 0x0000ff00;
       g_mask = 0x00ff0000;
       b_mask = 0xff000000;
       a_mask = 0x000000ff;
+#else
+      r_mask = 0x00ff0000;
+      g_mask = 0x0000ff00;
+      b_mask = 0x000000ff;
+      a_mask = 0xff000000;
+
 #endif
       break;
     case PIX_FMT_YUV410P:
@@ -238,11 +239,17 @@
     case PIX_FMT_AYUV4444:
       fmt = GST_MAKE_FOURCC ('A', 'Y', 'U', 'V');
       break;
-    default:
+  case PIX_FMT_GRAY8:
+    bpp = depth = 8;
+    caps = GST_FF_VID_CAPS_NEW ("video/x-raw-gray",
+				"bpp", G_TYPE_INT, bpp, "depth", G_TYPE_INT, depth, NULL);
+    break;    
+  default:
       /* give up ... */
       break;
   }
 
+  if (caps == NULL) {
   if (bpp != 0) {
     if (a_mask != 0) {
       caps = GST_FF_VID_CAPS_NEW ("video/x-raw-rgb",
@@ -274,6 +281,7 @@
     caps = GST_FF_VID_CAPS_NEW ("video/x-raw-yuv",
         "format", GST_TYPE_FOURCC, fmt, NULL);
   }
+  }
 
   if (caps != NULL) {
     char *str = gst_caps_to_string (caps);
@@ -479,11 +487,9 @@
         case GST_MAKE_FOURCC ('A', 'Y', 'U', 'V'):
           context->pix_fmt = PIX_FMT_AYUV4444;
           break;
-#if 0
-        case FIXME:
+        case GST_MAKE_FOURCC ('Y', '4', '4', '4'):
           context->pix_fmt = PIX_FMT_YUV444P;
           break;
-#endif
       }
     }
   } else if (strcmp (gst_structure_get_name (structure),
@@ -497,9 +503,10 @@
           case 32:
             if (gst_structure_get_int (structure, "alpha_mask", &amask)) {
 #if (G_BYTE_ORDER == G_BIG_ENDIAN)
-              if (rmask == 0x00ff0000)
-#else
               if (rmask == 0x0000ff00)
+#else
+              if (rmask == 0x00ff0000)
+
 #endif
                 context->pix_fmt = PIX_FMT_BGRA32;
               else
@@ -550,6 +557,17 @@
         }
       }
     }
+  } else if (strcmp (gst_structure_get_name (structure),
+		     "video/x-raw-gray") == 0) {
+    gint bpp = 0;
+    
+    if (gst_structure_get_int (structure, "bpp", &bpp)) {
+      switch (bpp) {
+      case 8:
+	context->pix_fmt = PIX_FMT_GRAY8;
+	break;
+      }
+    }
   }
 }
 


--- orig/gst/ffmpegcolorspace/gstffmpegcolorspace.c
+++ mod/gst/ffmpegcolorspace/gstffmpegcolorspace.c
@@ -91,6 +91,7 @@
   int i;
   GstStructure *structure;
   GstCaps *rgbcaps;
+  GstCaps *graycaps;
 
   caps = gst_caps_copy (caps);
 
@@ -116,7 +117,15 @@
 
     gst_structure_set_name (structure, "video/x-raw-rgb");
   }
-
+  graycaps = gst_caps_copy (caps);
+  
+  for (i = 0; i < gst_caps_get_size (graycaps); i++) {
+    structure = gst_caps_get_structure (graycaps, i);
+    
+    gst_structure_set_name (structure, "video/x-raw-gray");
+  }
+  
+  gst_caps_append (caps, graycaps);
   gst_caps_append (caps, rgbcaps);
 
   return caps;


--- orig/gst/ffmpegcolorspace/imgconvert.c
+++ mod/gst/ffmpegcolorspace/imgconvert.c
@@ -1674,6 +1674,7 @@
 /* bgra32 handling */
 
 #define RGB_NAME bgra32
+#define FMT_BGRA32
 
 #define RGB_IN(r, g, b, s)\
 {\
@@ -1903,6 +1904,7 @@
   {PIX_FMT_RGBA32, PIX_FMT_YUV420P, rgba32_to_yuv420p},
   {PIX_FMT_RGBA32, PIX_FMT_GRAY8, rgba32_to_gray},
   {PIX_FMT_RGBA32, PIX_FMT_AYUV4444, rgba32_to_ayuv4444},
+  {PIX_FMT_BGRA32, PIX_FMT_AYUV4444, bgra32_to_ayuv4444},
 
   {PIX_FMT_BGR24, PIX_FMT_RGB24, bgr24_to_rgb24},
   {PIX_FMT_BGR24, PIX_FMT_YUV420P, bgr24_to_yuv420p},


--- orig/gst/ffmpegcolorspace/imgconvert_template.h
+++ mod/gst/ffmpegcolorspace/imgconvert_template.h
@@ -467,6 +467,9 @@
         d += dst_wrap;
     }
 }
+#endif /* !defined(FMT_RGBA32) && defined(RGBA_OUT) */
+
+#if defined(FMT_RGBA32)
 
 #if !defined(rgba32_fcts_done)
 #define rgba32_fcts_done
@@ -527,7 +530,42 @@
 
 #endif /* !defined(rgba32_fcts_done) */
 
-#endif /* !defined(FMT_RGBA32) && defined(RGBA_OUT) */
+#endif /* defined(FMT_RGBA32) */
+
+#if defined(FMT_BGRA32)
+#if !defined(bgra32_fcts_done)
+#define bgra32_fcts_done
+
+static void bgra32_to_ayuv4444(AVPicture *dst, const AVPicture *src,
+			       int width, int height)
+{
+  int src_wrap, dst_wrap, x, y;
+  int r, g, b, a;
+  uint8_t *d;
+  const uint8_t *p;
+  
+  src_wrap = src->linesize[0] - width * BPP;
+  dst_wrap = dst->linesize[0] - width * 4;
+  d = dst->data[0];
+  p = src->data[0];
+  for(y=0;y<height;y++) {
+    for(x=0;x<width;x++) {
+      RGBA_IN(r, g, b, a, p);
+      d[0] = a;
+      d[1] = RGB_TO_Y_CCIR(r, g, b);
+      d[2] = RGB_TO_U_CCIR(r, g, b, 0);
+      d[3] = RGB_TO_V_CCIR(r, g, b, 0);
+      p += BPP;
+      d += 4;
+    }
+    p += src_wrap;
+    d += dst_wrap;
+  }
+}
+
+#endif /* !defined(bgra32_fcts_done) */
+
+#endif /* defined(FMT_BGRA32) */
 
 #ifndef FMT_RGB24
 
