gtk: Cairo color formats are in native endianness, GStreamer's in memory order

CAIRO_FORMAT_ARGB32 is ARGB on big endian and BGRA on little endian.
This commit is contained in:
Sebastian Dröge 2015-06-15 20:39:59 +02:00
parent 05fa796c25
commit bd9ec0f333
2 changed files with 12 additions and 1 deletions

View file

@ -51,11 +51,17 @@ static gboolean gst_gtk_sink_set_caps (GstBaseSink * bsink, GstCaps * caps);
static GstFlowReturn gst_gtk_sink_show_frame (GstVideoSink * bsink,
GstBuffer * buf);
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
#define FORMATS "BGRA"
#else
#define FORMATS "ARGB"
#endif
static GstStaticPadTemplate gst_gtk_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("BGRA"))
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (FORMATS))
);
#define DEFAULT_FORCE_ASPECT_RATIO TRUE

View file

@ -431,8 +431,13 @@ gtk_gst_widget_set_caps (GtkGstWidget * widget, GstCaps * caps)
return FALSE;
/* FIXME: support other formats */
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
g_return_val_if_fail (GST_VIDEO_INFO_FORMAT (&v_info) ==
GST_VIDEO_FORMAT_BGRA, FALSE);
#else
g_return_val_if_fail (GST_VIDEO_INFO_FORMAT (&v_info) ==
GST_VIDEO_FORMAT_ARGB, FALSE);
#endif
g_mutex_lock (&widget->priv->lock);