1 #ifndef __GST_BASE_TEXT_OVERLAY_H__
2 #define __GST_BASE_TEXT_OVERLAY_H__
5 #include <gst/video/video.h>
6 #include <gst/controller/gstcontroller.h>
7 #include <pango/pangocairo.h>
11 #define GST_TYPE_BASE_TEXT_OVERLAY (gst_base_text_overlay_get_type())
12 #define GST_BASE_TEXT_OVERLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),\
13 GST_TYPE_BASE_TEXT_OVERLAY, GstBaseTextOverlay))
14 #define GST_BASE_TEXT_OVERLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),\
15 GST_TYPE_BASE_TEXT_OVERLAY,GstBaseTextOverlayClass))
16 #define GST_BASE_TEXT_OVERLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),\
17 GST_TYPE_BASE_TEXT_OVERLAY, GstBaseTextOverlayClass))
18 #define GST_IS_BASE_TEXT_OVERLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),\
19 GST_TYPE_BASE_TEXT_OVERLAY))
20 #define GST_IS_BASE_TEXT_OVERLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),\
21 GST_TYPE_BASE_TEXT_OVERLAY))
23 typedef struct _GstBaseTextOverlay GstBaseTextOverlay;
24 typedef struct _GstBaseTextOverlayClass GstBaseTextOverlayClass;
27 * GstBaseTextOverlayVAlign:
28 * @GST_BASE_TEXT_OVERLAY_VALIGN_BASELINE: draw text on the baseline
29 * @GST_BASE_TEXT_OVERLAY_VALIGN_BOTTOM: draw text on the bottom
30 * @GST_BASE_TEXT_OVERLAY_VALIGN_TOP: draw text on top
31 * @GST_BASE_TEXT_OVERLAY_VALIGN_POS: draw text according to the #GstBaseTextOverlay:ypos property
32 * @GST_BASE_TEXT_OVERLAY_VALIGN_CENTER: draw text vertically centered
34 * Vertical alignment of the text.
37 GST_BASE_TEXT_OVERLAY_VALIGN_BASELINE,
38 GST_BASE_TEXT_OVERLAY_VALIGN_BOTTOM,
39 GST_BASE_TEXT_OVERLAY_VALIGN_TOP,
40 GST_BASE_TEXT_OVERLAY_VALIGN_POS,
41 GST_BASE_TEXT_OVERLAY_VALIGN_CENTER
42 } GstBaseTextOverlayVAlign;
45 * GstBaseTextOverlayHAlign:
46 * @GST_BASE_TEXT_OVERLAY_HALIGN_LEFT: align text left
47 * @GST_BASE_TEXT_OVERLAY_HALIGN_CENTER: align text center
48 * @GST_BASE_TEXT_OVERLAY_HALIGN_RIGHT: align text right
49 * @GST_BASE_TEXT_OVERLAY_HALIGN_POS: position text according to the #GstBaseTextOverlay:xpos property
51 * Horizontal alignment of the text.
53 /* FIXME 0.11: remove GST_BASE_TEXT_OVERLAY_HALIGN_UNUSED */
55 GST_BASE_TEXT_OVERLAY_HALIGN_LEFT,
56 GST_BASE_TEXT_OVERLAY_HALIGN_CENTER,
57 GST_BASE_TEXT_OVERLAY_HALIGN_RIGHT,
58 GST_BASE_TEXT_OVERLAY_HALIGN_UNUSED,
59 GST_BASE_TEXT_OVERLAY_HALIGN_POS
60 } GstBaseTextOverlayHAlign;
63 * GstBaseTextOverlayWrapMode:
64 * @GST_BASE_TEXT_OVERLAY_WRAP_MODE_NONE: no wrapping
65 * @GST_BASE_TEXT_OVERLAY_WRAP_MODE_WORD: do word wrapping
66 * @GST_BASE_TEXT_OVERLAY_WRAP_MODE_CHAR: do char wrapping
67 * @GST_BASE_TEXT_OVERLAY_WRAP_MODE_WORD_CHAR: do word and char wrapping
69 * Whether to wrap the text and if so how.
72 GST_BASE_TEXT_OVERLAY_WRAP_MODE_NONE = -1,
73 GST_BASE_TEXT_OVERLAY_WRAP_MODE_WORD = PANGO_WRAP_WORD,
74 GST_BASE_TEXT_OVERLAY_WRAP_MODE_CHAR = PANGO_WRAP_CHAR,
75 GST_BASE_TEXT_OVERLAY_WRAP_MODE_WORD_CHAR = PANGO_WRAP_WORD_CHAR
76 } GstBaseTextOverlayWrapMode;
79 * GstBaseTextOverlayLineAlign:
80 * @GST_BASE_TEXT_OVERLAY_LINE_ALIGN_LEFT: lines are left-aligned
81 * @GST_BASE_TEXT_OVERLAY_LINE_ALIGN_CENTER: lines are center-aligned
82 * @GST_BASE_TEXT_OVERLAY_LINE_ALIGN_RIGHT: lines are right-aligned
84 * Alignment of text lines relative to each other
87 GST_BASE_TEXT_OVERLAY_LINE_ALIGN_LEFT = PANGO_ALIGN_LEFT,
88 GST_BASE_TEXT_OVERLAY_LINE_ALIGN_CENTER = PANGO_ALIGN_CENTER,
89 GST_BASE_TEXT_OVERLAY_LINE_ALIGN_RIGHT = PANGO_ALIGN_RIGHT
90 } GstBaseTextOverlayLineAlign;
95 * Opaque textoverlay object structure
97 struct _GstBaseTextOverlay {
100 GstPad *video_sinkpad;
101 GstPad *text_sinkpad;
105 GstSegment text_segment;
106 GstBuffer *text_buffer;
107 gboolean text_linked;
108 gboolean video_flushing;
110 gboolean text_flushing;
113 GCond *cond; /* to signal removal of a queued text
114 * buffer, arrival of a text buffer,
115 * a text segment update, or a change
116 * in status (e.g. shutdown, flushing) */
119 GstVideoFormat format;
123 GstBaseTextOverlayVAlign valign;
124 GstBaseTextOverlayHAlign halign;
125 GstBaseTextOverlayWrapMode wrap_mode;
126 GstBaseTextOverlayLineAlign line_align;
135 gboolean want_shading;
138 guint color, outline_color;
141 gdouble shadow_offset;
142 gdouble outline_offset;
148 gboolean auto_adjust_size;
149 gboolean need_render;
151 gint shading_value; /* for timeoverlay subclass */
153 gboolean have_pango_markup;
154 gboolean use_vertical_render;
157 struct _GstBaseTextOverlayClass {
158 GstElementClass parent_class;
160 PangoContext *pango_context;
163 gchar * (*get_text) (GstBaseTextOverlay *overlay, GstBuffer *video_frame);
166 GType gst_base_text_overlay_get_type(void) G_GNUC_CONST;
170 #endif /* __GST_BASE_TEXT_OVERLAY_H */