VLC 4.0.0-dev
Loading...
Searching...
No Matches
libvlc_media_discoverer.h
Go to the documentation of this file.
1/*****************************************************************************
2 * libvlc_media_discoverer.h: libvlc external API
3 *****************************************************************************
4 * Copyright (C) 1998-2009 VLC authors and VideoLAN
5 *
6 * Authors: Clément Stenac <zorglub@videolan.org>
7 * Jean-Paul Saman <jpsaman@videolan.org>
8 * Pierre d'Herbemont <pdherbemont@videolan.org>
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation; either version 2.1 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with this program; if not, write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
24
25#ifndef VLC_LIBVLC_MEDIA_DISCOVERER_H
26#define VLC_LIBVLC_MEDIA_DISCOVERER_H 1
27
28# ifdef __cplusplus
29extern "C" {
30# endif
31
32typedef struct libvlc_media_t libvlc_media_t;
33
34/**
35 * Category of a media discoverer
36 * \see libvlc_media_discoverer_list_get()
37 */
39 /** devices, like portable music player */
41 /** LAN/WAN services, like Upnp, SMB, or SAP */
43 /** Podcasts */
45 /** Local directories, like Video, Music or Pictures directories */
48
49/**
50 * Media discoverer description
51 * \see libvlc_media_discoverer_list_get()
52 */
58
59/** \defgroup libvlc_media_discoverer LibVLC media discovery
60 * \ingroup libvlc
61 * LibVLC media discovery finds available media via various means.
62 * This corresponds to the service discovery functionality in VLC media player.
63 * Different plugins find potential medias locally (e.g. user media directory),
64 * from peripherals (e.g. video capture device), on the local network
65 * (e.g. SAP) or on the Internet (e.g. Internet radios).
66 * @{
67 * \file
68 * LibVLC media discovery external API
69 */
70
72
73/**
74 * struct defining callbacks for libvlc_media_discoverer_new()
75 */
77 /**
78 * Version of struct libvlc_media_discoverer_cbs
79 */
80 uint32_t version;
81
82 /**
83 * Callback prototype that notify when the discoverer added a media
84 *
85 * \note Optional (can be NULL),
86 * available since version 0
87 *
88 * \param opaque opaque pointer set by libvlc_media_discoverer_new()
89 * \param parent parent of the new added media or NULL if there is no
90 * parents (more likely)
91 * \param media the new added media
92 */
93 void (*on_media_added)(void *opaque, libvlc_media_t *parent,
94 libvlc_media_t *media);
95
96 /**
97 * Callback prototype that notify when the discoverer removed a media
98 *
99 * \note Optional (can be NULL),
100 * available since version 0
101 *
102 * \param opaque opaque pointer set by libvlc_media_discoverer_new()
103 * \param media the removed media
104 */
105 void (*on_media_removed)(void *opaque, libvlc_media_t *media);
106};
107
108/**
109 * Create a media discoverer object by name.
110 *
111 * You need to call libvlc_media_discoverer_start() in order to start the
112 * discovery.
113 *
114 * \see libvlc_media_discoverer_start
115 *
116 * \param p_inst libvlc instance
117 * \param psz_name service name; use libvlc_media_discoverer_list_get() to get
118 * a list of the discoverer names available in this libVLC instance
119 * \param cbs callback to listen to events (can be NULL). The pointed
120 * struct must be kept alive (and not modified) by the caller until the
121 * returned object is destroyed with libvlc_media_discoverer_destroy().
122 * \param cbs_opaque opaque pointer used by the callbacks
123 * \return media discover object or NULL in case of error
124 * \version LibVLC 3.0.0 or later
125 */
128 const char * psz_name,
129 const struct libvlc_media_discoverer_cbs *cbs,
130 void *cbs_opaque );
131
132/**
133 * Start media discovery.
134 *
135 * To stop it, call libvlc_media_discoverer_stop() or
136 * libvlc_media_discoverer_destroy() directly.
137 *
138 * \see libvlc_media_discoverer_stop
139 *
140 * \param p_mdis media discover object
141 * \return -1 in case of error, 0 otherwise
142 * \version LibVLC 3.0.0 or later
143 */
144LIBVLC_API int
146
147/**
148 * Stop media discovery.
149 *
150 * \see libvlc_media_discoverer_start
151 *
152 * \param p_mdis media discover object
153 * \version LibVLC 3.0.0 or later
154 */
155LIBVLC_API void
157
158/**
159 * Destroy a media discoverer object. If the discovery is running, it will be
160 * stopped first.
161 *
162 * \param p_mdis media service discover object
163 * \version LibVLC 4.0.0 or later
164 */
165LIBVLC_API void
167
168/**
169 * Query if media service discover object is running.
170 *
171 * \param p_mdis media service discover object
172 *
173 * \retval true running
174 * \retval false not running
175 */
176LIBVLC_API bool
178
179/**
180 * Get media discoverer services by category
181 *
182 * \version LibVLC 3.0.0 and later.
183 *
184 * \param p_inst libvlc instance
185 * \param i_cat category of services to fetch
186 * \param ppp_services address to store an allocated array of media discoverer
187 * services (must be freed with libvlc_media_discoverer_list_release() by
188 * the caller) [OUT]
189 *
190 * \return the number of media discoverer services (0 on error)
191 */
192LIBVLC_API size_t
196
197/**
198 * Release an array of media discoverer services
199 *
200 * \version LibVLC 3.0.0 and later.
201 *
202 * \see libvlc_media_discoverer_list_get()
203 *
204 * \param pp_services array to release
205 * \param i_count number of elements in the array
206 */
207LIBVLC_API void
209 size_t i_count );
210
211/**@} */
212
213# ifdef __cplusplus
214}
215# endif
216
217#endif /* <vlc/libvlc.h> */
struct libvlc_instance_t libvlc_instance_t
This structure is opaque.
Definition libvlc.h:76
LIBVLC_API bool libvlc_media_discoverer_is_running(libvlc_media_discoverer_t *p_mdis)
Query if media service discover object is running.
LIBVLC_API void libvlc_media_discoverer_stop(libvlc_media_discoverer_t *p_mdis)
Stop media discovery.
LIBVLC_API int libvlc_media_discoverer_start(libvlc_media_discoverer_t *p_mdis)
Start media discovery.
LIBVLC_API libvlc_media_discoverer_t * libvlc_media_discoverer_new(libvlc_instance_t *p_inst, const char *psz_name, const struct libvlc_media_discoverer_cbs *cbs, void *cbs_opaque)
Create a media discoverer object by name.
LIBVLC_API void libvlc_media_discoverer_list_release(libvlc_media_discoverer_description_t **pp_services, size_t i_count)
Release an array of media discoverer services.
LIBVLC_API size_t libvlc_media_discoverer_list_get(libvlc_instance_t *p_inst, libvlc_media_discoverer_category_t i_cat, libvlc_media_discoverer_description_t ***ppp_services)
Get media discoverer services by category.
struct libvlc_media_discoverer_t libvlc_media_discoverer_t
Definition libvlc_media_discoverer.h:71
LIBVLC_API void libvlc_media_discoverer_destroy(libvlc_media_discoverer_t *p_mdis)
Destroy a media discoverer object.
struct libvlc_media_t libvlc_media_t
Definition libvlc_media.h:47
#define LIBVLC_API
Definition libvlc.h:42
libvlc_media_discoverer_category_t
Category of a media discoverer.
Definition libvlc_media_discoverer.h:38
@ libvlc_media_discoverer_localdirs
Local directories, like Video, Music or Pictures directories.
Definition libvlc_media_discoverer.h:46
@ libvlc_media_discoverer_lan
LAN/WAN services, like Upnp, SMB, or SAP.
Definition libvlc_media_discoverer.h:42
@ libvlc_media_discoverer_podcasts
Podcasts.
Definition libvlc_media_discoverer.h:44
@ libvlc_media_discoverer_devices
devices, like portable music player
Definition libvlc_media_discoverer.h:40
struct defining callbacks for libvlc_media_discoverer_new()
Definition libvlc_media_discoverer.h:76
void(* on_media_added)(void *opaque, libvlc_media_t *parent, libvlc_media_t *media)
Callback prototype that notify when the discoverer added a media.
Definition libvlc_media_discoverer.h:93
void(* on_media_removed)(void *opaque, libvlc_media_t *media)
Callback prototype that notify when the discoverer removed a media.
Definition libvlc_media_discoverer.h:105
uint32_t version
Version of struct libvlc_media_discoverer_cbs.
Definition libvlc_media_discoverer.h:80
Media discoverer description.
Definition libvlc_media_discoverer.h:53
char * psz_name
Definition libvlc_media_discoverer.h:54
char * psz_longname
Definition libvlc_media_discoverer.h:55
libvlc_media_discoverer_category_t i_cat
Definition libvlc_media_discoverer.h:56
const char * psz_name
Definition text_style.c:33