1 /* GStreamer
2  * Copyright (C) 2012 Smart TV Alliance
3  *  Author: Thiago Sousa Santos <thiago.sousa.santos@collabora.com>, Collabora Ltd.
4  *
5  * gstmssmanifest.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 #ifndef __GST_MSS_MANIFEST_H__
24 #define __GST_MSS_MANIFEST_H__
25 
26 #include <glib.h>
27 #include <gio/gio.h>
28 #include <gst/gst.h>
29 #include <gst/base/gstadapter.h>
30 
31 G_BEGIN_DECLS
32 
33 typedef struct _GstMssManifest GstMssManifest;
34 typedef struct _GstMssStream GstMssStream;
35 
36 typedef enum _GstMssStreamType {
37   MSS_STREAM_TYPE_UNKNOWN = 0,
38   MSS_STREAM_TYPE_VIDEO = 1,
39   MSS_STREAM_TYPE_AUDIO = 2
40 } GstMssStreamType;
41 
42 GstMssManifest * gst_mss_manifest_new (GstBuffer * data);
43 void gst_mss_manifest_free (GstMssManifest * manifest);
44 GSList * gst_mss_manifest_get_streams (GstMssManifest * manifest);
45 guint64 gst_mss_manifest_get_timescale (GstMssManifest * manifest);
46 guint64 gst_mss_manifest_get_duration (GstMssManifest * manifest);
47 GstClockTime gst_mss_manifest_get_gst_duration (GstMssManifest * manifest);
48 void gst_mss_manifest_seek (GstMssManifest * manifest, gboolean forward, guint64 time);
49 gboolean gst_mss_manifest_change_bitrate (GstMssManifest *manifest, guint64 bitrate);
50 guint64 gst_mss_manifest_get_current_bitrate (GstMssManifest * manifest);
51 gboolean gst_mss_manifest_is_live (GstMssManifest * manifest);
52 gint64 gst_mss_manifest_get_dvr_window_length (GstMssManifest * manifest);
53 gint gst_mss_manifest_get_look_ahead_fragments_count (GstMssManifest * manifest);
54 void gst_mss_manifest_reload_fragments (GstMssManifest * manifest, GstBuffer * data);
55 GstClockTime gst_mss_manifest_get_min_fragment_duration (GstMssManifest * manifest);
56 const gchar * gst_mss_manifest_get_protection_system_id (GstMssManifest * manifest);
57 const gchar * gst_mss_manifest_get_protection_data (GstMssManifest * manifest);
58 gboolean gst_mss_manifest_get_live_seek_range (GstMssManifest * manifest, gint64 * start, gint64 * stop);
59 
60 GstMssStreamType gst_mss_stream_get_type (GstMssStream *stream);
61 GstCaps * gst_mss_stream_get_caps (GstMssStream * stream);
62 gboolean gst_mss_stream_select_bitrate (GstMssStream * stream, guint64 bitrate);
63 guint64 gst_mss_stream_get_current_bitrate (GstMssStream * stream);
64 void gst_mss_stream_set_active (GstMssStream * stream, gboolean active);
65 guint64 gst_mss_stream_get_timescale (GstMssStream * stream);
66 GstFlowReturn gst_mss_stream_get_fragment_url (GstMssStream * stream, gchar ** url);
67 GstClockTime gst_mss_stream_get_fragment_gst_timestamp (GstMssStream * stream);
68 GstClockTime gst_mss_stream_get_fragment_gst_duration (GstMssStream * stream);
69 gboolean gst_mss_stream_has_next_fragment (GstMssStream * stream);
70 GstFlowReturn gst_mss_stream_advance_fragment (GstMssStream * stream);
71 GstFlowReturn gst_mss_stream_regress_fragment (GstMssStream * stream);
72 void gst_mss_stream_seek (GstMssStream * stream, gboolean forward, GstSeekFlags flags, guint64 time, guint64 * final_time);
73 const gchar * gst_mss_stream_get_lang (GstMssStream * stream);
74 
75 const gchar * gst_mss_stream_type_name (GstMssStreamType streamtype);
76 
77 void gst_mss_manifest_live_adapter_push(GstMssStream * stream, GstBuffer * buffer);
78 gsize gst_mss_manifest_live_adapter_available(GstMssStream * stream);
79 GstBuffer * gst_mss_manifest_live_adapter_take_buffer(GstMssStream * stream, gsize nbytes);
80 gboolean gst_mss_stream_fragment_parsing_needed(GstMssStream * stream);
81 void gst_mss_stream_parse_fragment(GstMssStream * stream, GstBuffer * buffer);
82 
83 G_END_DECLS
84 #endif /* __GST_MSS_MANIFEST_H__ */
85