Changeset b266f9e in mainline for uspace/srv/audio/hound/hound_ctx.c
- Timestamp:
- 2013-04-04T11:15:41Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- bf13c9a4
- Parents:
- 6133470
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/audio/hound/hound_ctx.c
r6133470 rb266f9e 38 38 39 39 #include "hound_ctx.h" 40 #include "log.h" 40 41 41 42 hound_ctx_t *hound_record_ctx_get(const char *name) … … 49 50 if (ctx) { 50 51 link_initialize(&ctx->link); 52 list_initialize(&ctx->streams); 51 53 ctx->sink = NULL; 52 54 ctx->source = malloc(sizeof(audio_source_t)); … … 74 76 if (ctx->sink) 75 77 audio_sink_fini(ctx->sink); 78 //TODO remove streams 76 79 free(ctx->source); 77 80 free(ctx->sink); … … 88 91 { 89 92 assert(ctx); 90 //TODO fix this 91 return false; 93 return ctx->source == NULL; 94 } 95 96 hound_ctx_stream_t *hound_ctx_create_stream(hound_ctx_t *ctx, int flags, 97 pcm_format_t format, size_t buffer_size) 98 { 99 assert(ctx); 100 hound_ctx_stream_t *stream = malloc(sizeof(hound_ctx_stream_t)); 101 if (stream) { 102 link_initialize(&stream->link); 103 stream->ctx = ctx; 104 stream->flags = flags; 105 stream->format = format; 106 stream->allowed_size = buffer_size; 107 list_append(&stream->link, &ctx->streams); 108 log_verbose("CTX: %p added stream; flags:%#x ch: %u r:%u f:%s", 109 ctx, flags, format.channels, format.sampling_rate, 110 pcm_sample_format_str(format.sample_format)); 111 } 112 return stream; 113 } 114 115 void hound_ctx_destroy_stream(hound_ctx_stream_t *stream) 116 { 117 if (stream) { 118 list_remove(&stream->link); 119 //TODO free used buffer space 120 log_verbose("CTX: %p remove stream; flags:%#x ch: %u r:%u f:%s", 121 stream->ctx, stream->flags, stream->format.channels, 122 stream->format.sampling_rate, 123 pcm_sample_format_str(stream->format.sample_format)); 124 free(stream); 125 } 92 126 } 93 127
Note:
See TracChangeset
for help on using the changeset viewer.