forked from videolan/vlc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vlc_renderer_discovery.h
224 lines (193 loc) · 6.36 KB
/
vlc_renderer_discovery.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
/*****************************************************************************
* vlc_renderer_discovery.h : Renderer Discovery functions
*****************************************************************************
* Copyright (C) 2016 VLC authors and VideoLAN
*
* 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.
*****************************************************************************/
#ifndef VLC_RENDERER_DISCOVERY_H
#define VLC_RENDERER_DISCOVERY_H 1
#include <vlc_input.h>
#include <vlc_probe.h>
#include <vlc_url.h>
/**
* @defgroup vlc_renderer VLC renderer discovery
* @ingroup interface
* @{
*
* @file
* This file declares VLC renderer discvoery structures and functions
*
* @defgroup vlc_renderer_item VLC renderer items returned by the discovery
* @{
*/
#define VLC_RENDERER_CAN_AUDIO 0x0001
#define VLC_RENDERER_CAN_VIDEO 0x0002
/**
* Create a new renderer item
*
* @param psz_type type of the item
* @param psz_name name of the item
* @param psz_uri uri of the renderer item, must contains a valid protocol and
* a valid host
* @param psz_extra_sout extra sout options
* @param psz_demux_filter demux filter to use with the renderer
* @param psz_icon_uri icon uri of the renderer item
* @param i_flags flags for the item
* @return a renderer item or NULL in case of error
*/
VLC_API 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) VLC_USED;
/**
* Hold a renderer item, i.e. creates a new reference
*/
VLC_API vlc_renderer_item_t *
vlc_renderer_item_hold(vlc_renderer_item_t *p_item);
/**
* Releases a renderer item, i.e. decrements its reference counter
*/
VLC_API void
vlc_renderer_item_release(vlc_renderer_item_t *p_item);
/**
* Get the human readable name of a renderer item
*/
VLC_API const char *
vlc_renderer_item_name(const vlc_renderer_item_t *p_item);
/**
* Get the type (not translated) of a renderer item. For now, the type can only
* be "chromecast" ("upnp", "airplay" may come later).
*/
VLC_API const char *
vlc_renderer_item_type(const vlc_renderer_item_t *p_item);
/**
* Get the demux filter to use with a renderer item
*/
VLC_API const char *
vlc_renderer_item_demux_filter(const vlc_renderer_item_t *p_item);
/**
* Get the sout command of a renderer item
*/
VLC_API const char *
vlc_renderer_item_sout(const vlc_renderer_item_t *p_item);
/**
* Get the icon uri of a renderer item
*/
VLC_API const char *
vlc_renderer_item_icon_uri(const vlc_renderer_item_t *p_item);
/**
* Get the flags of a renderer item
*/
VLC_API int
vlc_renderer_item_flags(const vlc_renderer_item_t *p_item);
/**
* @}
* @defgroup vlc_renderer_discovery VLC renderer discovery interface
* @{
*/
struct vlc_renderer_discovery_owner;
/**
* Return a list of renderer discovery modules
*
* @param p_obj any VLC object to get a libvlc instance from TODO
* @param pppsz_names a pointer to a list of module name, NULL terminated
* @param pppsz_longnames a pointer to a list of module longname, NULL
* terminated
*
* @return VLC_SUCCESS on success, or VLC_EGENERIC on error
*/
VLC_API int
vlc_rd_get_names(vlc_object_t *p_obj, char ***pppsz_names,
char ***pppsz_longnames) VLC_USED;
#define vlc_rd_get_names(a, b, c) \
vlc_rd_get_names(VLC_OBJECT(a), b, c)
/**
* Create a new renderer discovery module
*
* @param p_obj the parent VLC object the variables will be inherited from
* @param psz_name name of the module to load, see vlc_rd_get_names() to get
* the list of names
* @param owner owner object with callback that the renderer discovery will
* notify when new renderers are found or removed
*
* @return a valid vlc_renderer_discovery, need to be released with
* vlc_rd_release()
*/
VLC_API vlc_renderer_discovery_t *
vlc_rd_new(vlc_object_t *p_obj, const char *psz_name,
const struct vlc_renderer_discovery_owner *owner) VLC_USED;
VLC_API void vlc_rd_release(vlc_renderer_discovery_t *p_rd);
/**
* @}
* @defgroup vlc_renderer_discovery_module VLC renderer module
* @{
*/
struct vlc_renderer_discovery_owner
{
void *sys;
void (*item_added)(struct vlc_renderer_discovery_t *,
struct vlc_renderer_item_t *);
void (*item_removed)(struct vlc_renderer_discovery_t *,
struct vlc_renderer_item_t *);
};
struct vlc_renderer_discovery_t
{
struct vlc_object_t obj;
module_t * p_module;
struct vlc_renderer_discovery_owner owner;
char * psz_name;
config_chain_t * p_cfg;
void *p_sys;
};
/**
* Add a new renderer item
*
* This will send the vlc_RendererDiscoveryItemAdded event
*/
static inline void vlc_rd_add_item(vlc_renderer_discovery_t * p_rd,
vlc_renderer_item_t * p_item)
{
p_rd->owner.item_added(p_rd, p_item);
}
/**
* Add a new renderer item
*
* This will send the vlc_RendererDiscoveryItemRemoved event
*/
static inline void vlc_rd_remove_item(vlc_renderer_discovery_t * p_rd,
vlc_renderer_item_t * p_item)
{
p_rd->owner.item_removed(p_rd, p_item);
}
/**
* Renderer Discovery probe helpers
*/
VLC_API int
vlc_rd_probe_add(vlc_probe_t *p_probe, const char *psz_name,
const char *psz_longname);
#define VLC_RD_PROBE_HELPER(name, longname) \
static int vlc_rd_probe_open(vlc_object_t *obj) \
{ \
return vlc_rd_probe_add((struct vlc_probe_t *)obj, name, longname); \
}
#define VLC_RD_PROBE_SUBMODULE \
add_submodule() \
set_capability("renderer probe", 100) \
set_callback(vlc_rd_probe_open)
/** @} */
/** @} */
#endif