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__
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>
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) \
55 typedef struct _GstHLSDemux GstHLSDemux;
56 typedef struct _GstHLSDemuxClass GstHLSDemuxClass;
61 * Opaque #GstHLSDemux data structure.
65 GstAdaptiveDemux parent;
69 gchar *uri; /* Original playlist URI */
70 GstM3U8Client *client; /* M3U8 client */
71 gboolean do_typefind; /* Whether we need to typefind the next buffer */
73 #ifdef TIZEN_FEATURE_AVOID_PAD_SWITCHING
74 GstClockTime current_pts;
77 /* Cache for the last key */
79 GstFragment *key_fragment;
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;
87 gcry_cipher_hd_t aes_ctx;
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 */
99 struct _GstHLSDemuxClass
101 GstAdaptiveDemuxClass parent_class;
104 GType gst_hls_demux_get_type (void);
107 #endif /* __GST_HLS_DEMUX_H__ */