apply tizen build option rule
[platform/upstream/gstreamer.git] / ext / 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., 51 Franklin St, Fifth Floor,
20  * Boston, MA 02110-1301, USA.
21  */
22
23
24 #ifndef __GST_HLS_DEMUX_H__
25 #define __GST_HLS_DEMUX_H__
26
27 #include <gst/gst.h>
28 #include "m3u8.h"
29 #include "gstfragmented.h"
30 #include <gst/adaptivedemux/gstadaptivedemux.h>
31 #if defined(HAVE_OPENSSL)
32 #include <openssl/evp.h>
33 #elif defined(HAVE_NETTLE)
34 #include <nettle/aes.h>
35 #include <nettle/cbc.h>
36 #else
37 #include <gcrypt.h>
38 #endif
39
40 G_BEGIN_DECLS
41 #define GST_TYPE_HLS_DEMUX \
42   (gst_hls_demux_get_type())
43 #define GST_HLS_DEMUX(obj) \
44   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_HLS_DEMUX,GstHLSDemux))
45 #define GST_HLS_DEMUX_CLASS(klass) \
46   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_HLS_DEMUX,GstHLSDemuxClass))
47 #define GST_IS_HLS_DEMUX(obj) \
48   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_HLS_DEMUX))
49 #define GST_IS_HLS_DEMUX_CLASS(klass) \
50   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_HLS_DEMUX))
51 #define GST_HLS_DEMUX_GET_CLASS(obj) \
52   (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_HLS_DEMUX,GstHLSDemuxClass))
53 #define GST_HLS_DEMUX_CAST(obj) \
54   ((GstHLSDemux *)obj)
55 typedef struct _GstHLSDemux GstHLSDemux;
56 typedef struct _GstHLSDemuxClass GstHLSDemuxClass;
57
58 /**
59  * GstHLSDemux:
60  *
61  * Opaque #GstHLSDemux data structure.
62  */
63 struct _GstHLSDemux
64 {
65   GstAdaptiveDemux parent;
66
67   gint srcpad_counter;
68
69   gchar *uri;                   /* Original playlist URI */
70   GstM3U8Client *client;        /* M3U8 client */
71   gboolean do_typefind;         /* Whether we need to typefind the next buffer */
72
73 #ifdef TIZEN_FEATURE_AVOID_PAD_SWITCHING
74   GstClockTime current_pts;
75 #endif
76
77   /* Cache for the last key */
78   gchar *key_url;
79   GstFragment *key_fragment;
80
81   /* decryption tooling */
82 #if defined(HAVE_OPENSSL)
83   EVP_CIPHER_CTX aes_ctx;
84 #elif defined(HAVE_NETTLE)
85   struct CBC_CTX (struct aes_ctx, AES_BLOCK_SIZE) aes_ctx;
86 #else
87   gcry_cipher_hd_t aes_ctx;
88 #endif
89   gchar *current_key;
90   guint8 *current_iv;
91   GstBuffer *pending_buffer; /* decryption scenario:
92                               * the last buffer can only be pushed when
93                               * resized, so need to store and wait for
94                               * EOS to know it is the last */
95
96   gboolean reset_pts;
97 };
98
99 struct _GstHLSDemuxClass
100 {
101   GstAdaptiveDemuxClass parent_class;
102 };
103
104 GType gst_hls_demux_get_type (void);
105
106 G_END_DECLS
107 #endif /* __GST_HLS_DEMUX_H__ */