src/input_stream.h File Reference

#include <stddef.h>
#include <stdbool.h>
#include <sys/types.h>

Go to the source code of this file.

Data Structures

struct  input_stream

Functions

void input_stream_global_init (void)
 Initializes this library and all input_stream implementations.
void input_stream_global_finish (void)
 Deinitializes this library and all input_stream implementations.
bool input_stream_open (struct input_stream *is, const char *url)
 Opens a new input stream.
void input_stream_close (struct input_stream *is)
 Closes the input stream and free resources.
bool input_stream_seek (struct input_stream *is, off_t offset, int whence)
 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)
 Reads some of the stream into its buffer.
size_t input_stream_read (struct input_stream *is, void *ptr, size_t size)
 Reads data from the stream into the caller-supplied buffer.


Function Documentation

int input_stream_buffer ( struct input_stream is  ) 

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  ) 

Closes the input stream and free resources.

This does not free the input_stream pointer itself, because it is assumed to be allocated by the caller.

bool input_stream_eof ( struct input_stream is  ) 

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

void input_stream_global_finish ( void   ) 

Deinitializes this library and all input_stream implementations.

void input_stream_global_init ( void   ) 

Initializes this library and all input_stream implementations.

bool input_stream_open ( struct input_stream is,
const char *  url 
)

Opens a new input stream.

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

Parameters:
is the input_stream object allocated by the caller
Returns:
true on success

size_t input_stream_read ( struct input_stream is,
void *  ptr,
size_t  size 
)

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

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

Parameters:
is the input_stream object
ptr the buffer to read into
size the maximum number of bytes to read
Returns:
the number of bytes read

bool input_stream_seek ( struct input_stream is,
off_t  offset,
int  whence 
)

Seeks to the specified position in the stream.

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

Parameters:
is the input_stream object
offset the relative offset
whence the 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


Generated on Thu Sep 3 02:29:41 2009 for MPD by  doxygen 1.5.9