gst/subparse/: Add support for SAMI subtitles (#169936).
[platform/upstream/gstreamer.git] / 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., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20
21 #ifndef __GST_SUBPARSE_H__
22 #define __GST_SUBPARSE_H__
23
24 #include <gst/gst.h>
25
26 G_BEGIN_DECLS
27
28 #define GST_TYPE_SUBPARSE \
29   (gst_sub_parse_get_type ())
30 #define GST_SUBPARSE(obj) \
31   (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_SUBPARSE, GstSubParse))
32 #define GST_SUBPARSE_CLASS(klass) \
33   (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_SUBPARSE, GstSubParseClass))
34 #define GST_IS_SUBPARSE(obj) \
35   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_SUBPARSE))
36 #define GST_IS_SUBPARSE_CLASS(klass) \
37   (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_SUBPARSE))
38
39 typedef struct _GstSubParse GstSubParse;
40 typedef struct _GstSubParseClass GstSubParseClass;
41
42 /* format enum */
43 typedef enum
44 {
45   GST_SUB_PARSE_FORMAT_UNKNOWN = 0,
46   GST_SUB_PARSE_FORMAT_MDVDSUB = 1,
47   GST_SUB_PARSE_FORMAT_SUBRIP = 2,
48   GST_SUB_PARSE_FORMAT_MPSUB = 3,
49   GST_SUB_PARSE_FORMAT_SAMI = 4
50 } GstSubParseFormat;
51
52 typedef struct {
53   int      state;
54   GString *buf;
55   guint64  start_time;
56   guint64  duration;
57   GstSegment *segment;
58   gpointer user_data;
59 } ParserState;
60
61 typedef gchar* (*Parser) (ParserState *state, const gchar *line);
62
63 struct _GstSubParse {
64   GstElement element;
65
66   GstPad *sinkpad,*srcpad;
67
68   GString *textbuf;
69
70   GstSubParseFormat parser_type;
71   gboolean parser_detected;
72
73   Parser parse_line;
74   ParserState state;
75
76   /* seek */
77   guint64 offset;
78   guint64 next_offset;
79   
80   /* Segment */
81   GstSegment *segment;
82   GstSeekFlags  segment_flags;
83   gboolean need_segment;
84   
85   gboolean flushing;
86   gboolean valid_utf8;
87 };
88
89 struct _GstSubParseClass {
90   GstElementClass parent_class;
91 };
92
93 GType gst_sub_parse_get_type (void);
94
95 G_END_DECLS
96
97 #endif /* __GST_SUBPARSE_H__ */