libgpac
Documentation of the core library of GPAC
FileIO interface

File IO wrapper. More...

+ Collaboration diagram for FileIO interface:

Data Structures

interface  _FileIO
 
interface  _FileIOFactory
 

Detailed Description

FileIO allows redirecting calls to file access (open, close, read, write) to NodeJS rather than using system calls.

This allows generating content in NodeJS without any disk IO, or passing NodeJS data as input to GPAC without intermediate file.

See GF_FileIO for more details

A FileIO object is constructed from the URL to wrap and a factory object with callbacks used to access the file. For example, to wrap a file for input:

//create the FileIO factory
let factory = {
open: function(url, mode) { ... },
close: function() { ... },
read: function(buffer) { ... },
seek: function(position, whence) { ... },
tell: function() { ... },
eof: function() { ... }
};
//create the FileIO
let fio = new FileIO("somefile.mp4", factory_obj);
//load a source filter using this FileIO
let src = filter_sess.load_src(fio.url);
attribute _FileIO FileIO
Definition: nodejs.idl:125
def close()
close libgpac - see gf_sys_close
Definition: libgpac.py:359
Warning
All callbacks of the factory object MUST perform synchronously

The URL passed to the constructor indentifies the file name wrapped.

Some file types, such as HLS or DASH manifest, may imply reading or writing several files. To handle these cases, a new JS object is created for each call to open().

Warning
This object is an empty JS object, not a clone of the factory object (difference with Python bindings).

All FileIO callbacks will be done in the main thread.