+2005-11-25 Thomas Vander Stichele <thomas at apestaart dot org>
+
+ * docs/plugins/Makefile.am:
+ * docs/plugins/gst-plugins-good-plugins-docs.sgml:
+ * docs/plugins/gst-plugins-good-plugins-sections.txt:
+ * docs/plugins/inspect/plugin-autodetect.xml:
+ * ext/cairo/gstcairo.c: (plugin_init):
+ * ext/cairo/gsttextoverlay.c: (gst_text_overlay_base_init),
+ (gst_text_overlay_class_init), (gst_text_overlay_finalize),
+ (gst_text_overlay_init), (gst_text_overlay_font_init),
+ (gst_text_overlay_set_property), (gst_text_overlay_render_text),
+ (gst_text_overlay_getcaps), (gst_text_overlay_setcaps),
+ (gst_text_overlay_text_pad_linked),
+ (gst_text_overlay_text_pad_unlinked), (gst_text_overlay_shade_y),
+ (gst_text_overlay_blit_1), (gst_text_overlay_blit_sub2x2),
+ (gst_text_overlay_push_frame), (gst_text_overlay_pop_video),
+ (gst_text_overlay_pop_text), (gst_text_overlay_collected),
+ (gst_text_overlay_change_state):
+ * ext/cairo/gsttextoverlay.h:
+ * ext/cairo/gsttimeoverlay.c:
+ (gst_cairo_time_overlay_update_font_height),
+ (gst_cairo_time_overlay_set_caps),
+ (gst_cairo_time_overlay_get_unit_size),
+ (gst_cairo_time_overlay_print_smpte_time),
+ (gst_cairo_time_overlay_transform),
+ (gst_cairo_time_overlay_base_init),
+ (gst_cairo_time_overlay_class_init), (gst_cairo_time_overlay_init),
+ (gst_cairo_time_overlay_get_type):
+ * ext/cairo/gsttimeoverlay.h:
+ do some name borgifying
+ document
+
2005-11-25 Thomas Vander Stichele <thomas at apestaart dot org>
* docs/plugins/Makefile.am:
$(top_srcdir)/gst/autodetect/gstautoaudiosink.h \
$(top_srcdir)/gst/autodetect/gstautovideosink.h \
$(top_srcdir)/gst/level/gstlevel.h \
- $(top_srcdir)/gst/goom/gstgoom.h
+ $(top_srcdir)/gst/goom/gstgoom.h \
+ $(top_srcdir)/ext/cairo/gsttimeoverlay.h
# example code that needs to be converted to xml and placed in xml/
EXAMPLE_CFILES = \
<title>gst-plugins-good Elements</title>
<xi:include href="xml/element-autoaudiosink.xml" />
<xi:include href="xml/element-autovideosink.xml" />
+ <xi:include href="xml/element-cairotimeoverlay.xml" />
<xi:include href="xml/element-goom.xml" />
<xi:include href="xml/element-level.xml" />
</chapter>
<xi:include href="xml/plugin-aasink.xml" />
<xi:include href="xml/plugin-alaw.xml" />
<xi:include href="xml/plugin-alpha.xml" />
+ <xi:include href="xml/plugin-alphacolor.xml" />
<xi:include href="xml/plugin-autodetect.xml" />
<xi:include href="xml/plugin-avi.xml" />
<xi:include href="xml/plugin-cacasink.xml" />
+ <xi:include href="xml/plugin-cairo.xml" />
<xi:include href="xml/plugin-cutter.xml" />
+ <xi:include href="xml/plugin-debug.xml" />
<xi:include href="xml/plugin-dv.xml" />
+ <xi:include href="xml/plugin-efence.xml" />
<xi:include href="xml/plugin-effectv.xml" />
<xi:include href="xml/plugin-esdsink.xml" />
<xi:include href="xml/plugin-fdsrc.xml" />
<xi:include href="xml/plugin-flac.xml" />
+ <xi:include href="xml/plugin-flxdec.xml" />
<xi:include href="xml/plugin-gconfelements.xml" />
<xi:include href="xml/plugin-goom.xml" />
<xi:include href="xml/plugin-jpeg.xml" />
<xi:include href="xml/plugin-level.xml" />
+ <xi:include href="xml/plugin-matroska.xml" />
<xi:include href="xml/plugin-mulaw.xml" />
+ <xi:include href="xml/plugin-navigationtest.xml" />
<xi:include href="xml/plugin-ossaudio.xml" />
<xi:include href="xml/plugin-png.xml" />
<xi:include href="xml/plugin-rtp.xml" />
<xi:include href="xml/plugin-udp.xml" />
<xi:include href="xml/plugin-videobox.xml" />
<xi:include href="xml/plugin-videoflip.xml" />
+ <xi:include href="xml/plugin-videomixer.xml" />
+ <xi:include href="xml/plugin-wavenc.xml" />
<xi:include href="xml/plugin-wavparse.xml" />
</chapter>
</book>
GstAutoVideoSinkClass
</SECTION>
+<SECTION>
+<FILE>element-cairotimeoverlay</FILE>
+GstCairoTimeOverlay
+<TITLE>cairotimeoverlay</TITLE>
+<SUBSECTION Standard>
+GstCairoTimeOverlayClass
+</SECTION>
+
<SECTION>
<FILE>element-goom</FILE>
GstGoom
<name>autoaudiosink</name>
<longname>Auto audio sink</longname>
<class>Sink/Audio</class>
- <description>Audio sink embedding the Auto-settings for audio output</description>
+ <description>Wrapper audio sink for automatically detected audio sink</description>
<author>Ronald Bultje <rbultje@ronald.bitfreak.net></author>
</element>
<element>
<name>autovideosink</name>
<longname>Auto video sink</longname>
<class>Sink/Video</class>
- <description>Video sink embedding the Auto-settings for video output</description>
+ <description>Wrapper video sink for automatically detected video sink</description>
<author>Ronald Bultje <rbultje@ronald.bitfreak.net></author>
</element>
</elements>
plugin_init (GstPlugin * plugin)
{
gst_element_register (plugin, "cairotextoverlay", GST_RANK_NONE,
- GST_TYPE_TEXT_OVERLAY);
+ GST_TYPE_CAIRO_TEXT_OVERLAY);
gst_element_register (plugin, "cairotimeoverlay", GST_RANK_NONE,
- GST_TYPE_TIMEOVERLAY);
+ GST_TYPE_CAIRO_TIME_OVERLAY);
GST_DEBUG_CATEGORY_INIT (cairo_debug, "cairo", 0, "Cairo elements");
GST_DEBUG_CATEGORY_EXTERN (cairo_debug);
#define GST_CAT_DEFAULT cairo_debug
-static GstElementDetails textoverlay_details = {
+static GstElementDetails cairo_text_overlay_details = {
"Text Overlay",
"Filter/Editor/Video",
"Adds text strings on top of a video buffer",
#define DEFAULT_XPAD 25
#define DEFAULT_FONT "sans"
-static GstStaticPadTemplate textoverlay_src_template_factory =
+static GstStaticPadTemplate cairo_text_overlay_src_template_factory =
GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
static GstFlowReturn gst_text_overlay_collected (GstCollectPads * pads,
gpointer data);
static void gst_text_overlay_finalize (GObject * object);
-static void gst_text_overlay_font_init (GstTextOverlay * overlay);
+static void gst_text_overlay_font_init (GstCairoTextOverlay * overlay);
/* These macros are adapted from videotestsrc.c */
#define I420_Y_ROWSTRIDE(width) (GST_ROUND_UP_4(width))
#define I420_SIZE(w,h) (I420_V_OFFSET(w,h)+(I420_V_ROWSTRIDE(w)*GST_ROUND_UP_2(h)/2))
-GST_BOILERPLATE (GstTextOverlay, gst_text_overlay, GstElement, GST_TYPE_ELEMENT)
+GST_BOILERPLATE (GstCairoTextOverlay, gst_text_overlay, GstElement,
+ GST_TYPE_ELEMENT)
static void gst_text_overlay_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&textoverlay_src_template_factory));
+ gst_static_pad_template_get (&cairo_text_overlay_src_template_factory));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&video_sink_template_factory));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&text_sink_template_factory));
- gst_element_class_set_details (element_class, &textoverlay_details);
+ gst_element_class_set_details (element_class, &cairo_text_overlay_details);
}
static void
-gst_text_overlay_class_init (GstTextOverlayClass * klass)
+gst_text_overlay_class_init (GstCairoTextOverlayClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
static void
gst_text_overlay_finalize (GObject * object)
{
- GstTextOverlay *overlay = GST_TEXT_OVERLAY (object);
+ GstCairoTextOverlay *overlay = GST_CAIRO_TEXT_OVERLAY (object);
gst_collect_pads_stop (overlay->collect);
gst_object_unref (overlay->collect);
}
static void
-gst_text_overlay_init (GstTextOverlay * overlay, GstTextOverlayClass * klass)
+gst_text_overlay_init (GstCairoTextOverlay * overlay,
+ GstCairoTextOverlayClass * klass)
{
/* video sink */
overlay->video_sinkpad =
/* (video) source */
overlay->srcpad =
gst_pad_new_from_template (gst_static_pad_template_get
- (&textoverlay_src_template_factory), "src");
+ (&cairo_text_overlay_src_template_factory), "src");
gst_pad_set_getcaps_function (overlay->srcpad,
GST_DEBUG_FUNCPTR (gst_text_overlay_getcaps));
gst_element_add_pad (GST_ELEMENT (overlay), overlay->srcpad);
- overlay->halign = GST_TEXT_OVERLAY_HALIGN_CENTER;
- overlay->valign = GST_TEXT_OVERLAY_VALIGN_BASELINE;
+ overlay->halign = GST_CAIRO_TEXT_OVERLAY_HALIGN_CENTER;
+ overlay->valign = GST_CAIRO_TEXT_OVERLAY_VALIGN_BASELINE;
overlay->xpad = DEFAULT_XPAD;
overlay->ypad = DEFAULT_YPAD;
overlay->deltax = 0;
}
static void
-gst_text_overlay_font_init (GstTextOverlay * overlay)
+gst_text_overlay_font_init (GstCairoTextOverlay * overlay)
{
cairo_font_extents_t font_extents;
cairo_surface_t *surface;
gst_text_overlay_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
- GstTextOverlay *overlay = GST_TEXT_OVERLAY (object);
+ GstCairoTextOverlay *overlay = GST_CAIRO_TEXT_OVERLAY (object);
GST_OBJECT_LOCK (overlay);
const gchar *s = g_value_get_string (value);
if (strcasecmp (s, "baseline") == 0)
- overlay->valign = GST_TEXT_OVERLAY_VALIGN_BASELINE;
+ overlay->valign = GST_CAIRO_TEXT_OVERLAY_VALIGN_BASELINE;
else if (strcasecmp (s, "bottom") == 0)
- overlay->valign = GST_TEXT_OVERLAY_VALIGN_BOTTOM;
+ overlay->valign = GST_CAIRO_TEXT_OVERLAY_VALIGN_BOTTOM;
else if (strcasecmp (s, "top") == 0)
- overlay->valign = GST_TEXT_OVERLAY_VALIGN_TOP;
+ overlay->valign = GST_CAIRO_TEXT_OVERLAY_VALIGN_TOP;
else
g_warning ("Invalid 'valign' property value: %s", s);
break;
const gchar *s = g_value_get_string (value);
if (strcasecmp (s, "left") == 0)
- overlay->halign = GST_TEXT_OVERLAY_HALIGN_LEFT;
+ overlay->halign = GST_CAIRO_TEXT_OVERLAY_HALIGN_LEFT;
else if (strcasecmp (s, "right") == 0)
- overlay->halign = GST_TEXT_OVERLAY_HALIGN_RIGHT;
+ overlay->halign = GST_CAIRO_TEXT_OVERLAY_HALIGN_RIGHT;
else if (strcasecmp (s, "center") == 0)
- overlay->halign = GST_TEXT_OVERLAY_HALIGN_CENTER;
+ overlay->halign = GST_CAIRO_TEXT_OVERLAY_HALIGN_CENTER;
else
g_warning ("Invalid 'halign' property value: %s", s);
break;
}
static void
-gst_text_overlay_render_text (GstTextOverlay * overlay, gchar * text,
+gst_text_overlay_render_text (GstCairoTextOverlay * overlay, gchar * text,
gint textlen)
{
cairo_text_extents_t extents;
cairo_set_source_rgba (cr, 1, 1, 1, 1.0);
switch (overlay->halign) {
- case GST_TEXT_OVERLAY_HALIGN_LEFT:
+ case GST_CAIRO_TEXT_OVERLAY_HALIGN_LEFT:
x = overlay->xpad;
break;
- case GST_TEXT_OVERLAY_HALIGN_CENTER:
+ case GST_CAIRO_TEXT_OVERLAY_HALIGN_CENTER:
x = (overlay->width - extents.width) / 2;
break;
- case GST_TEXT_OVERLAY_HALIGN_RIGHT:
+ case GST_CAIRO_TEXT_OVERLAY_HALIGN_RIGHT:
x = overlay->width - extents.width - overlay->xpad;
break;
default:
static GstCaps *
gst_text_overlay_getcaps (GstPad * pad)
{
- GstTextOverlay *overlay;
+ GstCairoTextOverlay *overlay;
GstPad *otherpad;
GstCaps *caps;
- overlay = GST_TEXT_OVERLAY (gst_pad_get_parent (pad));
+ overlay = GST_CAIRO_TEXT_OVERLAY (gst_pad_get_parent (pad));
if (pad == overlay->srcpad)
otherpad = overlay->video_sinkpad;
static gboolean
gst_text_overlay_setcaps (GstPad * pad, GstCaps * caps)
{
- GstTextOverlay *overlay;
+ GstCairoTextOverlay *overlay;
GstStructure *structure;
gboolean ret = FALSE;
const GValue *fps;
g_return_val_if_fail (gst_caps_is_fixed (caps), FALSE);
- overlay = GST_TEXT_OVERLAY (gst_pad_get_parent (pad));
+ overlay = GST_CAIRO_TEXT_OVERLAY (gst_pad_get_parent (pad));
overlay->width = 0;
overlay->height = 0;
static GstPadLinkReturn
gst_text_overlay_text_pad_linked (GstPad * pad, GstPad * peer)
{
- GstTextOverlay *overlay;
+ GstCairoTextOverlay *overlay;
- overlay = GST_TEXT_OVERLAY (GST_PAD_PARENT (pad));
+ overlay = GST_CAIRO_TEXT_OVERLAY (GST_PAD_PARENT (pad));
GST_DEBUG_OBJECT (overlay, "Text pad linked");
static void
gst_text_overlay_text_pad_unlinked (GstPad * pad)
{
- GstTextOverlay *overlay;
+ GstCairoTextOverlay *overlay;
/* don't use gst_pad_get_parent() here, will deadlock */
- overlay = GST_TEXT_OVERLAY (GST_PAD_PARENT (pad));
+ overlay = GST_CAIRO_TEXT_OVERLAY (GST_PAD_PARENT (pad));
GST_DEBUG_OBJECT (overlay, "Text pad unlinked");
#define BOX_YPAD 6
static inline void
-gst_text_overlay_shade_y (GstTextOverlay * overlay, guchar * dest,
+gst_text_overlay_shade_y (GstCairoTextOverlay * overlay, guchar * dest,
guint dest_stride, gint y0, gint y1)
{
gint i, j, x0, x1;
}
static inline void
-gst_text_overlay_blit_1 (GstTextOverlay * overlay, guchar * dest,
+gst_text_overlay_blit_1 (GstCairoTextOverlay * overlay, guchar * dest,
guchar * text_image, gint val, guint dest_stride)
{
gint i, j;
}
static inline void
-gst_text_overlay_blit_sub2x2 (GstTextOverlay * overlay, guchar * dest,
+gst_text_overlay_blit_sub2x2 (GstCairoTextOverlay * overlay, guchar * dest,
guchar * text_image, gint val, guint dest_stride)
{
gint i, j;
static GstFlowReturn
-gst_text_overlay_push_frame (GstTextOverlay * overlay, GstBuffer * video_frame)
+gst_text_overlay_push_frame (GstCairoTextOverlay * overlay,
+ GstBuffer * video_frame)
{
guchar *y, *u, *v;
gint ypos;
video_frame = gst_buffer_make_writable (video_frame);
switch (overlay->valign) {
- case GST_TEXT_OVERLAY_VALIGN_BOTTOM:
+ case GST_CAIRO_TEXT_OVERLAY_VALIGN_BOTTOM:
ypos = overlay->height - overlay->font_height - overlay->ypad;
break;
- case GST_TEXT_OVERLAY_VALIGN_BASELINE:
+ case GST_CAIRO_TEXT_OVERLAY_VALIGN_BASELINE:
ypos = overlay->height - (overlay->font_height - overlay->text_dy)
- overlay->ypad;
break;
- case GST_TEXT_OVERLAY_VALIGN_TOP:
+ case GST_CAIRO_TEXT_OVERLAY_VALIGN_TOP:
ypos = overlay->ypad;
break;
default:
}
static void
-gst_text_overlay_pop_video (GstTextOverlay * overlay)
+gst_text_overlay_pop_video (GstCairoTextOverlay * overlay)
{
GstBuffer *buf;
}
static void
-gst_text_overlay_pop_text (GstTextOverlay * overlay)
+gst_text_overlay_pop_text (GstCairoTextOverlay * overlay)
{
GstBuffer *buf;
static GstFlowReturn
gst_text_overlay_collected (GstCollectPads * pads, gpointer data)
{
- GstTextOverlay *overlay;
+ GstCairoTextOverlay *overlay;
GstFlowReturn ret = GST_FLOW_OK;
GstClockTime now, txt_end, frame_end;
GstBuffer *video_frame = NULL;
GstBuffer *text_buf = NULL;
- overlay = GST_TEXT_OVERLAY (data);
+ overlay = GST_CAIRO_TEXT_OVERLAY (data);
GST_DEBUG ("Collecting");
gst_text_overlay_change_state (GstElement * element, GstStateChange transition)
{
GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
- GstTextOverlay *overlay = GST_TEXT_OVERLAY (element);
+ GstCairoTextOverlay *overlay = GST_CAIRO_TEXT_OVERLAY (element);
switch (transition) {
case GST_STATE_CHANGE_READY_TO_PAUSED:
-#ifndef __GST_TEXT_OVERLAY_H__
-#define __GST_TEXT_OVERLAY_H__
+#ifndef __GST_CAIRO_TEXT_OVERLAY_H__
+#define __GST_CAIRO_TEXT_OVERLAY_H__
#include <gst/gst.h>
#include <gst/base/gstcollectpads.h>
G_BEGIN_DECLS
-#define GST_TYPE_TEXT_OVERLAY (gst_text_overlay_get_type())
-#define GST_TEXT_OVERLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),\
- GST_TYPE_TEXT_OVERLAY, GstTextOverlay))
-#define GST_TEXT_OVERLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),\
- GST_TYPE_ULAW, GstTextOverlay))
-#define GST_TEXT_OVERLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),\
- GST_TYPE_TEXT_OVERLAY, GstTextOverlayClass))
-#define GST_IS_TEXT_OVERLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),\
- GST_TYPE_TEXT_OVERLAY))
-#define GST_IS_TEXT_OVERLAY_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),\
- GST_TYPE_TEXT_OVERLAY))
-
-typedef struct _GstTextOverlay GstTextOverlay;
-typedef struct _GstTextOverlayClass GstTextOverlayClass;
-
-typedef enum _GstTextOverlayVAlign GstTextOverlayVAlign;
-typedef enum _GstTextOverlayHAlign GstTextOverlayHAlign;
-
-enum _GstTextOverlayVAlign {
- GST_TEXT_OVERLAY_VALIGN_BASELINE,
- GST_TEXT_OVERLAY_VALIGN_BOTTOM,
- GST_TEXT_OVERLAY_VALIGN_TOP
+#define GST_TYPE_CAIRO_TEXT_OVERLAY (gst_text_overlay_get_type())
+#define GST_CAIRO_TEXT_OVERLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),\
+ GST_TYPE_CAIRO_TEXT_OVERLAY, GstCairoTextOverlay))
+#define GST_CAIRO_TEXT_OVERLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),\
+ GST_TYPE_ULAW, GstCairoTextOverlay))
+#define GST_CAIRO_TEXT_OVERLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),\
+ GST_TYPE_CAIRO_TEXT_OVERLAY, GstCairoTextOverlayClass))
+#define GST_IS_CAIRO_TEXT_OVERLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),\
+ GST_TYPE_CAIRO_TEXT_OVERLAY))
+#define GST_IS_CAIRO_TEXT_OVERLAY_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),\
+ GST_TYPE_CAIRO_TEXT_OVERLAY))
+
+typedef struct _GstCairoTextOverlay GstCairoTextOverlay;
+typedef struct _GstCairoTextOverlayClass GstCairoTextOverlayClass;
+
+typedef enum _GstCairoTextOverlayVAlign GstCairoTextOverlayVAlign;
+typedef enum _GstCairoTextOverlayHAlign GstCairoTextOverlayHAlign;
+
+enum _GstCairoTextOverlayVAlign {
+ GST_CAIRO_TEXT_OVERLAY_VALIGN_BASELINE,
+ GST_CAIRO_TEXT_OVERLAY_VALIGN_BOTTOM,
+ GST_CAIRO_TEXT_OVERLAY_VALIGN_TOP
};
-enum _GstTextOverlayHAlign {
- GST_TEXT_OVERLAY_HALIGN_LEFT,
- GST_TEXT_OVERLAY_HALIGN_CENTER,
- GST_TEXT_OVERLAY_HALIGN_RIGHT
+enum _GstCairoTextOverlayHAlign {
+ GST_CAIRO_TEXT_OVERLAY_HALIGN_LEFT,
+ GST_CAIRO_TEXT_OVERLAY_HALIGN_CENTER,
+ GST_CAIRO_TEXT_OVERLAY_HALIGN_RIGHT
};
-struct _GstTextOverlay {
+struct _GstCairoTextOverlay {
GstElement element;
GstPad *video_sinkpad;
gint fps_n;
gint fps_d;
- GstTextOverlayVAlign valign;
- GstTextOverlayHAlign halign;
+ GstCairoTextOverlayVAlign valign;
+ GstCairoTextOverlayHAlign halign;
gint xpad;
gint ypad;
gint deltax;
gdouble scale;
};
-struct _GstTextOverlayClass {
+struct _GstCairoTextOverlayClass {
GstElementClass parent_class;
};
G_END_DECLS
-#endif /* __GST_TEXT_OVERLAY_H */
+#endif /* __GST_CAIRO_TEXT_OVERLAY_H */
* Boston, MA 02111-1307, USA.
*/
-/*
- * This file was (probably) generated from gsttimeoverlay.c,
- * gsttimeoverlay.c,v 1.7 2003/11/08 02:48:59 dschleef Exp
+/**
+ * SECTION:element-cairotimeoverlay
+ *
+ * <refsect2>
+ * <para>
+ * cairotimeoverlay renders the buffer timestamp for each frame on top of
+ * the frame.
+ * </para>
+ * <title>Example launch line</title>
+ * <para>
+ * <programlisting>
+ * gst-launch -v -m videotestsrc ! cairotimeoverlay ! autovideosink
+ * </programlisting>
+ * </para>
+ * </refsect2>
*/
#ifdef HAVE_CONFIG_H
#include <gst/video/video.h>
-static GstElementDetails timeoverlay_details =
+static GstElementDetails cairo_time_overlay_details =
GST_ELEMENT_DETAILS ("Time Overlay",
"Filter/Editor/Video",
"Overlays the time on a video stream",
"David Schleef <ds@schleef.org>");
-static GstStaticPadTemplate gst_timeoverlay_src_template =
+static GstStaticPadTemplate gst_cairo_time_overlay_src_template =
GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420"))
);
-static GstStaticPadTemplate gst_timeoverlay_sink_template =
+static GstStaticPadTemplate gst_cairo_time_overlay_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420"))
);
-static GstVideofilterClass *parent_class = NULL;
+static GstBaseTransformClass *parent_class = NULL;
static void
-gst_timeoverlay_update_font_height (GstTimeoverlay * timeoverlay)
+gst_cairo_time_overlay_update_font_height (GstCairoTimeOverlay * timeoverlay)
{
gint width, height;
cairo_surface_t *font_surface;
}
static gboolean
-gst_timeoverlay_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
+gst_cairo_time_overlay_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
GstCaps * outcaps)
{
- GstTimeoverlay *filter = GST_TIMEOVERLAY (btrans);
+ GstCairoTimeOverlay *filter = GST_CAIRO_TIME_OVERLAY (btrans);
GstStructure *structure;
gboolean ret = FALSE;
if (gst_structure_get_int (structure, "width", &filter->width) &&
gst_structure_get_int (structure, "height", &filter->height)) {
- gst_timeoverlay_update_font_height (filter);
+ gst_cairo_time_overlay_update_font_height (filter);
ret = TRUE;
}
#define GST_VIDEO_I420_SIZE(w,h) (GST_VIDEO_I420_V_OFFSET(w,h)+(GST_VIDEO_I420_V_ROWSTRIDE(w)*GST_ROUND_UP_2(h)/2))
static gboolean
-gst_timeoverlay_get_unit_size (GstBaseTransform * btrans, GstCaps * caps,
+gst_cairo_time_overlay_get_unit_size (GstBaseTransform * btrans, GstCaps * caps,
guint * size)
{
- GstTimeoverlay *filter;
+ GstCairoTimeOverlay *filter;
GstStructure *structure;
gboolean ret = FALSE;
gint width, height;
- filter = GST_TIMEOVERLAY (btrans);
+ filter = GST_CAIRO_TIME_OVERLAY (btrans);
structure = gst_caps_get_structure (caps, 0);
}
static char *
-gst_timeoverlay_print_smpte_time (guint64 time)
+gst_cairo_time_overlay_print_smpte_time (guint64 time)
{
int hours;
int minutes;
static GstFlowReturn
-gst_timeoverlay_transform (GstBaseTransform * trans, GstBuffer * in,
+gst_cairo_time_overlay_transform (GstBaseTransform * trans, GstBuffer * in,
GstBuffer * out)
{
- GstTimeoverlay *timeoverlay;
+ GstCairoTimeOverlay *timeoverlay;
int width;
int height;
int b_width;
cairo_t *text_cairo;
GstFlowReturn ret = GST_FLOW_OK;
- timeoverlay = GST_TIMEOVERLAY (trans);
+ timeoverlay = GST_CAIRO_TIME_OVERLAY (trans);
gst_buffer_stamp (out, in);
cairo_fill (text_cairo);
cairo_restore (text_cairo);
- string = gst_timeoverlay_print_smpte_time (GST_BUFFER_TIMESTAMP (in));
+ string = gst_cairo_time_overlay_print_smpte_time (GST_BUFFER_TIMESTAMP (in));
cairo_save (text_cairo);
cairo_select_font_face (text_cairo, "monospace", 0, 0);
cairo_set_font_size (text_cairo, 20);
}
static void
-gst_timeoverlay_base_init (gpointer g_class)
+gst_cairo_time_overlay_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- gst_element_class_set_details (element_class, &timeoverlay_details);
+ gst_element_class_set_details (element_class, &cairo_time_overlay_details);
gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_timeoverlay_sink_template));
+ gst_static_pad_template_get (&gst_cairo_time_overlay_sink_template));
gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_timeoverlay_src_template));
+ gst_static_pad_template_get (&gst_cairo_time_overlay_src_template));
}
static void
-gst_timeoverlay_class_init (gpointer klass, gpointer class_data)
+gst_cairo_time_overlay_class_init (gpointer klass, gpointer class_data)
{
GObjectClass *gobject_class;
GstElementClass *element_class;
parent_class = g_type_class_peek_parent (klass);
- trans_class->set_caps = GST_DEBUG_FUNCPTR (gst_timeoverlay_set_caps);
+ trans_class->set_caps = GST_DEBUG_FUNCPTR (gst_cairo_time_overlay_set_caps);
trans_class->get_unit_size =
- GST_DEBUG_FUNCPTR (gst_timeoverlay_get_unit_size);
- trans_class->transform = GST_DEBUG_FUNCPTR (gst_timeoverlay_transform);
+ GST_DEBUG_FUNCPTR (gst_cairo_time_overlay_get_unit_size);
+ trans_class->transform = GST_DEBUG_FUNCPTR (gst_cairo_time_overlay_transform);
}
static void
-gst_timeoverlay_init (GTypeInstance * instance, gpointer g_class)
+gst_cairo_time_overlay_init (GTypeInstance * instance, gpointer g_class)
{
}
GType
-gst_timeoverlay_get_type (void)
+gst_cairo_time_overlay_get_type (void)
{
- static GType timeoverlay_type = 0;
+ static GType cairo_time_overlay_type = 0;
- if (!timeoverlay_type) {
- static const GTypeInfo timeoverlay_info = {
- sizeof (GstTimeoverlayClass),
- gst_timeoverlay_base_init,
+ if (!cairo_time_overlay_type) {
+ static const GTypeInfo cairo_time_overlay_info = {
+ sizeof (GstCairoTimeOverlayClass),
+ gst_cairo_time_overlay_base_init,
NULL,
- gst_timeoverlay_class_init,
+ gst_cairo_time_overlay_class_init,
NULL,
NULL,
- sizeof (GstTimeoverlay),
+ sizeof (GstCairoTimeOverlay),
0,
- gst_timeoverlay_init,
+ gst_cairo_time_overlay_init,
};
- timeoverlay_type = g_type_register_static (GST_TYPE_VIDEOFILTER,
- "GstTimeoverlay", &timeoverlay_info, 0);
+ cairo_time_overlay_type = g_type_register_static (GST_TYPE_BASE_TRANSFORM,
+ "GstCairoTimeOverlay", &cairo_time_overlay_info, 0);
}
- return timeoverlay_type;
+ return cairo_time_overlay_type;
}
* Boston, MA 02111-1307, USA.
*/
-
-#ifndef __GST_TIMEOVERLAY_H__
-#define __GST_TIMEOVERLAY_H__
+#ifndef __GST_CAIRO_TIME_OVERLAY_H__
+#define __GST_CAIRO_TIME_OVERLAY_H__
#include <gst/gst.h>
+#include <gst/base/gstbasetransform.h>
#include <cairo.h>
-#include "gstvideofilter.h"
-
G_BEGIN_DECLS
-#define GST_TYPE_TIMEOVERLAY \
- (gst_timeoverlay_get_type())
-#define GST_TIMEOVERLAY(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_TIMEOVERLAY,GstTimeoverlay))
-#define GST_TIMEOVERLAY_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_TIMEOVERLAY,GstTimeoverlayClass))
-#define GST_IS_TIMEOVERLAY(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_TIMEOVERLAY))
-#define GST_IS_TIMEOVERLAY_CLASS(obj) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_TIMEOVERLAY))
+#define GST_TYPE_CAIRO_TIME_OVERLAY \
+ (gst_cairo_time_overlay_get_type())
+#define GST_CAIRO_TIME_OVERLAY(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_CAIRO_TIME_OVERLAY,GstCairoTimeOverlay))
+#define GST_CAIRO_TIME_OVERLAY_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_CAIRO_TIME_OVERLAY,GstCairoTimeOverlayClass))
+#define GST_IS_CAIRO_TIME_OVERLAY(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_CAIRO_TIME_OVERLAY))
+#define GST_IS_CAIRO_TIME_OVERLAY_CLASS(obj) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_CAIRO_TIME_OVERLAY))
-typedef struct _GstTimeoverlay GstTimeoverlay;
-typedef struct _GstTimeoverlayClass GstTimeoverlayClass;
-
-struct _GstTimeoverlay {
- GstVideofilter videofilter;
+typedef struct _GstCairoTimeOverlay {
+ GstBaseTransform basetransform;
gint width, height;
-
+
cairo_surface_t *surface;
cairo_t *cr;
int text_height;
-};
+} GstCairoTimeOverlay;
-struct _GstTimeoverlayClass {
- GstVideofilterClass parent_class;
-};
+typedef struct _GstCairoTimeOverlayClass {
+ GstBaseTransformClass parent_class;
+} GstCairoTimeOverlayClass;
-GType gst_timeoverlay_get_type(void);
+GType gst_cairo_time_overlay_get_type(void);
G_END_DECLS
-#endif /* __GST_TIMEOVERLAY_H__ */
+#endif /* __GST_CAIRO_TIME_OVERLAY_H__ */