1 /* 2 * ISO File Format parsing library 3 * 4 * gstisoff.h 5 * 6 * Copyright (C) 2015 Samsung Electronics. All rights reserved. 7 * Author: Thiago Santos <thiagoss@osg.samsung.com> 8 * 9 * This library is free software; you can redistribute it and/or 10 * modify it under the terms of the GNU Library General Public 11 * License as published by the Free Software Foundation; either 12 * version 2.1 of the License, or (at your option) any later version. 13 * 14 * This library is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 * Library General Public License for more details. 18 * 19 * You should have received a copy of the GNU Library General Public 20 * License along with this library (COPYING); if not, write to the 21 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 22 * Boston, MA 02111-1307, USA. 23 */ 24 25 #ifndef __GST_ISOFF_QT_H__ 26 #define __GST_ISOFF_QT_H__ 27 28 #include <gst/gst.h> 29 30 G_BEGIN_DECLS 31 32 typedef enum { 33 GST_ISOFF_QT_PARSER_OK, 34 GST_ISOFF_QT_PARSER_DONE, 35 GST_ISOFF_QT_PARSER_UNEXPECTED, 36 GST_ISOFF_QT_PARSER_ERROR 37 } GstIsoffParserResult; 38 39 /* this is the minimum size, it can be larger if it 40 * uses extended size or type */ 41 #define GST_ISOFF_QT_FULL_BOX_SIZE 12 42 43 #define GST_ISOFF_QT_FOURCC_SIDX GST_MAKE_FOURCC('s','i','d','x') 44 typedef struct _GstSidxBoxEntry 45 { 46 gboolean ref_type; 47 guint32 size; 48 GstClockTime duration; 49 gboolean starts_with_sap; 50 guint8 sap_type; 51 guint32 sap_delta_time; 52 53 guint64 offset; 54 GstClockTime pts; 55 } GstSidxBoxEntry; 56 57 typedef struct _GstSidxBox 58 { 59 guint8 version; 60 guint32 flags; 61 62 guint32 ref_id; 63 guint32 timescale; 64 guint64 earliest_pts; 65 guint64 first_offset; 66 67 gint entry_index; 68 gint entries_count; 69 70 GstSidxBoxEntry *entries; 71 } GstSidxBox; 72 73 typedef enum _GstSidxParserStatus 74 { 75 GST_ISOFF_QT_SIDX_PARSER_INIT, 76 GST_ISOFF_QT_SIDX_PARSER_HEADER, 77 GST_ISOFF_QT_SIDX_PARSER_DATA, 78 GST_ISOFF_QT_SIDX_PARSER_FINISHED 79 } GstSidxParserStatus; 80 81 typedef struct _GstSidxParser 82 { 83 GstSidxParserStatus status; 84 85 guint64 size; 86 guint64 cumulative_entry_size; 87 guint64 cumulative_pts; 88 89 GstSidxBox sidx; 90 } GstSidxParser; 91 92 void gst_isoff_qt_sidx_parser_init (GstSidxParser * parser); 93 void gst_isoff_qt_sidx_parser_clear (GstSidxParser * parser); 94 GstIsoffParserResult gst_isoff_qt_sidx_parser_add_data (GstSidxParser * parser, const guint8 * buffer, gint length, guint * consumed); 95 GstIsoffParserResult gst_isoff_qt_sidx_parser_add_buffer (GstSidxParser * parser, GstBuffer * buf, guint * consumed); 96 97 G_END_DECLS 98 99 #endif /* __GST_ISOFF_QT_H__ */ 100 101