1 /*****************************************************************************
2  * renderer.c : Manage renderer modules
3  *****************************************************************************
4  * Copyright (C) 1999-2017 VLC authors, VideoLAN and VideoLabs
5  *
6  * Authors: Hugo Beauzée-Luyssen <hugo@beauzee.fr>
7  *
8  * This program is free software; you can redistribute it and/or modify it
9  * under the terms of the GNU Lesser General Public License as published by
10  * the Free Software Foundation; either version 2.1 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this program; if not, write to the Free Software Foundation,
20  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
21  *****************************************************************************/
22 
23 #ifdef HAVE_CONFIG_H
24 # include "config.h"
25 #endif
26 
27 #include <vlc_common.h>
28 #include <vlc_playlist.h>
29 #include <vlc_renderer_discovery.h>
30 
31 #include "playlist/playlist_internal.h"
32 
playlist_SetRenderer(playlist_t * p_playlist,vlc_renderer_item_t * p_item)33 int playlist_SetRenderer( playlist_t* p_playlist, vlc_renderer_item_t* p_item )
34 {
35     if( p_item )
36         vlc_renderer_item_hold( p_item );
37 
38     PL_LOCK;
39 
40     playlist_private_t *p_priv = pl_priv( p_playlist );
41     vlc_renderer_item_t *p_prev_renderer = p_priv->p_renderer;
42     p_priv->p_renderer = p_item;
43     if( p_priv->p_input )
44         input_Control( p_priv->p_input, INPUT_SET_RENDERER, p_item );
45 
46     PL_UNLOCK;
47 
48     if( p_prev_renderer )
49         vlc_renderer_item_release( p_prev_renderer );
50     return VLC_SUCCESS;
51 }
52