gst_plugins_base/gst/subparse/gstsubparse.h
changeset 2 5505e8908944
parent 0 0e761a78d257
child 7 567bb019e3e3
equal deleted inserted replaced
1:4c282e7dd6d3 2:5505e8908944
       
     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 GST_DEBUG_CATEGORY_EXTERN (sub_parse_debug);
       
    27 #define GST_CAT_DEFAULT sub_parse_debug
       
    28 
       
    29 G_BEGIN_DECLS
       
    30 
       
    31 #define GST_TYPE_SUBPARSE \
       
    32   (gst_sub_parse_get_type ())
       
    33 #define GST_SUBPARSE(obj) \
       
    34   (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_SUBPARSE, GstSubParse))
       
    35 #define GST_SUBPARSE_CLASS(klass) \
       
    36   (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_SUBPARSE, GstSubParseClass))
       
    37 #define GST_IS_SUBPARSE(obj) \
       
    38   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_SUBPARSE))
       
    39 #define GST_IS_SUBPARSE_CLASS(klass) \
       
    40   (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_SUBPARSE))
       
    41 
       
    42 typedef struct _GstSubParse GstSubParse;
       
    43 typedef struct _GstSubParseClass GstSubParseClass;
       
    44 
       
    45 /* format enum */
       
    46 typedef enum
       
    47 {
       
    48   GST_SUB_PARSE_FORMAT_UNKNOWN = 0,
       
    49   GST_SUB_PARSE_FORMAT_MDVDSUB = 1,
       
    50   GST_SUB_PARSE_FORMAT_SUBRIP = 2,
       
    51   GST_SUB_PARSE_FORMAT_MPSUB = 3,
       
    52   GST_SUB_PARSE_FORMAT_SAMI = 4,
       
    53   GST_SUB_PARSE_FORMAT_TMPLAYER = 5,
       
    54   GST_SUB_PARSE_FORMAT_MPL2 = 6,
       
    55   GST_SUB_PARSE_FORMAT_SUBVIEWER = 7
       
    56 } GstSubParseFormat;
       
    57 
       
    58 typedef struct {
       
    59   int      state;
       
    60   GString *buf;
       
    61   guint64  start_time;
       
    62   guint64  duration;
       
    63   GstSegment *segment;
       
    64   gpointer user_data;
       
    65   gdouble  fps;          /* used by microdvd parser */
       
    66 } ParserState;
       
    67 
       
    68 typedef gchar* (*Parser) (ParserState *state, const gchar *line);
       
    69 
       
    70 struct _GstSubParse {
       
    71   GstElement element;
       
    72 
       
    73   GstPad *sinkpad,*srcpad;
       
    74 
       
    75   GString *textbuf;
       
    76 
       
    77   GstSubParseFormat parser_type;
       
    78   gboolean parser_detected;
       
    79 
       
    80   Parser parse_line;
       
    81   ParserState state;
       
    82 
       
    83   /* seek */
       
    84   guint64 offset;
       
    85   guint64 next_offset;
       
    86   
       
    87   /* Segment */
       
    88   GstSegment    segment;
       
    89   GstSeekFlags  segment_flags;
       
    90   gboolean      need_segment;
       
    91   
       
    92   gboolean flushing;
       
    93   gboolean valid_utf8;
       
    94   gchar   *encoding;
       
    95 };
       
    96 
       
    97 struct _GstSubParseClass {
       
    98   GstElementClass parent_class;
       
    99 };
       
   100 #ifdef __SYMBIAN32__
       
   101 IMPORT_C
       
   102 #endif
       
   103 
       
   104 
       
   105 GType gst_sub_parse_get_type (void);
       
   106 
       
   107 G_END_DECLS
       
   108 
       
   109 #endif /* __GST_SUBPARSE_H__ */