summaryrefslogtreecommitdiffstats
path: root/gst/legacyresample/resample.h
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2009-01-23 12:46:28 +0100
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2009-01-23 12:47:19 +0100
commite4e3b44e048ddc1d7499c6108175a5f89c6273d9 (patch)
treef88b685f1b6baf849649494ec557d2ef0ef13a88 /gst/legacyresample/resample.h
parent6fec8619b597f5cc9c58d268ddd9f64ea0a94277 (diff)
downloadgst-plugins-bad-e4e3b44e048ddc1d7499c6108175a5f89c6273d9.tar.gz
gst-plugins-bad-e4e3b44e048ddc1d7499c6108175a5f89c6273d9.tar.bz2
gst-plugins-bad-e4e3b44e048ddc1d7499c6108175a5f89c6273d9.zip
Rename audioresample files and types to legacyresample
Finish the move/rename of audioresample to legacyresample to prevent any confusion.
Diffstat (limited to 'gst/legacyresample/resample.h')
-rw-r--r--gst/legacyresample/resample.h128
1 files changed, 128 insertions, 0 deletions
diff --git a/gst/legacyresample/resample.h b/gst/legacyresample/resample.h
new file mode 100644
index 00000000..84bf8f09
--- /dev/null
+++ b/gst/legacyresample/resample.h
@@ -0,0 +1,128 @@
+/* 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 "functable.h"
+#include "buffer.h"
+
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
+
+#ifdef WIN32
+#define rint(x) (floor((x)+0.5))
+#endif
+
+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 */
+
+ unsigned char *o_buf;
+ int o_size;
+
+ AudioresampleBufferQueue *queue;
+ int eos;
+ int started;
+
+ int sample_size;
+
+ unsigned char *buffer;
+ int buffer_len;
+ int buffer_filled;
+
+ 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);
+void resample_input_flush (ResampleState *r);
+void resample_input_pushthrough (ResampleState *r);
+
+int resample_get_output_size_for_input (ResampleState * r, int size);
+int resample_get_input_size_for_output (ResampleState * r, int size);
+
+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__ */
+