diff options
author | Olivier Crete <olivier.crete@collabora.co.uk> | 2007-12-19 20:32:18 +0000 |
---|---|---|
committer | Edward Hervey <bilboed@bilboed.com> | 2009-02-17 19:29:59 +0100 |
commit | ecc7dbcc772ce6a4f098c1723e8f4304a408eaf8 (patch) | |
tree | e5a83bb553c3d876960c89f9b569a6db995b710c | |
parent | ee9906672b7857ea38b3160112f95ebf503b1ef2 (diff) | |
download | gst-plugins-bad-ecc7dbcc772ce6a4f098c1723e8f4304a408eaf8.tar.gz gst-plugins-bad-ecc7dbcc772ce6a4f098c1723e8f4304a408eaf8.tar.bz2 gst-plugins-bad-ecc7dbcc772ce6a4f098c1723e8f4304a408eaf8.zip |
[MOVED FROM GST-P-FARSIGHT] Set the DISCONT flag after dropping buffers
20071219203218-3e2dc-bc5f03d88ff5837040b9214de016cc142776dfc2.gz
-rw-r--r-- | gst/valve/gstvalve.c | 43 | ||||
-rw-r--r-- | gst/valve/gstvalve.h | 4 |
2 files changed, 41 insertions, 6 deletions
diff --git a/gst/valve/gstvalve.c b/gst/valve/gstvalve.c index 5b765c65..d057b027 100644 --- a/gst/valve/gstvalve.c +++ b/gst/valve/gstvalve.c @@ -79,7 +79,9 @@ static GstFlowReturn gst_valve_transform_ip (GstBaseTransform *trans, static gboolean gst_valve_event (GstBaseTransform *trans, GstEvent *event); static GstFlowReturn gst_valve_buffer_alloc (GstPad * pad, guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf); - +static GstFlowReturn gst_valve_prepare_output_buffer (GstBaseTransform *trans, + GstBuffer * in_buf, gint out_size, GstCaps * out_caps, + GstBuffer ** out_buf); static void _do_init (GType type) @@ -120,6 +122,8 @@ gst_valve_class_init (GstValveClass *klass) gstbasetransform_class->transform_ip = GST_DEBUG_FUNCPTR (gst_valve_transform_ip); + gstbasetransform_class->prepare_output_buffer = + GST_DEBUG_FUNCPTR (gst_valve_prepare_output_buffer); gstbasetransform_class->event = GST_DEBUG_FUNCPTR (gst_valve_event); gstbasetransform_class->src_event = @@ -138,7 +142,8 @@ static void gst_valve_init (GstValve *valve, GstValveClass *klass) { - valve->drop = 0; + valve->drop = FALSE; + valve->discont = FALSE; valve->original_allocfunc = GST_BASE_TRANSFORM (valve)->sinkpad->bufferallocfunc; @@ -149,7 +154,7 @@ gst_valve_init (GstValve *valve, GstValveClass *klass) #if GST_VERSION_MINOR >= 10 && GST_VERSION_MICRO >= 13 - gst_base_transform_set_passthrough ((GstBaseTransform *)valve, TRUE); + gst_base_transform_set_passthrough (GST_BASE_TRANSFORM (valve), FALSE); #endif } @@ -201,23 +206,49 @@ gst_valve_get_property (GObject *object, } static GstFlowReturn -gst_valve_transform_ip (GstBaseTransform *trans, GstBuffer *buf) +gst_valve_prepare_output_buffer (GstBaseTransform *trans, GstBuffer * in_buf, + gint out_size, GstCaps * out_caps, + GstBuffer ** out_buf) { GstValve *valve = GST_VALVE (trans); GstFlowReturn ret = GST_FLOW_OK; GST_OBJECT_LOCK (GST_OBJECT (trans)); - if (valve->drop) { + if (valve->drop) + { #if GST_VERSION_MINOR >= 10 && GST_VERSION_MICRO >= 13 ret = GST_BASE_TRANSFORM_FLOW_DROPPED; #endif - buf = NULL; + *out_buf = NULL; + valve->discont = TRUE; + } + else + { + if (valve->discont) + { + *out_buf = gst_buffer_make_metadata_writable (in_buf); + GST_BUFFER_FLAG_SET (*out_buf, GST_BUFFER_FLAG_DISCONT); + valve->discont = FALSE; + + } + else + { + *out_buf = in_buf; + } + gst_buffer_ref (*out_buf); } GST_OBJECT_UNLOCK (GST_OBJECT (trans)); return ret; } +static GstFlowReturn +gst_valve_transform_ip (GstBaseTransform *trans, GstBuffer *buf) +{ + return GST_FLOW_OK; +} + + static gboolean gst_valve_event (GstBaseTransform *trans, GstEvent *event) { diff --git a/gst/valve/gstvalve.h b/gst/valve/gstvalve.h index f60d7e18..8d0c1400 100644 --- a/gst/valve/gstvalve.h +++ b/gst/valve/gstvalve.h @@ -52,8 +52,12 @@ struct _GstValve { GstBaseTransform parent; + /* Protected by the object lock */ gboolean drop; + /* Protected by the stream lock*/ + gboolean discont; + GstPadBufferAllocFunction original_allocfunc; /*< private > */ |