mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 16:50:47 +00:00
omx: Add support for setting the component-role
This commit is contained in:
parent
0a9fe2f146
commit
f0cbbad0f1
4 changed files with 34 additions and 4 deletions
21
omx/gstomx.c
21
omx/gstomx.c
|
@ -314,7 +314,7 @@ static OMX_CALLBACKTYPE callbacks =
|
|||
|
||||
GstOMXComponent *
|
||||
gst_omx_component_new (GstObject * parent, const gchar * core_name,
|
||||
const gchar * component_name)
|
||||
const gchar * component_name, const gchar * component_role)
|
||||
{
|
||||
OMX_ERRORTYPE err;
|
||||
GstOMXCore *core;
|
||||
|
@ -354,6 +354,25 @@ gst_omx_component_new (GstObject * parent, const gchar * core_name,
|
|||
comp->settings_cookie = 0;
|
||||
comp->reconfigure_out_pending = 0;
|
||||
|
||||
/* Set component role if any */
|
||||
if (component_role) {
|
||||
OMX_PARAM_COMPONENTROLETYPE param;
|
||||
|
||||
memset (¶m, 0, sizeof (param));
|
||||
param.nSize = sizeof (param);
|
||||
param.nVersion.s.nVersionMajor = 1;
|
||||
param.nVersion.s.nVersionMinor = 1;
|
||||
|
||||
g_strlcpy ((gchar *) param.cRole, component_role, sizeof (param.cRole));
|
||||
err =
|
||||
OMX_SetParameter (comp->handle, OMX_IndexParamStandardComponentRole,
|
||||
¶m);
|
||||
|
||||
GST_DEBUG_OBJECT (parent, "Setting component role to '%s': %s (0x%08x)",
|
||||
component_role, gst_omx_error_to_string (err), err);
|
||||
}
|
||||
|
||||
|
||||
OMX_GetState (comp->handle, &comp->state);
|
||||
|
||||
return comp;
|
||||
|
|
|
@ -155,7 +155,7 @@ GstOMXCore * gst_omx_core_acquire (const gchar * filename);
|
|||
void gst_omx_core_release (GstOMXCore * core);
|
||||
|
||||
|
||||
GstOMXComponent * gst_omx_component_new (GstObject *parent, const gchar * core_name, const gchar * component_name);
|
||||
GstOMXComponent * gst_omx_component_new (GstObject *parent, const gchar * core_name, const gchar * component_name, const gchar *component_role);
|
||||
void gst_omx_component_free (GstOMXComponent * comp);
|
||||
|
||||
OMX_ERRORTYPE gst_omx_component_set_state (GstOMXComponent * comp, OMX_STATETYPE state);
|
||||
|
|
|
@ -82,7 +82,7 @@ gst_omx_video_dec_base_init (gpointer g_class)
|
|||
GKeyFile *config;
|
||||
const gchar *element_name;
|
||||
GError *err;
|
||||
gchar *core_name, *component_name;
|
||||
gchar *core_name, *component_name, *component_role;
|
||||
gint in_port_index, out_port_index;
|
||||
gchar *template_caps;
|
||||
GstPadTemplate *templ;
|
||||
|
@ -106,6 +106,16 @@ gst_omx_video_dec_base_init (gpointer g_class)
|
|||
g_assert (component_name != NULL);
|
||||
videodec_class->component_name = component_name;
|
||||
|
||||
/* If this fails we simply don't set a role */
|
||||
if ((component_role =
|
||||
g_key_file_get_string (config, element_name, "component-role",
|
||||
NULL))) {
|
||||
GST_DEBUG ("Using component-role '%s' for element '%s'", component_role,
|
||||
element_name);
|
||||
videodec_class->component_role = component_role;
|
||||
}
|
||||
|
||||
|
||||
/* Now set the inport/outport indizes and assume sane defaults */
|
||||
err = NULL;
|
||||
in_port_index =
|
||||
|
@ -222,7 +232,7 @@ gst_omx_video_dec_open (GstOMXVideoDec * self)
|
|||
|
||||
self->component =
|
||||
gst_omx_component_new (GST_OBJECT_CAST (self), klass->core_name,
|
||||
klass->component_name);
|
||||
klass->component_name, klass->component_role);
|
||||
|
||||
if (!self->component)
|
||||
return FALSE;
|
||||
|
|
|
@ -63,6 +63,7 @@ struct _GstOMXVideoDecClass
|
|||
|
||||
const gchar *core_name;
|
||||
const gchar *component_name;
|
||||
const gchar *component_role;
|
||||
|
||||
const gchar *default_src_template_caps;
|
||||
const gchar *default_sink_template_caps;
|
||||
|
|
Loading…
Reference in a new issue