src/input_stream.h File Reference

#include "check.h"
#include "gcc.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

Functions

 gcc_nonnull (1, 2) G_GNUC_MALLOC struct input_stream *input_stream_open(const char *uri
 Opens a new input stream.
 gcc_nonnull (1) void input_stream_close(struct input_stream *is)
 Close the input stream and free resources.

Variables

GMutex * mutex
GMutex GCond * cond
GMutex GCond GError ** error_r
goffset offset
goffset int whence
void * ptr
void size_t size

Function Documentation

gcc_nonnull (  ) 

Close the input stream and free resources.

Returns true if the next read operation will not block: either data is available, or end-of-stream has been reached, or an error has occurred.

Wrapper for input_stream_tag() which locks and unlocks the mutex; the caller must not be holding it already.

Reads the tag from the stream.

Wrapper for input_stream_eof() which locks and unlocks the mutex; the caller must not be holding it already.

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

Wrapper for input_stream_seek() which locks and unlocks the mutex; the caller must not be holding it already.

Seeks to the specified position in the stream.

Wrapper for input_stream_wait_locked() which locks and unlocks the mutex; the caller must not be holding it already.

Wait until the stream becomes ready.

Update the public attributes.

Check for errors that may have occurred in the I/O thread.

The caller must not lock the mutex.

Returns:
false on error

Call before accessing attributes such as "ready" or "offset".

The caller must lock the mutex.

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

The caller must lock the mutex.

Parameters:
is the input_stream object
offset the relative offset
whence the base of the seek, one of SEEK_SET, SEEK_CUR, SEEK_END

The caller must lock the mutex.

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

Opens a new input stream.

Wrapper for input_stream_tag() which locks and unlocks the mutex; the caller must not be holding it already.

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

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

Parameters:
mutex a mutex that is used to protect this object; must be locked before calling any of the public methods
cond a cond that gets signalled when the state of this object changes; may be NULL if the caller doesn't want to get notifications
Returns:
an input_stream object on success, NULL on error

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

The caller must lock the mutex.

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

Variable Documentation

GMutex GCond* cond

Definition at line 106 of file input_stream.h.

void size_t GError** error_r

Definition at line 106 of file input_stream.h.

GMutex* mutex

Definition at line 106 of file input_stream.h.

goffset offset

Definition at line 178 of file input_stream.h.

void * ptr

Definition at line 255 of file input_stream.h.

void size_t size

Definition at line 255 of file input_stream.h.

goffset int whence

Definition at line 178 of file input_stream.h.


Generated on 17 Jul 2013 for MPD by  doxygen 1.6.1