gsttextoverlay.h 3.15 KB
Newer Older
1
2
#ifndef __GST_TEXT_OVERLAY_H__
#define __GST_TEXT_OVERLAY_H__
3
4
5
6
7

#include <gst/gst.h>
#include <pango/pangoft2.h>

G_BEGIN_DECLS
Johan Dahlin's avatar
Johan Dahlin committed
8

9
10
11
12
13
14
15
16
17
18
19
#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_TEXT_OVERLAY,GstTextOverlayClass))
#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(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),\
                                         GST_TYPE_TEXT_OVERLAY))
Johan Dahlin's avatar
Johan Dahlin committed
20
21

typedef struct _GstTextOverlay      GstTextOverlay;
22
23
typedef struct _GstTextOverlayClass GstTextOverlayClass;

24
25
26
typedef enum _GstTextOverlayVAlign   GstTextOverlayVAlign;
typedef enum _GstTextOverlayHAlign   GstTextOverlayHAlign;
typedef enum _GstTextOverlayWrapMode GstTextOverlayWrapMode;
27

Johan Dahlin's avatar
Johan Dahlin committed
28
29
30
enum _GstTextOverlayVAlign {
    GST_TEXT_OVERLAY_VALIGN_BASELINE,
    GST_TEXT_OVERLAY_VALIGN_BOTTOM,
31
    GST_TEXT_OVERLAY_VALIGN_TOP
32
33
};

Johan Dahlin's avatar
Johan Dahlin committed
34
35
36
enum _GstTextOverlayHAlign {
    GST_TEXT_OVERLAY_HALIGN_LEFT,
    GST_TEXT_OVERLAY_HALIGN_CENTER,
37
    GST_TEXT_OVERLAY_HALIGN_RIGHT
38
39
};

40
41
42
43
44
45
46
enum _GstTextOverlayWrapMode {
    GST_TEXT_OVERLAY_WRAP_MODE_NONE = -1,
    GST_TEXT_OVERLAY_WRAP_MODE_WORD = PANGO_WRAP_WORD,
    GST_TEXT_OVERLAY_WRAP_MODE_CHAR = PANGO_WRAP_CHAR,
    GST_TEXT_OVERLAY_WRAP_MODE_WORD_CHAR = PANGO_WRAP_WORD_CHAR
};

47

Johan Dahlin's avatar
Johan Dahlin committed
48
struct _GstTextOverlay {
49
50
51
52
53
54
    GstElement               element;

    GstPad                  *video_sinkpad;
    GstPad                  *text_sinkpad;
    GstPad                  *srcpad;

55
56
57
58
59
    GstSegment              *segment;
    GstBuffer               *text_buffer;
    gboolean                text_linked;
  
    GCond                   *cond;  /* to signal removal of data */
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81

    gint                     width;
    gint                     height;
    gint                     fps_n;
    gint                     fps_d;

    GstTextOverlayVAlign     valign;
    GstTextOverlayHAlign     halign;
    GstTextOverlayWrapMode   wrap_mode;

    gint                     xpad;
    gint                     ypad;
    gint                     deltax;
    gint                     deltay;
    gchar                   *default_text;
    gboolean                 want_shading;

    PangoLayout             *layout;
    FT_Bitmap                bitmap;
    gint                     bitmap_buffer_size;
    gint                     baseline_y;

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
82
    gboolean                 need_render;
83
84

    gint                     shading_value;  /* for timeoverlay subclass */
85
86
};

Johan Dahlin's avatar
Johan Dahlin committed
87
88
struct _GstTextOverlayClass {
    GstElementClass parent_class;
89

Johan Dahlin's avatar
Johan Dahlin committed
90
    PangoContext *pango_context;
91
92
93

    gchar *     (*get_text) (GstTextOverlay *overlay, GstBuffer *video_frame);

94
95
};

96
GType gst_text_overlay_get_type(void) G_GNUC_CONST;
97
98

G_END_DECLS
Johan Dahlin's avatar
Johan Dahlin committed
99

100
#endif /* __GST_TEXT_OVERLAY_H */