Changeset c799138 in mainline for uspace/srv/audio/hound/audio_data.c
- Timestamp:
- 2013-04-11T01:34:41Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 250828a
- Parents:
- f0a647c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/audio/hound/audio_data.c
rf0a647c rc799138 40 40 #include "log.h" 41 41 42 /** 43 * Create reference counted buffer out of ordinary data buffer. 44 * @param data audio buffer 45 * @param size Size of the @p data buffer. 46 * @param fomart audio data format. 47 * @return pointer to valid audio data structre, NULL on failure. 48 */ 42 49 audio_data_t *audio_data_create(const void *data, size_t size, 43 50 pcm_format_t format) … … 58 65 } 59 66 67 /** 68 * Get a new reference to the audio data buffer. 69 * @param adata The audio data buffer. 70 */ 60 71 void audio_data_addref(audio_data_t *adata) 61 72 { … … 65 76 } 66 77 78 /** 79 * Release a reference to the audio data buffer. 80 * @param adata The audio data buffer. 81 */ 67 82 void audio_data_unref(audio_data_t *adata) 68 83 { … … 78 93 /* Data link helpers */ 79 94 95 /** Audio data buffer list helper structure. */ 80 96 typedef struct { 81 97 link_t link; … … 84 100 } audio_data_link_t; 85 101 102 /** List instance helper function. 103 * @param l link 104 * @return valid pointer to data link structure, NULL on failure. 105 */ 86 106 static inline audio_data_link_t * audio_data_link_list_instance(link_t *l) 87 107 { … … 89 109 } 90 110 111 /** 112 * Create a new audio data link. 113 * @param adata Audio data to store. 114 * @return Valid pointer to a new audio data link structure, NULL on failure. 115 */ 91 116 static audio_data_link_t *audio_data_link_create(audio_data_t *adata) 92 117 { … … 101 126 } 102 127 128 /** 129 * Destroy audio data link. 130 * @param link The link to destroy. 131 * 132 * Releases data reference. 133 */ 103 134 static void audio_data_link_destroy(audio_data_link_t *link) 104 135 { … … 109 140 } 110 141 142 /** 143 * Data link buffer start helper function. 144 * @param alink audio data link 145 * @return pointer to the beginning of data buffer. 146 */ 111 147 static inline const void * audio_data_link_start(audio_data_link_t *alink) 112 148 { … … 116 152 } 117 153 154 /** 155 * Data link remaining size getter. 156 * @param alink audio data link 157 * @return Remaining size of valid data in the buffer. 158 */ 118 159 static inline size_t audio_data_link_remain_size(audio_data_link_t *alink) 119 160 { … … 125 166 126 167 168 /** 169 * Data link remaining frames getter. 170 * @param alink audio data link 171 * @return Number of remaining frames in the buffer. 172 */ 127 173 static inline size_t audio_data_link_available_frames(audio_data_link_t *alink) 128 174 { … … 135 181 /* Audio Pipe */ 136 182 137 183 /** 184 * Initialize audio pipe structure. 185 * @param pipe The pipe structure to initialize. 186 */ 138 187 void audio_pipe_init(audio_pipe_t *pipe) 139 188 { … … 145 194 } 146 195 147 148 196 /** 197 * Destroy all data in a pipe. 198 * @param pipe The audio pipe to clean. 199 */ 149 200 void audio_pipe_fini(audio_pipe_t *pipe) 150 201 { … … 156 207 } 157 208 209 /** 210 * Add new audio data to a pipe. 211 * @param pipe The target pipe. 212 * @param data The data. 213 * @return Error code. 214 */ 158 215 int audio_pipe_push(audio_pipe_t *pipe, audio_data_t *data) 159 216 { … … 172 229 } 173 230 231 /** 232 * Retrieve data form a audio pipe. 233 * @param pipe THe target pipe. 234 * @return Valid pointer to audio data, NULL if the pipe was empty. 235 */ 174 236 audio_data_t *audio_pipe_pop(audio_pipe_t *pipe) 175 237 { … … 191 253 } 192 254 255 256 /** 257 * Use data store in a pipe and mix it into the provided buffer. 258 * @param pipe The piep that should provide data. 259 * @param data Target buffer. 260 * @param size Target buffer size. 261 * @param format Target data format. 262 * @return Size of the target buffer used, Error code on failure. 263 */ 193 264 ssize_t audio_pipe_mix_data(audio_pipe_t *pipe, void *data, 194 265 size_t size, const pcm_format_t *f)
Note:
See TracChangeset
for help on using the changeset viewer.