/**
* SECTION:element-timeoverlay
- * @see_also: #GstTextOverlay, #GstClockOverlay
+ * @see_also: #GstBaseTextOverlay, #GstClockOverlay
*
* This element overlays the buffer time stamps of a video stream on
* top of itself. You can position the text and configure the font details
- * using the properties of the #GstTextOverlay class. By default, the
+ * using the properties of the #GstBaseTextOverlay class. By default, the
* time stamp is displayed in the top left corner of the picture, with some
* padding to the left and to the top.
*
#include "gsttimeoverlay.h"
-GST_BOILERPLATE (GstTimeOverlay, gst_time_overlay, GstTextOverlay,
- GST_TYPE_TEXT_OVERLAY);
-
-static void
-gst_time_overlay_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_set_details_simple (element_class, "Time overlay",
- "Filter/Editor/Video",
- "Overlays buffer time stamps on a video stream",
- "Tim-Philipp Müller <tim@centricular.net>");
-}
+#define gst_time_overlay_parent_class parent_class
+G_DEFINE_TYPE (GstTimeOverlay, gst_time_overlay, GST_TYPE_BASE_TEXT_OVERLAY);
static gchar *
gst_time_overlay_render_time (GstTimeOverlay * overlay, GstClockTime time)
/* Called with lock held */
static gchar *
-gst_time_overlay_get_text (GstTextOverlay * overlay, GstBuffer * video_frame)
+gst_time_overlay_get_text (GstBaseTextOverlay * overlay,
+ GstBuffer * video_frame)
{
GstClockTime time = GST_BUFFER_TIMESTAMP (video_frame);
gchar *time_str, *txt, *ret;
static void
gst_time_overlay_class_init (GstTimeOverlayClass * klass)
{
- GstTextOverlayClass *gsttextoverlay_class;
+ GstElementClass *gstelement_class;
+ GstBaseTextOverlayClass *gsttextoverlay_class;
PangoContext *context;
PangoFontDescription *font_description;
- gsttextoverlay_class = (GstTextOverlayClass *) klass;
+ gsttextoverlay_class = (GstBaseTextOverlayClass *) klass;
+ gstelement_class = (GstElementClass *) klass;
+
+ gst_element_class_set_details_simple (gstelement_class, "Time overlay",
+ "Filter/Editor/Video",
+ "Overlays buffer time stamps on a video stream",
+ "Tim-Philipp Müller <tim@centricular.net>");
gsttextoverlay_class->get_text = gst_time_overlay_get_text;
- g_mutex_lock (GST_TEXT_OVERLAY_CLASS (klass)->pango_lock);
- context = GST_TEXT_OVERLAY_CLASS (klass)->pango_context;
+ g_mutex_lock (gsttextoverlay_class->pango_lock);
+ context = gsttextoverlay_class->pango_context;
pango_context_set_language (context, pango_language_from_string ("en_US"));
pango_context_set_base_dir (context, PANGO_DIRECTION_LTR);
pango_font_description_set_size (font_description, 18 * PANGO_SCALE);
pango_context_set_font_description (context, font_description);
pango_font_description_free (font_description);
- g_mutex_unlock (GST_TEXT_OVERLAY_CLASS (klass)->pango_lock);
+ g_mutex_unlock (gsttextoverlay_class->pango_lock);
}
static void
-gst_time_overlay_init (GstTimeOverlay * overlay, GstTimeOverlayClass * klass)
+gst_time_overlay_init (GstTimeOverlay * overlay)
{
- GstTextOverlay *textoverlay;
+ GstBaseTextOverlay *textoverlay;
- textoverlay = GST_TEXT_OVERLAY (overlay);
+ textoverlay = GST_BASE_TEXT_OVERLAY (overlay);
- textoverlay->valign = GST_TEXT_OVERLAY_VALIGN_TOP;
- textoverlay->halign = GST_TEXT_OVERLAY_HALIGN_LEFT;
+ textoverlay->valign = GST_BASE_TEXT_OVERLAY_VALIGN_TOP;
+ textoverlay->halign = GST_BASE_TEXT_OVERLAY_HALIGN_LEFT;
}