2002-03-20 21:45:03 +00:00
|
|
|
/* GStreamer
|
2001-12-22 23:21:55 +00:00
|
|
|
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
*
|
|
|
|
* 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 (at your option) 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.
|
|
|
|
*/
|
2004-01-27 09:00:01 +00:00
|
|
|
/* Element-Checklist-Version: 5 */
|
2001-12-22 23:21:55 +00:00
|
|
|
|
|
|
|
|
2003-06-29 19:46:12 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
2001-12-22 23:21:55 +00:00
|
|
|
#include <string.h>
|
|
|
|
#include <math.h>
|
|
|
|
|
2002-03-19 04:10:06 +00:00
|
|
|
/*#define DEBUG_ENABLED */
|
2001-12-22 23:21:55 +00:00
|
|
|
#include <gstaudioscale.h>
|
2001-12-23 12:18:18 +00:00
|
|
|
#include <gst/audio/audio.h>
|
|
|
|
#include <gst/resample/resample.h>
|
2001-12-22 23:21:55 +00:00
|
|
|
|
|
|
|
/* elementfactory information */
|
2004-03-14 22:34:34 +00:00
|
|
|
static GstElementDetails gst_audioscale_details =
|
|
|
|
GST_ELEMENT_DETAILS ("Audio scaler",
|
|
|
|
"Filter/Converter/Audio",
|
|
|
|
"Resample audio",
|
|
|
|
"David Schleef <ds@schleef.org>");
|
2001-12-22 23:21:55 +00:00
|
|
|
|
|
|
|
/* Audioscale signals and args */
|
2004-03-14 22:34:34 +00:00
|
|
|
enum
|
|
|
|
{
|
2001-12-22 23:21:55 +00:00
|
|
|
/* FILL ME */
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
enum
|
|
|
|
{
|
2001-12-22 23:21:55 +00:00
|
|
|
ARG_0,
|
|
|
|
ARG_FILTERLEN,
|
2004-05-21 22:39:30 +00:00
|
|
|
ARG_METHOD
|
|
|
|
/* FILL ME */
|
2001-12-22 23:21:55 +00:00
|
|
|
};
|
|
|
|
|
2003-12-22 01:47:09 +00:00
|
|
|
static GstStaticPadTemplate gst_audioscale_sink_template =
|
2004-03-14 22:34:34 +00:00
|
|
|
GST_STATIC_PAD_TEMPLATE ("sink",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
2004-05-25 20:14:10 +00:00
|
|
|
GST_STATIC_CAPS ("audio/x-raw-int, "
|
|
|
|
"rate = (int) [ 1, MAX ], "
|
|
|
|
"channels = (int) [ 1, MAX ], "
|
|
|
|
"endianness = (int) BYTE_ORDER, "
|
|
|
|
"width = (int) { 8, 16, 24, 32 }, "
|
|
|
|
"depth = (int) [ 1, 32 ], " "signed = (boolean) { true, false }")
|
2004-03-14 22:34:34 +00:00
|
|
|
);
|
2003-07-06 20:49:52 +00:00
|
|
|
|
2003-12-22 01:47:09 +00:00
|
|
|
static GstStaticPadTemplate gst_audioscale_src_template =
|
2004-03-14 22:34:34 +00:00
|
|
|
GST_STATIC_PAD_TEMPLATE ("src",
|
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
2004-05-25 20:14:10 +00:00
|
|
|
GST_STATIC_CAPS ("audio/x-raw-int, "
|
|
|
|
"rate = (int) [ 1, MAX ], "
|
|
|
|
"channels = (int) [ 1, MAX ], "
|
|
|
|
"endianness = (int) BYTE_ORDER, "
|
|
|
|
"width = (int) { 8, 16, 24, 32 }, "
|
|
|
|
"depth = (int) [ 1, 32 ], " "signed = (boolean) { true, false }")
|
2004-03-14 22:34:34 +00:00
|
|
|
);
|
2002-05-29 06:14:43 +00:00
|
|
|
|
2001-12-22 23:21:55 +00:00
|
|
|
#define GST_TYPE_AUDIOSCALE_METHOD (gst_audioscale_method_get_type())
|
|
|
|
static GType
|
|
|
|
gst_audioscale_method_get_type (void)
|
|
|
|
{
|
|
|
|
static GType audioscale_method_type = 0;
|
|
|
|
static GEnumValue audioscale_methods[] = {
|
2004-03-14 22:34:34 +00:00
|
|
|
{GST_RESAMPLE_NEAREST, "0", "Nearest"},
|
|
|
|
{GST_RESAMPLE_BILINEAR, "1", "Bilinear"},
|
|
|
|
{GST_RESAMPLE_SINC, "2", "Sinc"},
|
|
|
|
{0, NULL, NULL},
|
2001-12-22 23:21:55 +00:00
|
|
|
};
|
2004-03-15 19:32:28 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
if (!audioscale_method_type) {
|
|
|
|
audioscale_method_type = g_enum_register_static ("GstAudioscaleMethod",
|
2004-03-15 19:32:28 +00:00
|
|
|
audioscale_methods);
|
2001-12-22 23:21:55 +00:00
|
|
|
}
|
|
|
|
return audioscale_method_type;
|
|
|
|
}
|
2002-05-29 06:14:43 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
static void gst_audioscale_base_init (gpointer g_class);
|
|
|
|
static void gst_audioscale_class_init (AudioscaleClass * klass);
|
|
|
|
static void gst_audioscale_init (Audioscale * audioscale);
|
2004-05-07 20:26:47 +00:00
|
|
|
static void gst_audioscale_dispose (GObject * object);
|
2001-12-22 23:21:55 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
static void gst_audioscale_chain (GstPad * pad, GstData * _data);
|
2001-12-22 23:21:55 +00:00
|
|
|
|
|
|
|
static void gst_audioscale_set_property (GObject * object, guint prop_id,
|
2004-03-14 22:34:34 +00:00
|
|
|
const GValue * value, GParamSpec * pspec);
|
2001-12-22 23:21:55 +00:00
|
|
|
static void gst_audioscale_get_property (GObject * object, guint prop_id,
|
2004-03-14 22:34:34 +00:00
|
|
|
GValue * value, GParamSpec * pspec);
|
2001-12-22 23:21:55 +00:00
|
|
|
|
|
|
|
static GstElementClass *parent_class = NULL;
|
|
|
|
|
2002-03-19 04:10:06 +00:00
|
|
|
/*static guint gst_audioscale_signals[LAST_SIGNAL] = { 0 }; */
|
2001-12-22 23:21:55 +00:00
|
|
|
|
|
|
|
GType
|
|
|
|
audioscale_get_type (void)
|
|
|
|
{
|
|
|
|
static GType audioscale_type = 0;
|
|
|
|
|
|
|
|
if (!audioscale_type) {
|
|
|
|
static const GTypeInfo audioscale_info = {
|
2004-03-14 22:34:34 +00:00
|
|
|
sizeof (AudioscaleClass),
|
2003-11-01 01:24:30 +00:00
|
|
|
gst_audioscale_base_init,
|
2001-12-22 23:21:55 +00:00
|
|
|
NULL,
|
2004-03-14 22:34:34 +00:00
|
|
|
(GClassInitFunc) gst_audioscale_class_init,
|
2001-12-22 23:21:55 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
2004-03-14 22:34:34 +00:00
|
|
|
sizeof (Audioscale),
|
2001-12-22 23:21:55 +00:00
|
|
|
0,
|
2004-03-14 22:34:34 +00:00
|
|
|
(GInstanceInitFunc) gst_audioscale_init,
|
2001-12-22 23:21:55 +00:00
|
|
|
};
|
2004-03-15 19:32:28 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
audioscale_type =
|
2004-03-15 19:32:28 +00:00
|
|
|
g_type_register_static (GST_TYPE_ELEMENT, "Audioscale",
|
|
|
|
&audioscale_info, 0);
|
2001-12-22 23:21:55 +00:00
|
|
|
}
|
|
|
|
return audioscale_type;
|
|
|
|
}
|
|
|
|
|
2003-11-01 01:24:30 +00:00
|
|
|
static void
|
|
|
|
gst_audioscale_base_init (gpointer g_class)
|
|
|
|
{
|
|
|
|
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
|
|
|
|
|
|
|
|
gst_element_class_add_pad_template (gstelement_class,
|
2003-12-22 01:47:09 +00:00
|
|
|
gst_static_pad_template_get (&gst_audioscale_src_template));
|
2003-11-01 01:24:30 +00:00
|
|
|
gst_element_class_add_pad_template (gstelement_class,
|
2003-12-22 01:47:09 +00:00
|
|
|
gst_static_pad_template_get (&gst_audioscale_sink_template));
|
2003-11-01 01:24:30 +00:00
|
|
|
|
|
|
|
gst_element_class_set_details (gstelement_class, &gst_audioscale_details);
|
|
|
|
}
|
|
|
|
|
2001-12-22 23:21:55 +00:00
|
|
|
static void
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_audioscale_class_init (AudioscaleClass * klass)
|
2001-12-22 23:21:55 +00:00
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
|
|
|
GstElementClass *gstelement_class;
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
gobject_class = (GObjectClass *) klass;
|
|
|
|
gstelement_class = (GstElementClass *) klass;
|
2001-12-22 23:21:55 +00:00
|
|
|
|
2003-11-16 22:02:21 +00:00
|
|
|
gobject_class->set_property = gst_audioscale_set_property;
|
|
|
|
gobject_class->get_property = gst_audioscale_get_property;
|
2004-05-07 20:26:47 +00:00
|
|
|
gobject_class->dispose = gst_audioscale_dispose;
|
2003-11-16 22:02:21 +00:00
|
|
|
|
2001-12-22 23:21:55 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FILTERLEN,
|
2004-03-14 22:34:34 +00:00
|
|
|
g_param_spec_int ("filter_length", "filter_length", "filter_length",
|
2004-03-15 19:32:28 +00:00
|
|
|
0, G_MAXINT, 16, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
2003-11-16 22:02:21 +00:00
|
|
|
|
2001-12-22 23:21:55 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_METHOD,
|
2004-03-14 22:34:34 +00:00
|
|
|
g_param_spec_enum ("method", "method", "method",
|
2004-03-15 19:32:28 +00:00
|
|
|
GST_TYPE_AUDIOSCALE_METHOD, GST_RESAMPLE_SINC,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
2001-12-22 23:21:55 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
|
2001-12-22 23:21:55 +00:00
|
|
|
}
|
|
|
|
|
gst/audioscale/gstaudioscale.c: Fix getcaps to expand and union lists. (bug #138225)
Original commit message from CVS:
* gst/audioscale/gstaudioscale.c: (gst_audioscale_expand_value),
(gst_audioscale_getcaps): Fix getcaps to expand and union lists.
(bug #138225)
* gst/debug/Makefile.am:
* gst/debug/breakmydata.c: (gst_break_my_data_plugin_init):
* gst/debug/gstdebug.c: (plugin_init): Merge elements into one
plugin.
* gst/debug/negotiation.c: (gst_gst_negotiation_get_type),
(gst_negotiation_base_init), (gst_negotiation_class_init),
(gst_negotiation_init), (gst_negotiation_getcaps),
(gst_negotiation_pad_link), (gst_negotiation_chain),
(gst_negotiation_set_property), (gst_negotiation_get_property),
(gst_negotiation_plugin_init): New element to talk about random
negotiation things happening in a pipeline.
2004-03-31 22:36:36 +00:00
|
|
|
static void
|
|
|
|
gst_audioscale_expand_value (GValue * dest, const GValue * src)
|
|
|
|
{
|
|
|
|
int rate_min, rate_max;
|
|
|
|
|
|
|
|
if (G_VALUE_TYPE (src) == G_TYPE_INT ||
|
|
|
|
G_VALUE_TYPE (src) == GST_TYPE_INT_RANGE) {
|
|
|
|
if (G_VALUE_TYPE (src) == G_TYPE_INT) {
|
|
|
|
rate_min = g_value_get_int (src);
|
|
|
|
rate_max = rate_min;
|
|
|
|
} else {
|
|
|
|
rate_min = gst_value_get_int_range_min (src);
|
|
|
|
rate_max = gst_value_get_int_range_max (src);
|
|
|
|
}
|
|
|
|
|
|
|
|
rate_min /= 2;
|
|
|
|
if (rate_min < 1)
|
|
|
|
rate_min = 1;
|
|
|
|
if (rate_max < G_MAXINT / 2) {
|
|
|
|
rate_max *= 2;
|
|
|
|
} else {
|
|
|
|
rate_max = G_MAXINT;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_value_init (dest, GST_TYPE_INT_RANGE);
|
|
|
|
gst_value_set_int_range (dest, rate_min, rate_max);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (G_VALUE_TYPE (src) == GST_TYPE_LIST) {
|
|
|
|
int i;
|
|
|
|
|
|
|
|
g_value_init (dest, GST_TYPE_LIST);
|
|
|
|
for (i = 0; i < gst_value_list_get_size (src); i++) {
|
|
|
|
const GValue *s = gst_value_list_get_value (src, i);
|
|
|
|
GValue d = { 0 };
|
|
|
|
int j;
|
|
|
|
|
|
|
|
gst_audioscale_expand_value (&d, s);
|
|
|
|
|
|
|
|
for (j = 0; j < gst_value_list_get_size (dest); j++) {
|
|
|
|
const GValue *s2 = gst_value_list_get_value (dest, j);
|
|
|
|
GValue d2 = { 0 };
|
|
|
|
|
|
|
|
gst_value_union (&d2, &d, s2);
|
|
|
|
if (G_VALUE_TYPE (&d2) == GST_TYPE_INT_RANGE) {
|
|
|
|
g_value_unset ((GValue *) s2);
|
|
|
|
gst_value_init_and_copy ((GValue *) s2, &d2);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
g_value_unset (&d2);
|
|
|
|
}
|
|
|
|
if (j == gst_value_list_get_size (dest)) {
|
|
|
|
gst_value_list_append_value (dest, &d);
|
|
|
|
}
|
|
|
|
g_value_unset (&d);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gst_value_list_get_size (dest) == 1) {
|
|
|
|
const GValue *s = gst_value_list_get_value (dest, 0);
|
|
|
|
GValue d = { 0 };
|
|
|
|
|
|
|
|
gst_value_init_and_copy (&d, s);
|
|
|
|
g_value_unset (dest);
|
|
|
|
gst_value_init_and_copy (dest, &d);
|
|
|
|
g_value_unset (&d);
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_ERROR ("unexpected value type");
|
|
|
|
}
|
|
|
|
|
2003-09-14 11:20:45 +00:00
|
|
|
static GstCaps *
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_audioscale_getcaps (GstPad * pad)
|
2003-09-14 11:20:45 +00:00
|
|
|
{
|
|
|
|
Audioscale *audioscale;
|
2003-12-22 01:47:09 +00:00
|
|
|
GstCaps *caps;
|
2003-12-31 08:02:04 +00:00
|
|
|
GstPad *otherpad;
|
2003-12-22 01:47:09 +00:00
|
|
|
int i;
|
2003-09-14 11:20:45 +00:00
|
|
|
|
|
|
|
audioscale = GST_AUDIOSCALE (gst_pad_get_parent (pad));
|
|
|
|
|
2003-12-31 08:02:04 +00:00
|
|
|
otherpad = (pad == audioscale->srcpad) ? audioscale->sinkpad :
|
2004-03-14 22:34:34 +00:00
|
|
|
audioscale->srcpad;
|
2003-12-31 08:02:04 +00:00
|
|
|
caps = gst_pad_get_allowed_caps (otherpad);
|
2003-09-14 11:20:45 +00:00
|
|
|
|
|
|
|
/* we do this hack, because the audioscale lib doesn't handle
|
|
|
|
* rate conversions larger than a factor of 2 */
|
2004-03-14 22:34:34 +00:00
|
|
|
for (i = 0; i < gst_caps_get_size (caps); i++) {
|
2003-12-22 01:47:09 +00:00
|
|
|
GstStructure *structure = gst_caps_get_structure (caps, i);
|
|
|
|
const GValue *value;
|
gst/audioscale/gstaudioscale.c: Fix getcaps to expand and union lists. (bug #138225)
Original commit message from CVS:
* gst/audioscale/gstaudioscale.c: (gst_audioscale_expand_value),
(gst_audioscale_getcaps): Fix getcaps to expand and union lists.
(bug #138225)
* gst/debug/Makefile.am:
* gst/debug/breakmydata.c: (gst_break_my_data_plugin_init):
* gst/debug/gstdebug.c: (plugin_init): Merge elements into one
plugin.
* gst/debug/negotiation.c: (gst_gst_negotiation_get_type),
(gst_negotiation_base_init), (gst_negotiation_class_init),
(gst_negotiation_init), (gst_negotiation_getcaps),
(gst_negotiation_pad_link), (gst_negotiation_chain),
(gst_negotiation_set_property), (gst_negotiation_get_property),
(gst_negotiation_plugin_init): New element to talk about random
negotiation things happening in a pipeline.
2004-03-31 22:36:36 +00:00
|
|
|
GValue dest = { 0 };
|
2003-12-22 01:47:09 +00:00
|
|
|
|
|
|
|
value = gst_structure_get_value (structure, "rate");
|
gst/audioscale/gstaudioscale.c: Fix getcaps to expand and union lists. (bug #138225)
Original commit message from CVS:
* gst/audioscale/gstaudioscale.c: (gst_audioscale_expand_value),
(gst_audioscale_getcaps): Fix getcaps to expand and union lists.
(bug #138225)
* gst/debug/Makefile.am:
* gst/debug/breakmydata.c: (gst_break_my_data_plugin_init):
* gst/debug/gstdebug.c: (plugin_init): Merge elements into one
plugin.
* gst/debug/negotiation.c: (gst_gst_negotiation_get_type),
(gst_negotiation_base_init), (gst_negotiation_class_init),
(gst_negotiation_init), (gst_negotiation_getcaps),
(gst_negotiation_pad_link), (gst_negotiation_chain),
(gst_negotiation_set_property), (gst_negotiation_get_property),
(gst_negotiation_plugin_init): New element to talk about random
negotiation things happening in a pipeline.
2004-03-31 22:36:36 +00:00
|
|
|
if (value == NULL) {
|
|
|
|
GST_ERROR ("caps structure doesn't have required rate field");
|
2003-12-22 01:47:09 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
gst/audioscale/gstaudioscale.c: Fix getcaps to expand and union lists. (bug #138225)
Original commit message from CVS:
* gst/audioscale/gstaudioscale.c: (gst_audioscale_expand_value),
(gst_audioscale_getcaps): Fix getcaps to expand and union lists.
(bug #138225)
* gst/debug/Makefile.am:
* gst/debug/breakmydata.c: (gst_break_my_data_plugin_init):
* gst/debug/gstdebug.c: (plugin_init): Merge elements into one
plugin.
* gst/debug/negotiation.c: (gst_gst_negotiation_get_type),
(gst_negotiation_base_init), (gst_negotiation_class_init),
(gst_negotiation_init), (gst_negotiation_getcaps),
(gst_negotiation_pad_link), (gst_negotiation_chain),
(gst_negotiation_set_property), (gst_negotiation_get_property),
(gst_negotiation_plugin_init): New element to talk about random
negotiation things happening in a pipeline.
2004-03-31 22:36:36 +00:00
|
|
|
gst_audioscale_expand_value (&dest, value);
|
2003-12-31 08:02:04 +00:00
|
|
|
|
gst/audioscale/gstaudioscale.c: Fix getcaps to expand and union lists. (bug #138225)
Original commit message from CVS:
* gst/audioscale/gstaudioscale.c: (gst_audioscale_expand_value),
(gst_audioscale_getcaps): Fix getcaps to expand and union lists.
(bug #138225)
* gst/debug/Makefile.am:
* gst/debug/breakmydata.c: (gst_break_my_data_plugin_init):
* gst/debug/gstdebug.c: (plugin_init): Merge elements into one
plugin.
* gst/debug/negotiation.c: (gst_gst_negotiation_get_type),
(gst_negotiation_base_init), (gst_negotiation_class_init),
(gst_negotiation_init), (gst_negotiation_getcaps),
(gst_negotiation_pad_link), (gst_negotiation_chain),
(gst_negotiation_set_property), (gst_negotiation_get_property),
(gst_negotiation_plugin_init): New element to talk about random
negotiation things happening in a pipeline.
2004-03-31 22:36:36 +00:00
|
|
|
gst_structure_set_value (structure, "rate", &dest);
|
2003-09-14 11:20:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return caps;
|
|
|
|
}
|
|
|
|
|
2003-01-10 13:38:32 +00:00
|
|
|
static GstPadLinkReturn
|
2003-12-22 01:47:09 +00:00
|
|
|
gst_audioscale_link (GstPad * pad, const GstCaps * caps)
|
2001-12-22 23:21:55 +00:00
|
|
|
{
|
|
|
|
Audioscale *audioscale;
|
ext/xine/xineinput.c: call parent dispose.
Original commit message from CVS:
2004-02-23 Benjamin Otte <otte@gnome.org>
* ext/xine/xineinput.c: (gst_xine_input_dispose):
(gst_xine_input_subclass_init):
call parent dispose.
change pad template for CD reader correctly
* ext/xine/Makefile.am:
* ext/xine/gstxine.h:
* ext/xine/xine.c: (plugin_init):
* ext/xine/xineaudiosink.c:
wrap audio sinks, too
* gst-libs/gst/resample/private.h:
* gst-libs/gst/resample/resample.c: (gst_resample_init),
(gst_resample_reinit), (gst_resample_scale),
(gst_resample_nearest_s16), (gst_resample_bilinear_s16),
(gst_resample_sinc_slow_s16), (gst_resample_sinc_s16),
(gst_resample_sinc_ft_s16), (gst_resample_nearest_float),
(gst_resample_bilinear_float), (gst_resample_sinc_slow_float),
(gst_resample_sinc_float), (gst_resample_sinc_ft_float):
* gst-libs/gst/resample/resample.h:
* gst/audioscale/gstaudioscale.c: (gst_audioscale_method_get_type),
(gst_audioscale_class_init), (gst_audioscale_link),
(gst_audioscale_get_buffer), (gst_audioscale_init),
(gst_audioscale_chain), (gst_audioscale_set_property),
(gst_audioscale_get_property):
* gst/audioscale/gstaudioscale.h:
s/resample_*/gst_resample_*/i to not clobber namespaces
2004-02-23 22:21:30 +00:00
|
|
|
gst_resample_t *r;
|
2003-12-22 01:47:09 +00:00
|
|
|
GstStructure *structure;
|
|
|
|
int rate;
|
|
|
|
int channels;
|
2003-09-14 11:20:45 +00:00
|
|
|
int ret;
|
2003-12-22 01:47:09 +00:00
|
|
|
GstPadLinkReturn link_ret;
|
2003-12-31 08:02:04 +00:00
|
|
|
GstPad *otherpad;
|
2001-12-22 23:21:55 +00:00
|
|
|
|
|
|
|
audioscale = GST_AUDIOSCALE (gst_pad_get_parent (pad));
|
ext/xine/xineinput.c: call parent dispose.
Original commit message from CVS:
2004-02-23 Benjamin Otte <otte@gnome.org>
* ext/xine/xineinput.c: (gst_xine_input_dispose):
(gst_xine_input_subclass_init):
call parent dispose.
change pad template for CD reader correctly
* ext/xine/Makefile.am:
* ext/xine/gstxine.h:
* ext/xine/xine.c: (plugin_init):
* ext/xine/xineaudiosink.c:
wrap audio sinks, too
* gst-libs/gst/resample/private.h:
* gst-libs/gst/resample/resample.c: (gst_resample_init),
(gst_resample_reinit), (gst_resample_scale),
(gst_resample_nearest_s16), (gst_resample_bilinear_s16),
(gst_resample_sinc_slow_s16), (gst_resample_sinc_s16),
(gst_resample_sinc_ft_s16), (gst_resample_nearest_float),
(gst_resample_bilinear_float), (gst_resample_sinc_slow_float),
(gst_resample_sinc_float), (gst_resample_sinc_ft_float):
* gst-libs/gst/resample/resample.h:
* gst/audioscale/gstaudioscale.c: (gst_audioscale_method_get_type),
(gst_audioscale_class_init), (gst_audioscale_link),
(gst_audioscale_get_buffer), (gst_audioscale_init),
(gst_audioscale_chain), (gst_audioscale_set_property),
(gst_audioscale_get_property):
* gst/audioscale/gstaudioscale.h:
s/resample_*/gst_resample_*/i to not clobber namespaces
2004-02-23 22:21:30 +00:00
|
|
|
r = audioscale->gst_resample;
|
2001-12-22 23:21:55 +00:00
|
|
|
|
2003-12-31 08:02:04 +00:00
|
|
|
otherpad = (pad == audioscale->srcpad) ? audioscale->sinkpad
|
2004-03-14 22:34:34 +00:00
|
|
|
: audioscale->srcpad;
|
2003-12-31 08:02:04 +00:00
|
|
|
|
|
|
|
structure = gst_caps_get_structure (caps, 0);
|
|
|
|
|
|
|
|
ret = gst_structure_get_int (structure, "rate", &rate);
|
|
|
|
ret &= gst_structure_get_int (structure, "channels", &channels);
|
|
|
|
|
|
|
|
link_ret = gst_pad_try_set_caps (otherpad, gst_caps_copy (caps));
|
2004-03-14 22:34:34 +00:00
|
|
|
if (GST_PAD_LINK_SUCCESSFUL (link_ret)) {
|
2003-09-14 11:20:45 +00:00
|
|
|
audioscale->passthru = TRUE;
|
2003-12-31 08:02:04 +00:00
|
|
|
r->channels = channels;
|
|
|
|
r->i_rate = rate;
|
|
|
|
r->o_rate = rate;
|
2003-12-22 01:47:09 +00:00
|
|
|
return link_ret;
|
2003-09-14 11:20:45 +00:00
|
|
|
}
|
|
|
|
audioscale->passthru = FALSE;
|
|
|
|
|
2002-03-30 17:06:26 +00:00
|
|
|
|
2003-12-31 08:02:04 +00:00
|
|
|
if (gst_pad_is_negotiated (otherpad)) {
|
|
|
|
GstCaps *trycaps = gst_caps_copy (caps);
|
|
|
|
|
|
|
|
gst_caps_set_simple (trycaps,
|
2004-03-15 19:32:28 +00:00
|
|
|
"rate", G_TYPE_INT,
|
|
|
|
(int) ((pad == audioscale->srcpad) ? r->i_rate : r->o_rate), NULL);
|
2003-12-31 08:02:04 +00:00
|
|
|
link_ret = gst_pad_try_set_caps (otherpad, trycaps);
|
2004-03-14 22:34:34 +00:00
|
|
|
if (GST_PAD_LINK_FAILED (link_ret)) {
|
2003-12-31 08:02:04 +00:00
|
|
|
return link_ret;
|
|
|
|
}
|
|
|
|
}
|
2003-09-14 11:20:45 +00:00
|
|
|
|
2003-12-22 01:47:09 +00:00
|
|
|
r->channels = channels;
|
|
|
|
if (pad == audioscale->srcpad) {
|
2003-09-14 11:20:45 +00:00
|
|
|
r->o_rate = rate;
|
2003-12-31 08:02:04 +00:00
|
|
|
} else {
|
|
|
|
r->i_rate = rate;
|
2003-09-14 11:20:45 +00:00
|
|
|
}
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_resample_reinit (r);
|
2003-12-22 01:47:09 +00:00
|
|
|
|
|
|
|
return GST_PAD_LINK_OK;
|
2001-12-22 23:21:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void *
|
|
|
|
gst_audioscale_get_buffer (void *priv, unsigned int size)
|
|
|
|
{
|
2004-03-14 22:34:34 +00:00
|
|
|
Audioscale *audioscale = priv;
|
2001-12-22 23:21:55 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
audioscale->outbuf = gst_buffer_new ();
|
|
|
|
GST_BUFFER_SIZE (audioscale->outbuf) = size;
|
|
|
|
GST_BUFFER_DATA (audioscale->outbuf) = g_malloc (size);
|
|
|
|
GST_BUFFER_TIMESTAMP (audioscale->outbuf) =
|
|
|
|
audioscale->offset * GST_SECOND / audioscale->gst_resample->o_rate;
|
|
|
|
audioscale->offset +=
|
|
|
|
size / sizeof (gint16) / audioscale->gst_resample->channels;
|
2001-12-22 23:21:55 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
return GST_BUFFER_DATA (audioscale->outbuf);
|
2001-12-22 23:21:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_audioscale_init (Audioscale * audioscale)
|
2001-12-22 23:21:55 +00:00
|
|
|
{
|
ext/xine/xineinput.c: call parent dispose.
Original commit message from CVS:
2004-02-23 Benjamin Otte <otte@gnome.org>
* ext/xine/xineinput.c: (gst_xine_input_dispose):
(gst_xine_input_subclass_init):
call parent dispose.
change pad template for CD reader correctly
* ext/xine/Makefile.am:
* ext/xine/gstxine.h:
* ext/xine/xine.c: (plugin_init):
* ext/xine/xineaudiosink.c:
wrap audio sinks, too
* gst-libs/gst/resample/private.h:
* gst-libs/gst/resample/resample.c: (gst_resample_init),
(gst_resample_reinit), (gst_resample_scale),
(gst_resample_nearest_s16), (gst_resample_bilinear_s16),
(gst_resample_sinc_slow_s16), (gst_resample_sinc_s16),
(gst_resample_sinc_ft_s16), (gst_resample_nearest_float),
(gst_resample_bilinear_float), (gst_resample_sinc_slow_float),
(gst_resample_sinc_float), (gst_resample_sinc_ft_float):
* gst-libs/gst/resample/resample.h:
* gst/audioscale/gstaudioscale.c: (gst_audioscale_method_get_type),
(gst_audioscale_class_init), (gst_audioscale_link),
(gst_audioscale_get_buffer), (gst_audioscale_init),
(gst_audioscale_chain), (gst_audioscale_set_property),
(gst_audioscale_get_property):
* gst/audioscale/gstaudioscale.h:
s/resample_*/gst_resample_*/i to not clobber namespaces
2004-02-23 22:21:30 +00:00
|
|
|
gst_resample_t *r;
|
2001-12-22 23:21:55 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
audioscale->sinkpad =
|
|
|
|
gst_pad_new_from_template (gst_static_pad_template_get
|
|
|
|
(&gst_audioscale_sink_template), "sink");
|
|
|
|
gst_element_add_pad (GST_ELEMENT (audioscale), audioscale->sinkpad);
|
|
|
|
gst_pad_set_chain_function (audioscale->sinkpad, gst_audioscale_chain);
|
2003-12-22 01:47:09 +00:00
|
|
|
gst_pad_set_link_function (audioscale->sinkpad, gst_audioscale_link);
|
2003-09-14 11:20:45 +00:00
|
|
|
gst_pad_set_getcaps_function (audioscale->sinkpad, gst_audioscale_getcaps);
|
2001-12-22 23:21:55 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
audioscale->srcpad =
|
|
|
|
gst_pad_new_from_template (gst_static_pad_template_get
|
|
|
|
(&gst_audioscale_src_template), "src");
|
2001-12-22 23:21:55 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (audioscale), audioscale->srcpad);
|
2003-12-22 01:47:09 +00:00
|
|
|
gst_pad_set_link_function (audioscale->srcpad, gst_audioscale_link);
|
2003-09-14 11:20:45 +00:00
|
|
|
gst_pad_set_getcaps_function (audioscale->srcpad, gst_audioscale_getcaps);
|
2001-12-22 23:21:55 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
r = g_new0 (gst_resample_t, 1);
|
ext/xine/xineinput.c: call parent dispose.
Original commit message from CVS:
2004-02-23 Benjamin Otte <otte@gnome.org>
* ext/xine/xineinput.c: (gst_xine_input_dispose):
(gst_xine_input_subclass_init):
call parent dispose.
change pad template for CD reader correctly
* ext/xine/Makefile.am:
* ext/xine/gstxine.h:
* ext/xine/xine.c: (plugin_init):
* ext/xine/xineaudiosink.c:
wrap audio sinks, too
* gst-libs/gst/resample/private.h:
* gst-libs/gst/resample/resample.c: (gst_resample_init),
(gst_resample_reinit), (gst_resample_scale),
(gst_resample_nearest_s16), (gst_resample_bilinear_s16),
(gst_resample_sinc_slow_s16), (gst_resample_sinc_s16),
(gst_resample_sinc_ft_s16), (gst_resample_nearest_float),
(gst_resample_bilinear_float), (gst_resample_sinc_slow_float),
(gst_resample_sinc_float), (gst_resample_sinc_ft_float):
* gst-libs/gst/resample/resample.h:
* gst/audioscale/gstaudioscale.c: (gst_audioscale_method_get_type),
(gst_audioscale_class_init), (gst_audioscale_link),
(gst_audioscale_get_buffer), (gst_audioscale_init),
(gst_audioscale_chain), (gst_audioscale_set_property),
(gst_audioscale_get_property):
* gst/audioscale/gstaudioscale.h:
s/resample_*/gst_resample_*/i to not clobber namespaces
2004-02-23 22:21:30 +00:00
|
|
|
audioscale->gst_resample = r;
|
2001-12-22 23:21:55 +00:00
|
|
|
|
|
|
|
r->priv = audioscale;
|
|
|
|
r->get_buffer = gst_audioscale_get_buffer;
|
ext/xine/xineinput.c: call parent dispose.
Original commit message from CVS:
2004-02-23 Benjamin Otte <otte@gnome.org>
* ext/xine/xineinput.c: (gst_xine_input_dispose):
(gst_xine_input_subclass_init):
call parent dispose.
change pad template for CD reader correctly
* ext/xine/Makefile.am:
* ext/xine/gstxine.h:
* ext/xine/xine.c: (plugin_init):
* ext/xine/xineaudiosink.c:
wrap audio sinks, too
* gst-libs/gst/resample/private.h:
* gst-libs/gst/resample/resample.c: (gst_resample_init),
(gst_resample_reinit), (gst_resample_scale),
(gst_resample_nearest_s16), (gst_resample_bilinear_s16),
(gst_resample_sinc_slow_s16), (gst_resample_sinc_s16),
(gst_resample_sinc_ft_s16), (gst_resample_nearest_float),
(gst_resample_bilinear_float), (gst_resample_sinc_slow_float),
(gst_resample_sinc_float), (gst_resample_sinc_ft_float):
* gst-libs/gst/resample/resample.h:
* gst/audioscale/gstaudioscale.c: (gst_audioscale_method_get_type),
(gst_audioscale_class_init), (gst_audioscale_link),
(gst_audioscale_get_buffer), (gst_audioscale_init),
(gst_audioscale_chain), (gst_audioscale_set_property),
(gst_audioscale_get_property):
* gst/audioscale/gstaudioscale.h:
s/resample_*/gst_resample_*/i to not clobber namespaces
2004-02-23 22:21:30 +00:00
|
|
|
r->method = GST_RESAMPLE_SINC;
|
2001-12-22 23:21:55 +00:00
|
|
|
r->channels = 0;
|
|
|
|
r->filter_length = 16;
|
|
|
|
r->i_rate = -1;
|
|
|
|
r->o_rate = -1;
|
ext/xine/xineinput.c: call parent dispose.
Original commit message from CVS:
2004-02-23 Benjamin Otte <otte@gnome.org>
* ext/xine/xineinput.c: (gst_xine_input_dispose):
(gst_xine_input_subclass_init):
call parent dispose.
change pad template for CD reader correctly
* ext/xine/Makefile.am:
* ext/xine/gstxine.h:
* ext/xine/xine.c: (plugin_init):
* ext/xine/xineaudiosink.c:
wrap audio sinks, too
* gst-libs/gst/resample/private.h:
* gst-libs/gst/resample/resample.c: (gst_resample_init),
(gst_resample_reinit), (gst_resample_scale),
(gst_resample_nearest_s16), (gst_resample_bilinear_s16),
(gst_resample_sinc_slow_s16), (gst_resample_sinc_s16),
(gst_resample_sinc_ft_s16), (gst_resample_nearest_float),
(gst_resample_bilinear_float), (gst_resample_sinc_slow_float),
(gst_resample_sinc_float), (gst_resample_sinc_ft_float):
* gst-libs/gst/resample/resample.h:
* gst/audioscale/gstaudioscale.c: (gst_audioscale_method_get_type),
(gst_audioscale_class_init), (gst_audioscale_link),
(gst_audioscale_get_buffer), (gst_audioscale_init),
(gst_audioscale_chain), (gst_audioscale_set_property),
(gst_audioscale_get_property):
* gst/audioscale/gstaudioscale.h:
s/resample_*/gst_resample_*/i to not clobber namespaces
2004-02-23 22:21:30 +00:00
|
|
|
r->format = GST_RESAMPLE_S16;
|
2002-03-19 04:10:06 +00:00
|
|
|
/*r->verbose = 1; */
|
2001-12-22 23:21:55 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_resample_init (r);
|
2002-05-29 06:14:43 +00:00
|
|
|
|
|
|
|
/* we will be reinitialized when the G_PARAM_CONSTRUCTs hit */
|
2001-12-22 23:21:55 +00:00
|
|
|
}
|
|
|
|
|
2004-05-07 20:26:47 +00:00
|
|
|
static void
|
|
|
|
gst_audioscale_dispose (GObject * object)
|
|
|
|
{
|
|
|
|
Audioscale *audioscale = GST_AUDIOSCALE (object);
|
|
|
|
|
|
|
|
if (audioscale->gst_resample)
|
|
|
|
g_free (audioscale->gst_resample);
|
|
|
|
audioscale->gst_resample = NULL;
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
|
|
|
}
|
|
|
|
|
2001-12-22 23:21:55 +00:00
|
|
|
static void
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_audioscale_chain (GstPad * pad, GstData * _data)
|
2001-12-22 23:21:55 +00:00
|
|
|
{
|
2003-10-08 16:08:22 +00:00
|
|
|
GstBuffer *buf = GST_BUFFER (_data);
|
2001-12-22 23:21:55 +00:00
|
|
|
Audioscale *audioscale;
|
|
|
|
guchar *data;
|
|
|
|
gulong size;
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
g_return_if_fail (pad != NULL);
|
|
|
|
g_return_if_fail (GST_IS_PAD (pad));
|
|
|
|
g_return_if_fail (buf != NULL);
|
2001-12-22 23:21:55 +00:00
|
|
|
|
|
|
|
audioscale = GST_AUDIOSCALE (gst_pad_get_parent (pad));
|
2004-03-14 22:34:34 +00:00
|
|
|
if (audioscale->passthru) {
|
2003-10-08 16:08:22 +00:00
|
|
|
gst_pad_push (audioscale->srcpad, GST_DATA (buf));
|
2003-09-14 11:20:45 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
data = GST_BUFFER_DATA (buf);
|
|
|
|
size = GST_BUFFER_SIZE (buf);
|
2001-12-22 23:21:55 +00:00
|
|
|
|
2003-12-31 08:02:04 +00:00
|
|
|
GST_DEBUG ("gst_audioscale_chain: got buffer of %ld bytes in '%s'\n",
|
|
|
|
size, gst_element_get_name (GST_ELEMENT (audioscale)));
|
2001-12-22 23:21:55 +00:00
|
|
|
|
ext/xine/xineinput.c: call parent dispose.
Original commit message from CVS:
2004-02-23 Benjamin Otte <otte@gnome.org>
* ext/xine/xineinput.c: (gst_xine_input_dispose):
(gst_xine_input_subclass_init):
call parent dispose.
change pad template for CD reader correctly
* ext/xine/Makefile.am:
* ext/xine/gstxine.h:
* ext/xine/xine.c: (plugin_init):
* ext/xine/xineaudiosink.c:
wrap audio sinks, too
* gst-libs/gst/resample/private.h:
* gst-libs/gst/resample/resample.c: (gst_resample_init),
(gst_resample_reinit), (gst_resample_scale),
(gst_resample_nearest_s16), (gst_resample_bilinear_s16),
(gst_resample_sinc_slow_s16), (gst_resample_sinc_s16),
(gst_resample_sinc_ft_s16), (gst_resample_nearest_float),
(gst_resample_bilinear_float), (gst_resample_sinc_slow_float),
(gst_resample_sinc_float), (gst_resample_sinc_ft_float):
* gst-libs/gst/resample/resample.h:
* gst/audioscale/gstaudioscale.c: (gst_audioscale_method_get_type),
(gst_audioscale_class_init), (gst_audioscale_link),
(gst_audioscale_get_buffer), (gst_audioscale_init),
(gst_audioscale_chain), (gst_audioscale_set_property),
(gst_audioscale_get_property):
* gst/audioscale/gstaudioscale.h:
s/resample_*/gst_resample_*/i to not clobber namespaces
2004-02-23 22:21:30 +00:00
|
|
|
gst_resample_scale (audioscale->gst_resample, data, size);
|
2001-12-22 23:21:55 +00:00
|
|
|
|
2003-10-08 16:08:22 +00:00
|
|
|
gst_pad_push (audioscale->srcpad, GST_DATA (audioscale->outbuf));
|
2001-12-22 23:21:55 +00:00
|
|
|
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_audioscale_set_property (GObject * object, guint prop_id,
|
2004-03-14 22:34:34 +00:00
|
|
|
const GValue * value, GParamSpec * pspec)
|
2001-12-22 23:21:55 +00:00
|
|
|
{
|
|
|
|
Audioscale *src;
|
ext/xine/xineinput.c: call parent dispose.
Original commit message from CVS:
2004-02-23 Benjamin Otte <otte@gnome.org>
* ext/xine/xineinput.c: (gst_xine_input_dispose):
(gst_xine_input_subclass_init):
call parent dispose.
change pad template for CD reader correctly
* ext/xine/Makefile.am:
* ext/xine/gstxine.h:
* ext/xine/xine.c: (plugin_init):
* ext/xine/xineaudiosink.c:
wrap audio sinks, too
* gst-libs/gst/resample/private.h:
* gst-libs/gst/resample/resample.c: (gst_resample_init),
(gst_resample_reinit), (gst_resample_scale),
(gst_resample_nearest_s16), (gst_resample_bilinear_s16),
(gst_resample_sinc_slow_s16), (gst_resample_sinc_s16),
(gst_resample_sinc_ft_s16), (gst_resample_nearest_float),
(gst_resample_bilinear_float), (gst_resample_sinc_slow_float),
(gst_resample_sinc_float), (gst_resample_sinc_ft_float):
* gst-libs/gst/resample/resample.h:
* gst/audioscale/gstaudioscale.c: (gst_audioscale_method_get_type),
(gst_audioscale_class_init), (gst_audioscale_link),
(gst_audioscale_get_buffer), (gst_audioscale_init),
(gst_audioscale_chain), (gst_audioscale_set_property),
(gst_audioscale_get_property):
* gst/audioscale/gstaudioscale.h:
s/resample_*/gst_resample_*/i to not clobber namespaces
2004-02-23 22:21:30 +00:00
|
|
|
gst_resample_t *r;
|
2001-12-22 23:21:55 +00:00
|
|
|
|
|
|
|
/* it's not null if we got it, but it might not be ours */
|
2004-03-14 22:34:34 +00:00
|
|
|
g_return_if_fail (GST_IS_AUDIOSCALE (object));
|
|
|
|
src = GST_AUDIOSCALE (object);
|
ext/xine/xineinput.c: call parent dispose.
Original commit message from CVS:
2004-02-23 Benjamin Otte <otte@gnome.org>
* ext/xine/xineinput.c: (gst_xine_input_dispose):
(gst_xine_input_subclass_init):
call parent dispose.
change pad template for CD reader correctly
* ext/xine/Makefile.am:
* ext/xine/gstxine.h:
* ext/xine/xine.c: (plugin_init):
* ext/xine/xineaudiosink.c:
wrap audio sinks, too
* gst-libs/gst/resample/private.h:
* gst-libs/gst/resample/resample.c: (gst_resample_init),
(gst_resample_reinit), (gst_resample_scale),
(gst_resample_nearest_s16), (gst_resample_bilinear_s16),
(gst_resample_sinc_slow_s16), (gst_resample_sinc_s16),
(gst_resample_sinc_ft_s16), (gst_resample_nearest_float),
(gst_resample_bilinear_float), (gst_resample_sinc_slow_float),
(gst_resample_sinc_float), (gst_resample_sinc_ft_float):
* gst-libs/gst/resample/resample.h:
* gst/audioscale/gstaudioscale.c: (gst_audioscale_method_get_type),
(gst_audioscale_class_init), (gst_audioscale_link),
(gst_audioscale_get_buffer), (gst_audioscale_init),
(gst_audioscale_chain), (gst_audioscale_set_property),
(gst_audioscale_get_property):
* gst/audioscale/gstaudioscale.h:
s/resample_*/gst_resample_*/i to not clobber namespaces
2004-02-23 22:21:30 +00:00
|
|
|
r = src->gst_resample;
|
2001-12-22 23:21:55 +00:00
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
case ARG_FILTERLEN:
|
|
|
|
r->filter_length = g_value_get_int (value);
|
2004-03-14 22:34:34 +00:00
|
|
|
GST_DEBUG_OBJECT (GST_ELEMENT (src), "new filter length %d\n",
|
2004-03-15 19:32:28 +00:00
|
|
|
r->filter_length);
|
2001-12-22 23:21:55 +00:00
|
|
|
break;
|
|
|
|
case ARG_METHOD:
|
2002-05-29 06:14:43 +00:00
|
|
|
r->method = g_value_get_enum (value);
|
2001-12-22 23:21:55 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
2002-05-29 06:14:43 +00:00
|
|
|
|
ext/xine/xineinput.c: call parent dispose.
Original commit message from CVS:
2004-02-23 Benjamin Otte <otte@gnome.org>
* ext/xine/xineinput.c: (gst_xine_input_dispose):
(gst_xine_input_subclass_init):
call parent dispose.
change pad template for CD reader correctly
* ext/xine/Makefile.am:
* ext/xine/gstxine.h:
* ext/xine/xine.c: (plugin_init):
* ext/xine/xineaudiosink.c:
wrap audio sinks, too
* gst-libs/gst/resample/private.h:
* gst-libs/gst/resample/resample.c: (gst_resample_init),
(gst_resample_reinit), (gst_resample_scale),
(gst_resample_nearest_s16), (gst_resample_bilinear_s16),
(gst_resample_sinc_slow_s16), (gst_resample_sinc_s16),
(gst_resample_sinc_ft_s16), (gst_resample_nearest_float),
(gst_resample_bilinear_float), (gst_resample_sinc_slow_float),
(gst_resample_sinc_float), (gst_resample_sinc_ft_float):
* gst-libs/gst/resample/resample.h:
* gst/audioscale/gstaudioscale.c: (gst_audioscale_method_get_type),
(gst_audioscale_class_init), (gst_audioscale_link),
(gst_audioscale_get_buffer), (gst_audioscale_init),
(gst_audioscale_chain), (gst_audioscale_set_property),
(gst_audioscale_get_property):
* gst/audioscale/gstaudioscale.h:
s/resample_*/gst_resample_*/i to not clobber namespaces
2004-02-23 22:21:30 +00:00
|
|
|
gst_resample_reinit (r);
|
2001-12-22 23:21:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_audioscale_get_property (GObject * object, guint prop_id, GValue * value,
|
|
|
|
GParamSpec * pspec)
|
2001-12-22 23:21:55 +00:00
|
|
|
{
|
|
|
|
Audioscale *src;
|
ext/xine/xineinput.c: call parent dispose.
Original commit message from CVS:
2004-02-23 Benjamin Otte <otte@gnome.org>
* ext/xine/xineinput.c: (gst_xine_input_dispose):
(gst_xine_input_subclass_init):
call parent dispose.
change pad template for CD reader correctly
* ext/xine/Makefile.am:
* ext/xine/gstxine.h:
* ext/xine/xine.c: (plugin_init):
* ext/xine/xineaudiosink.c:
wrap audio sinks, too
* gst-libs/gst/resample/private.h:
* gst-libs/gst/resample/resample.c: (gst_resample_init),
(gst_resample_reinit), (gst_resample_scale),
(gst_resample_nearest_s16), (gst_resample_bilinear_s16),
(gst_resample_sinc_slow_s16), (gst_resample_sinc_s16),
(gst_resample_sinc_ft_s16), (gst_resample_nearest_float),
(gst_resample_bilinear_float), (gst_resample_sinc_slow_float),
(gst_resample_sinc_float), (gst_resample_sinc_ft_float):
* gst-libs/gst/resample/resample.h:
* gst/audioscale/gstaudioscale.c: (gst_audioscale_method_get_type),
(gst_audioscale_class_init), (gst_audioscale_link),
(gst_audioscale_get_buffer), (gst_audioscale_init),
(gst_audioscale_chain), (gst_audioscale_set_property),
(gst_audioscale_get_property):
* gst/audioscale/gstaudioscale.h:
s/resample_*/gst_resample_*/i to not clobber namespaces
2004-02-23 22:21:30 +00:00
|
|
|
gst_resample_t *r;
|
2001-12-22 23:21:55 +00:00
|
|
|
|
2002-05-29 06:14:43 +00:00
|
|
|
src = GST_AUDIOSCALE (object);
|
ext/xine/xineinput.c: call parent dispose.
Original commit message from CVS:
2004-02-23 Benjamin Otte <otte@gnome.org>
* ext/xine/xineinput.c: (gst_xine_input_dispose):
(gst_xine_input_subclass_init):
call parent dispose.
change pad template for CD reader correctly
* ext/xine/Makefile.am:
* ext/xine/gstxine.h:
* ext/xine/xine.c: (plugin_init):
* ext/xine/xineaudiosink.c:
wrap audio sinks, too
* gst-libs/gst/resample/private.h:
* gst-libs/gst/resample/resample.c: (gst_resample_init),
(gst_resample_reinit), (gst_resample_scale),
(gst_resample_nearest_s16), (gst_resample_bilinear_s16),
(gst_resample_sinc_slow_s16), (gst_resample_sinc_s16),
(gst_resample_sinc_ft_s16), (gst_resample_nearest_float),
(gst_resample_bilinear_float), (gst_resample_sinc_slow_float),
(gst_resample_sinc_float), (gst_resample_sinc_ft_float):
* gst-libs/gst/resample/resample.h:
* gst/audioscale/gstaudioscale.c: (gst_audioscale_method_get_type),
(gst_audioscale_class_init), (gst_audioscale_link),
(gst_audioscale_get_buffer), (gst_audioscale_init),
(gst_audioscale_chain), (gst_audioscale_set_property),
(gst_audioscale_get_property):
* gst/audioscale/gstaudioscale.h:
s/resample_*/gst_resample_*/i to not clobber namespaces
2004-02-23 22:21:30 +00:00
|
|
|
r = src->gst_resample;
|
2001-12-22 23:21:55 +00:00
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
case ARG_FILTERLEN:
|
|
|
|
g_value_set_int (value, r->filter_length);
|
|
|
|
break;
|
|
|
|
case ARG_METHOD:
|
2002-05-29 06:14:43 +00:00
|
|
|
g_value_set_enum (value, r->method);
|
2001-12-22 23:21:55 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static gboolean
|
2004-03-14 22:34:34 +00:00
|
|
|
plugin_init (GstPlugin * plugin)
|
2001-12-22 23:21:55 +00:00
|
|
|
{
|
2002-01-12 03:29:57 +00:00
|
|
|
/* load support library */
|
|
|
|
if (!gst_library_load ("gstresample"))
|
|
|
|
return FALSE;
|
|
|
|
|
2003-11-01 01:24:30 +00:00
|
|
|
if (!gst_element_register (plugin, "audioscale", GST_RANK_NONE,
|
2004-03-15 19:32:28 +00:00
|
|
|
GST_TYPE_AUDIOSCALE)) {
|
2003-11-01 01:24:30 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2001-12-22 23:21:55 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
|
|
|
GST_VERSION_MINOR,
|
|
|
|
"audioscale",
|
|
|
|
"Resamples audio", plugin_init, VERSION, "LGPL", GST_PACKAGE, GST_ORIGIN)
|