Blame gst/audiofx/audiofxbasefirfilter.h

Packit 8ff292
/* -*- c-basic-offset: 2 -*-
Packit 8ff292
 * 
Packit 8ff292
 * GStreamer
Packit 8ff292
 * Copyright (C) 1999-2001 Erik Walthinsen <omega@cse.ogi.edu>
Packit 8ff292
 *               2006 Dreamlab Technologies Ltd. <mathis.hofer@dreamlab.net>
Packit 8ff292
 *               2009 Sebastian Dröge <sebastian.droege@collabora.co.uk>
Packit 8ff292
 *
Packit 8ff292
 * This library is free software; you can redistribute it and/or
Packit 8ff292
 * modify it under the terms of the GNU Library General Public
Packit 8ff292
 * License as published by the Free Software Foundation; either
Packit 8ff292
 * version 2 of the License, or (at your option) any later version.
Packit 8ff292
 *
Packit 8ff292
 * This library is distributed in the hope that it will be useful,
Packit 8ff292
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 8ff292
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 8ff292
 * Library General Public License for more details.
Packit 8ff292
 *
Packit 8ff292
 * You should have received a copy of the GNU Library General Public
Packit 8ff292
 * License along with this library; if not, write to the
Packit 8ff292
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Packit 8ff292
 * Boston, MA 02110-1301, USA.
Packit 8ff292
 * 
Packit 8ff292
 */
Packit 8ff292
Packit 8ff292
#ifndef __GST_AUDIO_FX_BASE_FIR_FILTER_H__
Packit 8ff292
#define __GST_AUDIO_FX_BASE_FIR_FILTER_H__
Packit 8ff292
Packit 8ff292
#include <gst/gst.h>
Packit 8ff292
#include <gst/audio/gstaudiofilter.h>
Packit 8ff292
#include <gst/fft/gstfftf64.h>
Packit 8ff292
Packit 8ff292
G_BEGIN_DECLS
Packit 8ff292
Packit 8ff292
#define GST_TYPE_AUDIO_FX_BASE_FIR_FILTER \
Packit 8ff292
  (gst_audio_fx_base_fir_filter_get_type())
Packit 8ff292
#define GST_AUDIO_FX_BASE_FIR_FILTER(obj) \
Packit 8ff292
  (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_FX_BASE_FIR_FILTER,GstAudioFXBaseFIRFilter))
Packit 8ff292
#define GST_AUDIO_FX_BASE_FIR_FILTER_CLASS(klass) \
Packit 8ff292
  (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_FX_BASE_FIR_FILTER,GstAudioFXBaseFIRFilterClass))
Packit 8ff292
#define GST_IS_AUDIO_FX_BASE_FIR_FILTER(obj) \
Packit 8ff292
  (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_FX_BASE_FIR_FILTER))
Packit 8ff292
#define GST_IS_AUDIO_FX_BASE_FIR_FILTER_CLASS(klass) \
Packit 8ff292
  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_FX_BASE_FIR_FILTER))
Packit 8ff292
Packit 8ff292
typedef struct _GstAudioFXBaseFIRFilter GstAudioFXBaseFIRFilter;
Packit 8ff292
typedef struct _GstAudioFXBaseFIRFilterClass GstAudioFXBaseFIRFilterClass;
Packit 8ff292
Packit 8ff292
typedef guint (*GstAudioFXBaseFIRFilterProcessFunc) (GstAudioFXBaseFIRFilter *, const guint8 *, guint8 *, guint);
Packit 8ff292
Packit 8ff292
/**
Packit 8ff292
 * GstAudioFXBaseFIRFilter:
Packit 8ff292
 *
Packit 8ff292
 * Opaque data structure.
Packit 8ff292
 */
Packit 8ff292
struct _GstAudioFXBaseFIRFilter {
Packit 8ff292
  GstAudioFilter element;
Packit 8ff292
Packit 8ff292
  /* properties */
Packit 8ff292
  gdouble *kernel;              /* filter kernel -- time domain */
Packit 8ff292
  guint kernel_length;          /* length of the filter kernel -- time domain */
Packit 8ff292
Packit 8ff292
  guint64 latency;              /* pre-latency of the filter kernel */
Packit 8ff292
  gboolean low_latency;         /* work in slower low latency mode */
Packit 8ff292
Packit 8ff292
  gboolean drain_on_changes;    /* If the filter should be drained when
Packit 8ff292
                                 * coeficients change */
Packit 8ff292
Packit 8ff292
  /* < private > */
Packit 8ff292
  GstAudioFXBaseFIRFilterProcessFunc process;
Packit 8ff292
Packit 8ff292
  gdouble *buffer;              /* buffer for storing samples of previous buffers */
Packit 8ff292
  guint buffer_fill;            /* fill level of buffer */
Packit 8ff292
  guint buffer_length;          /* length of the buffer -- meaning depends on processing mode */
Packit 8ff292
Packit 8ff292
  /* FFT convolution specific data */
Packit 8ff292
  GstFFTF64 *fft;
Packit 8ff292
  GstFFTF64 *ifft;
Packit 8ff292
  GstFFTF64Complex *frequency_response;  /* filter kernel -- frequency domain */
Packit 8ff292
  guint frequency_response_length;       /* length of filter kernel -- frequency domain */
Packit 8ff292
  GstFFTF64Complex *fft_buffer;          /* FFT buffer, has the length of the frequency response */
Packit 8ff292
  guint block_length;                    /* Length of the processing blocks -- time domain */
Packit 8ff292
Packit 8ff292
  GstClockTime start_ts;        /* start timestamp after a discont */
Packit 8ff292
  guint64 start_off;            /* start offset after a discont */
Packit 8ff292
  guint64 nsamples_out;         /* number of output samples since last discont */
Packit 8ff292
  guint64 nsamples_in;          /* number of input samples since last discont */
Packit 8ff292
Packit 8ff292
  GMutex lock;
Packit 8ff292
};
Packit 8ff292
Packit 8ff292
struct _GstAudioFXBaseFIRFilterClass {
Packit 8ff292
  GstAudioFilterClass parent_class;
Packit 8ff292
};
Packit 8ff292
Packit 8ff292
GType gst_audio_fx_base_fir_filter_get_type (void);
Packit 8ff292
void gst_audio_fx_base_fir_filter_set_kernel (GstAudioFXBaseFIRFilter *filter, gdouble *kernel,
Packit 8ff292
                                              guint kernel_length, guint64 latency, const GstAudioInfo * info);
Packit 8ff292
void gst_audio_fx_base_fir_filter_push_residue (GstAudioFXBaseFIRFilter *filter);
Packit 8ff292
Packit 8ff292
G_END_DECLS
Packit 8ff292
Packit 8ff292
#endif /* __GST_AUDIO_FX_BASE_FIR_FILTER_H__ */