Changeset f0a647c in mainline


Ignore:
Timestamp:
2013-04-11T00:18:22Z (11 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c799138
Parents:
876f5561
Message:

hound: Remove dead code

Location:
uspace/srv/audio/hound
Files:
2 edited

Legend:

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

    r876f5561 rf0a647c  
    6565        source->update_available_data = update_available_data;
    6666        source->format = *f;
    67         source->available_data.base = NULL;
    68         source->available_data.position = NULL;
    69         source->available_data.size = 0;
    7067        log_verbose("Initialized source (%p) '%s'", source, source->name);
    7168        return EOK;
     
    7976}
    8077
    81 int audio_source_add_self(audio_source_t *source, void *buffer, size_t size,
    82     const pcm_format_t *f)
    83 {
    84         assert(source);
    85         if (!buffer) {
    86                 log_debug("Non-existent buffer");
    87                 return EBADMEM;
    88         }
    89         if (!f || size == 0) {
    90                 log_debug("No format or zero size");
    91         }
    92         if (size % (pcm_sample_format_size(f->sample_format) * f->channels)) {
    93                 log_debug("Buffer does not fit integer number of frames");
    94                 return EINVAL;
    95         }
    96         if (source->format.sampling_rate != f->sampling_rate) {
    97                 log_debug("Resampling is not supported, yet");
    98                 return ENOTSUP;
    99         }
    100         const size_t src_frame_size = pcm_format_frame_size(&source->format);
    101         const size_t dst_frames = size / pcm_format_frame_size(f);
    102 
    103         if (source->available_data.position == NULL ||
    104             source->available_data.size == 0) {
    105                 int ret = EOVERFLOW; /* In fact this is underflow... */
    106                 if (source->update_available_data)
    107                         ret = source->update_available_data(source,
    108                             dst_frames * src_frame_size);
    109                 if (ret != EOK) {
    110                         log_debug("No data to add to %p(%zu)", buffer, size);
    111                         return ret;
    112                 }
    113         }
    114 
    115         const int ret = pcm_format_convert_and_mix(buffer, size,
    116                source->available_data.position, source->available_data.size,
    117                &source->format, f);
    118         if (ret != EOK) {
    119                 log_debug("Mixing failed %p <= %p, frames: %zu",
    120                     buffer, source->available_data.position, dst_frames);
    121                 return ret;
    122         }
    123 
    124         source->available_data.position += (dst_frames * src_frame_size);
    125         source->available_data.size -= (dst_frames * src_frame_size);
    126         return EOK;
    127 }
    128 
    12978/**
    13079 * @}
  • uspace/srv/audio/hound/audio_source.h

    r876f5561 rf0a647c  
    4040#include <pcm/format.h>
    4141
    42 struct audio_sink;
    4342typedef struct audio_source audio_source_t;
    4443
     
    5150        int (*connection_change)(audio_source_t *source, bool added);
    5251        int (*update_available_data)(audio_source_t *source, size_t size);
    53         struct {
    54                 void *position;
    55                 void *base;
    56                 size_t size;
    57         } available_data;
    5852};
    5953
     
    6862    const pcm_format_t *f);
    6963void audio_source_fini(audio_source_t *source);
    70 //int audio_source_connected(audio_source_t *source, struct audio_sink *sink);
    71 int audio_source_add_self(audio_source_t *source, void *buffer, size_t size,
    72     const pcm_format_t *f);
    7364static inline const pcm_format_t *audio_source_format(const audio_source_t *s)
    7465{
Note: See TracChangeset for help on using the changeset viewer.