2 * GPAC - Multimedia Framework C SDK
\r
4 * Copyright (c) Jean Le Feuvre 2000-2005
\r
5 * All rights reserved
\r
7 * This file is part of GPAC / ISO Media File Format sub-project
\r
9 * GPAC is free software; you can redistribute it and/or modify
\r
10 * it under the terms of the GNU Lesser General Public License as published by
\r
11 * the Free Software Foundation; either version 2, or (at your option)
\r
12 * any later version.
\r
14 * GPAC is distributed in the hope that it will be useful,
\r
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
17 * GNU Lesser General Public License for more details.
\r
19 * You should have received a copy of the GNU Lesser General Public
\r
20 * License along with this library; see the file COPYING. If not, write to
\r
21 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
\r
27 #ifndef _GF_ISOMEDIA_H_
\r
28 #define _GF_ISOMEDIA_H_
\r
36 #include <gpac/mpeg4_odf.h>
\r
39 /*the isomedia file*/
\r
40 typedef struct __tag_isom GF_ISOFile;
\r
42 /*media sample object*/
\r
47 /*data with padding if requested*/
\r
51 /*relative offset for composition if needed*/
\r
53 /*Random Access Point flag:
\r
54 0: not random access
\r
56 2: sample is a redundant RAP. If set when adding the sample, this will create a sample dependency entry
\r
62 /*creates a new empty sample*/
\r
63 GF_ISOSample *gf_isom_sample_new();
\r
65 /*delete a sample. NOTE:the buffer content will be destroyed by default.
\r
66 if you wish to keep the buffer, set dataLength to 0 in the sample
\r
68 the pointer is set to NULL after deletion*/
\r
69 void gf_isom_sample_del(GF_ISOSample **samp);
\r
73 /********************************************************************
\r
74 FILE FORMAT CONSTANTS
\r
75 ********************************************************************/
\r
77 /*Modes for file opening
\r
78 NOTE 1: All the READ function in this API can be used in EDIT/WRITE mode.
\r
79 However, some unexpected errors or values may happen in that case, depending
\r
80 on how much modifications you made (timing, track with 0 samples, ...)
\r
81 On the other hand, none of the EDIT/WRITE functions will work in
\r
83 NOTE 2: The output structure of a edited file will sometimes be different
\r
84 from the original file, but the media-data and meta-data will be identical.
\r
85 The only change happens in the file media-data container(s) during edition
\r
86 NOTE 3: when editing the file, you MUST set the final name of the modified file
\r
87 to something different. This API doesn't allow file overwriting.
\r
91 /*Opens file for dumping: same as read-only but keeps all movie fragments info untouched*/
\r
92 GF_ISOM_OPEN_READ_DUMP = 0,
\r
93 /*Opens a file in READ ONLY mode*/
\r
95 /*Opens a file in WRITE ONLY mode. Media Data is captured on the fly. In this mode,
\r
96 the editing functions are disabled.*/
\r
98 /*Opens an existing file in EDIT mode*/
\r
100 /*Creates a new file in EDIT mode*/
\r
104 /*Movie Options for file writing*/
\r
107 /*FLAT: the MediaData (MPEG4 ESs) is stored at the begining of the file*/
\r
108 GF_ISOM_STORE_FLAT = 1,
\r
109 /*STREAMABLE: the MetaData (File Info) is stored at the begining of the file
\r
110 for fast access during download*/
\r
111 GF_ISOM_STORE_STREAMABLE,
\r
112 /*INTERLEAVED: Same as STREAMABLE, plus the media data is mixed by chunk of fixed duration*/
\r
113 GF_ISOM_STORE_INTERLEAVED,
\r
114 /*INTERLEAVED +DRIFT: Same as INTERLEAVED, and adds time drift control to avoid creating too long chunks*/
\r
115 GF_ISOM_STORE_DRIFT_INTERLEAVED,
\r
116 /*tightly interleaves samples based on their DTS, therefore allowing better placement of samples in the file.
\r
117 This is used for both http interleaving and Hinting optimizations*/
\r
118 GF_ISOM_STORE_TIGHT
\r
122 /*Some track may depend on other tracks for several reasons. They reference these tracks
\r
123 through the following Reference Types*/
\r
126 /*ref type for the OD track dependencies*/
\r
127 GF_ISOM_REF_OD = GF_4CC( 'm', 'p', 'o', 'd' ),
\r
128 /*ref type for stream dependencies*/
\r
129 GF_ISOM_REF_DECODE = GF_4CC( 'd', 'p', 'n', 'd' ),
\r
130 /*ref type for OCR (Object Clock Reference) dependencies*/
\r
131 GF_ISOM_REF_OCR = GF_4CC( 's', 'y', 'n', 'c' ),
\r
132 /*ref type for IPI (Intellectual Property Information) dependencies*/
\r
133 GF_ISOM_REF_IPI = GF_4CC( 'i', 'p', 'i', 'r' ),
\r
134 /*ref type for timed Meta Data tracks*/
\r
135 GF_ISOM_REF_META = GF_4CC( 'c', 'd', 's', 'c' ),
\r
136 /*ref type for Hint tracks*/
\r
137 GF_ISOM_REF_HINT = GF_4CC( 'h', 'i', 'n', 't' ),
\r
138 /*ref type for QT Chapter tracks*/
\r
139 GF_ISOM_REF_CHAP = GF_4CC( 'c', 'h', 'a', 'p' )
\r
142 /*Track Edition flag*/
\r
144 /*empty segment in the track (no media for this segment)*/
\r
145 GF_ISOM_EDIT_EMPTY = 0x00,
\r
146 /*dwelled segment in the track (one media sample for this segment)*/
\r
147 GF_ISOM_EDIT_DWELL = 0x01,
\r
148 /*normal segment in the track*/
\r
149 GF_ISOM_EDIT_NORMAL = 0x02
\r
152 /*Generic Media Types (YOU HAVE TO USE ONE OF THESE TYPES FOR COMPLIANT ISO MEDIA FILES)*/
\r
155 /*base media types*/
\r
156 GF_ISOM_MEDIA_VISUAL = GF_4CC( 'v', 'i', 'd', 'e' ),
\r
157 GF_ISOM_MEDIA_AUDIO = GF_4CC( 's', 'o', 'u', 'n' ),
\r
158 GF_ISOM_MEDIA_HINT = GF_4CC( 'h', 'i', 'n', 't' ),
\r
159 GF_ISOM_MEDIA_META = GF_4CC( 'm', 'e', 't', 'a' ),
\r
160 GF_ISOM_MEDIA_TEXT = GF_4CC( 't', 'e', 'x', 't' ),
\r
161 GF_ISOM_MEDIA_SUBPIC = GF_4CC( 's', 'u', 'b', 'p' ),
\r
163 /*MPEG-4 media types*/
\r
164 GF_ISOM_MEDIA_OD = GF_4CC( 'o', 'd', 's', 'm' ),
\r
165 GF_ISOM_MEDIA_OCR = GF_4CC( 'c', 'r', 's', 'm' ),
\r
166 GF_ISOM_MEDIA_SCENE = GF_4CC( 's', 'd', 's', 'm' ),
\r
167 GF_ISOM_MEDIA_MPEG7 = GF_4CC( 'm', '7', 's', 'm' ),
\r
168 GF_ISOM_MEDIA_OCI = GF_4CC( 'o', 'c', 's', 'm' ),
\r
169 GF_ISOM_MEDIA_IPMP = GF_4CC( 'i', 'p', 's', 'm' ),
\r
170 GF_ISOM_MEDIA_MPEGJ = GF_4CC( 'm', 'j', 's', 'm' ),
\r
171 /*GPAC-defined, for any track using MPEG-4 systems signaling but with undefined streaml types*/
\r
172 GF_ISOM_MEDIA_ESM = GF_4CC( 'g', 'e', 's', 'm' ),
\r
174 /*DIMS media type (same as scene but with a different mediaInfo)*/
\r
175 GF_ISOM_MEDIA_DIMS = GF_4CC( 'd', 'i', 'm', 's' ),
\r
177 GF_ISOM_MEDIA_FLASH = GF_4CC( 'f', 'l', 's', 'h' )
\r
180 /* Encryption Scheme Type in the SchemeTypeInfoBox */
\r
183 GF_ISOM_ISMACRYP_SCHEME = GF_4CC( 'i', 'A', 'E', 'C' )
\r
186 /*specific media sub-types - you shall make sure the media sub type is what you expect*/
\r
189 /*reserved, internal use in the lib. Indicates the track complies to MPEG-4 system
\r
190 specification, and the usual OD framework tools may be used*/
\r
191 GF_ISOM_SUBTYPE_MPEG4 = GF_4CC( 'M', 'P', 'E', 'G' ),
\r
193 /*reserved, internal use in the lib. Indicates the track is of GF_ISOM_SUBTYPE_MPEG4
\r
194 but it is encrypted.*/
\r
195 GF_ISOM_SUBTYPE_MPEG4_CRYP = GF_4CC( 'E', 'N', 'C', 'M' ),
\r
197 /*AVC/H264 media type - not listed as an MPEG-4 type, ALTHOUGH this library automatically remaps
\r
198 GF_AVCConfig to MPEG-4 ESD*/
\r
199 GF_ISOM_SUBTYPE_AVC_H264 = GF_4CC( 'a', 'v', 'c', '1' ),
\r
201 /*3GPP(2) extension subtypes*/
\r
202 GF_ISOM_SUBTYPE_3GP_H263 = GF_4CC( 's', '2', '6', '3' ),
\r
203 GF_ISOM_SUBTYPE_3GP_AMR = GF_4CC( 's', 'a', 'm', 'r' ),
\r
204 GF_ISOM_SUBTYPE_3GP_AMR_WB = GF_4CC( 's', 'a', 'w', 'b' ),
\r
205 GF_ISOM_SUBTYPE_3GP_EVRC = GF_4CC( 's', 'e', 'v', 'c' ),
\r
206 GF_ISOM_SUBTYPE_3GP_QCELP = GF_4CC( 's', 'q', 'c', 'p' ),
\r
207 GF_ISOM_SUBTYPE_3GP_SMV = GF_4CC( 's', 's', 'm', 'v' ),
\r
210 GF_ISOM_SUBTYPE_3GP_DIMS = GF_4CC( 'd', 'i', 'm', 's' ),
\r
212 GF_ISOM_SUBTYPE_AC3 = GF_4CC( 'a', 'c', '-', '3' ),
\r
218 /*direction for sample search (including SyncSamples search)
\r
219 Function using search allways specify the desired time in composition (presentation) time
\r
221 (Sample N-1) DesiredTime (Sample N)
\r
223 FORWARD: will give the next sample given the desired time (eg, N)
\r
224 BACKWARD: will give the previous sample given the desired time (eg, N-1)
\r
225 SYNCFORWARD: will search from the desired point in time for a sync sample if any
\r
226 If no sync info, behaves as FORWARD
\r
227 SYNCBACKWARD: will search till the desired point in time for a sync sample if any
\r
228 If no sync info, behaves as BACKWARD
\r
229 SYNCSHADOW: use the sync shadow information to retrieve the sample.
\r
230 If no SyncShadow info, behave as SYNCBACKWARD
\r
234 GF_ISOM_SEARCH_FORWARD = 1,
\r
235 GF_ISOM_SEARCH_BACKWARD = 2,
\r
236 GF_ISOM_SEARCH_SYNC_FORWARD = 3,
\r
237 GF_ISOM_SEARCH_SYNC_BACKWARD = 4,
\r
238 GF_ISOM_SEARCH_SYNC_SHADOW = 5
\r
241 /*Predefined File Brand codes (MPEG-4 and JPEG2000)*/
\r
244 /*file complying to the generic ISO Media File (base specification ISO/IEC 14496-12)
\r
245 this is the default brand when creating a new movie*/
\r
246 GF_ISOM_BRAND_ISOM = GF_4CC( 'i', 's', 'o', 'm' ),
\r
247 /*file complying to the generic ISO Media File (base specification ISO/IEC 14496-12) + Meta extensions*/
\r
248 GF_ISOM_BRAND_ISO2 = GF_4CC( 'i', 's', 'o', '2' ),
\r
249 /*file complying to ISO/IEC 14496-1 2001 edition. A .mp4 file without a brand
\r
250 is equivalent to a file compatible with this brand*/
\r
251 GF_ISOM_BRAND_MP41 = GF_4CC( 'm', 'p', '4', '1' ),
\r
252 /*file complying to ISO/IEC 14496-14 (MP4 spec)*/
\r
253 GF_ISOM_BRAND_MP42 = GF_4CC( 'm', 'p', '4', '2' ),
\r
254 /*file complying to ISO/IEC 15444-3 (JPEG2000) without profile restriction*/
\r
255 GF_ISOM_BRAND_MJP2 = GF_4CC( 'm', 'j', 'p', '2' ),
\r
256 /*file complying to ISO/IEC 15444-3 (JPEG2000) with simple profile restriction*/
\r
257 GF_ISOM_BRAND_MJ2S = GF_4CC( 'm', 'j', '2', 's' ),
\r
258 /*old versions of 3GPP spec (without timed text)*/
\r
259 GF_ISOM_BRAND_3GP4 = GF_4CC('3', 'g', 'p', '4'),
\r
260 GF_ISOM_BRAND_3GP5 = GF_4CC('3', 'g', 'p', '5'),
\r
261 /*final version of 3GPP file spec*/
\r
262 GF_ISOM_BRAND_3GP6 = GF_4CC('3', 'g', 'p', '6'),
\r
263 /*generci 3GPP file (several audio tracks, etc..)*/
\r
264 GF_ISOM_BRAND_3GG6 = GF_4CC('3', 'g', 'g', '6'),
\r
265 /*3GPP2 file spec*/
\r
266 GF_ISOM_BRAND_3G2A = GF_4CC('3', 'g', '2', 'a'),
\r
268 GF_ISOM_BRAND_AVC1 = GF_4CC('a', 'v', 'c', '1'),
\r
269 /* file complying to ISO/IEC 21000-9:2005 (MPEG-21 spec)*/
\r
270 GF_ISOM_BRAND_MP21 = GF_4CC('m', 'p', '2', '1'),
\r
274 /*MPEG-4 ProfileAndLevel codes*/
\r
279 GF_ISOM_PL_GRAPHICS,
\r
283 /*not a profile, just set/unset inlineFlag*/
\r
288 /********************************************************************
\r
289 GENERAL API FUNCTIONS
\r
290 ********************************************************************/
\r
292 /*get the last fatal error that occured in the file
\r
293 ANY FUNCTION OF THIS API WON'T BE PROCESSED IF THE FILE HAS AN ERROR
\r
294 Note: some function may return an error while the movie has no error
\r
295 the last error is a FatalError, and is not always set if a bad
\r
296 param is specified...*/
\r
297 GF_Err gf_isom_last_error(GF_ISOFile *the_file);
\r
299 /*returns 1 if target file is an IsoMedia file, 0 otherwise*/
\r
300 Bool gf_isom_probe_file(const char *fileName);
\r
302 /*Opens an isoMedia File.
\r
303 tmp_dir: for the 2 edit modes only, specifies a location for temp file. If NULL, the librairy will use the default
\r
304 OS temporary file management schemes.*/
\r
305 GF_ISOFile *gf_isom_open(const char *fileName, u32 OpenMode, const char *tmp_dir);
\r
307 /*close the file, write it if new/edited*/
\r
308 GF_Err gf_isom_close(GF_ISOFile *the_file);
\r
310 /*delete the movie without saving it.*/
\r
311 void gf_isom_delete(GF_ISOFile *the_file);
\r
313 /*Get the mode of an open file*/
\r
314 u8 gf_isom_get_mode(GF_ISOFile *the_file);
\r
316 Bool gf_isom_is_JPEG2000(GF_ISOFile *mov);
\r
318 /********************************************************************
\r
319 STREAMING API FUNCTIONS
\r
320 ********************************************************************/
\r
321 /*open a movie that can be uncomplete in READ_ONLY mode
\r
322 to use for http streaming & co
\r
324 NOTE: you must buffer the data to a local file, this mode DOES NOT handle
\r
325 http/ftp/... streaming
\r
327 BytesMissing is the predicted number of bytes missing for the file to be loaded
\r
328 Note that if the file is not optimized for streaming, this number is not accurate
\r
329 If the movie is successfully loaded (the_file non-NULL), BytesMissing is zero
\r
331 GF_Err gf_isom_open_progressive(const char *fileName, GF_ISOFile **the_file, u64 *BytesMissing);
\r
333 /*If requesting a sample fails with error GF_ISOM_INCOMPLETE_FILE, use this function
\r
334 to get the number of bytes missing to retrieve the sample*/
\r
335 u64 gf_isom_get_missing_bytes(GF_ISOFile *the_file, u32 trackNumber);
\r
338 /*Fragmented movie extensions*/
\r
340 /*return 0 if movie isn't fragmented, 1 otherwise*/
\r
341 u32 gf_isom_is_fragmented(GF_ISOFile *the_file);
\r
342 /*return 0 if track isn't fragmented, 1 otherwise*/
\r
343 u32 gf_isom_is_track_fragmented(GF_ISOFile *the_file, u32 TrackID);
\r
345 /*a file being downloaded may be a fragmented file. In this case only partial info
\r
346 is available once the file is successfully open (gf_isom_open_progressive), and since there is
\r
347 no information wrt number fragments (which could actually be generated on the fly
\r
348 at the sender side), you must call this function on regular bases in order to
\r
349 load newly downloaded fragments. Note this may result in Track/Movie duration changes
\r
350 and SampleCount change too ...*/
\r
351 GF_Err gf_isom_refresh_fragmented(GF_ISOFile *the_file, u64 *MissingBytes);
\r
353 /*check if file has movie info, eg has tracks & dynamic media. Some files may just use
\r
354 the base IsoMedia structure without "moov" container*/
\r
355 Bool gf_isom_has_movie(GF_ISOFile *file);
\r
357 /********************************************************************
\r
358 READING API FUNCTIONS
\r
359 ********************************************************************/
\r
361 /*return the number of tracks in the movie, or -1 if error*/
\r
362 u32 gf_isom_get_track_count(GF_ISOFile *the_file);
\r
364 /*return the timescale of the movie, 0 if error*/
\r
365 u32 gf_isom_get_timescale(GF_ISOFile *the_file);
\r
367 /*return the duration of the movie, 0 if error*/
\r
368 u64 gf_isom_get_duration(GF_ISOFile *the_file);
\r
370 /*return the creation info of the movie*/
\r
371 GF_Err gf_isom_get_creation_time(GF_ISOFile *the_file, u64 *creationTime, u64 *modificationTime);
\r
373 /*return the trackID of track number n, or 0 if error*/
\r
374 u32 gf_isom_get_track_id(GF_ISOFile *the_file, u32 trackNumber);
\r
376 /*return the track number of the track of specified ID, or 0 if error*/
\r
377 u32 gf_isom_get_track_by_id(GF_ISOFile *the_file, u32 trackID);
\r
379 /*gets the enable flag of a track 0: NO, 1: yes, 2: error*/
\r
380 u8 gf_isom_is_track_enabled(GF_ISOFile *the_file, u32 trackNumber);
\r
382 /* determines if the track is encrypted 0: NO, 1: yes, 2: error*/
\r
383 u8 gf_isom_is_track_encrypted(GF_ISOFile *the_file, u32 trackNumber);
\r
385 /*get the track duration return 0 if bad param*/
\r
386 u64 gf_isom_get_track_duration(GF_ISOFile *the_file, u32 trackNumber);
\r
388 /*return the media type FOUR CHAR code type of the media*/
\r
389 u32 gf_isom_get_media_type(GF_ISOFile *the_file, u32 trackNumber);
\r
391 /*return the media type FOUR CHAR code type of the media*/
\r
392 u32 gf_isom_get_media_subtype(GF_ISOFile *the_file, u32 trackNumber, u32 DescriptionIndex);
\r
394 /*return the media type FOUR CHAR code type of an MPEG4 media (eg, mp4a, mp4v, enca, encv, etc...)
\r
395 returns 0 if not MPEG-4 subtype*/
\r
396 u32 gf_isom_get_mpeg4_subtype(GF_ISOFile *the_file, u32 trackNumber, u32 DescriptionIndex);
\r
398 /*Get the media (composition) time given the absolute time in the Movie
\r
399 mediaTime is set to 0 if the media is not playing at that time (empty time segment)*/
\r
400 GF_Err gf_isom_get_media_time(GF_ISOFile *the_file, u32 trackNumber, u32 movieTime, u64 *MediaTime);
\r
402 /*Get the number of "streams" stored in the media - a media can have several stream descriptions...*/
\r
403 u32 gf_isom_get_sample_description_count(GF_ISOFile *the_file, u32 trackNumber);
\r
405 /*Get the stream description index (eg, the ESD) for a given time IN MEDIA TIMESCALE
\r
406 return 0 if error or if empty*/
\r
407 u32 gf_isom_get_sample_description_index(GF_ISOFile *the_file, u32 trackNumber, u64 for_time);
\r
409 /*returns 1 if samples refering to the given stream description are present in the file
\r
411 Bool gf_isom_is_self_contained(GF_ISOFile *the_file, u32 trackNumber, u32 sampleDescriptionIndex);
\r
413 /*get the media duration (without edit) return 0 if no samples (URL streams)*/
\r
414 u64 gf_isom_get_media_duration(GF_ISOFile *the_file, u32 trackNumber);
\r
416 /*Get the timeScale of the media. */
\r
417 u32 gf_isom_get_media_timescale(GF_ISOFile *the_file, u32 trackNumber);
\r
419 /*return the maximum chunk duration of the track in milliseconds*/
\r
420 u32 gf_isom_get_max_chunk_duration(GF_ISOFile *the_file, u32 trackNumber);
\r
422 /*Get the HandlerDescription name. The outName must be:
\r
423 (outName != NULL && *outName == NULL)
\r
424 the handler name is the string version of the MediaTypes*/
\r
425 GF_Err gf_isom_get_handler_name(GF_ISOFile *the_file, u32 trackNumber, const char **outName);
\r
427 /*Check a DataReference of this track (index >= 1)
\r
428 A Data Reference allows to construct a file without integrating the media data*/
\r
429 GF_Err gf_isom_check_data_reference(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex);
\r
431 /*get the location of the data. If URL && URN are NULL, the data is in this file
\r
432 both strings are const: don't free them.*/
\r
433 GF_Err gf_isom_get_data_reference(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex, const char **outURL, const char **outURN);
\r
435 /*Get the number of samples - return 0 if error*/
\r
436 u32 gf_isom_get_sample_count(GF_ISOFile *the_file, u32 trackNumber);
\r
438 /*Get constant sample size, or 0 if size not constant*/
\r
439 u32 gf_isom_get_constant_sample_size(GF_ISOFile *the_file, u32 trackNumber);
\r
440 /*returns total amount of media bytes in track*/
\r
441 u64 gf_isom_get_media_data_size(GF_ISOFile *the_file, u32 trackNumber);
\r
443 /*It may be desired to fetch samples with a bigger allocated buffer than their real size, in case the decoder
\r
444 reads more data than available. This sets the amount of extra bytes to allocate when reading samples from this track
\r
445 NOTE: the dataLength of the sample does NOT include padding*/
\r
446 GF_Err gf_isom_set_sample_padding(GF_ISOFile *the_file, u32 trackNumber, u32 padding_bytes);
\r
448 /*return a sample given its number, and set the StreamDescIndex of this sample
\r
449 this index allows to retrieve the stream description if needed (2 media in 1 track)
\r
450 return NULL if error*/
\r
451 GF_ISOSample *gf_isom_get_sample(GF_ISOFile *the_file, u32 trackNumber, u32 sampleNumber, u32 *StreamDescriptionIndex);
\r
453 /*same as gf_isom_get_sample but doesn't fetch media data
\r
454 @StreamDescriptionIndex (optional): set to stream description index
\r
455 @data_offset (optional): set to sample start offset in file.
\r
457 NOTE: when both StreamDescriptionIndex and data_offset are NULL, only DTS, CTS_Offset and RAP indications are
\r
460 GF_ISOSample *gf_isom_get_sample_info(GF_ISOFile *the_file, u32 trackNumber, u32 sampleNumber, u32 *StreamDescriptionIndex, u64 *data_offset);
\r
462 /*retrieves given sample DTS*/
\r
463 u64 gf_isom_get_sample_dts(GF_ISOFile *the_file, u32 trackNumber, u32 sampleNumber);
\r
465 /*returns sample duration in media timeScale*/
\r
466 u32 gf_isom_get_sample_duration(GF_ISOFile *the_file, u32 trackNumber, u32 sampleNumber);
\r
468 /*gets a sample given a desired decoding time IN MEDIA TIME SCALE
\r
469 and set the StreamDescIndex of this sample
\r
470 this index allows to retrieve the stream description if needed (2 media in 1 track)
\r
471 return GF_EOS if the desired time exceeds the media duration
\r
472 WARNING: the sample may not be sync even though the sync was requested (depends on the media and the editList)
\r
473 the SampleNum is optional. If non-NULL, will contain the sampleNumber*/
\r
474 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
476 /*retrieves given sample DTS*/
\r
477 u32 gf_isom_get_sample_from_dts(GF_ISOFile *the_file, u32 trackNumber, u64 dts);
\r
479 /*Track Edition functions*/
\r
481 /*return a sample given a desired time in the movie. MovieTime is IN MEDIA TIME SCALE , handles edit list.
\r
482 and set the StreamDescIndex of this sample
\r
483 this index allows to retrieve the stream description if needed (2 media in 1 track)
\r
484 sample must be set to NULL before calling.
\r
486 result Sample is NULL if an error occured
\r
487 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
488 if no sample is playing, the closest sample in the edit time-line is returned when serching in regular modes
\r
490 WARNING: the sample may not be sync even though the sync was requested (depends on the media and the editList)
\r
492 Note: this function will handle re-timestamping the sample according to the mapping of the media time-line
\r
493 on the track time-line. The sample TSs (DTS / CTS offset) are expressed in MEDIA TIME SCALE
\r
494 (to match the media stream TS resolution as indicated in media header / SLConfig)
\r
496 sampleNumber is optional and gives the number of the sample in the media
\r
498 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
500 /*get the number of edited segment*/
\r
501 u32 gf_isom_get_edit_segment_count(GF_ISOFile *the_file, u32 trackNumber);
\r
503 /*Get the desired segment information*/
\r
504 GF_Err gf_isom_get_edit_segment(GF_ISOFile *the_file, u32 trackNumber, u32 SegmentIndex, u64 *EditTime, u64 *SegmentDuration, u64 *MediaTime, u8 *EditMode);
\r
506 /*get the number of languages for the copyright*/
\r
507 u32 gf_isom_get_copyright_count(GF_ISOFile *the_file);
\r
508 /*get the copyright and its language code given the index*/
\r
509 GF_Err gf_isom_get_copyright(GF_ISOFile *the_file, u32 Index, const char **threeCharCodes, const char **notice);
\r
510 /*get the opaque watermark info if any - returns GF_NOT_SUPPORTED if not present*/
\r
511 GF_Err gf_isom_get_watermark(GF_ISOFile *the_file, bin128 UUID, u8** data, u32* length);
\r
513 /*get the number of chapter for movie or track if trackNumber !=0*/
\r
514 u32 gf_isom_get_chapter_count(GF_ISOFile *the_file, u32 trackNumber);
\r
515 /*get the given movie or track (trackNumber!=0) chapter time and name - index is 1-based
\r
516 @chapter_time: retrives start time in milliseconds - may be NULL.
\r
517 @name: retrieves chapter name - may be NULL - SHALL NOT be destroyed by user
\r
519 GF_Err gf_isom_get_chapter(GF_ISOFile *the_file, u32 trackNumber, u32 Index, u64 *chapter_time, const char **name);
\r
522 return 0 if the media has no sync point info (eg, all samples are RAPs)
\r
523 return 1 if the media has sync points (eg some samples are RAPs)
\r
524 return 2 if the media has empty sync point info (eg no samples are RAPs). This will likely only happen
\r
525 in scalable context
\r
527 u8 gf_isom_has_sync_points(GF_ISOFile *the_file, u32 trackNumber);
\r
529 /*returns number of sync points*/
\r
530 u32 gf_isom_get_sync_point_count(GF_ISOFile *the_file, u32 trackNumber);
\r
532 /*returns 1 if one sample of the track is found to have a composition time offset (DTS<CTS)*/
\r
533 Bool gf_isom_has_time_offset(GF_ISOFile *the_file, u32 trackNumber);
\r
535 /*returns 1 if the track has sync shadow samples*/
\r
536 Bool gf_isom_has_sync_shadows(GF_ISOFile *the_file, u32 trackNumber);
\r
538 /*returns 1 if the track has sample dep indications*/
\r
539 Bool gf_isom_has_sample_dependency(GF_ISOFile *the_file, u32 trackNumber);
\r
541 /*rough estimation of file size, only works for completely self-contained files and without fragmentation
\r
542 for the current time*/
\r
543 u64 gf_isom_estimate_size(GF_ISOFile *the_file);
\r
545 u32 gf_isom_get_next_alternate_group_id(GF_ISOFile *movie);
\r
549 MPEG-4 Systems extensions
\r
552 /*check if files has root OD/IOD or not*/
\r
553 Bool gf_isom_has_root_od(GF_ISOFile *the_file);
\r
555 /*return the root Object descriptor of the movie (can be NULL, OD or IOD, you have to check its tag)
\r
556 YOU HAVE TO DELETE THE DESCRIPTOR
\r
558 GF_Descriptor *gf_isom_get_root_od(GF_ISOFile *the_file);
\r
560 /*check the presence of a track in IOD. 0: NO, 1: YES, 2: ERROR*/
\r
561 u8 gf_isom_is_track_in_root_od(GF_ISOFile *the_file, u32 trackNumber);
\r
563 /*Get the GF_ESD given the StreamDescriptionIndex - YOU HAVE TO DELETE THE DESCRIPTOR*/
\r
564 GF_ESD *gf_isom_get_esd(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex);
\r
566 /*Get the decoderConfigDescriptor given the StreamDescriptionIndex - YOU HAVE TO DELETE THE DESCRIPTOR*/
\r
567 GF_DecoderConfig *gf_isom_get_decoder_config(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex);
\r
569 /*sets default TrackID (or ES_ID) for clock references. If trackNumber is 0, default sync track ID is reseted
\r
570 and will be reassigned at next ESD fetch*/
\r
571 void gf_isom_set_default_sync_track(GF_ISOFile *file, u32 trackNumber);
\r
573 /*Return the number of track references of a track for a given ReferenceType - return -1 if error*/
\r
574 s32 gf_isom_get_reference_count(GF_ISOFile *the_file, u32 trackNumber, u32 referenceType);
\r
576 /*Return the referenced track number for a track and a given ReferenceType and Index
\r
577 return -1 if error, 0 if the reference is a NULL one, or the trackNumber
\r
579 GF_Err gf_isom_get_reference(GF_ISOFile *the_file, u32 trackNumber, u32 referenceType, u32 referenceIndex, u32 *refTrack);
\r
581 u8 gf_isom_get_pl_indication(GF_ISOFile *the_file, u8 PL_Code);
\r
583 /*locates the first ObjectDescriptor using the given track by inspecting any OD tracks*/
\r
584 u32 gf_isom_find_od_for_track(GF_ISOFile *file, u32 track);
\r
586 /*returns file name*/
\r
587 const char *gf_isom_get_filename(GF_ISOFile *the_file);
\r
590 Update of the Reading API for IsoMedia Version 2
\r
593 /*retrieves the brand of the file. The brand is introduced in V2 to differenciate
\r
594 MP4, MJPEG2000 and QT while indicating compatibilities
\r
595 the brand is one of the above defined code, or any other registered brand
\r
597 minorVersion is an optional parameter (can be set to NULL) ,
\r
598 "informative integer for the minor version of the major brand"
\r
599 AlternateBrandsCount is an optional parameter (can be set to NULL) ,
\r
600 giving the number of compatible brands.
\r
602 The function will set brand to 0 if no brand indication is found in the file
\r
604 GF_Err gf_isom_get_brand_info(GF_ISOFile *the_file, u32 *brand, u32 *minorVersion, u32 *AlternateBrandsCount);
\r
606 /*gets an alternate brand indication. BrandIndex is 1-based
\r
607 Note that the Major brand should always be indicated in the alternate brands*/
\r
608 GF_Err gf_isom_get_alternate_brand(GF_ISOFile *the_file, u32 BrandIndex, u32 *brand);
\r
610 /*get the number of padding bits at the end of a given sample if any*/
\r
611 GF_Err gf_isom_get_sample_padding_bits(GF_ISOFile *the_file, u32 trackNumber, u32 sampleNumber, u8 *NbBits);
\r
612 /*indicates whether the track samples use padding bits or not*/
\r
613 Bool gf_isom_has_padding_bits(GF_ISOFile *the_file, u32 trackNumber);
\r
615 /*returns width and height of the given visual sample desc - error if not a visual track*/
\r
616 GF_Err gf_isom_get_visual_info(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex, u32 *Width, u32 *Height);
\r
618 /*returns samplerate, channels and bps of the given audio track - error if not a audio track*/
\r
619 GF_Err gf_isom_get_audio_info(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex, u32 *SampleRate, u32 *Channels, u8 *bitsPerSample);
\r
621 /*returns track visual info - all coord values are expressed as 16.16 fixed point floats*/
\r
622 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
624 /*returns width and height of the given visual sample desc - error if not a visual track*/
\r
625 GF_Err gf_isom_get_pixel_aspect_ratio(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex, u32 *hSpacing, u32 *vSpacing);
\r
628 User Data Manipulation (cf write API too)
\r
631 /* Gets the number of UserDataItems with the same ID / UUID in the desired track or
\r
632 in the movie if trackNumber is set to 0*/
\r
633 u32 gf_isom_get_user_data_count(GF_ISOFile *the_file, u32 trackNumber, u32 UserDataType, bin128 UUID);
\r
634 /* Gets the UserData for the specified item from the track or the movie if trackNumber is set to 0
\r
635 data is allocated by the function and is yours to free
\r
636 you musty pass (userData != NULL && *userData=NULL)*/
\r
637 GF_Err gf_isom_get_user_data(GF_ISOFile *the_file, u32 trackNumber, u32 UserDataType, bin128 UUID, u32 UserDataIndex, char **userData, u32 *userDataSize);
\r
640 /*gets 3char media language code - @three_char_code must be at least 4 char long*/
\r
641 GF_Err gf_isom_get_media_language(GF_ISOFile *the_file, u32 trackNumber, char *three_char_code);
\r
643 /*Unknown sample description*/
\r
646 /*codec tag is the containing box's tag, 0 if UUID is used*/
\r
648 /*entry UUID if no tag is used*/
\r
655 /*video codecs only*/
\r
656 u32 temporal_quality;
\r
657 u32 spacial_quality;
\r
661 u16 color_table_index;
\r
662 char compressor_name[33];
\r
664 /*audio codecs only*/
\r
667 u16 bits_per_sample;
\r
670 char *extension_buf;
\r
671 u32 extension_buf_size;
\r
672 } GF_GenericSampleDescription;
\r
674 /*returns wrapper for unknown entries - you must delete it yourself*/
\r
675 GF_GenericSampleDescription *gf_isom_get_generic_sample_description(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex);
\r
677 /*retrieves default values for a track fragment. Each variable is optional and
\r
678 if set will contain the default value for this track samples*/
\r
679 GF_Err gf_isom_get_fragment_defaults(GF_ISOFile *the_file, u32 trackNumber,
\r
680 u32 *defaultDuration, u32 *defaultSize, u32 *defaultDescriptionIndex,
\r
681 u32 *defaultRandomAccess, u8 *defaultPadding, u16 *defaultDegradationPriority);
\r
684 /*non standard extensions used for video packets in order to keep AU structure in the file format
\r
685 (no normative tables for that). Info is NOT written to disk.
\r
687 /*get number of fragments for a sample */
\r
688 u32 gf_isom_get_sample_fragment_count(GF_ISOFile *the_file, u32 trackNumber, u32 sampleNumber);
\r
689 /*get sample fragment size*/
\r
690 u16 gf_isom_get_sample_fragment_size(GF_ISOFile *the_file, u32 trackNumber, u32 sampleNumber, u32 FragmentIndex);
\r
692 /*returns 1 if file is single AV (max one audio, one video, one text and basic od/bifs)*/
\r
693 Bool gf_isom_is_single_av(GF_ISOFile *file);
\r
695 /*guess which std this file refers to. return value:
\r
696 GF_ISOM_BRAND_ISOM: unrecognized std
\r
697 GF_ISOM_BRAND_3GP5: 3GP file (max 1 audio, 1 video) without text track
\r
698 GF_ISOM_BRAND_3GP6: 3GP file (max 1 audio, 1 video) with text track
\r
699 GF_ISOM_BRAND_3GG6: 3GP file multitrack file
\r
700 GF_ISOM_BRAND_3G2A: 3GP2 file
\r
701 GF_ISOM_BRAND_AVC1: AVC file
\r
702 FCC("ISMA"): ISMA file (may overlap with 3GP)
\r
703 GF_ISOM_BRAND_MP42: any generic MP4 file (eg with BIFS/OD/MPEG-4 systems stuff)
\r
705 for files without movie, returns the file meta handler type
\r
707 u32 gf_isom_guess_specification(GF_ISOFile *file);
\r
710 #ifndef GPAC_READ_ONLY
\r
713 /********************************************************************
\r
714 EDITING/WRITING API FUNCTIONS
\r
715 ********************************************************************/
\r
717 /*set the timescale of the movie*/
\r
718 GF_Err gf_isom_set_timescale(GF_ISOFile *the_file, u32 timeScale);
\r
720 /*creates a new Track. If trackID = 0, the trackID is chosen by the API
\r
721 returns the track number or 0 if error*/
\r
722 u32 gf_isom_new_track(GF_ISOFile *the_file, u32 trackID, u32 MediaType, u32 TimeScale);
\r
724 /*removes the desired track - internal cross dependancies will be updated.
\r
725 WARNING: any OD streams with references to this track through ODUpdate, ESDUpdate, ESDRemove commands
\r
726 will be rewritten*/
\r
727 GF_Err gf_isom_remove_track(GF_ISOFile *the_file, u32 trackNumber);
\r
729 /*sets the enable flag of a track*/
\r
730 GF_Err gf_isom_set_track_enabled(GF_ISOFile *the_file, u32 trackNumber, u8 enableTrack);
\r
732 /*changes the trackID - all track references present in the file are updated
\r
733 returns error if trackID is already in used in the file*/
\r
734 GF_Err gf_isom_set_track_id(GF_ISOFile *the_file, u32 trackNumber, u32 trackID);
\r
736 /*Add samples to a track. Use streamDescriptionIndex to specify the desired stream (if several)*/
\r
737 GF_Err gf_isom_add_sample(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex, GF_ISOSample *sample);
\r
739 /*Add sync shadow sample to a track.
\r
740 - There must be a regular sample with the same DTS.
\r
741 - Sync Shadow samples MUST be RAP
\r
742 - Currently, adding sync shadow must be done in order (no sample insertion)
\r
744 GF_Err gf_isom_add_sample_shadow(GF_ISOFile *the_file, u32 trackNumber, GF_ISOSample *sample);
\r
746 /*add data to current sample in the track. Use this function for media with
\r
747 fragmented options such as MPEG-4 video packets. This will update the data size.
\r
748 CANNOT be used with OD media type*/
\r
749 GF_Err gf_isom_append_sample_data(GF_ISOFile *the_file, u32 trackNumber, char *data, u32 data_size);
\r
751 /*Add sample references to a track. The dataOffset is the offset of the data in the referenced file
\r
752 you MUST have created a StreamDescription with URL or URN specifying your referenced file
\r
753 Use streamDescriptionIndex to specify the desired stream (if several)*/
\r
754 GF_Err gf_isom_add_sample_reference(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex, GF_ISOSample *sample, u64 dataOffset);
\r
756 /*set the duration of the last media sample. If not set, the duration of the last sample is the
\r
757 duration of the previous one if any, or media TimeScale (default value).*/
\r
758 GF_Err gf_isom_set_last_sample_duration(GF_ISOFile *the_file, u32 trackNumber, u32 duration);
\r
760 /*sets a track reference*/
\r
761 GF_Err gf_isom_set_track_reference(GF_ISOFile *the_file, u32 trackNumber, u32 referenceType, u32 ReferencedTrackID);
\r
763 /*removes a track reference*/
\r
764 GF_Err gf_isom_remove_track_reference(GF_ISOFile *the_file, u32 trackNumber, u32 referenceType, u32 ReferenceIndex);
\r
766 /*sets track handler name. name is either NULL (reset), a UTF-8 formatted string or a UTF8 file
\r
767 resource in the form "file://path/to/file_utf8" */
\r
768 GF_Err gf_isom_set_handler_name(GF_ISOFile *the_file, u32 trackNumber, const char *nameUTF8);
\r
770 /*Update the sample size table - this is needed when using @gf_isom_append_sample_data in case the resulting samples
\r
771 are of same sizes (typically in 3GP speech tracks)*/
\r
772 GF_Err gf_isom_refresh_size_info(GF_ISOFile *file, u32 trackNumber);
\r
774 /*Update Sample functions*/
\r
776 /*update a given sample of the media.
\r
777 @data_only: if set, only the sample data is updated, not other info*/
\r
778 GF_Err gf_isom_update_sample(GF_ISOFile *the_file, u32 trackNumber, u32 sampleNumber, GF_ISOSample *sample, Bool data_only);
\r
780 /*update a sample reference in the media. Note that the sample MUST exists,
\r
781 that sample->data MUST be NULL and sample->dataLength must be NON NULL;*/
\r
782 GF_Err gf_isom_update_sample_reference(GF_ISOFile *the_file, u32 trackNumber, u32 sampleNumber, GF_ISOSample *sample, u64 data_offset);
\r
784 /*Remove a given sample*/
\r
785 GF_Err gf_isom_remove_sample(GF_ISOFile *the_file, u32 trackNumber, u32 sampleNumber);
\r
787 /*changes media time scale*/
\r
788 GF_Err gf_isom_set_media_timescale(GF_ISOFile *the_file, u32 trackNumber, u32 new_timescale);
\r
790 /*set the save file name of the (edited) movie.
\r
791 If the movie is edited, the default fileName is avp_#openName)
\r
792 NOTE: you cannot save an edited file under the same name (overwrite not allowed)
\r
793 If the movie is created (WRITE mode), the default filename is #openName*/
\r
794 GF_Err gf_isom_set_final_name(GF_ISOFile *the_file, char *filename);
\r
797 /*set the storage mode of a file (FLAT, STREAMABLE, INTERLEAVED)*/
\r
798 GF_Err gf_isom_set_storage_mode(GF_ISOFile *the_file, u8 storageMode);
\r
799 u8 gf_isom_get_storage_mode(GF_ISOFile *the_file);
\r
801 /*set the interleaving time of media data (INTERLEAVED mode only)
\r
802 InterleaveTime is in MovieTimeScale*/
\r
803 GF_Err gf_isom_set_interleave_time(GF_ISOFile *the_file, u32 InterleaveTime);
\r
804 u32 gf_isom_get_interleave_time(GF_ISOFile *the_file);
\r
806 /*set the copyright in one language.*/
\r
807 GF_Err gf_isom_set_copyright(GF_ISOFile *the_file, const char *threeCharCode, char *notice);
\r
809 /*deletes copyright (1-based indexes)*/
\r
810 GF_Err gf_isom_remove_copyright(GF_ISOFile *the_file, u32 index);
\r
813 GF_Err gf_isom_set_alternate_group_id(GF_ISOFile *movie, u32 trackNumber, u32 groupId);
\r
815 /*add chapter info:
\r
816 if trackNumber is 0, the chapter info is added to the movie, otherwise to the track
\r
817 @timestamp: chapter start time in milliseconds. Chapters are added in order to the file. If a chapter with same timestamp
\r
818 is found, its name is updated but no entry is created.
\r
819 @name: chapter name. If NULL, defaults to 'Chapter N'
\r
821 GF_Err gf_isom_add_chapter(GF_ISOFile *the_file, u32 trackNumber, u64 timestamp, char *name);
\r
823 /*deletes copyright (1-based index, index 0 for all)*/
\r
824 GF_Err gf_isom_remove_chapter(GF_ISOFile *the_file, u32 trackNumber, u32 index);
\r
826 /*set watermark info for movie*/
\r
827 GF_Err gf_isom_set_watermark(GF_ISOFile *the_file, bin128 UUID, u8* data, u32 length);
\r
829 /*Track Edition functions - used to change the normal playback of the media if desired
\r
830 NOTE: IT IS THE USER RESPONSABILITY TO CREATE A CONSISTENT TIMELINE FOR THE TRACK
\r
831 This API provides the basic hooks and some basic consistency checking
\r
832 but can not check the desired functionality of the track edits
\r
835 /*update or insert a new edit segment in the track time line. Edits are used to modify
\r
836 the media normal timing. EditTime and EditDuration are expressed in Movie TimeScale
\r
837 If a segment with EditTime already exists, IT IS ERASED
\r
838 if there is a segment before this new one, its duration is adjust to match EditTime of
\r
840 WARNING: The first segment always have an EditTime of 0. You should insert an empty or dwelled segment first.*/
\r
841 GF_Err gf_isom_set_edit_segment(GF_ISOFile *the_file, u32 trackNumber, u64 EditTime, u64 EditDuration, u64 MediaTime, u8 EditMode);
\r
843 /*same as above except only modifies duartion type and mediaType*/
\r
844 GF_Err gf_isom_modify_edit_segment(GF_ISOFile *the_file, u32 trackNumber, u32 seg_index, u64 EditDuration, u64 MediaTime, u8 EditMode);
\r
845 /*same as above except only appends new segment*/
\r
846 GF_Err gf_isom_append_edit_segment(GF_ISOFile *the_file, u32 trackNumber, u64 EditDuration, u64 MediaTime, u8 EditMode);
\r
848 /*remove the edit segments for the whole track*/
\r
849 GF_Err gf_isom_remove_edit_segments(GF_ISOFile *the_file, u32 trackNumber);
\r
851 /*remove the given edit segment (1-based index). If this is not the last segment, the next segment duration
\r
852 is updated to maintain a continous timeline*/
\r
853 GF_Err gf_isom_remove_edit_segment(GF_ISOFile *the_file, u32 trackNumber, u32 seg_index);
\r
856 User Data Manipulation
\r
858 You can add specific typed data to either a track or the movie: the UserData
\r
859 The type must be formated as a FourCC if you have a registered 4CC type
\r
860 but the usual is to set a UUID (128 bit ID for box type) which never conflict
\r
861 with existing structures in the format
\r
862 To manipulate a UUID user data set the UserDataType to 0 and specify a valid UUID.
\r
863 Otherwise the UUID parameter is ignored
\r
864 Several items with the same ID or UUID can be added (this allows you to store any
\r
865 kind/number of private information under a unique ID / UUID)
\r
867 /*Add a user data item in the desired track or in the movie if TrackNumber is 0*/
\r
868 GF_Err gf_isom_add_user_data(GF_ISOFile *the_file, u32 trackNumber, u32 UserDataType, bin128 UUID, char *data, u32 DataLength);
\r
870 /*remove all user data items from the desired track or from the movie if TrackNumber is 0*/
\r
871 GF_Err gf_isom_remove_user_data(GF_ISOFile *the_file, u32 trackNumber, u32 UserDataType, bin128 UUID);
\r
873 /*remove a user data item from the desired track or from the movie if TrackNumber is 0
\r
874 use the UDAT read functions to get the item index*/
\r
875 GF_Err gf_isom_remove_user_data_item(GF_ISOFile *the_file, u32 trackNumber, u32 UserDataType, bin128 UUID, u32 UserDataIndex);
\r
877 /*remove track, moov (trackNumber=0) or file-level (trackNumber=0xFFFFFFFF) UUID box of matching type*/
\r
878 GF_Err gf_isom_remove_uuid(GF_ISOFile *movie, u32 trackNumber, bin128 UUID);
\r
879 /*adds track, moov (trackNumber=0) or file-level (trackNumber=0xFFFFFFFF) UUID box of given type*/
\r
880 GF_Err gf_isom_add_uuid(GF_ISOFile *movie, u32 trackNumber, bin128 UUID, char *data, u32 data_size);
\r
883 Update of the Writing API for IsoMedia Version 2
\r
886 /*use a compact track version for sample size. This is not usually recommended
\r
887 except for speech codecs where the track has a lot of small samples
\r
888 compaction is done automatically while writing based on the track's sample sizes*/
\r
889 GF_Err gf_isom_use_compact_size(GF_ISOFile *the_file, u32 trackNumber, u8 CompactionOn);
\r
891 /*sets the brand of the movie*/
\r
892 GF_Err gf_isom_set_brand_info(GF_ISOFile *the_file, u32 MajorBrand, u32 MinorVersion);
\r
894 /*adds or remove an alternate brand for the movie*/
\r
895 GF_Err gf_isom_modify_alternate_brand(GF_ISOFile *the_file, u32 Brand, u8 AddIt);
\r
897 /*removes all alternate brands except major brand*/
\r
898 GF_Err gf_isom_reset_alt_brands(GF_ISOFile *movie);
\r
900 /*set the number of padding bits at the end of a given sample if needed
\r
901 if the function is never called the padding bit info is ignored
\r
902 this MUST be called on an existin sample*/
\r
903 GF_Err gf_isom_set_sample_padding_bits(GF_ISOFile *the_file, u32 trackNumber, u32 sampleNumber, u8 NbBits);
\r
906 /*since v2 you must specify w/h of video tracks for authoring tools (no decode the video cfg / first sample)*/
\r
907 GF_Err gf_isom_set_visual_info(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex, u32 Width, u32 Height);
\r
909 /*mainly used for 3GPP text since most ISO-based formats ignore these (except MJ2K)
\r
910 all coord values are expressed as 16.16 fixed point floats*/
\r
911 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
913 GF_Err gf_isom_set_pixel_aspect_ratio(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex, u32 hSpacing, u32 vSpacing);
\r
915 /*set SR & nbChans for audio description*/
\r
916 GF_Err gf_isom_set_audio_info(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex, u32 sampleRate, u32 nbChannels, u8 bitsPerSample);
\r
918 /*non standard extensions: set/remove a fragment of a sample - this is used for video packets
\r
919 in order to keep AU structure in the file format (no normative tables for that). Info is NOT written to disk*/
\r
920 GF_Err gf_isom_add_sample_fragment(GF_ISOFile *the_file, u32 trackNumber, u32 sampleNumber, u16 FragmentSize);
\r
921 GF_Err gf_isom_remove_sample_fragment(GF_ISOFile *the_file, u32 trackNumber, u32 sampleNumber);
\r
922 /*remove all sample fragment info for this track*/
\r
923 GF_Err gf_isom_remove_sample_fragments(GF_ISOFile *the_file, u32 trackNumber);
\r
925 /*set CTS unpack mode (used for B-frames & like): in unpack mode, each sample uses one entry in CTTS tables
\r
926 unpack=0: set unpack on - !!creates a CTTS table if none found!!
\r
927 unpack=1: set unpack off and repacks all table info
\r
929 GF_Err gf_isom_set_cts_packing(GF_ISOFile *the_file, u32 trackNumber, Bool unpack);
\r
930 /*modify CTS offset of a given sample (used for B-frames) - MUST be called in unpack mode only*/
\r
931 GF_Err gf_isom_modify_cts_offset(GF_ISOFile *the_file, u32 trackNumber, u32 sample_number, u32 offset);
\r
932 /*remove CTS offset table (used for B-frames)*/
\r
933 GF_Err gf_isom_remove_cts_info(GF_ISOFile *the_file, u32 trackNumber);
\r
935 /*set 3char code media language*/
\r
936 GF_Err gf_isom_set_media_language(GF_ISOFile *the_file, u32 trackNumber, char *three_char_code);
\r
938 /*removes given stream description*/
\r
939 GF_Err gf_isom_remove_sample_description(GF_ISOFile *the_file, u32 trackNumber, u32 streamDescIndex);
\r
942 some authoring extensions
\r
944 /*sets name for authoring - if name is NULL reset authoring name*/
\r
945 GF_Err gf_isom_set_track_name(GF_ISOFile *the_file, u32 trackNumber, char *name);
\r
946 /*gets authoring name*/
\r
947 const char *gf_isom_get_track_name(GF_ISOFile *the_file, u32 trackNumber);
\r
953 /*set a profile and level indication for the movie iod (created if needed)
\r
954 if the flag is ProfileLevel is 0 this means the movie doesn't require
\r
955 the specific codec (equivalent to 0xFF value in MPEG profiles)*/
\r
956 GF_Err gf_isom_set_pl_indication(GF_ISOFile *the_file, u8 PL_Code, u8 ProfileLevel);
\r
958 /*set the rootOD ID of the movie if you need it. By default, movies are created without root ODs*/
\r
959 GF_Err gf_isom_set_root_od_id(GF_ISOFile *the_file, u32 OD_ID);
\r
961 /*set the rootOD URL of the movie if you need it (only needed to create empty file pointing
\r
962 to external ressource)*/
\r
963 GF_Err gf_isom_set_root_od_url(GF_ISOFile *the_file, char *url_string);
\r
965 /*remove the root OD*/
\r
966 GF_Err gf_isom_remove_root_od(GF_ISOFile *the_file);
\r
968 /*Add a system descriptor to the OD of the movie*/
\r
969 GF_Err gf_isom_add_desc_to_root_od(GF_ISOFile *the_file, GF_Descriptor *theDesc);
\r
971 /*add a track to the root OD*/
\r
972 GF_Err gf_isom_add_track_to_root_od(GF_ISOFile *the_file, u32 trackNumber);
\r
974 /*remove a track to the root OD*/
\r
975 GF_Err gf_isom_remove_track_from_root_od(GF_ISOFile *the_file, u32 trackNumber);
\r
977 /*Create a new StreamDescription (GF_ESD) in the file. The URL and URN are used to
\r
978 describe external media, this will creat a data reference for the media*/
\r
979 GF_Err gf_isom_new_mpeg4_description(GF_ISOFile *the_file, u32 trackNumber, GF_ESD *esd, char *URLname, char *URNname, u32 *outDescriptionIndex);
\r
981 /*use carefully. Very usefull when you made a lot of changes (IPMP, IPI, OCI, ...)
\r
982 THIS WILL REPLACE THE WHOLE DESCRIPTOR ...*/
\r
983 GF_Err gf_isom_change_mpeg4_description(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex, GF_ESD *newESD);
\r
985 /*Add a system descriptor to the ESD of a stream - you have to delete the descriptor*/
\r
986 GF_Err gf_isom_add_desc_to_description(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex, GF_Descriptor *theDesc);
\r
989 /*Default extensions*/
\r
991 /*Create a new unknown StreamDescription in the file. The URL and URN are used to
\r
992 describe external media, this will creat a data reference for the media
\r
993 use this to store media not currently supported by the ISO media format
\r
995 GF_Err gf_isom_new_generic_sample_description(GF_ISOFile *the_file, u32 trackNumber, char *URLname, char *URNname, GF_GenericSampleDescription *udesc, u32 *outDescriptionIndex);
\r
997 /*change the data field of an unknown sample description*/
\r
998 GF_Err gf_isom_change_generic_sample_description(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex, GF_GenericSampleDescription *udesc);
\r
1001 special shortcut for stream description cloning from a given input file (this avoids inspecting for media type)
\r
1002 @the_file, @trackNumber: destination file and track
\r
1003 @orig_file, @orig_track, @orig_desc_index: orginal file, track and sample description
\r
1004 @URLname, @URNname, @outDescriptionIndex: same usage as with gf_isom_new_mpeg4_description
\r
1006 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
1008 /*special shortcut: clones a track (everything except media data and sample info (DTS? CTS, RAPs, etc...)
\r
1009 also clones sampleDescriptions
\r
1010 @keep_data_ref: if set, external data references are kept, otherwise they are removed (track media data will be self-contained)
\r
1011 @dest_track: track number of cloned track*/
\r
1012 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
1013 /*special shortcut: clones IOD PLs from orig to dest if any*/
\r
1014 GF_Err gf_isom_clone_pl_indications(GF_ISOFile *orig, GF_ISOFile *dest);
\r
1015 /*clones root OD from input to output file, without copying root OD track references*/
\r
1016 GF_Err gf_isom_clone_root_od(GF_ISOFile *input, GF_ISOFile *output);
\r
1018 /*returns true if same set of sample description in both tracks - this does include self-contained checking
\r
1019 and reserved flags. The specific media cfg (DSI & co) is not analysed, only
\r
1020 a brutal memory comparaison is done*/
\r
1021 Bool gf_isom_is_same_sample_description(GF_ISOFile *f1, u32 tk1, GF_ISOFile *f2, u32 tk2);
\r
1023 GF_Err gf_isom_set_JPEG2000(GF_ISOFile *mov, Bool set_on);
\r
1026 Movie Fragments Writing API
\r
1027 Movie Fragments is a feature of ISO media files for fragmentation
\r
1028 of a presentation meta-data and interleaving with its media data.
\r
1029 This enables faster http fast start for big movies, and also reduces the risk
\r
1030 of data loss in case of a recording crash, because meta data and media data
\r
1031 can be written to disk at regular times
\r
1032 This API provides simple function calls to setup such a movie and write it
\r
1033 The process implies:
\r
1034 1- creating a movie in the usual way (track, stream descriptions, (IOD setup
\r
1036 2- possibly add some samples in the regular fashion
\r
1037 3- setup track fragments for all track that will be written in a fragmented way
\r
1038 (note that you can create/write a track that has no fragmentation at all)
\r
1039 4- finalize the movie for fragmentation (this will flush all meta-data and
\r
1040 any media-data added to disk, ensuring all vital information for the presentation
\r
1041 is stored on file and not lost in case of crash/poweroff)
\r
1043 then 5-6 as often as desired
\r
1044 5- start a new movie fragment
\r
1045 6- add samples to each setup track
\r
1049 * Movie Fragments can only be used in GF_ISOM_OPEN_WRITE mode (capturing)
\r
1050 and no editing functionalities can be used
\r
1051 * the fragmented movie API uses TrackID and not TrackNumber
\r
1055 setup a track for fragmentation by specifying some default values for
\r
1056 storage efficiency
\r
1057 *TrackID: track identifier
\r
1058 *DefaultStreamDescriptionIndex: the default description used by samples in this track
\r
1059 *DefaultSampleDuration: default duration of samples in this track
\r
1060 *DefaultSampleSize: default size of samples in this track (0 if unknown)
\r
1061 *DefaultSampleIsSync: default key-flag (RAP) of samples in this track
\r
1062 *DefaultSamplePadding: default padding bits for samples in this track
\r
1063 *DefaultDegradationPriority: default degradation priority for samples in this track
\r
1066 GF_Err gf_isom_setup_track_fragment(GF_ISOFile *the_file, u32 TrackID,
\r
1067 u32 DefaultStreamDescriptionIndex,
\r
1068 u32 DefaultSampleDuration,
\r
1069 u32 DefaultSampleSize,
\r
1070 u8 DefaultSampleIsSync,
\r
1071 u8 DefaultSamplePadding,
\r
1072 u16 DefaultDegradationPriority);
\r
1074 /*flushes data to disk and prepare movie fragmentation*/
\r
1075 GF_Err gf_isom_finalize_for_fragment(GF_ISOFile *the_file);
\r
1077 /*starts a new movie fragment*/
\r
1078 GF_Err gf_isom_start_fragment(GF_ISOFile *the_file);
\r
1083 /*indicates that the track fragment has no samples but still has a duration
\r
1084 (silence-detection in audio codecs, ...).
\r
1085 param: indicates duration*/
\r
1086 GF_ISOM_TRAF_EMPTY,
\r
1087 /*I-Frame detection: this can reduce file size by detecting I-frames and
\r
1088 optimizing sample flags (padding, priority, ..)
\r
1089 param: on/off (0/1)*/
\r
1090 GF_ISOM_TRAF_RANDOM_ACCESS,
\r
1091 /*activate data cache on track fragment. This is usefull when writing interleaved
\r
1092 media from a live source (typically audio-video), and greatly reduces file size
\r
1093 param: Number of samples (> 1) to cache before disk flushing. You shouldn't try
\r
1094 to cache too many samples since this will load your memory. base that on FPS/SR*/
\r
1095 GF_ISOM_TRAF_DATA_CACHE
\r
1098 /*set options. Options can be set at the begining of each new fragment only, and for the
\r
1099 lifetime of the fragment*/
\r
1100 GF_Err gf_isom_set_fragment_option(GF_ISOFile *the_file, u32 TrackID, u32 Code, u32 param);
\r
1103 /*adds a sample to a fragmented track
\r
1105 *TrackID: destination track
\r
1106 *sample: sample to add
\r
1107 *StreamDescriptionIndex: stream description for this sample. If 0, the default one
\r
1109 *Duration: sample duration.
\r
1110 Note: because of the interleaved nature of the meta/media data, the sample duration
\r
1111 MUST be provided (in case of regular tracks, this was computed internally by the lib)
\r
1112 *PaddingBits: padding bits for the sample, or 0
\r
1113 *DegradationPriority for the sample, or 0
\r
1117 GF_Err gf_isom_fragment_add_sample(GF_ISOFile *the_file, u32 TrackID, GF_ISOSample *sample,
\r
1118 u32 StreamDescriptionIndex,
\r
1120 u8 PaddingBits, u16 DegradationPriority);
\r
1122 /*appends data into last sample of track for video fragments/other media
\r
1123 CANNOT be used with OD tracks*/
\r
1124 GF_Err gf_isom_fragment_append_data(GF_ISOFile *the_file, u32 TrackID, char *data, u32 data_size, u8 PaddingBits);
\r
1128 /******************************************************************
\r
1129 GENERIC Publishing API
\r
1130 ******************************************************************/
\r
1132 /*Removes all sync shadow entries for a given track. The shadow samples are NOT removed; they must be removed
\r
1134 GF_Err gf_isom_remove_sync_shadows(GF_ISOFile *the_file, u32 trackNumber);
\r
1136 /*Use this function to do the shadowing if you use shadowing.
\r
1137 the sample to be shadowed MUST be a non-sync sample (ignored if not)
\r
1138 the sample shadowing must be a Sync sample (error if not)*/
\r
1139 GF_Err gf_isom_set_sync_shadow(GF_ISOFile *the_file, u32 trackNumber, u32 sampleNumber, u32 syncSample);
\r
1141 /*set the GroupID of a track (only used for optimized interleaving). By setting GroupIDs
\r
1142 you can specify the storage order for media data of a group of streams. This is usefull
\r
1143 for BIFS presentation so that static resources of the scene can be downloaded before BIFS*/
\r
1144 GF_Err gf_isom_set_track_group(GF_ISOFile *the_file, u32 trackNumber, u32 GroupID);
\r
1146 /*set the priority of a track within a Group (used for optimized interleaving and hinting).
\r
1147 This allows tracks to be stored before other within a same group, for instance the
\r
1148 hint track data can be stored just before the media data, reducing disk seeking
\r
1149 for a same time, within a group of tracks, the track with the lowest inversePriority will
\r
1150 be written first*/
\r
1151 GF_Err gf_isom_set_track_priority_in_group(GF_ISOFile *the_file, u32 trackNumber, u32 InversePriority);
\r
1153 /*set the max SamplesPerChunk (for file optimization, mainly in FLAT and STREAMABLE modes)*/
\r
1154 GF_Err gf_isom_set_max_samples_per_chunk(GF_ISOFile *the_file, u32 trackNumber, u32 maxSamplesPerChunk);
\r
1156 /*associate a given SL config with a given ESD while extracting the OD information
\r
1157 all the SL params must be fixed by the calling app!
\r
1158 The SLConfig is stored by the API for further use. A NULL pointer will result
\r
1159 in using the default SLConfig (predefined = 2) remapped to predefined = 0
\r
1160 This is usefull while reading the IOD / OD stream of an MP4 file. Note however that
\r
1161 only full AUs are extracted, therefore the calling application must SL-packetize the streams*/
\r
1162 GF_Err gf_isom_set_extraction_slc(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex, GF_SLConfig *slConfig);
\r
1164 GF_Err gf_isom_get_extraction_slc(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex, GF_SLConfig **slConfig);
\r
1166 u32 gf_isom_get_track_group(GF_ISOFile *the_file, u32 trackNumber);
\r
1167 u32 gf_isom_get_track_priority_in_group(GF_ISOFile *the_file, u32 trackNumber);
\r
1169 /*stores movie config (storage mode, interleave time, track groupIDs, priorities and names) in UDTA(kept on disk)
\r
1170 if @remove_all is set, removes all stored info, otherwise recompute all stored info*/
\r
1171 GF_Err gf_isom_store_movie_config(GF_ISOFile *the_file, Bool remove_all);
\r
1172 /*restores movie config (storage mode, interleave time, track groupIDs, priorities and names) if found*/
\r
1173 GF_Err gf_isom_load_movie_config(GF_ISOFile *the_file);
\r
1175 /*setup interleaving for storage (shortcut for storeage mode + interleave_time)*/
\r
1176 GF_Err gf_isom_make_interleave(GF_ISOFile *mp4file, Double TimeInSec);
\r
1179 /******************************************************************
\r
1180 GENERIC HINTING WRITING API
\r
1181 ******************************************************************/
\r
1183 /*supported hint formats - ONLY RTP now*/
\r
1186 GF_ISOM_HINT_RTP = GF_4CC('r', 't', 'p', ' '),
\r
1190 /*Setup the resources based on the hint format
\r
1191 This function MUST be called after creating a new hint track and before
\r
1192 any other calls on this track*/
\r
1193 GF_Err gf_isom_setup_hint_track(GF_ISOFile *the_file, u32 trackNumber, u32 HintType);
\r
1195 /*Create a HintDescription for the HintTrack
\r
1196 the rely flag indicates whether a reliable transport protocol is desired/required
\r
1197 for data transport
\r
1198 0: not desired (UDP/IP). NB: most RTP streaming servers only support UDP/IP for data
\r
1199 1: preferable (TCP/IP if possible or UDP/IP)
\r
1200 2: required (TCP/IP only)
\r
1201 The HintDescriptionIndex is set, to be used when creating a HINT sample
\r
1203 GF_Err gf_isom_new_hint_description(GF_ISOFile *the_file, u32 trackNumber, s32 HintTrackVersion, s32 LastCompatibleVersion, u8 Rely, u32 *HintDescriptionIndex);
\r
1205 /*Starts a new sample for the hint track. A sample is just a collection of packets
\r
1206 the transmissionTime is indicated in the media timeScale of the hint track*/
\r
1207 GF_Err gf_isom_begin_hint_sample(GF_ISOFile *the_file, u32 trackNumber, u32 HintDescriptionIndex, u32 TransmissionTime);
\r
1209 /*stores the hint sample in the file once all your packets for this sample are done
\r
1210 set IsRandomAccessPoint if you want to indicate that this is a random access point
\r
1212 GF_Err gf_isom_end_hint_sample(GF_ISOFile *the_file, u32 trackNumber, u8 IsRandomAccessPoint);
\r
1215 /******************************************************************
\r
1216 PacketHandling functions
\r
1217 Data can be added at the end or at the beginning of the current packet
\r
1218 by setting AtBegin to 1 the data will be added at the begining
\r
1219 This allows constructing the packet payload before any meta-data
\r
1220 ******************************************************************/
\r
1222 /*adds a blank chunk of data in the sample that is skipped while streaming*/
\r
1223 GF_Err gf_isom_hint_blank_data(GF_ISOFile *the_file, u32 trackNumber, u8 AtBegin);
\r
1225 /*adds a chunk of data in the packet that is directly copied while streaming
\r
1226 NOTE: dataLength MUST BE <= 14 bytes, and you should only use this function
\r
1227 to add small blocks of data (encrypted parts, specific headers, ...)*/
\r
1228 GF_Err gf_isom_hint_direct_data(GF_ISOFile *the_file, u32 trackNumber, char *data, u32 dataLength, u8 AtBegin);
\r
1230 /*adds a reference to some sample data in the packet
\r
1231 SourceTrackID: the ID of the track where the referenced sample is
\r
1232 SampleNumber: the sample number containing the data to be added
\r
1233 DataLength: the length of bytes to copy in the packet
\r
1234 offsetInSample: the offset in bytes in the sample at which to begin copying data
\r
1236 extra_data: only used when the sample is actually the sample that will contain this packet
\r
1237 (usefull to store en encrypted version of a packet only available while streaming)
\r
1238 In this case, set SourceTrackID to the HintTrack ID and SampleNumber to 0
\r
1239 In this case, the DataOffset MUST BE NULL and length will indicate the extra_data size
\r
1241 Note that if you want to reference a previous HintSample in the hintTrack, you will
\r
1242 have to parse the sample yourself ...
\r
1244 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
1247 /*adds a reference to some stream description data in the packet (headers, ...)
\r
1248 SourceTrackID: the ID of the track where the referenced sample is
\r
1249 StreamDescriptionIndex: the index of the stream description in the desired track
\r
1250 DataLength: the length of bytes to copy in the packet
\r
1251 offsetInDescription: the offset in bytes in the description at which to begin copying data
\r
1253 Since it is far from being obvious what this offset is, we recommend not using this
\r
1254 function. The ISO Media Format specification is currently being updated to solve
\r
1256 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
1259 /******************************************************************
\r
1260 RTP SPECIFIC WRITING API
\r
1261 ******************************************************************/
\r
1263 /*Creates a new RTP packet in the HintSample. If a previous packet was created,
\r
1264 it is stored in the hint sample and a new packet is created.
\r
1265 - relativeTime: RTP time offset of this packet in the HintSample if any - in hint track
\r
1266 time scale. Used for data smoothing by servers.
\r
1267 - PackingBit: the 'P' bit of the RTP packet header
\r
1268 - eXtensionBit: the'X' bit of the RTP packet header
\r
1269 - MarkerBit: the 'M' bit of the RTP packet header
\r
1270 - PayloadType: the payload type, on 7 bits, format 0x0XXXXXXX
\r
1271 - B_frame: indicates if this is a B-frame packet. Can be skipped by a server
\r
1272 - IsRepeatedPacket: indicates if this is a duplicate packet of a previous one.
\r
1273 Can be skipped by a server
\r
1274 - SequenceNumber: the RTP base sequence number of the packet. Because of support for repeated
\r
1275 packets, you have to set the sequence number yourself.*/
\r
1276 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
1278 /*set the flags of the RTP packet*/
\r
1279 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
1281 /*set the time offset of this packet. This enables packets to be placed in the hint track
\r
1282 in decoding order, but have their presentation time-stamp in the transmitted
\r
1283 packet in a different order. Typically used for MPEG video with B-frames
\r
1285 GF_Err gf_isom_rtp_packet_set_offset(GF_ISOFile *the_file, u32 trackNumber, s32 timeOffset);
\r
1288 /*set some specific info in the HintDescription for RTP*/
\r
1290 /*sets the RTP TimeScale that the server use to send packets
\r
1291 some RTP payloads may need a specific timeScale that is not the timeScale in the file format
\r
1292 the default timeScale choosen by the API is the MediaTimeScale of the hint track*/
\r
1293 GF_Err gf_isom_rtp_set_timescale(GF_ISOFile *the_file, u32 trackNumber, u32 HintDescriptionIndex, u32 TimeScale);
\r
1294 /*sets the RTP TimeOffset that the server will add to the packets
\r
1295 if not set, the server adds a random offset*/
\r
1296 GF_Err gf_isom_rtp_set_time_offset(GF_ISOFile *the_file, u32 trackNumber, u32 HintDescriptionIndex, u32 TimeOffset);
\r
1297 /*sets the RTP SequenceNumber Offset that the server will add to the packets
\r
1298 if not set, the server adds a random offset*/
\r
1299 GF_Err gf_isom_rtp_set_time_sequence_offset(GF_ISOFile *the_file, u32 trackNumber, u32 HintDescriptionIndex, u32 SequenceNumberOffset);
\r
1303 /******************************************************************
\r
1304 SDP SPECIFIC WRITING API
\r
1305 ******************************************************************/
\r
1306 /*add an SDP line to the SDP container at the track level (media-specific SDP info)
\r
1307 NOTE: the \r\n end of line for SDP is automatically inserted*/
\r
1308 GF_Err gf_isom_sdp_add_track_line(GF_ISOFile *the_file, u32 trackNumber, const char *text);
\r
1309 /*remove all SDP info at the track level*/
\r
1310 GF_Err gf_isom_sdp_clean_track(GF_ISOFile *the_file, u32 trackNumber);
\r
1312 /*add an SDP line to the SDP container at the movie level (presentation SDP info)
\r
1313 NOTE: the \r\n end of line for SDP is automatically inserted*/
\r
1314 GF_Err gf_isom_sdp_add_line(GF_ISOFile *the_file, const char *text);
\r
1315 /*remove all SDP info at the movie level*/
\r
1316 GF_Err gf_isom_sdp_clean(GF_ISOFile *the_file);
\r
1318 #endif /*GPAC_READ_ONLY*/
\r
1320 /*Get SDP info at the movie level*/
\r
1321 GF_Err gf_isom_sdp_get(GF_ISOFile *the_file, const char **sdp, u32 *length);
\r
1322 /*Get SDP info at the track level*/
\r
1323 GF_Err gf_isom_sdp_track_get(GF_ISOFile *the_file, u32 trackNumber, const char **sdp, u32 *length);
\r
1325 u32 gf_isom_get_payt_count(GF_ISOFile *the_file, u32 trackNumber);
\r
1326 const char *gf_isom_get_payt_info(GF_ISOFile *the_file, u32 trackNumber, u32 index, u32 *payID);
\r
1328 /*dumps file structures into XML trace file */
\r
1329 GF_Err gf_isom_dump(GF_ISOFile *file, FILE *trace);
\r
1330 /*dumps RTP hint samples structure into XML trace file
\r
1331 @trackNumber, @SampleNum: hint track and hint sample number
\r
1334 GF_Err gf_isom_dump_hint_sample(GF_ISOFile *the_file, u32 trackNumber, u32 SampleNum, FILE * trace);
\r
1338 /*small hint reader - performs data caching*/
\r
1340 /*resets hint reading parameters, returns an error if the hint type is not supported for reading
\r
1341 packet sequence number is always reseted to 0
\r
1342 @sample_start: indicates from where the packets should be read (regular 1-based sample number)
\r
1343 @ts_offset: constant offset for timestamps, must be expressed in media timescale (which is the hint timescale).
\r
1344 usually 0 (no offset)
\r
1345 @sn_offset: offset for packet sequence number (first packet will have a SN of 1 + sn_offset)
\r
1347 @ssrc: sync source identifier for RTP
\r
1349 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
1351 /*reads next hint packet. ALl packets are read in transmission (decoding) order
\r
1352 returns an error if not supported, or GF_EOS when no more packets are available
\r
1353 currently only RTP reader is supported
\r
1354 @pck_data, @pck_size: output packet data (must be freed by caller) - contains all info to be sent
\r
1355 on the wire, eg for RTP contains the RTP header and the data
\r
1356 @disposable (optional): indicates that the packet can be droped when late (B-frames & co)
\r
1357 @repeated (optional): indicates this is a repeated packet (same one has already been sent)
\r
1358 @trans_ts (optional): indicates the transmission time of the packet, expressed in hint timescale, taking into account
\r
1359 the ts_offset specified in gf_isom_reset_hint_reader. Depending on packets this may not be the same
\r
1360 as the hint sample timestamp + ts_offset, some packets may need to be sent earlier (B-frames)
\r
1361 @sample_num (optional): indicates hint sample number the packet belongs to
\r
1363 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
1367 3GPP specific extensions
\r
1368 NOTE: MPEG-4 OD Framework cannot be used with 3GPP files.
\r
1369 Stream Descriptions are not GF_ESD, just generic config options as specified in this file
\r
1372 /*Generic 3GP/3GP2 config record*/
\r
1375 /*GF_4CC record type, one fo the above GF_ISOM_SUBTYPE_3GP_ * subtypes*/
\r
1377 /*4CC vendor name*/
\r
1380 u8 decoder_version;
\r
1381 /*number of sound frames per IsoMedia sample, >0 and <=15. The very last sample may contain less frames. */
\r
1382 u8 frames_per_sample;
\r
1384 /*H263 ONLY - Level and profile*/
\r
1385 u8 H263_level, H263_profile;
\r
1387 /*AMR(WB) ONLY - num of mode for the codec*/
\r
1389 /*AMR(WB) ONLY - changes in codec mode per sample*/
\r
1390 u8 AMR_mode_change_period;
\r
1394 /*return the 3GP config for this tream description, NULL if not a 3GPP track*/
\r
1395 GF_3GPConfig *gf_isom_3gp_config_get(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex);
\r
1396 #ifndef GPAC_READ_ONLY
\r
1397 /*create the track config*/
\r
1398 GF_Err gf_isom_3gp_config_new(GF_ISOFile *the_file, u32 trackNumber, GF_3GPConfig *config, char *URLname, char *URNname, u32 *outDescriptionIndex);
\r
1399 /*update the track config - subtypes shall NOT differ*/
\r
1400 GF_Err gf_isom_3gp_config_update(GF_ISOFile *the_file, u32 trackNumber, GF_3GPConfig *config, u32 DescriptionIndex);
\r
1401 #endif /*GPAC_READ_ONLY*/
\r
1403 /*AVC/H264 extensions - GF_AVCConfig is defined in mpeg4_odf.h*/
\r
1405 /*gets uncompressed AVC config - user is responsible for deleting it*/
\r
1406 GF_AVCConfig *gf_isom_avc_config_get(GF_ISOFile *the_file, u32 trackNumber, u32 DescriptionIndex);
\r
1408 #ifndef GPAC_READ_ONLY
\r
1409 /*creates new AVC config*/
\r
1410 GF_Err gf_isom_avc_config_new(GF_ISOFile *the_file, u32 trackNumber, GF_AVCConfig *cfg, char *URLname, char *URNname, u32 *outDescriptionIndex);
\r
1411 /*updates AVC config*/
\r
1412 GF_Err gf_isom_avc_config_update(GF_ISOFile *the_file, u32 trackNumber, u32 DescriptionIndex, GF_AVCConfig *cfg);
\r
1417 3GP timed text handling
\r
1419 NOTE: currently only writing API is developped, the reading one is not used in MPEG-4 since
\r
1420 MPEG-4 maps 3GP timed text to MPEG-4 Streaming Text (part 17)
\r
1423 /*set streamihng text reading mode: if do_convert is set, all text samples will be retrieved as TTUs
\r
1424 and ESD will be emulated for text tracks.*/
\r
1425 GF_Err gf_isom_text_set_streaming_mode(GF_ISOFile *the_file, Bool do_convert);
\r
1427 /*exports text track to given format
\r
1428 @dump_type: 0 for TTXT, 1 for srt, 2 for SVG
\r
1430 GF_Err gf_isom_text_dump(GF_ISOFile *the_file, u32 track, FILE *dump, u32 dump_type);
\r
1432 /*returns encoded TX3G box (text sample description for 3GPP text streams) as needed by RTP or other standards:
\r
1433 @sidx: 1-based stream description index
\r
1435 if 0, the sidx will NOT be written before the encoded TX3G
\r
1436 if not 0, the sidx will be written before the encoded TX3G, with the given offset. Offset sshould be at
\r
1437 least 128 for most commmon usage of TX3G (RTP, MPEG-4 timed text, etc)
\r
1440 GF_Err gf_isom_text_get_encoded_tx3g(GF_ISOFile *file, u32 track, u32 sidx, u32 sidx_offset, char **tx3g, u32 *tx3g_size);
\r
1442 /*checks if this text description is already inserted
\r
1443 @outDescIdx: set to 0 if not found, or descIndex
\r
1444 @same_style, @same_box: indicates if default styles and box are used
\r
1446 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
1448 /*text sample formatting*/
\r
1449 typedef struct _3gpp_text_sample GF_TextSample;
\r
1450 /*creates text sample handle*/
\r
1451 GF_TextSample *gf_isom_new_text_sample();
\r
1452 /*destroy text sample handle*/
\r
1453 void gf_isom_delete_text_sample(GF_TextSample *tx_samp);
\r
1455 #ifndef GPAC_READ_ONLY
\r
1457 /*Create a new TextSampleDescription in the file.
\r
1458 The URL and URN are used to describe external media, this will create a data reference for the media
\r
1459 GF_TextSampleDescriptor is defined in mpeg4_odf.h
\r
1461 GF_Err gf_isom_new_text_description(GF_ISOFile *the_file, u32 trackNumber, GF_TextSampleDescriptor *desc, char *URLname, char *URNname, u32 *outDescriptionIndex);
\r
1462 /*change the text sample description*/
\r
1463 GF_Err gf_isom_update_text_description(GF_ISOFile *movie, u32 trackNumber, u32 descriptionIndex, GF_TextSampleDescriptor *desc);
\r
1465 /*reset text sample content*/
\r
1466 GF_Err gf_isom_text_reset(GF_TextSample * tx_samp);
\r
1467 /*reset text sample styles but keep text*/
\r
1468 GF_Err gf_isom_text_reset_styles(GF_TextSample * samp);
\r
1470 /*sets UTF16 marker for text data. This MUST be called on an empty sample. If text data added later
\r
1471 on (cf below) is not formatted as UTF16 data(2 bytes char) the resulting text sample won't be compliant,
\r
1472 but this library WON'T WARN*/
\r
1473 GF_Err gf_isom_text_set_utf16_marker(GF_TextSample * samp);
\r
1474 /*append text to sample - text_len is the number of bytes to be written from text_data. This allows
\r
1475 handling UTF8 and UTF16 strings in a transparent manner*/
\r
1476 GF_Err gf_isom_text_add_text(GF_TextSample * tx_samp, char *text_data, u32 text_len);
\r
1477 /*append style modifyer to sample*/
\r
1478 GF_Err gf_isom_text_add_style(GF_TextSample * tx_samp, GF_StyleRecord *rec);
\r
1479 /*appends highlight modifier for the sample
\r
1480 @start_char: first char highlighted,
\r
1481 @end_char: first char not highlighted*/
\r
1482 GF_Err gf_isom_text_add_highlight(GF_TextSample * samp, u16 start_char, u16 end_char);
\r
1483 /*sets highlight color for the whole sample*/
\r
1484 GF_Err gf_isom_text_set_highlight_color(GF_TextSample * samp, u8 r, u8 g, u8 b, u8 a);
\r
1485 GF_Err gf_isom_text_set_highlight_color_argb(GF_TextSample * samp, u32 argb);
\r
1486 /*appends a new karaoke sequence in the sample
\r
1487 @start_time: karaoke start time expressed in text stream timescale, but relative to the sample media time
\r
1489 GF_Err gf_isom_text_add_karaoke(GF_TextSample * samp, u32 start_time);
\r
1490 /*appends a new segment in the current karaoke sequence - you must build sequences in order to be compliant
\r
1491 @end_time: segment end time expressed in text stream timescale, but relative to the sample media time
\r
1492 @start_char: first char highlighted,
\r
1493 @end_char: first char not highlighted
\r
1495 GF_Err gf_isom_text_set_karaoke_segment(GF_TextSample * samp, u32 end_time, u16 start_char, u16 end_char);
\r
1496 /*sets scroll delay for the whole sample (scrolling is enabled through GF_TextSampleDescriptor.DisplayFlags)
\r
1497 @scroll_delay: delay for scrolling expressed in text stream timescale
\r
1499 GF_Err gf_isom_text_set_scroll_delay(GF_TextSample * samp, u32 scroll_delay);
\r
1500 /*appends hyperlinking for the sample
\r
1502 @altString: ASCII hint (tooltip, ...) for end user
\r
1503 @start_char: first char hyperlinked,
\r
1504 @end_char: first char not hyperlinked
\r
1506 GF_Err gf_isom_text_add_hyperlink(GF_TextSample * samp, char *URL, char *altString, u16 start_char, u16 end_char);
\r
1507 /*sets current text box (display pos&size within the text track window) for the sample*/
\r
1508 GF_Err gf_isom_text_set_box(GF_TextSample * samp, s16 top, s16 left, s16 bottom, s16 right);
\r
1509 /*appends blinking for the sample
\r
1510 @start_char: first char blinking,
\r
1511 @end_char: first char not blinking
\r
1513 GF_Err gf_isom_text_add_blink(GF_TextSample * samp, u16 start_char, u16 end_char);
\r
1514 /*sets wrap flag for the sample - currently only 0 (no wrap) and 1 ("soft wrap") are allowed in 3GP*/
\r
1515 GF_Err gf_isom_text_set_wrap(GF_TextSample * samp, u8 wrap_flags);
\r
1517 /*formats sample as a regular GF_ISOSample. The resulting sample will always be marked as random access
\r
1518 text sample content is kept untouched*/
\r
1519 GF_ISOSample *gf_isom_text_to_sample(GF_TextSample * tx_samp);
\r
1521 #endif //GPAC_READ_ONLY
\r
1523 /*****************************************************
\r
1525 *****************************************************/
\r
1526 /*flags for GF_ISMASample*/
\r
1529 /*signals the stream the sample belongs to uses selective encryption*/
\r
1530 GF_ISOM_ISMA_USE_SEL_ENC = 1,
\r
1531 /*signals the sample is encrypted*/
\r
1532 GF_ISOM_ISMA_IS_ENCRYPTED = 2,
\r
1537 /*IV in ISMACryp is Byte Stream Offset*/
\r
1539 u8 IV_length;/*repeated from sampleDesc for convenience*/
\r
1540 u8 *key_indicator;
\r
1541 u8 KI_length;/*repeated from sampleDesc for convenience*/
\r
1547 * creates a new empty ISMA sample
\r
1549 GF_ISMASample *gf_isom_ismacryp_new_sample();
\r
1551 /*delete an ISMA sample. NOTE:the buffers content will be destroyed by default.
\r
1552 if you wish to keep the buffer, set dataLength to 0 in the sample before deleting it*/
\r
1553 void gf_isom_ismacryp_delete_sample(GF_ISMASample *samp);
\r
1555 /*decodes ISMACryp sample based on all info in ISMACryp sample description*/
\r
1556 GF_ISMASample *gf_isom_ismacryp_sample_from_data(char *data, u32 dataLength, Bool use_selective_encryption, u8 KI_length, u8 IV_length);
\r
1557 /*rewrites samp content from s content*/
\r
1558 GF_Err gf_isom_ismacryp_sample_to_sample(GF_ISMASample *s, GF_ISOSample *dest);
\r
1560 /*decodes ISMACryp sample based on sample and its descrition index - returns NULL if not an ISMA sample
\r
1561 Note: input sample is NOT destroyed*/
\r
1562 GF_ISMASample *gf_isom_get_ismacryp_sample(GF_ISOFile *the_file, u32 trackNumber, GF_ISOSample *samp, u32 sampleDescriptionIndex);
\r
1564 /*returns whether the given media is a protected one or not - return scheme protection 4CC*/
\r
1565 u32 gf_isom_is_media_encrypted(GF_ISOFile *the_file, u32 trackNumber, u32 sampleDescriptionIndex);
\r
1567 /*returns whether the given media is a protected ISMACryp one or not*/
\r
1568 Bool gf_isom_is_ismacryp_media(GF_ISOFile *the_file, u32 trackNumber, u32 sampleDescriptionIndex);
\r
1570 /*returns whether the given media is a protected ISMACryp one or not*/
\r
1571 Bool gf_isom_is_omadrm_media(GF_ISOFile *the_file, u32 trackNumber, u32 sampleDescriptionIndex);
\r
1573 GF_Err gf_isom_get_omadrm_info(GF_ISOFile *the_file, u32 trackNumber, u32 sampleDescriptionIndex, u32 *outOriginalFormat,
\r
1574 u32 *outSchemeType, u32 *outSchemeVersion,
\r
1575 const char **outContentID, const char **outRightsIssuerURL, const char **outTextualHeaders, u32 *outTextualHeadersLen, u64 *outPlaintextLength, u32 *outEncryptionType, Bool *outSelectiveEncryption, u32 *outIVLength, u32 *outKeyIndicationLength);
\r
1576 /*retrieves ISMACryp info for the given track & SDI - all output parameters are optional - URIs SHALL NOT BE MODIFIED BY USER
\r
1577 @outOriginalFormat: retrieves orginal protected media format - usually GF_ISOM_SUBTYPE_MPEG4
\r
1578 @outSchemeType: retrieves 4CC of protection scheme (GF_ISOM_ISMACRYP_SCHEME = iAEC in ISMACryp 1.0)
\r
1579 outSchemeVersion: retrieves version of protection scheme (1 in ISMACryp 1.0)
\r
1580 outSchemeURI: retrieves URI location of scheme
\r
1581 outKMS_URI: retrieves URI location of key management system - only valid with ISMACryp 1.0
\r
1582 outSelectiveEncryption: specifies whether sample-based encryption is used in media - only valid with ISMACryp 1.0
\r
1583 outIVLength: specifies length of Initial Vector - only valid with ISMACryp 1.0
\r
1584 outKeyIndicationLength: specifies length of key indicator - only valid with ISMACryp 1.0
\r
1586 outSelectiveEncryption, outIVLength and outKeyIndicationLength are usually not needed to decode an
\r
1587 ISMA sample when using gf_isom_get_ismacryp_sample fct above
\r
1589 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
1592 #ifndef GPAC_READ_ONLY
\r
1593 /*removes ISMACryp protection info (does not perform decryption :)*/
\r
1594 GF_Err gf_isom_remove_ismacryp_protection(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex);
\r
1596 /*creates ISMACryp protection info (does not perform encryption :)*/
\r
1597 GF_Err gf_isom_set_ismacryp_protection(GF_ISOFile *the_file, u32 trackNumber, u32 desc_index, u32 scheme_type,
\r
1598 u32 scheme_version, char *scheme_uri, char *kms_URI,
\r
1599 Bool selective_encryption, u32 KI_length, u32 IV_length);
\r
1601 /*change scheme URI and/or KMS URI for crypted files. Other params cannot be changed once the media is crypted
\r
1602 @scheme_uri: new scheme URI, or NULL to keep previous
\r
1603 @kms_uri: new KMS URI, or NULL to keep previous
\r
1605 GF_Err gf_isom_change_ismacryp_protection(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex, char *scheme_uri, char *kms_uri);
\r
1608 GF_Err gf_isom_set_oma_protection(GF_ISOFile *the_file, u32 trackNumber, u32 desc_index,
\r
1609 char *contentID, char *kms_URI, u32 encryption_type, u64 plainTextLength, char *textual_headers, u32 textual_headers_len,
\r
1610 Bool selective_encryption, u32 KI_length, u32 IV_length);
\r
1615 GF_Err gf_isom_dump_ismacryp_protection(GF_ISOFile *the_file, u32 trackNumber, FILE * trace);
\r
1616 GF_Err gf_isom_dump_ismacryp_sample(GF_ISOFile *the_file, u32 trackNumber, u32 SampleNum, FILE *trace);
\r
1619 /********************************************************************
\r
1620 GENERAL META API FUNCTIONS
\r
1622 Meta can be stored at several places in the file layout:
\r
1623 * root level (like moov, ftyp and co)
\r
1626 Meta API uses the following parameters for all functions:
\r
1628 gf_isom_*_meta_*(GF_ISOFile *file, Bool root_meta, u32 track_num, ....) with:
\r
1629 @root_meta: if set, accesses file root meta
\r
1630 @track_num: if root_meta not set, specifies whether the target meta is at the
\r
1631 moov level (track_num=0) or at the track level.
\r
1633 ********************************************************************/
\r
1635 /*gets meta type. Returned value: 0 if no meta found, or four char code of meta (eg, "mp21", "smil", ...)*/
\r
1636 u32 gf_isom_get_meta_type(GF_ISOFile *file, Bool root_meta, u32 track_num);
\r
1638 /*indicates if the meta has an XML container (note that XML data can also be included as items).
\r
1639 return value: 0 (no XML or error), 1 (XML text), 2 (BinaryXML, eg BiM) */
\r
1640 u32 gf_isom_has_meta_xml(GF_ISOFile *file, Bool root_meta, u32 track_num);
\r
1642 /*extracts XML (if any) from given meta
\r
1643 @outName: output file path and location for writing
\r
1644 @is_binary: indicates if XML is Bim or regular XML
\r
1646 GF_Err gf_isom_extract_meta_xml(GF_ISOFile *file, Bool root_meta, u32 track_num, char *outName, Bool *is_binary);
\r
1648 /*returns number of items described in this meta*/
\r
1649 u32 gf_isom_get_meta_item_count(GF_ISOFile *file, Bool root_meta, u32 track_num);
\r
1651 /*gets item info for the given item
\r
1652 @item_num: 1-based index of item to query
\r
1653 @itemID (optional): item ID in file
\r
1654 @is_self_reference: item is the file itself
\r
1655 @item_name (optional): item name
\r
1656 @item_mime_type (optional): item mime type
\r
1657 @item_encoding (optional): item content encoding type
\r
1658 @item_url, @item_urn (optional): url/urn of external resource containing this item data if any.
\r
1659 When item is fully contained in file, these are set to NULL
\r
1662 GF_Err gf_isom_get_meta_item_info(GF_ISOFile *file, Bool root_meta, u32 track_num, u32 item_num,
\r
1663 u32 *itemID, u32 *protection_idx, Bool *is_self_reference,
\r
1664 const char **item_name, const char **item_mime_type, const char **item_encoding,
\r
1665 const char **item_url, const char **item_urn);
\r
1668 /*gets item idx from item ID*/
\r
1669 u32 gf_isom_get_meta_item_by_id(GF_ISOFile *file, Bool root_meta, u32 track_num, u32 item_ID);
\r
1671 /*extracts item from given meta
\r
1672 @item_num: 1-based index of item to query
\r
1674 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
1676 /*retirves primary item ID, 0 if none found (primary can also be stored through meta XML)*/
\r
1677 u32 gf_isom_get_meta_primary_item_id(GF_ISOFile *file, Bool root_meta, u32 track_num);
\r
1679 #ifndef GPAC_READ_ONLY
\r
1681 /*sets meta type (four char int, eg "mp21", ...
\r
1682 Creates a meta box if none found
\r
1683 if metaType is 0, REMOVES META
\r
1685 GF_Err gf_isom_set_meta_type(GF_ISOFile *file, Bool root_meta, u32 track_num, u32 metaType);
\r
1687 /*removes meta XML info if any*/
\r
1688 GF_Err gf_isom_remove_meta_xml(GF_ISOFile *file, Bool root_meta, u32 track_num);
\r
1690 /*set meta XML data from file - erase any previously (Binary)XML info*/
\r
1691 GF_Err gf_isom_set_meta_xml(GF_ISOFile *file, Bool root_meta, u32 track_num, char *XMLFileName, Bool IsBinaryXML);
\r
1693 /*adds item to meta:
\r
1694 @self_reference: indicates this item is the file itself
\r
1695 @resource_path: file to add - can be NULL when URL/URN is used
\r
1696 @item_name: item name - if NULL, use file name. CANNOT BE NULL if resource_path is not set
\r
1697 @mime_type: item mime type - if NULL, use "application/octet-stream"
\r
1698 @content_encoding: content encoding type - if NULL, none specified
\r
1699 @URL, @URN: if set, resource will be remote (same as stream descriptions)
\r
1701 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
1703 /*removes item from meta*/
\r
1704 GF_Err gf_isom_remove_meta_item(GF_ISOFile *file, Bool root_meta, u32 track_num, u32 item_num);
\r
1706 /*sets the given item as the primary one. You SHALL NOT use this if the meta has a valid XML data*/
\r
1707 GF_Err gf_isom_set_meta_primary_item(GF_ISOFile *file, Bool root_meta, u32 track_num, u32 item_num);
\r
1712 /********************************************************************
\r
1713 Timed Meta-Data extensions
\r
1714 ********************************************************************/
\r
1716 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
1718 #ifndef GPAC_READ_ONLY
\r
1719 /*create a new timed metat data sample description for this track*/
\r
1720 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
1724 /********************************************************************
\r
1726 ********************************************************************/
\r
1729 /*probe is only used ti check if iTunes info are present*/
\r
1730 GF_ISOM_ITUNE_PROBE = 0,
\r
1731 GF_ISOM_ITUNE_ALBUM = GF_4CC( 0xA9, 'a', 'l', 'b' ),
\r
1732 GF_ISOM_ITUNE_ARTIST = GF_4CC( 0xA9, 'A', 'R', 'T' ),
\r
1733 GF_ISOM_ITUNE_COMMENT = GF_4CC( 0xA9, 'c', 'm', 't' ),
\r
1734 GF_ISOM_ITUNE_COMPILATION = GF_4CC( 'c', 'p', 'i', 'l' ),
\r
1735 GF_ISOM_ITUNE_COMPOSER = GF_4CC( 0xA9, 'c', 'o', 'm' ),
\r
1736 GF_ISOM_ITUNE_COVER_ART = GF_4CC( 'c', 'o', 'v', 'r' ),
\r
1737 GF_ISOM_ITUNE_CREATED = GF_4CC( 0xA9, 'd', 'a', 'y' ),
\r
1738 GF_ISOM_ITUNE_DISK = GF_4CC( 'd', 'i', 's', 'k' ),
\r
1739 GF_ISOM_ITUNE_TOOL = GF_4CC( 0xA9, 't', 'o', 'o' ),
\r
1740 GF_ISOM_ITUNE_GENRE = GF_4CC( 'g', 'n', 'r', 'e' ),
\r
1741 GF_ISOM_ITUNE_GROUP = GF_4CC( 0xA9, 'g', 'r', 'p' ),
\r
1742 GF_ISOM_ITUNE_ITUNES_DATA = GF_4CC( '-', '-', '-', '-' ),
\r
1743 GF_ISOM_ITUNE_NAME = GF_4CC( 0xA9, 'n', 'a', 'm' ),
\r
1744 GF_ISOM_ITUNE_TEMPO = GF_4CC( 't', 'm', 'p', 'o' ),
\r
1745 GF_ISOM_ITUNE_TRACK = GF_4CC( 0xA9, 't', 'r', 'k' ),
\r
1746 GF_ISOM_ITUNE_TRACKNUMBER = GF_4CC( 't', 'r', 'k', 'n' ),
\r
1747 GF_ISOM_ITUNE_WRITER = GF_4CC( 0xA9, 'w', 'r', 't' ),
\r
1748 GF_ISOM_ITUNE_ENCODER = GF_4CC( 0xA9, 'e', 'n', 'c' ),
\r
1749 GF_ISOM_ITUNE_ALBUM_ARTIST = GF_4CC( 'a', 'A', 'R', 'T' ),
\r
1750 GF_ISOM_ITUNE_GAPELESS = GF_4CC( 'p', 'g', 'a', 'p' ),
\r
1752 /*get the given tag info.
\r
1753 !! '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
1754 and the data_len to the genre ID
\r
1755 returns GF_URL_ERROR if no tag is present in the file
\r
1757 GF_Err gf_isom_apple_get_tag(GF_ISOFile *mov, u32 tag, const char **data, u32 *data_len);
\r
1758 #ifndef GPAC_READ_ONLY
\r
1759 /*set the given tag info. If data and data_len are 0, removes the given tag
\r
1760 For 'genre', data may be NULL in which case the genre ID taken from the data_len parameter
\r
1762 GF_Err gf_isom_apple_set_tag(GF_ISOFile *mov, u32 tag, const char *data, u32 data_len);
\r
1764 /*sets compatibility tag on AVC tracks (needed by iPod to play files... hurray for standards)*/
\r
1765 GF_Err gf_isom_set_ipod_compatible(GF_ISOFile *the_file, u32 trackNumber);
\r
1769 /*3GPP Alternate Group API - (c) 2007 ENST & ResonateMP4*/
\r
1771 /*gets the number of switching groups declared in this track if any:
\r
1772 trackNumber: track number
\r
1773 alternateGroupID: alternate group id of track if speciifed, 0 otherwise
\r
1774 nb_groups: number of switching groups defined for this track
\r
1776 GF_Err gf_isom_get_track_switch_group_count(GF_ISOFile *movie, u32 trackNumber, u32 *alternateGroupID, u32 *nb_groups);
\r
1778 /*returns the list of criteria (expressed as 4CC IDs, cf 3GPP TS 26.244)
\r
1779 trackNumber: track number
\r
1780 group_index: 1-based index of the group to inspect
\r
1781 switchGroupID: ID of the switch group if any, 0 otherwise (alternate-only group)
\r
1782 criteriaListSize: number of criteria items in returned list
\r
1784 const u32 *gf_isom_get_track_switch_parameter(GF_ISOFile *movie, u32 trackNumber, u32 group_index, u32 *switchGroupID, u32 *criteriaListSize);
\r
1786 #ifndef GPAC_READ_ONLY
\r
1787 /*sets a new (switch) group for this track
\r
1788 trackNumber: track
\r
1789 trackRefGroup: number of a track belonging to the same alternate group. If 0, a new alternate group will be created for this track
\r
1790 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
1791 switchGroupID: SHALL NOT BE NULL
\r
1792 input: specifies the desired switchGroupID to use. If value is 0, next available switchGroupID in file is used.
\r
1793 output: indicates the switchGroupID used.
\r
1794 criteriaList, criteriaListCount: criteria list and size. Criterias are expressed as 4CC IDs, cf 3GPP TS 26.244
\r
1796 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
1798 /*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
1799 GF_Err gf_isom_reset_track_switch_parameter(GF_ISOFile *movie, u32 trackNumber, Bool reset_all_group);
\r
1801 /*resets ALL track switch group information in the entire movie*/
\r
1802 GF_Err gf_isom_reset_switch_parameters(GF_ISOFile *movie);
\r
1811 u8 pathComponents;
\r
1812 Bool fullRequestHost;
\r
1814 u8 containsRedundant;
\r
1815 const char *textEncoding;
\r
1816 const char *contentEncoding;
\r
1817 const char *content_script_types;
\r
1818 } GF_DIMSDescription;
\r
1820 GF_Err gf_isom_get_dims_description(GF_ISOFile *movie, u32 trackNumber, u32 descriptionIndex, GF_DIMSDescription *desc);
\r
1821 #ifndef GPAC_READ_ONLY
\r
1822 GF_Err gf_isom_new_dims_description(GF_ISOFile *movie, u32 trackNumber, GF_DIMSDescription *desc, char *URLname, char *URNname, u32 *outDescriptionIndex);
\r
1823 GF_Err gf_isom_update_dims_description(GF_ISOFile *movie, u32 trackNumber, GF_DIMSDescription *desc, char *URLname, char *URNname, u32 DescriptionIndex);
\r
1829 /*AC3 config record*/
\r
1840 #ifndef GPAC_READ_ONLY
\r
1841 GF_Err gf_isom_ac3_config_new(GF_ISOFile *the_file, u32 trackNumber, GF_AC3Config *cfg, char *URLname, char *URNname, u32 *outDescriptionIndex);
\r
1845 #ifdef __cplusplus
\r
1850 #endif /*_GF_ISOMEDIA_H_*/
\r