]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - compress_filter.c
Switch audiod over to the buffer tree API.
[paraslash.git] / compress_filter.c
index 142ad899bfe175581fb36e8943a1f5011f43d3d6..39055618cde7ea16bfd5f2207f4b00a3b314c5e2 100644 (file)
@@ -103,13 +103,17 @@ static void compress_post_select(__a_unused struct sched *s, struct task *t)
        //inplace = false;
 next_buffer:
        t->error = 0;
-       ret = btr_node_status(btrn, fn->min_iqs);
+       ret = btr_node_status(btrn, fn->min_iqs, BTR_NT_INTERNAL);
        if (ret < 0)
                goto err;
        if (ret == 0)
                return;
        btr_merge(btrn, fn->min_iqs);
        length = btr_next_buffer(btrn, &inbuf) & ~(size_t)1;
+       if (length == 0) { /* eof and 1 byte available */
+               ret = -E_COMPRESS_EOF;
+               goto err;
+       }
        ip = (int16_t *)inbuf;
        if (inplace)
                op = ip;
@@ -150,9 +154,8 @@ next_buffer:
        goto next_buffer;
 err:
        assert(ret < 0);
-       close_compress(fn);
        t->error = ret;
-       btr_del_node(btrn);
+       btr_remove_node(btrn);
 }
 
 /** TODO: Add sanity checks */
@@ -185,6 +188,11 @@ static void open_compress(struct filter_node *fn)
        pcd->max_gain = 1 << (pcd->conf->inertia_arg + pcd->conf->aggressiveness_arg);
 }
 
+static void compress_free_config(void *conf)
+{
+       compress_cmdline_parser_free(conf);
+}
+
 /**
  * The init function of the compress filter.
  *
@@ -201,6 +209,7 @@ void compress_filter_init(struct filter *f)
        f->pre_select = generic_filter_pre_select;
        f->post_select = compress_post_select;
        f->parse_config = compress_parse_config;
+       f->free_config = compress_free_config;
        f->help = (struct ggo_help) {
                .short_help = compress_filter_args_info_help,
                .detailed_help = compress_filter_args_info_detailed_help