00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef MPD_INPUT_STREAM_H
00021 #define MPD_INPUT_STREAM_H
00022
00023 #include "check.h"
00024 #include "gcc.h"
00025
00026 #include <glib.h>
00027
00028 #include <stddef.h>
00029 #include <stdbool.h>
00030 #include <sys/types.h>
00031
00032 struct input_stream {
00036 const struct input_plugin *plugin;
00037
00042 char *uri;
00043
00052 GMutex *mutex;
00053
00062 GCond *cond;
00063
00068 bool ready;
00069
00073 bool seekable;
00074
00078 goffset size;
00079
00083 goffset offset;
00084
00088 char *mime;
00089 };
00090
00102 gcc_nonnull(1, 2)
00103 G_GNUC_MALLOC
00104 struct input_stream *
00105 input_stream_open(const char *uri,
00106 GMutex *mutex, GCond *cond,
00107 GError **error_r);
00108
00114 gcc_nonnull(1)
00115 void
00116 input_stream_close(struct input_stream *is);
00117
00118 gcc_nonnull(1)
00119 static inline void
00120 input_stream_lock(struct input_stream *is)
00121 {
00122 g_mutex_lock(is->mutex);
00123 }
00124
00125 gcc_nonnull(1)
00126 static inline void
00127 input_stream_unlock(struct input_stream *is)
00128 {
00129 g_mutex_unlock(is->mutex);
00130 }
00131
00137 gcc_nonnull(1)
00138 bool
00139 input_stream_check(struct input_stream *is, GError **error_r);
00140
00145 gcc_nonnull(1)
00146 void
00147 input_stream_update(struct input_stream *is);
00148
00154 gcc_nonnull(1)
00155 void
00156 input_stream_wait_ready(struct input_stream *is);
00157
00162 gcc_nonnull(1)
00163 void
00164 input_stream_lock_wait_ready(struct input_stream *is);
00165
00176 gcc_nonnull(1)
00177 bool
00178 input_stream_seek(struct input_stream *is, goffset offset, int whence,
00179 GError **error_r);
00180
00185 gcc_nonnull(1)
00186 bool
00187 input_stream_lock_seek(struct input_stream *is, goffset offset, int whence,
00188 GError **error_r);
00189
00195 gcc_nonnull(1)
00196 G_GNUC_PURE
00197 bool input_stream_eof(struct input_stream *is);
00198
00203 gcc_nonnull(1)
00204 G_GNUC_PURE
00205 bool
00206 input_stream_lock_eof(struct input_stream *is);
00207
00216 gcc_nonnull(1)
00217 G_GNUC_MALLOC
00218 struct tag *
00219 input_stream_tag(struct input_stream *is);
00220
00225 gcc_nonnull(1)
00226 G_GNUC_MALLOC
00227 struct tag *
00228 input_stream_lock_tag(struct input_stream *is);
00229
00237 gcc_nonnull(1)
00238 G_GNUC_PURE
00239 bool
00240 input_stream_available(struct input_stream *is);
00241
00253 gcc_nonnull(1, 2)
00254 size_t
00255 input_stream_read(struct input_stream *is, void *ptr, size_t size,
00256 GError **error_r);
00257
00262 gcc_nonnull(1, 2)
00263 size_t
00264 input_stream_lock_read(struct input_stream *is, void *ptr, size_t size,
00265 GError **error_r);
00266
00267 #endif