omx: simplify tunnel functions

Specifying the component is error prone and unnecessary.

https://bugzilla.gnome.org/show_bug.cgi?id=726021
This commit is contained in:
Christian König 2014-03-04 17:41:20 +01:00 committed by Sebastian Dröge
parent 14a0da437f
commit de5f940186
3 changed files with 21 additions and 19 deletions

View file

@ -1059,19 +1059,22 @@ gst_omx_component_set_config (GstOMXComponent * comp, OMX_INDEXTYPE index,
}
OMX_ERRORTYPE
gst_omx_component_setup_tunnel (GstOMXComponent * comp1, GstOMXPort * port1,
GstOMXComponent * comp2, GstOMXPort * port2)
gst_omx_setup_tunnel (GstOMXPort * port1, GstOMXPort * port2)
{
GstOMXComponent *comp1;
GstOMXComponent *comp2;
OMX_ERRORTYPE err;
g_return_val_if_fail (comp1 != NULL, OMX_ErrorUndefined);
g_return_val_if_fail (port1 != NULL, OMX_ErrorUndefined);
g_return_val_if_fail (port1->port_def.eDir == OMX_DirOutput,
OMX_ErrorUndefined);
g_return_val_if_fail (comp2 != NULL, OMX_ErrorUndefined);
comp1 = port1->comp;
g_return_val_if_fail (port2 != NULL, OMX_ErrorUndefined);
g_return_val_if_fail (port2->port_def.eDir == OMX_DirInput,
OMX_ErrorUndefined);
comp2 = port2->comp;
g_return_val_if_fail (comp1->core == comp2->core, OMX_ErrorUndefined);
g_mutex_lock (&comp1->lock);
@ -1100,19 +1103,22 @@ gst_omx_component_setup_tunnel (GstOMXComponent * comp1, GstOMXPort * port1,
}
OMX_ERRORTYPE
gst_omx_component_close_tunnel (GstOMXComponent * comp1, GstOMXPort * port1,
GstOMXComponent * comp2, GstOMXPort * port2)
gst_omx_close_tunnel (GstOMXPort * port1, GstOMXPort * port2)
{
GstOMXComponent *comp1;
GstOMXComponent *comp2;
OMX_ERRORTYPE err;
g_return_val_if_fail (comp1 != NULL, OMX_ErrorUndefined);
g_return_val_if_fail (port1 != NULL, OMX_ErrorUndefined);
g_return_val_if_fail (port1->port_def.eDir == OMX_DirOutput,
OMX_ErrorUndefined);
g_return_val_if_fail (comp2 != NULL, OMX_ErrorUndefined);
comp1 = port1->comp;
g_return_val_if_fail (port2 != NULL, OMX_ErrorUndefined);
g_return_val_if_fail (port2->port_def.eDir == OMX_DirInput,
OMX_ErrorUndefined);
comp2 = port2->comp;
g_return_val_if_fail (comp1->core == comp2->core, OMX_ErrorUndefined);
g_return_val_if_fail (port1->tunneled && port2->tunneled, OMX_ErrorUndefined);

View file

@ -311,8 +311,9 @@ OMX_ERRORTYPE gst_omx_component_set_parameter (GstOMXComponent * comp, OMX_I
OMX_ERRORTYPE gst_omx_component_get_config (GstOMXComponent * comp, OMX_INDEXTYPE index, gpointer config);
OMX_ERRORTYPE gst_omx_component_set_config (GstOMXComponent * comp, OMX_INDEXTYPE index, gpointer config);
OMX_ERRORTYPE gst_omx_component_setup_tunnel (GstOMXComponent * comp1, GstOMXPort * port1, GstOMXComponent * comp2, GstOMXPort * port2);
OMX_ERRORTYPE gst_omx_component_close_tunnel (GstOMXComponent * comp1, GstOMXPort * port1, GstOMXComponent * comp2, GstOMXPort * port2);
OMX_ERRORTYPE gst_omx_setup_tunnel (GstOMXPort * port1, GstOMXPort * port2);
OMX_ERRORTYPE gst_omx_close_tunnel (GstOMXPort * port1, GstOMXPort * port2);
OMX_ERRORTYPE gst_omx_port_get_port_definition (GstOMXPort * port, OMX_PARAM_PORTDEFINITIONTYPE * port_def);

View file

@ -856,8 +856,7 @@ gst_omx_video_dec_shutdown (GstOMXVideoDec * self)
gst_omx_port_deallocate_buffers (self->dec_in_port);
gst_omx_video_dec_deallocate_output_buffers (self);
gst_omx_component_close_tunnel (self->dec, self->dec_out_port,
self->egl_render, self->egl_in_port);
gst_omx_close_tunnel (self->dec_out_port, self->egl_in_port);
if (state > OMX_StateLoaded) {
gst_omx_component_get_state (self->egl_render, 5 * GST_SECOND);
gst_omx_component_get_state (self->dec, 1 * GST_SECOND);
@ -1621,9 +1620,7 @@ gst_omx_video_dec_reconfigure_output_port (GstOMXVideoDec * self)
#undef OMX_IndexParamBrcmVideoEGLRenderDiscardMode
}
err =
gst_omx_component_setup_tunnel (self->dec, self->dec_out_port,
self->egl_render, self->egl_in_port);
err = gst_omx_setup_tunnel (self->dec_out_port, self->egl_in_port);
if (err != OMX_ErrorNone)
goto no_egl;
@ -1707,8 +1704,7 @@ gst_omx_video_dec_reconfigure_output_port (GstOMXVideoDec * self)
gst_omx_component_set_state (self->egl_render, OMX_StateLoaded);
gst_omx_video_dec_deallocate_output_buffers (self);
gst_omx_component_close_tunnel (self->dec, self->dec_out_port,
self->egl_render, self->egl_in_port);
gst_omx_close_tunnel (self->dec_out_port, self->egl_in_port);
if (egl_state > OMX_StateLoaded) {
gst_omx_component_get_state (self->egl_render, 5 * GST_SECOND);
@ -2542,8 +2538,7 @@ gst_omx_video_dec_set_format (GstVideoDecoder * decoder,
gst_omx_component_set_state (self->egl_render, OMX_StateLoaded);
gst_omx_component_set_state (self->dec, OMX_StateLoaded);
gst_omx_component_close_tunnel (self->dec, self->dec_out_port,
self->egl_render, self->egl_in_port);
gst_omx_close_tunnel (self->dec_out_port, self->egl_in_port);
if (egl_state > OMX_StateLoaded) {
gst_omx_component_get_state (self->egl_render, 5 * GST_SECOND);