summaryrefslogtreecommitdiff
path: root/gst/playback/gstsubtitleoverlay.h
blob: 8d1fe05fa949daad40dcbd34b1671983040fe86f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/* GStreamer
 * Copyright (C) 2009 Sebastian Dröge <sebastian.droege@collabora.co.uk>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

#ifndef __GST_SUBTITLE_OVERLAY_H__
#define __GST_SUBTITLE_OVERLAY_H__

#include <gst/gst.h>

G_BEGIN_DECLS
#define GST_TYPE_SUBTITLE_OVERLAY \
  (gst_subtitle_overlay_get_type())
#define GST_SUBTITLE_OVERLAY(obj) \
  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_SUBTITLE_OVERLAY, GstSubtitleOverlay))
#define GST_SUBTITLE_OVERLAY_CAST(obj) \
  ((GstSubtitleOverlay *) obj)
#define GST_SUBTITLE_OVERLAY_CLASS(klass) \
  (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_SUBTITLE_OVERLAY, GstSubtitleOverlayClass))
#define GST_IS_SUBTITLE_OVERLAY(obj) \
  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_SUBTITLE_OVERLAY))
#define GST_IS_SUBTITLE_OVERLAY_CLASS(klass) \
  (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_SUBTITLE_OVERLAY))

#define GST_SUBTITLE_OVERLAY_LOCK(obj) G_STMT_START {                   \
    GST_LOG_OBJECT (obj,                                                \
                    "locking from thread %p",                           \
                    g_thread_self ());                                  \
    g_mutex_lock (GST_SUBTITLE_OVERLAY_CAST(obj)->lock);                \
    GST_LOG_OBJECT (obj,                                                \
                    "locked from thread %p",                            \
                    g_thread_self ());                                  \
} G_STMT_END

#define GST_SUBTITLE_OVERLAY_UNLOCK(obj) G_STMT_START {                 \
    GST_LOG_OBJECT (obj,                                                \
                    "unlocking from thread %p",                         \
                    g_thread_self ());                                  \
    g_mutex_unlock (GST_SUBTITLE_OVERLAY_CAST(obj)->lock);              \
} G_STMT_END

typedef struct _GstSubtitleOverlay GstSubtitleOverlay;
typedef struct _GstSubtitleOverlayClass GstSubtitleOverlayClass;

struct _GstSubtitleOverlay
{
  GstBin parent;

  gchar *font_desc;

  gboolean do_async;

  GstPad *srcpad;
  GstPadEventFunction src_proxy_event;

  GstPad *video_sinkpad;
  GstPad *video_block_pad;
  GstPadEventFunction video_sink_event;
  gboolean video_sink_blocked;
  GstSegment video_segment;
  gboolean video_segment_pending;

  GstPad *subtitle_sinkpad;
  GstPad *subtitle_block_pad;
  GstPadLinkFunction subtitle_sink_link;
  GstPadUnlinkFunction subtitle_sink_unlink;
  GstPadEventFunction subtitle_sink_event;
  GstPadSetCapsFunction subtitle_sink_setcaps;
  gboolean subtitle_sink_blocked;
  GstSegment subtitle_segment;
  gboolean subtitle_segment_pending;
  gboolean subtitle_flush;

  GList *factories;
  GstCaps *factory_caps;

  GMutex *lock;
  GstCaps *subcaps;

  GstElement *passthrough_identity;

  GstElement *pre_colorspace;
  GstElement *post_colorspace;

  GstElement *parser;
  GstElement *overlay;

  GstElement *renderer;
};

struct _GstSubtitleOverlayClass
{
  GstBinClass parent;
};

GType gst_subtitle_overlay_get_type (void);
gboolean gst_subtitle_overlay_plugin_init (GstPlugin * plugin);

GstCaps *gst_subtitle_overlay_create_factory_caps (void);

G_END_DECLS
#endif /* __GST_SUBTITLE_OVERLAY_H__ */