ssaparse: ignore invalid UTF-8 in init section
[platform/upstream/gstreamer.git] / gst / subparse / gstsubparse.h
index 6757aad..2da2012 100644 (file)
  *
  * You should have received a copy of the GNU Library General Public
  * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
  */
 
 #ifndef __GST_SUBPARSE_H__
 #define __GST_SUBPARSE_H__
 
 #include <gst/gst.h>
+#include <gst/base/gstadapter.h>
+
+GST_DEBUG_CATEGORY_EXTERN (sub_parse_debug);
+#define GST_CAT_DEFAULT sub_parse_debug
 
 G_BEGIN_DECLS
 
@@ -30,10 +34,10 @@ G_BEGIN_DECLS
 #define GST_SUBPARSE(obj) \
   (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_SUBPARSE, GstSubParse))
 #define GST_SUBPARSE_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_SUBPARSE, GstSubParse))
+  (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_SUBPARSE, GstSubParseClass))
 #define GST_IS_SUBPARSE(obj) \
   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_SUBPARSE))
-#define GST_IS_SUBPARSE_CLASS(obj) \
+#define GST_IS_SUBPARSE_CLASS(klass) \
   (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_SUBPARSE))
 
 typedef struct _GstSubParse GstSubParse;
@@ -45,7 +49,13 @@ typedef enum
   GST_SUB_PARSE_FORMAT_UNKNOWN = 0,
   GST_SUB_PARSE_FORMAT_MDVDSUB = 1,
   GST_SUB_PARSE_FORMAT_SUBRIP = 2,
-  GST_SUB_PARSE_FORMAT_MPSUB = 3
+  GST_SUB_PARSE_FORMAT_MPSUB = 3,
+  GST_SUB_PARSE_FORMAT_SAMI = 4,
+  GST_SUB_PARSE_FORMAT_TMPLAYER = 5,
+  GST_SUB_PARSE_FORMAT_MPL2 = 6,
+  GST_SUB_PARSE_FORMAT_SUBVIEWER = 7,
+  GST_SUB_PARSE_FORMAT_DKS = 8,
+  GST_SUB_PARSE_FORMAT_QTTEXT = 9
 } GstSubParseFormat;
 
 typedef struct {
@@ -53,7 +63,11 @@ typedef struct {
   GString *buf;
   guint64  start_time;
   guint64  duration;
+  guint64  max_duration; /* to clamp duration, 0 = no limit (used by tmplayer parser) */
   GstSegment *segment;
+  gpointer user_data;
+  gboolean have_internal_fps; /* If TRUE don't overwrite fps by property */
+  gint fps_n, fps_d;     /* used by frame based parsers */
 } ParserState;
 
 typedef gchar* (*Parser) (ParserState *state, const gchar *line);
@@ -63,10 +77,14 @@ struct _GstSubParse {
 
   GstPad *sinkpad,*srcpad;
 
+  /* contains the input in the input encoding */
+  GstAdapter *adapter;
+  /* contains the UTF-8 decoded input */
   GString *textbuf;
 
   GstSubParseFormat parser_type;
   gboolean parser_detected;
+  const gchar *subtitle_codec;
 
   Parser parse_line;
   ParserState state;
@@ -76,12 +94,18 @@ struct _GstSubParse {
   guint64 next_offset;
   
   /* Segment */
-  GstSegment *segment;
-  GstSeekFlags  segment_flags;
-  gboolean need_segment;
+  GstSegment    segment;
+  gboolean      need_segment;
   
   gboolean flushing;
   gboolean valid_utf8;
+  gchar   *detected_encoding;
+  gchar   *encoding;
+
+  gboolean first_buffer;
+
+  /* used by frame based parsers */
+  gint fps_n, fps_d;          
 };
 
 struct _GstSubParseClass {