diff options
author | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2009-06-29 11:59:13 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2009-06-29 11:59:13 +0200 |
commit | 72fca8a828b05b9dbf2b02b7754006755954fc47 (patch) | |
tree | 44f3f00c2c475ca93772fa583224806670326610 /gst/frei0r | |
parent | 0de4e9df00e2dfe2671631e696731d84d51d5829 (diff) | |
download | gst-plugins-bad-72fca8a828b05b9dbf2b02b7754006755954fc47.tar.gz gst-plugins-bad-72fca8a828b05b9dbf2b02b7754006755954fc47.tar.bz2 gst-plugins-bad-72fca8a828b05b9dbf2b02b7754006755954fc47.zip |
frei0r: In the filter plugins create the frei0r instances in create() before playback starts
Diffstat (limited to 'gst/frei0r')
-rw-r--r-- | gst/frei0r/gstfrei0rfilter.c | 23 | ||||
-rw-r--r-- | gst/frei0r/gstfrei0rfilter.h | 2 |
2 files changed, 12 insertions, 13 deletions
diff --git a/gst/frei0r/gstfrei0rfilter.c b/gst/frei0r/gstfrei0rfilter.c index 174d8c51..834e1899 100644 --- a/gst/frei0r/gstfrei0rfilter.c +++ b/gst/frei0r/gstfrei0rfilter.c @@ -40,22 +40,11 @@ gst_frei0r_filter_set_caps (GstBaseTransform * trans, GstCaps * incaps, GstCaps * outcaps) { GstFrei0rFilter *self = GST_FREI0R_FILTER (trans); - GstFrei0rFilterClass *klass = GST_FREI0R_FILTER_GET_CLASS (trans); 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; - 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; } @@ -81,9 +70,17 @@ gst_frei0r_filter_transform (GstBaseTransform * trans, GstBuffer * inbuf, GstFrei0rFilterClass *klass = GST_FREI0R_FILTER_GET_CLASS (trans); gdouble time; - if (!self->f0r_instance) + if (G_UNLIKELY (self->width <= 0 || self->height <= 0)) 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; if (klass->ftable->update2) diff --git a/gst/frei0r/gstfrei0rfilter.h b/gst/frei0r/gstfrei0rfilter.h index ded2172b..b85c3f6e 100644 --- a/gst/frei0r/gstfrei0rfilter.h +++ b/gst/frei0r/gstfrei0rfilter.h @@ -42,6 +42,8 @@ typedef struct _GstFrei0rFilterClass GstFrei0rFilterClass; struct _GstFrei0rFilter { GstVideoFilter parent; + gint width, height; + f0r_instance_t *f0r_instance; GstFrei0rPropertyValue *property_cache; }; |