Changeset aab8e3d3 in mainline
- Timestamp:
- 2013-04-03T19:02:48Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8f8ec69
- Parents:
- b893cd6
- Location:
- uspace/srv/audio/hound
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/audio/hound/hound_ctx.c
rb893cd6 raab8e3d3 39 39 #include "hound_ctx.h" 40 40 41 static void hound_ctx_init_common(hound_ctx_t *ctx)42 {43 if (!ctx)44 return;45 link_initialize(&ctx->link);46 }47 48 41 hound_ctx_t *hound_record_ctx_get(const char *name) 49 42 { … … 54 47 { 55 48 hound_ctx_t *ctx = malloc(sizeof(hound_ctx_t)); 56 hound_ctx_init_common(ctx); 49 if (ctx) { 50 link_initialize(&ctx->link); 51 ctx->sink = NULL; 52 ctx->source = malloc(sizeof(audio_source_t)); 53 if (!ctx->source) { 54 free(ctx); 55 return NULL; 56 } 57 const int ret = audio_source_init(ctx->source, name, ctx, NULL, 58 NULL, &AUDIO_FORMAT_ANY); 59 if (ret != EOK) { 60 free(ctx->source); 61 free(ctx); 62 return NULL; 63 } 64 } 57 65 return ctx; 58 66 } … … 62 70 assert(ctx); 63 71 assert(!link_in_use(&ctx->link)); 72 if (ctx->source) 73 audio_source_fini(ctx->source); 74 if (ctx->sink) 75 audio_sink_fini(ctx->sink); 76 free(ctx->source); 77 free(ctx->sink); 64 78 free(ctx); 65 79 } -
uspace/srv/audio/hound/hound_ctx.h
rb893cd6 raab8e3d3 39 39 #include <adt/list.h> 40 40 #include <hound/protocol.h> 41 #include "audio_source.h" 42 #include "audio_sink.h" 41 43 42 44 typedef struct { 43 45 link_t link; 46 list_t streams; 47 audio_source_t *source; 48 audio_sink_t *sink; 44 49 } hound_ctx_t; 45 50 46 51 static inline hound_ctx_t *hound_ctx_from_link(link_t *l) 47 52 { 48 return l ist_get_instance(l, hound_ctx_t, link);53 return l ? list_get_instance(l, hound_ctx_t, link) : NULL; 49 54 } 50 55
Note:
See TracChangeset
for help on using the changeset viewer.