summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.com>2018-09-04 19:34:59 +0000
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>2019-12-22 05:43:40 +0000
commitbba92f64ca2fece3a50938d408014772fc41bbcc (patch)
treeb114246b8eda90227c96d6c5ca683d77c19b738a
parent73179da17cd01ea393fed4e814efcede64400afd (diff)
omx: Add helper to enable/disable/read subframe mode
-rw-r--r--omx/gstomx.c55
-rw-r--r--omx/gstomx.h2
2 files changed, 57 insertions, 0 deletions
diff --git a/omx/gstomx.c b/omx/gstomx.c
index 71cd13a..cb53691 100644
--- a/omx/gstomx.c
+++ b/omx/gstomx.c
@@ -3440,6 +3440,61 @@ gst_omx_port_set_dmabuf (GstOMXPort * port, gboolean dmabuf)
#endif
}
+gboolean
+gst_omx_port_set_subframe (GstOMXPort * port, gboolean enabled)
+{
+#ifdef USE_OMX_TARGET_ZYNQ_USCALE_PLUS
+ OMX_ALG_VIDEO_PARAM_SUBFRAME subframe_mode;
+ OMX_ERRORTYPE err;
+
+ GST_OMX_INIT_STRUCT (&subframe_mode);
+ subframe_mode.nPortIndex = port->index;
+
+ subframe_mode.bEnableSubframe = enabled;
+
+ err = gst_omx_component_set_parameter (port->comp,
+ (OMX_INDEXTYPE) OMX_ALG_IndexParamVideoSubframe, &subframe_mode);
+ if (err != OMX_ErrorNone) {
+ GST_WARNING_OBJECT (port->comp->parent,
+ "Failed to %s subframe mode on port %d: %s (0x%08x)",
+ enabled ? "enable" : "disable", port->index,
+ gst_omx_error_to_string (err), err);
+ return FALSE;
+ }
+
+ return TRUE;
+#else
+ /* subframe mode is not supported on this platform */
+ return FALSE;
+#endif
+}
+
+gboolean
+gst_omx_port_get_subframe (GstOMXPort * port)
+{
+#ifdef USE_OMX_TARGET_ZYNQ_USCALE_PLUS
+ OMX_ALG_VIDEO_PARAM_SUBFRAME subframe_mode;
+ OMX_ERRORTYPE err;
+
+ GST_OMX_INIT_STRUCT (&subframe_mode);
+ subframe_mode.nPortIndex = port->index;
+
+ err = gst_omx_component_get_parameter (port->comp,
+ (OMX_INDEXTYPE) OMX_ALG_IndexParamVideoSubframe, &subframe_mode);
+ if (err != OMX_ErrorNone) {
+ GST_WARNING_OBJECT (port->comp->parent,
+ "Failed to get subframe mode on port %d: %s (0x%08x)",
+ port->index, gst_omx_error_to_string (err), err);
+ return FALSE;
+ }
+
+ return subframe_mode.bEnableSubframe;
+#else
+ /* subframe mode is not supported on this platform */
+ return FALSE;
+#endif
+}
+
typedef GType (*GGetTypeFunction) (void);
static const GGetTypeFunction types[] = {
diff --git a/omx/gstomx.h b/omx/gstomx.h
index 8ffef39..6862463 100644
--- a/omx/gstomx.h
+++ b/omx/gstomx.h
@@ -472,6 +472,8 @@ gboolean gst_omx_port_ensure_buffer_count_actual (GstOMXPort * port, gu
gboolean gst_omx_port_update_buffer_count_actual (GstOMXPort * port, guint nb);
gboolean gst_omx_port_set_dmabuf (GstOMXPort * port, gboolean dmabuf);
+gboolean gst_omx_port_set_subframe (GstOMXPort * port, gboolean enabled);
+gboolean gst_omx_port_get_subframe (GstOMXPort * port);
/* OMX 1.2.0 dynamic allocation mode */
gboolean gst_omx_is_dynamic_allocation_supported (void);