2 * DASH demux plugin for GStreamer
6 * Copyright (C) 2012 Orange
8 * David Corvoysier <david.corvoysier@orange.com>
9 * Hamid Zakari <hamid.zakari@gmail.com>
11 * Copyright (C) 2013 Smart TV Alliance
12 * Author: Thiago Sousa Santos <thiago.sousa.santos@collabora.com>, Collabora Ltd.
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.
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.
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.
30 #ifndef __GST_DASH_DEMUX_H__
31 #define __GST_DASH_DEMUX_H__
34 #include <gst/adaptivedemux/gstadaptivedemux.h>
35 #include <gst/base/gstadapter.h>
36 #include <gst/base/gstdataqueue.h>
37 #include "gstmpdclient.h"
38 #include <gst/isoff/gstisoff.h>
39 #include <gst/uridownloader/gsturidownloader.h>
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) \
55 typedef struct _GstDashDemuxClockDrift GstDashDemuxClockDrift;
56 typedef struct _GstDashDemuxStream GstDashDemuxStream;
57 typedef struct _GstDashDemux GstDashDemux;
58 typedef struct _GstDashDemuxClass GstDashDemuxClass;
60 struct _GstDashDemuxStream
62 GstAdaptiveDemuxStream parent;
65 GstActiveStream *active_stream;
67 GstMediaFragmentInfo current_fragment;
70 GstSidxParser sidx_parser;
71 GstClockTime sidx_position;
72 gint64 sidx_base_offset;
74 GstClockTime pending_seek_ts;
77 /* current offset of the first byte in the adapter / last byte we pushed or
79 guint64 current_offset;
80 /* index = 1, header = 2, data = 3 */
81 guint current_index_header_or_data;
83 /* ISOBMFF box parsing */
86 /* index = 1, header = 2, data = 3 */
87 guint32 current_fourcc;
88 guint64 current_start_offset;
93 guint64 moof_offset, moof_size;
94 GArray *moof_sync_samples;
95 guint current_sync_sample;
97 guint64 moof_average_size;
98 guint64 keyframe_average_size;
99 guint64 keyframe_average_distance;
100 gboolean first_sync_sample_after_moof, first_sync_sample_always_after_moof;
102 /* Internal position value, at the keyframe/entry level */
103 GstClockTime actual_position;
104 /* Timestamp of the beginning of the current fragment */
105 GstClockTime current_fragment_timestamp;
106 GstClockTime current_fragment_duration;
107 GstClockTime current_fragment_keyframe_distance;
109 /* Average keyframe download time (only in trickmode-key-units) */
110 GstClockTime average_download_time;
111 /* Cached target time (only in trickmode-key-units) */
112 GstClockTime target_time;
113 /* Average skip-ahead time (only in trickmode-key-units) */
114 GstClockTime average_skip_size;
120 * Opaque #GstDashDemux data structure.
124 GstAdaptiveDemux parent;
126 GSList *next_periods;
128 GstMPDClient *client; /* MPD client */
131 GstDashDemuxClockDrift *clock_drift;
133 gboolean end_of_period;
134 gboolean end_of_manifest;
137 GstClockTime max_buffering_time; /* Maximum buffering time accumulated during playback */
138 guint max_bitrate; /* max of bitrate supported by target decoder */
139 gint max_video_width, max_video_height;
140 gint max_video_framerate_n, max_video_framerate_d;
141 gchar* default_presentation_delay; /* presentation time delay if MPD@suggestedPresentationDelay is not present */
143 gint n_audio_streams;
144 gint n_video_streams;
145 gint n_subtitle_streams;
147 gboolean trickmode_no_audio;
148 gboolean allow_trickmode_key_units;
151 struct _GstDashDemuxClass
153 GstAdaptiveDemuxClass parent_class;
156 GType gst_dash_demux_get_type (void);
158 GST_ELEMENT_REGISTER_DECLARE (dashdemux);
161 #endif /* __GST_DASH_DEMUX_H__ */