1 #ifndef __GST_BASE_TEXT_OVERLAY_H__
2 #define __GST_BASE_TEXT_OVERLAY_H__
5 #include <gst/video/video.h>
6 #include <pango/pangocairo.h>
10 #define GST_TYPE_BASE_TEXT_OVERLAY (gst_base_text_overlay_get_type())
11 #define GST_BASE_TEXT_OVERLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),\
12 GST_TYPE_BASE_TEXT_OVERLAY, GstBaseTextOverlay))
13 #define GST_BASE_TEXT_OVERLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),\
14 GST_TYPE_BASE_TEXT_OVERLAY,GstBaseTextOverlayClass))
15 #define GST_BASE_TEXT_OVERLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),\
16 GST_TYPE_BASE_TEXT_OVERLAY, GstBaseTextOverlayClass))
17 #define GST_IS_BASE_TEXT_OVERLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),\
18 GST_TYPE_BASE_TEXT_OVERLAY))
19 #define GST_IS_BASE_TEXT_OVERLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),\
20 GST_TYPE_BASE_TEXT_OVERLAY))
22 typedef struct _GstBaseTextOverlay GstBaseTextOverlay;
23 typedef struct _GstBaseTextOverlayClass GstBaseTextOverlayClass;
26 * GstBaseTextOverlayVAlign:
27 * @GST_BASE_TEXT_OVERLAY_VALIGN_BASELINE: draw text on the baseline
28 * @GST_BASE_TEXT_OVERLAY_VALIGN_BOTTOM: draw text on the bottom
29 * @GST_BASE_TEXT_OVERLAY_VALIGN_TOP: draw text on top
30 * @GST_BASE_TEXT_OVERLAY_VALIGN_POS: draw text according to the #GstBaseTextOverlay:ypos property
31 * @GST_BASE_TEXT_OVERLAY_VALIGN_CENTER: draw text vertically centered
33 * Vertical alignment of the text.
36 GST_BASE_TEXT_OVERLAY_VALIGN_BASELINE,
37 GST_BASE_TEXT_OVERLAY_VALIGN_BOTTOM,
38 GST_BASE_TEXT_OVERLAY_VALIGN_TOP,
39 GST_BASE_TEXT_OVERLAY_VALIGN_POS,
40 GST_BASE_TEXT_OVERLAY_VALIGN_CENTER
41 } GstBaseTextOverlayVAlign;
44 * GstBaseTextOverlayHAlign:
45 * @GST_BASE_TEXT_OVERLAY_HALIGN_LEFT: align text left
46 * @GST_BASE_TEXT_OVERLAY_HALIGN_CENTER: align text center
47 * @GST_BASE_TEXT_OVERLAY_HALIGN_RIGHT: align text right
48 * @GST_BASE_TEXT_OVERLAY_HALIGN_POS: position text according to the #GstBaseTextOverlay:xpos property
50 * Horizontal alignment of the text.
52 /* FIXME 0.11: remove GST_BASE_TEXT_OVERLAY_HALIGN_UNUSED */
54 GST_BASE_TEXT_OVERLAY_HALIGN_LEFT,
55 GST_BASE_TEXT_OVERLAY_HALIGN_CENTER,
56 GST_BASE_TEXT_OVERLAY_HALIGN_RIGHT,
57 GST_BASE_TEXT_OVERLAY_HALIGN_UNUSED,
58 GST_BASE_TEXT_OVERLAY_HALIGN_POS
59 } GstBaseTextOverlayHAlign;
62 * GstBaseTextOverlayWrapMode:
63 * @GST_BASE_TEXT_OVERLAY_WRAP_MODE_NONE: no wrapping
64 * @GST_BASE_TEXT_OVERLAY_WRAP_MODE_WORD: do word wrapping
65 * @GST_BASE_TEXT_OVERLAY_WRAP_MODE_CHAR: do char wrapping
66 * @GST_BASE_TEXT_OVERLAY_WRAP_MODE_WORD_CHAR: do word and char wrapping
68 * Whether to wrap the text and if so how.
71 GST_BASE_TEXT_OVERLAY_WRAP_MODE_NONE = -1,
72 GST_BASE_TEXT_OVERLAY_WRAP_MODE_WORD = PANGO_WRAP_WORD,
73 GST_BASE_TEXT_OVERLAY_WRAP_MODE_CHAR = PANGO_WRAP_CHAR,
74 GST_BASE_TEXT_OVERLAY_WRAP_MODE_WORD_CHAR = PANGO_WRAP_WORD_CHAR
75 } GstBaseTextOverlayWrapMode;
78 * GstBaseTextOverlayLineAlign:
79 * @GST_BASE_TEXT_OVERLAY_LINE_ALIGN_LEFT: lines are left-aligned
80 * @GST_BASE_TEXT_OVERLAY_LINE_ALIGN_CENTER: lines are center-aligned
81 * @GST_BASE_TEXT_OVERLAY_LINE_ALIGN_RIGHT: lines are right-aligned
83 * Alignment of text lines relative to each other
86 GST_BASE_TEXT_OVERLAY_LINE_ALIGN_LEFT = PANGO_ALIGN_LEFT,
87 GST_BASE_TEXT_OVERLAY_LINE_ALIGN_CENTER = PANGO_ALIGN_CENTER,
88 GST_BASE_TEXT_OVERLAY_LINE_ALIGN_RIGHT = PANGO_ALIGN_RIGHT
89 } GstBaseTextOverlayLineAlign;
94 * Opaque textoverlay object structure
96 struct _GstBaseTextOverlay {
99 GstPad *video_sinkpad;
100 GstPad *text_sinkpad;
104 GstSegment text_segment;
105 GstBuffer *text_buffer;
106 gboolean text_linked;
107 gboolean video_flushing;
109 gboolean text_flushing;
112 GCond cond; /* to signal removal of a queued text
113 * buffer, arrival of a text buffer,
114 * a text segment update, or a change
115 * in status (e.g. shutdown, flushing) */
118 GstVideoFormat format;
122 GstBaseTextOverlayVAlign valign;
123 GstBaseTextOverlayHAlign halign;
124 GstBaseTextOverlayWrapMode wrap_mode;
125 GstBaseTextOverlayLineAlign line_align;
134 gboolean want_shading;
137 guint color, outline_color;
140 gdouble shadow_offset;
141 gdouble outline_offset;
147 gboolean auto_adjust_size;
148 gboolean need_render;
150 gint shading_value; /* for timeoverlay subclass */
152 gboolean have_pango_markup;
153 gboolean use_vertical_render;
156 struct _GstBaseTextOverlayClass {
157 GstElementClass parent_class;
159 PangoContext *pango_context;
162 gchar * (*get_text) (GstBaseTextOverlay *overlay, GstBuffer *video_frame);
165 GType gst_base_text_overlay_get_type(void) G_GNUC_CONST;
169 #endif /* __GST_BASE_TEXT_OVERLAY_H */