VLC 4.0.0-dev
vlc_services_discovery.h File Reference

This file lists functions and structures for service discovery (SD) in vlc. More...

Include dependency graph for vlc_services_discovery.h:

Go to the source code of this file.

Data Structures

struct  services_discovery_callbacks
 
struct  services_discovery_owner_t
 
struct  services_discovery_t
 Main service discovery structure to build a SD module. More...
 
struct  services_discovery_descriptor_t
 Service discovery descriptor. More...
 
#define vlc_sd_GetNames(obj, pln, pcat)    vlc_sd_GetNames(VLC_OBJECT(obj), pln, pcat)
 
#define vlc_sd_Create(obj, a, b)    vlc_sd_Create( VLC_OBJECT( obj ), a, b )
 
#define VLC_SD_PROBE_SUBMODULE
 
#define VLC_SD_PROBE_HELPER(name, longname, cat)
 
enum  services_discovery_category_e { SD_CAT_DEVICES = 1 , SD_CAT_LAN , SD_CAT_INTERNET , SD_CAT_MYCOMPUTER }
 Service discovery categories. More...
 
enum  services_discovery_command_e { SD_CMD_SEARCH = 1 , SD_CMD_DESCRIPTOR }
 Service discovery control commands. More...
 
enum  services_discovery_capability_e { SD_CAP_SEARCH = 1 }
 Service discovery capabilities. More...
 
static int vlc_sd_control (services_discovery_t *p_sd, int i_control, va_list args)
 Ask for a research in the SD. More...
 
char ** vlc_sd_GetNames (vlc_object_t *, char ***, int **)
 Gets the list of available services discovery plugins. More...
 
services_discovery_tvlc_sd_Create (vlc_object_t *parent, const char *chain, const struct services_discovery_owner_t *owner)
 Creates a services discoverer. More...
 
void vlc_sd_Destroy (services_discovery_t *)
 
static void services_discovery_AddItem (services_discovery_t *sd, input_item_t *item)
 Added top-level service callback. More...
 
static void services_discovery_AddSubItem (services_discovery_t *sd, input_item_t *parent, input_item_t *item)
 Added service callback. More...
 
static void services_discovery_AddItemCat (services_discovery_t *sd, input_item_t *item, const char *category)
 Added service backward compatibility callback. More...
 
static void services_discovery_RemoveItem (services_discovery_t *sd, input_item_t *item)
 Removed service callback. More...
 
int vlc_sd_probe_Add (vlc_probe_t *, const char *, const char *, int category)
 

Detailed Description

This file lists functions and structures for service discovery (SD) in vlc.

Macro Definition Documentation

◆ vlc_sd_Create

#define vlc_sd_Create (   obj,
  a,
 
)     vlc_sd_Create( VLC_OBJECT( obj ), a, b )

◆ vlc_sd_GetNames

#define vlc_sd_GetNames (   obj,
  pln,
  pcat 
)     vlc_sd_GetNames(VLC_OBJECT(obj), pln, pcat)

◆ VLC_SD_PROBE_HELPER

#define VLC_SD_PROBE_HELPER (   name,
  longname,
  cat 
)
Value:
static int vlc_sd_probe_Open (vlc_object_t *obj) \
{ \
return vlc_sd_probe_Add ((struct vlc_probe_t *)obj, name, \
longname, cat); \
}
const char name[16]
Definition: httpd.c:1281
VLC object common members.
Definition: vlc_objects.h:45
Definition: vlc_probe.h:41
int vlc_sd_probe_Add(vlc_probe_t *, const char *, const char *, int category)
Definition: services_discovery.c:41

◆ VLC_SD_PROBE_SUBMODULE

#define VLC_SD_PROBE_SUBMODULE
Value:
set_capability( "services probe", 100 ) \
set_callback( vlc_sd_probe_Open )
#define add_submodule()
Definition: vlc_plugin.h:339

Enumeration Type Documentation

◆ services_discovery_capability_e

Service discovery capabilities.

Enumerator
SD_CAP_SEARCH 

One can search in the SD.

◆ services_discovery_category_e

Service discovery categories.

See also
vlc_sd_probe_Add
Enumerator
SD_CAT_DEVICES 

Devices, like portable music players.

SD_CAT_LAN 

LAN/WAN services, like Upnp or SAP.

SD_CAT_INTERNET 

Internet or Website channels services.

SD_CAT_MYCOMPUTER 

Computer services, like Discs or Apps.

◆ services_discovery_command_e

Service discovery control commands.

Enumerator
SD_CMD_SEARCH 

arg1 = query

SD_CMD_DESCRIPTOR 

arg1 = services_discovery_descriptor_t*

Function Documentation

◆ services_discovery_AddItem()

static void services_discovery_AddItem ( services_discovery_t sd,
input_item_t item 
)
inlinestatic

Added top-level service callback.

This is a convenience wrapper for services_discovery_AddSubItem(). It covers the most comomn case wherby the added item is a top-level service, i.e. it has no parent node.

References services_discovery_owner_t::cbs, services_discovery_callbacks::item_added, and services_discovery_t::owner.

◆ services_discovery_AddItemCat()

static void services_discovery_AddItemCat ( services_discovery_t sd,
input_item_t item,
const char *  category 
)
inlinestatic

Added service backward compatibility callback.

Parameters
categoryOptional name of a group that the item belongs in (for backward compatibility with legacy modules)

References services_discovery_owner_t::cbs, services_discovery_callbacks::item_added, and services_discovery_t::owner.

◆ services_discovery_AddSubItem()

static void services_discovery_AddSubItem ( services_discovery_t sd,
input_item_t parent,
input_item_t item 
)
inlinestatic

Added service callback.

A services discovery module invokes this function when it "discovers" a new service, i.e. a new input item.

Note
This callback does not take ownership of the input item; it might however (and most probably will) add one of more references to the item.

The caller is responsible for releasing its own reference(s) eventually. Keeping a reference is necessary to call services_discovery_RemoveItem() or to alter the item later. However, if the caller will never remove nor alter the item, it can drop its reference(s) immediately.

Parameters
sdservices discoverer / services discovery module instance
iteminput item to add

References services_discovery_owner_t::cbs, services_discovery_callbacks::item_added, and services_discovery_t::owner.

◆ services_discovery_RemoveItem()

static void services_discovery_RemoveItem ( services_discovery_t sd,
input_item_t item 
)
inlinestatic

Removed service callback.

A services discovery module invokes this function when it senses that a service is no longer available.

References services_discovery_owner_t::cbs, services_discovery_callbacks::item_removed, and services_discovery_t::owner.

◆ vlc_sd_control()

static int vlc_sd_control ( services_discovery_t p_sd,
int  i_control,
va_list  args 
)
inlinestatic

Ask for a research in the SD.

Parameters
p_sdthe Service Discovery
i_controlthe command to issue
argsthe argument list
Returns
VLC_SUCCESS in case of success, the error code otherwise

References services_discovery_t::pf_control, and VLC_EGENERIC.

◆ vlc_sd_Create()

services_discovery_t * vlc_sd_Create ( vlc_object_t parent,
const char *  chain,
const struct services_discovery_owner_t owner 
)

Creates a services discoverer.

◆ vlc_sd_Destroy()

◆ vlc_sd_GetNames()

char ** vlc_sd_GetNames ( vlc_object_t obj,
char ***  pppsz_longnames,
int **  pp_categories 
)

Gets the list of available services discovery plugins.

References vlc_sd_probe_t::category, count, vlc_sd_probe_t::longname, vlc_sd_probe_t::name, unlikely, vlc_alloc(), and vlc_probe.

◆ vlc_sd_probe_Add()

int vlc_sd_probe_Add ( vlc_probe_t probe,
const char *  name,
const char *  longname,
int  category 
)