1
mirror of https://code.videolan.org/videolan/vlc synced 2024-10-03 01:31:53 +02:00

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.
This commit is contained in:
Rémi Denis-Courmont 2017-05-14 10:36:07 +03:00
parent db349e3226
commit 21d61f40b2
16 changed files with 37 additions and 26 deletions

View File

@ -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);
}

View File

@ -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,

View File

@ -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;

View File

@ -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 );
}
}

View File

@ -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];
}

View File

@ -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 );
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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);
}
}

View File

@ -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 ) );

View File

@ -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;
}

View File

@ -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 );

View File

@ -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;
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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);
}