OSDN Git Service

add tstools.
[rec10/rec10-git.git] / tstools / DtsEdit / src / gpac / isomedia.h
diff --git a/tstools/DtsEdit/src/gpac/isomedia.h b/tstools/DtsEdit/src/gpac/isomedia.h
new file mode 100644 (file)
index 0000000..bcd329f
--- /dev/null
@@ -0,0 +1,1852 @@
+/*\r
+ *                     GPAC - Multimedia Framework C SDK\r
+ *\r
+ *                     Copyright (c) Jean Le Feuvre 2000-2005 \r
+ *                                     All rights reserved\r
+ *\r
+ *  This file is part of GPAC / ISO Media File Format sub-project\r
+ *\r
+ *  GPAC is free software; you can redistribute it and/or modify\r
+ *  it under the terms of the GNU Lesser General Public License as published by\r
+ *  the Free Software Foundation; either version 2, or (at your option)\r
+ *  any later version.\r
+ *   \r
+ *  GPAC is distributed in the hope that it will be useful,\r
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ *  GNU Lesser General Public License for more details.\r
+ *   \r
+ *  You should have received a copy of the GNU Lesser General Public\r
+ *  License along with this library; see the file COPYING.  If not, write to\r
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. \r
+ *\r
+ */\r
+\r
+\r
+\r
+#ifndef _GF_ISOMEDIA_H_\r
+#define _GF_ISOMEDIA_H_\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+\r
+#include <gpac/mpeg4_odf.h>\r
+\r
+\r
+/*the isomedia file*/\r
+typedef struct __tag_isom GF_ISOFile;\r
+\r
+/*media sample object*/\r
+typedef struct\r
+{\r
+       /*data size*/\r
+       u32 dataLength;\r
+       /*data with padding if requested*/\r
+       char *data;\r
+       /*decoding time*/\r
+       u64 DTS;\r
+       /*relative offset for composition if needed*/\r
+       u32 CTS_Offset;\r
+       /*Random Access Point flag:\r
+        0: not random access\r
+        1: regular RAP, \r
+        2: sample is a redundant RAP. If set when adding the sample, this will create a sample dependency entry\r
+       */\r
+       u8 IsRAP;\r
+} GF_ISOSample;\r
+\r
+\r
+/*creates a new empty sample*/\r
+GF_ISOSample *gf_isom_sample_new();\r
+\r
+/*delete a sample. NOTE:the buffer content will be destroyed by default.\r
+if you wish to keep the buffer, set dataLength to 0 in the sample \r
+before deleting it\r
+the pointer is set to NULL after deletion*/\r
+void gf_isom_sample_del(GF_ISOSample **samp);\r
+\r
+\r
+\r
+/********************************************************************\r
+                               FILE FORMAT CONSTANTS\r
+********************************************************************/\r
+\r
+/*Modes for file opening\r
+               NOTE 1: All the READ function in this API can be used in EDIT/WRITE mode. \r
+However, some unexpected errors or values may happen in that case, depending\r
+on how much modifications you made (timing, track with 0 samples, ...)\r
+               On the other hand, none of the EDIT/WRITE functions will work in \r
+READ mode.\r
+               NOTE 2: The output structure of a edited file will sometimes be different \r
+from the original file, but the media-data and meta-data will be identical.\r
+The only change happens in the file media-data container(s) during edition\r
+               NOTE 3: when editing the file, you MUST set the final name of the modified file\r
+to something different. This API doesn't allow file overwriting.\r
+*/\r
+enum \r
+{\r
+       /*Opens file for dumping: same as read-only but keeps all movie fragments info untouched*/\r
+       GF_ISOM_OPEN_READ_DUMP = 0,\r
+       /*Opens a file in READ ONLY mode*/\r
+       GF_ISOM_OPEN_READ,\r
+       /*Opens a file in WRITE ONLY mode. Media Data is captured on the fly. In this mode, \r
+       the editing functions are disabled.*/\r
+       GF_ISOM_OPEN_WRITE,\r
+       /*Opens an existing file in EDIT mode*/\r
+       GF_ISOM_OPEN_EDIT,\r
+       /*Creates a new file in EDIT mode*/\r
+       GF_ISOM_WRITE_EDIT\r
+};\r
+\r
+/*Movie Options for file writing*/\r
+enum\r
+{\r
+       /*FLAT: the MediaData (MPEG4 ESs) is stored at the begining of the file*/\r
+       GF_ISOM_STORE_FLAT = 1,\r
+       /*STREAMABLE: the MetaData (File Info) is stored at the begining of the file \r
+       for fast access during download*/\r
+       GF_ISOM_STORE_STREAMABLE,\r
+       /*INTERLEAVED: Same as STREAMABLE, plus the media data is mixed by chunk  of fixed duration*/\r
+       GF_ISOM_STORE_INTERLEAVED,\r
+       /*INTERLEAVED +DRIFT: Same as INTERLEAVED, and adds time drift control to avoid creating too long chunks*/\r
+       GF_ISOM_STORE_DRIFT_INTERLEAVED,\r
+       /*tightly interleaves samples based on their DTS, therefore allowing better placement of samples in the file.\r
+       This is used for both http interleaving and Hinting optimizations*/\r
+       GF_ISOM_STORE_TIGHT\r
+\r
+};\r
+\r
+/*Some track may depend on other tracks for several reasons. They reference these tracks \r
+through the following Reference Types*/\r
+enum\r
+{\r
+       /*ref type for the OD track dependencies*/\r
+       GF_ISOM_REF_OD                  = GF_4CC( 'm', 'p', 'o', 'd' ),\r
+       /*ref type for stream dependencies*/\r
+       GF_ISOM_REF_DECODE = GF_4CC( 'd', 'p', 'n', 'd' ),\r
+       /*ref type for OCR (Object Clock Reference) dependencies*/\r
+       GF_ISOM_REF_OCR                         = GF_4CC( 's', 'y', 'n', 'c' ),\r
+       /*ref type for IPI (Intellectual Property Information) dependencies*/\r
+       GF_ISOM_REF_IPI                         = GF_4CC( 'i', 'p', 'i', 'r' ),\r
+       /*ref type for timed Meta Data tracks*/\r
+       GF_ISOM_REF_META                = GF_4CC( 'c', 'd', 's', 'c' ),\r
+       /*ref type for Hint tracks*/\r
+       GF_ISOM_REF_HINT                = GF_4CC( 'h', 'i', 'n', 't' ),\r
+       /*ref type for QT Chapter tracks*/\r
+       GF_ISOM_REF_CHAP                = GF_4CC( 'c', 'h', 'a', 'p' )\r
+};\r
+\r
+/*Track Edition flag*/\r
+enum {\r
+       /*empty segment in the track (no media for this segment)*/\r
+       GF_ISOM_EDIT_EMPTY              =       0x00,\r
+       /*dwelled segment in the track (one media sample for this segment)*/\r
+       GF_ISOM_EDIT_DWELL              =       0x01,\r
+       /*normal segment in the track*/\r
+       GF_ISOM_EDIT_NORMAL             =       0x02\r
+};\r
+\r
+/*Generic Media Types (YOU HAVE TO USE ONE OF THESE TYPES FOR COMPLIANT ISO MEDIA FILES)*/\r
+enum\r
+{\r
+       /*base media types*/\r
+       GF_ISOM_MEDIA_VISUAL    = GF_4CC( 'v', 'i', 'd', 'e' ),\r
+       GF_ISOM_MEDIA_AUDIO             = GF_4CC( 's', 'o', 'u', 'n' ),\r
+       GF_ISOM_MEDIA_HINT              = GF_4CC( 'h', 'i', 'n', 't' ),\r
+       GF_ISOM_MEDIA_META              = GF_4CC( 'm', 'e', 't', 'a' ),\r
+       GF_ISOM_MEDIA_TEXT              = GF_4CC( 't', 'e', 'x', 't' ),\r
+       GF_ISOM_MEDIA_SUBPIC    = GF_4CC( 's', 'u', 'b', 'p' ),\r
+\r
+       /*MPEG-4 media types*/\r
+       GF_ISOM_MEDIA_OD                = GF_4CC( 'o', 'd', 's', 'm' ),\r
+       GF_ISOM_MEDIA_OCR               = GF_4CC( 'c', 'r', 's', 'm' ),\r
+       GF_ISOM_MEDIA_SCENE             = GF_4CC( 's', 'd', 's', 'm' ),\r
+       GF_ISOM_MEDIA_MPEG7             = GF_4CC( 'm', '7', 's', 'm' ),\r
+       GF_ISOM_MEDIA_OCI               = GF_4CC( 'o', 'c', 's', 'm' ),\r
+       GF_ISOM_MEDIA_IPMP              = GF_4CC( 'i', 'p', 's', 'm' ),\r
+       GF_ISOM_MEDIA_MPEGJ             = GF_4CC( 'm', 'j', 's', 'm' ),\r
+       /*GPAC-defined, for any track using MPEG-4 systems signaling but with undefined streaml types*/\r
+       GF_ISOM_MEDIA_ESM               = GF_4CC( 'g', 'e', 's', 'm' ),\r
+\r
+       /*DIMS media type (same as scene but with a different mediaInfo)*/\r
+       GF_ISOM_MEDIA_DIMS              = GF_4CC( 'd', 'i', 'm', 's' ),\r
+\r
+       GF_ISOM_MEDIA_FLASH             = GF_4CC( 'f', 'l', 's', 'h' )\r
+};\r
+\r
+/* Encryption Scheme Type in the SchemeTypeInfoBox */\r
+enum \r
+{\r
+       GF_ISOM_ISMACRYP_SCHEME = GF_4CC( 'i', 'A', 'E', 'C' )\r
+};\r
+\r
+/*specific media sub-types - you shall make sure the media sub type is what you expect*/\r
+enum\r
+{\r
+       /*reserved, internal use in the lib. Indicates the track complies to MPEG-4 system\r
+       specification, and the usual OD framework tools may be used*/\r
+       GF_ISOM_SUBTYPE_MPEG4           = GF_4CC( 'M', 'P', 'E', 'G' ),\r
+       \r
+       /*reserved, internal use in the lib. Indicates the track is of GF_ISOM_SUBTYPE_MPEG4\r
+       but it is encrypted.*/\r
+       GF_ISOM_SUBTYPE_MPEG4_CRYP      = GF_4CC( 'E', 'N', 'C', 'M' ),\r
+\r
+       /*AVC/H264 media type - not listed as an MPEG-4 type, ALTHOUGH this library automatically remaps\r
+       GF_AVCConfig to MPEG-4 ESD*/\r
+       GF_ISOM_SUBTYPE_AVC_H264                = GF_4CC( 'a', 'v', 'c', '1' ),\r
+\r
+       /*3GPP(2) extension subtypes*/\r
+       GF_ISOM_SUBTYPE_3GP_H263                = GF_4CC( 's', '2', '6', '3' ),\r
+       GF_ISOM_SUBTYPE_3GP_AMR         = GF_4CC( 's', 'a', 'm', 'r' ),\r
+       GF_ISOM_SUBTYPE_3GP_AMR_WB      = GF_4CC( 's', 'a', 'w', 'b' ),\r
+       GF_ISOM_SUBTYPE_3GP_EVRC                = GF_4CC( 's', 'e', 'v', 'c' ),\r
+       GF_ISOM_SUBTYPE_3GP_QCELP       = GF_4CC( 's', 'q', 'c', 'p' ),\r
+       GF_ISOM_SUBTYPE_3GP_SMV         = GF_4CC( 's', 's', 'm', 'v' ),\r
+\r
+       /*3GPP DIMS*/\r
+       GF_ISOM_SUBTYPE_3GP_DIMS        = GF_4CC( 'd', 'i', 'm', 's' ),\r
+\r
+       GF_ISOM_SUBTYPE_AC3                     = GF_4CC( 'a', 'c', '-', '3' ),\r
+};\r
+\r
+\r
+\r
+\r
+/*direction for sample search (including SyncSamples search)\r
+Function using search allways specify the desired time in composition (presentation) time\r
+\r
+               (Sample N-1)    DesiredTime             (Sample N)\r
+\r
+FORWARD: will give the next sample given the desired time (eg, N)\r
+BACKWARD: will give the previous sample given the desired time (eg, N-1)\r
+SYNCFORWARD: will search from the desired point in time for a sync sample if any\r
+               If no sync info, behaves as FORWARD\r
+SYNCBACKWARD: will search till the desired point in time for a sync sample if any\r
+               If no sync info, behaves as BACKWARD\r
+SYNCSHADOW: use the sync shadow information to retrieve the sample.\r
+               If no SyncShadow info, behave as SYNCBACKWARD\r
+*/\r
+enum\r
+{\r
+       GF_ISOM_SEARCH_FORWARD          =       1,\r
+       GF_ISOM_SEARCH_BACKWARD         =       2,\r
+       GF_ISOM_SEARCH_SYNC_FORWARD     =       3,\r
+       GF_ISOM_SEARCH_SYNC_BACKWARD    =       4,\r
+       GF_ISOM_SEARCH_SYNC_SHADOW              =       5\r
+};\r
+\r
+/*Predefined File Brand codes (MPEG-4 and JPEG2000)*/\r
+enum\r
+{\r
+       /*file complying to the generic ISO Media File (base specification ISO/IEC 14496-12)\r
+       this is the default brand when creating a new movie*/\r
+       GF_ISOM_BRAND_ISOM = GF_4CC( 'i', 's', 'o', 'm' ),\r
+       /*file complying to the generic ISO Media File (base specification ISO/IEC 14496-12) + Meta extensions*/\r
+       GF_ISOM_BRAND_ISO2 =  GF_4CC( 'i', 's', 'o', '2' ),\r
+       /*file complying to ISO/IEC 14496-1 2001 edition. A .mp4 file without a brand\r
+       is equivalent to a file compatible with this brand*/\r
+       GF_ISOM_BRAND_MP41 = GF_4CC( 'm', 'p', '4', '1' ),\r
+       /*file complying to ISO/IEC 14496-14 (MP4 spec)*/\r
+       GF_ISOM_BRAND_MP42 = GF_4CC( 'm', 'p', '4', '2' ),\r
+       /*file complying to ISO/IEC 15444-3 (JPEG2000) without profile restriction*/\r
+       GF_ISOM_BRAND_MJP2 = GF_4CC( 'm', 'j', 'p', '2' ),\r
+       /*file complying to ISO/IEC 15444-3 (JPEG2000) with simple profile restriction*/\r
+       GF_ISOM_BRAND_MJ2S = GF_4CC( 'm', 'j', '2', 's' ),\r
+       /*old versions of 3GPP spec (without timed text)*/\r
+       GF_ISOM_BRAND_3GP4 = GF_4CC('3', 'g', 'p', '4'),\r
+       GF_ISOM_BRAND_3GP5 = GF_4CC('3', 'g', 'p', '5'),\r
+       /*final version of 3GPP file spec*/\r
+       GF_ISOM_BRAND_3GP6 = GF_4CC('3', 'g', 'p', '6'),\r
+       /*generci 3GPP file (several audio tracks, etc..)*/\r
+       GF_ISOM_BRAND_3GG6 = GF_4CC('3', 'g', 'g', '6'),\r
+       /*3GPP2 file spec*/\r
+       GF_ISOM_BRAND_3G2A = GF_4CC('3', 'g', '2', 'a'),\r
+       /*AVC file spec*/\r
+       GF_ISOM_BRAND_AVC1 = GF_4CC('a', 'v', 'c', '1'),\r
+       /* file complying to ISO/IEC 21000-9:2005 (MPEG-21 spec)*/\r
+       GF_ISOM_BRAND_MP21 = GF_4CC('m', 'p', '2', '1'),\r
+};\r
+\r
+\r
+/*MPEG-4 ProfileAndLevel codes*/\r
+enum\r
+{\r
+       GF_ISOM_PL_AUDIO,\r
+       GF_ISOM_PL_VISUAL,\r
+       GF_ISOM_PL_GRAPHICS,\r
+       GF_ISOM_PL_SCENE,\r
+       GF_ISOM_PL_OD,\r
+       GF_ISOM_PL_MPEGJ,\r
+       /*not a profile, just set/unset inlineFlag*/\r
+       GF_ISOM_PL_INLINE,\r
+};\r
+\r
+\r
+/********************************************************************\r
+                               GENERAL API FUNCTIONS\r
+********************************************************************/\r
+\r
+/*get the last fatal error that occured in the file\r
+ANY FUNCTION OF THIS API WON'T BE PROCESSED IF THE FILE HAS AN ERROR\r
+Note: some function may return an error while the movie has no error\r
+the last error is a FatalError, and is not always set if a bad \r
+param is specified...*/\r
+GF_Err gf_isom_last_error(GF_ISOFile *the_file);\r
+\r
+/*returns 1 if target file is an IsoMedia file, 0 otherwise*/\r
+Bool gf_isom_probe_file(const char *fileName);\r
+\r
+/*Opens an isoMedia File.\r
+tmp_dir: for the 2 edit modes only, specifies a location for temp file. If NULL, the librairy will use the default\r
+OS temporary file management schemes.*/\r
+GF_ISOFile *gf_isom_open(const char *fileName, u32 OpenMode, const char *tmp_dir);\r
+\r
+/*close the file, write it if new/edited*/\r
+GF_Err gf_isom_close(GF_ISOFile *the_file);\r
+\r
+/*delete the movie without saving it.*/\r
+void gf_isom_delete(GF_ISOFile *the_file);\r
+\r
+/*Get the mode of an open file*/\r
+u8 gf_isom_get_mode(GF_ISOFile *the_file);\r
+\r
+Bool gf_isom_is_JPEG2000(GF_ISOFile *mov);\r
+\r
+/********************************************************************\r
+                               STREAMING API FUNCTIONS\r
+********************************************************************/\r
+/*open a movie that can be uncomplete in READ_ONLY mode\r
+to use for http streaming & co\r
+\r
+NOTE: you must buffer the data to a local file, this mode DOES NOT handle \r
+http/ftp/... streaming\r
+\r
+BytesMissing is the predicted number of bytes missing for the file to be loaded\r
+Note that if the file is not optimized for streaming, this number is not accurate\r
+If the movie is successfully loaded (the_file non-NULL), BytesMissing is zero\r
+*/\r
+GF_Err gf_isom_open_progressive(const char *fileName, GF_ISOFile **the_file, u64 *BytesMissing);\r
+\r
+/*If requesting a sample fails with error GF_ISOM_INCOMPLETE_FILE, use this function\r
+to get the number of bytes missing to retrieve the sample*/\r
+u64 gf_isom_get_missing_bytes(GF_ISOFile *the_file, u32 trackNumber);\r
+\r
+\r
+/*Fragmented movie extensions*/\r
+\r
+/*return 0 if movie isn't fragmented, 1 otherwise*/\r
+u32 gf_isom_is_fragmented(GF_ISOFile *the_file);\r
+/*return 0 if track isn't fragmented, 1 otherwise*/\r
+u32 gf_isom_is_track_fragmented(GF_ISOFile *the_file, u32 TrackID);\r
+\r
+/*a file being downloaded may be a fragmented file. In this case only partial info \r
+is available once the file is successfully open (gf_isom_open_progressive), and since there is \r
+no information wrt number fragments (which could actually be generated on the fly \r
+at the sender side), you must call this function on regular bases in order to\r
+load newly downloaded fragments. Note this may result in Track/Movie duration changes\r
+and SampleCount change too ...*/\r
+GF_Err gf_isom_refresh_fragmented(GF_ISOFile *the_file, u64 *MissingBytes);\r
+\r
+/*check if file has movie info, eg has tracks & dynamic media. Some files may just use\r
+the base IsoMedia structure without "moov" container*/\r
+Bool gf_isom_has_movie(GF_ISOFile *file);\r
+\r
+/********************************************************************\r
+                               READING API FUNCTIONS\r
+********************************************************************/\r
+\r
+/*return the number of tracks in the movie, or -1 if error*/\r
+u32 gf_isom_get_track_count(GF_ISOFile *the_file);\r
+\r
+/*return the timescale of the movie, 0 if error*/\r
+u32 gf_isom_get_timescale(GF_ISOFile *the_file);\r
+\r
+/*return the duration of the movie, 0 if error*/\r
+u64 gf_isom_get_duration(GF_ISOFile *the_file);\r
+\r
+/*return the creation info of the movie*/\r
+GF_Err gf_isom_get_creation_time(GF_ISOFile *the_file, u64 *creationTime, u64 *modificationTime);\r
+\r
+/*return the trackID of track number n, or 0 if error*/\r
+u32 gf_isom_get_track_id(GF_ISOFile *the_file, u32 trackNumber);\r
+\r
+/*return the track number of the track of specified ID, or 0 if error*/\r
+u32 gf_isom_get_track_by_id(GF_ISOFile *the_file, u32 trackID);\r
+\r
+/*gets the enable flag of a track 0: NO, 1: yes, 2: error*/\r
+u8 gf_isom_is_track_enabled(GF_ISOFile *the_file, u32 trackNumber);\r
+\r
+/* determines if the track is encrypted 0: NO, 1: yes, 2: error*/\r
+u8 gf_isom_is_track_encrypted(GF_ISOFile *the_file, u32 trackNumber);\r
+\r
+/*get the track duration return 0 if bad param*/\r
+u64 gf_isom_get_track_duration(GF_ISOFile *the_file, u32 trackNumber);\r
+\r
+/*return the media type FOUR CHAR code type of the media*/\r
+u32 gf_isom_get_media_type(GF_ISOFile *the_file, u32 trackNumber);\r
+\r
+/*return the media type FOUR CHAR code type of the media*/\r
+u32 gf_isom_get_media_subtype(GF_ISOFile *the_file, u32 trackNumber, u32 DescriptionIndex);\r
+\r
+/*return the media type FOUR CHAR code type of an MPEG4 media (eg, mp4a, mp4v, enca, encv, etc...)\r
+returns 0 if not MPEG-4 subtype*/\r
+u32 gf_isom_get_mpeg4_subtype(GF_ISOFile *the_file, u32 trackNumber, u32 DescriptionIndex);\r
+\r
+/*Get the media (composition) time given the absolute time in the Movie\r
+mediaTime is set to 0 if the media is not playing at that time (empty time segment)*/\r
+GF_Err gf_isom_get_media_time(GF_ISOFile *the_file, u32 trackNumber, u32 movieTime, u64 *MediaTime);\r
+\r
+/*Get the number of "streams" stored in the media - a media can have several stream descriptions...*/\r
+u32 gf_isom_get_sample_description_count(GF_ISOFile *the_file, u32 trackNumber);\r
+\r
+/*Get the stream description index (eg, the ESD) for a given time IN MEDIA TIMESCALE\r
+return 0 if error or if empty*/\r
+u32 gf_isom_get_sample_description_index(GF_ISOFile *the_file, u32 trackNumber, u64 for_time);\r
+\r
+/*returns 1 if samples refering to the given stream description are present in the file\r
+0 otherwise*/\r
+Bool gf_isom_is_self_contained(GF_ISOFile *the_file, u32 trackNumber, u32 sampleDescriptionIndex);\r
+\r
+/*get the media duration (without edit) return 0 if no samples (URL streams)*/\r
+u64 gf_isom_get_media_duration(GF_ISOFile *the_file, u32 trackNumber);\r
+\r
+/*Get the timeScale of the media. */\r
+u32 gf_isom_get_media_timescale(GF_ISOFile *the_file, u32 trackNumber);\r
+\r
+/*return the maximum chunk duration of the track in milliseconds*/\r
+u32 gf_isom_get_max_chunk_duration(GF_ISOFile *the_file, u32 trackNumber);\r
+\r
+/*Get the HandlerDescription name. The outName must be:\r
+                (outName != NULL && *outName == NULL)\r
+the handler name is the string version of the MediaTypes*/\r
+GF_Err gf_isom_get_handler_name(GF_ISOFile *the_file, u32 trackNumber, const char **outName);\r
+\r
+/*Check a DataReference of this track (index >= 1)\r
+A Data Reference allows to construct a file without integrating the media data*/\r
+GF_Err gf_isom_check_data_reference(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex);\r
+\r
+/*get the location of the data. If URL && URN are NULL, the data is in this file\r
+both strings are const: don't free them.*/\r
+GF_Err gf_isom_get_data_reference(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex, const char **outURL, const char **outURN);\r
+\r
+/*Get the number of samples - return 0 if error*/\r
+u32 gf_isom_get_sample_count(GF_ISOFile *the_file, u32 trackNumber);\r
+\r
+/*Get constant sample size, or 0 if size not constant*/\r
+u32 gf_isom_get_constant_sample_size(GF_ISOFile *the_file, u32 trackNumber);\r
+/*returns total amount of media bytes in track*/\r
+u64 gf_isom_get_media_data_size(GF_ISOFile *the_file, u32 trackNumber);\r
+\r
+/*It may be desired to fetch samples with a bigger allocated buffer than their real size, in case the decoder\r
+reads more data than available. This sets the amount of extra bytes to allocate when reading samples from this track\r
+NOTE: the dataLength of the sample does NOT include padding*/\r
+GF_Err gf_isom_set_sample_padding(GF_ISOFile *the_file, u32 trackNumber, u32 padding_bytes);\r
+\r
+/*return a sample given its number, and set the StreamDescIndex of this sample\r
+this index allows to retrieve the stream description if needed (2 media in 1 track)\r
+return NULL if error*/\r
+GF_ISOSample *gf_isom_get_sample(GF_ISOFile *the_file, u32 trackNumber, u32 sampleNumber, u32 *StreamDescriptionIndex);\r
+\r
+/*same as gf_isom_get_sample but doesn't fetch media data\r
+@StreamDescriptionIndex (optional): set to stream description index\r
+@data_offset (optional): set to sample start offset in file.\r
+       \r
+         NOTE: when both StreamDescriptionIndex and data_offset are NULL, only DTS, CTS_Offset and RAP indications are \r
+retrieved (faster)\r
+*/\r
+GF_ISOSample *gf_isom_get_sample_info(GF_ISOFile *the_file, u32 trackNumber, u32 sampleNumber, u32 *StreamDescriptionIndex, u64 *data_offset);\r
+\r
+/*retrieves given sample DTS*/\r
+u64 gf_isom_get_sample_dts(GF_ISOFile *the_file, u32 trackNumber, u32 sampleNumber);\r
+\r
+/*returns sample duration in media timeScale*/\r
+u32 gf_isom_get_sample_duration(GF_ISOFile *the_file, u32 trackNumber, u32 sampleNumber);\r
+\r
+/*gets a sample given a desired decoding time IN MEDIA TIME SCALE\r
+and set the StreamDescIndex of this sample\r
+this index allows to retrieve the stream description if needed (2 media in 1 track)\r
+return GF_EOS if the desired time exceeds the media duration\r
+WARNING: the sample may not be sync even though the sync was requested (depends on the media and the editList)\r
+the SampleNum is optional. If non-NULL, will contain the sampleNumber*/\r
+GF_Err gf_isom_get_sample_for_media_time(GF_ISOFile *the_file, u32 trackNumber, u64 desiredTime, u32 *StreamDescriptionIndex, u8 SearchMode, GF_ISOSample **sample, u32 *SampleNum);\r
+\r
+/*retrieves given sample DTS*/\r
+u32 gf_isom_get_sample_from_dts(GF_ISOFile *the_file, u32 trackNumber, u64 dts);\r
+\r
+/*Track Edition functions*/\r
+\r
+/*return a sample given a desired time in the movie. MovieTime is IN MEDIA TIME SCALE , handles edit list.\r
+and set the StreamDescIndex of this sample\r
+this index allows to retrieve the stream description if needed (2 media in 1 track)\r
+sample must be set to NULL before calling. \r
+\r
+result Sample is NULL if an error occured\r
+if no sample is playing, an empty sample is returned with no data and a DTS set to MovieTime when serching in sync modes\r
+if no sample is playing, the closest sample in the edit time-line is returned when serching in regular modes\r
+\r
+WARNING: the sample may not be sync even though the sync was requested (depends on the media and the editList)\r
+\r
+Note: this function will handle re-timestamping the sample according to the mapping  of the media time-line \r
+on the track time-line. The sample TSs (DTS / CTS offset) are expressed in MEDIA TIME SCALE \r
+(to match the media stream TS resolution as indicated in media header / SLConfig)\r
+\r
+sampleNumber is optional and gives the number of the sample in the media\r
+*/\r
+GF_Err gf_isom_get_sample_for_movie_time(GF_ISOFile *the_file, u32 trackNumber, u64 movieTime, u32 *StreamDescriptionIndex, u8 SearchMode, GF_ISOSample **sample, u32 *sampleNumber);\r
+\r
+/*get the number of edited segment*/\r
+u32 gf_isom_get_edit_segment_count(GF_ISOFile *the_file, u32 trackNumber);\r
+\r
+/*Get the desired segment information*/\r
+GF_Err gf_isom_get_edit_segment(GF_ISOFile *the_file, u32 trackNumber, u32 SegmentIndex, u64 *EditTime, u64 *SegmentDuration, u64 *MediaTime, u8 *EditMode);\r
+\r
+/*get the number of languages for the copyright*/\r
+u32 gf_isom_get_copyright_count(GF_ISOFile *the_file);\r
+/*get the copyright and its language code given the index*/\r
+GF_Err gf_isom_get_copyright(GF_ISOFile *the_file, u32 Index, const char **threeCharCodes, const char **notice);\r
+/*get the opaque watermark info if any - returns GF_NOT_SUPPORTED if not present*/\r
+GF_Err gf_isom_get_watermark(GF_ISOFile *the_file, bin128 UUID, u8** data, u32* length);\r
+\r
+/*get the number of chapter for movie or track if trackNumber !=0*/\r
+u32 gf_isom_get_chapter_count(GF_ISOFile *the_file, u32 trackNumber);\r
+/*get the given movie or track (trackNumber!=0) chapter time and name - index is 1-based\r
+@chapter_time: retrives start time in milliseconds - may be NULL.\r
+@name: retrieves chapter name - may be NULL - SHALL NOT be destroyed by user\r
+*/\r
+GF_Err gf_isom_get_chapter(GF_ISOFile *the_file, u32 trackNumber, u32 Index, u64 *chapter_time, const char **name);\r
+\r
+/*\r
+return 0 if the media has no sync point info (eg, all samples are RAPs)\r
+return 1 if the media has sync points (eg some samples are RAPs)\r
+return 2 if the media has empty sync point info (eg no samples are RAPs). This will likely only happen \r
+                       in scalable context\r
+*/\r
+u8 gf_isom_has_sync_points(GF_ISOFile *the_file, u32 trackNumber);\r
+\r
+/*returns number of sync points*/\r
+u32 gf_isom_get_sync_point_count(GF_ISOFile *the_file, u32 trackNumber);\r
+\r
+/*returns 1 if one sample of the track is found to have a composition time offset (DTS<CTS)*/\r
+Bool gf_isom_has_time_offset(GF_ISOFile *the_file, u32 trackNumber);\r
+\r
+/*returns 1 if the track has sync shadow samples*/\r
+Bool gf_isom_has_sync_shadows(GF_ISOFile *the_file, u32 trackNumber);\r
+\r
+/*returns 1 if the track has sample dep indications*/\r
+Bool gf_isom_has_sample_dependency(GF_ISOFile *the_file, u32 trackNumber);\r
+\r
+/*rough estimation of file size, only works for completely self-contained files and without fragmentation\r
+for the current time*/\r
+u64 gf_isom_estimate_size(GF_ISOFile *the_file);\r
+\r
+u32 gf_isom_get_next_alternate_group_id(GF_ISOFile *movie);\r
+\r
+\r
+/*\r
+               MPEG-4 Systems extensions\r
+*/\r
+\r
+/*check if files has root OD/IOD or not*/\r
+Bool gf_isom_has_root_od(GF_ISOFile *the_file);\r
+\r
+/*return the root Object descriptor of the movie (can be NULL, OD or IOD, you have to check its tag)\r
+YOU HAVE TO DELETE THE DESCRIPTOR\r
+*/\r
+GF_Descriptor *gf_isom_get_root_od(GF_ISOFile *the_file);\r
+\r
+/*check the presence of a track in IOD. 0: NO, 1: YES, 2: ERROR*/\r
+u8 gf_isom_is_track_in_root_od(GF_ISOFile *the_file, u32 trackNumber);\r
+\r
+/*Get the GF_ESD given the StreamDescriptionIndex - YOU HAVE TO DELETE THE DESCRIPTOR*/\r
+GF_ESD *gf_isom_get_esd(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex);\r
+\r
+/*Get the decoderConfigDescriptor given the StreamDescriptionIndex - YOU HAVE TO DELETE THE DESCRIPTOR*/\r
+GF_DecoderConfig *gf_isom_get_decoder_config(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex);\r
+\r
+/*sets default TrackID (or ES_ID) for clock references. If trackNumber is 0, default sync track ID is reseted\r
+and will be reassigned at next ESD fetch*/\r
+void gf_isom_set_default_sync_track(GF_ISOFile *file, u32 trackNumber);\r
+\r
+/*Return the number of track references of a track for a given ReferenceType - return -1 if error*/\r
+s32 gf_isom_get_reference_count(GF_ISOFile *the_file, u32 trackNumber, u32 referenceType);\r
+\r
+/*Return the referenced track number for a track and a given ReferenceType and Index\r
+return -1 if error, 0 if the reference is a NULL one, or the trackNumber\r
+*/\r
+GF_Err gf_isom_get_reference(GF_ISOFile *the_file, u32 trackNumber, u32 referenceType, u32 referenceIndex, u32 *refTrack);\r
+\r
+u8 gf_isom_get_pl_indication(GF_ISOFile *the_file, u8 PL_Code);\r
+\r
+/*locates the first ObjectDescriptor using the given track by inspecting any OD tracks*/\r
+u32 gf_isom_find_od_for_track(GF_ISOFile *file, u32 track);\r
+\r
+/*returns file name*/\r
+const char *gf_isom_get_filename(GF_ISOFile *the_file);\r
+\r
+/*\r
+               Update of the Reading API for IsoMedia Version 2\r
+*/\r
+\r
+/*retrieves the brand of the file. The brand is introduced in V2 to differenciate\r
+MP4, MJPEG2000 and QT while indicating compatibilities\r
+the brand is one of the above defined code, or any other registered brand\r
+\r
+minorVersion is an optional parameter (can be set to NULL) , \r
+               "informative integer for the minor version of the major brand"\r
+AlternateBrandsCount is an optional parameter (can be set to NULL) , \r
+       giving the number of compatible brands. \r
+\r
+       The function will set brand to 0 if no brand indication is found in the file\r
+*/\r
+GF_Err gf_isom_get_brand_info(GF_ISOFile *the_file, u32 *brand, u32 *minorVersion, u32 *AlternateBrandsCount);\r
+\r
+/*gets an alternate brand indication. BrandIndex is 1-based\r
+Note that the Major brand should always be indicated in the alternate brands*/\r
+GF_Err gf_isom_get_alternate_brand(GF_ISOFile *the_file, u32 BrandIndex, u32 *brand);\r
+\r
+/*get the number of padding bits at the end of a given sample if any*/\r
+GF_Err gf_isom_get_sample_padding_bits(GF_ISOFile *the_file, u32 trackNumber, u32 sampleNumber, u8 *NbBits);\r
+/*indicates whether the track samples use padding bits or not*/\r
+Bool gf_isom_has_padding_bits(GF_ISOFile *the_file, u32 trackNumber);\r
+\r
+/*returns width and height of the given visual sample desc - error if not a visual track*/\r
+GF_Err gf_isom_get_visual_info(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex, u32 *Width, u32 *Height);\r
+\r
+/*returns samplerate, channels and bps of the given audio track - error if not a audio track*/\r
+GF_Err gf_isom_get_audio_info(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex, u32 *SampleRate, u32 *Channels, u8 *bitsPerSample);\r
+\r
+/*returns track visual info - all coord values are expressed as 16.16 fixed point floats*/\r
+GF_Err gf_isom_get_track_layout_info(GF_ISOFile *the_file, u32 trackNumber, u32 *width, u32 *height, s32 *translation_x, s32 *translation_y, s16 *layer);\r
+\r
+/*returns width and height of the given visual sample desc - error if not a visual track*/\r
+GF_Err gf_isom_get_pixel_aspect_ratio(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex, u32 *hSpacing, u32 *vSpacing);\r
+\r
+/*\r
+       User Data Manipulation (cf write API too)\r
+*/\r
+\r
+/* Gets the number of UserDataItems with the same ID / UUID in the desired track or \r
+in the movie if trackNumber is set to 0*/\r
+u32 gf_isom_get_user_data_count(GF_ISOFile *the_file, u32 trackNumber, u32 UserDataType, bin128 UUID);\r
+/* Gets the UserData for the specified item from the track or the movie if trackNumber is set to 0\r
+data is allocated by the function and is yours to free\r
+you musty pass (userData != NULL && *userData=NULL)*/\r
+GF_Err gf_isom_get_user_data(GF_ISOFile *the_file, u32 trackNumber, u32 UserDataType, bin128 UUID, u32 UserDataIndex, char **userData, u32 *userDataSize);\r
+\r
+\r
+/*gets 3char media language code - @three_char_code must be at least 4 char long*/\r
+GF_Err gf_isom_get_media_language(GF_ISOFile *the_file, u32 trackNumber, char *three_char_code);\r
+\r
+/*Unknown sample description*/\r
+typedef struct\r
+{\r
+       /*codec tag is the containing box's tag, 0 if UUID is used*/\r
+       u32 codec_tag;\r
+       /*entry UUID if no tag is used*/\r
+       bin128 UUID;\r
+\r
+       u16 version;\r
+       u16 revision;\r
+       u32 vendor_code;\r
+\r
+       /*video codecs only*/\r
+       u32 temporal_quality;\r
+       u32 spacial_quality;\r
+       u16 width, height;\r
+       u32 h_res, v_res;\r
+       u16 depth;\r
+       u16 color_table_index;\r
+       char compressor_name[33];\r
+\r
+       /*audio codecs only*/\r
+       u32 samplerate;\r
+       u16 nb_channels;\r
+       u16 bits_per_sample;\r
+\r
+       /*if present*/\r
+       char *extension_buf;\r
+       u32 extension_buf_size;\r
+} GF_GenericSampleDescription;\r
+\r
+/*returns wrapper for unknown entries - you must delete it yourself*/\r
+GF_GenericSampleDescription *gf_isom_get_generic_sample_description(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex);\r
+\r
+/*retrieves default values for a track fragment. Each variable is optional and \r
+if set will contain the default value for this track samples*/\r
+GF_Err gf_isom_get_fragment_defaults(GF_ISOFile *the_file, u32 trackNumber, \r
+                                                        u32 *defaultDuration, u32 *defaultSize, u32 *defaultDescriptionIndex,\r
+                                                        u32 *defaultRandomAccess, u8 *defaultPadding, u16 *defaultDegradationPriority);\r
+\r
+\r
+/*non standard extensions used for video packets in order to keep AU structure in the file format \r
+(no normative tables for that). Info is NOT written to disk.\r
+*/\r
+/*get number of fragments for a sample */\r
+u32 gf_isom_get_sample_fragment_count(GF_ISOFile *the_file, u32 trackNumber, u32 sampleNumber);\r
+/*get sample fragment size*/\r
+u16 gf_isom_get_sample_fragment_size(GF_ISOFile *the_file, u32 trackNumber, u32 sampleNumber, u32 FragmentIndex);\r
+\r
+/*returns 1 if file is single AV (max one audio, one video, one text and basic od/bifs)*/\r
+Bool gf_isom_is_single_av(GF_ISOFile *file);\r
+\r
+/*guess which std this file refers to. return value:\r
+       GF_ISOM_BRAND_ISOM: unrecognized std\r
+       GF_ISOM_BRAND_3GP5: 3GP file (max 1 audio, 1 video) without text track\r
+       GF_ISOM_BRAND_3GP6: 3GP file (max 1 audio, 1 video) with text track\r
+       GF_ISOM_BRAND_3GG6: 3GP file multitrack file\r
+       GF_ISOM_BRAND_3G2A: 3GP2 file\r
+       GF_ISOM_BRAND_AVC1: AVC file\r
+       FCC("ISMA"): ISMA file (may overlap with 3GP)\r
+       GF_ISOM_BRAND_MP42: any generic MP4 file (eg with BIFS/OD/MPEG-4 systems stuff)\r
+\r
+  for files without movie, returns the file meta handler type\r
+*/\r
+u32 gf_isom_guess_specification(GF_ISOFile *file);\r
+\r
+\r
+#ifndef GPAC_READ_ONLY\r
+\r
+\r
+/********************************************************************\r
+                               EDITING/WRITING API FUNCTIONS\r
+********************************************************************/\r
+\r
+/*set the timescale of the movie*/\r
+GF_Err gf_isom_set_timescale(GF_ISOFile *the_file, u32 timeScale);\r
+\r
+/*creates a new Track. If trackID = 0, the trackID is chosen by the API\r
+returns the track number or 0 if error*/\r
+u32 gf_isom_new_track(GF_ISOFile *the_file, u32 trackID, u32 MediaType, u32 TimeScale);\r
+\r
+/*removes the desired track - internal cross dependancies will be updated.\r
+WARNING: any OD streams with references to this track through  ODUpdate, ESDUpdate, ESDRemove commands\r
+will be rewritten*/\r
+GF_Err gf_isom_remove_track(GF_ISOFile *the_file, u32 trackNumber);\r
+\r
+/*sets the enable flag of a track*/\r
+GF_Err gf_isom_set_track_enabled(GF_ISOFile *the_file, u32 trackNumber, u8 enableTrack);\r
+\r
+/*changes the trackID - all track references present in the file are updated\r
+returns error if trackID is already in used in the file*/\r
+GF_Err gf_isom_set_track_id(GF_ISOFile *the_file, u32 trackNumber, u32 trackID);\r
+\r
+/*Add samples to a track. Use streamDescriptionIndex to specify the desired stream (if several)*/\r
+GF_Err gf_isom_add_sample(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex, GF_ISOSample *sample);\r
+\r
+/*Add sync shadow sample to a track. \r
+- There must be a regular sample with the same DTS. \r
+- Sync Shadow samples MUST be RAP\r
+- Currently, adding sync shadow must be done in order (no sample insertion)\r
+*/\r
+GF_Err gf_isom_add_sample_shadow(GF_ISOFile *the_file, u32 trackNumber, GF_ISOSample *sample);\r
+\r
+/*add data to current sample in the track. Use this function for media with\r
+fragmented options such as MPEG-4 video packets. This will update the data size.\r
+CANNOT be used with OD media type*/\r
+GF_Err gf_isom_append_sample_data(GF_ISOFile *the_file, u32 trackNumber, char *data, u32 data_size);\r
+\r
+/*Add sample references to a track. The dataOffset is the offset of the data in the referenced file\r
+you MUST have created a StreamDescription with URL or URN specifying your referenced file\r
+Use streamDescriptionIndex to specify the desired stream (if several)*/\r
+GF_Err gf_isom_add_sample_reference(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex, GF_ISOSample *sample, u64 dataOffset);\r
+\r
+/*set the duration of the last media sample. If not set, the duration of the last sample is the\r
+duration of the previous one if any, or media TimeScale (default value).*/\r
+GF_Err gf_isom_set_last_sample_duration(GF_ISOFile *the_file, u32 trackNumber, u32 duration);\r
+\r
+/*sets a track reference*/\r
+GF_Err gf_isom_set_track_reference(GF_ISOFile *the_file, u32 trackNumber, u32 referenceType, u32 ReferencedTrackID);\r
+\r
+/*removes a track reference*/\r
+GF_Err gf_isom_remove_track_reference(GF_ISOFile *the_file, u32 trackNumber, u32 referenceType, u32 ReferenceIndex);\r
+\r
+/*sets track handler name. name is either NULL (reset), a UTF-8 formatted string or a UTF8 file \r
+resource in the form "file://path/to/file_utf8" */\r
+GF_Err gf_isom_set_handler_name(GF_ISOFile *the_file, u32 trackNumber, const char *nameUTF8);\r
+\r
+/*Update the sample size table - this is needed when using @gf_isom_append_sample_data in case the resulting samples\r
+are of same sizes (typically in 3GP speech tracks)*/\r
+GF_Err gf_isom_refresh_size_info(GF_ISOFile *file, u32 trackNumber);\r
+\r
+/*Update Sample functions*/\r
+\r
+/*update a given sample of the media.\r
+@data_only: if set, only the sample data is updated, not other info*/\r
+GF_Err gf_isom_update_sample(GF_ISOFile *the_file, u32 trackNumber, u32 sampleNumber, GF_ISOSample *sample, Bool data_only);\r
+\r
+/*update a sample reference in the media. Note that the sample MUST exists,\r
+that sample->data MUST be NULL and sample->dataLength must be NON NULL;*/\r
+GF_Err gf_isom_update_sample_reference(GF_ISOFile *the_file, u32 trackNumber, u32 sampleNumber, GF_ISOSample *sample, u64 data_offset);\r
+\r
+/*Remove a given sample*/\r
+GF_Err gf_isom_remove_sample(GF_ISOFile *the_file, u32 trackNumber, u32 sampleNumber);\r
+\r
+/*changes media time scale*/\r
+GF_Err gf_isom_set_media_timescale(GF_ISOFile *the_file, u32 trackNumber, u32 new_timescale);\r
+\r
+/*set the save file name of the (edited) movie. \r
+If the movie is edited, the default fileName is avp_#openName)\r
+NOTE: you cannot save an edited file under the same name (overwrite not allowed)\r
+If the movie is created (WRITE mode), the default filename is #openName*/\r
+GF_Err gf_isom_set_final_name(GF_ISOFile *the_file, char *filename);\r
+\r
+\r
+/*set the storage mode of a file (FLAT, STREAMABLE, INTERLEAVED)*/\r
+GF_Err gf_isom_set_storage_mode(GF_ISOFile *the_file, u8 storageMode);\r
+u8 gf_isom_get_storage_mode(GF_ISOFile *the_file);\r
+\r
+/*set the interleaving time of media data (INTERLEAVED mode only)\r
+InterleaveTime is in MovieTimeScale*/\r
+GF_Err gf_isom_set_interleave_time(GF_ISOFile *the_file, u32 InterleaveTime);\r
+u32 gf_isom_get_interleave_time(GF_ISOFile *the_file);\r
+\r
+/*set the copyright in one language.*/\r
+GF_Err gf_isom_set_copyright(GF_ISOFile *the_file, const char *threeCharCode, char *notice);\r
+\r
+/*deletes copyright (1-based indexes)*/\r
+GF_Err gf_isom_remove_copyright(GF_ISOFile *the_file, u32 index);\r
+\r
+\r
+GF_Err gf_isom_set_alternate_group_id(GF_ISOFile *movie, u32 trackNumber, u32 groupId);\r
+\r
+/*add chapter info:\r
+if trackNumber is 0, the chapter info is added to the movie, otherwise to the track\r
+@timestamp: chapter start time in milliseconds. Chapters are added in order to the file. If a chapter with same timestamp\r
+       is found, its name is updated but no entry is created.\r
+@name: chapter name. If NULL, defaults to 'Chapter N'\r
+*/\r
+GF_Err gf_isom_add_chapter(GF_ISOFile *the_file, u32 trackNumber, u64 timestamp, char *name);\r
+\r
+/*deletes copyright (1-based index, index 0 for all)*/\r
+GF_Err gf_isom_remove_chapter(GF_ISOFile *the_file, u32 trackNumber, u32 index);\r
+\r
+/*set watermark info for movie*/\r
+GF_Err gf_isom_set_watermark(GF_ISOFile *the_file, bin128 UUID, u8* data, u32 length);\r
+\r
+/*Track Edition functions - used to change the normal playback of the media if desired\r
+NOTE: IT IS THE USER RESPONSABILITY TO CREATE A CONSISTENT TIMELINE FOR THE TRACK\r
+This API provides the basic hooks and some basic consistency checking\r
+but can not check the desired functionality of the track edits\r
+*/\r
+\r
+/*update or insert a new edit segment in the track time line. Edits are used to modify\r
+the media normal timing. EditTime and EditDuration are expressed in Movie TimeScale\r
+If a segment with EditTime already exists, IT IS ERASED\r
+if there is a segment before this new one, its duration is adjust to match EditTime of\r
+the new segment\r
+WARNING: The first segment always have an EditTime of 0. You should insert an empty or dwelled segment first.*/\r
+GF_Err gf_isom_set_edit_segment(GF_ISOFile *the_file, u32 trackNumber, u64 EditTime, u64 EditDuration, u64 MediaTime, u8 EditMode);\r
+\r
+/*same as above except only modifies duartion type and mediaType*/\r
+GF_Err gf_isom_modify_edit_segment(GF_ISOFile *the_file, u32 trackNumber, u32 seg_index, u64 EditDuration, u64 MediaTime, u8 EditMode);\r
+/*same as above except only appends new segment*/\r
+GF_Err gf_isom_append_edit_segment(GF_ISOFile *the_file, u32 trackNumber, u64 EditDuration, u64 MediaTime, u8 EditMode);\r
+\r
+/*remove the edit segments for the whole track*/\r
+GF_Err gf_isom_remove_edit_segments(GF_ISOFile *the_file, u32 trackNumber);\r
+\r
+/*remove the given edit segment (1-based index). If this is not the last segment, the next segment duration\r
+is updated to maintain a continous timeline*/\r
+GF_Err gf_isom_remove_edit_segment(GF_ISOFile *the_file, u32 trackNumber, u32 seg_index);\r
+\r
+/*\r
+                               User Data Manipulation\r
+\r
+               You can add specific typed data to either a track or the movie: the UserData\r
+       The type must be formated as a FourCC if you have a registered 4CC type\r
+       but the usual is to set a UUID (128 bit ID for box type) which never conflict\r
+       with existing structures in the format\r
+               To manipulate a UUID user data set the UserDataType to 0 and specify a valid UUID.\r
+Otherwise the UUID parameter is ignored\r
+               Several items with the same ID or UUID can be added (this allows you to store any\r
+       kind/number of private information under a unique ID / UUID)\r
+*/\r
+/*Add a user data item in the desired track or in the movie if TrackNumber is 0*/\r
+GF_Err gf_isom_add_user_data(GF_ISOFile *the_file, u32 trackNumber, u32 UserDataType, bin128 UUID, char *data, u32 DataLength);\r
+\r
+/*remove all user data items from the desired track or from the movie if TrackNumber is 0*/\r
+GF_Err gf_isom_remove_user_data(GF_ISOFile *the_file, u32 trackNumber, u32 UserDataType, bin128 UUID);\r
+\r
+/*remove a user data item from the desired track or from the movie if TrackNumber is 0\r
+use the UDAT read functions to get the item index*/\r
+GF_Err gf_isom_remove_user_data_item(GF_ISOFile *the_file, u32 trackNumber, u32 UserDataType, bin128 UUID, u32 UserDataIndex);\r
+\r
+/*remove track, moov (trackNumber=0) or file-level (trackNumber=0xFFFFFFFF) UUID box of matching type*/\r
+GF_Err gf_isom_remove_uuid(GF_ISOFile *movie, u32 trackNumber, bin128 UUID);\r
+/*adds track, moov (trackNumber=0) or file-level (trackNumber=0xFFFFFFFF) UUID box of given type*/\r
+GF_Err gf_isom_add_uuid(GF_ISOFile *movie, u32 trackNumber, bin128 UUID, char *data, u32 data_size);\r
+\r
+/*\r
+               Update of the Writing API for IsoMedia Version 2\r
+*/     \r
+\r
+/*use a compact track version for sample size. This is not usually recommended \r
+except for speech codecs where the track has a lot of small samples\r
+compaction is done automatically while writing based on the track's sample sizes*/\r
+GF_Err gf_isom_use_compact_size(GF_ISOFile *the_file, u32 trackNumber, u8 CompactionOn);\r
+\r
+/*sets the brand of the movie*/\r
+GF_Err gf_isom_set_brand_info(GF_ISOFile *the_file, u32 MajorBrand, u32 MinorVersion);\r
+\r
+/*adds or remove an alternate brand for the movie*/\r
+GF_Err gf_isom_modify_alternate_brand(GF_ISOFile *the_file, u32 Brand, u8 AddIt);\r
+\r
+/*removes all alternate brands except major brand*/\r
+GF_Err gf_isom_reset_alt_brands(GF_ISOFile *movie);\r
+\r
+/*set the number of padding bits at the end of a given sample if needed\r
+if the function is never called the padding bit info is ignored\r
+this MUST be called on an existin sample*/\r
+GF_Err gf_isom_set_sample_padding_bits(GF_ISOFile *the_file, u32 trackNumber, u32 sampleNumber, u8 NbBits);\r
+\r
+\r
+/*since v2 you must specify w/h of video tracks for authoring tools (no decode the video cfg / first sample)*/\r
+GF_Err gf_isom_set_visual_info(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex, u32 Width, u32 Height);\r
+\r
+/*mainly used for 3GPP text since most ISO-based formats ignore these (except MJ2K) \r
+all coord values are expressed as 16.16 fixed point floats*/\r
+GF_Err gf_isom_set_track_layout_info(GF_ISOFile *the_file, u32 trackNumber, u32 width, u32 height, s32 translation_x, s32 translation_y, s16 layer);\r
+\r
+GF_Err gf_isom_set_pixel_aspect_ratio(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex, u32 hSpacing, u32 vSpacing);\r
+\r
+/*set SR & nbChans for audio description*/\r
+GF_Err gf_isom_set_audio_info(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex, u32 sampleRate, u32 nbChannels, u8 bitsPerSample);\r
+\r
+/*non standard extensions: set/remove a fragment of a sample - this is used for video packets\r
+in order to keep AU structure in the file format (no normative tables for that). Info is NOT written to disk*/\r
+GF_Err gf_isom_add_sample_fragment(GF_ISOFile *the_file, u32 trackNumber, u32 sampleNumber, u16 FragmentSize);\r
+GF_Err gf_isom_remove_sample_fragment(GF_ISOFile *the_file, u32 trackNumber, u32 sampleNumber);\r
+/*remove all sample fragment info for this track*/\r
+GF_Err gf_isom_remove_sample_fragments(GF_ISOFile *the_file, u32 trackNumber);\r
+\r
+/*set CTS unpack mode (used for B-frames & like): in unpack mode, each sample uses one entry in CTTS tables\r
+unpack=0: set unpack on - !!creates a CTTS table if none found!!\r
+unpack=1: set unpack off and repacks all table info\r
+*/\r
+GF_Err gf_isom_set_cts_packing(GF_ISOFile *the_file, u32 trackNumber, Bool unpack);\r
+/*modify CTS offset of a given sample (used for B-frames) - MUST be called in unpack mode only*/\r
+GF_Err gf_isom_modify_cts_offset(GF_ISOFile *the_file, u32 trackNumber, u32 sample_number, u32 offset);\r
+/*remove CTS offset table (used for B-frames)*/\r
+GF_Err gf_isom_remove_cts_info(GF_ISOFile *the_file, u32 trackNumber);\r
+\r
+/*set 3char code media language*/\r
+GF_Err gf_isom_set_media_language(GF_ISOFile *the_file, u32 trackNumber, char *three_char_code);\r
+\r
+/*removes given stream description*/\r
+GF_Err gf_isom_remove_sample_description(GF_ISOFile *the_file, u32 trackNumber, u32 streamDescIndex);\r
+\r
+/*\r
+       some authoring extensions\r
+*/\r
+/*sets name for authoring - if name is NULL reset authoring name*/\r
+GF_Err gf_isom_set_track_name(GF_ISOFile *the_file, u32 trackNumber, char *name);\r
+/*gets authoring name*/\r
+const char *gf_isom_get_track_name(GF_ISOFile *the_file, u32 trackNumber);\r
+\r
+/*\r
+                       MPEG-4 Extensions\r
+*/\r
+\r
+/*set a profile and level indication for the movie iod (created if needed)\r
+if the flag is ProfileLevel is 0 this means the movie doesn't require\r
+the specific codec (equivalent to 0xFF value in MPEG profiles)*/\r
+GF_Err gf_isom_set_pl_indication(GF_ISOFile *the_file, u8 PL_Code, u8 ProfileLevel);\r
+\r
+/*set the rootOD ID of the movie if you need it. By default, movies are created without root ODs*/\r
+GF_Err gf_isom_set_root_od_id(GF_ISOFile *the_file, u32 OD_ID);\r
+\r
+/*set the rootOD URL of the movie if you need it (only needed to create empty file pointing \r
+to external ressource)*/\r
+GF_Err gf_isom_set_root_od_url(GF_ISOFile *the_file, char *url_string);\r
+\r
+/*remove the root OD*/\r
+GF_Err gf_isom_remove_root_od(GF_ISOFile *the_file);\r
+\r
+/*Add a system descriptor to the OD of the movie*/\r
+GF_Err gf_isom_add_desc_to_root_od(GF_ISOFile *the_file, GF_Descriptor *theDesc);\r
+\r
+/*add a track to the root OD*/\r
+GF_Err gf_isom_add_track_to_root_od(GF_ISOFile *the_file, u32 trackNumber);\r
+\r
+/*remove a track to the root OD*/\r
+GF_Err gf_isom_remove_track_from_root_od(GF_ISOFile *the_file, u32 trackNumber);\r
+\r
+/*Create a new StreamDescription (GF_ESD) in the file. The URL and URN are used to \r
+describe external media, this will creat a data reference for the media*/\r
+GF_Err gf_isom_new_mpeg4_description(GF_ISOFile *the_file, u32 trackNumber, GF_ESD *esd, char *URLname, char *URNname, u32 *outDescriptionIndex);\r
+\r
+/*use carefully. Very usefull when you made a lot of changes (IPMP, IPI, OCI, ...)\r
+THIS WILL REPLACE THE WHOLE DESCRIPTOR ...*/\r
+GF_Err gf_isom_change_mpeg4_description(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex, GF_ESD *newESD);\r
+\r
+/*Add a system descriptor to the ESD of a stream - you have to delete the descriptor*/\r
+GF_Err gf_isom_add_desc_to_description(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex, GF_Descriptor *theDesc);\r
+\r
+\r
+/*Default extensions*/\r
+\r
+/*Create a new unknown StreamDescription in the file. The URL and URN are used to \r
+describe external media, this will creat a data reference for the media\r
+use this to store media not currently supported by the ISO media format\r
+*/\r
+GF_Err gf_isom_new_generic_sample_description(GF_ISOFile *the_file, u32 trackNumber, char *URLname, char *URNname, GF_GenericSampleDescription *udesc, u32 *outDescriptionIndex);\r
+\r
+/*change the data field of an unknown sample description*/\r
+GF_Err gf_isom_change_generic_sample_description(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex, GF_GenericSampleDescription *udesc);\r
+\r
+/*\r
+special shortcut for stream description cloning from a given input file (this avoids inspecting for media type)\r
+@the_file, @trackNumber: destination file and track\r
+@orig_file, @orig_track, @orig_desc_index: orginal file, track and sample description\r
+@URLname, @URNname, @outDescriptionIndex: same usage as with gf_isom_new_mpeg4_description\r
+*/\r
+GF_Err gf_isom_clone_sample_description(GF_ISOFile *the_file, u32 trackNumber, GF_ISOFile *orig_file, u32 orig_track, u32 orig_desc_index, char *URLname, char *URNname, u32 *outDescriptionIndex);\r
+\r
+/*special shortcut: clones a track (everything except media data and sample info (DTS? CTS, RAPs, etc...) \r
+also clones sampleDescriptions\r
+@keep_data_ref: if set, external data references are kept, otherwise they are removed (track media data will be self-contained)\r
+@dest_track: track number of cloned track*/\r
+GF_Err gf_isom_clone_track(GF_ISOFile *orig_file, u32 orig_track, GF_ISOFile *dest_file, Bool keep_data_ref, u32 *dest_track);\r
+/*special shortcut: clones IOD PLs from orig to dest if any*/\r
+GF_Err gf_isom_clone_pl_indications(GF_ISOFile *orig, GF_ISOFile *dest);\r
+/*clones root OD from input to output file, without copying root OD track references*/\r
+GF_Err gf_isom_clone_root_od(GF_ISOFile *input, GF_ISOFile *output);\r
+\r
+/*returns true if same set of sample description in both tracks - this does include self-contained checking\r
+and reserved flags. The specific media cfg (DSI & co) is not analysed, only\r
+a brutal memory comparaison is done*/\r
+Bool gf_isom_is_same_sample_description(GF_ISOFile *f1, u32 tk1, GF_ISOFile *f2, u32 tk2);\r
+\r
+GF_Err gf_isom_set_JPEG2000(GF_ISOFile *mov, Bool set_on);\r
+\r
+/*\r
+                       Movie Fragments Writing API\r
+               Movie Fragments is a feature of ISO media files for fragmentation\r
+       of a presentation meta-data and interleaving with its media data.\r
+       This enables faster http fast start for big movies, and also reduces the risk\r
+       of data loss in case of a recording crash, because meta data and media data\r
+       can be written to disk at regular times\r
+               This API provides simple function calls to setup such a movie and write it\r
+       The process implies:\r
+               1- creating a movie in the usual way (track, stream descriptions, (IOD setup\r
+       copyright, ...)\r
+               2- possibly add some samples in the regular fashion\r
+               3- setup track fragments for all track that will be written in a fragmented way\r
+       (note that you can create/write a track that has no fragmentation at all)\r
+               4- finalize the movie for fragmentation (this will flush all meta-data and \r
+       any media-data added to disk, ensuring all vital information for the presentation\r
+       is stored on file and not lost in case of crash/poweroff)\r
+       \r
+         then 5-6 as often as desired\r
+               5- start a new movie fragment\r
+               6- add samples to each setup track\r
+\r
+\r
+  IMPORTANT NOTES:\r
+               * Movie Fragments can only be used in GF_ISOM_OPEN_WRITE mode (capturing)\r
+  and no editing functionalities can be used\r
+               * the fragmented movie API uses TrackID and not TrackNumber \r
+*/\r
+\r
+/*\r
+setup a track for fragmentation by specifying some default values for \r
+storage efficiency\r
+*TrackID: track identifier\r
+*DefaultStreamDescriptionIndex: the default description used by samples in this track\r
+*DefaultSampleDuration: default duration of samples in this track\r
+*DefaultSampleSize: default size of samples in this track (0 if unknown)\r
+*DefaultSampleIsSync: default key-flag (RAP) of samples in this track\r
+*DefaultSamplePadding: default padding bits for samples in this track\r
+*DefaultDegradationPriority: default degradation priority for samples in this track\r
+\r
+*/\r
+GF_Err gf_isom_setup_track_fragment(GF_ISOFile *the_file, u32 TrackID, \r
+                                                        u32 DefaultStreamDescriptionIndex,\r
+                                                        u32 DefaultSampleDuration,\r
+                                                        u32 DefaultSampleSize,\r
+                                                        u8 DefaultSampleIsSync,\r
+                                                        u8 DefaultSamplePadding,\r
+                                                        u16 DefaultDegradationPriority);\r
+\r
+/*flushes data to disk and prepare movie fragmentation*/\r
+GF_Err gf_isom_finalize_for_fragment(GF_ISOFile *the_file);\r
+\r
+/*starts a new movie fragment*/\r
+GF_Err gf_isom_start_fragment(GF_ISOFile *the_file);\r
+\r
+\r
+enum\r
+{\r
+       /*indicates that the track fragment has no samples but still has a duration\r
+       (silence-detection in audio codecs, ...). \r
+       param: indicates duration*/\r
+       GF_ISOM_TRAF_EMPTY,\r
+       /*I-Frame detection: this can reduce file size by detecting I-frames and\r
+       optimizing sample flags (padding, priority, ..)\r
+       param: on/off (0/1)*/\r
+       GF_ISOM_TRAF_RANDOM_ACCESS,\r
+       /*activate data cache on track fragment. This is usefull when writing interleaved\r
+       media from a live source (typically audio-video), and greatly reduces file size\r
+       param: Number of samples (> 1) to cache before disk flushing. You shouldn't try \r
+       to cache too many samples since this will load your memory. base that on FPS/SR*/\r
+       GF_ISOM_TRAF_DATA_CACHE\r
+};\r
+\r
+/*set options. Options can be set at the begining of each new fragment only, and for the\r
+lifetime of the fragment*/\r
+GF_Err gf_isom_set_fragment_option(GF_ISOFile *the_file, u32 TrackID, u32 Code, u32 param);\r
+\r
+\r
+/*adds a sample to a fragmented track\r
+\r
+*TrackID: destination track\r
+*sample: sample to add\r
+*StreamDescriptionIndex: stream description for this sample. If 0, the default one \r
+is used\r
+*Duration: sample duration.\r
+Note: because of the interleaved nature of the meta/media data, the sample duration\r
+MUST be provided (in case of regular tracks, this was computed internally by the lib)\r
+*PaddingBits: padding bits for the sample, or 0\r
+*DegradationPriority for the sample, or 0\r
+\r
+*/\r
+\r
+GF_Err gf_isom_fragment_add_sample(GF_ISOFile *the_file, u32 TrackID, GF_ISOSample *sample, \r
+                                                                u32 StreamDescriptionIndex, \r
+                                                                u32 Duration,\r
+                                                                u8 PaddingBits, u16 DegradationPriority);\r
+\r
+/*appends data into last sample of track for video fragments/other media\r
+CANNOT be used with OD tracks*/\r
+GF_Err gf_isom_fragment_append_data(GF_ISOFile *the_file, u32 TrackID, char *data, u32 data_size, u8 PaddingBits);\r
+\r
+\r
+\r
+/******************************************************************\r
+               GENERIC Publishing API\r
+******************************************************************/\r
+\r
+/*Removes all sync shadow entries for a given track. The shadow samples are NOT removed; they must be removed\r
+by the user app*/\r
+GF_Err gf_isom_remove_sync_shadows(GF_ISOFile *the_file, u32 trackNumber);\r
+\r
+/*Use this function to do the shadowing if you use shadowing.\r
+the sample to be shadowed MUST be a non-sync sample (ignored if not)\r
+the sample shadowing must be a Sync sample (error if not)*/\r
+GF_Err gf_isom_set_sync_shadow(GF_ISOFile *the_file, u32 trackNumber, u32 sampleNumber, u32 syncSample);\r
+\r
+/*set the GroupID of a track (only used for optimized interleaving). By setting GroupIDs\r
+you can specify the storage order for media data of a group of streams. This is usefull\r
+for BIFS presentation so that static resources of the scene can be downloaded before BIFS*/\r
+GF_Err gf_isom_set_track_group(GF_ISOFile *the_file, u32 trackNumber, u32 GroupID);\r
+\r
+/*set the priority of a track within a Group (used for optimized interleaving and hinting). \r
+This allows tracks to be stored before other within a same group, for instance the \r
+hint track data can be stored just before the media data, reducing disk seeking\r
+for a same time, within a group of tracks, the track with the lowest inversePriority will \r
+be written first*/\r
+GF_Err gf_isom_set_track_priority_in_group(GF_ISOFile *the_file, u32 trackNumber, u32 InversePriority);\r
+\r
+/*set the max SamplesPerChunk (for file optimization, mainly in FLAT and STREAMABLE modes)*/\r
+GF_Err gf_isom_set_max_samples_per_chunk(GF_ISOFile *the_file, u32 trackNumber, u32 maxSamplesPerChunk);\r
+\r
+/*associate a given SL config with a given ESD while extracting the OD information\r
+all the SL params must be fixed by the calling app!\r
+The SLConfig is stored by the API for further use. A NULL pointer will result\r
+in using the default SLConfig (predefined = 2) remapped to predefined = 0\r
+This is usefull while reading the IOD / OD stream of an MP4 file. Note however that\r
+only full AUs are extracted, therefore the calling application must SL-packetize the streams*/\r
+GF_Err gf_isom_set_extraction_slc(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex, GF_SLConfig *slConfig);\r
+\r
+GF_Err gf_isom_get_extraction_slc(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex, GF_SLConfig **slConfig);\r
+\r
+u32 gf_isom_get_track_group(GF_ISOFile *the_file, u32 trackNumber);\r
+u32 gf_isom_get_track_priority_in_group(GF_ISOFile *the_file, u32 trackNumber);\r
+\r
+/*stores movie config (storage mode, interleave time, track groupIDs, priorities and names) in UDTA(kept on disk)\r
+if @remove_all is set, removes all stored info, otherwise recompute all stored info*/\r
+GF_Err gf_isom_store_movie_config(GF_ISOFile *the_file, Bool remove_all);\r
+/*restores movie config (storage mode, interleave time, track groupIDs, priorities and names) if found*/\r
+GF_Err gf_isom_load_movie_config(GF_ISOFile *the_file);\r
+\r
+/*setup interleaving for storage (shortcut for storeage mode + interleave_time)*/\r
+GF_Err gf_isom_make_interleave(GF_ISOFile *mp4file, Double TimeInSec);\r
+\r
+\r
+/******************************************************************\r
+               GENERIC HINTING WRITING API\r
+******************************************************************/\r
+\r
+/*supported hint formats - ONLY RTP now*/\r
+enum\r
+{\r
+       GF_ISOM_HINT_RTP = GF_4CC('r', 't', 'p', ' '),\r
+};\r
+\r
+\r
+/*Setup the resources based on the hint format\r
+This function MUST be called after creating a new hint track and before\r
+any other calls on this track*/\r
+GF_Err gf_isom_setup_hint_track(GF_ISOFile *the_file, u32 trackNumber, u32 HintType);\r
+\r
+/*Create a HintDescription for the HintTrack\r
+the rely flag indicates whether a reliable transport protocol is desired/required\r
+for data transport\r
+       0: not desired (UDP/IP). NB: most RTP streaming servers only support UDP/IP for data\r
+       1: preferable (TCP/IP if possible or UDP/IP)\r
+       2: required (TCP/IP only)\r
+The HintDescriptionIndex is set, to be used when creating a HINT sample\r
+*/\r
+GF_Err gf_isom_new_hint_description(GF_ISOFile *the_file, u32 trackNumber, s32 HintTrackVersion, s32 LastCompatibleVersion, u8 Rely, u32 *HintDescriptionIndex);\r
+\r
+/*Starts a new sample for the hint track. A sample is just a collection of packets\r
+the transmissionTime is indicated in the media timeScale of the hint track*/\r
+GF_Err gf_isom_begin_hint_sample(GF_ISOFile *the_file, u32 trackNumber, u32 HintDescriptionIndex, u32 TransmissionTime);\r
+\r
+/*stores the hint sample in the file once all your packets for this sample are done\r
+set IsRandomAccessPoint if you want to indicate that this is a random access point \r
+in the stream*/\r
+GF_Err gf_isom_end_hint_sample(GF_ISOFile *the_file, u32 trackNumber, u8 IsRandomAccessPoint);\r
+\r
+\r
+/******************************************************************\r
+               PacketHandling functions\r
+               Data can be added at the end or at the beginning of the current packet\r
+               by setting AtBegin to 1 the data will be added at the begining\r
+               This allows constructing the packet payload before any meta-data\r
+******************************************************************/\r
+\r
+/*adds a blank chunk of data in the sample that is skipped while streaming*/\r
+GF_Err gf_isom_hint_blank_data(GF_ISOFile *the_file, u32 trackNumber, u8 AtBegin);\r
+\r
+/*adds a chunk of data in the packet that is directly copied while streaming\r
+NOTE: dataLength MUST BE <= 14 bytes, and you should only use this function\r
+to add small blocks of data (encrypted parts, specific headers, ...)*/\r
+GF_Err gf_isom_hint_direct_data(GF_ISOFile *the_file, u32 trackNumber, char *data, u32 dataLength, u8 AtBegin);\r
+\r
+/*adds a reference to some sample data in the packet\r
+SourceTrackID: the ID of the track where the referenced sample is\r
+SampleNumber: the sample number containing the data to be added\r
+DataLength: the length of bytes to copy in the packet\r
+offsetInSample: the offset in bytes in the sample at which to begin copying data\r
+\r
+extra_data: only used when the sample is actually the sample that will contain this packet\r
+(usefull to store en encrypted version of a packet only available while streaming)\r
+       In this case, set SourceTrackID to the HintTrack ID and SampleNumber to 0\r
+       In this case, the DataOffset MUST BE NULL and length will indicate the extra_data size\r
+\r
+Note that if you want to reference a previous HintSample in the hintTrack, you will \r
+have to parse the sample yourself ...\r
+*/\r
+GF_Err gf_isom_hint_sample_data(GF_ISOFile *the_file, u32 trackNumber, u32 SourceTrackID, u32 SampleNumber, u16 DataLength, u32 offsetInSample, char *extra_data, u8 AtBegin);\r
+\r
+\r
+/*adds a reference to some stream description data in the packet (headers, ...)\r
+SourceTrackID: the ID of the track where the referenced sample is\r
+StreamDescriptionIndex: the index of the stream description in the desired track\r
+DataLength: the length of bytes to copy in the packet\r
+offsetInDescription: the offset in bytes in the description at which to begin copying data\r
+\r
+Since it is far from being obvious what this offset is, we recommend not using this \r
+function. The ISO Media Format specification is currently being updated to solve\r
+this issue*/\r
+GF_Err gf_isom_hint_sample_description_data(GF_ISOFile *the_file, u32 trackNumber, u32 SourceTrackID, u32 StreamDescriptionIndex, u16 DataLength, u32 offsetInDescription, u8 AtBegin);\r
+\r
+\r
+/******************************************************************\r
+               RTP SPECIFIC WRITING API\r
+******************************************************************/\r
+\r
+/*Creates a new RTP packet in the HintSample. If a previous packet was created, \r
+it is stored in the hint sample and a new packet is created.\r
+- relativeTime: RTP time offset of this packet in the HintSample if any - in hint track \r
+time scale. Used for data smoothing by servers.\r
+- PackingBit: the 'P' bit of the RTP packet header\r
+- eXtensionBit: the'X' bit of the RTP packet header\r
+- MarkerBit: the 'M' bit of the RTP packet header\r
+- PayloadType: the payload type, on 7 bits, format 0x0XXXXXXX\r
+- B_frame: indicates if this is a B-frame packet. Can be skipped by a server\r
+- IsRepeatedPacket: indicates if this is a duplicate packet of a previous one.\r
+Can be skipped by a server\r
+- SequenceNumber: the RTP base sequence number of the packet. Because of support for repeated\r
+packets, you have to set the sequence number yourself.*/\r
+GF_Err gf_isom_rtp_packet_begin(GF_ISOFile *the_file, u32 trackNumber, s32 relativeTime, u8 PackingBit, u8 eXtensionBit, u8 MarkerBit, u8 PayloadType, u8 B_frame, u8 IsRepeatedPacket, u16 SequenceNumber);\r
+\r
+/*set the flags of the RTP packet*/\r
+GF_Err gf_isom_rtp_packet_set_flags(GF_ISOFile *the_file, u32 trackNumber, u8 PackingBit, u8 eXtensionBit, u8 MarkerBit, u8 disposable_packet, u8 IsRepeatedPacket);\r
+\r
+/*set the time offset of this packet. This enables packets to be placed in the hint track \r
+in decoding order, but have their presentation time-stamp in the transmitted \r
+packet in a different order. Typically used for MPEG video with B-frames\r
+*/\r
+GF_Err gf_isom_rtp_packet_set_offset(GF_ISOFile *the_file, u32 trackNumber, s32 timeOffset);\r
+\r
+                                                                  \r
+/*set some specific info in the HintDescription for RTP*/\r
+\r
+/*sets the RTP TimeScale that the server use to send packets\r
+some RTP payloads may need a specific timeScale that is not the timeScale in the file format\r
+the default timeScale choosen by the API is the MediaTimeScale of the hint track*/\r
+GF_Err gf_isom_rtp_set_timescale(GF_ISOFile *the_file, u32 trackNumber, u32 HintDescriptionIndex, u32 TimeScale);\r
+/*sets the RTP TimeOffset that the server will add to the packets\r
+if not set, the server adds a random offset*/\r
+GF_Err gf_isom_rtp_set_time_offset(GF_ISOFile *the_file, u32 trackNumber, u32 HintDescriptionIndex, u32 TimeOffset);\r
+/*sets the RTP SequenceNumber Offset that the server will add to the packets\r
+if not set, the server adds a random offset*/\r
+GF_Err gf_isom_rtp_set_time_sequence_offset(GF_ISOFile *the_file, u32 trackNumber, u32 HintDescriptionIndex, u32 SequenceNumberOffset);\r
+\r
+\r
+\r
+/******************************************************************\r
+               SDP SPECIFIC WRITING API\r
+******************************************************************/\r
+/*add an SDP line to the SDP container at the track level (media-specific SDP info)\r
+NOTE: the \r\n end of line for SDP is automatically inserted*/\r
+GF_Err gf_isom_sdp_add_track_line(GF_ISOFile *the_file, u32 trackNumber, const char *text);\r
+/*remove all SDP info at the track level*/\r
+GF_Err gf_isom_sdp_clean_track(GF_ISOFile *the_file, u32 trackNumber);\r
+\r
+/*add an SDP line to the SDP container at the movie level (presentation SDP info)\r
+NOTE: the \r\n end of line for SDP is automatically inserted*/\r
+GF_Err gf_isom_sdp_add_line(GF_ISOFile *the_file, const char *text);\r
+/*remove all SDP info at the movie level*/\r
+GF_Err gf_isom_sdp_clean(GF_ISOFile *the_file);\r
+\r
+#endif /*GPAC_READ_ONLY*/\r
+\r
+/*Get SDP info at the movie level*/\r
+GF_Err gf_isom_sdp_get(GF_ISOFile *the_file, const char **sdp, u32 *length);\r
+/*Get SDP info at the track level*/\r
+GF_Err gf_isom_sdp_track_get(GF_ISOFile *the_file, u32 trackNumber, const char **sdp, u32 *length);\r
+\r
+u32 gf_isom_get_payt_count(GF_ISOFile *the_file, u32 trackNumber);\r
+const char *gf_isom_get_payt_info(GF_ISOFile *the_file, u32 trackNumber, u32 index, u32 *payID);\r
+\r
+/*dumps file structures into XML trace file */\r
+GF_Err gf_isom_dump(GF_ISOFile *file, FILE *trace);\r
+/*dumps RTP hint samples structure into XML trace file\r
+       @trackNumber, @SampleNum: hint track and hint sample number\r
+       @trace: output\r
+*/\r
+GF_Err gf_isom_dump_hint_sample(GF_ISOFile *the_file, u32 trackNumber, u32 SampleNum, FILE * trace);\r
+\r
+\r
+\r
+/*small hint reader - performs data caching*/\r
+\r
+/*resets hint reading parameters, returns an error if the hint type is not supported for reading\r
+packet sequence number is always reseted to 0\r
+@sample_start: indicates from where the packets should be read (regular 1-based sample number)\r
+@ts_offset: constant offset for timestamps, must be expressed in media timescale (which is the hint timescale).\r
+       usually 0 (no offset)\r
+@sn_offset: offset for packet sequence number (first packet will have a SN of 1 + sn_offset)\r
+       usually 0\r
+@ssrc: sync source identifier for RTP\r
+*/\r
+GF_Err gf_isom_reset_hint_reader(GF_ISOFile *the_file, u32 trackNumber, u32 sample_start, u32 ts_offset, u32 sn_offset, u32 ssrc);\r
+\r
+/*reads next hint packet. ALl packets are read in transmission (decoding) order\r
+returns an error if not supported, or GF_EOS when no more packets are available\r
+currently only RTP reader is supported\r
+@pck_data, @pck_size: output packet data (must be freed by caller) - contains all info to be sent \r
+       on the wire, eg for RTP contains the RTP header and the data\r
+@disposable (optional): indicates that the packet can be droped when late (B-frames & co)\r
+@repeated (optional): indicates this is a repeated packet (same one has already been sent)\r
+@trans_ts (optional): indicates the transmission time of the packet, expressed in hint timescale, taking into account\r
+the ts_offset specified in gf_isom_reset_hint_reader. Depending on packets this may not be the same\r
+as the hint sample timestamp + ts_offset, some packets may need to be sent earlier (B-frames)\r
+@sample_num (optional): indicates hint sample number the packet belongs to\r
+*/\r
+GF_Err gf_isom_next_hint_packet(GF_ISOFile *the_file, u32 trackNumber, char **pck_data, u32 *pck_size, Bool *disposable, Bool *repeated, u32 *trans_ts, u32 *sample_num);\r
+\r
+\r
+/*\r
+                               3GPP specific extensions\r
+       NOTE: MPEG-4 OD Framework cannot be used with 3GPP files.\r
+       Stream Descriptions are not GF_ESD, just generic config options as specified in this file\r
+*/\r
+\r
+/*Generic 3GP/3GP2 config record*/\r
+typedef struct \r
+{\r
+       /*GF_4CC record type, one fo the above GF_ISOM_SUBTYPE_3GP_ * subtypes*/\r
+       u32 type;\r
+       /*4CC vendor name*/\r
+       u32 vendor;\r
+       /*codec version*/\r
+       u8 decoder_version;\r
+       /*number of sound frames per IsoMedia sample, >0 and <=15. The very last sample may contain less frames. */\r
+       u8 frames_per_sample;\r
+\r
+       /*H263 ONLY - Level and profile*/\r
+       u8 H263_level, H263_profile;\r
+\r
+       /*AMR(WB) ONLY - num of mode for the codec*/\r
+       u16 AMR_mode_set;\r
+       /*AMR(WB) ONLY - changes in codec mode per sample*/\r
+       u8 AMR_mode_change_period;\r
+} GF_3GPConfig;\r
+\r
+\r
+/*return the 3GP config for this tream description, NULL if not a 3GPP track*/\r
+GF_3GPConfig *gf_isom_3gp_config_get(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex);\r
+#ifndef GPAC_READ_ONLY\r
+/*create the track config*/\r
+GF_Err gf_isom_3gp_config_new(GF_ISOFile *the_file, u32 trackNumber, GF_3GPConfig *config, char *URLname, char *URNname, u32 *outDescriptionIndex);\r
+/*update the track config - subtypes shall NOT differ*/\r
+GF_Err gf_isom_3gp_config_update(GF_ISOFile *the_file, u32 trackNumber, GF_3GPConfig *config, u32 DescriptionIndex);\r
+#endif /*GPAC_READ_ONLY*/\r
+\r
+/*AVC/H264 extensions - GF_AVCConfig is defined in mpeg4_odf.h*/\r
+\r
+/*gets uncompressed AVC config - user is responsible for deleting it*/\r
+GF_AVCConfig *gf_isom_avc_config_get(GF_ISOFile *the_file, u32 trackNumber, u32 DescriptionIndex);\r
+\r
+#ifndef GPAC_READ_ONLY\r
+/*creates new AVC config*/\r
+GF_Err gf_isom_avc_config_new(GF_ISOFile *the_file, u32 trackNumber, GF_AVCConfig *cfg, char *URLname, char *URNname, u32 *outDescriptionIndex);\r
+/*updates AVC config*/\r
+GF_Err gf_isom_avc_config_update(GF_ISOFile *the_file, u32 trackNumber, u32 DescriptionIndex, GF_AVCConfig *cfg);\r
+#endif\r
+\r
+\r
+/*\r
+       3GP timed text handling\r
+\r
+       NOTE: currently only writing API is developped, the reading one is not used in MPEG-4 since\r
+       MPEG-4 maps 3GP timed text to MPEG-4 Streaming Text (part 17)\r
+*/\r
+\r
+/*set streamihng text reading mode: if do_convert is set, all text samples will be retrieved as TTUs\r
+and ESD will be emulated for text tracks.*/\r
+GF_Err gf_isom_text_set_streaming_mode(GF_ISOFile *the_file, Bool do_convert);\r
+\r
+/*exports text track to given format\r
+@dump_type: 0 for TTXT, 1 for srt, 2 for SVG\r
+*/\r
+GF_Err gf_isom_text_dump(GF_ISOFile *the_file, u32 track, FILE *dump, u32 dump_type);\r
+\r
+/*returns encoded TX3G box (text sample description for 3GPP text streams) as needed by RTP or other standards:\r
+       @sidx: 1-based stream description index\r
+       @sidx_offset: \r
+               if 0, the sidx will NOT be written before the encoded TX3G\r
+               if not 0, the sidx will be written before the encoded TX3G, with the given offset. Offset sshould be at \r
+               least 128 for most commmon usage of TX3G (RTP, MPEG-4 timed text, etc)\r
+\r
+*/\r
+GF_Err gf_isom_text_get_encoded_tx3g(GF_ISOFile *file, u32 track, u32 sidx, u32 sidx_offset, char **tx3g, u32 *tx3g_size);\r
+\r
+/*checks if this text description is already inserted\r
+@outDescIdx: set to 0 if not found, or descIndex\r
+@same_style, @same_box: indicates if default styles and box are used\r
+*/\r
+GF_Err gf_isom_text_has_similar_description(GF_ISOFile *the_file, u32 trackNumber, GF_TextSampleDescriptor *desc, u32 *outDescIdx, Bool *same_box, Bool *same_styles);\r
+\r
+/*text sample formatting*/\r
+typedef struct _3gpp_text_sample GF_TextSample;\r
+/*creates text sample handle*/\r
+GF_TextSample *gf_isom_new_text_sample();\r
+/*destroy text sample handle*/\r
+void gf_isom_delete_text_sample(GF_TextSample *tx_samp);\r
+\r
+#ifndef GPAC_READ_ONLY\r
+\r
+/*Create a new TextSampleDescription in the file. \r
+The URL and URN are used to describe external media, this will create a data reference for the media\r
+GF_TextSampleDescriptor is defined in mpeg4_odf.h\r
+*/\r
+GF_Err gf_isom_new_text_description(GF_ISOFile *the_file, u32 trackNumber, GF_TextSampleDescriptor *desc, char *URLname, char *URNname, u32 *outDescriptionIndex);\r
+/*change the text sample description*/\r
+GF_Err gf_isom_update_text_description(GF_ISOFile *movie, u32 trackNumber, u32 descriptionIndex, GF_TextSampleDescriptor *desc);\r
+\r
+/*reset text sample content*/\r
+GF_Err gf_isom_text_reset(GF_TextSample * tx_samp);\r
+/*reset text sample styles but keep text*/\r
+GF_Err gf_isom_text_reset_styles(GF_TextSample * samp);\r
+\r
+/*sets UTF16 marker for text data. This MUST be called on an empty sample. If text data added later \r
+on (cf below) is not formatted as UTF16 data(2 bytes char) the resulting text sample won't be compliant, \r
+but this library WON'T WARN*/\r
+GF_Err gf_isom_text_set_utf16_marker(GF_TextSample * samp);\r
+/*append text to sample - text_len is the number of bytes to be written from text_data. This allows \r
+handling UTF8 and UTF16 strings in a transparent manner*/\r
+GF_Err gf_isom_text_add_text(GF_TextSample * tx_samp, char *text_data, u32 text_len);\r
+/*append style modifyer to sample*/\r
+GF_Err gf_isom_text_add_style(GF_TextSample * tx_samp, GF_StyleRecord *rec);\r
+/*appends highlight modifier for the sample \r
+       @start_char: first char highlighted, \r
+       @end_char: first char not highlighted*/\r
+GF_Err gf_isom_text_add_highlight(GF_TextSample * samp, u16 start_char, u16 end_char);\r
+/*sets highlight color for the whole sample*/\r
+GF_Err gf_isom_text_set_highlight_color(GF_TextSample * samp, u8 r, u8 g, u8 b, u8 a);\r
+GF_Err gf_isom_text_set_highlight_color_argb(GF_TextSample * samp, u32 argb);\r
+/*appends a new karaoke sequence in the sample\r
+       @start_time: karaoke start time expressed in text stream timescale, but relative to the sample media time\r
+*/\r
+GF_Err gf_isom_text_add_karaoke(GF_TextSample * samp, u32 start_time);\r
+/*appends a new segment in the current karaoke sequence - you must build sequences in order to be compliant\r
+       @end_time: segment end time expressed in text stream timescale, but relative to the sample media time\r
+       @start_char: first char highlighted, \r
+       @end_char: first char not highlighted\r
+*/\r
+GF_Err gf_isom_text_set_karaoke_segment(GF_TextSample * samp, u32 end_time, u16 start_char, u16 end_char);\r
+/*sets scroll delay for the whole sample (scrolling is enabled through GF_TextSampleDescriptor.DisplayFlags)\r
+       @scroll_delay: delay for scrolling expressed in text stream timescale\r
+*/\r
+GF_Err gf_isom_text_set_scroll_delay(GF_TextSample * samp, u32 scroll_delay);\r
+/*appends hyperlinking for the sample\r
+       @URL: ASCII url\r
+       @altString: ASCII hint (tooltip, ...) for end user\r
+       @start_char: first char hyperlinked, \r
+       @end_char: first char not hyperlinked\r
+*/\r
+GF_Err gf_isom_text_add_hyperlink(GF_TextSample * samp, char *URL, char *altString, u16 start_char, u16 end_char);\r
+/*sets current text box (display pos&size within the text track window) for the sample*/\r
+GF_Err gf_isom_text_set_box(GF_TextSample * samp, s16 top, s16 left, s16 bottom, s16 right);\r
+/*appends blinking for the sample\r
+       @start_char: first char blinking, \r
+       @end_char: first char not blinking\r
+*/\r
+GF_Err gf_isom_text_add_blink(GF_TextSample * samp, u16 start_char, u16 end_char);\r
+/*sets wrap flag for the sample - currently only 0 (no wrap) and 1 ("soft wrap") are allowed in 3GP*/\r
+GF_Err gf_isom_text_set_wrap(GF_TextSample * samp, u8 wrap_flags);\r
+\r
+/*formats sample as a regular GF_ISOSample. The resulting sample will always be marked as random access\r
+text sample content is kept untouched*/\r
+GF_ISOSample *gf_isom_text_to_sample(GF_TextSample * tx_samp);\r
+\r
+#endif //GPAC_READ_ONLY\r
+\r
+/*****************************************************\r
+               ISMACryp Samples\r
+*****************************************************/\r
+/*flags for GF_ISMASample*/\r
+enum \r
+{\r
+       /*signals the stream the sample belongs to uses selective encryption*/\r
+       GF_ISOM_ISMA_USE_SEL_ENC = 1,\r
+       /*signals the sample is encrypted*/\r
+       GF_ISOM_ISMA_IS_ENCRYPTED = 2,\r
+};\r
+\r
+typedef struct\r
+{\r
+       /*IV in ISMACryp is Byte Stream Offset*/\r
+       u64 IV;\r
+       u8 IV_length;/*repeated from sampleDesc for convenience*/\r
+       u8 *key_indicator;\r
+       u8 KI_length;/*repeated from sampleDesc for convenience*/\r
+       u32 dataLength;\r
+       char *data;\r
+       u32 flags;\r
+} GF_ISMASample;\r
+/**\r
+ * creates a new empty ISMA sample\r
+ */\r
+GF_ISMASample *gf_isom_ismacryp_new_sample();\r
+\r
+/*delete an ISMA sample. NOTE:the buffers content will be destroyed by default.\r
+if you wish to keep the buffer, set dataLength to 0 in the sample before deleting it*/\r
+void gf_isom_ismacryp_delete_sample(GF_ISMASample *samp);\r
+\r
+/*decodes ISMACryp sample based on all info in ISMACryp sample description*/\r
+GF_ISMASample *gf_isom_ismacryp_sample_from_data(char *data, u32 dataLength, Bool use_selective_encryption, u8 KI_length, u8 IV_length);\r
+/*rewrites samp content from s content*/\r
+GF_Err gf_isom_ismacryp_sample_to_sample(GF_ISMASample *s, GF_ISOSample *dest);\r
+\r
+/*decodes ISMACryp sample based on sample and its descrition index - returns NULL if not an ISMA sample \r
+Note: input sample is NOT destroyed*/\r
+GF_ISMASample *gf_isom_get_ismacryp_sample(GF_ISOFile *the_file, u32 trackNumber, GF_ISOSample *samp, u32 sampleDescriptionIndex);\r
+\r
+/*returns whether the given media is a protected one or not - return scheme protection 4CC*/\r
+u32 gf_isom_is_media_encrypted(GF_ISOFile *the_file, u32 trackNumber, u32 sampleDescriptionIndex);\r
+\r
+/*returns whether the given media is a protected ISMACryp one or not*/\r
+Bool gf_isom_is_ismacryp_media(GF_ISOFile *the_file, u32 trackNumber, u32 sampleDescriptionIndex);\r
+\r
+/*returns whether the given media is a protected ISMACryp one or not*/\r
+Bool gf_isom_is_omadrm_media(GF_ISOFile *the_file, u32 trackNumber, u32 sampleDescriptionIndex);\r
+\r
+GF_Err gf_isom_get_omadrm_info(GF_ISOFile *the_file, u32 trackNumber, u32 sampleDescriptionIndex, u32 *outOriginalFormat,\r
+                                                          u32 *outSchemeType, u32 *outSchemeVersion,\r
+                                                          const char **outContentID, const char **outRightsIssuerURL, const char **outTextualHeaders, u32 *outTextualHeadersLen, u64 *outPlaintextLength, u32 *outEncryptionType, Bool *outSelectiveEncryption, u32 *outIVLength, u32 *outKeyIndicationLength);\r
+/*retrieves ISMACryp info for the given track & SDI - all output parameters are optional - URIs SHALL NOT BE MODIFIED BY USER\r
+       @outOriginalFormat: retrieves orginal protected media format - usually GF_ISOM_SUBTYPE_MPEG4\r
+       @outSchemeType: retrieves 4CC of protection scheme (GF_ISOM_ISMACRYP_SCHEME = iAEC in ISMACryp 1.0)\r
+       outSchemeVersion: retrieves version of protection scheme (1 in ISMACryp 1.0)\r
+       outSchemeURI: retrieves URI location of scheme \r
+       outKMS_URI: retrieves URI location of key management system - only valid with ISMACryp 1.0\r
+       outSelectiveEncryption: specifies whether sample-based encryption is used in media - only valid with ISMACryp 1.0\r
+       outIVLength: specifies length of Initial Vector - only valid with ISMACryp 1.0\r
+       outKeyIndicationLength: specifies length of key indicator - only valid with ISMACryp 1.0\r
+\r
+  outSelectiveEncryption, outIVLength and outKeyIndicationLength are usually not needed to decode an \r
+  ISMA sample when using gf_isom_get_ismacryp_sample fct above\r
+*/\r
+GF_Err gf_isom_get_ismacryp_info(GF_ISOFile *the_file, u32 trackNumber, u32 sampleDescriptionIndex, u32 *outOriginalFormat, u32 *outSchemeType, u32 *outSchemeVersion, const char **outSchemeURI, const char **outKMS_URI, Bool *outSelectiveEncryption, u32 *outIVLength, u32 *outKeyIndicationLength);\r
+\r
+\r
+#ifndef GPAC_READ_ONLY\r
+/*removes ISMACryp protection info (does not perform decryption :)*/\r
+GF_Err gf_isom_remove_ismacryp_protection(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex);\r
+\r
+/*creates ISMACryp protection info (does not perform encryption :)*/\r
+GF_Err gf_isom_set_ismacryp_protection(GF_ISOFile *the_file, u32 trackNumber, u32 desc_index, u32 scheme_type, \r
+                                                  u32 scheme_version, char *scheme_uri, char *kms_URI,\r
+                                                  Bool selective_encryption, u32 KI_length, u32 IV_length);\r
+\r
+/*change scheme URI and/or KMS URI for crypted files. Other params cannot be changed once the media is crypted\r
+       @scheme_uri: new scheme URI, or NULL to keep previous\r
+       @kms_uri: new KMS URI, or NULL to keep previous\r
+*/\r
+GF_Err gf_isom_change_ismacryp_protection(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex, char *scheme_uri, char *kms_uri);\r
+\r
+\r
+GF_Err gf_isom_set_oma_protection(GF_ISOFile *the_file, u32 trackNumber, u32 desc_index,\r
+                                                  char *contentID, char *kms_URI, u32 encryption_type, u64 plainTextLength, char *textual_headers, u32 textual_headers_len,\r
+                                                  Bool selective_encryption, u32 KI_length, u32 IV_length);\r
+\r
+#endif\r
+\r
+/*xml dumpers*/\r
+GF_Err gf_isom_dump_ismacryp_protection(GF_ISOFile *the_file, u32 trackNumber, FILE * trace);\r
+GF_Err gf_isom_dump_ismacryp_sample(GF_ISOFile *the_file, u32 trackNumber, u32 SampleNum, FILE *trace);\r
+\r
+\r
+/********************************************************************\r
+                               GENERAL META API FUNCTIONS\r
+       \r
+         Meta can be stored at several places in the file layout:\r
+               * root level (like moov, ftyp and co)\r
+               * moov level\r
+               * track level\r
+       Meta API uses the following parameters for all functions:\r
+       \r
+        gf_isom_*_meta_*(GF_ISOFile *file, Bool root_meta, u32 track_num, ....) with:\r
+               @root_meta: if set, accesses file root meta\r
+               @track_num: if root_meta not set, specifies whether the target meta is at the\r
+                       moov level (track_num=0) or at the track level.\r
+\r
+********************************************************************/\r
+\r
+/*gets meta type. Returned value: 0 if no meta found, or four char code of meta (eg, "mp21", "smil", ...)*/\r
+u32 gf_isom_get_meta_type(GF_ISOFile *file, Bool root_meta, u32 track_num);\r
+\r
+/*indicates if the meta has an XML container (note that XML data can also be included as items). \r
+return value: 0 (no XML or error), 1 (XML text), 2 (BinaryXML, eg BiM) */\r
+u32 gf_isom_has_meta_xml(GF_ISOFile *file, Bool root_meta, u32 track_num);\r
+\r
+/*extracts XML (if any) from given meta\r
+       @outName: output file path and location for writing\r
+       @is_binary: indicates if XML is Bim or regular XML\r
+*/\r
+GF_Err gf_isom_extract_meta_xml(GF_ISOFile *file, Bool root_meta, u32 track_num, char *outName, Bool *is_binary);\r
+\r
+/*returns number of items described in this meta*/\r
+u32 gf_isom_get_meta_item_count(GF_ISOFile *file, Bool root_meta, u32 track_num);\r
+\r
+/*gets item info for the given item\r
+       @item_num: 1-based index of item to query\r
+       @itemID (optional): item ID in file\r
+       @is_self_reference: item is the file itself\r
+       @item_name (optional): item name\r
+       @item_mime_type (optional): item mime type\r
+       @item_encoding (optional): item content encoding type\r
+       @item_url, @item_urn (optional): url/urn of external resource containing this item data if any. \r
+               When item is fully contained in file, these are set to NULL\r
+\r
+*/\r
+GF_Err gf_isom_get_meta_item_info(GF_ISOFile *file, Bool root_meta, u32 track_num, u32 item_num, \r
+                                                       u32 *itemID, u32 *protection_idx, Bool *is_self_reference,\r
+                                                       const char **item_name, const char **item_mime_type, const char **item_encoding,\r
+                                                       const char **item_url, const char **item_urn);\r
+\r
+\r
+/*gets item idx from item ID*/\r
+u32 gf_isom_get_meta_item_by_id(GF_ISOFile *file, Bool root_meta, u32 track_num, u32 item_ID);\r
+\r
+/*extracts item from given meta\r
+       @item_num: 1-based index of item to query\r
+*/\r
+GF_Err gf_isom_extract_meta_item(GF_ISOFile *file, Bool root_meta, u32 track_num, u32 item_num, const char *dump_file_name);\r
+\r
+/*retirves primary item ID, 0 if none found (primary can also be stored through meta XML)*/\r
+u32 gf_isom_get_meta_primary_item_id(GF_ISOFile *file, Bool root_meta, u32 track_num);\r
+\r
+#ifndef GPAC_READ_ONLY\r
+\r
+/*sets meta type (four char int, eg "mp21", ... \r
+       Creates a meta box if none found\r
+       if metaType is 0, REMOVES META \r
+*/\r
+GF_Err gf_isom_set_meta_type(GF_ISOFile *file, Bool root_meta, u32 track_num, u32 metaType);\r
+\r
+/*removes meta XML info if any*/\r
+GF_Err gf_isom_remove_meta_xml(GF_ISOFile *file, Bool root_meta, u32 track_num);\r
+\r
+/*set meta XML data from file - erase any previously (Binary)XML info*/\r
+GF_Err gf_isom_set_meta_xml(GF_ISOFile *file, Bool root_meta, u32 track_num, char *XMLFileName, Bool IsBinaryXML);\r
+\r
+/*adds item to meta:\r
+       @self_reference: indicates this item is the file itself\r
+       @resource_path: file to add - can be NULL when URL/URN is used\r
+       @item_name: item name - if NULL, use file name. CANNOT BE NULL if resource_path is not set\r
+       @mime_type: item mime type - if NULL, use "application/octet-stream"\r
+       @content_encoding: content encoding type - if NULL, none specified\r
+       @URL, @URN: if set, resource will be remote (same as stream descriptions)\r
+*/\r
+GF_Err gf_isom_add_meta_item(GF_ISOFile *file, Bool root_meta, u32 track_num, Bool self_reference, char *resource_path, const char *item_name, const char *mime_type, const char *content_encoding, const char *URL, const char *URN);\r
+\r
+/*removes item from meta*/\r
+GF_Err gf_isom_remove_meta_item(GF_ISOFile *file, Bool root_meta, u32 track_num, u32 item_num);\r
+\r
+/*sets the given item as the primary one. You SHALL NOT use this if the meta has a valid XML data*/\r
+GF_Err gf_isom_set_meta_primary_item(GF_ISOFile *file, Bool root_meta, u32 track_num, u32 item_num);\r
+\r
+#endif\r
+\r
+\r
+/********************************************************************\r
+                               Timed Meta-Data extensions\r
+********************************************************************/\r
+\r
+GF_Err gf_isom_get_timed_meta_data_info(GF_ISOFile *file, u32 track, u32 sampleDescription, Bool *is_xml, const char **mime_or_namespace, const char **content_encoding, const char **schema_loc);\r
+\r
+#ifndef GPAC_READ_ONLY\r
+/*create a new timed metat data sample description for this track*/\r
+GF_Err gf_isom_timed_meta_data_config_new(GF_ISOFile *movie, u32 trackNumber, Bool is_xml, char *mime_or_namespace, char *content_encoding, char *schema_loc, char *URLname, char *URNname, u32 *outDescriptionIndex);\r
+#endif\r
+\r
+\r
+/********************************************************************\r
+                               iTunes info tags\r
+********************************************************************/\r
+enum\r
+{\r
+       /*probe is only used ti check if iTunes info are present*/\r
+       GF_ISOM_ITUNE_PROBE = 0,\r
+       GF_ISOM_ITUNE_ALBUM     = GF_4CC( 0xA9, 'a', 'l', 'b' ),\r
+       GF_ISOM_ITUNE_ARTIST = GF_4CC( 0xA9, 'A', 'R', 'T' ),\r
+       GF_ISOM_ITUNE_COMMENT = GF_4CC( 0xA9, 'c', 'm', 't' ),\r
+       GF_ISOM_ITUNE_COMPILATION = GF_4CC( 'c', 'p', 'i', 'l' ),\r
+       GF_ISOM_ITUNE_COMPOSER = GF_4CC( 0xA9, 'c', 'o', 'm' ),\r
+       GF_ISOM_ITUNE_COVER_ART = GF_4CC( 'c', 'o', 'v', 'r' ),\r
+       GF_ISOM_ITUNE_CREATED = GF_4CC( 0xA9, 'd', 'a', 'y' ),\r
+       GF_ISOM_ITUNE_DISK = GF_4CC( 'd', 'i', 's', 'k' ),\r
+       GF_ISOM_ITUNE_TOOL = GF_4CC( 0xA9, 't', 'o', 'o' ),\r
+       GF_ISOM_ITUNE_GENRE = GF_4CC( 'g', 'n', 'r', 'e' ),\r
+       GF_ISOM_ITUNE_GROUP = GF_4CC( 0xA9, 'g', 'r', 'p' ),\r
+       GF_ISOM_ITUNE_ITUNES_DATA = GF_4CC( '-', '-', '-', '-' ),\r
+       GF_ISOM_ITUNE_NAME = GF_4CC( 0xA9, 'n', 'a', 'm' ),\r
+       GF_ISOM_ITUNE_TEMPO = GF_4CC( 't', 'm', 'p', 'o' ),\r
+       GF_ISOM_ITUNE_TRACK = GF_4CC( 0xA9, 't', 'r', 'k' ),\r
+       GF_ISOM_ITUNE_TRACKNUMBER = GF_4CC( 't', 'r', 'k', 'n' ),\r
+       GF_ISOM_ITUNE_WRITER = GF_4CC( 0xA9, 'w', 'r', 't' ),\r
+       GF_ISOM_ITUNE_ENCODER = GF_4CC( 0xA9, 'e', 'n', 'c' ),\r
+       GF_ISOM_ITUNE_ALBUM_ARTIST = GF_4CC( 'a', 'A', 'R', 'T' ),\r
+       GF_ISOM_ITUNE_GAPELESS = GF_4CC( 'p', 'g', 'a', 'p' ),\r
+};\r
+/*get the given tag info. \r
+!! 'genre' may be coded by ID, the libisomedia doesn't translate the ID. In such a case, the result data is set to NULL \r
+and the data_len to the genre ID\r
+returns GF_URL_ERROR if no tag is present in the file\r
+*/\r
+GF_Err gf_isom_apple_get_tag(GF_ISOFile *mov, u32 tag, const char **data, u32 *data_len);\r
+#ifndef GPAC_READ_ONLY\r
+/*set the given tag info. If data and data_len are 0, removes the given tag\r
+For 'genre', data may be NULL in which case the genre ID taken from the data_len parameter\r
+*/\r
+GF_Err gf_isom_apple_set_tag(GF_ISOFile *mov, u32 tag, const char *data, u32 data_len);\r
+\r
+/*sets compatibility tag on AVC tracks (needed by iPod to play files... hurray for standards)*/\r
+GF_Err gf_isom_set_ipod_compatible(GF_ISOFile *the_file, u32 trackNumber);\r
+#endif\r
+\r
+\r
+/*3GPP Alternate Group API - (c) 2007 ENST & ResonateMP4*/\r
+\r
+/*gets the number of switching groups declared in this track if any:\r
+trackNumber: track number\r
+alternateGroupID: alternate group id of track if speciifed, 0 otherwise\r
+nb_groups: number of switching groups defined for this track\r
+*/\r
+GF_Err gf_isom_get_track_switch_group_count(GF_ISOFile *movie, u32 trackNumber, u32 *alternateGroupID, u32 *nb_groups);\r
+\r
+/*returns the list of criteria (expressed as 4CC IDs, cf 3GPP TS 26.244)\r
+trackNumber: track number\r
+group_index: 1-based index of the group to inspect\r
+switchGroupID: ID of the switch group if any, 0 otherwise (alternate-only group)\r
+criteriaListSize: number of criteria items in returned list\r
+*/\r
+const u32 *gf_isom_get_track_switch_parameter(GF_ISOFile *movie, u32 trackNumber, u32 group_index, u32 *switchGroupID, u32 *criteriaListSize);\r
+\r
+#ifndef GPAC_READ_ONLY\r
+/*sets a new (switch) group for this track\r
+trackNumber: track\r
+trackRefGroup: number of a track belonging to the same alternate group. If 0, a new alternate group will be created for this track\r
+is_switch_group: if set, indicates that a switch group identifier shall be assigned to the created group. Otherwise, the criteria list is associated with the entire alternate group\r
+switchGroupID: SHALL NOT BE NULL\r
+       input: specifies the desired switchGroupID to use. If value is 0, next available switchGroupID in file is used.\r
+       output: indicates the switchGroupID used.\r
+criteriaList, criteriaListCount: criteria list and size. Criterias are expressed as 4CC IDs, cf 3GPP TS 26.244\r
+*/\r
+GF_Err gf_isom_set_track_switch_parameter(GF_ISOFile *movie, u32 trackNumber, u32 trackRefGroup, Bool is_switch_group, u32 *switchGroupID, u32 *criteriaList, u32 criteriaListCount);\r
+\r
+/*resets track switch group information for the track or for the entire alternate group this track belongs to if reset_all_group is set*/\r
+GF_Err gf_isom_reset_track_switch_parameter(GF_ISOFile *movie, u32 trackNumber, Bool reset_all_group);\r
+\r
+/*resets ALL track switch group information in the entire movie*/\r
+GF_Err gf_isom_reset_switch_parameters(GF_ISOFile *movie);\r
+\r
+#endif\r
+\r
+\r
+typedef struct\r
+{\r
+       u8 profile;\r
+       u8 level;\r
+       u8 pathComponents;\r
+       Bool fullRequestHost;\r
+       Bool streamType;\r
+       u8 containsRedundant;\r
+       const char *textEncoding;\r
+       const char *contentEncoding;\r
+       const char *content_script_types;\r
+} GF_DIMSDescription;\r
+\r
+GF_Err gf_isom_get_dims_description(GF_ISOFile *movie, u32 trackNumber, u32 descriptionIndex, GF_DIMSDescription *desc);\r
+#ifndef GPAC_READ_ONLY\r
+GF_Err gf_isom_new_dims_description(GF_ISOFile *movie, u32 trackNumber, GF_DIMSDescription *desc, char *URLname, char *URNname, u32 *outDescriptionIndex);\r
+GF_Err gf_isom_update_dims_description(GF_ISOFile *movie, u32 trackNumber, GF_DIMSDescription *desc, char *URLname, char *URNname, u32 DescriptionIndex);\r
+#endif\r
+\r
+\r
+\r
+\r
+/*AC3 config record*/\r
+typedef struct \r
+{\r
+       u8 fscod;\r
+       u8 bsid;\r
+       u8 bsmod;\r
+       u8 acmod;\r
+       u8 lfon;\r
+       u8 brcode;\r
+} GF_AC3Config;\r
+\r
+#ifndef GPAC_READ_ONLY\r
+GF_Err gf_isom_ac3_config_new(GF_ISOFile *the_file, u32 trackNumber, GF_AC3Config *cfg, char *URLname, char *URNname, u32 *outDescriptionIndex);\r
+#endif\r
+\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+\r
+#endif /*_GF_ISOMEDIA_H_*/\r
+\r
+\r