class Vips.Source : Vips.Connection{ gboolean decode, gboolean have_tested_seek, gboolean is_pipe, gint64 read_position, gint64 length}
AVipsSource
provides a unified interface for reading, seeking, andmapping data, regardless of the underlying source type.
This source can originate from something like a socket, file or memory area.
During the header phase, we save data from unseekable sources in a bufferso readers can rewind and read again. We don’t buffer data during thedecode stage.
Create an source attached to a file descriptor.descriptor
isclosed withclose()
when source is finalized.
Signal the end of header read and the start of the pixel decode phase.After this, you can no longer seek on this source.
Test if this source is a simple file with support for seek. Named pipes,for example, will fail this test. IfTRUE
, you can usevips_connection_filename()
to find the filename.
Some sources can be efficiently mapped into memory.You can still usevips_source_map()
if this function returnsFALSE
,but it will be slow.
Return the length in bytes of the source. Unseekable sources, forexample pipes, will have to be read entirely into memory before the lengthcan be found, so this operation can take a long time.
Map the source entirely into memory and return a pointer to thestart. Iflength
is non-NULL, the source size is written to it.
Just likevips_source_map()
, but return aVipsBlob
containing thepointer.source
will stay alive as long as the result is alive.
Minimise the source. As many resources as can be safely removed areremoved. Usevips_source_unminimise()
to restore the source if you wish touse it again.
Read up tolength
bytes fromsource
and store the bytes inbuffer
.Return the number of bytes actually read. If all bytes have been read fromthe file, return 0.
Move the file read position. You can’t call this after pixel decode starts.The arguments are exactly aslseek()
.
Return a pointer to the first few bytes of the file. If the file is tooshort, returnNULL
.
Attempt to sniff at mostlength
bytes from the start of the source. Apointer to the bytes is returned indata
. The number of bytes actuallyread is returned — it may be less thanlength
if the file is shorter thanlength
. A negative number indicates a read error.
Restore the source after minimisation. This is called at the startof every source method, so loaders should not usually need this.
Please see VipsObject for a full list of methods.
The ::close signal is emitted once during object close. The objectis dying and may not work.
The ::postbuild signal is emitted once just after successful objectconstruction. Return non-zero to cause object construction to fail.
The ::postclose signal is emitted once after object close. Theobject pointer is still valid, but nothing else.
The ::preclose signal is emitted once just before object closestarts. The object is still alive.
The notify signal is emitted on an object when one of its properties hasits value set through g_object_set_property(), g_object_set(), et al.
struct VipsSourceClass { VipsConnectionClass parent_class; gint64 (* read) ( VipsSource* source, void* buffer, size_t length ); gint64 (* seek) ( VipsSource* source, gint64 offset, int whence ); }
No description available.
parent_class: VipsConnectionClass
No description available.
read: gint64 (* read) ( VipsSource* source, void* buffer, size_t length )
No description available.
seek: gint64 (* seek) ( VipsSource* source, gint64 offset, int whence )
No description available.
Read up tolength
bytes fromsource
and store the bytes inbuffer
.Return the number of bytes actually read. If all bytes have been read fromthe file, return 0.
Move the file read position. You can’t call this after pixel decode starts.The arguments are exactly aslseek()
.