adaptivedemux: Get rid of internal stream adapter and let subclasses handle this...
[platform/upstream/gstreamer.git] / ext / dash / gstdashdemux.h
1 /*
2  * DASH demux plugin for GStreamer
3  *
4  * gstdashdemux.h
5  *
6  * Copyright (C) 2012 Orange
7  * Authors:
8  *   David Corvoysier <david.corvoysier@orange.com>
9  *   Hamid Zakari <hamid.zakari@gmail.com>
10  *
11  * Copyright (C) 2013 Smart TV Alliance
12  *  Author: Thiago Sousa Santos <thiago.sousa.santos@collabora.com>, Collabora Ltd.
13  *
14  * This library is free software; you can redistribute it and/or
15  * modify it under the terms of the GNU Library General Public
16  * License as published by the Free Software Foundation; either
17  * version 2.1 of the License, or (at your option) any later version.
18  *
19  * This library is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
22  * Library General Public License for more details.
23  *
24  * You should have received a copy of the GNU Library General Public
25  * License along with this library (COPYING); if not, write to the
26  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
27  * Boston, MA 02111-1307, USA.
28  */
29
30 #ifndef __GST_DASH_DEMUX_H__
31 #define __GST_DASH_DEMUX_H__
32
33 #include <gst/gst.h>
34 #include <gst/adaptivedemux/gstadaptivedemux.h>
35 #include <gst/base/gstadapter.h>
36 #include <gst/base/gstdataqueue.h>
37 #include "gstmpdparser.h"
38 #include "gstisoff.h"
39 #include <gst/uridownloader/gsturidownloader.h>
40
41 G_BEGIN_DECLS
42 #define GST_TYPE_DASH_DEMUX \
43         (gst_dash_demux_get_type())
44 #define GST_DASH_DEMUX(obj) \
45         (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DASH_DEMUX,GstDashDemux))
46 #define GST_DASH_DEMUX_CLASS(klass) \
47         (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DASH_DEMUX,GstDashDemuxClass))
48 #define GST_IS_DASH_DEMUX(obj) \
49         (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DASH_DEMUX))
50 #define GST_IS_DASH_DEMUX_CLASS(klass) \
51         (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DASH_DEMUX))
52 #define GST_DASH_DEMUX_CAST(obj) \
53         ((GstDashDemux *)obj)
54
55 typedef struct _GstDashDemuxClockDrift GstDashDemuxClockDrift;
56 typedef struct _GstDashDemuxStream GstDashDemuxStream;
57 typedef struct _GstDashDemux GstDashDemux;
58 typedef struct _GstDashDemuxClass GstDashDemuxClass;
59
60 struct _GstDashDemuxStream
61 {
62   GstAdaptiveDemuxStream parent;
63
64   gint index;
65   GstActiveStream *active_stream;
66
67   GstMediaFragmentInfo current_fragment;
68
69   /* index parsing */
70   GstAdapter *sidx_adapter;
71   GstSidxParser sidx_parser;
72   gsize sidx_current_remaining;
73   gint sidx_index;
74   gint64 sidx_base_offset;
75   GstClockTime pending_seek_ts;
76 };
77
78 /**
79  * GstDashDemux:
80  *
81  * Opaque #GstDashDemux data structure.
82  */
83 struct _GstDashDemux
84 {
85   GstAdaptiveDemux parent;
86
87   GSList *next_periods;
88
89   GstMpdClient *client;         /* MPD client */
90   GMutex client_lock;
91
92   GstDashDemuxClockDrift *clock_drift;
93
94   gboolean end_of_period;
95   gboolean end_of_manifest;
96
97   /* Properties */
98   GstClockTime max_buffering_time;      /* Maximum buffering time accumulated during playback */
99   guint64 max_bitrate;          /* max of bitrate supported by target decoder         */
100   gchar* default_presentation_delay; /* presentation time delay if MPD@suggestedPresentationDelay is not present */
101
102   gint n_audio_streams;
103   gint n_video_streams;
104   gint n_subtitle_streams;
105 };
106
107 struct _GstDashDemuxClass
108 {
109   GstAdaptiveDemuxClass parent_class;
110 };
111
112 GType gst_dash_demux_get_type (void);
113
114 G_END_DECLS
115 #endif /* __GST_DASH_DEMUX_H__ */
116