From: Sebastian Dröge Date: Mon, 15 Jun 2015 18:45:11 +0000 (+0200) Subject: gtksink: Add support for xRGB/BGRx X-Git-Tag: 1.19.3~509^2~1701^2~79 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=166e33d64c53fc12ec26cf6a54d150dde9362280;p=platform%2Fupstream%2Fgstreamer.git gtksink: Add support for xRGB/BGRx --- diff --git a/ext/gtk/gstgtksink.c b/ext/gtk/gstgtksink.c index baf4950..2c5d3ed 100644 --- a/ext/gtk/gstgtksink.c +++ b/ext/gtk/gstgtksink.c @@ -52,9 +52,9 @@ static GstFlowReturn gst_gtk_sink_show_frame (GstVideoSink * bsink, GstBuffer * buf); #if G_BYTE_ORDER == G_LITTLE_ENDIAN -#define FORMATS "BGRA" +#define FORMATS "{ BGRx, BGRA }" #else -#define FORMATS "ARGB" +#define FORMATS "{ xRGB, ARGB }" #endif static GstStaticPadTemplate gst_gtk_sink_template = diff --git a/ext/gtk/gtkgstwidget.c b/ext/gtk/gtkgstwidget.c index 2f4b0bf..023d376 100644 --- a/ext/gtk/gtkgstwidget.c +++ b/ext/gtk/gtkgstwidget.c @@ -124,12 +124,18 @@ gtk_gst_widget_draw (GtkWidget * widget, cairo_t * cr) gdouble scale_y = (gdouble) widget_height / gst_widget->priv->display_height; GstVideoRectangle result; + cairo_format_t format; gst_widget->priv->v_info = frame.info; + if (frame.info.finfo->format == GST_VIDEO_FORMAT_ARGB || + frame.info.finfo->format == GST_VIDEO_FORMAT_BGRA) { + format = CAIRO_FORMAT_ARGB32; + } else { + format = CAIRO_FORMAT_RGB24; + } surface = cairo_image_surface_create_for_data (frame.data[0], - CAIRO_FORMAT_ARGB32, frame.info.width, frame.info.height, - frame.info.stride[0]); + format, frame.info.width, frame.info.height, frame.info.stride[0]); if (gst_widget->priv->force_aspect_ratio) { GstVideoRectangle src, dst; @@ -433,10 +439,12 @@ gtk_gst_widget_set_caps (GtkGstWidget * widget, GstCaps * caps) /* 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); + GST_VIDEO_FORMAT_BGRA || GST_VIDEO_INFO_FORMAT (&v_info) == + GST_VIDEO_FORMAT_BGRx, FALSE); #else g_return_val_if_fail (GST_VIDEO_INFO_FORMAT (&v_info) == - GST_VIDEO_FORMAT_ARGB, FALSE); + GST_VIDEO_FORMAT_ARGB || GST_VIDEO_INFO_FORMAT (&v_info) == + GST_VIDEO_FORMAT_xRGB, FALSE); #endif g_mutex_lock (&widget->priv->lock);