1 /* GStreamer DVB subtitles overlay
2  * Copyright (c) 2010 Mart Raudsepp <mart.raudsepp@collabora.co.uk>
3  * Copyright (c) 2010 ONELAN Ltd.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public License
16  * along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA.
18  */
19 
20 #ifndef __GST_DVBSUB_OVERLAY_H__
21 #define __GST_DVBSUB_OVERLAY_H__
22 
23 #include <gst/gst.h>
24 #include <gst/video/video.h>
25 #include <gst/video/video-overlay-composition.h>
26 
27 #include "dvb-sub.h"
28 
29 G_BEGIN_DECLS
30 
31 #define GST_TYPE_DVBSUB_OVERLAY (gst_dvbsub_overlay_get_type())
32 #define GST_DVBSUB_OVERLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DVBSUB_OVERLAY,GstDVBSubOverlay))
33 #define GST_DVBSUB_OVERLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DVBSUB_OVERLAY,GstDVBSubOverlayClass))
34 #define GST_IS_DVBSUB_OVERLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DVBSUB_OVERLAY))
35 #define GST_IS_DVBSUB_OVERLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DVBSUB_OVERLAY))
36 
37 typedef struct _GstDVBSubOverlay GstDVBSubOverlay;
38 typedef struct _GstDVBSubOverlayClass GstDVBSubOverlayClass;
39 
40 struct _GstDVBSubOverlay
41 {
42   GstElement element;
43 
44   GstPad *video_sinkpad, *text_sinkpad, *srcpad;
45 
46   /* properties */
47   gboolean enable;
48   gint max_page_timeout;
49   gboolean force_end;
50 
51   /* <private> */
52   GstSegment video_segment;
53   GstSegment subtitle_segment;
54 
55   GstVideoInfo info;
56 
57   DVBSubtitles *current_subtitle; /* The currently active set of subtitle regions, if any */
58   GstVideoOverlayComposition *current_comp;
59   GQueue *pending_subtitles; /* A queue of raw subtitle region sets with
60 			      * metadata that are waiting their running time */
61 
62   GMutex dvbsub_mutex; /* protects the queue and the DvbSub instance */
63   DvbSub *dvb_sub;
64 
65   /* subtitle data submitted to dvb_sub but no sub received yet */
66   gboolean pending_sub;
67   /* last text pts */
68   GstClockTime last_text_pts;
69 
70   gboolean attach_compo_to_buffer;
71 };
72 
73 struct _GstDVBSubOverlayClass
74 {
75   GstElementClass parent_class;
76 };
77 
78 GType gst_dvbsub_overlay_get_type (void);
79 
80 G_END_DECLS
81 
82 #endif
83