summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Kost <ensonic@users.sf.net>2010-02-01 22:32:32 +0200
committerStefan Kost <ensonic@users.sf.net>2010-02-01 22:32:32 +0200
commitebdf1c2a18405052be242ec115380d00088775cd (patch)
treea7dd11e19b31f0144cbfa8f42800dba9467209b8
parent8f1bb31255e5ca2a1a300c60c6a54460101e014c (diff)
signalprocessor,lv2,ladspa: move sample-rate to baseclass
We need the sample-rate in baseclass for upcomming timestamp changes.
-rw-r--r--ext/ladspa/gstladspa.c16
-rw-r--r--ext/lv2/gstlv2.c14
-rw-r--r--gst-libs/gst/signalprocessor/gstsignalprocessor.c14
-rw-r--r--gst-libs/gst/signalprocessor/gstsignalprocessor.h4
4 files changed, 23 insertions, 25 deletions
diff --git a/ext/ladspa/gstladspa.c b/ext/ladspa/gstladspa.c
index e6dd148b5..501973457 100644
--- a/ext/ladspa/gstladspa.c
+++ b/ext/ladspa/gstladspa.c
@@ -555,8 +555,6 @@ gst_ladspa_setup (GstSignalProcessor * gsp, GstCaps * caps)
GstLADSPAClass *oclass;
GstSignalProcessorClass *gsp_class;
LADSPA_Descriptor *desc;
- GstStructure *s;
- gint sample_rate;
gint i;
gsp_class = GST_SIGNAL_PROCESSOR_GET_CLASS (gsp);
@@ -567,13 +565,10 @@ gst_ladspa_setup (GstSignalProcessor * gsp, GstCaps * caps)
g_return_val_if_fail (ladspa->handle == NULL, FALSE);
g_return_val_if_fail (ladspa->activated == FALSE, FALSE);
- s = gst_caps_get_structure (caps, 0);
- if (!gst_structure_get_int (s, "rate", &sample_rate))
- goto no_sample_rate;
+ GST_DEBUG_OBJECT (ladspa, "instantiating the plugin at %d Hz",
+ gsp->sample_rate);
- GST_DEBUG_OBJECT (ladspa, "instantiating the plugin at %d Hz", sample_rate);
-
- if (!(ladspa->handle = desc->instantiate (desc, sample_rate)))
+ if (!(ladspa->handle = desc->instantiate (desc, gsp->sample_rate)))
goto no_instance;
/* connect the control ports */
@@ -586,11 +581,6 @@ gst_ladspa_setup (GstSignalProcessor * gsp, GstCaps * caps)
return TRUE;
-no_sample_rate:
- {
- GST_WARNING_OBJECT (gsp, "got no sample-rate");
- return FALSE;
- }
no_instance:
{
GST_WARNING_OBJECT (gsp, "could not create instance");
diff --git a/ext/lv2/gstlv2.c b/ext/lv2/gstlv2.c
index bb8cfc89a..4c01230ba 100644
--- a/ext/lv2/gstlv2.c
+++ b/ext/lv2/gstlv2.c
@@ -600,7 +600,6 @@ gst_lv2_setup (GstSignalProcessor * gsp, GstCaps * caps)
GstLV2Class *oclass;
GstSignalProcessorClass *gsp_class;
GstStructure *s;
- gint sample_rate;
gint i;
GstLV2Group *group = NULL;
GstAudioChannelPosition *positions = NULL;
@@ -613,14 +612,10 @@ gst_lv2_setup (GstSignalProcessor * gsp, GstCaps * caps)
g_return_val_if_fail (lv2->activated == FALSE, FALSE);
- s = gst_caps_get_structure (caps, 0);
- if (!gst_structure_get_int (s, "rate", &sample_rate))
- goto no_sample_rate;
-
- GST_DEBUG_OBJECT (lv2, "instantiating the plugin at %d Hz", sample_rate);
+ GST_DEBUG_OBJECT (lv2, "instantiating the plugin at %d Hz", gsp->sample_rate);
if (!(lv2->instance =
- slv2_plugin_instantiate (oclass->plugin, sample_rate, NULL)))
+ slv2_plugin_instantiate (oclass->plugin, gsp->sample_rate, NULL)))
goto no_instance;
/* connect the control ports */
@@ -673,11 +668,6 @@ gst_lv2_setup (GstSignalProcessor * gsp, GstCaps * caps)
}
return TRUE;
-no_sample_rate:
- {
- GST_WARNING_OBJECT (gsp, "got no sample-rate");
- return FALSE;
- }
no_instance:
{
GST_WARNING_OBJECT (gsp, "could not create instance");
diff --git a/gst-libs/gst/signalprocessor/gstsignalprocessor.c b/gst-libs/gst/signalprocessor/gstsignalprocessor.c
index bae230e5f..435ced8e9 100644
--- a/gst-libs/gst/signalprocessor/gstsignalprocessor.c
+++ b/gst-libs/gst/signalprocessor/gstsignalprocessor.c
@@ -471,6 +471,8 @@ gst_signal_processor_setcaps (GstPad * pad, GstCaps * caps)
/* the whole processor has one caps; if the sample rate changes, let subclass
implementations know */
if (!gst_caps_is_equal (caps, self->caps)) {
+ GstStructure *s;
+
GST_DEBUG_OBJECT (pad, "got caps %" GST_PTR_FORMAT, caps);
if (GST_SIGNAL_PROCESSOR_IS_RUNNING (self))
@@ -478,6 +480,10 @@ gst_signal_processor_setcaps (GstPad * pad, GstCaps * caps)
if (GST_SIGNAL_PROCESSOR_IS_INITIALIZED (self))
gst_signal_processor_cleanup (self);
+ s = gst_caps_get_structure (caps, 0);
+ if (!gst_structure_get_int (s, "rate", &self->sample_rate))
+ goto no_sample_rate;
+
if (!gst_signal_processor_setup (self, caps))
goto start_or_setup_failed;
@@ -502,13 +508,21 @@ gst_signal_processor_setcaps (GstPad * pad, GstCaps * caps)
return TRUE;
+no_sample_rate:
+ {
+ GST_WARNING_OBJECT (self, "got no sample-rate");
+ gst_object_unref (self);
+ return FALSE;
+ }
start_or_setup_failed:
{
+ GST_WARNING_OBJECT (self, "start or setup failed");
gst_object_unref (self);
return FALSE;
}
setcaps_pull_failed:
{
+ GST_WARNING_OBJECT (self, "activating in pull-mode failed");
gst_object_unref (self);
return FALSE;
}
diff --git a/gst-libs/gst/signalprocessor/gstsignalprocessor.h b/gst-libs/gst/signalprocessor/gstsignalprocessor.h
index cad85e9c6..4d512e146 100644
--- a/gst-libs/gst/signalprocessor/gstsignalprocessor.h
+++ b/gst-libs/gst/signalprocessor/gstsignalprocessor.h
@@ -100,6 +100,10 @@ struct _GstSignalProcessor {
/* controls */
gfloat *control_in;
gfloat *control_out;
+
+ /* sampling rate */
+ gint sample_rate;
+
};
struct _GstSignalProcessorClass {