omx: Add helper to enable/disable/read subframe mode

This commit is contained in:
Nicolas Dufresne 2018-09-04 19:34:59 +00:00 committed by GStreamer Merge Bot
parent 73179da17c
commit bba92f64ca
2 changed files with 57 additions and 0 deletions

View file

@ -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[] = {

View file

@ -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);