GstVideoInfo sink_vinfo;
GstVideoInfo alpha_vinfo;
GstVideoFormat src_format;
+
+ guint sink_format_cookie;
+ guint alpha_format_cookie;
};
#define gst_alpha_combine_parent_class parent_class
g_mutex_lock (&self->buffer_lock);
g_assert (self->flushing);
self->flushing--;
+
+ /* Reset the format cookies to ensure they are equal */
+ if (!self->flushing) {
+ self->sink_format_cookie = 0;
+ self->alpha_format_cookie = 0;
+ }
+
g_mutex_unlock (&self->buffer_lock);
}
GstVideoFormat sink_format, src_format = GST_VIDEO_FORMAT_UNKNOWN;
GstEvent *event;
gint i;
+ gboolean ret;
if (!gst_video_info_from_caps (&self->sink_vinfo, caps)) {
GST_ELEMENT_ERROR (self, STREAM, FORMAT, ("Invalid video format"), (NULL));
event = gst_event_new_caps (caps);
gst_caps_unref (caps);
- return gst_pad_push_event (self->src_pad, event);
+ ret = gst_pad_push_event (self->src_pad, event);
+
+ /* signal the sink format change */
+ g_mutex_lock (&self->buffer_lock);
+ self->sink_format_cookie++;
+ g_cond_signal (&self->buffer_cond);
+ g_mutex_unlock (&self->buffer_lock);
+
+ return ret;
}
static gboolean
return FALSE;
}
+ self->alpha_format_cookie++;
+
+ /* wait for the matching format change on the sink pad */
+ while (self->alpha_format_cookie != self->sink_format_cookie &&
+ !self->flushing)
+ g_cond_wait (&self->buffer_cond, &self->buffer_lock);
+
g_mutex_unlock (&self->buffer_lock);
return TRUE;
self->src_format = GST_VIDEO_FORMAT_UNKNOWN;
gst_video_info_init (&self->sink_vinfo);
gst_video_info_init (&self->alpha_vinfo);
+ self->sink_format_cookie = 0;
+ self->alpha_format_cookie = 0;
break;
default:
break;