filter: Remove allocation of filter buffers.
[paraslash.git] / fecdec_filter.c
index fd35d5f..8ccc2ee 100644 (file)
  */
 #define NUM_FEC_GROUPS 3
 
-/** Default size of the output buffer of the fecdec filter. */
-#define FECDEC_DEFAULT_OUTBUF_SIZE (3 * 1024)
-/** Maximal size of the output buffer of the fecdec filter. */
-#define FECDEC_MAX_OUTBUF_SIZE (1024 * 1024)
-
 /** Data read from the header of a slice. */
 struct fec_header {
        /** Total number of slices in this group. */
@@ -326,11 +321,7 @@ static int decode_group(struct fecdec_group *fg, struct filter_node *fn)
                                break;
                        if (sb + written > fg->h.audio_header_size)
                                n = fg->h.audio_header_size - written;
-                       if (fn->btrn)
-                               btr_copy(fg->data[i], n, pfd->btrp, fn->btrn);
-                       else
-                               memcpy(p + written, fg->data[i], n);
-                       fn->loaded += n;
+                       btr_copy(fg->data[i], n, pfd->btrp, fn->btrn);
                        written += n;
                }
                p += written;
@@ -340,11 +331,7 @@ static int decode_group(struct fecdec_group *fg, struct filter_node *fn)
                size_t n = sb;
                if (n + written > fg->h.group_bytes)
                        n = fg->h.group_bytes - written;
-               if (fn->btrn)
-                       btr_copy(fg->data[i], n, pfd->btrp, fn->btrn);
-               else
-                       memcpy(p + written, fg->data[i], n);
-               fn->loaded += n;
+               btr_copy(fg->data[i], n, pfd->btrp, fn->btrn);
                written += n;
        }
        p += written;
@@ -443,12 +430,9 @@ static void fecdec_close(struct filter_node *fn)
 
        FOR_EACH_FECDEC_GROUP(fg, pfd)
                clear_group(fg);
-       free(fn->buf);
-       fn->buf = NULL;
        fec_free(pfd->fec);
        free(fn->private_data);
        fn->private_data = NULL;
-       fn->conf = NULL;
 }
 
 static void fecdec_post_select(__a_unused struct sched *s, struct task *t)
@@ -491,11 +475,8 @@ out:
 static void fecdec_open(struct filter_node *fn)
 {
        struct private_fecdec_data *pfd;
-       fn->bufsize = FECDEC_DEFAULT_OUTBUF_SIZE;
-       fn->buf = para_malloc(fn->bufsize);
        pfd = para_calloc(sizeof(*pfd));
        fn->private_data = pfd;
-       fn->loaded = 0;
        fn->min_iqs = FEC_HEADER_SIZE;
 }