diff options
author | Dave Robillard <dave@drobilla.net> | 2009-06-03 16:37:53 -0400 |
---|---|---|
committer | Dave Robillard <dave@drobilla.net> | 2009-06-03 16:37:53 -0400 |
commit | 7f3bcd484b465d8216ac419754450adf07e9b0d2 (patch) | |
tree | 5320e188d7719d8fba29beaf7da8f6f73e51e4e8 /gst/shapewipe | |
parent | b19dd5920605c0036dacf19591a6feca7a736a50 (diff) | |
parent | e14bfea0c44aafba65239cbff9c6a4a93e0ae41a (diff) | |
download | gst-plugins-bad-7f3bcd484b465d8216ac419754450adf07e9b0d2.tar.gz gst-plugins-bad-7f3bcd484b465d8216ac419754450adf07e9b0d2.tar.bz2 gst-plugins-bad-7f3bcd484b465d8216ac419754450adf07e9b0d2.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 | 43 |
1 files changed, 33 insertions, 10 deletions
diff --git a/gst/shapewipe/gstshapewipe.c b/gst/shapewipe/gstshapewipe.c index ec33f0a7..c2c4ce2b 100644 --- a/gst/shapewipe/gstshapewipe.c +++ b/gst/shapewipe/gstshapewipe.c @@ -17,6 +17,27 @@ * Boston, MA 02111-1307, USA. */ +/** + * SECTION:element-shapewipe + * + * The shapewipe element provides custom transitions on video streams + * based on a grayscale bitmap. The state of the transition can be + * controlled by the position property and an optional blended border + * can be added by the border property. + * + * Transition bitmaps can be downloaded from the + * <ulink url="http://cinelerra.org/transitions.php">Cinelerra transition</ulink> + * page. + * + * <refsect2> + * <title>Example launch line</title> + * |[ + * gst-launch -v videotestsrc ! video/x-raw-yuv,width=640,height=480 ! shapewipe position=0.5 name=shape ! videomixer name=mixer ! ffmpegcolorspace ! autovideosink filesrc location=mask.png ! typefind ! decodebin2 ! ffmpegcolorspace ! videoscale ! queue ! shape.mask_sink videotestsrc pattern=snow ! video/x-raw-yuv,width=640,height=480 ! queue ! mixer. + * ]| This pipeline adds the transition from mask.png with position 0.5 to an SMPTE test screen and snow. + * </refsect2> + */ + + #ifdef HAVE_CONFIG_H # include "config.h" #endif @@ -571,7 +592,7 @@ gst_shape_wipe_blend_16 (GstShapeWipe * self, GstBuffer * inbuf, for (i = 0; i < self->height; i++) { for (j = 0; j < self->width; j++) { - gfloat in = *mask / 65535.0f; + gfloat in = *mask / 65536.0f; if (in < low) { output[0] = 0x00; /* A */ @@ -627,7 +648,7 @@ gst_shape_wipe_blend_8 (GstShapeWipe * self, GstBuffer * inbuf, for (i = 0; i < self->height; i++) { for (j = 0; j < self->width; j++) { - gfloat in = *mask / 255.0f; + gfloat in = *mask / 256.0f; if (in < low) { output[0] = 0x00; /* A */ @@ -678,26 +699,26 @@ gst_shape_wipe_video_sink_chain (GstPad * pad, GstBuffer * buffer) GST_TIME_ARGS (timestamp), self->mask_position); g_mutex_lock (self->mask_mutex); - mask = self->mask; - if (self->mask) - gst_buffer_ref (self->mask); - else + if (!self->mask) g_cond_wait (self->mask_cond, self->mask_mutex); if (self->mask == NULL) { g_mutex_unlock (self->mask_mutex); + gst_buffer_unref (buffer); return GST_FLOW_UNEXPECTED; + } else { + mask = gst_buffer_ref (self->mask); } - - mask = gst_buffer_ref (self->mask); - g_mutex_unlock (self->mask_mutex); ret = gst_pad_alloc_buffer_and_set_caps (self->srcpad, GST_BUFFER_OFFSET_NONE, GST_BUFFER_SIZE (buffer), GST_PAD_CAPS (self->srcpad), &outbuf); - if (G_UNLIKELY (ret != GST_FLOW_OK)) + if (G_UNLIKELY (ret != GST_FLOW_OK)) { + gst_buffer_unref (buffer); + gst_buffer_unref (mask); return ret; + } if (self->mask_bpp == 16) ret = gst_shape_wipe_blend_16 (self, buffer, mask, outbuf); @@ -728,6 +749,8 @@ gst_shape_wipe_mask_sink_chain (GstPad * pad, GstBuffer * buffer) g_cond_signal (self->mask_cond); g_mutex_unlock (self->mask_mutex); + gst_buffer_unref (buffer); + return ret; } |