[vlc-commits] sd: split services_discovery_AddItem()
Rémi Denis-Courmont
git at videolan.org
Sun May 14 18:37:40 CEST 2017
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun May 14 10:36:07 2017 +0300| [21d61f40b29a3cb0d0d341b4822e30eb1b1e265c] | committer: Rémi Denis-Courmont
sd: split services_discovery_AddItem()
Add a separate callback wrapper for item with category, which is long
since deprecated. Remove the category parameter from the normal
callback wrapper.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=21d61f40b29a3cb0d0d341b4822e30eb1b1e265c
---
include/vlc_services_discovery.h | 17 ++++++++++++++---
modules/access/dsm/sd.c | 2 +-
modules/lua/libs/sd.c | 4 ++--
modules/services_discovery/avahi.c | 2 +-
modules/services_discovery/bonjour.m | 2 +-
modules/services_discovery/mediadirs.c | 8 ++++----
modules/services_discovery/microdns.c | 2 +-
modules/services_discovery/mtp.c | 2 +-
modules/services_discovery/os2drive.c | 2 +-
modules/services_discovery/podcast.c | 4 ++--
modules/services_discovery/pulse.c | 4 ++--
modules/services_discovery/sap.c | 4 ++--
modules/services_discovery/udev.c | 2 +-
modules/services_discovery/upnp.cpp | 2 +-
modules/services_discovery/windrive.c | 2 +-
modules/services_discovery/xcb_apps.c | 4 ++--
16 files changed, 37 insertions(+), 26 deletions(-)
diff --git a/include/vlc_services_discovery.h b/include/vlc_services_discovery.h
index 8f8a55bbcb..1456a8945b 100644
--- a/include/vlc_services_discovery.h
+++ b/include/vlc_services_discovery.h
@@ -159,12 +159,23 @@ VLC_API void vlc_sd_Destroy( services_discovery_t * );
*
* @param sd services discoverer / services discovery module instance
* @param item input item to add
+ */
+static inline void services_discovery_AddItem(services_discovery_t *sd,
+ input_item_t *item)
+{
+ return sd->owner.item_added(sd, item, NULL);
+}
+
+/**
+ * Added service backward compatibility callback.
+ *
* @param category Optional name of a group that the item belongs in
* (for backward compatibility with legacy modules)
*/
-static inline void services_discovery_AddItem(services_discovery_t *sd,
- input_item_t *item,
- const char *category)
+VLC_DEPRECATED
+static inline void services_discovery_AddItemCat(services_discovery_t *sd,
+ input_item_t *item,
+ const char *category)
{
return sd->owner.item_added(sd, item, category);
}
diff --git a/modules/access/dsm/sd.c b/modules/access/dsm/sd.c
index b6252fd8dd..94129dc504 100644
--- a/modules/access/dsm/sd.c
+++ b/modules/access/dsm/sd.c
@@ -69,7 +69,7 @@ static void entry_item_append( services_discovery_t *p_sd,
p_entry_item->p_item = p_item;
input_item_Hold( p_item );
vlc_array_append( &p_sys->entry_item_list, p_entry_item );
- services_discovery_AddItem( p_sd, p_item, NULL );
+ services_discovery_AddItem( p_sd, p_item );
}
static void entry_item_remove( services_discovery_t *p_sd,
diff --git a/modules/lua/libs/sd.c b/modules/lua/libs/sd.c
index e8561fca31..455547a9d3 100644
--- a/modules/lua/libs/sd.c
+++ b/modules/lua/libs/sd.c
@@ -337,9 +337,9 @@ static int vlclua_sd_add_common( services_discovery_t *p_sd, lua_State *L,
lua_getfield( L, -2, "category" );
if( lua_isstring( L, -1 ) )
- services_discovery_AddItem( p_sd, p_input, luaL_checkstring( L, -1 ) );
+ services_discovery_AddItemCat( p_sd, p_input, luaL_checkstring( L, -1 ) );
else
- services_discovery_AddItem( p_sd, p_input, NULL );
+ services_discovery_AddItem( p_sd, p_input );
lua_pop( L, 1 );
return 1;
diff --git a/modules/services_discovery/avahi.c b/modules/services_discovery/avahi.c
index 3026b7aac9..bf19ad68c4 100644
--- a/modules/services_discovery/avahi.c
+++ b/modules/services_discovery/avahi.c
@@ -205,7 +205,7 @@ static void resolve_callback(
{
vlc_dictionary_insert( &p_sys->services_name_to_input_item,
name, p_input );
- services_discovery_AddItem( p_sd, p_input, NULL /* no category */ );
+ services_discovery_AddItem( p_sd, p_input );
input_item_Release( p_input );
}
}
diff --git a/modules/services_discovery/bonjour.m b/modules/services_discovery/bonjour.m
index 3e20382c45..03552aec54 100644
--- a/modules/services_discovery/bonjour.m
+++ b/modules/services_discovery/bonjour.m
@@ -331,7 +331,7 @@ NSString *const VLCBonjourRendererDemux = @"VLCBonjourRendererDemux";
NSString *uri = [NSString stringWithFormat:@"%@://%@:%ld", protocol, netService.hostName, netService.port];
input_item_t *p_input_item = input_item_NewDirectory([uri UTF8String], [netService.name UTF8String], ITEM_NET );
if (p_input_item != NULL) {
- services_discovery_AddItem( p_sd, p_input_item, NULL);
+ services_discovery_AddItem(p_sd, p_input_item);
[_inputItemsForNetServices addObject:[NSValue valueWithPointer:p_input_item]];
[_resolvedNetServices addObject:netService];
}
diff --git a/modules/services_discovery/mediadirs.c b/modules/services_discovery/mediadirs.c
index 2dd2ab26d9..1a8e5fa580 100644
--- a/modules/services_discovery/mediadirs.c
+++ b/modules/services_discovery/mediadirs.c
@@ -254,7 +254,7 @@ static void input_item_subitem_added( const vlc_event_t * p_event,
if( p_sys->i_type == Picture )
formatSnapshotItem( p_item );
- services_discovery_AddItem( p_sd, p_item, NULL );
+ services_discovery_AddItem( p_sd, p_item );
}
static int onNewFileAdded( vlc_object_t *p_this, char const *psz_var,
@@ -278,7 +278,7 @@ static int onNewFileAdded( vlc_object_t *p_this, char const *psz_var,
if( fileType( p_sd, psz_file ) == Picture )
{
formatSnapshotItem( p_item );
- services_discovery_AddItem( p_sd, p_item, NULL );
+ services_discovery_AddItem( p_sd, p_item );
msg_Dbg( p_sd, "New snapshot added : %s", psz_file );
}
@@ -287,7 +287,7 @@ static int onNewFileAdded( vlc_object_t *p_this, char const *psz_var,
{
if( fileType( p_sd, psz_file ) == Audio )
{
- services_discovery_AddItem( p_sd, p_item, NULL );
+ services_discovery_AddItem( p_sd, p_item );
msg_Dbg( p_sd, "New recorded audio added : %s", psz_file );
}
@@ -297,7 +297,7 @@ static int onNewFileAdded( vlc_object_t *p_this, char const *psz_var,
if( fileType( p_sd, psz_file ) == Video ||
fileType( p_sd, psz_file ) == Unknown )
{
- services_discovery_AddItem( p_sd, p_item, NULL );
+ services_discovery_AddItem( p_sd, p_item );
msg_Dbg( p_sd, "New recorded video added : %s", psz_file );
}
diff --git a/modules/services_discovery/microdns.c b/modules/services_discovery/microdns.c
index b68df771db..7fe5feb0bb 100644
--- a/modules/services_discovery/microdns.c
+++ b/modules/services_discovery/microdns.c
@@ -175,7 +175,7 @@ items_add_input( struct discovery_sys *p_sys, services_discovery_t *p_sd,
p_item->p_renderer_item = NULL;
p_item->i_last_seen = mdate();
vlc_array_append( &p_sys->items, p_item );
- services_discovery_AddItem( p_sd, p_input_item, NULL );
+ services_discovery_AddItem( p_sd, p_input_item );
return VLC_SUCCESS;
}
diff --git a/modules/services_discovery/mtp.c b/modules/services_discovery/mtp.c
index 0beaee7c74..e79d04a1f1 100644
--- a/modules/services_discovery/mtp.c
+++ b/modules/services_discovery/mtp.c
@@ -267,7 +267,7 @@ static void AddTrack( services_discovery_t *p_sd, LIBMTP_track_t *p_track )
}
input_item_SetDate( p_input, p_track->date );
input_item_SetDuration( p_input, p_track->duration * 1000 );
- services_discovery_AddItem( p_sd, p_input, NULL );
+ services_discovery_AddItem( p_sd, p_input );
p_sd->p_sys->pp_items[p_sd->p_sys->i_count++] = p_input;
}
diff --git a/modules/services_discovery/os2drive.c b/modules/services_discovery/os2drive.c
index e04728a3fa..36343607b9 100644
--- a/modules/services_discovery/os2drive.c
+++ b/modules/services_discovery/os2drive.c
@@ -95,7 +95,7 @@ static int Open (vlc_object_t *obj)
if (item == NULL)
break;
- services_discovery_AddItem (sd, item, NULL);
+ services_discovery_AddItem (sd, item);
}
}
diff --git a/modules/services_discovery/podcast.c b/modules/services_discovery/podcast.c
index 313e92c3a2..ba61c802bd 100644
--- a/modules/services_discovery/podcast.c
+++ b/modules/services_discovery/podcast.c
@@ -327,7 +327,7 @@ static void ParseUrls( services_discovery_t *p_sd, char *psz_urls )
input_item_AddOption( p_input, "demux=podcast", VLC_INPUT_OPTION_TRUSTED );
INSERT_ELEM( pp_new_items, i_new_items, i_new_items, p_input );
- services_discovery_AddItem( p_sd, p_input, NULL /* no cat */ );
+ services_discovery_AddItem( p_sd, p_input );
INSERT_ELEM( p_sys->pp_input, p_sys->i_input, p_sys->i_input,
input_CreateAndStart( p_sd, p_input, NULL ) );
@@ -402,7 +402,7 @@ static void ParseRequest( services_discovery_t *p_sd )
input_item_AddOption( p_input, "demux=podcast", VLC_INPUT_OPTION_TRUSTED );
INSERT_ELEM( p_sys->pp_items, p_sys->i_items, p_sys->i_items, p_input );
- services_discovery_AddItem( p_sd, p_input, NULL /* no cat */ );
+ services_discovery_AddItem( p_sd, p_input );
INSERT_ELEM( p_sys->pp_input, p_sys->i_input, p_sys->i_input,
input_CreateAndStart( p_sd, p_input, NULL ) );
diff --git a/modules/services_discovery/pulse.c b/modules/services_discovery/pulse.c
index 2dd1ddd59b..2c0771d200 100644
--- a/modules/services_discovery/pulse.c
+++ b/modules/services_discovery/pulse.c
@@ -181,8 +181,8 @@ static int AddSource (services_discovery_t *sd, const pa_source_info *info)
}
const char *card = pa_proplist_gets(info->proplist, "device.product.name");
- services_discovery_AddItem (sd, item,
- (card != NULL) ? card : N_("Generic"));
+ services_discovery_AddItemCat(sd, item,
+ (card != NULL) ? card : N_("Generic"));
d->sd = sd;
return 0;
}
diff --git a/modules/services_discovery/sap.c b/modules/services_discovery/sap.c
index 6fc5971daf..48729c671f 100644
--- a/modules/services_discovery/sap.c
+++ b/modules/services_discovery/sap.c
@@ -900,7 +900,7 @@ sap_announce_t *CreateAnnounce( services_discovery_t *p_sd, uint32_t *i_source,
if (likely(str != NULL))
for (char *p = strchr(str, '.'); p != NULL; p = strchr(p, '.'))
*(p++) = '|';
- services_discovery_AddItem(p_sd, p_input, str ? str : psz_value);
+ services_discovery_AddItemCat(p_sd, p_input, str ? str : psz_value);
free(str);
}
else
@@ -908,7 +908,7 @@ sap_announce_t *CreateAnnounce( services_discovery_t *p_sd, uint32_t *i_source,
/* backward compatibility with VLC 0.7.3-2.0.0 senders */
psz_value = GetAttribute(p_sap->p_sdp->pp_attributes,
p_sap->p_sdp->i_attributes, "x-plgroup");
- services_discovery_AddItem(p_sd, p_input, psz_value);
+ services_discovery_AddItemCat(p_sd, p_input, psz_value);
}
TAB_APPEND( p_sys->i_announces, p_sys->pp_announces, p_sap );
diff --git a/modules/services_discovery/udev.c b/modules/services_discovery/udev.c
index 0fd5824ebc..f4359aa839 100644
--- a/modules/services_discovery/udev.c
+++ b/modules/services_discovery/udev.c
@@ -198,7 +198,7 @@ static int AddDevice (services_discovery_t *sd, struct udev_device *dev)
*dp = d;
}
- services_discovery_AddItem (sd, item, NULL);
+ services_discovery_AddItem(sd, item);
d->sd = sd;
return 0;
}
diff --git a/modules/services_discovery/upnp.cpp b/modules/services_discovery/upnp.cpp
index 93aa2997d3..ba61a75c02 100644
--- a/modules/services_discovery/upnp.cpp
+++ b/modules/services_discovery/upnp.cpp
@@ -344,7 +344,7 @@ bool MediaServerList::addServer( MediaServerDesc* desc )
input_item_SetArtworkURL( p_input_item, desc->iconUrl.c_str() );
desc->inputItem = p_input_item;
input_item_SetDescription( p_input_item, desc->UDN.c_str() );
- services_discovery_AddItem( m_sd, p_input_item, NULL );
+ services_discovery_AddItem( m_sd, p_input_item );
m_list.push_back( desc );
return true;
diff --git a/modules/services_discovery/windrive.c b/modules/services_discovery/windrive.c
index 8d47628bd4..922d497548 100644
--- a/modules/services_discovery/windrive.c
+++ b/modules/services_discovery/windrive.c
@@ -81,7 +81,7 @@ static int Open (vlc_object_t *obj)
if (item == NULL)
break;
- services_discovery_AddItem (sd, item, NULL);
+ services_discovery_AddItem(sd, item);
}
return VLC_SUCCESS;
}
diff --git a/modules/services_discovery/xcb_apps.c b/modules/services_discovery/xcb_apps.c
index fcb9caa072..da13db12aa 100644
--- a/modules/services_discovery/xcb_apps.c
+++ b/modules/services_discovery/xcb_apps.c
@@ -272,7 +272,7 @@ static struct app *AddApp (services_discovery_t *sd, xcb_window_t xid)
app->xid = xid;
app->item = item;
app->owner = sd;
- services_discovery_AddItem (sd, item, _("Applications"));
+ services_discovery_AddItemCat(sd, item, _("Applications"));
return app;
}
@@ -352,6 +352,6 @@ static void AddDesktop(services_discovery_t *sd)
if (item == NULL)
return;
- services_discovery_AddItem (sd, item, NULL);
+ services_discovery_AddItem(sd, item);
input_item_Release (item);
}
More information about the vlc-commits
mailing list