#include <inttypes.h>
#include "vfs.h"
#include "audstrings.h"
#include <stdio.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <string.h>
#include <mowgli.h>
Go to the source code of this file.
Functions | |
void | vfs_set_lookup_func (VFSConstructor *(*func)(const gchar *scheme)) |
void | vfs_set_verbose (gboolean set) |
static void | logger (const gchar *format,...) |
VFSFile * | vfs_fopen (const gchar *path, const gchar *mode) |
Opens a stream from a VFS transport using one of the registered VFSConstructor handlers. | |
gint | vfs_fclose (VFSFile *file) |
Closes a VFS stream and destroys a VFSFile object. | |
gint64 | vfs_fread (void *ptr, gint64 size, gint64 nmemb, VFSFile *file) |
Reads from a VFS stream. | |
gint64 | vfs_fwrite (const void *ptr, gint64 size, gint64 nmemb, VFSFile *file) |
Writes to a VFS stream. | |
gint | vfs_getc (VFSFile *file) |
Reads a character from a VFS stream. | |
gint | vfs_ungetc (gint c, VFSFile *file) |
Pushes a character back to the VFS stream. | |
gint | vfs_fseek (VFSFile *file, gint64 offset, gint whence) |
Performs a seek in given VFS stream. | |
void | vfs_rewind (VFSFile *file) |
Rewinds a VFS stream. | |
gint64 | vfs_ftell (VFSFile *file) |
Returns the current position in the VFS stream's buffer. | |
gboolean | vfs_feof (VFSFile *file) |
Returns whether or not the VFS stream has reached EOF. | |
gint | vfs_ftruncate (VFSFile *file, gint64 length) |
Truncates a VFS stream to a certain size. | |
gint64 | vfs_fsize (VFSFile *file) |
Returns size of the file. | |
gchar * | vfs_get_metadata (VFSFile *file, const gchar *field) |
Returns metadata about the stream. | |
gboolean | vfs_file_test (const gchar *path, GFileTest test) |
Wrapper for g_file_test(). | |
gboolean | vfs_is_writeable (const gchar *path) |
Tests if a file is writeable. | |
VFSFile * | vfs_dup (VFSFile *in) |
Increments the amount of references that are using this FD. | |
gboolean | vfs_is_remote (const gchar *path) |
Tests if a path is remote uri. | |
gboolean | vfs_is_streaming (VFSFile *file) |
Tests if a file is associated to streaming. | |
Variables | |
static VFSConstructor *(* | lookup_func )(const gchar *scheme) = NULL |
static gboolean | verbose = FALSE |
static void logger | ( | const gchar * | format, | |
... | ||||
) | [static] |
Definition at line 52 of file vfs.c.
Referenced by vfs_feof(), vfs_fopen(), vfs_fread(), vfs_fseek(), vfs_fsize(), vfs_ftell(), vfs_ftruncate(), vfs_fwrite(), vfs_getc(), vfs_rewind(), and vfs_ungetc().
Increments the amount of references that are using this FD.
References are removed by calling vfs_fclose on the handle returned from this function. If the amount of references reaches zero, then the file will be closed.
in | The VFSFile handle to mark as duplicated. |
Closes a VFS stream and destroys a VFSFile object.
file | A VFSFile object to destroy. |
Definition at line 130 of file vfs.c.
Referenced by buffered_file_vfs_fclose_impl(), file_find_decoder(), file_read_image(), file_read_tuple(), file_write_tuple(), playback_thread(), playlist_load(), playlist_save(), probe_buffer_fclose(), save_preset_file(), vfs_buffered_file_new_from_uri(), vfs_buffered_file_release_live_fd(), 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 302 of file vfs.c.
Referenced by buffered_file_vfs_feof_impl(), and probe_buffer_feof().
gboolean vfs_file_test | ( | const gchar * | path, | |
GFileTest | test | |||
) |
Wrapper for g_file_test().
path | A path to test. | |
test | A GFileTest to run. |
Definition at line 375 of file vfs.c.
Referenced by add_generic(), and playlist_remove_failed().
VFSFile* vfs_fopen | ( | const gchar * | path, | |
const gchar * | 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 88 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(), vfs_buffered_file_new_from_uri(), and vfs_file_get_contents().
gint64 vfs_fread | ( | void * | ptr, | |
gint64 | size, | |||
gint64 | 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 162 of file vfs.c.
Referenced by buffered_file_vfs_fread_impl(), import_winamp_eqf(), increase_buffer(), vfs_buffered_file_new_from_uri(), 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 246 of file vfs.c.
Referenced by buffered_file_vfs_fread_impl(), buffered_file_vfs_fseek_impl(), buffered_file_vfs_getc_impl(), import_winamp_eqf(), and probe_func().
gint64 vfs_fsize | ( | VFSFile * | file | ) |
Returns size of the file.
file | VFSFile object that represents the VFS stream. |
Definition at line 337 of file vfs.c.
Referenced by buffered_file_vfs_fsize_impl(), probe_buffer_fsize(), and vfs_file_get_contents().
gint64 vfs_ftell | ( | VFSFile * | file | ) |
Returns the current position in the VFS stream's buffer.
file | VFSFile object that represents the VFS stream. |
Definition at line 283 of file vfs.c.
Referenced by buffered_file_vfs_fread_impl(), buffered_file_vfs_fseek_impl(), buffered_file_vfs_ftell_impl(), and buffered_file_vfs_getc_impl().
gint64 vfs_fwrite | ( | const void * | ptr, | |
gint64 | size, | |||
gint64 | 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 184 of file vfs.c.
Referenced by buffered_file_vfs_fwrite_impl(), 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().
gchar* vfs_get_metadata | ( | VFSFile * | file, | |
const gchar * | 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 357 of file vfs.c.
Referenced by buffered_file_vfs_metadata_impl(), 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 204 of file vfs.c.
Referenced by buffered_file_vfs_getc_impl(), and vfs_fgets().
gboolean vfs_is_remote | ( | const gchar * | path | ) |
Tests if a path is remote uri.
path | A path to test. |
Definition at line 438 of file vfs.c.
Referenced by check_opened().
gboolean vfs_is_writeable | ( | const gchar * | path | ) |
void vfs_rewind | ( | VFSFile * | file | ) |
Rewinds a VFS stream.
file | VFSFile object that represents the VFS stream. |
Definition at line 266 of file vfs.c.
Referenced by buffered_file_vfs_rewind_impl(), and vfs_buffered_file_new_from_uri().
void vfs_set_lookup_func | ( | VFSConstructor *(*)(const gchar *scheme) | func | ) |
Definition at line 40 of file vfs.c.
Referenced by start_plugins_one(), and stop_plugins_one().
void vfs_set_verbose | ( | gboolean | set | ) |
Definition at line 47 of file vfs.c.
Referenced by init_two().
VFSConstructor*(* lookup_func)(const gchar *scheme) = NULL [static] |
Referenced by vfs_fopen(), and vfs_set_lookup_func().