summaryrefslogtreecommitdiff
path: root/ext/dash/gstisoff.h
diff options
context:
space:
mode:
authorThiago Santos <thiagoss@osg.samsung.com>2015-01-12 11:57:02 -0300
committerThiago Santos <thiagoss@osg.samsung.com>2015-01-16 15:00:11 -0300
commitf5b98f24c280809a5bc236ee18e574378ce432f3 (patch)
treea1b0f6a4757546ccd815d48d0fde237fabc63a31 /ext/dash/gstisoff.h
parentb40e5decb298734f70fceb938cb317b6b923a699 (diff)
downloadgstreamer-plugins-bad-f5b98f24c280809a5bc236ee18e574378ce432f3.tar.gz
dashdemux: parse the sidx index from isobmff streams
Allows dashdemux to identify the subsegments in the stream and switch bitrates when needed
Diffstat (limited to 'ext/dash/gstisoff.h')
-rw-r--r--ext/dash/gstisoff.h99
1 files changed, 99 insertions, 0 deletions
diff --git a/ext/dash/gstisoff.h b/ext/dash/gstisoff.h
new file mode 100644
index 000000000..e535c69c0
--- /dev/null
+++ b/ext/dash/gstisoff.h
@@ -0,0 +1,99 @@
+/*
+ * ISO File Format parsing library
+ *
+ * gstisoff.h
+ *
+ * Copyright (C) 2015 Samsung Electronics. All rights reserved.
+ * Author: Thiago Santos <thiagoss@osg.samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library (COPYING); if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_ISOFF_H__
+#define __GST_ISOFF_H__
+
+#include <gst/gst.h>
+
+G_BEGIN_DECLS
+
+typedef enum {
+ GST_ISOFF_PARSER_OK,
+ GST_ISOFF_PARSER_DONE,
+ GST_ISOFF_PARSER_UNEXPECTED,
+ GST_ISOFF_PARSER_ERROR
+} GstIsoffParserResult;
+
+/* this is the minimum size, it can be larger if it
+ * uses extended size or type */
+#define GST_ISOFF_FULL_BOX_SIZE 12
+
+#define GST_ISOFF_FOURCC_SIDX GST_MAKE_FOURCC('s','i','d','x')
+typedef struct _GstSidxBoxEntry
+{
+ gboolean ref_type;
+ guint32 size;
+ GstClockTime duration;
+ gboolean starts_with_sap;
+ guint8 sap_type;
+ guint32 sap_delta_time;
+
+ guint64 offset;
+ GstClockTime pts;
+} GstSidxBoxEntry;
+
+typedef struct _GstSidxBox
+{
+ guint8 version;
+ guint32 flags;
+
+ guint32 ref_id;
+ guint32 timescale;
+ guint64 earliest_pts;
+ guint64 first_offset;
+
+ gint entry_index;
+ gint entries_count;
+
+ GstSidxBoxEntry *entries;
+} GstSidxBox;
+
+typedef enum _GstSidxParserStatus
+{
+ GST_ISOFF_SIDX_PARSER_INIT,
+ GST_ISOFF_SIDX_PARSER_HEADER,
+ GST_ISOFF_SIDX_PARSER_DATA,
+ GST_ISOFF_SIDX_PARSER_FINISHED
+} GstSidxParserStatus;
+
+typedef struct _GstSidxParser
+{
+ GstSidxParserStatus status;
+
+ guint64 size;
+ guint64 cumulative_entry_size;
+ guint64 cumulative_pts;
+
+ GstSidxBox sidx;
+} GstSidxParser;
+
+void gst_isoff_sidx_parser_init (GstSidxParser * parser);
+void gst_isoff_sidx_parser_clear (GstSidxParser * parser);
+GstIsoffParserResult gst_isoff_sidx_parser_add_buffer (GstSidxParser * parser, GstBuffer * buf, guint * consumed);
+
+G_END_DECLS
+
+#endif /* __GST_ISOFF_H__ */
+