• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * GStreamer
3  * Copyright (C) 2009 Sebastian Pölsterl <sebp@k-d-w.org>
4  * Copyright (C) 2010 Andoni Morales Alastruey <ylatuya@gmail.com>
5  *
6  * This library is free software; you can redistribute it and/or
7  * mod1ify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  * Boston, MA  02110-1301  USA
20  */
21 
22 #ifndef __GST_TELETEXTDEC_H__
23 #define __GST_TELETEXTDEC_H__
24 
25 #include <gst/gst.h>
26 #include <libzvbi.h>
27 
28 G_BEGIN_DECLS
29 #define GST_TYPE_TELETEXTDEC \
30   (gst_teletextdec_get_type())
31 #define GST_TELETEXTDEC(obj) \
32   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_TELETEXTDEC,GstTeletextDec))
33 #define GST_TELETEXTDEC_CLASS(klass) \
34   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_TELETEXTDEC,GstTeletextDecClass))
35 #define GST_IS_TELETEXTDEC(obj) \
36   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_TELETEXTDEC))
37 #define GST_IS_TELETEXTDEC_CLASS(klass) \
38   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_TELETEXTDEC))
39 typedef struct _GstTeletextDec GstTeletextDec;
40 typedef struct _GstTeletextDecClass GstTeletextDecClass;
41 typedef struct _GstTeletextFrame GstTeletextFrame;
42 typedef enum _GstTeletextOutputFormat GstTeletextOutputFormat;
43 
44 typedef GstFlowReturn (*GstTeletextExportFunc) (GstTeletextDec * teletext,
45     vbi_page * page, GstBuffer ** buf);
46 
47 struct _GstTeletextDec
48 {
49   GstElement element;
50 
51   GstPad *sinkpad;
52   GstPad *srcpad;
53   GstEvent *segment;
54 
55   GstClockTime in_timestamp;
56   GstClockTime in_duration;
57   gint rate_numerator;
58   gint rate_denominator;
59 
60   /* Props */
61   gint pageno;
62   gint subno;
63   gboolean subtitles_mode;
64   gchar *subtitles_template;
65   gchar *font_description;
66 
67   vbi_decoder *decoder;
68 
69   GQueue *queue;
70   GMutex queue_lock;
71 
72   GstTeletextFrame *frame;
73   float last_ts;
74 
75   GstTeletextExportFunc export_func;
76 
77   /* negotiated size of the output image in RGBA mode. */
78   guint width;
79   guint height;
80 
81   /* buffer pool received from the peer pad - used in RGBA output only. */
82   GstBufferPool *buf_pool;
83 };
84 
85 struct _GstTeletextFrame
86 {
87   vbi_sliced *sliced_begin;
88   vbi_sliced *sliced_end;
89   vbi_sliced *current_slice;
90 
91   guint last_field;
92   guint last_field_line;
93   guint last_frame_line;
94 };
95 
96 
97 struct _GstTeletextDecClass
98 {
99   GstElementClass parent_class;
100 };
101 
102 GType gst_teletextdec_get_type (void);
103 
104 G_END_DECLS
105 #endif /* __GST_TELETEXTDEC_H__ */
106