Blame gst/subparse/gstsubparse.h

Packit 971217
/* GStreamer
Packit 971217
 * Copyright (C) <2002> David A. Schleef <ds@schleef.org>
Packit 971217
 * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
Packit 971217
 *
Packit 971217
 * This library is free software; you can redistribute it and/or
Packit 971217
 * modify it under the terms of the GNU Library General Public
Packit 971217
 * License as published by the Free Software Foundation; either
Packit 971217
 * version 2 of the License, or (at your option) any later version.
Packit 971217
 *
Packit 971217
 * This library is distributed in the hope that it will be useful,
Packit 971217
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 971217
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 971217
 * Library General Public License for more details.
Packit 971217
 *
Packit 971217
 * You should have received a copy of the GNU Library General Public
Packit 971217
 * License along with this library; if not, write to the
Packit 971217
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Packit 971217
 * Boston, MA 02110-1301, USA.
Packit 971217
 */
Packit 971217
Packit 971217
#ifndef __GST_SUBPARSE_H__
Packit 971217
#define __GST_SUBPARSE_H__
Packit 971217
Packit 971217
#include <gst/gst.h>
Packit 971217
#include <gst/base/gstadapter.h>
Packit 971217
Packit 971217
GST_DEBUG_CATEGORY_EXTERN (sub_parse_debug);
Packit 971217
#define GST_CAT_DEFAULT sub_parse_debug
Packit 971217
Packit 971217
G_BEGIN_DECLS
Packit 971217
Packit 971217
#define GST_TYPE_SUBPARSE \
Packit 971217
  (gst_sub_parse_get_type ())
Packit 971217
#define GST_SUBPARSE(obj) \
Packit 971217
  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_SUBPARSE, GstSubParse))
Packit 971217
#define GST_SUBPARSE_CLASS(klass) \
Packit 971217
  (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_SUBPARSE, GstSubParseClass))
Packit 971217
#define GST_IS_SUBPARSE(obj) \
Packit 971217
  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_SUBPARSE))
Packit 971217
#define GST_IS_SUBPARSE_CLASS(klass) \
Packit 971217
  (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_SUBPARSE))
Packit 971217
Packit 971217
typedef struct _GstSubParse GstSubParse;
Packit 971217
typedef struct _GstSubParseClass GstSubParseClass;
Packit 971217
Packit 971217
/* format enum */
Packit 971217
typedef enum
Packit 971217
{
Packit 971217
  GST_SUB_PARSE_FORMAT_UNKNOWN = 0,
Packit 971217
  GST_SUB_PARSE_FORMAT_MDVDSUB = 1,
Packit 971217
  GST_SUB_PARSE_FORMAT_SUBRIP = 2,
Packit 971217
  GST_SUB_PARSE_FORMAT_MPSUB = 3,
Packit 971217
  GST_SUB_PARSE_FORMAT_SAMI = 4,
Packit 971217
  GST_SUB_PARSE_FORMAT_TMPLAYER = 5,
Packit 971217
  GST_SUB_PARSE_FORMAT_MPL2 = 6,
Packit 971217
  GST_SUB_PARSE_FORMAT_SUBVIEWER = 7,
Packit 971217
  GST_SUB_PARSE_FORMAT_DKS = 8,
Packit 971217
  GST_SUB_PARSE_FORMAT_QTTEXT = 9,
Packit 971217
  GST_SUB_PARSE_FORMAT_LRC = 10,
Packit 971217
  GST_SUB_PARSE_FORMAT_VTT = 11
Packit 971217
} GstSubParseFormat;
Packit 971217
Packit 971217
typedef struct {
Packit 971217
  int      state;
Packit 971217
  GString *buf;
Packit 971217
  guint64  start_time;
Packit 971217
  guint64  duration;
Packit 971217
  guint64  max_duration; /* to clamp duration, 0 = no limit (used by tmplayer parser) */
Packit 971217
  GstSegment *segment;
Packit 971217
  gpointer user_data;
Packit 971217
  gboolean have_internal_fps; /* If TRUE don't overwrite fps by property */
Packit 971217
  gint fps_n, fps_d;     /* used by frame based parsers */
Packit 971217
  guint8 line_position;          /* percent value */
Packit 971217
  gint line_number;              /* line number, can be positive or negative */
Packit 971217
  guint8 text_position;          /* percent value */
Packit 971217
  guint8 text_size;          /* percent value */
Packit 971217
  gchar *vertical;        /* "", "vertical", "vertical-lr" */
Packit 971217
  gchar *alignment;       /* "", "start", "middle", "end" */
Packit 971217
  gconstpointer allowed_tags; /* list of markup tags allowed in the cue text. */
Packit 971217
  gboolean allows_tag_attributes;
Packit 971217
} ParserState;
Packit 971217
Packit 971217
typedef gchar* (*Parser) (ParserState *state, const gchar *line);
Packit 971217
Packit 971217
struct _GstSubParse {
Packit 971217
  GstElement element;
Packit 971217
Packit 971217
  GstPad *sinkpad,*srcpad;
Packit 971217
Packit 971217
  /* contains the input in the input encoding */
Packit 971217
  GstAdapter *adapter;
Packit 971217
  /* contains the UTF-8 decoded input */
Packit 971217
  GString *textbuf;
Packit 971217
Packit 971217
  GstSubParseFormat parser_type;
Packit 971217
  gboolean parser_detected;
Packit 971217
  const gchar *subtitle_codec;
Packit 971217
Packit 971217
  Parser parse_line;
Packit 971217
  ParserState state;
Packit 971217
Packit 971217
  /* seek */
Packit 971217
  guint64 offset;
Packit 971217
  
Packit 971217
  /* Segment */
Packit 971217
  GstSegment    segment;
Packit 971217
  gboolean      need_segment;
Packit 971217
  
Packit 971217
  gboolean flushing;
Packit 971217
  gboolean valid_utf8;
Packit 971217
  gchar   *detected_encoding;
Packit 971217
  gchar   *encoding;
Packit 971217
Packit 971217
  gboolean first_buffer;
Packit 971217
Packit 971217
  /* used by frame based parsers */
Packit 971217
  gint fps_n, fps_d;          
Packit 971217
};
Packit 971217
Packit 971217
struct _GstSubParseClass {
Packit 971217
  GstElementClass parent_class;
Packit 971217
};
Packit 971217
Packit 971217
GType gst_sub_parse_get_type (void);
Packit 971217
Packit 971217
G_END_DECLS
Packit 971217
Packit 971217
#endif /* __GST_SUBPARSE_H__ */