tizen 2.3.1 release
[framework/multimedia/gst-plugins-ext0.10.git] / piffdemux / src / piffdemux.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_PIFFDEMUX_H__
22 #define __GST_PIFFDEMUX_H__
23
24 #include <gst/gst.h>
25 #include <gst/base/gstadapter.h>
26 #include "piffcommon.h"
27
28 #ifdef DRM_ENABLE
29 #include <drm_client.h>
30 #include <drm_trusted_client.h>
31 #include <drm_client_types.h>
32 #include <drm_trusted_client_types.h>
33 #endif
34
35 G_BEGIN_DECLS
36
37 GST_DEBUG_CATEGORY_EXTERN (piffdemux_debug);
38 #define GST_CAT_DEFAULT piffdemux_debug
39
40 #define GST_TYPE_PIFFDEMUX \
41   (gst_piffdemux_get_type())
42 #define GST_PIFFDEMUX(obj) \
43   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PIFFDEMUX,GstPiffDemux))
44 #define GST_PIFFDEMUX_CLASS(klass) \
45   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PIFFDEMUX,GstPiffDemuxClass))
46 #define GST_IS_PIFFDEMUX(obj) \
47   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PIFFDEMUX))
48 #define GST_IS_PIFFDEMUX_CLASS(klass) \
49   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PIFFDEMUX))
50
51 #define GST_PIFFDEMUX_CAST(obj) ((GstPiffDemux *)(obj))
52
53 /* piffdemux produces these for atoms it cannot parse */
54 #define GST_PIFF_DEMUX_PRIVATE_TAG "private-piff-tag"
55 #define GST_PIFF_DEMUX_CLASSIFICATION_TAG "classification"
56
57 #define GST_PIFFDEMUX_MAX_STREAMS         8
58
59 typedef struct _GstPiffDemux GstPiffDemux;
60 typedef struct _GstPiffDemuxClass GstPiffDemuxClass;
61 typedef struct _PiffDemuxStream PiffDemuxStream;
62
63 struct _GstPiffDemux {
64   GstElement element;
65
66   /* pads */
67   GstPad *sinkpad;
68   GstPad *srcpad;
69
70   PiffDemuxStream *stream;
71
72   guint32 timescale;
73   gint64 duration;
74
75   gboolean fragmented;
76   guint64 moof_offset;
77   gint state;
78   gboolean posted_redirect;
79
80   /* push based variables */
81   guint neededbytes;
82   guint todrop;
83   GstAdapter *adapter;
84   GstBuffer *mdatbuffer;
85   guint64 mdatleft;
86
87   /* offset of the media data (i.e.: Size of header) */
88   guint64 offset;
89   /* offset of the mdat atom */
90   guint64 mdatoffset;
91   guint64 first_mdat;
92
93   GstTagList *tag_list;
94
95   /* configured playback region */
96   GstSegment segment;
97   gboolean segment_running;
98   GstEvent *pending_newsegment;
99
100   /* gst index support */
101   GstIndex *element_index;
102   gint index_id;
103
104   gint64 requested_seek_time;
105   guint64 seek_offset;
106   gboolean moof_rcvd;
107
108   /* live specific params */
109   piff_live_param_t *param;
110   guint lookahead_cnt;
111   gboolean is_live;
112
113   gboolean encrypt_content;
114   gboolean decrypt_init;
115 #ifdef DRM_ENABLE
116   DRM_DECRYPT_HANDLE pr_handle;
117 #endif
118   GstBuffer *protection_header;
119 };
120
121 struct _GstPiffDemuxClass {
122   GstElementClass parent_class;
123   void (*live_param)   (GstPiffDemux *piff, const piff_live_param_t *param);
124 };
125
126 GType gst_piffdemux_get_type (void);
127
128 /* prepares video caps based on input params */
129 void gst_piffdemux_set_video_params (GstPiffDemux * piffdemux, guint fourcc, guint width, guint height,
130                                      guint fps_n, guint fps_d, unsigned char *codec_data, unsigned int codec_data_len);
131 /* prepares audio caps based on input params */
132 void gst_piffdemux_set_audio_params (GstPiffDemux * piffdemux, guint fourcc, guint sampling_rate, guint bps,
133                                      guint channels, unsigned char *codec_data, unsigned int codec_data_len);
134 G_END_DECLS
135
136 #endif /* __GST_PIFFDEMUX_H__ */
137