d23926b0168f3e0abc68330a67ce38e3f88da1fe
[framework/multimedia/gst-plugins-ext0.10.git] / piffdemux / src / piffdemux.h
1 /* GStreamer\r
2  * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>\r
3  *\r
4  * This library is free software; you can redistribute it and/or\r
5  * modify it under the terms of the GNU Library General Public\r
6  * License as published by the Free Software Foundation; either\r
7  * version 2 of the License, or (at your option) any later version.\r
8  *\r
9  * This library is distributed in the hope that it will be useful,\r
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
12  * Library General Public License for more details.\r
13  *\r
14  * You should have received a copy of the GNU Library General Public\r
15  * License along with this library; if not, write to the\r
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,\r
17  * Boston, MA 02111-1307, USA.\r
18  */\r
19 \r
20 \r
21 #ifndef __GST_PIFFDEMUX_H__\r
22 #define __GST_PIFFDEMUX_H__\r
23 \r
24 #include <gst/gst.h>\r
25 #include <gst/base/gstadapter.h>\r
26 #include "piffcommon.h"\r
27 \r
28 G_BEGIN_DECLS\r
29 \r
30 GST_DEBUG_CATEGORY_EXTERN (piffdemux_debug);\r
31 #define GST_CAT_DEFAULT piffdemux_debug\r
32 \r
33 #define GST_TYPE_PIFFDEMUX \\r
34   (gst_piffdemux_get_type())\r
35 #define GST_PIFFDEMUX(obj) \\r
36   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PIFFDEMUX,GstPiffDemux))\r
37 #define GST_PIFFDEMUX_CLASS(klass) \\r
38   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PIFFDEMUX,GstPiffDemuxClass))\r
39 #define GST_IS_PIFFDEMUX(obj) \\r
40   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PIFFDEMUX))\r
41 #define GST_IS_PIFFDEMUX_CLASS(klass) \\r
42   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PIFFDEMUX))\r
43 \r
44 #define GST_PIFFDEMUX_CAST(obj) ((GstPiffDemux *)(obj))\r
45 \r
46 /* piffdemux produces these for atoms it cannot parse */\r
47 #define GST_PIFF_DEMUX_PRIVATE_TAG "private-piff-tag"\r
48 #define GST_PIFF_DEMUX_CLASSIFICATION_TAG "classification"\r
49 \r
50 #define GST_PIFFDEMUX_MAX_STREAMS         8\r
51 \r
52 typedef struct _GstPiffDemux GstPiffDemux;\r
53 typedef struct _GstPiffDemuxClass GstPiffDemuxClass;\r
54 typedef struct _PiffDemuxStream PiffDemuxStream;\r
55 \r
56 struct _GstPiffDemux {\r
57   GstElement element;\r
58 \r
59   /* pads */\r
60   GstPad *sinkpad;\r
61   GstPad *srcpad;\r
62 \r
63   PiffDemuxStream *stream;\r
64 \r
65   guint32 timescale;\r
66   gint64 duration;\r
67 \r
68   gboolean fragmented;\r
69 \r
70   guint64 moof_offset;\r
71 \r
72   gint state;\r
73 \r
74   gboolean posted_redirect;\r
75 \r
76   /* push based variables */\r
77   guint neededbytes;\r
78   guint todrop;\r
79   GstAdapter *adapter;\r
80   GstBuffer *mdatbuffer;\r
81   guint64 mdatleft;\r
82 \r
83   /* offset of the media data (i.e.: Size of header) */\r
84   guint64 offset;\r
85   /* offset of the mdat atom */\r
86   guint64 mdatoffset;\r
87   guint64 first_mdat;\r
88 \r
89   GstTagList *tag_list;\r
90 \r
91   /* configured playback region */\r
92   GstSegment segment;\r
93   gboolean segment_running;\r
94   GstEvent *pending_newsegment;\r
95 \r
96   /* gst index support */\r
97   GstIndex *element_index;\r
98   gint index_id;\r
99 \r
100   gint64 requested_seek_time;\r
101   guint64 seek_offset;\r
102   gboolean moof_rcvd;\r
103 \r
104   /* live specific params */\r
105   piff_live_param_t *param;\r
106   guint lookahead_cnt;\r
107   gboolean is_live;\r
108 };\r
109 \r
110 struct _GstPiffDemuxClass {\r
111   GstElementClass parent_class;\r
112   void (*live_param)   (GstPiffDemux *piff, const piff_live_param_t *param);\r
113 };\r
114 \r
115 GType gst_piffdemux_get_type (void);\r
116 \r
117 /* prepares video caps based on input params */\r
118 void gst_piffdemux_set_video_params (GstPiffDemux * piffdemux, guint fourcc, guint width, guint height, guint fps_n, guint fps_d, unsigned char *codec_data, unsigned int codec_data_len);\r
119 /* prepares audio caps based on input params */\r
120 void gst_piffdemux_set_audio_params (GstPiffDemux * piffdemux, guint fourcc,\r
121                                         guint sampling_rate, guint bps, guint channels, unsigned char *codec_data, unsigned int codec_data_len);\r
122 G_END_DECLS\r
123 \r
124 #endif /* __GST_PIFFDEMUX_H__ */\r
125 \r