ossp-pkg/l2/l2_stream.c 1.1 -> 1.2
--- l2_stream.c 2001/05/10 19:46:01 1.1
+++ l2_stream.c 2001/05/17 14:43:26 1.2
@@ -31,3 +31,32 @@
#include "l2.h"
#include "l2_p.h"
+l2_stream_t* l2_stream_create(void)
+ {
+ l2_stream_t *st;
+ st = (l2_stream_t *)malloc(sizeof(l2_stream_t));
+ if (!st)
+ return NULL;
+ memset(st, 0, sizeof(l2_stream_t));
+ return st;
+ }
+
+void l2_stream_destroy(l2_stream_t* st)
+ {
+ size_t i;
+ for (i = 0; i <= L2_MAX_CHANNELS && st->channels[i]; ++i)
+ l2_channel_destroy(st->channels[i]);
+ for (i = 0; i <= L2_MAX_FORMATTERS && st->formatters[i]; ++i)
+ free(st->formatters[i]);
+ }
+
+l2_stream_t* l2_stream_channel(l2_stream_t *st, l2_channel_t *ch, unsigned int levelmask)
+ {
+ size_t i;
+ for (i = 0; i <= L2_MAX_CHANNELS && st->channels[i]; ++i)
+ ;
+ if (i == L2_MAX_CHANNELS)
+ return 0; /* Array is full. */
+ st->channels[i] = ch;
+ return st;
+ }
|
|