MPD
Data Structures | Typedefs | Functions
input_stream.h File Reference
#include "check.h"
#include <glib.h>
#include <stddef.h>
#include <stdbool.h>
#include <sys/types.h>

Go to the source code of this file.

Data Structures

struct  input_stream
 

Typedefs

typedef gint64 goffset
 

Functions

static void input_stream_init (struct input_stream *is, const struct input_plugin *plugin, const char *uri)
 
static void input_stream_deinit (struct input_stream *is)
 
struct input_streaminput_stream_open (const char *uri, GError **error_r)
 Opens a new input stream.
 
void input_stream_close (struct input_stream *is)
 Close the input stream and free resources.
 
bool input_stream_seek (struct input_stream *is, goffset offset, int whence, GError **error_r)
 Seeks to the specified position in the stream.
 
bool input_stream_eof (struct input_stream *is)
 Returns true if the stream has reached end-of-file.
 
struct taginput_stream_tag (struct input_stream *is)
 Reads the tag from the stream.
 
int input_stream_buffer (struct input_stream *is, GError **error_r)
 Reads some of the stream into its buffer.
 
size_t input_stream_read (struct input_stream *is, void *ptr, size_t size, GError **error_r)
 Reads data from the stream into the caller-supplied buffer.
 

Typedef Documentation

typedef gint64 goffset

Definition at line 32 of file input_stream.h.

Function Documentation

int input_stream_buffer ( struct input_stream is,
GError **  error_r 
)

Reads some of the stream into its buffer.

The following return codes are defined: -1 = error, 1 = something was buffered, 0 = nothing was buffered.

The semantics of this function are not well-defined, and it will eventually be removed.

void input_stream_close ( struct input_stream is)

Close the input stream and free resources.

static void input_stream_deinit ( struct input_stream is)
inlinestatic

Definition at line 88 of file input_stream.h.

bool input_stream_eof ( struct input_stream is)

Returns true if the stream has reached end-of-file.

static void input_stream_init ( struct input_stream is,
const struct input_plugin plugin,
const char *  uri 
)
inlinestatic

Definition at line 75 of file input_stream.h.

struct input_stream* input_stream_open ( const char *  uri,
GError **  error_r 
)
read

Opens a new input stream.

You may not access it until the "ready" flag is set.

Returns
an input_stream object on success, NULL on error
size_t input_stream_read ( struct input_stream is,
void *  ptr,
size_t  size,
GError **  error_r 
)

Reads data from the stream into the caller-supplied buffer.

Returns 0 on error or eof (check with input_stream_eof()).

Parameters
isthe input_stream object
ptrthe buffer to read into
sizethe maximum number of bytes to read
Returns
the number of bytes read
bool input_stream_seek ( struct input_stream is,
goffset  offset,
int  whence,
GError **  error_r 
)

Seeks to the specified position in the stream.

This will most likely fail if the "seekable" flag is false.

Parameters
isthe input_stream object
offsetthe relative offset
whencethe base of the seek, one of SEEK_SET, SEEK_CUR, SEEK_END
struct tag* input_stream_tag ( struct input_stream is)
read

Reads the tag from the stream.

Returns
a tag object which must be freed with tag_free(), or NULL if the tag has not changed since the last call