libgpac
Documentation of the core library of GPAC
+ Collaboration diagram for Generic API:

Enumerations

enum  GF_ISOOpenMode {
  GF_ISOM_OPEN_READ_DUMP = 0 , GF_ISOM_OPEN_READ , GF_ISOM_OPEN_WRITE , GF_ISOM_OPEN_EDIT ,
  GF_ISOM_WRITE_EDIT , GF_ISOM_OPEN_KEEP_FRAGMENTS , GF_ISOM_OPEN_READ_EDIT
}
 

Functions

u32 gf_isom_probe_file (const char *fileName)
 
u32 gf_isom_probe_file_range (const char *fileName, u64 start_range, u64 end_range)
 
u32 gf_isom_probe_data (const u8 *inBuf, u32 inSize)
 
GF_ISOFilegf_isom_open (const char *fileName, GF_ISOOpenMode OpenMode, const char *tmp_dir)
 
GF_Err gf_isom_close (GF_ISOFile *isom_file)
 
void gf_isom_delete (GF_ISOFile *isom_file)
 
GF_Err gf_isom_last_error (GF_ISOFile *isom_file)
 
u8 gf_isom_get_mode (GF_ISOFile *isom_file)
 
Bool gf_isom_is_JPEG2000 (GF_ISOFile *isom_file)
 
Bool gf_isom_is_video_handler_type (u32 mtype)
 
u32 gf_isom_get_num_supported_boxes ()
 
u32 gf_isom_get_supported_box_type (u32 idx)
 
GF_Err gf_isom_dump_supported_box (u32 idx, FILE *trace)
 

Detailed Description

Generic API functions

Enumeration Type Documentation

◆ GF_ISOOpenMode

Movie file opening modes

Enumerator
GF_ISOM_OPEN_READ_DUMP 

Opens file for dumping: same as read-only but keeps all movie fragments info untouched

GF_ISOM_OPEN_READ 

Opens a file in READ ONLY mode

GF_ISOM_OPEN_WRITE 

Opens a file in WRITE ONLY mode. Media Data is captured on the fly and storage mode is always flat (moov at end). In this mode, the editing functions are disabled.

GF_ISOM_OPEN_EDIT 

Opens an existing file in EDIT mode

GF_ISOM_WRITE_EDIT 

Creates a new file in EDIT mode

GF_ISOM_OPEN_KEEP_FRAGMENTS 

Opens an existing file and keep fragment information

GF_ISOM_OPEN_READ_EDIT 

Opens an existing file in READ ONLY mode but enables most of the file edit functions except fragmentation Samples may be added to the file in this mode, they will be stored in memory

Function Documentation

◆ gf_isom_probe_file()

u32 gf_isom_probe_file ( const char *  fileName)

indicates if target file is an IsoMedia file

Parameters
fileNamethe target local file name or path to probe, gmem:// or gfio:// resource
Returns
1 if it is a non-special file, 2 if an init segment, 3 if a media segment, 0 otherwise

◆ gf_isom_probe_file_range()

u32 gf_isom_probe_file_range ( const char *  fileName,
u64  start_range,
u64  end_range 
)

indicates if target file is an IsoMedia file

Parameters
fileNamethe target local file name or path to probe, gmem:// or gfio:// resource
start_rangethe offset in the file to start probing from
end_rangethe offset in the file at which probing shall stop
Returns
1 if it is a non-special file, 2 if an init segment, 3 if a media segment, 4 if empty or no file, 0 otherwise

◆ gf_isom_probe_data()

u32 gf_isom_probe_data ( const u8 inBuf,
u32  inSize 
)

indicates if target file is an IsoMedia file

Parameters
inBufthe buffer to probe
inSizethe sizeo of the buffer to probe
Returns
1 if it is a non-special file, 2 if an init segment, 3 if a media segment, 0 otherwise (non recognized or too short)

◆ gf_isom_open()

GF_ISOFile* gf_isom_open ( const char *  fileName,
GF_ISOOpenMode  OpenMode,
const char *  tmp_dir 
)

opens an isoMedia File.

Parameters
fileNamename of the file to open, , gmem:// or gfio:// resource. The special name "_gpac_isobmff_redirect" is used to indicate that segment shall be written to a memory buffer passed to callback function set through gf_isom_set_write_callback. SHALL not be NULL.
OpenModefile opening mode
tmp_dirfor the 2 edit modes only, specifies a location for temp file. If NULL, the library will use the default libgpac temporary file management schemes.
Returns
the created ISO file if no error

◆ gf_isom_close()

GF_Err gf_isom_close ( GF_ISOFile isom_file)

closes the file, write it if new/edited or if pending fragment

Parameters
isom_filethe target ISO file
Returns
error if any

◆ gf_isom_delete()

void gf_isom_delete ( GF_ISOFile isom_file)

deletes the movie without saving it

Parameters
isom_filethe target ISO file

◆ gf_isom_last_error()

GF_Err gf_isom_last_error ( GF_ISOFile isom_file)

gets the last fatal error that occured in the file ANY FUNCTION OF THIS API WON'T BE PROCESSED IF THE FILE HAS AN ERROR

Note
Some function may return an error while the movie has no error the last error is a FatalError, and is not always set if a bad param is specified...
Parameters
isom_filethe target ISO file
Returns
error if any

◆ gf_isom_get_mode()

u8 gf_isom_get_mode ( GF_ISOFile isom_file)

gets the mode of an open file

Parameters
isom_filethe target ISO file
Returns
open mode of the file

◆ gf_isom_is_JPEG2000()

Bool gf_isom_is_JPEG2000 ( GF_ISOFile isom_file)

checks if file is J2K image

Parameters
isom_filethe target ISO file
Returns
GF_TRUE if file is a j2k image, GF_FALSE otherwise

◆ gf_isom_is_video_handler_type()

Bool gf_isom_is_video_handler_type ( u32  mtype)

checks if a given four character code matches a known video handler type (vide, auxv, pict, ...)

Parameters
mtypethe four character code to check
Returns
GF_TRUE if the type is a video media type

◆ gf_isom_get_num_supported_boxes()

u32 gf_isom_get_num_supported_boxes ( )

gets number of implemented boxes in (including the internal unknown box wrapper).

Note
There can be several times the same type returned due to variation of the box (versions or flags)
Returns
number of implemented boxes

◆ gf_isom_get_supported_box_type()

u32 gf_isom_get_supported_box_type ( u32  idx)

gets four character code of box given its index. Index 0 is GPAC internal unknown box handler

Parameters
idx0-based index of the box
Returns
four character code of the box

◆ gf_isom_dump_supported_box()

GF_Err gf_isom_dump_supported_box ( u32  idx,
FILE *  trace 
)

prints default box syntax of box given its index. Index 0 is GPAC internal unknown box handler

Parameters
idx0-based index of the box
tracethe file object to dump to
Returns
error if any