VLC  4.0.0-dev
vlc_renderer_discovery.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * vlc_renderer_discovery.h : Renderer Discovery functions
3  *****************************************************************************
4  * Copyright (C) 2016 VLC authors and VideoLAN
5  *
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.
10  *
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.
15  *
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  *****************************************************************************/
20 
21 #ifndef VLC_RENDERER_DISCOVERY_H
22 #define VLC_RENDERER_DISCOVERY_H 1
23 
24 #include <vlc_input.h>
25 #include <vlc_probe.h>
26 #include <vlc_url.h>
27 
28 /**
29  * @defgroup vlc_renderer VLC renderer discovery
30  * @ingroup interface
31  * @{
32  *
33  * @file
34  * This file declares VLC renderer discvoery structures and functions
35  *
36  * @defgroup vlc_renderer_item VLC renderer items returned by the discovery
37  * @{
38  */
39 
40 #define VLC_RENDERER_CAN_AUDIO 0x0001
41 #define VLC_RENDERER_CAN_VIDEO 0x0002
42 
43 /**
44  * Create a new renderer item
45  *
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
49  * a valid host
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
55  */
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;
61 
62 /**
63  * Hold a renderer item, i.e. creates a new reference
64  */
67 
68 /**
69  * Releases a renderer item, i.e. decrements its reference counter
70  */
71 VLC_API void
73 
74 /**
75  * Get the human readable name of a renderer item
76  */
77 VLC_API const char *
79 
80 /**
81  * Get the type (not translated) of a renderer item. For now, the type can only
82  * be "chromecast" ("upnp", "airplay" may come later).
83  */
84 VLC_API const char *
86 
87 /**
88  * Get the demux filter to use with a renderer item
89  */
90 VLC_API const char *
92 
93 /**
94  * Get the sout command of a renderer item
95  */
96 VLC_API const char *
98 
99 /**
100  * Get the icon uri of a renderer item
101  */
102 VLC_API const char *
104 
105 /**
106  * Get the flags of a renderer item
107  */
108 VLC_API int
110 
111 /**
112  * @}
113  * @defgroup vlc_renderer_discovery VLC renderer discovery interface
114  * @{
115  */
116 
118 
119 /**
120  * Return a list of renderer discovery modules
121  *
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
124  * terminated
125  *
126  * @return VLC_SUCCESS on success, or VLC_EGENERIC on error
127  */
128 VLC_API int
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)
133 
134 /**
135  * Create a new renderer discovery module
136  *
137  * @param psz_name name of the module to load, see vlc_rd_get_names() to get
138  * the list of names
139  *
140  * @return a valid vlc_renderer_discovery, need to be released with
141  * vlc_rd_release()
142  */
144 vlc_rd_new(vlc_object_t *p_obj, const char *psz_name,
145  const struct vlc_renderer_discovery_owner *owner) VLC_USED;
146 
148 
149 /**
150  * @}
151  * @defgroup vlc_renderer_discovery_module VLC renderer module
152  * @{
153  */
154 
156 {
157  void *sys;
160  void (*item_removed)(struct vlc_renderer_discovery_t *,
162 };
163 
165 {
166  struct vlc_object_t obj;
167  module_t * p_module;
169  struct vlc_renderer_discovery_owner owner;
171  char * psz_name;
172  config_chain_t * p_cfg;
174  void *p_sys;
175 };
176 
177 /**
178  * Add a new renderer item
179  *
180  * This will send the vlc_RendererDiscoveryItemAdded event
181  */
182 static inline void vlc_rd_add_item(vlc_renderer_discovery_t * p_rd,
184 {
185  p_rd->owner.item_added(p_rd, p_item);
186 }
187 
188 /**
189  * Add a new renderer item
190  *
191  * This will send the vlc_RendererDiscoveryItemRemoved event
192  */
193 static inline void vlc_rd_remove_item(vlc_renderer_discovery_t * p_rd,
195 {
196  p_rd->owner.item_removed(p_rd, p_item);
197 }
198 
199 /**
200  * Renderer Discovery proble helpers
201  */
202 VLC_API int
203 vlc_rd_probe_add(vlc_probe_t *p_probe, const char *psz_name,
204  const char *psz_longname);
205 
206 #define VLC_RD_PROBE_HELPER(name, longname) \
207 static int vlc_rd_probe_open(vlc_object_t *obj) \
208 { \
209  return vlc_rd_probe_add((struct vlc_probe_t *)obj, name, longname); \
210 }
211 
212 #define VLC_RD_PROBE_SUBMODULE \
213  add_submodule() \
214  set_capability("renderer probe", 100) \
215  set_callback(vlc_rd_probe_open)
216 
217 /** @} @} */
218 
219 #endif
vlc_renderer_item_t * vlc_renderer_item_new(const char *psz_type, const char *psz_name, const char *psz_uri, const char *psz_extra_sout, const char *psz_demux_filter, const char *psz_icon_uri, int i_flags)
Create a new renderer item.
Definition: renderer_discovery.c:57
int vlc_rd_probe_add(vlc_probe_t *p_probe, const char *psz_name, const char *psz_longname)
Renderer Discovery proble helpers.
Definition: renderer_discovery.c:182
const char * vlc_renderer_item_demux_filter(const vlc_renderer_item_t *p_item)
Get the demux filter to use with a renderer item.
Definition: renderer_discovery.c:142
const char * vlc_renderer_item_icon_uri(const vlc_renderer_item_t *p_item)
Get the icon uri of a renderer item.
Definition: renderer_discovery.c:134
vlc_renderer_discovery_t * vlc_rd_new(vlc_object_t *p_obj, const char *psz_name, const struct vlc_renderer_discovery_owner *owner)
Create a new renderer discovery module.
struct vlc_renderer_discovery_owner owner
Definition: vlc_renderer_discovery.h:170
void(* item_removed)(struct vlc_renderer_discovery_t *, struct vlc_renderer_item_t *)
Definition: vlc_renderer_discovery.h:161
This file defines functions for manipulating URL in vlc.
Internal module descriptor.
Definition: modules.h:75
void * sys
Definition: vlc_renderer_discovery.h:158
static void vlc_rd_add_item(vlc_renderer_discovery_t *p_rd, vlc_renderer_item_t *p_item)
Add a new renderer item.
Definition: vlc_renderer_discovery.h:183
Definition: renderer_discovery.c:34
const char * psz_name
Definition: text_style.c:33
Definition: vlc_configuration.h:331
Definition: vlc_renderer_discovery.h:156
const char * vlc_renderer_item_name(const vlc_renderer_item_t *p_item)
Get the human readable name of a renderer item.
Definition: renderer_discovery.c:110
#define vlc_rd_get_names(a, b, c)
Definition: vlc_renderer_discovery.h:132
static void vlc_rd_remove_item(vlc_renderer_discovery_t *p_rd, vlc_renderer_item_t *p_item)
Add a new renderer item.
Definition: vlc_renderer_discovery.h:194
void(* item_added)(struct vlc_renderer_discovery_t *, struct vlc_renderer_item_t *)
Definition: vlc_renderer_discovery.h:159
#define VLC_API
Definition: fourcc_gen.c:31
void vlc_renderer_item_release(vlc_renderer_item_t *p_item)
Releases a renderer item, i.e.
Definition: renderer_discovery.c:167
Definition: vlc_renderer_discovery.h:165
This file defines functions and structures to run-time probe VLC extensions.
const char * vlc_renderer_item_type(const vlc_renderer_item_t *p_item)
Get the type (not translated) of a renderer item.
Definition: renderer_discovery.c:118
void vlc_rd_release(vlc_renderer_discovery_t *p_rd)
Definition: renderer_discovery.c:234
Input thread interface.
vlc_renderer_item_t * vlc_renderer_item_hold(vlc_renderer_item_t *p_item)
Hold a renderer item, i.e.
Definition: renderer_discovery.c:158
VLC object common members.
Definition: vlc_objects.h:43
const char * vlc_renderer_item_sout(const vlc_renderer_item_t *p_item)
Get the sout command of a renderer item.
Definition: renderer_discovery.c:126
int vlc_renderer_item_flags(const vlc_renderer_item_t *p_item)
Get the flags of a renderer item.
Definition: renderer_discovery.c:150
#define VLC_USED
Definition: fourcc_gen.c:32
Definition: vlc_probe.h:40