MPD 0.17~git
Data Structures | Typedefs | Functions | Variables
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

Typedefs

typedef gint64 goffset

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

Typedef Documentation

typedef gint64 goffset

Definition at line 33 of file input_stream.h.


Function Documentation

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:
mutexa mutex that is used to protect this object; must be locked before calling any of the public methods
conda 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:
isthe input_stream object
ptrthe buffer to read into
sizethe maximum number of bytes to read
Returns:
the number of bytes read
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:
isthe input_stream object
offsetthe relative offset
whencethe 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

Variable Documentation

GMutex GCond* cond

Definition at line 110 of file input_stream.h.

void size_t GError** error_r

Definition at line 110 of file input_stream.h.

GMutex* mutex

Definition at line 110 of file input_stream.h.

Definition at line 182 of file input_stream.h.

void * ptr

Definition at line 259 of file input_stream.h.

void size_t size

Definition at line 259 of file input_stream.h.

Definition at line 182 of file input_stream.h.