From 0a68fafa430aa4503b32abc107c0c4582aa9227d Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Fri, 25 Nov 2005 21:36:18 +0000 Subject: [PATCH] do some name borgifying document Original commit message from CVS: do some name borgifying document --- ChangeLog | 32 ++++++++ docs/plugins/Makefile.am | 3 +- docs/plugins/gst-plugins-good-plugins-docs.sgml | 10 +++ docs/plugins/gst-plugins-good-plugins-sections.txt | 8 ++ docs/plugins/inspect/plugin-autodetect.xml | 4 +- ext/cairo/gstcairo.c | 4 +- ext/cairo/gsttextoverlay.c | 91 ++++++++++----------- ext/cairo/gsttextoverlay.h | 66 ++++++++-------- ext/cairo/gsttimeoverlay.c | 92 ++++++++++++---------- ext/cairo/gsttimeoverlay.h | 49 ++++++------ 10 files changed, 210 insertions(+), 149 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1408222..5d1cf47 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,38 @@ * 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 + + * docs/plugins/Makefile.am: + * docs/plugins/gst-plugins-good-plugins-docs.sgml: + * docs/plugins/gst-plugins-good-plugins-sections.txt: * gst/autodetect/gstautoaudiosink.c: (gst_auto_audio_sink_base_init): * gst/autodetect/gstautovideosink.c: diff --git a/docs/plugins/Makefile.am b/docs/plugins/Makefile.am index 913c0a5..497e60e 100644 --- a/docs/plugins/Makefile.am +++ b/docs/plugins/Makefile.am @@ -77,7 +77,8 @@ EXTRA_HFILES = \ $(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 = \ diff --git a/docs/plugins/gst-plugins-good-plugins-docs.sgml b/docs/plugins/gst-plugins-good-plugins-docs.sgml index 82579c2..9f2b03e 100644 --- a/docs/plugins/gst-plugins-good-plugins-docs.sgml +++ b/docs/plugins/gst-plugins-good-plugins-docs.sgml @@ -14,6 +14,7 @@ gst-plugins-good Elements + @@ -25,20 +26,27 @@ + + + + + + + @@ -49,6 +57,8 @@ + + diff --git a/docs/plugins/gst-plugins-good-plugins-sections.txt b/docs/plugins/gst-plugins-good-plugins-sections.txt index 7c4c86c..fa729f2 100644 --- a/docs/plugins/gst-plugins-good-plugins-sections.txt +++ b/docs/plugins/gst-plugins-good-plugins-sections.txt @@ -15,6 +15,14 @@ GstAutoVideoSinkClass
+element-cairotimeoverlay +GstCairoTimeOverlay +cairotimeoverlay + +GstCairoTimeOverlayClass +
+ +
element-goom GstGoom goom diff --git a/docs/plugins/inspect/plugin-autodetect.xml b/docs/plugins/inspect/plugin-autodetect.xml index a1e717f..6d7e56f 100644 --- a/docs/plugins/inspect/plugin-autodetect.xml +++ b/docs/plugins/inspect/plugin-autodetect.xml @@ -13,14 +13,14 @@ autoaudiosink Auto audio sink Sink/Audio - Audio sink embedding the Auto-settings for audio output + Wrapper audio sink for automatically detected audio sink Ronald Bultje <rbultje@ronald.bitfreak.net> autovideosink Auto video sink Sink/Video - Video sink embedding the Auto-settings for video output + Wrapper video sink for automatically detected video sink Ronald Bultje <rbultje@ronald.bitfreak.net> diff --git a/ext/cairo/gstcairo.c b/ext/cairo/gstcairo.c index aac9725..85573b7 100644 --- a/ext/cairo/gstcairo.c +++ b/ext/cairo/gstcairo.c @@ -33,9 +33,9 @@ static gboolean 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"); diff --git a/ext/cairo/gsttextoverlay.c b/ext/cairo/gsttextoverlay.c index 1ef6b7d..f674706 100644 --- a/ext/cairo/gsttextoverlay.c +++ b/ext/cairo/gsttextoverlay.c @@ -43,7 +43,7 @@ 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", @@ -68,7 +68,7 @@ enum #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, @@ -101,7 +101,7 @@ static void gst_text_overlay_text_pad_unlinked (GstPad * pad); 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)) @@ -114,24 +114,25 @@ static void gst_text_overlay_font_init (GstTextOverlay * overlay); #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; @@ -190,7 +191,7 @@ gst_text_overlay_class_init (GstTextOverlayClass * klass) 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); @@ -205,7 +206,8 @@ gst_text_overlay_finalize (GObject * object) } static void -gst_text_overlay_init (GstTextOverlay * overlay, GstTextOverlayClass * klass) +gst_text_overlay_init (GstCairoTextOverlay * overlay, + GstCairoTextOverlayClass * klass) { /* video sink */ overlay->video_sinkpad = @@ -230,13 +232,13 @@ gst_text_overlay_init (GstTextOverlay * overlay, GstTextOverlayClass * klass) /* (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; @@ -267,7 +269,7 @@ gst_text_overlay_init (GstTextOverlay * overlay, GstTextOverlayClass * klass) } 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; @@ -291,7 +293,7 @@ static void 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); @@ -309,11 +311,11 @@ gst_text_overlay_set_property (GObject * object, guint prop_id, 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; @@ -322,11 +324,11 @@ gst_text_overlay_set_property (GObject * object, guint prop_id, 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; @@ -367,7 +369,7 @@ gst_text_overlay_set_property (GObject * object, guint prop_id, } 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; @@ -416,13 +418,13 @@ gst_text_overlay_render_text (GstTextOverlay * overlay, gchar * text, 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: @@ -484,11 +486,11 @@ gst_text_overlay_render_text (GstTextOverlay * overlay, gchar * text, 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; @@ -528,7 +530,7 @@ gst_text_overlay_getcaps (GstPad * pad) static gboolean gst_text_overlay_setcaps (GstPad * pad, GstCaps * caps) { - GstTextOverlay *overlay; + GstCairoTextOverlay *overlay; GstStructure *structure; gboolean ret = FALSE; const GValue *fps; @@ -538,7 +540,7 @@ gst_text_overlay_setcaps (GstPad * pad, GstCaps * caps) 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; @@ -560,9 +562,9 @@ gst_text_overlay_setcaps (GstPad * pad, GstCaps * caps) 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"); @@ -579,10 +581,10 @@ gst_text_overlay_text_pad_linked (GstPad * pad, GstPad * peer) 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"); @@ -599,7 +601,7 @@ gst_text_overlay_text_pad_unlinked (GstPad * pad) #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; @@ -620,7 +622,7 @@ gst_text_overlay_shade_y (GstTextOverlay * overlay, guchar * dest, } 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; @@ -639,7 +641,7 @@ gst_text_overlay_blit_1 (GstTextOverlay * overlay, guchar * dest, } 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; @@ -662,7 +664,8 @@ gst_text_overlay_blit_sub2x2 (GstTextOverlay * overlay, guchar * dest, 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; @@ -670,14 +673,14 @@ gst_text_overlay_push_frame (GstTextOverlay * overlay, GstBuffer * video_frame) 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: @@ -724,7 +727,7 @@ gst_text_overlay_push_frame (GstTextOverlay * overlay, GstBuffer * video_frame) } static void -gst_text_overlay_pop_video (GstTextOverlay * overlay) +gst_text_overlay_pop_video (GstCairoTextOverlay * overlay) { GstBuffer *buf; @@ -734,7 +737,7 @@ gst_text_overlay_pop_video (GstTextOverlay * overlay) } static void -gst_text_overlay_pop_text (GstTextOverlay * overlay) +gst_text_overlay_pop_text (GstCairoTextOverlay * overlay) { GstBuffer *buf; @@ -751,13 +754,13 @@ gst_text_overlay_pop_text (GstTextOverlay * overlay) 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"); @@ -881,7 +884,7 @@ static GstStateChangeReturn 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: diff --git a/ext/cairo/gsttextoverlay.h b/ext/cairo/gsttextoverlay.h index 8f105ca..fe1a1fd 100644 --- a/ext/cairo/gsttextoverlay.h +++ b/ext/cairo/gsttextoverlay.h @@ -1,44 +1,44 @@ -#ifndef __GST_TEXT_OVERLAY_H__ -#define __GST_TEXT_OVERLAY_H__ +#ifndef __GST_CAIRO_TEXT_OVERLAY_H__ +#define __GST_CAIRO_TEXT_OVERLAY_H__ #include #include 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; @@ -54,8 +54,8 @@ struct _GstTextOverlay { gint fps_n; gint fps_d; - GstTextOverlayVAlign valign; - GstTextOverlayHAlign halign; + GstCairoTextOverlayVAlign valign; + GstCairoTextOverlayHAlign halign; gint xpad; gint ypad; gint deltax; @@ -77,7 +77,7 @@ struct _GstTextOverlay { gdouble scale; }; -struct _GstTextOverlayClass { +struct _GstCairoTextOverlayClass { GstElementClass parent_class; }; @@ -85,4 +85,4 @@ GType gst_text_overlay_get_type (void); G_END_DECLS -#endif /* __GST_TEXT_OVERLAY_H */ +#endif /* __GST_CAIRO_TEXT_OVERLAY_H */ diff --git a/ext/cairo/gsttimeoverlay.c b/ext/cairo/gsttimeoverlay.c index 7fc7bd9..6e54468 100644 --- a/ext/cairo/gsttimeoverlay.c +++ b/ext/cairo/gsttimeoverlay.c @@ -18,9 +18,21 @@ * 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 + * + * + * + * cairotimeoverlay renders the buffer timestamp for each frame on top of + * the frame. + * + * Example launch line + * + * + * gst-launch -v -m videotestsrc ! cairotimeoverlay ! autovideosink + * + * + * */ #ifdef HAVE_CONFIG_H @@ -36,30 +48,30 @@ #include -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 "); -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; @@ -85,10 +97,10 @@ gst_timeoverlay_update_font_height (GstTimeoverlay * timeoverlay) } 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; @@ -96,7 +108,7 @@ gst_timeoverlay_set_caps (GstBaseTransform * btrans, GstCaps * incaps, 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; } @@ -115,15 +127,15 @@ gst_timeoverlay_set_caps (GstBaseTransform * btrans, GstCaps * incaps, #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); @@ -139,7 +151,7 @@ gst_timeoverlay_get_unit_size (GstBaseTransform * btrans, GstCaps * caps, } static char * -gst_timeoverlay_print_smpte_time (guint64 time) +gst_cairo_time_overlay_print_smpte_time (guint64 time) { int hours; int minutes; @@ -162,10 +174,10 @@ gst_timeoverlay_print_smpte_time (guint64 time) 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; @@ -178,7 +190,7 @@ gst_timeoverlay_transform (GstBaseTransform * trans, GstBuffer * in, cairo_t *text_cairo; GstFlowReturn ret = GST_FLOW_OK; - timeoverlay = GST_TIMEOVERLAY (trans); + timeoverlay = GST_CAIRO_TIME_OVERLAY (trans); gst_buffer_stamp (out, in); @@ -209,7 +221,7 @@ gst_timeoverlay_transform (GstBaseTransform * trans, GstBuffer * 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); @@ -246,20 +258,20 @@ gst_timeoverlay_transform (GstBaseTransform * trans, GstBuffer * in, } 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; @@ -271,37 +283,37 @@ gst_timeoverlay_class_init (gpointer klass, gpointer class_data) 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; } diff --git a/ext/cairo/gsttimeoverlay.h b/ext/cairo/gsttimeoverlay.h index eaa098d..6df4b69 100644 --- a/ext/cairo/gsttimeoverlay.h +++ b/ext/cairo/gsttimeoverlay.h @@ -17,48 +17,43 @@ * 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 +#include #include -#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__ */ -- 2.7.4