Commit ce3a8f4b authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

sd: add description field

parent b3d01bed
......@@ -59,6 +59,8 @@ struct services_discovery_t
char *psz_name; /**< Main name of the SD */
config_chain_t *p_cfg; /**< Configuration for the SD */
const char *description; /**< Human-readable name */
/** Control function
* \see services_discovery_command_e
*/
......
......@@ -135,6 +135,7 @@ int bdsm_SdOpen (vlc_object_t *p_this)
if( p_sys == NULL )
return VLC_ENOMEM;
p_sd->description = _("Windows networks");
p_sd->p_sys = p_sys;
p_sys->p_entry_item_list = vlc_array_new();
if ( p_sys->p_entry_item_list == NULL )
......
......@@ -83,6 +83,15 @@ int Open_LuaSD( vlc_object_t *p_this )
psz_name = strdup(p_sd->psz_name);
}
p_sd->description = p_sd->psz_name;
for( const config_chain_t *cc = p_sd->p_cfg; cc != NULL; cc = cc->p_next )
if( strcmp( cc->psz_name, "longname" ) == 0 )
{
p_sd->description = cc->psz_value;
break;
}
if( !( p_sys = malloc( sizeof( services_discovery_sys_t ) ) ) )
{
free( psz_name );
......
......@@ -274,6 +274,8 @@ static int Open( vlc_object_t *p_this )
if( !p_sys )
return VLC_ENOMEM;
p_sd->description = _("Zeroconf network services");
vlc_dictionary_init( &p_sys->services_name_to_input_item, 1 );
p_sys->poll = avahi_threaded_poll_new();
......
......@@ -226,6 +226,8 @@ static int Open(vlc_object_t *p_this)
return VLC_ENOMEM;
}
p_sd->description = _("Bonjour Network Discovery");
VLCNetServiceDiscoveryController *discoveryController = [[VLCNetServiceDiscoveryController alloc] init];
discoveryController.p_sd = p_sd;
......
......@@ -120,6 +120,7 @@ static int Open( vlc_object_t *p_this, enum type_e i_type )
{
services_discovery_t *p_sd = ( services_discovery_t* )p_this;
services_discovery_sys_t *p_sys;
const char *desc;
p_sd->p_sys = p_sys = calloc( 1, sizeof( *p_sys) );
if( !p_sys )
......@@ -129,6 +130,7 @@ static int Open( vlc_object_t *p_this, enum type_e i_type )
if( p_sys->i_type == Video )
{
desc = N_("My Videos");
p_sys->psz_dir[0] = config_GetUserDir( VLC_VIDEOS_DIR );
p_sys->psz_dir[1] = var_CreateGetString( p_sd, "input-record-path" );
......@@ -136,6 +138,7 @@ static int Open( vlc_object_t *p_this, enum type_e i_type )
}
else if( p_sys->i_type == Audio )
{
desc = N_("My Music");
p_sys->psz_dir[0] = config_GetUserDir( VLC_MUSIC_DIR );
p_sys->psz_dir[1] = var_CreateGetString( p_sd, "input-record-path" );
......@@ -143,6 +146,7 @@ static int Open( vlc_object_t *p_this, enum type_e i_type )
}
else if( p_sys->i_type == Picture )
{
desc = N_("My Pictures");
p_sys->psz_dir[0] = config_GetUserDir( VLC_PICTURES_DIR );
p_sys->psz_dir[1] = var_CreateGetString( p_sd, "snapshot-path" );
......@@ -154,6 +158,8 @@ static int Open( vlc_object_t *p_this, enum type_e i_type )
return VLC_EGENERIC;
}
p_sd->description = vlc_gettext(desc);
var_AddCallback( p_sd->obj.libvlc, p_sys->psz_var, onNewFileAdded, p_sd );
if( vlc_clone( &p_sys->thread, Run, p_sd, VLC_THREAD_PRIORITY_LOW ) )
......
......@@ -620,6 +620,7 @@ OpenSD( vlc_object_t *p_obj )
if( !p_sd->p_sys )
return VLC_ENOMEM;
p_sd->description = _("mDNS Network Discovery");
config_ChainParse( p_sd, CFG_PREFIX, ppsz_options, p_sd->p_cfg );
return OpenCommon( p_obj, &p_sd->p_sys->s, false );
......
......@@ -93,6 +93,7 @@ static int Open( vlc_object_t *p_this )
if( !( p_sys = malloc( sizeof( services_discovery_sys_t ) ) ) )
return VLC_ENOMEM;
p_sd->p_sys = p_sys;
p_sd->description = _("MTP devices");
p_sys->psz_name = NULL;
vlc_mutex_lock( &mtp_lock );
......
......@@ -66,6 +66,8 @@ static int Open (vlc_object_t *obj)
ULONG ulDataLen;
ULONG rc;
sd->description = _("Discs");
if (DosOpen ((PSZ)"CD-ROM2$", (PHFILE)&hcd2, &ulAction, 0, FILE_NORMAL,
OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW,
OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE, NULL))
......
......@@ -142,6 +142,7 @@ static int Open( vlc_object_t *p_this )
p_sys->update_type = UPDATE_URLS;
p_sd->p_sys = p_sys;
p_sd->description = _("Podcasts");
/* Launch the callback associated with this variable */
vlc_object_t *pl = p_sd->obj.parent;
......
......@@ -79,6 +79,7 @@ static int Open (vlc_object_t *obj)
}
sd->p_sys = sys;
sd->description = _("Audio capture");
sys->context = ctx;
sys->root = NULL;
......
......@@ -301,6 +301,7 @@ static int Open( vlc_object_t *p_this )
p_sys->i_timeout = var_CreateGetInteger( p_sd, "sap-timeout" );
p_sd->p_sys = p_sys;
p_sd->description = _("Network streams (SAP)");
p_sys->pi_fd = NULL;
p_sys->i_fd = 0;
......
......@@ -119,6 +119,7 @@ struct device
struct subsys
{
const char *name;
const char *description;
char * (*get_mrl) (struct udev_device *dev);
char * (*get_name) (struct udev_device *dev);
int item_type;
......@@ -233,6 +234,8 @@ static int Open (vlc_object_t *obj, const struct subsys *subsys)
if (p_sys == NULL)
return VLC_ENOMEM;
sd->description = vlc_gettext(subsys->description);
sd->p_sys = p_sys;
p_sys->subsys = subsys;
p_sys->root = NULL;
......@@ -441,7 +444,8 @@ static char *v4l_get_name (struct udev_device *dev)
int OpenV4L (vlc_object_t *obj)
{
static const struct subsys subsys = {
"video4linux", v4l_get_mrl, v4l_get_name, ITEM_TYPE_CARD,
"video4linux", N_("Video capture"),
v4l_get_mrl, v4l_get_name, ITEM_TYPE_CARD,
};
return Open (obj, &subsys);
......@@ -515,7 +519,8 @@ out:
int OpenALSA (vlc_object_t *obj)
{
static const struct subsys subsys = {
"sound", alsa_get_mrl, alsa_get_name, ITEM_TYPE_CARD,
"sound", N_("Audio capture"),
alsa_get_mrl, alsa_get_name, ITEM_TYPE_CARD,
};
return Open (obj, &subsys);
......@@ -619,7 +624,7 @@ static char *disc_get_name (struct udev_device *dev)
int OpenDisc (vlc_object_t *obj)
{
static const struct subsys subsys = {
"block", disc_get_mrl, disc_get_name, ITEM_TYPE_DISC,
"block", N_("Discs"), disc_get_mrl, disc_get_name, ITEM_TYPE_DISC,
};
return Open (obj, &subsys);
......
......@@ -230,6 +230,8 @@ static int Open( vlc_object_t *p_this )
if( !( p_sd->p_sys = p_sys ) )
return VLC_ENOMEM;
p_sd->description = _("Universal Plug'n'Play");
p_sys->p_upnp = UpnpInstanceWrapper::get( p_this, p_sd );
if ( !p_sys->p_upnp )
{
......
......@@ -56,6 +56,8 @@ static int Open (vlc_object_t *obj)
{
services_discovery_t *sd = (services_discovery_t *)obj;
sd->description = _("Discs");
LONG drives = GetLogicalDrives ();
char mrl[12] = "file:///A:/", name[3] = "A:";
TCHAR path[4] = TEXT("A:\\");
......
......@@ -97,6 +97,7 @@ static int Open (vlc_object_t *obj)
if (p_sys == NULL)
return VLC_ENOMEM;
sd->p_sys = p_sys;
sd->description = _("Screen capture");
/* Connect to X server */
char *display = var_InheritString (obj, "x11-display");
......
......@@ -114,6 +114,7 @@ services_discovery_t *vlc_sd_Create(vlc_object_t *parent, const char *cfg,
return NULL;
free(config_ChainCreate(&sd->psz_name, &sd->p_cfg, cfg));
sd->description = NULL;
sd->owner = *owner;
sd->p_module = module_need(sd, "services_discovery",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment