069fa72ebe6a5b23f797ffb6b5aa06c55729c5a5
[platform/upstream/gstreamer.git] / gst / quicktime / qtdemux.h
1 /* GStreamer
2  * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
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., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20
21 #ifndef __GST_QTDEMUX_H__
22 #define __GST_QTDEMUX_H__
23
24 #include <gst/gst.h>
25 #include <gst/base/gstadapter.h>
26
27 G_BEGIN_DECLS
28
29 GST_DEBUG_CATEGORY_EXTERN (qtdemux_debug);
30 #define GST_CAT_DEFAULT qtdemux_debug
31
32 #define GST_TYPE_QTDEMUX \
33   (gst_qtdemux_get_type())
34 #define GST_QTDEMUX(obj) \
35   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_QTDEMUX,GstQTDemux))
36 #define GST_QTDEMUX_CLASS(klass) \
37   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_QTDEMUX,GstQTDemuxClass))
38 #define GST_IS_QTDEMUX(obj) \
39   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_QTDEMUX))
40 #define GST_IS_QTDEMUX_CLASS(klass) \
41   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_QTDEMUX))
42
43 #define GST_QTDEMUX_CAST(obj) ((GstQTDemux *)(obj))
44
45 /* qtdemux produces these for atoms it cannot parse */
46 #define GST_QT_DEMUX_PRIVATE_TAG "private-qt-tag"
47 #define GST_QT_DEMUX_CLASSIFICATION_TAG "classification"
48
49 #define GST_QTDEMUX_MAX_STREAMS         8
50
51 typedef struct _GstQTDemux GstQTDemux;
52 typedef struct _GstQTDemuxClass GstQTDemuxClass;
53 typedef struct _QtDemuxStream QtDemuxStream;
54
55 struct _GstQTDemux {
56   GstElement element;
57
58   /* pads */
59   GstPad *sinkpad;
60
61   QtDemuxStream *streams[GST_QTDEMUX_MAX_STREAMS];
62   gint     n_streams;
63   gint     n_video_streams;
64   gint     n_audio_streams;
65   gint     n_sub_streams;
66
67   guint  major_brand;
68   GstBuffer *comp_brands;
69   GNode *moov_node;
70   GNode *moov_node_compressed;
71
72   guint32 timescale;
73   guint64 duration;
74
75   gboolean fragmented;
76   /* offset of the mfra atom */
77   guint64 mfra_offset;
78   guint64 moof_offset;
79
80   gint state;
81
82   gboolean pullbased;
83   gboolean posted_redirect;
84
85   /* push based variables */
86   guint neededbytes;
87   guint todrop;
88   GstAdapter *adapter;
89   GstBuffer *mdatbuffer;
90   guint64 mdatleft;
91
92   /* offset of the media data (i.e.: Size of header) */
93   guint64 offset;
94   /* offset of the mdat atom */
95   guint64 mdatoffset;
96   guint64 first_mdat;
97   gboolean got_moov;
98
99   GstTagList *tag_list;
100
101   /* configured playback region */
102   GstSegment segment;
103   gboolean segment_running;
104   GstEvent *pending_newsegment;
105
106   /* gst index support */
107   GstIndex *element_index;
108   gint index_id;
109
110   gint64 requested_seek_time;
111   guint64 seek_offset;
112 };
113
114 struct _GstQTDemuxClass {
115   GstElementClass parent_class;
116 };
117
118 GType gst_qtdemux_get_type (void);
119
120 G_END_DECLS
121
122 #endif /* __GST_QTDEMUX_H__ */