mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 10:11:08 +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;
|
GstLADSPAClass *oclass;
|
||||||
GstSignalProcessorClass *gsp_class;
|
GstSignalProcessorClass *gsp_class;
|
||||||
LADSPA_Descriptor *desc;
|
LADSPA_Descriptor *desc;
|
||||||
GstStructure *s;
|
|
||||||
gint sample_rate;
|
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
gsp_class = GST_SIGNAL_PROCESSOR_GET_CLASS (gsp);
|
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->handle == NULL, FALSE);
|
||||||
g_return_val_if_fail (ladspa->activated == FALSE, FALSE);
|
g_return_val_if_fail (ladspa->activated == FALSE, FALSE);
|
||||||
|
|
||||||
s = gst_caps_get_structure (caps, 0);
|
GST_DEBUG_OBJECT (ladspa, "instantiating the plugin at %d Hz",
|
||||||
if (!gst_structure_get_int (s, "rate", &sample_rate))
|
gsp->sample_rate);
|
||||||
goto no_sample_rate;
|
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (ladspa, "instantiating the plugin at %d Hz", sample_rate);
|
if (!(ladspa->handle = desc->instantiate (desc, gsp->sample_rate)))
|
||||||
|
|
||||||
if (!(ladspa->handle = desc->instantiate (desc, sample_rate)))
|
|
||||||
goto no_instance;
|
goto no_instance;
|
||||||
|
|
||||||
/* connect the control ports */
|
/* connect the control ports */
|
||||||
|
@ -586,11 +581,6 @@ gst_ladspa_setup (GstSignalProcessor * gsp, GstCaps * caps)
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
no_sample_rate:
|
|
||||||
{
|
|
||||||
GST_WARNING_OBJECT (gsp, "got no sample-rate");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
no_instance:
|
no_instance:
|
||||||
{
|
{
|
||||||
GST_WARNING_OBJECT (gsp, "could not create instance");
|
GST_WARNING_OBJECT (gsp, "could not create instance");
|
||||||
|
|
|
@ -600,7 +600,6 @@ gst_lv2_setup (GstSignalProcessor * gsp, GstCaps * caps)
|
||||||
GstLV2Class *oclass;
|
GstLV2Class *oclass;
|
||||||
GstSignalProcessorClass *gsp_class;
|
GstSignalProcessorClass *gsp_class;
|
||||||
GstStructure *s;
|
GstStructure *s;
|
||||||
gint sample_rate;
|
|
||||||
gint i;
|
gint i;
|
||||||
GstLV2Group *group = NULL;
|
GstLV2Group *group = NULL;
|
||||||
GstAudioChannelPosition *positions = NULL;
|
GstAudioChannelPosition *positions = NULL;
|
||||||
|
@ -613,14 +612,10 @@ gst_lv2_setup (GstSignalProcessor * gsp, GstCaps * caps)
|
||||||
|
|
||||||
g_return_val_if_fail (lv2->activated == FALSE, FALSE);
|
g_return_val_if_fail (lv2->activated == FALSE, FALSE);
|
||||||
|
|
||||||
s = gst_caps_get_structure (caps, 0);
|
GST_DEBUG_OBJECT (lv2, "instantiating the plugin at %d Hz", gsp->sample_rate);
|
||||||
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);
|
|
||||||
|
|
||||||
if (!(lv2->instance =
|
if (!(lv2->instance =
|
||||||
slv2_plugin_instantiate (oclass->plugin, sample_rate, NULL)))
|
slv2_plugin_instantiate (oclass->plugin, gsp->sample_rate, NULL)))
|
||||||
goto no_instance;
|
goto no_instance;
|
||||||
|
|
||||||
/* connect the control ports */
|
/* connect the control ports */
|
||||||
|
@ -673,11 +668,6 @@ gst_lv2_setup (GstSignalProcessor * gsp, GstCaps * caps)
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
no_sample_rate:
|
|
||||||
{
|
|
||||||
GST_WARNING_OBJECT (gsp, "got no sample-rate");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
no_instance:
|
no_instance:
|
||||||
{
|
{
|
||||||
GST_WARNING_OBJECT (gsp, "could not create 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
|
/* the whole processor has one caps; if the sample rate changes, let subclass
|
||||||
implementations know */
|
implementations know */
|
||||||
if (!gst_caps_is_equal (caps, self->caps)) {
|
if (!gst_caps_is_equal (caps, self->caps)) {
|
||||||
|
GstStructure *s;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (pad, "got caps %" GST_PTR_FORMAT, caps);
|
GST_DEBUG_OBJECT (pad, "got caps %" GST_PTR_FORMAT, caps);
|
||||||
|
|
||||||
if (GST_SIGNAL_PROCESSOR_IS_RUNNING (self))
|
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))
|
if (GST_SIGNAL_PROCESSOR_IS_INITIALIZED (self))
|
||||||
gst_signal_processor_cleanup (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))
|
if (!gst_signal_processor_setup (self, caps))
|
||||||
goto start_or_setup_failed;
|
goto start_or_setup_failed;
|
||||||
|
|
||||||
|
@ -502,13 +508,21 @@ gst_signal_processor_setcaps (GstPad * pad, GstCaps * caps)
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
no_sample_rate:
|
||||||
|
{
|
||||||
|
GST_WARNING_OBJECT (self, "got no sample-rate");
|
||||||
|
gst_object_unref (self);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
start_or_setup_failed:
|
start_or_setup_failed:
|
||||||
{
|
{
|
||||||
|
GST_WARNING_OBJECT (self, "start or setup failed");
|
||||||
gst_object_unref (self);
|
gst_object_unref (self);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
setcaps_pull_failed:
|
setcaps_pull_failed:
|
||||||
{
|
{
|
||||||
|
GST_WARNING_OBJECT (self, "activating in pull-mode failed");
|
||||||
gst_object_unref (self);
|
gst_object_unref (self);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,6 +100,10 @@ struct _GstSignalProcessor {
|
||||||
/* controls */
|
/* controls */
|
||||||
gfloat *control_in;
|
gfloat *control_in;
|
||||||
gfloat *control_out;
|
gfloat *control_out;
|
||||||
|
|
||||||
|
/* sampling rate */
|
||||||
|
gint sample_rate;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstSignalProcessorClass {
|
struct _GstSignalProcessorClass {
|
||||||
|
|
Loading…
Reference in a new issue