[Gstreamer-openmax] [PATCH] add input-buffers and output-buffers properties to GstOmxBaseFilter

Rob Clark rob at ti.com
Tue Nov 3 18:25:51 PST 2009


Signed-off-by: Rob Clark <rob at ti.com>
---
 omx/gstomx_base_filter.c |   43 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 43 insertions(+), 0 deletions(-)

diff --git a/omx/gstomx_base_filter.c b/omx/gstomx_base_filter.c
index 5a68d02..35571ae 100644
--- a/omx/gstomx_base_filter.c
+++ b/omx/gstomx_base_filter.c
@@ -31,6 +31,8 @@ enum
     ARG_COMPONENT_NAME,
     ARG_LIBRARY_NAME,
     ARG_USE_TIMESTAMPS,
+    ARG_NUM_INPUT_BUFFERS,
+    ARG_NUM_OUTPUT_BUFFERS,
 };
 
 static GstElementClass *parent_class;
@@ -205,6 +207,22 @@ set_property (GObject *obj,
         case ARG_USE_TIMESTAMPS:
             self->use_timestamps = g_value_get_boolean (value);
             break;
+        case ARG_NUM_INPUT_BUFFERS:
+        case ARG_NUM_OUTPUT_BUFFERS:
+            {
+                OMX_PARAM_PORTDEFINITIONTYPE param;
+                OMX_U32 nBufferCountActual = g_value_get_uint (value);
+                guint nPortIndex = (prop_id == ARG_NUM_INPUT_BUFFERS) ? 0 : 1;
+                GOmxPort *port = g_omx_core_get_port (self->gomx, nPortIndex);
+
+                G_OMX_PORT_GET_PARAM (port, OMX_IndexParamPortDefinition, &param);
+
+                g_return_if_fail (nBufferCountActual >= param.nBufferCountMin);
+                param.nBufferCountActual = nBufferCountActual;
+
+                G_OMX_PORT_SET_PARAM (port, OMX_IndexParamPortDefinition, &param);
+            }
+            break;
         default:
             G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
             break;
@@ -232,6 +250,18 @@ get_property (GObject *obj,
         case ARG_USE_TIMESTAMPS:
             g_value_set_boolean (value, self->use_timestamps);
             break;
+        case ARG_NUM_INPUT_BUFFERS:
+        case ARG_NUM_OUTPUT_BUFFERS:
+            {
+                OMX_PARAM_PORTDEFINITIONTYPE param;
+                guint nPortIndex = (prop_id == ARG_NUM_INPUT_BUFFERS) ? 0 : 1;
+                GOmxPort *port = g_omx_core_get_port (self->gomx, nPortIndex);
+
+                G_OMX_PORT_GET_PARAM (port, OMX_IndexParamPortDefinition, &param);
+
+                g_value_set_uint (value, param.nBufferCountActual);
+            }
+            break;
         default:
             G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
             break;
@@ -272,6 +302,19 @@ type_class_init (gpointer g_class,
                                          g_param_spec_boolean ("use-timestamps", "Use timestamps",
                                                                "Whether or not to use timestamps",
                                                                TRUE, G_PARAM_READWRITE));
+
+        /* note: the default values for these are just a guess.. since we wouldn't know
+         * until the OMX component is constructed.  But that is ok, these properties are
+         * only for debugging
+         */
+        g_object_class_install_property (gobject_class, ARG_NUM_INPUT_BUFFERS,
+                                         g_param_spec_uint ("input-buffers", "Input buffers",
+                                                            "The number of OMX input buffers",
+                                                            1, 10, 4, G_PARAM_READWRITE));
+        g_object_class_install_property (gobject_class, ARG_NUM_OUTPUT_BUFFERS,
+                                         g_param_spec_uint ("output-buffers", "Output buffers",
+                                                            "The number of OMX output buffers",
+                                                            1, 10, 4, G_PARAM_READWRITE));
     }
 }
 
-- 
1.6.3.2





More information about the Gstreamer-openmax mailing list