Commit 20196581 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

playlist: Add playlist_SetRenderer

refs #18605
parent f7ef0752
......@@ -358,6 +358,14 @@ VLC_API bool playlist_IsServicesDiscoveryLoaded( playlist_t *,const char *) VLC_
/** Query a services discovery */
VLC_API int playlist_ServicesDiscoveryControl( playlist_t *, const char *, int, ... );
/********************** Renderer ***********************/
/**
* Sets a renderer or remove the current one
* @param p_item The renderer item to be used, or NULL to disable the current
* one. If a renderer is provided, its reference count will be
* incremented.
*/
VLC_API int playlist_SetRenderer( playlist_t* p_pl, vlc_renderer_item_t* p_item );
/********************************************************
......
......@@ -225,6 +225,7 @@ libvlccore_la_SOURCES = \
playlist/item.c \
playlist/search.c \
playlist/services_discovery.c \
playlist/renderer.c \
input/item.c \
input/access.c \
input/clock.c \
......
......@@ -362,6 +362,7 @@ playlist_VolumeSet
playlist_VolumeUp
playlist_MuteSet
playlist_MuteGet
playlist_SetRenderer
sdp_AddAttribute
sdp_AddMedia
secstotimestr
......
......@@ -34,6 +34,7 @@
#include <vlc_playlist.h>
#include <vlc_interface.h>
#include <vlc_http.h>
#include <vlc_renderer_discovery.h>
#include "playlist_internal.h"
#include "input/resource.h"
......@@ -310,6 +311,8 @@ void playlist_Destroy( playlist_t *p_playlist )
/* Release input resources */
assert( p_sys->p_input == NULL );
input_resource_Release( p_sys->p_input_resource );
if( p_sys->p_renderer )
vlc_renderer_item_release( p_sys->p_renderer );
if( p_playlist->p_media_library != NULL )
playlist_MLDump( p_playlist );
......
......@@ -58,6 +58,7 @@ typedef struct playlist_private_t
input_thread_t * p_input; /**< the input thread associated
* with the current item */
input_resource_t * p_input_resource; /**< input resources */
vlc_renderer_item_t *p_renderer;
struct {
/* Current status. These fields are readonly, only the playlist
* main loop can touch it*/
......
/*****************************************************************************
* renderer.c : Manage renderer modules
*****************************************************************************
* Copyright (C) 1999-2017 VLC authors, VideoLAN and VideoLabs
*
* Authors: Hugo Beauzée-Luyssen <hugo@beauzee.fr>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <vlc_common.h>
#include <vlc_playlist.h>
#include <vlc_renderer_discovery.h>
#include "playlist/playlist_internal.h"
int playlist_SetRenderer( playlist_t* p_playlist, vlc_renderer_item_t* p_item )
{
if( p_item )
vlc_renderer_item_hold( p_item );
PL_LOCK;
playlist_private_t *p_priv = pl_priv( p_playlist );
vlc_renderer_item_t *p_prev_renderer = p_priv->p_renderer;
p_priv->p_renderer = p_item;
if( p_priv->p_input )
input_Control( p_priv->p_input, INPUT_SET_RENDERER, p_item );
PL_UNLOCK;
if( p_prev_renderer )
vlc_renderer_item_release( p_prev_renderer );
return VLC_SUCCESS;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment