mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-09-09 13:48:55 +00:00
deinterlace: Refactor chain function
This is needed to be able to output a frame from outside the chain function, i.e. in the following commit that adds flushing of the field history.
This commit is contained in:
parent
3eb02097f9
commit
5a56274cba
1 changed files with 37 additions and 30 deletions
|
@ -941,41 +941,13 @@ gst_deinterlace_do_qos (GstDeinterlace * self, GstClockTime timestamp)
|
|||
}
|
||||
|
||||
static GstFlowReturn
|
||||
gst_deinterlace_chain (GstPad * pad, GstBuffer * buf)
|
||||
gst_deinterlace_output_frame (GstDeinterlace * self)
|
||||
{
|
||||
GstDeinterlace *self = GST_DEINTERLACE (GST_PAD_PARENT (pad));
|
||||
GstClockTime timestamp;
|
||||
GstFlowReturn ret = GST_FLOW_OK;
|
||||
gint fields_required = 0;
|
||||
gint cur_field_idx = 0;
|
||||
GstBuffer *outbuf;
|
||||
|
||||
GST_OBJECT_LOCK (self);
|
||||
if (self->reconfigure) {
|
||||
if (self->new_fields != -1)
|
||||
self->fields = self->new_fields;
|
||||
if (self->new_mode != -1)
|
||||
self->mode = self->new_mode;
|
||||
self->new_mode = self->new_fields = -1;
|
||||
|
||||
self->reconfigure = FALSE;
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
if (GST_PAD_CAPS (self->srcpad))
|
||||
gst_deinterlace_setcaps (self->sinkpad, GST_PAD_CAPS (self->sinkpad));
|
||||
} else {
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
}
|
||||
|
||||
if (self->still_frame_mode || self->passthrough)
|
||||
return gst_pad_push (self->srcpad, buf);
|
||||
|
||||
if (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DISCONT)) {
|
||||
GST_DEBUG_OBJECT (self, "DISCONT buffer, resetting history");
|
||||
gst_deinterlace_reset_history (self);
|
||||
}
|
||||
|
||||
gst_deinterlace_push_history (self, buf);
|
||||
buf = NULL;
|
||||
GstBuffer *buf, *outbuf;
|
||||
|
||||
fields_required = gst_deinterlace_method_get_fields_required (self->method);
|
||||
|
||||
|
@ -1151,6 +1123,41 @@ gst_deinterlace_chain (GstPad * pad, GstBuffer * buf)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
gst_deinterlace_chain (GstPad * pad, GstBuffer * buf)
|
||||
{
|
||||
GstDeinterlace *self = GST_DEINTERLACE (GST_PAD_PARENT (pad));
|
||||
|
||||
GST_OBJECT_LOCK (self);
|
||||
if (self->reconfigure) {
|
||||
if (self->new_fields != -1)
|
||||
self->fields = self->new_fields;
|
||||
if (self->new_mode != -1)
|
||||
self->mode = self->new_mode;
|
||||
self->new_mode = self->new_fields = -1;
|
||||
|
||||
self->reconfigure = FALSE;
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
if (GST_PAD_CAPS (self->srcpad))
|
||||
gst_deinterlace_setcaps (self->sinkpad, GST_PAD_CAPS (self->sinkpad));
|
||||
} else {
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
}
|
||||
|
||||
if (self->still_frame_mode || self->passthrough)
|
||||
return gst_pad_push (self->srcpad, buf);
|
||||
|
||||
if (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DISCONT)) {
|
||||
GST_DEBUG_OBJECT (self, "DISCONT buffer, resetting history");
|
||||
gst_deinterlace_reset_history (self);
|
||||
}
|
||||
|
||||
gst_deinterlace_push_history (self, buf);
|
||||
buf = NULL;
|
||||
|
||||
return gst_deinterlace_output_frame (self);
|
||||
}
|
||||
|
||||
static gint
|
||||
gst_greatest_common_divisor (gint a, gint b)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue