diff options
-rw-r--r-- | ext/gtk/gstgtksink.c | 4 | ||||
-rw-r--r-- | ext/gtk/gtkgstwidget.c | 16 |
2 files changed, 14 insertions, 6 deletions
diff --git a/ext/gtk/gstgtksink.c b/ext/gtk/gstgtksink.c index baf495088..2c5d3ed3e 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 2f4b0bf10..023d3766a 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); |