summaryrefslogtreecommitdiffstats
path: root/gst/audioresample/resample.h
diff options
context:
space:
mode:
Diffstat (limited to 'gst/audioresample/resample.h')
-rw-r--r--gst/audioresample/resample.h114
1 files changed, 114 insertions, 0 deletions
diff --git a/gst/audioresample/resample.h b/gst/audioresample/resample.h
new file mode 100644
index 00000000..9be54f46
--- /dev/null
+++ b/gst/audioresample/resample.h
@@ -0,0 +1,114 @@
+/* Resampling library
+ * Copyright (C) <2001> David Schleef <ds@schleef.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+#ifndef __RESAMPLE_H__
+#define __RESAMPLE_H__
+
+#include <audioresample/functable.h>
+#include <audioresample/buffer.h>
+
+typedef enum {
+ RESAMPLE_FORMAT_S16 = 0,
+ RESAMPLE_FORMAT_S32,
+ RESAMPLE_FORMAT_F32,
+ RESAMPLE_FORMAT_F64
+} ResampleFormat;
+
+typedef void (*ResampleCallback) (void *);
+
+typedef struct _ResampleState ResampleState;
+
+struct _ResampleState {
+ /* parameters */
+
+ int n_channels;
+ ResampleFormat format;
+
+ int filter_length;
+
+ double i_rate;
+ double o_rate;
+
+ int method;
+
+ /* internal parameters */
+
+ int need_reinit;
+
+ double halftaps;
+
+ /* filter state */
+
+ void *o_buf;
+ int o_size;
+
+ AudioresampleBufferQueue *queue;
+ int eos;
+ int started;
+
+ int sample_size;
+
+ void *buffer;
+ int buffer_len;
+
+ double i_start;
+ double o_start;
+
+ double i_inc;
+ double o_inc;
+
+ double sinc_scale;
+
+ double i_end;
+ double o_end;
+
+ int i_samples;
+ int o_samples;
+
+ //void *i_buf;
+
+ Functable *ft;
+
+ double *out_tmp;
+};
+
+void resample_init(void);
+void resample_cleanup(void);
+
+ResampleState *resample_new (void);
+void resample_free (ResampleState *state);
+
+void resample_add_input_data (ResampleState * r, void *data, int size,
+ ResampleCallback free_func, void *closure);
+void resample_input_eos (ResampleState *r);
+int resample_get_output_size (ResampleState *r);
+int resample_get_output_data (ResampleState *r, void *data, int size);
+
+void resample_set_filter_length (ResampleState *r, int length);
+void resample_set_input_rate (ResampleState *r, double rate);
+void resample_set_output_rate (ResampleState *r, double rate);
+void resample_set_n_channels (ResampleState *r, int n_channels);
+void resample_set_format (ResampleState *r, ResampleFormat format);
+void resample_set_method (ResampleState *r, int method);
+int resample_format_size (ResampleFormat format);
+
+
+#endif /* __RESAMPLE_H__ */
+