tizen 2.3.1 release
[framework/multimedia/gst-plugins-bad0.10.git] / gst / hls / gsthlsdemux.h
1 /* GStreamer
2  * Copyright (C) 2010 Marc-Andre Lureau <marcandre.lureau@gmail.com>
3  * Copyright (C) 2010 Andoni Morales Alastruey <ylatuya@gmail.com>
4  *
5  * gsthlsdemux.h:
6  *
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.
11  *
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.
16  *
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., 59 Temple Place - Suite 330,
20  * Boston, MA 02111-1307, USA.
21  */
22
23
24 #ifndef __GST_HLS_DEMUX_H__
25 #define __GST_HLS_DEMUX_H__
26
27 #include <gst/gst.h>
28 #include <gst/base/gstadapter.h>
29 #include "m3u8.h"
30 #include "gstfragmented.h"
31 #include "gsturidownloader.h"
32
33 G_BEGIN_DECLS
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 typedef struct _GstHLSDemux GstHLSDemux;
45 typedef struct _GstHLSDemuxClass GstHLSDemuxClass;
46
47 #define GST_HLS_DEMUX_AES_BLOCK_SIZE 16
48
49 /**
50  * GstHLSDemux:
51  *
52  * Opaque #GstHLSDemux data structure.
53  */
54 struct _GstHLSDemux
55 {
56   GstElement parent;
57
58   GstPad *srcpad;
59   GstPad *sinkpad;
60
61   GstBuffer *playlist;
62   GstCaps *input_caps;
63   GstUriDownloader *downloader;
64   GstM3U8Client *client;        /* M3U8 client */
65   GQueue *queue;                /* Queue storing the fetched fragments */
66   gboolean need_cache;          /* Wheter we need to cache some fragments before starting to push data */
67   gboolean end_of_playlist;
68   gboolean do_typefind;         /* Whether we need to typefind the next buffer */
69
70   /* Properties */
71   guint fragments_cache;        /* number of fragments needed to be cached to start playing */
72   gfloat bitrate_limit;         /* limit of the available bitrate to use */
73   guint connection_speed;       /* Network connection speed in kbps (0 = unknown) */
74
75   /* Streaming task */
76   GstTask *stream_task;
77   GStaticRecMutex stream_lock;
78   gboolean stop_stream_task;
79
80   /* Updates task */
81   GstTask *updates_task;
82   GStaticRecMutex updates_lock;
83   GMutex *updates_timed_lock;
84   GTimeVal next_update;         /* Time of the next update */
85   gboolean cancelled;
86
87   /* Position in the stream */
88   GstClockTime position_shift;
89   gboolean need_segment;
90 };
91
92 struct _GstHLSDemuxClass
93 {
94   GstElementClass parent_class;
95 };
96
97 GType gst_hls_demux_get_type (void);
98
99 G_END_DECLS
100 #endif /* __GST_HLS_DEMUX_H__ */