frei0r: In the filter plugins create the frei0r instances in create() before playback starts
This commit is contained in:
parent
0de4e9df00
commit
72fca8a828
@ -40,22 +40,11 @@ gst_frei0r_filter_set_caps (GstBaseTransform * trans, GstCaps * incaps,
|
|||||||
GstCaps * outcaps)
|
GstCaps * outcaps)
|
||||||
{
|
{
|
||||||
GstFrei0rFilter *self = GST_FREI0R_FILTER (trans);
|
GstFrei0rFilter *self = GST_FREI0R_FILTER (trans);
|
||||||
GstFrei0rFilterClass *klass = GST_FREI0R_FILTER_GET_CLASS (trans);
|
|
||||||
GstVideoFormat fmt;
|
GstVideoFormat fmt;
|
||||||
gint width, height;
|
|
||||||
|
|
||||||
if (!gst_video_format_parse_caps (incaps, &fmt, &width, &height))
|
if (!gst_video_format_parse_caps (incaps, &fmt, &self->width, &self->height))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (self->f0r_instance) {
|
|
||||||
klass->ftable->destruct (self->f0r_instance);
|
|
||||||
self->f0r_instance = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
self->f0r_instance =
|
|
||||||
gst_frei0r_instance_construct (klass->ftable, klass->properties,
|
|
||||||
klass->n_properties, self->property_cache, width, height);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,9 +70,17 @@ gst_frei0r_filter_transform (GstBaseTransform * trans, GstBuffer * inbuf,
|
|||||||
GstFrei0rFilterClass *klass = GST_FREI0R_FILTER_GET_CLASS (trans);
|
GstFrei0rFilterClass *klass = GST_FREI0R_FILTER_GET_CLASS (trans);
|
||||||
gdouble time;
|
gdouble time;
|
||||||
|
|
||||||
if (!self->f0r_instance)
|
if (G_UNLIKELY (self->width <= 0 || self->height <= 0))
|
||||||
return GST_FLOW_NOT_NEGOTIATED;
|
return GST_FLOW_NOT_NEGOTIATED;
|
||||||
|
|
||||||
|
if (G_UNLIKELY (!self->f0r_instance)) {
|
||||||
|
self->f0r_instance =
|
||||||
|
gst_frei0r_instance_construct (klass->ftable, klass->properties,
|
||||||
|
klass->n_properties, self->property_cache, self->width, self->height);
|
||||||
|
if (G_UNLIKELY (!self->f0r_instance))
|
||||||
|
return GST_FLOW_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
time = ((gdouble) GST_BUFFER_TIMESTAMP (inbuf)) / GST_SECOND;
|
time = ((gdouble) GST_BUFFER_TIMESTAMP (inbuf)) / GST_SECOND;
|
||||||
|
|
||||||
if (klass->ftable->update2)
|
if (klass->ftable->update2)
|
||||||
|
@ -42,6 +42,8 @@ typedef struct _GstFrei0rFilterClass GstFrei0rFilterClass;
|
|||||||
struct _GstFrei0rFilter {
|
struct _GstFrei0rFilter {
|
||||||
GstVideoFilter parent;
|
GstVideoFilter parent;
|
||||||
|
|
||||||
|
gint width, height;
|
||||||
|
|
||||||
f0r_instance_t *f0r_instance;
|
f0r_instance_t *f0r_instance;
|
||||||
GstFrei0rPropertyValue *property_cache;
|
GstFrei0rPropertyValue *property_cache;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user