Changeset c5b8548 in mainline for uspace/srv/audio/hound/audio_data.c


Ignore:
Timestamp:
2013-04-05T12:24:43Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
704baed
Parents:
50179b63
Message:

hound: make audio data list element private

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/audio/hound/audio_data.c

    r50179b63 rc5b8548  
    6969}
    7070
    71 audio_data_link_t *audio_data_link_create(audio_data_t *adata)
     71/* Data link helpers */
     72
     73typedef struct {
     74        link_t link;
     75        audio_data_t *adata;
     76        size_t position;
     77} audio_data_link_t;
     78
     79static 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
     84static audio_data_link_t *audio_data_link_create(audio_data_t *adata)
    7285{
    7386        assert(adata);
     
    8194}
    8295
    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)
     96static void audio_data_link_destroy(audio_data_link_t *link)
    9897{
    9998        assert(link);
     
    103102}
    104103
    105 size_t audio_data_link_available_frames(audio_data_link_t *alink)
     104static 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
     111static 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
     120static inline size_t audio_data_link_available_frames(audio_data_link_t *alink)
    106121{
    107122        assert(alink);
Note: See TracChangeset for help on using the changeset viewer.