Vips.SourceCustom
Description: Reference for Vips.SourceCustom

### Class

# VipsSourceCustom

#### Description [src]

    class Vips.SourceCustom : Vips.Source
    {
      /* No available fields */
    }

Subclass of `VipsSource` with action signals for handlers.

This is supposed to be useful for language bindings.

#### Ancestors

- VipsSource
- VipsConnection
- VipsObject
- GObject

#### Constructors

###### vips_source_custom_new

Create a `VipsSourceCustom`. Attach signals to implement read and seek.

#### Instance methods

##### Methods inherited from VipsSource (13)

###### vips_source_decode

Signal the end of header read and the start of the pixel decode phase. After this, you can no longer seek on this source.

###### vips_source_is_file

Test if this source is a simple file with support for seek. Named pipes, for example, will fail this test. If `TRUE`, you can use `vips_connection_filename()` to find the filename.

###### vips_source_is_mappable

Some sources can be efficiently mapped into memory. You can still use `vips_source_map()` if this function returns `FALSE`, but it will be slow.

###### vips_source_length

Return the length in bytes of the source. Unseekable sources, for example pipes, will have to be read entirely into memory before the length can be found, so this operation can take a long time.

###### vips_source_map

Map the source entirely into memory and return a pointer to the start. If `length` is non-NULL, the source size is written to it.

###### vips_source_map_blob

Just like `vips_source_map()`, but return a `VipsBlob` containing the pointer. `source` will stay alive as long as the result is alive.

###### vips_source_minimise

Minimise the source. As many resources as can be safely removed are removed. Use `vips_source_unminimise()` to restore the source if you wish to use it again.

###### vips_source_read

Read up to `length` bytes from `source` and store the bytes in `buffer`. Return the number of bytes actually read. If all bytes have been read from the file, return 0.

###### vips_source_rewind

Rewind the source to the start.

###### vips_source_seek

Move the file read position. You can’t call this after pixel decode starts. The arguments are exactly as `lseek()`.

###### vips_source_sniff

Return a pointer to the first few bytes of the file. If the file is too short, return `NULL`.

###### vips_source_sniff_at_most

Attempt to sniff at most `length` bytes from the start of the source. A pointer to the bytes is returned in `data`. The number of bytes actually read is returned — it may be less than `length` if the file is shorter than `length`. A negative number indicates a read error.

###### vips_source_unminimise

Restore the source after minimisation. This is called at the start of every source method, so loaders should not usually need this.

##### Methods inherited from VipsConnection (2)

###### vips_connection_filename

No description available.

###### vips_connection_nick

No description available.

##### Methods inherited from VipsObject (27)

Please see VipsObject for a full list of methods.

##### Methods inherited from GObject (43)

Please see GObject for a full list of methods.

#### Properties

##### Properties inherited from VipsSource (1)

###### Vips.Source:blob

No description available.

##### Properties inherited from VipsConnection (2)

###### Vips.Connection:descriptor

No description available.

###### Vips.Connection:filename

No description available.

##### Properties inherited from VipsObject (2)

###### Vips.Object:description

No description available.

###### Vips.Object:nickname

No description available.

#### Signals

###### Vips.SourceCustom::read

This signal is emitted to read bytes from the source into `buffer`.

###### Vips.SourceCustom::seek

This signal is emitted to seek the source. The handler should change the source position appropriately.

##### Signals inherited from VipsObject (4)

###### VipsObject::close

The ::close signal is emitted once during object close. The object is dying and may not work.

###### VipsObject::postbuild

The ::postbuild signal is emitted once just after successful object construction. Return non-zero to cause object construction to fail.

###### VipsObject::postclose

The ::postclose signal is emitted once after object close. The object pointer is still valid, but nothing else.

###### VipsObject::preclose

The ::preclose signal is emitted once just before object close starts. The object is still alive.

##### Signals inherited from GObject (1)

###### GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

#### Class structure

    struct VipsSourceCustomClass {
      VipsSourceClass parent_class;
      gint64 (* read) (
        VipsSourceCustom* source,
        void* buffer,
        gint64 length
      );
      gint64 (* seek) (
        VipsSourceCustom* source,
        gint64 offset,
        int whence
      );

    }

No description available.

###### Class members

`parent_class: VipsSourceClass`

  No description available.

`read: gint64 (* read) ( VipsSourceCustom* source, void* buffer, gint64 length )`

  No description available.

`seek: gint64 (* seek) ( VipsSourceCustom* source, gint64 offset, int whence )`

  No description available.

#### Virtual methods

###### Vips.SourceCustomClass.read

No description available.

###### Vips.SourceCustomClass.seek

No description available.