Changeset 0ee3157 in mainline
- Timestamp:
- 2020-09-18T23:09:04Z (4 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 003c413
- Parents:
- d53af3c8
- Location:
- uspace/lib/riff
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/riff/include/riff/chunk.h
rd53af3c8 r0ee3157 37 37 #define RIFF_CHUNK_H 38 38 39 #include <errno.h> 39 40 #include <stddef.h> 40 41 #include <types/riff/chunk.h> 41 42 42 extern int riff_wopen(const char *, riffw_t **);43 extern int riff_wclose(riffw_t *);44 extern int riff_wchunk_start(riffw_t *, riff_ckid_t, riff_wchunk_t *);45 extern int riff_wchunk_end(riffw_t *, riff_wchunk_t *);46 extern int riff_wchunk_write(riffw_t *, void *, size_t);47 extern int riff_write_uint32(riffw_t *, uint32_t);43 extern errno_t riff_wopen(const char *, riffw_t **); 44 extern errno_t riff_wclose(riffw_t *); 45 extern errno_t riff_wchunk_start(riffw_t *, riff_ckid_t, riff_wchunk_t *); 46 extern errno_t riff_wchunk_end(riffw_t *, riff_wchunk_t *); 47 extern errno_t riff_wchunk_write(riffw_t *, void *, size_t); 48 extern errno_t riff_write_uint32(riffw_t *, uint32_t); 48 49 49 extern int riff_ropen(const char *, riffr_t **);50 extern int riff_rclose(riffr_t *);51 extern int riff_read_uint32(riffr_t *, uint32_t *);52 extern int riff_rchunk_start(riffr_t *, riff_rchunk_t *);53 extern int riff_rchunk_end(riffr_t *, riff_rchunk_t *);54 extern int riff_rchunk_read(riffr_t *, riff_rchunk_t *, void *, size_t,50 extern errno_t riff_ropen(const char *, riffr_t **); 51 extern errno_t riff_rclose(riffr_t *); 52 extern errno_t riff_read_uint32(riffr_t *, uint32_t *); 53 extern errno_t riff_rchunk_start(riffr_t *, riff_rchunk_t *); 54 extern errno_t riff_rchunk_end(riffr_t *, riff_rchunk_t *); 55 extern errno_t riff_rchunk_read(riffr_t *, riff_rchunk_t *, void *, size_t, 55 56 size_t *); 56 57 -
uspace/lib/riff/include/riff/rwave.h
rd53af3c8 r0ee3157 37 37 #define RIFF_WAVE_H 38 38 39 #include <errno.h> 39 40 #include <types/riff/rwave.h> 40 41 41 extern int rwave_wopen(const char *, rwave_params_t *params, rwavew_t **);42 extern int rwave_write_samples(rwavew_t *, void *, size_t);43 extern int rwave_wclose(rwavew_t *);42 extern errno_t rwave_wopen(const char *, rwave_params_t *params, rwavew_t **); 43 extern errno_t rwave_write_samples(rwavew_t *, void *, size_t); 44 extern errno_t rwave_wclose(rwavew_t *); 44 45 45 extern int rwave_ropen(const char *, rwave_params_t *params, rwaver_t **);46 extern int rwave_read_samples(rwaver_t *, void *, size_t, size_t *);47 extern int rwave_rclose(rwaver_t *);46 extern errno_t rwave_ropen(const char *, rwave_params_t *params, rwaver_t **); 47 extern errno_t rwave_read_samples(rwaver_t *, void *, size_t, size_t *); 48 extern errno_t rwave_rclose(rwaver_t *); 48 49 49 50 #endif -
uspace/lib/riff/src/chunk.c
rd53af3c8 r0ee3157 49 49 * file. 50 50 */ 51 int riff_wopen(const char *fname, riffw_t **rrw)51 errno_t riff_wopen(const char *fname, riffw_t **rrw) 52 52 { 53 53 riffw_t *rw; … … 73 73 * is destroyed anyway. 74 74 */ 75 int riff_wclose(riffw_t *rw)75 errno_t riff_wclose(riffw_t *rw) 76 76 { 77 77 int rv; … … 89 89 * @return EOK on success, EIO on error. 90 90 */ 91 int riff_write_uint32(riffw_t *rw, uint32_t v)91 errno_t riff_write_uint32(riffw_t *rw, uint32_t v) 92 92 { 93 93 uint32_t vle; … … 108 108 * @return EOK on success, EIO on write error 109 109 */ 110 int riff_wchunk_start(riffw_t *rw, riff_ckid_t ckid, riff_wchunk_t *wchunk)110 errno_t riff_wchunk_start(riffw_t *rw, riff_ckid_t ckid, riff_wchunk_t *wchunk) 111 111 { 112 112 long pos; 113 int rc;113 errno_t rc; 114 114 115 115 pos = ftell(rw->f); … … 141 141 * @return EOK on success, EIO error. 142 142 */ 143 int riff_wchunk_end(riffw_t *rw, riff_wchunk_t *wchunk)143 errno_t riff_wchunk_end(riffw_t *rw, riff_wchunk_t *wchunk) 144 144 { 145 145 long pos; 146 146 long cksize; 147 int rc;147 errno_t rc; 148 148 149 149 pos = ftell(rw->f); … … 176 176 * @return EOK on success, EIO on error. 177 177 */ 178 int riff_wchunk_write(riffw_t *rw, void *data, size_t bytes)178 errno_t riff_wchunk_write(riffw_t *rw, void *data, size_t bytes) 179 179 { 180 180 size_t nw; … … 195 195 * file.. 196 196 */ 197 int riff_ropen(const char *fname, riffr_t **rrr)197 errno_t riff_ropen(const char *fname, riffr_t **rrr) 198 198 { 199 199 riffr_t *rr; 200 int rc;200 errno_t rc; 201 201 202 202 rr = calloc(1, sizeof(riffr_t)); … … 226 226 * @return EOK on success, EIO on error. 227 227 */ 228 int riff_rclose(riffr_t *rr)229 { 230 int rc;228 errno_t riff_rclose(riffr_t *rr) 229 { 230 errno_t rc; 231 231 232 232 rc = fclose(rr->f); … … 241 241 * @return EOK on success, EIO on error. 242 242 */ 243 int riff_read_uint32(riffr_t *rr, uint32_t *v)243 errno_t riff_read_uint32(riffr_t *rr, uint32_t *v) 244 244 { 245 245 uint32_t vle; … … 259 259 * @return EOK on success, EIO on error. 260 260 */ 261 int riff_rchunk_start(riffr_t *rr, riff_rchunk_t *rchunk)262 { 263 int rc;261 errno_t riff_rchunk_start(riffr_t *rr, riff_rchunk_t *rchunk) 262 { 263 errno_t rc; 264 264 long pos; 265 265 … … 317 317 * @return EOK on success, EIO on error. 318 318 */ 319 int riff_rchunk_end(riffr_t *rr, riff_rchunk_t *rchunk)319 errno_t riff_rchunk_end(riffr_t *rr, riff_rchunk_t *rchunk) 320 320 { 321 321 long ckend; … … 343 343 * EIO on I/O error. 344 344 */ 345 int riff_rchunk_read(riffr_t *rr, riff_rchunk_t *rchunk, void *buf,345 errno_t riff_rchunk_read(riffr_t *rr, riff_rchunk_t *rchunk, void *buf, 346 346 size_t bytes, size_t *nread) 347 347 { -
uspace/lib/riff/src/rwave.c
rd53af3c8 r0ee3157 94 94 * @return EOK on success, EIO on I/O error, ENOMEM if out of memory. 95 95 */ 96 int rwave_wopen(const char *fname, rwave_params_t *params, rwavew_t **rww)96 errno_t rwave_wopen(const char *fname, rwave_params_t *params, rwavew_t **rww) 97 97 { 98 98 riff_wchunk_t fmt; 99 99 rwave_fmt_t rwfmt; 100 int rc;100 errno_t rc; 101 101 rwavew_t *ww; 102 102 … … 169 169 * not supported. 170 170 */ 171 int rwave_write_samples(rwavew_t *ww, void *data, size_t bytes)171 errno_t rwave_write_samples(rwavew_t *ww, void *data, size_t bytes) 172 172 { 173 173 size_t i; 174 174 uint16_t *d16, *b16; 175 175 size_t now; 176 int rc;176 errno_t rc; 177 177 178 178 /* Convert sample data to little endian */ … … 215 215 * anyway. 216 216 */ 217 int rwave_wclose(rwavew_t *ww)218 { 219 int rc;217 errno_t rwave_wclose(rwavew_t *ww) 218 { 219 errno_t rc; 220 220 221 221 rc = riff_wchunk_end(ww->rw, &ww->wave); … … 240 240 * @return EOK on success, EIO on I/O error, ENOMEM if out of memory 241 241 */ 242 int rwave_ropen(const char *fname, rwave_params_t *params, rwaver_t **rwr)242 errno_t rwave_ropen(const char *fname, rwave_params_t *params, rwaver_t **rwr) 243 243 { 244 244 rwaver_t *wr = NULL; … … 247 247 rwave_fmt_t wfmt; 248 248 size_t nread; 249 int rc;249 errno_t rc; 250 250 251 251 wr = calloc(1, sizeof(rwaver_t)); … … 349 349 * EIO on I/O error. 350 350 */ 351 int rwave_read_samples(rwaver_t *wr, void *buf, size_t bytes, size_t *nread)352 { 353 int rc;351 errno_t rwave_read_samples(rwaver_t *wr, void *buf, size_t bytes, size_t *nread) 352 { 353 errno_t rc; 354 354 355 355 rc = riff_rchunk_read(wr->rr, &wr->data, buf, bytes, nread); … … 369 369 * anyway. 370 370 */ 371 int rwave_rclose(rwaver_t *wr)372 { 373 int rc;371 errno_t rwave_rclose(rwaver_t *wr) 372 { 373 errno_t rc; 374 374 375 375 rc = riff_rchunk_end(wr->rr, &wr->wave);
Note:
See TracChangeset
for help on using the changeset viewer.