Main API header for accessing Audacious VFS functionality. More...
#include <stdint.h>
#include <libaudcore/core.h>
Go to the source code of this file.
Classes | |
struct | VFSConstructor |
VFSConstructor objects contain the base vtables used for extrapolating a VFS stream. More... | |
Defines | |
#define | WARN_RETURN |
Functions | |
VFSFile * | vfs_new (const char *path, VFSConstructor *vtable, void *handle) WARN_RETURN |
const char * | vfs_get_filename (VFSFile *file) WARN_RETURN |
void * | vfs_get_handle (VFSFile *file) WARN_RETURN |
VFSFile * | vfs_fopen (const char *path, const char *mode) WARN_RETURN |
Opens a stream from a VFS transport using one of the registered VFSConstructor handlers. | |
int | vfs_fclose (VFSFile *file) |
Closes a VFS stream and destroys a VFSFile object. | |
int64_t | vfs_fread (void *ptr, int64_t size, int64_t nmemb, VFSFile *file) WARN_RETURN |
Reads from a VFS stream. | |
int64_t | vfs_fwrite (const void *ptr, int64_t size, int64_t nmemb, VFSFile *file) WARN_RETURN |
Writes to a VFS stream. | |
int | vfs_getc (VFSFile *stream) WARN_RETURN |
Reads a character from a VFS stream. | |
int | vfs_ungetc (int c, VFSFile *stream) WARN_RETURN |
Pushes a character back to the VFS stream. | |
char * | vfs_fgets (char *s, int n, VFSFile *stream) WARN_RETURN |
Reads a string of characters from a stream, ending in newline or EOF. | |
bool_t | vfs_feof (VFSFile *file) WARN_RETURN |
Returns whether or not the VFS stream has reached EOF. | |
int | vfs_fprintf (VFSFile *stream, char const *format,...) __attribute__((__format__(__printf__ |
int int | vfs_fseek (VFSFile *file, int64_t offset, int whence) WARN_RETURN |
Performs a seek in given VFS stream. | |
void | vfs_rewind (VFSFile *file) |
Rewinds a VFS stream. | |
int64_t | vfs_ftell (VFSFile *file) WARN_RETURN |
Returns the current position in the VFS stream's buffer. | |
int64_t | vfs_fsize (VFSFile *file) WARN_RETURN |
Returns size of the file. | |
int | vfs_ftruncate (VFSFile *file, int64_t length) WARN_RETURN |
Truncates a VFS stream to a certain size. | |
bool_t | vfs_fget_le16 (uint16_t *value, VFSFile *stream) WARN_RETURN |
Reads an unsigned 16-bit Little Endian value from the stream into native endian format. | |
bool_t | vfs_fget_le32 (uint32_t *value, VFSFile *stream) WARN_RETURN |
Reads an unsigned 32-bit Little Endian value from the stream into native endian format. | |
bool_t | vfs_fget_le64 (uint64_t *value, VFSFile *stream) WARN_RETURN |
Reads an unsigned 64-bit Little Endian value from the stream into native endian format. | |
bool_t | vfs_fget_be16 (uint16_t *value, VFSFile *stream) WARN_RETURN |
Reads an unsigned 16-bit Big Endian value from the stream into native endian format. | |
bool_t | vfs_fget_be32 (uint32_t *value, VFSFile *stream) WARN_RETURN |
Reads an unsigned 32-bit Big Endian value from the stream into native endian format. | |
bool_t | vfs_fget_be64 (uint64_t *value, VFSFile *stream) WARN_RETURN |
Reads an unsigned 64-bit Big Endian value from the stream into native endian format. | |
bool_t | vfs_fput_le16 (uint16_t value, VFSFile *stream) WARN_RETURN |
Writes an unsigned 16-bit native endian value into the stream as a Little Endian value. | |
bool_t | vfs_fput_le32 (uint32_t value, VFSFile *stream) WARN_RETURN |
Writes an unsigned 32-bit native endian value into the stream as a Big Endian value. | |
bool_t | vfs_fput_le64 (uint64_t value, VFSFile *stream) WARN_RETURN |
Writes an unsigned 64-bit native endian value into the stream as a Big Endian value. | |
bool_t | vfs_fput_be16 (uint16_t value, VFSFile *stream) WARN_RETURN |
Writes an unsigned 16-bit native endian value into the stream as a Big Endian value. | |
bool_t | vfs_fput_be32 (uint32_t value, VFSFile *stream) WARN_RETURN |
Writes an unsigned 32-bit native endian value into the stream as a Big Endian value. | |
bool_t | vfs_fput_be64 (uint64_t value, VFSFile *stream) WARN_RETURN |
Writes an unsigned 64-bit native endian value into the stream as a Big Endian value. | |
bool_t | vfs_is_streaming (VFSFile *file) WARN_RETURN |
Tests if a file is associated to streaming. | |
char * | vfs_get_metadata (VFSFile *file, const char *field) WARN_RETURN |
Returns metadata about the stream. | |
bool_t | vfs_file_test (const char *path, int test) WARN_RETURN |
Wrapper for g_file_test(). | |
bool_t | vfs_is_writeable (const char *path) WARN_RETURN |
Tests if a file is writeable. | |
bool_t | vfs_is_remote (const char *path) WARN_RETURN |
Tests if a path is remote uri. | |
void | vfs_file_get_contents (const char *filename, void **buf, int64_t *size) |
Gets contents of the file into a buffer. | |
void | vfs_set_lookup_func (VFSConstructor *(*func)(const char *scheme)) |
void | vfs_set_verbose (bool_t verbose) |
Main API header for accessing Audacious VFS functionality.
Provides functions for VFS transport registration and file access.
Definition in file vfs.h.
Closes a VFS stream and destroys a VFSFile object.
file | A VFSFile object to destroy. |
Definition at line 165 of file vfs.c.
Referenced by file_find_decoder(), file_read_image(), file_read_tuple(), file_write_tuple(), playback_thread(), playlist_load(), playlist_save(), probe_buffer_fclose(), save_preset_file(), and vfs_file_get_contents().
Returns whether or not the VFS stream has reached EOF.
file | VFSFile object that represents the VFS stream. |
Definition at line 334 of file vfs.c.
Referenced by probe_buffer_feof().
Reads an unsigned 16-bit Big Endian value from the stream into native endian format.
value | Pointer to the variable to read the value into. | |
stream | A VFSFile object representing the stream. |
Definition at line 256 of file vfs_common.c.
Reads an unsigned 32-bit Big Endian value from the stream into native endian format.
value | Pointer to the variable to read the value into. | |
stream | A VFSFile object representing the stream. |
Definition at line 272 of file vfs_common.c.
Reads an unsigned 64-bit Big Endian value from the stream into native endian format.
value | Pointer to the variable to read the value into. | |
stream | A VFSFile object representing the stream. |
Definition at line 288 of file vfs_common.c.
Reads an unsigned 16-bit Little Endian value from the stream into native endian format.
value | Pointer to the variable to read the value into. | |
stream | A VFSFile object representing the stream. |
Definition at line 207 of file vfs_common.c.
Reads an unsigned 32-bit Little Endian value from the stream into native endian format.
value | Pointer to the variable to read the value into. | |
stream | A VFSFile object representing the stream. |
Definition at line 223 of file vfs_common.c.
Reads an unsigned 64-bit Little Endian value from the stream into native endian format.
value | Pointer to the variable to read the value into. | |
stream | A VFSFile object representing the stream. |
Definition at line 239 of file vfs_common.c.
Reads a string of characters from a stream, ending in newline or EOF.
s | A buffer to put the string in. | |
n | The amount of characters to read. | |
stream | A VFSFile object representing the stream. |
Definition at line 64 of file vfs_common.c.
void vfs_file_get_contents | ( | const char * | filename, | |
void ** | buf, | |||
int64_t * | size | |||
) |
Gets contents of the file into a buffer.
Buffer of filesize bytes is allocated by this function as necessary.
filename | URI of the file to read in. | |
buf | Pointer to a pointer variable of buffer. | |
size | Pointer to gsize variable that will hold the amount of read data e.g. filesize. |
Definition at line 150 of file vfs_common.c.
Referenced by art_get_data(), and vfs_async_file_get_contents_worker().
Wrapper for g_file_test().
path | A path to test. | |
test | A GFileTest to run. |
Definition at line 407 of file vfs.c.
Referenced by add_generic(), and playlist_remove_failed().
VFSFile* vfs_fopen | ( | const char * | path, | |
const char * | mode | |||
) |
Opens a stream from a VFS transport using one of the registered VFSConstructor handlers.
path | The path or URI to open. | |
mode | The preferred access privileges (not guaranteed). |
Definition at line 123 of file vfs.c.
Referenced by check_opened(), file_read_image(), file_read_tuple(), file_write_tuple(), playback_thread(), playlist_load(), playlist_save(), probe_buffer_new(), save_preset_file(), and vfs_file_get_contents().
Writes an unsigned 16-bit native endian value into the stream as a Big Endian value.
value | Value to write into the stream. | |
stream | A VFSFile object representing the stream. |
Definition at line 347 of file vfs_common.c.
Writes an unsigned 32-bit native endian value into the stream as a Big Endian value.
value | Value to write into the stream. | |
stream | A VFSFile object representing the stream. |
Definition at line 361 of file vfs_common.c.
Writes an unsigned 64-bit native endian value into the stream as a Big Endian value.
value | Value to write into the stream. | |
stream | A VFSFile object representing the stream. |
Definition at line 375 of file vfs_common.c.
Writes an unsigned 16-bit native endian value into the stream as a Little Endian value.
value | Value to write into the stream. | |
stream | A VFSFile object representing the stream. |
Definition at line 305 of file vfs_common.c.
Writes an unsigned 32-bit native endian value into the stream as a Big Endian value.
value | Value to write into the stream. | |
stream | A VFSFile object representing the stream. |
Definition at line 319 of file vfs_common.c.
Writes an unsigned 64-bit native endian value into the stream as a Big Endian value.
value | Value to write into the stream. | |
stream | A VFSFile object representing the stream. |
Definition at line 333 of file vfs_common.c.
int64_t vfs_fread | ( | void * | ptr, | |
int64_t | size, | |||
int64_t | nmemb, | |||
VFSFile * | file | |||
) |
Reads from a VFS stream.
ptr | A pointer to the destination buffer. | |
size | The size of each element to read. | |
nmemb | The number of elements to read. | |
file | VFSFile object that represents the VFS stream. |
Definition at line 194 of file vfs.c.
Referenced by import_winamp_eqf(), increase_buffer(), vfs_fget_be16(), vfs_fget_be32(), vfs_fget_be64(), vfs_fget_le16(), vfs_fget_le32(), vfs_fget_le64(), and vfs_file_get_contents().
Performs a seek in given VFS stream.
Standard C-style values of whence can be used to indicate desired action.
file | VFSFile object that represents the VFS stream. | |
offset | The offset to seek to. | |
whence | Type of the seek: SEEK_CUR, SEEK_SET or SEEK_END. |
Definition at line 278 of file vfs.c.
Referenced by import_winamp_eqf(), and probe_func().
int64_t vfs_fsize | ( | VFSFile * | file | ) |
Returns size of the file.
file | VFSFile object that represents the VFS stream. |
Definition at line 369 of file vfs.c.
Referenced by probe_buffer_fsize(), vfs_file_get_contents(), and vfs_is_streaming().
int64_t vfs_ftell | ( | VFSFile * | file | ) |
int64_t vfs_fwrite | ( | const void * | ptr, | |
int64_t | size, | |||
int64_t | nmemb, | |||
VFSFile * | file | |||
) |
Writes to a VFS stream.
ptr | A const pointer to the source buffer. | |
size | The size of each element to write. | |
nmemb | The number of elements to write. | |
file | VFSFile object that represents the VFS stream. |
Definition at line 216 of file vfs.c.
Referenced by save_preset_file(), vfs_fput_be16(), vfs_fput_be32(), vfs_fput_be64(), vfs_fput_le16(), vfs_fput_le32(), vfs_fput_le64(), vfs_fputc(), and vfs_fputs().
const char* vfs_get_filename | ( | VFSFile * | file | ) |
Definition at line 104 of file vfs.c.
Referenced by import_winamp_eqf().
void* vfs_get_handle | ( | VFSFile * | file | ) |
Definition at line 109 of file vfs.c.
Referenced by probe_buffer_fclose(), probe_buffer_feof(), probe_buffer_fread(), probe_buffer_fseek(), probe_buffer_fsize(), probe_buffer_ftell(), and probe_buffer_get_metadata().
char* vfs_get_metadata | ( | VFSFile * | file, | |
const char * | field | |||
) |
Returns metadata about the stream.
file | VFSFile object that represents the VFS stream. | |
field | The string constant field name to get. |
Definition at line 389 of file vfs.c.
Referenced by probe_buffer_get_metadata(), and probe_by_mime().
Reads a character from a VFS stream.
file | VFSFile object that represents the VFS stream. |
Definition at line 236 of file vfs.c.
Referenced by vfs_fgets().
bool_t vfs_is_remote | ( | const char * | path | ) |
Tests if a path is remote uri.
path | A path to test. |
Definition at line 450 of file vfs.c.
Referenced by check_opened().
bool_t vfs_is_writeable | ( | const char * | path | ) |
VFSFile* vfs_new | ( | const char * | path, | |
VFSConstructor * | vtable, | |||
void * | handle | |||
) |
Definition at line 94 of file vfs.c.
Referenced by probe_buffer_new(), and vfs_fopen().
void vfs_rewind | ( | VFSFile * | file | ) |
void vfs_set_lookup_func | ( | VFSConstructor *(*)(const char *scheme) | func | ) |
Definition at line 55 of file vfs.c.
Referenced by start_plugins_one(), and stop_plugins_one().
void vfs_set_verbose | ( | bool_t | verbose | ) |
Definition at line 62 of file vfs.c.
Referenced by init_two().