Changeset 5109:4f9fc788fe91 in roaraudio for include/libroar/vs.h


Ignore:
Timestamp:
07/28/11 16:32:34 (13 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

Started to use compiler attributes (Also see: #130)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • include/libroar/vs.h

    r5078 r5109  
    3939#include "libroar.h" 
    4040 
     41#define _LIBROAR_VS_STDATTRS _LIBROAR_ATTR_USE_RESULT _LIBROAR_ATTR_NONNULL(1) 
     42 
    4143struct roar_vs; 
    4244 
     
    4547 
    4648/* return readable string describing the problem */ 
    47 const char * roar_vs_strerr(int error); 
     49const char * roar_vs_strerr(int error) _LIBROAR_ATTR_PURE _LIBROAR_ATTR_USE_RESULT; 
    4850 
    4951/* create a new VS object from normal RoarAudio connection object 
     
    5153 * The connection is not closed by roar_vs_close(). 
    5254 */ 
    53 roar_vs_t * roar_vs_new_from_con(struct roar_connection * con, int * error); 
     55roar_vs_t * roar_vs_new_from_con(struct roar_connection * con, int * error) _LIBROAR_VS_STDATTRS; 
    5456 
    5557/* create a new VS object with a new connection */ 
    56 roar_vs_t * roar_vs_new(const char * server, const char * name, int * error); 
     58roar_vs_t * roar_vs_new(const char * server, const char * name, int * error) _LIBROAR_ATTR_USE_RESULT; 
    5759 
    5860/* start a the stream in the VS object */ 
    59 int roar_vs_stream(roar_vs_t * vss, const struct roar_audio_info * info, int dir, int * error); 
     61int roar_vs_stream(roar_vs_t * vss, const struct roar_audio_info * info, int dir, int * error) _LIBROAR_ATTR_USE_RESULT _LIBROAR_ATTR_NONNULL(1, 2); 
    6062 
    6163/* connect to server and start stream in once 
    6264 * this is basically roar_vs_new() and roar_vs_stream() in one function. 
    6365 */ 
    64 roar_vs_t * roar_vs_new_simple(const char * server, const char * name, int rate, int channels, int codec, int bits, int dir, int * error); 
     66roar_vs_t * roar_vs_new_simple(const char * server, const char * name, int rate, int channels, int codec, int bits, int dir, int * error) _LIBROAR_ATTR_USE_RESULT; 
    6567 
    6668/* create a VS object for playback. 
     
    7375 */ 
    7476 
    75 int roar_vs_file(roar_vs_t * vss, struct roar_vio_calls * vio, int closefile, int * error); 
     77int roar_vs_file(roar_vs_t * vss, struct roar_vio_calls * vio, int closefile, int * error) _LIBROAR_ATTR_USE_RESULT _LIBROAR_ATTR_NONNULL(1, 2); 
    7678 
    7779/* Open a file and attach it. 
    7880 */ 
    79 int roar_vs_file_simple(roar_vs_t * vss, char * filename, int * error); 
     81int roar_vs_file_simple(roar_vs_t * vss, char * filename, int * error) _LIBROAR_ATTR_USE_RESULT _LIBROAR_ATTR_NONNULL(1, 2); 
    8082 
    8183/* Connects to a server to just play a file. 
    8284 */ 
    83 roar_vs_t * roar_vs_new_from_file(const char * server, const char * name, char * filename, int * error); 
     85roar_vs_t * roar_vs_new_from_file(const char * server, const char * name, char * filename, int * error) _LIBROAR_ATTR_USE_RESULT _LIBROAR_ATTR_NONNULL(3); 
    8486 
    8587/* Switch to buffered mode. 
     
    9294 * Buffer size should be a value of 2^n. Typical values are 2048 and 4096. 
    9395 */ 
    94 int roar_vs_buffer(roar_vs_t * vss, size_t buffer, int * error); 
     96int roar_vs_buffer(roar_vs_t * vss, size_t buffer, int * error) _LIBROAR_VS_STDATTRS; 
    9597 
    9698 
     
    109111 * If server connection was provided by caller it is untouched. 
    110112 */ 
    111 int roar_vs_close(roar_vs_t * vss, int killit, int * error); 
     113int roar_vs_close(roar_vs_t * vss, int killit, int * error) _LIBROAR_ATTR_NONNULL(1); 
    112114 
    113115/* write data to a stream 
     
    119121 * you should wait some (short!) time (for example one main loop iteration) and try again. 
    120122 */ 
    121 ssize_t roar_vs_write(roar_vs_t * vss, const void * buf, size_t len, int * error); 
     123ssize_t roar_vs_write(roar_vs_t * vss, const void * buf, size_t len, int * error) _LIBROAR_ATTR_USE_RESULT _LIBROAR_ATTR_NONNULL(1, 2); 
    122124 
    123125/* read data from a stream 
     
    129131 * you should wait some (short!) time (for example one main loop iteration) and try again. 
    130132 */ 
    131 ssize_t roar_vs_read (roar_vs_t * vss,       void * buf, size_t len, int * error); 
     133ssize_t roar_vs_read (roar_vs_t * vss,       void * buf, size_t len, int * error) _LIBROAR_ATTR_USE_RESULT _LIBROAR_ATTR_NONNULL(1, 2); 
    132134 
    133135/* wait value for waiting */ 
     
    141143 * Returns 0 on no error and -1 on error. 
    142144 */ 
    143 int     roar_vs_sync (roar_vs_t * vss, int wait, int * error); 
     145int     roar_vs_sync (roar_vs_t * vss, int wait, int * error) _LIBROAR_ATTR_NONNULL(1); 
    144146 
    145147/* set blocking mode of stream 
    146148 * returns old blocking state 
    147149 */ 
    148 int     roar_vs_blocking (roar_vs_t * vss, int val, int * error); 
     150int     roar_vs_blocking (roar_vs_t * vss, int val, int * error) _LIBROAR_VS_STDATTRS; 
    149151 
    150152/* do not supply backend offset */ 
     
    162164 * plus a offset provided by the selected backend 
    163165 */ 
    164 ssize_t roar_vs_position(roar_vs_t * vss, int backend, int * error); 
     166ssize_t roar_vs_position(roar_vs_t * vss, int backend, int * error) _LIBROAR_VS_STDATTRS; 
    165167 
    166168/* get latency between playback and local write counter 
     
    174176 * ahead of us). This is normal in case we read a stream. 
    175177 */ 
    176 roar_mus_t roar_vs_latency(roar_vs_t * vss, int backend, int * error); 
    177 roar_mus_t roar_vs_latency2(roar_vs_t * vss, int backend, int wait, int * error); 
     178roar_mus_t roar_vs_latency(roar_vs_t * vss, int backend, int * error) _LIBROAR_VS_STDATTRS _LIBROAR_ATTR_DEPRECATED; 
     179roar_mus_t roar_vs_latency2(roar_vs_t * vss, int backend, int wait, int * error) _LIBROAR_VS_STDATTRS; 
    178180 
    179181/* set pause flag 
     
    182184 * returns old pause setting (useful with ROAR_VS_TOGGLE) 
    183185 */ 
    184 int     roar_vs_pause(roar_vs_t * vss, int val, int * error); 
     186int     roar_vs_pause(roar_vs_t * vss, int val, int * error) _LIBROAR_ATTR_NONNULL(1); 
    185187 
    186188/* set the mute flag of the stream 
     
    191193 * returns old mute setting (useful with ROAR_VS_TOGGLE) 
    192194 */ 
    193 int     roar_vs_mute (roar_vs_t * vss, int val, int * error); 
     195int     roar_vs_mute (roar_vs_t * vss, int val, int * error) _LIBROAR_ATTR_NONNULL(1); 
    194196 
    195197/* set volume of stream (all channels to the same value) 
     
    197199 * Returns 0 on no error and -1 on error. 
    198200 */ 
    199 int     roar_vs_volume_mono   (roar_vs_t * vss, float c, int * error); 
     201int     roar_vs_volume_mono   (roar_vs_t * vss, float c, int * error) _LIBROAR_ATTR_NONNULL(1); 
    200202/* set volume of stream (like volume + balance, stereo mode) 
    201203 * volume l and r are floats from 0 ('muted', see above) to 1 (full volume). 
    202204 * Returns 0 on no error and -1 on error. 
    203205 */ 
    204 int     roar_vs_volume_stereo (roar_vs_t * vss, float l, float r, int * error); 
     206int     roar_vs_volume_stereo (roar_vs_t * vss, float l, float r, int * error) _LIBROAR_ATTR_NONNULL(1); 
    205207 
    206208/* get volume from stream (like volume + balance, stereo mode) 
     
    210212 * you can just use: c = (*l + *r)/2 
    211213 */ 
    212 int     roar_vs_volume_get    (roar_vs_t * vss, float * l, float * r, int * error); 
     214int     roar_vs_volume_get    (roar_vs_t * vss, float * l, float * r, int * error) _LIBROAR_ATTR_USE_RESULT _LIBROAR_ATTR_NONNULL(1, 2, 3); 
    213215 
    214216/* set an array of meta data for the stream 
     
    222224 * ret = roar_vs_meta(vss, &kv, 1, &err); 
    223225 */ 
    224 int     roar_vs_meta          (roar_vs_t * vss, struct roar_keyval * kv, size_t len, int * error); 
     226int     roar_vs_meta          (roar_vs_t * vss, struct roar_keyval * kv, size_t len, int * error) _LIBROAR_ATTR_NONNULL(1, 2); 
    225227 
    226228/* sets the stream role 
     
    228230 * Returns 0 on no error and -1 on error. 
    229231 */ 
    230 int     roar_vs_role          (roar_vs_t * vss, int role, int * error); 
     232int     roar_vs_role          (roar_vs_t * vss, int role, int * error) _LIBROAR_ATTR_NONNULL(1); 
    231233 
    232234/* Run a single iteration. 
     
    235237 * Returns -1 on error, 0 on EOF and positive true value on no error. 
    236238 */ 
    237 int     roar_vs_iterate       (roar_vs_t * vss, int wait, int * error); 
     239int     roar_vs_iterate       (roar_vs_t * vss, int wait, int * error) _LIBROAR_ATTR_NONNULL(1); 
    238240 
    239241/* Iterate until EOF or error. 
     
    241243 * Returns 0 on no error and -1 on error. 
    242244 */ 
    243 int     roar_vs_run           (roar_vs_t * vss, int * error); 
    244  
    245 ssize_t roar_vs_get_avail_read(roar_vs_t * vss, int * error); 
    246 ssize_t roar_vs_get_avail_write(roar_vs_t * vss, int * error); 
     245int     roar_vs_run           (roar_vs_t * vss, int * error) _LIBROAR_ATTR_NONNULL(1); 
     246 
     247ssize_t roar_vs_get_avail_read(roar_vs_t * vss, int * error) _LIBROAR_VS_STDATTRS; 
     248ssize_t roar_vs_get_avail_write(roar_vs_t * vss, int * error) _LIBROAR_VS_STDATTRS; 
    247249 
    248250/* If in buffered mode drop all data from internal buffer. 
     
    252254 * but should be avoided as it may break the bitstream. 
    253255 */ 
    254 int     roar_vs_reset_buffer(roar_vs_t * vss, int writering, int readring, int * error); 
     256int     roar_vs_reset_buffer(roar_vs_t * vss, int writering, int readring, int * error) _LIBROAR_VS_STDATTRS _LIBROAR_ATTR_DEPRECATED; 
    255257 
    256258/* Misc controls. 
     
    317319#define ROAR_VS_ASYNCLEVEL_AUTO   2 
    318320 
    319 int     roar_vs_ctl           (roar_vs_t * vss, roar_vs_ctlcmd cmd, void * argp, int * error); 
     321int     roar_vs_ctl           (roar_vs_t * vss, roar_vs_ctlcmd cmd, void * argp, int * error) _LIBROAR_VS_STDATTRS; 
    320322 
    321323 
     
    324326 * Returns used connection object or NULL on error. 
    325327 */ 
    326 struct roar_connection * roar_vs_connection_obj(roar_vs_t * vss, int * error); 
     328struct roar_connection * roar_vs_connection_obj(roar_vs_t * vss, int * error) _LIBROAR_VS_STDATTRS; 
    327329 
    328330/* Get used stream object 
     
    330332 * Returns used stream object or NULL on error. 
    331333 */ 
    332 struct roar_stream     * roar_vs_stream_obj    (roar_vs_t * vss, int * error); 
     334struct roar_stream     * roar_vs_stream_obj    (roar_vs_t * vss, int * error) _LIBROAR_VS_STDATTRS; 
    333335 
    334336/* Get used VIO object 
     
    338340 * Returns used VIO object or NULL on error. 
    339341 */ 
    340 struct roar_vio_calls  * roar_vs_vio_obj       (roar_vs_t * vss, int * error); 
     342struct roar_vio_calls  * roar_vs_vio_obj       (roar_vs_t * vss, int * error) _LIBROAR_VS_STDATTRS; 
    341343 
    342344/* send NOOP command to server 
Note: See TracChangeset for help on using the changeset viewer.