vlc | branch: master | Rémi Denis-Courmont <[email protected]> | Fri Jan 18 21:51:50 2019 +0200| [5791ddcf584673fede5ed1fd9ca6b97b19b407c3] | committer: Rémi Denis-Courmont
resource: reindent > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5791ddcf584673fede5ed1fd9ca6b97b19b407c3 --- src/input/resource.c | 106 +++++++++++++++++++++++++-------------------------- 1 file changed, 52 insertions(+), 54 deletions(-) diff --git a/src/input/resource.c b/src/input/resource.c index bafa7582b2..a56e5946ce 100644 --- a/src/input/resource.c +++ b/src/input/resource.c @@ -372,51 +372,49 @@ void input_resource_SetInput( input_resource_t *p_resource, input_thread_t *p_in vout_thread_t *input_resource_GetVout(input_resource_t *p_resource, const vout_configuration_t *cfg) { + vout_configuration_t cfg_buf; vout_thread_t *vout; assert(cfg != NULL); assert(cfg->fmt != NULL); vlc_mutex_lock( &p_resource->lock ); - vout_configuration_t cfg_buf; + if (cfg->vout == NULL && p_resource->p_vout_free != NULL) { + msg_Dbg(p_resource->p_parent, "trying to reuse free vout"); - if (cfg->vout == NULL && p_resource->p_vout_free != NULL) { - msg_Dbg(p_resource->p_parent, "trying to reuse free vout"); + cfg_buf = *cfg; + cfg_buf.vout = p_resource->p_vout_free; + p_resource->p_vout_free = NULL; + cfg = &cfg_buf; - cfg_buf = *cfg; - cfg_buf.vout = p_resource->p_vout_free; - p_resource->p_vout_free = NULL; - cfg = &cfg_buf; + } else if (cfg->vout != NULL) { + assert(cfg->vout != p_resource->p_vout_free); - } else if (cfg->vout != NULL) { - assert(cfg->vout != p_resource->p_vout_free); + vlc_mutex_lock(&p_resource->lock_hold); + TAB_REMOVE(p_resource->i_vout, p_resource->pp_vout, cfg->vout); + vlc_mutex_unlock(&p_resource->lock_hold); + } - vlc_mutex_lock(&p_resource->lock_hold); - TAB_REMOVE(p_resource->i_vout, p_resource->pp_vout, cfg->vout); - vlc_mutex_unlock(&p_resource->lock_hold); - } + vout = vout_Request(p_resource->p_parent, cfg, p_resource->p_input); + if (vout != NULL) { + DisplayVoutTitle(p_resource, vout); - vout = vout_Request(p_resource->p_parent, cfg, p_resource->p_input); - if (vout != NULL) { - DisplayVoutTitle(p_resource, vout); - - /* Send original viewpoint to the input in order to update other ESes */ - if (p_resource->p_input != NULL) - input_Control(p_resource->p_input, INPUT_SET_INITIAL_VIEWPOINT, - &cfg->fmt->pose); - - vlc_mutex_lock(&p_resource->lock_hold); - TAB_APPEND(p_resource->i_vout, p_resource->pp_vout, vout); - vlc_mutex_unlock(&p_resource->lock_hold); - - if (p_resource->p_input != NULL) - input_SendEventVout(p_resource->p_input, - &(struct vlc_input_event_vout) { - .action = VLC_INPUT_EVENT_VOUT_ADDED, - .vout = vout, - }); - } + /* Send original viewpoint to the input in order to update other ESes */ + if (p_resource->p_input != NULL) + input_Control(p_resource->p_input, INPUT_SET_INITIAL_VIEWPOINT, + &cfg->fmt->pose); + vlc_mutex_lock(&p_resource->lock_hold); + TAB_APPEND(p_resource->i_vout, p_resource->pp_vout, vout); + vlc_mutex_unlock(&p_resource->lock_hold); + + if (p_resource->p_input != NULL) + input_SendEventVout(p_resource->p_input, + &(struct vlc_input_event_vout) { + .action = VLC_INPUT_EVENT_VOUT_ADDED, + .vout = vout, + }); + } vlc_mutex_unlock( &p_resource->lock ); return vout; } @@ -427,32 +425,32 @@ void input_resource_PutVout(input_resource_t *p_resource, assert(vout != NULL); vlc_mutex_lock( &p_resource->lock ); - vlc_mutex_lock(&p_resource->lock_hold); - TAB_REMOVE(p_resource->i_vout, p_resource->pp_vout, vout); + vlc_mutex_lock(&p_resource->lock_hold); + TAB_REMOVE(p_resource->i_vout, p_resource->pp_vout, vout); - const int active_vouts = p_resource->i_vout; - vlc_mutex_unlock(&p_resource->lock_hold); + const int active_vouts = p_resource->i_vout; + vlc_mutex_unlock(&p_resource->lock_hold); - if (p_resource->p_input != NULL) - input_SendEventVout(p_resource->p_input, - &(struct vlc_input_event_vout) { - .action = VLC_INPUT_EVENT_VOUT_DELETED, - .vout = vout, - }); + if (p_resource->p_input != NULL) + input_SendEventVout(p_resource->p_input, + &(struct vlc_input_event_vout) { + .action = VLC_INPUT_EVENT_VOUT_DELETED, + .vout = vout, + }); - if (p_resource->p_vout_free != NULL || active_vouts > 0) { - msg_Dbg(p_resource->p_parent, "destroying vout (already one saved or active)"); - vout_CloseAndRelease(vout); - } else { - vout_configuration_t cfg = { .vout = vout }; + if (p_resource->p_vout_free != NULL || active_vouts > 0) { + msg_Dbg(p_resource->p_parent, "destroying vout (already one saved or active)"); + vout_CloseAndRelease(vout); + } else { + vout_configuration_t cfg = { .vout = vout }; - msg_Dbg(p_resource->p_parent, "saving a free vout"); - vout_FlushAll(vout); - vout_FlushSubpictureChannel(vout, -1); + msg_Dbg(p_resource->p_parent, "saving a free vout"); + vout_FlushAll(vout); + vout_FlushSubpictureChannel(vout, -1); - p_resource->p_vout_free = vout_Request(p_resource->p_parent, &cfg, - NULL); - } + p_resource->p_vout_free = vout_Request(p_resource->p_parent, &cfg, + NULL); + } vlc_mutex_unlock( &p_resource->lock ); } _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
