Changeset c5b8548 in mainline for uspace/srv/audio/hound/audio_data.c
- Timestamp:
- 2013-04-05T12:24:43Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 704baed
- Parents:
- 50179b63
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/audio/hound/audio_data.c
r50179b63 rc5b8548 69 69 } 70 70 71 audio_data_link_t *audio_data_link_create(audio_data_t *adata) 71 /* Data link helpers */ 72 73 typedef struct { 74 link_t link; 75 audio_data_t *adata; 76 size_t position; 77 } audio_data_link_t; 78 79 static inline audio_data_link_t * audio_data_link_list_instance(link_t *l) 80 { 81 return l ? list_get_instance(l, audio_data_link_t, link) : NULL; 82 } 83 84 static audio_data_link_t *audio_data_link_create(audio_data_t *adata) 72 85 { 73 86 assert(adata); … … 81 94 } 82 95 83 audio_data_link_t * audio_data_link_create_data(const void *data, size_t size, 84 pcm_format_t format) 85 { 86 audio_data_link_t *link = NULL; 87 audio_data_t *adata = audio_data_create(data, size, format); 88 if (adata) { 89 link = audio_data_link_create(adata); 90 /* This will either return refcount to 1 or clean adata if 91 * cloning failed */ 92 audio_data_unref(adata); 93 } 94 return link; 95 } 96 97 void audio_data_link_destroy(audio_data_link_t *link) 96 static void audio_data_link_destroy(audio_data_link_t *link) 98 97 { 99 98 assert(link); … … 103 102 } 104 103 105 size_t audio_data_link_available_frames(audio_data_link_t *alink) 104 static inline const void * audio_data_link_start(audio_data_link_t *alink) 105 { 106 assert(alink); 107 assert(alink->adata); 108 return alink->adata->data + alink->position; 109 } 110 111 static inline size_t audio_data_link_remain_size(audio_data_link_t *alink) 112 { 113 assert(alink); 114 assert(alink->adata); 115 assert(alink->position <= alink->adata->size); 116 return alink->adata->size - alink->position; 117 } 118 119 120 static inline size_t audio_data_link_available_frames(audio_data_link_t *alink) 106 121 { 107 122 assert(alink);
Note:
See TracChangeset
for help on using the changeset viewer.