Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
GSoC
GSoC2018
macOS
vlc
Commits
9882ff2e
Commit
9882ff2e
authored
Jun 10, 2018
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sd: move callbacks to constant structure
parent
a6e1e1b0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
10 deletions
+23
-10
include/vlc_services_discovery.h
include/vlc_services_discovery.h
+11
-6
lib/media_discoverer.c
lib/media_discoverer.c
+6
-2
src/playlist/services_discovery.c
src/playlist/services_discovery.c
+6
-2
No files found.
include/vlc_services_discovery.h
View file @
9882ff2e
...
...
@@ -40,14 +40,19 @@ extern "C" {
* @{
*/
struct
services_discovery_
owner_t
struct
services_discovery_
callbacks
{
void
*
sys
;
/**< Private data for the owner callbacks */
void
(
*
item_added
)(
struct
services_discovery_t
*
sd
,
input_item_t
*
parent
,
input_item_t
*
item
,
const
char
*
category
);
void
(
*
item_removed
)(
struct
services_discovery_t
*
sd
,
input_item_t
*
item
);
};
struct
services_discovery_owner_t
{
const
struct
services_discovery_callbacks
*
cbs
;
void
*
sys
;
/**< Private data for the owner callbacks */
};
/**
* Main service discovery structure to build a SD module
*/
...
...
@@ -157,7 +162,7 @@ VLC_API void vlc_sd_Destroy( services_discovery_t * );
static
inline
void
services_discovery_AddItem
(
services_discovery_t
*
sd
,
input_item_t
*
item
)
{
sd
->
owner
.
item_added
(
sd
,
NULL
,
item
,
NULL
);
sd
->
owner
.
cbs
->
item_added
(
sd
,
NULL
,
item
,
NULL
);
}
/**
...
...
@@ -181,7 +186,7 @@ static inline void services_discovery_AddSubItem(services_discovery_t *sd,
input_item_t
*
parent
,
input_item_t
*
item
)
{
sd
->
owner
.
item_added
(
sd
,
parent
,
item
,
NULL
);
sd
->
owner
.
cbs
->
item_added
(
sd
,
parent
,
item
,
NULL
);
}
/**
...
...
@@ -195,7 +200,7 @@ static inline void services_discovery_AddItemCat(services_discovery_t *sd,
input_item_t
*
item
,
const
char
*
category
)
{
sd
->
owner
.
item_added
(
sd
,
NULL
,
item
,
category
);
sd
->
owner
.
cbs
->
item_added
(
sd
,
NULL
,
item
,
category
);
}
/**
...
...
@@ -207,7 +212,7 @@ static inline void services_discovery_AddItemCat(services_discovery_t *sd,
static
inline
void
services_discovery_RemoveItem
(
services_discovery_t
*
sd
,
input_item_t
*
item
)
{
sd
->
owner
.
item_removed
(
sd
,
item
);
sd
->
owner
.
cbs
->
item_removed
(
sd
,
item
);
}
/* SD probing */
...
...
lib/media_discoverer.c
View file @
9882ff2e
...
...
@@ -169,6 +169,11 @@ libvlc_media_discoverer_new( libvlc_instance_t * p_inst, const char * psz_name )
return
p_mdis
;
}
static
const
struct
services_discovery_callbacks
sd_cbs
=
{
.
item_added
=
services_discovery_item_added
,
.
item_removed
=
services_discovery_item_removed
,
};
/**************************************************************************
* start (Public)
**************************************************************************/
...
...
@@ -176,9 +181,8 @@ LIBVLC_API int
libvlc_media_discoverer_start
(
libvlc_media_discoverer_t
*
p_mdis
)
{
struct
services_discovery_owner_t
owner
=
{
&
sd_cbs
,
p_mdis
,
services_discovery_item_added
,
services_discovery_item_removed
,
};
/* Here we go */
...
...
src/playlist/services_discovery.c
View file @
9882ff2e
...
...
@@ -110,6 +110,11 @@ static void playlist_sd_item_removed(services_discovery_t *sd,
playlist_Unlock
(
playlist
);
}
static
const
struct
services_discovery_callbacks
playlist_sd_cbs
=
{
.
item_added
=
playlist_sd_item_added
,
.
item_removed
=
playlist_sd_item_removed
,
};
int
playlist_ServicesDiscoveryAdd
(
playlist_t
*
playlist
,
const
char
*
chain
)
{
vlc_sd_internal_t
*
sds
=
malloc
(
sizeof
(
*
sds
)
+
strlen
(
chain
)
+
1
);
...
...
@@ -119,9 +124,8 @@ int playlist_ServicesDiscoveryAdd(playlist_t *playlist, const char *chain)
sds
->
node
=
NULL
;
struct
services_discovery_owner_t
owner
=
{
&
playlist_sd_cbs
,
sds
,
playlist_sd_item_added
,
playlist_sd_item_removed
,
};
/* Perform the addition */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment