2 * Copyright (C) 2010 Marc-Andre Lureau <marcandre.lureau@gmail.com>
3 * Copyright (C) 2010 Andoni Morales Alastruey <ylatuya@gmail.com>
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
24 #ifndef __GST_HLS_DEMUX_H__
25 #define __GST_HLS_DEMUX_H__
28 #include <gst/base/gstadapter.h>
30 #include "gstfragmented.h"
31 #include <gst/uridownloader/gsturidownloader.h>
34 #define GST_TYPE_HLS_DEMUX \
35 (gst_hls_demux_get_type())
36 #define GST_HLS_DEMUX(obj) \
37 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_HLS_DEMUX,GstHLSDemux))
38 #define GST_HLS_DEMUX_CLASS(klass) \
39 (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_HLS_DEMUX,GstHLSDemuxClass))
40 #define GST_IS_HLS_DEMUX(obj) \
41 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_HLS_DEMUX))
42 #define GST_IS_HLS_DEMUX_CLASS(klass) \
43 (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_HLS_DEMUX))
44 #define GST_HLS_DEMUX_GET_CLASS(obj) \
45 (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_HLS_DEMUX,GstHLSDemuxClass))
46 typedef struct _GstHLSDemux GstHLSDemux;
47 typedef struct _GstHLSDemuxClass GstHLSDemuxClass;
52 * Opaque #GstHLSDemux data structure.
62 gboolean have_group_id;
67 GstUriDownloader *downloader;
68 gchar *uri; /* Original playlist URI */
69 GstM3U8Client *client; /* M3U8 client */
70 gboolean do_typefind; /* Whether we need to typefind the next buffer */
73 guint fragments_cache; /* number of fragments needed to be cached to start playing */
74 gfloat bitrate_limit; /* limit of the available bitrate to use */
75 guint connection_speed; /* Network connection speed in kbps (0 = unknown) */
79 GRecMutex stream_lock;
80 gboolean stop_stream_task;
81 GMutex download_lock; /* Used for protecting queue and the two conds */
82 GCond download_cond; /* Signalled when something is added to the queue */
83 gboolean end_of_playlist;
84 gint download_failed_count;
88 GstTask *updates_task;
89 GRecMutex updates_lock;
90 gint64 next_update; /* Time of the next update */
91 gboolean stop_updates_task;
92 GMutex updates_timed_lock;
93 GCond updates_timed_cond; /* Signalled when the playlist should be updated */
95 /* Position in the stream */
97 gboolean need_segment;
100 /* Cache for the last key */
102 GstFragment *key_fragment;
104 /* Current download rate (bps) */
105 gint current_download_rate;
108 struct _GstHLSDemuxClass
110 GstElementClass parent_class;
113 GType gst_hls_demux_get_type (void);
116 #endif /* __GST_HLS_DEMUX_H__ */