mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 04:06:12 +00:00
cairooverlay: add support for RGB16
https://bugzilla.gnome.org/show_bug.cgi?id=723289
This commit is contained in:
parent
46bc1677a4
commit
90b01fce61
1 changed files with 22 additions and 7 deletions
|
@ -96,11 +96,11 @@
|
||||||
|
|
||||||
#include <cairo.h>
|
#include <cairo.h>
|
||||||
|
|
||||||
|
/* RGB16 is native-endianness in GStreamer */
|
||||||
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||||
#define TEMPLATE_CAPS GST_VIDEO_CAPS_MAKE("{ BGRx, BGRA }")
|
#define TEMPLATE_CAPS GST_VIDEO_CAPS_MAKE("{ BGRx, BGRA, RGB16 }")
|
||||||
#else
|
#else
|
||||||
#define TEMPLATE_CAPS GST_VIDEO_CAPS_MAKE("{ xRGB, ARGB }")
|
#define TEMPLATE_CAPS GST_VIDEO_CAPS_MAKE("{ xRGB, ARGB, RGB16 }")
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static GstStaticPadTemplate gst_cairo_overlay_src_template =
|
static GstStaticPadTemplate gst_cairo_overlay_src_template =
|
||||||
|
@ -149,10 +149,25 @@ gst_cairo_overlay_transform_frame_ip (GstVideoFilter * vfilter,
|
||||||
cairo_t *cr;
|
cairo_t *cr;
|
||||||
cairo_format_t format;
|
cairo_format_t format;
|
||||||
|
|
||||||
if (GST_VIDEO_FRAME_N_COMPONENTS (frame) == 4)
|
switch (GST_VIDEO_FRAME_FORMAT (frame)) {
|
||||||
format = CAIRO_FORMAT_ARGB32;
|
case GST_VIDEO_FORMAT_ARGB:
|
||||||
else
|
case GST_VIDEO_FORMAT_BGRA:
|
||||||
format = CAIRO_FORMAT_RGB24;
|
format = CAIRO_FORMAT_ARGB32;
|
||||||
|
break;
|
||||||
|
case GST_VIDEO_FORMAT_xRGB:
|
||||||
|
case GST_VIDEO_FORMAT_BGRx:
|
||||||
|
format = CAIRO_FORMAT_RGB24;
|
||||||
|
break;
|
||||||
|
case GST_VIDEO_FORMAT_RGB16:
|
||||||
|
format = CAIRO_FORMAT_RGB16_565;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
GST_WARNING ("No matching cairo format for %s",
|
||||||
|
gst_video_format_to_string (GST_VIDEO_FRAME_FORMAT (frame)));
|
||||||
|
return GST_FLOW_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
surface =
|
surface =
|
||||||
cairo_image_surface_create_for_data (GST_VIDEO_FRAME_PLANE_DATA (frame,
|
cairo_image_surface_create_for_data (GST_VIDEO_FRAME_PLANE_DATA (frame,
|
||||||
|
|
Loading…
Reference in a new issue