1 /*****************************************************************************
2 * vlc_renderer_discovery.h : Renderer Discovery functions
3 *****************************************************************************
4 * Copyright (C) 2016 VLC authors and VideoLAN
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation; either version 2.1 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19 *****************************************************************************/
21 #ifndef VLC_RENDERER_DISCOVERY_H
22 #define VLC_RENDERER_DISCOVERY_H 1
24 #include <vlc_input.h>
25 #include <vlc_events.h>
26 #include <vlc_probe.h>
30 * @defgroup vlc_renderer VLC renderer discovery
34 * This file declares VLC renderer discvoery structures and functions
36 * @defgroup vlc_renderer_item VLC renderer items returned by the discovery
40 #define VLC_RENDERER_CAN_AUDIO 0x0001
41 #define VLC_RENDERER_CAN_VIDEO 0x0002
44 * Create a new renderer item
46 * @param psz_type type of the item
47 * @param psz_name name of the item
48 * @param psz_uri uri of the renderer item, must contains a valid protocol and
50 * @param psz_extra_sout extra sout options
51 * @param psz_demux_filter demux filter to use with the renderer
52 * @param psz_icon_uri icon uri of the renderer item
53 * @param i_flags flags for the item
54 * @return a renderer item or NULL in case of error
56 VLC_API vlc_renderer_item_t
*
57 vlc_renderer_item_new(const char *psz_type
, const char *psz_name
,
58 const char *psz_uri
, const char *psz_extra_sout
,
59 const char *psz_demux_filter
, const char *psz_icon_uri
,
60 int i_flags
) VLC_USED
;
63 * Hold a renderer item, i.e. creates a new reference
65 VLC_API vlc_renderer_item_t
*
66 vlc_renderer_item_hold(vlc_renderer_item_t
*p_item
);
69 * Releases a renderer item, i.e. decrements its reference counter
72 vlc_renderer_item_release(vlc_renderer_item_t
*p_item
);
75 * Get the human readable name of a renderer item
78 vlc_renderer_item_name(const vlc_renderer_item_t
*p_item
);
81 * Get the type (not translated) of a renderer item. For now, the type can only
82 * be "chromecast" ("upnp", "airplay" may come later).
85 vlc_renderer_item_type(const vlc_renderer_item_t
*p_item
);
88 * Get the demux filter to use with a renderer item
91 vlc_renderer_item_demux_filter(const vlc_renderer_item_t
*p_item
);
94 * Get the sout command of a renderer item
97 vlc_renderer_item_sout(const vlc_renderer_item_t
*p_item
);
100 * Get the icon uri of a renderer item
103 vlc_renderer_item_icon_uri(const vlc_renderer_item_t
*p_item
);
106 * Get the flags of a renderer item
109 vlc_renderer_item_flags(const vlc_renderer_item_t
*p_item
);
113 * @defgroup vlc_renderer_discovery VLC renderer discovery interface
117 typedef struct vlc_renderer_discovery_sys vlc_renderer_discovery_sys
;
120 * Return a list of renderer discovery modules
122 * @param pppsz_names a pointer to a list of module name, NULL terminated
123 * @param pppsz_longnames a pointer to a list of module longname, NULL
126 * @return VLC_SUCCESS on success, or VLC_EGENERIC on error
129 vlc_rd_get_names(vlc_object_t
*p_obj
, char ***pppsz_names
,
130 char ***pppsz_longnames
) VLC_USED
;
131 #define vlc_rd_get_names(a, b, c) \
132 vlc_rd_get_names(VLC_OBJECT(a), b, c)
135 * Create a new renderer discovery module
137 * @param psz_name name of the module to load, see vlc_rd_get_names() to get
140 * @return a valid vlc_renderer_discovery, need to be released with
143 VLC_API vlc_renderer_discovery_t
*
144 vlc_rd_new(vlc_object_t
*p_obj
, const char *psz_name
) VLC_USED
;
146 #define vlc_rd_release(p_rd) vlc_object_release(p_rd)
149 * Get the event manager of the renderer discovery module
151 * @see vlc_RendererDiscoveryItemAdded
152 * @see vlc_RendererDiscoveryItemRemoved
154 VLC_API vlc_event_manager_t
*
155 vlc_rd_event_manager(vlc_renderer_discovery_t
*p_rd
);
158 * Start the renderer discovery module
160 * Once started, the module can send new vlc_renderer_item_t via the
161 * vlc_RendererDiscoveryItemAdded event.
164 vlc_rd_start(vlc_renderer_discovery_t
*p_rd
);
167 * Stop the renderer discovery module
170 vlc_rd_stop(vlc_renderer_discovery_t
*p_rd
);
174 * @defgroup vlc_renderer_discovery_module VLC renderer module
178 struct vlc_renderer_discovery_t
183 vlc_event_manager_t event_manager
;
186 config_chain_t
* p_cfg
;
188 vlc_renderer_discovery_sys
*p_sys
;
192 * Add a new renderer item
194 * This will send the vlc_RendererDiscoveryItemAdded event
197 vlc_rd_add_item(vlc_renderer_discovery_t
* p_rd
, vlc_renderer_item_t
* p_item
);
200 * Add a new renderer item
202 * This will send the vlc_RendererDiscoveryItemRemoved event
205 vlc_rd_remove_item(vlc_renderer_discovery_t
* p_rd
, vlc_renderer_item_t
* p_item
);
208 * Renderer Discovery proble helpers
211 vlc_rd_probe_add(vlc_probe_t
*p_probe
, const char *psz_name
,
212 const char *psz_longname
);
214 #define VLC_RD_PROBE_HELPER(name, longname) \
215 static int vlc_rd_probe_open(vlc_object_t *obj) \
217 return vlc_rd_probe_add((struct vlc_probe_t *)obj, name, longname); \
220 #define VLC_RD_PROBE_SUBMODULE \
222 set_capability("renderer probe", 100) \
223 set_callbacks(vlc_rd_probe_open, NULL)