static gboolean gst_shape_wipe_video_sink_event (GstPad * pad, GstObject * parent, GstEvent * event) { GstShapeWipe *self = GST_SHAPE_WIPE (parent); gboolean ret; GST_LOG_OBJECT (pad, "Got %s event", GST_EVENT_TYPE_NAME (event)); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_CAPS: { GstCaps *caps; gst_event_parse_caps (event, &caps); ret = gst_shape_wipe_video_sink_setcaps (self, caps); gst_event_unref (event); break; } case GST_EVENT_SEGMENT: { GstSegment seg; gst_event_copy_segment (event, &seg); if (seg.format == GST_FORMAT_TIME) { GST_DEBUG_OBJECT (pad, "Got SEGMENT event in GST_FORMAT_TIME %" GST_PTR_FORMAT, &seg); self->segment = seg; } else { gst_segment_init (&self->segment, GST_FORMAT_TIME); } } /* fall through */ case GST_EVENT_FLUSH_STOP: gst_shape_wipe_reset_qos (self); /* fall through */ default: ret = gst_pad_push_event (self->srcpad, event); break; } return ret; }
static void gst_shape_wipe_reset (GstShapeWipe * self) { if (self->mask) gst_buffer_unref (self->mask); self->mask = NULL; g_cond_signal (self->mask_cond); self->fmt = GST_VIDEO_FORMAT_UNKNOWN; self->width = self->height = 0; self->mask_position = 0.0; self->mask_border = 0.0; self->mask_bpp = 0; gst_segment_init (&self->segment, GST_FORMAT_TIME); gst_shape_wipe_reset_qos (self); self->frame_duration = 0; }
static gboolean gst_shape_wipe_video_sink_event (GstPad * pad, GstEvent * event) { GstShapeWipe *self = GST_SHAPE_WIPE (gst_pad_get_parent (pad)); gboolean ret; GST_DEBUG_OBJECT (pad, "Got %s event", GST_EVENT_TYPE_NAME (event)); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_NEWSEGMENT:{ GstFormat fmt; gboolean is_update; gint64 start, end, base; gdouble rate; gst_event_parse_new_segment (event, &is_update, &rate, &fmt, &start, &end, &base); if (fmt == GST_FORMAT_TIME) { GST_DEBUG_OBJECT (pad, "Got NEWSEGMENT event in GST_FORMAT_TIME, passing on (%" GST_TIME_FORMAT " - %" GST_TIME_FORMAT ")", GST_TIME_ARGS (start), GST_TIME_ARGS (end)); gst_segment_set_newsegment (&self->segment, is_update, rate, fmt, start, end, base); } else { gst_segment_init (&self->segment, GST_FORMAT_TIME); } } /* fall through */ case GST_EVENT_FLUSH_STOP: gst_shape_wipe_reset_qos (self); /* fall through */ default: ret = gst_pad_push_event (self->srcpad, event); break; } gst_object_unref (self); return ret; }
static void gst_shape_wipe_reset (GstShapeWipe * self) { GST_DEBUG_OBJECT (self, "Resetting internal state"); if (self->mask) gst_buffer_unref (self->mask); self->mask = NULL; g_mutex_lock (&self->mask_mutex); g_cond_signal (&self->mask_cond); g_mutex_unlock (&self->mask_mutex); gst_video_info_init (&self->vinfo); gst_video_info_init (&self->minfo); self->mask_bpp = 0; gst_segment_init (&self->segment, GST_FORMAT_TIME); gst_shape_wipe_reset_qos (self); self->frame_duration = 0; }
static void gst_shape_wipe_reset (GstShapeWipe * self) { GST_DEBUG_OBJECT (self, "Resetting internal state"); if (self->mask) gst_buffer_unref (self->mask); self->mask = NULL; g_mutex_lock (self->mask_mutex); g_cond_signal (self->mask_cond); g_mutex_unlock (self->mask_mutex); self->fmt = GST_VIDEO_FORMAT_UNKNOWN; self->width = self->height = 0; self->mask_bpp = 0; gst_segment_init (&self->segment, GST_FORMAT_TIME); gst_shape_wipe_reset_qos (self); self->frame_duration = 0; }