diff options
author | Dave Robillard <dave@drobilla.net> | 2009-07-10 20:40:11 -0400 |
---|---|---|
committer | Dave Robillard <dave@drobilla.net> | 2009-07-10 20:40:11 -0400 |
commit | ba89c9e518ded3d919461903a444799a5115c34f (patch) | |
tree | 4b5429dcf1cdb5fe63b214d771d4ad76109ef099 /gst/shapewipe | |
parent | caba48f261421d397900471b19350da2e5a4a4e5 (diff) | |
parent | d607daaf183eb3e068ec53bbf373ea3a63991aa9 (diff) | |
download | gst-plugins-bad-ba89c9e518ded3d919461903a444799a5115c34f.tar.gz gst-plugins-bad-ba89c9e518ded3d919461903a444799a5115c34f.tar.bz2 gst-plugins-bad-ba89c9e518ded3d919461903a444799a5115c34f.zip |
Merge branch 'master' of git://anongit.freedesktop.org/gstreamer/gst-plugins-bad into fdo
Diffstat (limited to 'gst/shapewipe')
-rw-r--r-- | gst/shapewipe/gstshapewipe.c | 45 |
1 files changed, 27 insertions, 18 deletions
diff --git a/gst/shapewipe/gstshapewipe.c b/gst/shapewipe/gstshapewipe.c index 655cfc50..6b209d0d 100644 --- a/gst/shapewipe/gstshapewipe.c +++ b/gst/shapewipe/gstshapewipe.c @@ -96,7 +96,8 @@ static GstStaticPadTemplate video_sink_pad_template = GST_STATIC_PAD_TEMPLATE ("video_sink", GST_PAD_SINK, GST_PAD_ALWAYS, - GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("AYUV") " ; " GST_VIDEO_CAPS_ARGB)); + GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("AYUV") " ; " GST_VIDEO_CAPS_ARGB " ; " + GST_VIDEO_CAPS_BGRA)); static GstStaticPadTemplate mask_sink_pad_template = GST_STATIC_PAD_TEMPLATE ("mask_sink", @@ -113,7 +114,8 @@ static GstStaticPadTemplate mask_sink_pad_template = static GstStaticPadTemplate src_pad_template = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, - GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("AYUV") " ; " GST_VIDEO_CAPS_ARGB)); + GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("AYUV") " ; " GST_VIDEO_CAPS_ARGB " ; " + GST_VIDEO_CAPS_BGRA)); GST_DEBUG_CATEGORY_STATIC (gst_shape_wipe_debug); #define GST_CAT_DEFAULT gst_shape_wipe_debug @@ -808,9 +810,9 @@ gst_shape_wipe_blend_ayuv_##depth (GstShapeWipe * self, GstBuffer * inbuf, \ CREATE_AYUV_FUNCTIONS (16, 65536.0f); CREATE_AYUV_FUNCTIONS (8, 256.0f); -#define CREATE_ARGB_FUNCTIONS(depth, scale) \ +#define CREATE_ARGB_FUNCTIONS(depth, name, scale, a, r, g, b) \ static GstFlowReturn \ -gst_shape_wipe_blend_argb_##depth (GstShapeWipe * self, GstBuffer * inbuf, \ +gst_shape_wipe_blend_##name##_##depth (GstShapeWipe * self, GstBuffer * inbuf, \ GstBuffer * maskbuf, GstBuffer * outbuf) \ { \ const guint##depth *mask = (const guint##depth *) GST_BUFFER_DATA (maskbuf); \ @@ -838,22 +840,22 @@ gst_shape_wipe_blend_argb_##depth (GstShapeWipe * self, GstBuffer * inbuf, \ gfloat in = *mask / scale; \ \ if (in < low) { \ - output[0] = 0x00; /* A */ \ - output[1] = 0x00; /* R */ \ - output[2] = 0x00; /* G */ \ - output[3] = 0x00; /* B */ \ + output[a] = 0x00; /* A */ \ + output[r] = 0x00; /* R */ \ + output[g] = 0x00; /* G */ \ + output[b] = 0x00; /* B */ \ } else if (in >= high) { \ - output[0] = 0xff; /* A */ \ - output[1] = input[1]; /* R */ \ - output[2] = input[2]; /* G */ \ - output[3] = input[3]; /* B */ \ + output[a] = 0xff; /* A */ \ + output[r] = input[r]; /* R */ \ + output[g] = input[g]; /* G */ \ + output[b] = input[b]; /* B */ \ } else { \ gfloat val = 255.0f * ((in - low) / (high - low)); \ \ - output[0] = CLAMP (val, 0, 255); /* A */ \ - output[1] = input[1]; /* R */ \ - output[2] = input[2]; /* G */ \ - output[3] = input[3]; /* B */ \ + output[a] = CLAMP (val, 0, 255); /* A */ \ + output[r] = input[r]; /* R */ \ + output[g] = input[g]; /* G */ \ + output[b] = input[b]; /* B */ \ } \ \ mask++; \ @@ -866,8 +868,11 @@ gst_shape_wipe_blend_argb_##depth (GstShapeWipe * self, GstBuffer * inbuf, \ return GST_FLOW_OK; \ } -CREATE_ARGB_FUNCTIONS (16, 65536.0f); -CREATE_ARGB_FUNCTIONS (8, 256.0f); +CREATE_ARGB_FUNCTIONS (16, argb, 65536.0f, 0, 1, 2, 3); +CREATE_ARGB_FUNCTIONS (8, argb, 256.0f, 0, 1, 2, 3); + +CREATE_ARGB_FUNCTIONS (16, bgra, 65536.0f, 3, 2, 1, 0); +CREATE_ARGB_FUNCTIONS (8, bgra, 256.0f, 3, 2, 1, 0); static GstFlowReturn gst_shape_wipe_video_sink_chain (GstPad * pad, GstBuffer * buffer) @@ -937,6 +942,10 @@ gst_shape_wipe_video_sink_chain (GstPad * pad, GstBuffer * buffer) ret = gst_shape_wipe_blend_argb_16 (self, buffer, mask, outbuf); else if (self->fmt == GST_VIDEO_FORMAT_ARGB) ret = gst_shape_wipe_blend_argb_8 (self, buffer, mask, outbuf); + else if (self->fmt == GST_VIDEO_FORMAT_BGRA && self->mask_bpp == 16) + ret = gst_shape_wipe_blend_bgra_16 (self, buffer, mask, outbuf); + else if (self->fmt == GST_VIDEO_FORMAT_BGRA) + ret = gst_shape_wipe_blend_bgra_8 (self, buffer, mask, outbuf); else g_assert_not_reached (); |