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 } ParserState; 54 55 typedef gchar* (*Parser) (ParserState *state, const gchar *line); 56 57 struct _GstSubParse { 58 GstElement element; 59 60 GstPad *sinkpad,*srcpad; 61 62 /* contains the input in the input encoding */ 63 GstAdapter *adapter; 64 /* contains the UTF-8 decoded input */ 65 GString *textbuf; 66 67 GstSubParseFormat parser_type; 68 gboolean parser_detected; 69 const gchar *subtitle_codec; 70 71 Parser parse_line; 72 ParserState state; 73 74 /* seek */ 75 guint64 offset; 76 77 /* Segment */ 78 GstSegment segment; 79 gboolean need_segment; 80 81 gboolean flushing; 82 gboolean valid_utf8; 83 gchar *detected_encoding; 84 gchar *encoding; 85 gboolean strip_pango_markup; 86 87 gboolean first_buffer; 88 89 /* used by frame based parsers */ 90 gint fps_n, fps_d; 91 }; 92 93 G_END_DECLS 94 95 #endif /* __GST_SUBPARSE_H__ */ 96