flvdemux: Skip unknown tags in push-mode
[platform/upstream/gst-plugins-good.git] / gst / flv / gstflvdemux.h
1 /* GStreamer
2  * Copyright (C) <2007> Julien Moutte <julien@moutte.net>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19
20 #ifndef __FLV_DEMUX_H__
21 #define __FLV_DEMUX_H__
22
23 #include <gst/gst.h>
24 #include <gst/base/gstadapter.h>
25 #include "gstindex.h"
26
27 G_BEGIN_DECLS
28 #define GST_TYPE_FLV_DEMUX \
29   (gst_flv_demux_get_type())
30 #define GST_FLV_DEMUX(obj) \
31   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_FLV_DEMUX,GstFlvDemux))
32 #define GST_FLV_DEMUX_CLASS(klass) \
33   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_FLV_DEMUX,GstFlvDemuxClass))
34 #define GST_IS_FLV_DEMUX(obj) \
35   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FLV_DEMUX))
36 #define GST_IS_FLV_DEMUX_CLASS(klass) \
37   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FLV_DEMUX))
38 typedef struct _GstFlvDemux GstFlvDemux;
39 typedef struct _GstFlvDemuxClass GstFlvDemuxClass;
40
41 typedef enum
42 {
43   FLV_STATE_HEADER,
44   FLV_STATE_TAG_TYPE,
45   FLV_STATE_TAG_VIDEO,
46   FLV_STATE_TAG_AUDIO,
47   FLV_STATE_TAG_SCRIPT,
48   FLV_STATE_SEEK,
49   FLV_STATE_DONE,
50   FLV_STATE_SKIP,
51   FLV_STATE_NONE
52 } GstFlvDemuxState;
53
54 struct _GstFlvDemux
55 {
56   GstElement element;
57
58   GstPad *sinkpad;
59
60   GstPad *audio_pad;
61   GstPad *video_pad;
62
63   gboolean have_group_id;
64   guint group_id;
65
66   /* <private> */
67   
68   GstIndex *index;
69   gint index_id;
70   gboolean own_index;
71   
72   GArray * times;
73   GArray * filepositions;
74
75   GstAdapter *adapter;
76
77   GstSegment segment;
78
79   GstEvent *new_seg_event;
80
81   GstTagList *taglist;
82
83   GstFlvDemuxState state;
84
85   guint64 offset;
86   guint64 cur_tag_offset;
87   GstClockTime duration;
88   guint64 tag_size;
89   guint64 tag_data_size;
90
91   /* Audio infos */
92   guint16 rate;
93   guint16 channels;
94   guint16 width;
95   guint16 audio_codec_tag;
96   guint64 audio_offset;
97   gboolean audio_need_discont;
98   gboolean audio_need_segment;
99   gboolean audio_linked;
100   GstBuffer * audio_codec_data;
101   GstClockTime audio_start;
102   guint32 last_audio_pts;
103   GstClockTime audio_time_offset;
104
105   /* Video infos */
106   guint32 w;
107   guint32 h;
108   guint32 par_x;
109   guint32 par_y;
110   guint16 video_codec_tag;
111   guint64 video_offset;
112   gboolean video_need_discont;
113   gboolean video_need_segment;
114   gboolean video_linked;
115   gboolean got_par;
116   GstBuffer * video_codec_data;
117   GstClockTime video_start;
118   guint32 last_video_pts;
119   GstClockTime video_time_offset;
120   gdouble framerate;
121
122   gboolean random_access;
123   gboolean need_header;
124   gboolean has_audio;
125   gboolean has_video;
126   gboolean push_tags;
127   gboolean strict;
128   gboolean flushing;
129
130   gboolean no_more_pads;
131
132   gboolean seeking;
133   gboolean building_index;
134   gboolean indexed; /* TRUE if index is completely built */
135   gboolean upstream_seekable; /* TRUE if upstream is seekable */
136   gint64 file_size;
137   GstEvent *seek_event;
138   gint64 seek_time;
139
140   GstClockTime index_max_time;
141   gint64 index_max_pos;
142
143   /* reverse playback */
144   GstClockTime video_first_ts;
145   GstClockTime audio_first_ts;
146   gboolean video_done;
147   gboolean audio_done;
148   gint64 from_offset;
149   gint64 to_offset;
150 };
151
152 struct _GstFlvDemuxClass
153 {
154   GstElementClass parent_class;
155 };
156
157 GType gst_flv_demux_get_type (void);
158
159 G_END_DECLS
160 #endif /* __FLV_DEMUX_H__ */