X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=fecdec_filter.c;h=13d4f7b22f6a46da75ef4b629275d603fc5f39d1;hp=1c3a37849d1309fbf3b676bf04c513628dc1c657;hb=HEAD;hpb=f6a845d497ed6883e8318acc8a17d2ed07b85a51 diff --git a/fecdec_filter.c b/fecdec_filter.c index 1c3a3784..375f4c0a 100644 --- a/fecdec_filter.c +++ b/fecdec_filter.c @@ -1,8 +1,4 @@ -/* - * Copyright (C) 2009 Andre Noll - * - * Licensed under the GPL v2. For licencing details see COPYING. - */ +/* Copyright (C) 2009 Andre Noll , see file COPYING. */ /** \file fecdec_filter.c A filter that fec-decodes an audio stream. */ @@ -12,7 +8,6 @@ #include "error.h" #include "list.h" #include "sched.h" -#include "ggo.h" #include "buffer_tree.h" #include "filter.h" #include "string.h" @@ -230,8 +225,8 @@ static int add_slice(char *buf, struct fecdec_group *fg) } if (fg->num_slices == 0) { fg->num_slices = fg->h.slices_per_group; - fg->idx = para_malloc(fg->num_slices * sizeof(int)); - fg->data = para_calloc(fg->num_slices * sizeof(unsigned char *)); + fg->idx = arr_alloc(fg->num_slices, sizeof(int)); + fg->data = arr_zalloc(fg->num_slices, sizeof(unsigned char *)); } r = fg->num_received_slices; /* Check if we already have this slice. */ @@ -241,7 +236,7 @@ static int add_slice(char *buf, struct fecdec_group *fg) return 0; } fg->idx[r] = slice_num; - fg->data[r] = para_malloc(fg->h.slice_bytes); + fg->data[r] = alloc(fg->h.slice_bytes); memcpy(fg->data[r], buf, fg->h.slice_bytes); fg->num_received_slices++; return 1; @@ -365,7 +360,7 @@ static int read_fec_header(char *buf, size_t len, struct fec_header *h) h->bos = read_u8(buf + 22); h->header_stream = read_u8(buf + 23); if (!memcmp(buf, FEC_EOF_PACKET, FEC_EOF_PACKET_LEN)) - return -E_FECDEC_EOF; + return -E_EOF; // PARA_DEBUG_LOG("group %u, slize %u, slices per group: %u\n", // h->group_num, h->slice_num, h->slices_per_group); return 1; @@ -436,7 +431,7 @@ static void fecdec_close(struct filter_node *fn) fn->private_data = NULL; } -static int fecdec_post_select(__a_unused struct sched *s, void *context) +static int fecdec_post_monitor(__a_unused struct sched *s, void *context) { struct filter_node *fn = context; struct btr_node *btrn = fn->btrn; @@ -476,20 +471,14 @@ out: static void fecdec_open(struct filter_node *fn) { struct private_fecdec_data *pfd; - pfd = para_calloc(sizeof(*pfd)); + pfd = zalloc(sizeof(*pfd)); fn->private_data = pfd; fn->min_iqs = FEC_HEADER_SIZE; } -/** - * The init function of the fecdec filter. - * - * \param f Struct to initialize. - */ -void fecdec_filter_init(struct filter *f) -{ - f->close = fecdec_close; - f->open = fecdec_open; - f->pre_select = generic_filter_pre_select; - f->post_select = fecdec_post_select; -} +const struct filter lsg_filter_cmd_com_fecdec_user_data = { + .open = fecdec_open, + .pre_monitor = generic_filter_pre_monitor, + .post_monitor = fecdec_post_monitor, + .close = fecdec_close, +};