mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-19 16:21:17 +00:00
signalprocessor,lv2,ladspa: move sample-rate to baseclass
We need the sample-rate in baseclass for upcomming timestamp changes.
This commit is contained in:
parent
8f1bb31255
commit
ebdf1c2a18
4 changed files with 23 additions and 25 deletions
|
@ -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");
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -100,6 +100,10 @@ struct _GstSignalProcessor {
|
|||
/* controls */
|
||||
gfloat *control_in;
|
||||
gfloat *control_out;
|
||||
|
||||
/* sampling rate */
|
||||
gint sample_rate;
|
||||
|
||||
};
|
||||
|
||||
struct _GstSignalProcessorClass {
|
||||
|
|
Loading…
Reference in a new issue