tizen 2.3.1 release
[framework/multimedia/gst-plugins-ext0.10.git] / dashdemux / src / gstdashdemux.h
1 /*
2  * DASH demux plugin for GStreamer
3  *
4  * gstdashdemux.h
5  *
6  * Copyright (C) 2012 Orange
7  *
8  * Authors:
9  *   David Corvoysier <david.corvoysier@orange.com>
10  *   Hamid Zakari <hamid.zakari@gmail.com>
11  *
12  * This library is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU Library General Public
14  * License as published by the Free Software Foundation; either
15  * version 2.1 of the License, or (at your option) any later version.
16  *
17  * This library is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20  * Library General Public License for more details.
21  *
22  * You should have received a copy of the GNU Library General Public
23  * License along with this library (COPYING); if not, write to the
24  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
25  * Boston, MA 02111-1307, USA.
26  */
27
28 #ifndef __GST_DASH_DEMUX_H__
29 #define __GST_DASH_DEMUX_H__
30 #define DASHDEMUX_MODIFICATION
31 #include <gst/gst.h>
32 #include <gst/base/gstdataqueue.h>
33 #include "gstmpdparser.h"
34 #include "gstfragmented.h"
35 #include "gsturidownloader.h"
36 #include "gstdownloadrate.h"
37
38 G_BEGIN_DECLS
39 #define GST_TYPE_DASH_DEMUX \
40         (gst_dash_demux_get_type())
41 #define GST_DASH_DEMUX(obj) \
42         (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DASH_DEMUX,GstDashDemux))
43 #define GST_DASH_DEMUX_CLASS(klass) \
44         (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DASH_DEMUX,GstDashDemuxClass))
45 #define GST_IS_DASH_DEMUX(obj) \
46         (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DASH_DEMUX))
47 #define GST_IS_DASH_DEMUX_CLASS(klass) \
48         (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DASH_DEMUX))
49 //
50 typedef struct _GstDashDemux GstDashDemux;
51 typedef struct _GstDashDemuxClass GstDashDemuxClass;
52 typedef struct _GstDashDemuxStream GstDashDemuxStream;
53
54 struct _GstDashDemuxStream {
55   guint idx;
56   GstPad *srcpad;
57   GstCaps *output_caps;
58   GstCaps *input_caps;
59   GstDataQueue *queue;
60   GstClockTime start_time;
61   gboolean download_end_of_period;
62   gboolean stream_end_of_period;
63   gboolean stream_eos;
64   gboolean need_header;
65   gboolean need_segment;
66   GstDownloadRate dnl_rate;
67 };
68
69 #define MAX_LANGUAGES 20
70 /**
71  * GstDashDemux:
72  *
73  * Opaque #GstDashDemux data structure.
74  */
75 struct _GstDashDemux
76 {
77   GstElement parent;
78   GstPad *sinkpad;
79   GSList *streams;
80   gint max_video_width;
81   gint max_video_height;
82
83   GstBuffer *manifest;
84   GstUriDownloader *downloader;
85   GstMpdClient *client;         /* MPD client */
86   gboolean end_of_period;
87   gboolean end_of_manifest;
88
89   /* Properties */
90   GstClockTime max_buffering_time;      /* Maximum buffering time accumulated during playback */
91   gfloat bandwidth_usage;       /* Percentage of the available bandwidth to use       */
92   guint64 max_bitrate;          /* max of bitrate supported by target decoder         */
93
94   /* Streaming task */
95   GstTask *stream_task;
96   GStaticRecMutex stream_lock;
97   GMutex *stream_timed_lock;
98
99   /* Download task */
100   GstTask *download_task;
101   GStaticRecMutex download_lock;
102   volatile gboolean cancelled;
103   GMutex download_mutex;
104   GCond download_cond;
105
106   /* Manifest update */
107   GstClockTime last_manifest_update;
108 };
109
110 struct _GstDashDemuxClass
111 {
112   GstElementClass parent_class;
113 };
114
115 GType gst_dash_demux_get_type (void);
116
117 G_END_DECLS
118 #endif /* __GST_DASH_DEMUX_H__ */