Merge branch 'move_subdir_rtsp-server' into tizen_gst_1.19.2_mono
[platform/upstream/gstreamer.git] / subprojects / gst-plugins-base / gst / subparse / gstsubparse.h
1 /* GStreamer
2  * Copyright (C) <2002> David A. Schleef <ds@schleef.org>
3  * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
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
7  * License as published by the Free Software Foundation; either
8  * version 2 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 GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20
21 #ifndef __GST_SUBPARSE_H__
22 #define __GST_SUBPARSE_H__
23
24 #include <gst/gst.h>
25 #include <gst/base/gstadapter.h>
26
27 #include "gstsubparseelements.h"
28
29 G_BEGIN_DECLS
30
31 #define GST_TYPE_SUBPARSE (gst_sub_parse_get_type ())
32 G_DECLARE_FINAL_TYPE (GstSubParse, gst_sub_parse, GST, SUBPARSE, GstElement)
33
34
35 typedef struct {
36   int      state;
37   GString *buf;
38   guint64  start_time;
39   guint64  duration;
40   guint64  max_duration; /* to clamp duration, 0 = no limit (used by tmplayer parser) */
41   GstSegment *segment;
42   gpointer user_data;
43   gboolean have_internal_fps; /* If TRUE don't overwrite fps by property */
44   gint fps_n, fps_d;     /* used by frame based parsers */
45   guint8 line_position;          /* percent value */
46   gint line_number;              /* line number, can be positive or negative */
47   guint8 text_position;          /* percent value */
48   guint8 text_size;          /* percent value */
49   gchar *vertical;        /* "", "vertical", "vertical-lr" */
50   gchar *alignment;       /* "", "start", "middle", "end" */
51   gconstpointer allowed_tags; /* list of markup tags allowed in the cue text. */
52   gboolean allows_tag_attributes;
53 #ifdef TIZEN_FEATURE_SUBPARSE_MODIFICATION
54   GList* language_list;
55   gchar* current_language;
56   gboolean langlist_msg_posted;
57 #endif
58 #ifdef TIZEN_FEATURE_HLS_WEBVTT
59   guint64 local;
60   guint64 mpegts;
61 #endif
62 #ifdef TIZEN_FEATURE_SUBPARSE_DROP_OUT_OF_SEGMENT
63   gboolean drop_out_of_segment;
64 #endif
65 } ParserState;
66
67 typedef gchar* (*Parser) (ParserState *state, const gchar *line);
68
69 struct _GstSubParse {
70   GstElement element;
71
72   GstPad *sinkpad,*srcpad;
73
74   /* contains the input in the input encoding */
75   GstAdapter *adapter;
76   /* contains the UTF-8 decoded input */
77   GString *textbuf;
78
79   GstSubParseFormat parser_type;
80   gboolean parser_detected;
81   const gchar *subtitle_codec;
82
83   Parser parse_line;
84   ParserState state;
85
86   /* seek */
87   guint64 offset;
88
89   /* Segment */
90   GstSegment    segment;
91   gboolean      need_segment;
92
93   gboolean flushing;
94   gboolean valid_utf8;
95   gchar   *detected_encoding;
96   gchar   *encoding;
97   gboolean strip_pango_markup;
98
99   gboolean first_buffer;
100
101   /* used by frame based parsers */
102   gint fps_n, fps_d;
103 #ifdef TIZEN_FEATURE_SUBPARSE_MODIFICATION
104   GMutex seek_lock;
105 #endif
106 };
107
108 G_END_DECLS
109
110 #endif /* __GST_SUBPARSE_H__ */