From 32abd30f5ebc10cc09a1187395b7dfa3118d40e0 Mon Sep 17 00:00:00 2001 From: "Joshua M. Doe" Date: Wed, 14 Apr 2021 08:10:25 -0400 Subject: [PATCH] klvinject: prepare outbuf buffers to handle non-writable buffers --- gst/klv/gstklvinject.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/gst/klv/gstklvinject.c b/gst/klv/gstklvinject.c index b9894a5..2771698 100644 --- a/gst/klv/gstklvinject.c +++ b/gst/klv/gstklvinject.c @@ -45,7 +45,10 @@ GST_DEBUG_CATEGORY_STATIC (gst_klvinject_debug_category); /* prototypes */ static GstFlowReturn gst_klvinject_transform_ip (GstBaseTransform * trans, - GstBuffer * buf); + GstBuffer * inbuf); + +static GstFlowReturn gst_klvinject_prepare_output_buffer (GstBaseTransform * + trans, GstBuffer * input, GstBuffer ** outbuf); enum { @@ -85,9 +88,8 @@ gst_klvinject_class_init (GstKlvInjectClass * klass) base_transform_class->transform_ip = GST_DEBUG_FUNCPTR (gst_klvinject_transform_ip); - - base_transform_class->passthrough_on_same_caps = TRUE; - base_transform_class->transform_ip_on_passthrough = TRUE; + base_transform_class->prepare_output_buffer = + GST_DEBUG_FUNCPTR (gst_klvinject_prepare_output_buffer); } static void @@ -189,6 +191,18 @@ gst_klvinject_add_test_meta (GstKlvInject * filt, GstBuffer * buf) } } +static GstFlowReturn +gst_klvinject_prepare_output_buffer (GstBaseTransform * trans, + GstBuffer * inbuf, GstBuffer ** outbuf) +{ + GstFlowReturn ret = GST_FLOW_OK; + GstKlvInject *filt = GST_KLVINJECT (trans); + + *outbuf = gst_buffer_copy (inbuf); + + return GST_FLOW_OK; +} + static GstFlowReturn gst_klvinject_transform_ip (GstBaseTransform * trans, GstBuffer * buf) {