libgpac
Documentation of the core library of GPAC
|
import"core.idl";
Public Member Functions | |
File (DOMString reference_url, function open, function close, function write, function read, function seek, function tell, function eof, function exists) | |
void | protect () |
void | destroy () |
Data Fields | |
attribute readonly DOMString | url |
attribute readonly DOMString | resource_url |
attribute readonly FileIO | parent |
FileIO object
A FileIO object wraps calls to file IO, allowing the script to feed GPAC files not present on disk, or have GPAC create files in JS memory.
Whenever a file is opened, a new JS object of type FileIO is created and passed as "this" in the specified open, close, read, write, seek, tell, eof callbacks.
Any URL relative to the reference URL provided will be solved against the parent FileIO, resulting in additionnals open() calls.
Warning: this is work in progress
FileIO::File | ( | DOMString | reference_url, |
function | open, | ||
function | close, | ||
function | write, | ||
function | read, | ||
function | seek, | ||
function | tell, | ||
function | eof, | ||
function | exists | ||
) |
constructor for a FileIO
reference_url | the base URL this FileIO wraps |
open | the open function callback, shall not be NULL. The callback is "boolean open(DOMString url, DOMString mode); ", with mode a fopen mode and the return value true indicates success |
close | the close function callback, shall not be NULL. The callback is "close();" |
write | the write function callback, shall not be NULL if read is NULL. The callback is "unsigned long write(ArrayBuffer ab);", where ab is the buffer to write and the return value the number of bytes written |
read | the read function callback, shall not be NULL if write is NULL. The callback is "unsigned long read(ArrayBuffer ab);", where ab is the buffer to fill and the return value the number of bytes read |
seek | the seek function callback, shall not be NULL. The callback is "unsigned long seek(unsigned long long pos, unsigned long whence);", as in gf_fseek |
tell | the seek function callback, shall not be NULL. The callback is "unsigned long long tell();", as in gf_ftell |
eof | the end of file function callback, shall not be NULL. The callback is "boolean eof();", as in gf_feof |
exists | the file existence probing function callback, shall not be NULL. The callback is "boolean exists(DOMString URL);", returns true if file exists (for read access). The "this" object is the constructed FileIO on this callback. |
void FileIO::protect | ( | ) |
void FileIO::destroy | ( | ) |
attribute readonly DOMString FileIO::url |
get the gfio:// URL associated with the fileIO object
attribute readonly DOMString FileIO::resource_url |
get the underlying resource URL associated with the fileIO object