Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
2a2dd551
Commit
2a2dd551
authored
Feb 10, 2010
by
Jakob Leben
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
services_discovery: implement SD categories and use in Qt interface
parent
d269c768
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
81 additions
and
55 deletions
+81
-55
include/vlc_services_discovery.h
include/vlc_services_discovery.h
+15
-6
modules/gui/macosx/playlist.m
modules/gui/macosx/playlist.m
+1
-1
modules/gui/qt4/components/playlist/selector.cpp
modules/gui/qt4/components/playlist/selector.cpp
+37
-26
modules/gui/qt4/menus.cpp
modules/gui/qt4/menus.cpp
+1
-1
modules/misc/lua/libs/sd.c
modules/misc/lua/libs/sd.c
+1
-1
modules/misc/lua/vlc.c
modules/misc/lua/vlc.c
+1
-1
modules/services_discovery/bonjour.c
modules/services_discovery/bonjour.c
+1
-1
modules/services_discovery/mediadirs.c
modules/services_discovery/mediadirs.c
+3
-3
modules/services_discovery/mtp.c
modules/services_discovery/mtp.c
+1
-1
modules/services_discovery/podcast.c
modules/services_discovery/podcast.c
+1
-1
modules/services_discovery/sap.c
modules/services_discovery/sap.c
+1
-1
modules/services_discovery/shout.c
modules/services_discovery/shout.c
+3
-3
modules/services_discovery/udev.c
modules/services_discovery/udev.c
+2
-2
modules/services_discovery/upnp_cc.cpp
modules/services_discovery/upnp_cc.cpp
+1
-1
modules/services_discovery/upnp_intel.cpp
modules/services_discovery/upnp_intel.cpp
+1
-1
modules/services_discovery/xcb_apps.c
modules/services_discovery/xcb_apps.c
+1
-1
src/playlist/services_discovery.c
src/playlist/services_discovery.c
+10
-4
No files found.
include/vlc_services_discovery.h
View file @
2a2dd551
...
...
@@ -54,15 +54,23 @@ struct services_discovery_t
services_discovery_sys_t
*
p_sys
;
};
enum
services_discovery_category_e
{
SD_CAT_DEVICES
=
1
,
SD_CAT_LAN
,
SD_CAT_INTERNET
,
SD_CAT_MYCOMPUTER
};
/***********************************************************************
* Service Discovery
***********************************************************************/
/* Get the services discovery modules names to use in Create(), in a null
* terminated string array. Array and string must be freed after use. */
VLC_EXPORT
(
char
**
,
vlc_sd_GetNames
,
(
vlc_object_t
*
,
char
***
)
);
#define vlc_sd_GetNames(obj, pln) \
vlc_sd_GetNames(VLC_OBJECT(obj), pln)
VLC_EXPORT
(
char
**
,
vlc_sd_GetNames
,
(
vlc_object_t
*
,
char
***
,
int
**
)
);
#define vlc_sd_GetNames(obj, pln
, pcat
) \
vlc_sd_GetNames(VLC_OBJECT(obj), pln
, pcat
)
/* Creation of a service_discovery object */
VLC_EXPORT
(
services_discovery_t
*
,
vlc_sd_Create
,
(
vlc_object_t
*
,
const
char
*
)
);
...
...
@@ -91,18 +99,19 @@ VLC_EXPORT( void, services_discovery_RemoveItem, ( services_di
/* SD probing */
VLC_EXPORT
(
int
,
vlc_sd_probe_Add
,
(
vlc_probe_t
*
,
const
char
*
,
const
char
*
));
VLC_EXPORT
(
int
,
vlc_sd_probe_Add
,
(
vlc_probe_t
*
,
const
char
*
,
const
char
*
,
int
category
));
#define VLC_SD_PROBE_SUBMODULE \
add_submodule() \
set_capability( "services probe", 100 ) \
set_callbacks( vlc_sd_probe_Open, NULL )
#define VLC_SD_PROBE_HELPER(name, longname) \
#define VLC_SD_PROBE_HELPER(name, longname
, cat
) \
static int vlc_sd_probe_Open (vlc_object_t *obj) \
{ \
return vlc_sd_probe_Add ((struct vlc_probe_t *)obj, \
name "{longname=\"" # longname "\"}", longname); \
name "{longname=\"" # longname "\"}", \
longname, cat); \
}
/** @} */
...
...
modules/gui/macosx/playlist.m
View file @
2a2dd551
...
...
@@ -413,7 +413,7 @@
o_tc_sortColumn
=
nil
;
char
**
ppsz_name
;
char
**
ppsz_services
=
vlc_sd_GetNames
(
VLCIntf
,
&
ppsz_name
);
char
**
ppsz_services
=
vlc_sd_GetNames
(
VLCIntf
,
&
ppsz_name
,
NULL
);
if
(
!
ppsz_services
)
return
;
...
...
modules/gui/qt4/components/playlist/selector.cpp
View file @
2a2dd551
...
...
@@ -249,46 +249,53 @@ void PLSelector::createItems()
THEPL
->
p_media_library
);
ml
->
treeItem
()
->
setData
(
0
,
SPECIAL_ROLE
,
QVariant
(
IS_ML
)
);
QTreeWidgetItem
*
mfldrs
=
NULL
;
QTreeWidgetItem
*
shouts
=
NULL
;
QTreeWidgetItem
*
mycomp
=
addItem
(
CATEGORY_TYPE
,
qtr
(
"My Computer"
),
false
)
->
treeItem
();
QTreeWidgetItem
*
devices
=
addItem
(
CATEGORY_TYPE
,
qtr
(
"Devices"
),
false
)
->
treeItem
();
QTreeWidgetItem
*
lan
=
addItem
(
CATEGORY_TYPE
,
qtr
(
"Local Network"
),
false
)
->
treeItem
();
QTreeWidgetItem
*
internet
=
addItem
(
CATEGORY_TYPE
,
qtr
(
"Internet"
),
false
)
->
treeItem
();;
char
**
ppsz_longnames
;
char
**
ppsz_names
=
vlc_sd_GetNames
(
THEPL
,
&
ppsz_longnames
);
int
*
p_categories
;
char
**
ppsz_names
=
vlc_sd_GetNames
(
THEPL
,
&
ppsz_longnames
,
&
p_categories
);
if
(
!
ppsz_names
)
return
;
char
**
ppsz_name
=
ppsz_names
,
**
ppsz_longname
=
ppsz_longnames
;
for
(
;
*
ppsz_name
;
ppsz_name
++
,
ppsz_longname
++
)
int
*
p_category
=
p_categories
;
for
(
;
*
ppsz_name
;
ppsz_name
++
,
ppsz_longname
++
,
p_category
++
)
{
//msg_Dbg( p_intf, "Adding a SD item: %s", *ppsz_longname );
#define SD_IS( name ) ( !strcmp( *ppsz_name, name ) )
if
(
SD_IS
(
"shoutcast"
)
||
SD_IS
(
"shoutcasttv"
)
||
SD_IS
(
"frenchtv"
)
||
SD_IS
(
"freebox"
)
)
if
(
*
p_category
==
SD_CAT_INTERNET
)
{
PLSelItem
*
selItem
=
addItem
(
SD_TYPE
,
*
ppsz_longname
,
false
,
internet
);
putSDData
(
selItem
,
*
ppsz_name
,
*
ppsz_longname
);
if
(
!
strncmp
(
*
ppsz_name
,
"podcast"
,
7
)
)
{
selItem
->
treeItem
()
->
setData
(
0
,
SPECIAL_ROLE
,
QVariant
(
IS_PODCAST
)
);
selItem
->
addAction
(
ADD_ACTION
,
qtr
(
"Subscribe to a podcast"
)
);
CONNECT
(
selItem
,
action
(
PLSelItem
*
),
this
,
podcastAdd
(
PLSelItem
*
)
);
podcastsParent
=
selItem
->
treeItem
();
}
}
else
if
(
*
p_category
==
SD_CAT_DEVICES
)
{
if
(
!
shouts
)
shouts
=
addItem
(
CATEGORY_TYPE
,
qtr
(
"Shoutcast"
),
false
)
->
treeItem
();
putSDData
(
addItem
(
SD_TYPE
,
*
ppsz_longname
,
false
,
shouts
),
putSDData
(
addItem
(
SD_TYPE
,
*
ppsz_longname
,
false
,
devices
),
*
ppsz_name
,
*
ppsz_longname
);
}
else
if
(
SD_IS
(
"video_dir"
)
||
SD_IS
(
"audio_dir"
)
||
SD_IS
(
"picture_dir"
)
)
else
if
(
*
p_category
==
SD_CAT_LAN
)
{
if
(
!
mfldrs
)
mfldrs
=
addItem
(
CATEGORY_TYPE
,
qtr
(
"Media Folders"
),
false
)
->
treeItem
();
putSDData
(
addItem
(
SD_TYPE
,
*
ppsz_longname
,
false
,
mfldrs
),
putSDData
(
addItem
(
SD_TYPE
,
*
ppsz_longname
,
false
,
lan
),
*
ppsz_name
,
*
ppsz_longname
);
}
else
if
(
!
strncmp
(
*
ppsz_name
,
"podcast"
,
7
)
)
else
if
(
*
p_category
==
SD_CAT_MYCOMPUTER
)
{
PLSelItem
*
podItem
=
addItem
(
SD_TYPE
,
qtr
(
"Podcasts"
),
false
);
putSDData
(
podItem
,
*
ppsz_name
,
*
ppsz_longname
);
podItem
->
treeItem
()
->
setData
(
0
,
SPECIAL_ROLE
,
QVariant
(
IS_PODCAST
)
);
podItem
->
addAction
(
ADD_ACTION
,
qtr
(
"Subscribe to a podcast"
)
);
CONNECT
(
podItem
,
action
(
PLSelItem
*
),
this
,
podcastAdd
(
PLSelItem
*
)
);
podcastsParent
=
podItem
->
treeItem
();
putSDData
(
addItem
(
SD_TYPE
,
*
ppsz_longname
,
false
,
mycomp
),
*
ppsz_name
,
*
ppsz_longname
);
}
else
{
...
...
@@ -296,13 +303,17 @@ void PLSelector::createItems()
*
ppsz_name
,
*
ppsz_longname
);
}
#undef SD_IS
free
(
*
ppsz_name
);
free
(
*
ppsz_longname
);
}
free
(
ppsz_names
);
free
(
ppsz_longnames
);
free
(
p_categories
);
if
(
mycomp
->
childCount
()
==
0
)
delete
mycomp
;
if
(
devices
->
childCount
()
==
0
)
delete
devices
;
if
(
lan
->
childCount
()
==
0
)
delete
lan
;
if
(
internet
->
childCount
()
==
0
)
delete
internet
;
}
QStringList
PLSelector
::
mimeTypes
()
const
...
...
modules/gui/qt4/menus.cpp
View file @
2a2dd551
...
...
@@ -708,7 +708,7 @@ QMenu *QVLCMenu::SDMenu( intf_thread_t *p_intf, QWidget *parent )
menu
->
setTitle
(
qtr
(
I_PL_SD
)
);
char
**
ppsz_longnames
;
char
**
ppsz_names
=
vlc_sd_GetNames
(
p_intf
,
&
ppsz_longnames
);
char
**
ppsz_names
=
vlc_sd_GetNames
(
p_intf
,
&
ppsz_longnames
,
NULL
);
if
(
!
ppsz_names
)
return
menu
;
...
...
modules/misc/lua/libs/sd.c
View file @
2a2dd551
...
...
@@ -62,7 +62,7 @@ static int vlclua_sd_get_services_names( lua_State *L )
{
playlist_t
*
p_playlist
=
vlclua_get_playlist_internal
(
L
);
char
**
ppsz_longnames
;
char
**
ppsz_names
=
vlc_sd_GetNames
(
p_playlist
,
&
ppsz_longnames
);
char
**
ppsz_names
=
vlc_sd_GetNames
(
p_playlist
,
&
ppsz_longnames
,
NULL
);
if
(
!
ppsz_names
)
return
0
;
...
...
modules/misc/lua/vlc.c
View file @
2a2dd551
...
...
@@ -632,7 +632,7 @@ static int vlc_sd_probe_Open( vlc_object_t *obj )
free
(
psz_longname
);
goto
error
;
}
vlc_sd_probe_Add
(
probe
,
psz_name
,
psz_longname
);
vlc_sd_probe_Add
(
probe
,
psz_name
,
psz_longname
,
SD_CAT_INTERNET
);
free
(
psz_name
);
free
(
psz_longname
);
}
...
...
modules/services_discovery/bonjour.c
View file @
2a2dd551
...
...
@@ -48,7 +48,7 @@
static
int
Open
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
VLC_SD_PROBE_HELPER
(
"bonjour"
,
N_
(
"Bonjour services"
))
VLC_SD_PROBE_HELPER
(
"bonjour"
,
N_
(
"Bonjour services"
)
,
SD_CAT_LAN
)
vlc_module_begin
()
set_shortname
(
"Bonjour"
)
...
...
modules/services_discovery/mediadirs.c
View file @
2a2dd551
...
...
@@ -356,10 +356,10 @@ static int vlc_sd_probe_Open( vlc_object_t *obj )
vlc_probe_t
*
probe
=
(
vlc_probe_t
*
)
obj
;
vlc_sd_probe_Add
(
probe
,
"video_dir{longname=
\"
My Videos
\"
}"
,
N_
(
"My Videos"
)
);
N_
(
"My Videos"
)
,
SD_CAT_MYCOMPUTER
);
vlc_sd_probe_Add
(
probe
,
"audio_dir{longname=
\"
My Music
\"
}"
,
N_
(
"My Music"
)
);
N_
(
"My Music"
)
,
SD_CAT_MYCOMPUTER
);
vlc_sd_probe_Add
(
probe
,
"picture_dir{longname=
\"
My Pictures
\"
}"
,
N_
(
"My Pictures"
)
);
N_
(
"My Pictures"
)
,
SD_CAT_MYCOMPUTER
);
return
VLC_PROBE_CONTINUE
;
}
modules/services_discovery/mtp.c
View file @
2a2dd551
...
...
@@ -38,7 +38,7 @@
static
int
Open
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
VLC_SD_PROBE_HELPER
(
"mtp"
,
N_
(
"MTP devices"
))
VLC_SD_PROBE_HELPER
(
"mtp"
,
N_
(
"MTP devices"
)
,
SD_CAT_DEVICES
)
vlc_module_begin
()
set_shortname
(
"MTP"
)
...
...
modules/services_discovery/podcast.c
View file @
2a2dd551
...
...
@@ -53,7 +53,7 @@
static
int
Open
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
VLC_SD_PROBE_HELPER
(
"podcast"
,
N_
(
"Podcasts"
))
VLC_SD_PROBE_HELPER
(
"podcast"
,
N_
(
"Podcasts"
)
,
SD_CAT_INTERNET
)
#define URLS_TEXT N_("Podcast URLs list")
#define URLS_LONGTEXT N_("Enter the list of podcasts to retrieve, " \
...
...
modules/services_discovery/sap.c
View file @
2a2dd551
...
...
@@ -114,7 +114,7 @@
static
int
OpenDemux
(
vlc_object_t
*
);
static
void
CloseDemux
(
vlc_object_t
*
);
VLC_SD_PROBE_HELPER
(
"sap"
,
N_
(
"Network streams (SAP)"
))
VLC_SD_PROBE_HELPER
(
"sap"
,
N_
(
"Network streams (SAP)"
)
,
SD_CAT_LAN
)
vlc_module_begin
()
set_shortname
(
N_
(
"SAP"
))
...
...
modules/services_discovery/shout.c
View file @
2a2dd551
...
...
@@ -283,10 +283,10 @@ static int vlc_sd_probe_Open( vlc_object_t *obj )
vlc_probe_t
*
probe
=
(
vlc_probe_t
*
)
obj
;
vlc_sd_probe_Add
(
probe
,
"shoutcast{longname=
\"
Shoutcast Radio
\"
}"
,
N_
(
"Shoutcast Radio"
)
);
N_
(
"Shoutcast Radio"
)
,
SD_CAT_INTERNET
);
vlc_sd_probe_Add
(
probe
,
"shoutcasttv{longname=
\"
Shoutcast TV
\"
}"
,
N_
(
"Shoutcast TV"
)
);
N_
(
"Shoutcast TV"
)
,
SD_CAT_INTERNET
);
vlc_sd_probe_Add
(
probe
,
"frenchtv{longname=
\"
French TV
\"
}"
,
N_
(
"French TV"
)
);
N_
(
"French TV"
)
,
SD_CAT_INTERNET
);
return
VLC_PROBE_CONTINUE
;
}
modules/services_discovery/udev.c
View file @
2a2dd551
...
...
@@ -74,8 +74,8 @@ static int vlc_sd_probe_Open (vlc_object_t *obj)
if
(
mon
!=
NULL
)
{
vlc_sd_probe_Add
(
probe
,
"v4l{longname=
\"
Video capture
\"
}"
,
N_
(
"Video capture"
));
vlc_sd_probe_Add
(
probe
,
"disc{longname=
\"
Discs
\"
}"
,
N_
(
"Discs"
));
N_
(
"Video capture"
)
,
SD_CAT_DEVICES
);
vlc_sd_probe_Add
(
probe
,
"disc{longname=
\"
Discs
\"
}"
,
N_
(
"Discs"
)
,
SD_CAT_MYCOMPUTER
);
udev_monitor_unref
(
mon
);
}
udev_unref
(
udev
);
...
...
modules/services_discovery/upnp_cc.cpp
View file @
2a2dd551
...
...
@@ -58,7 +58,7 @@ using namespace CyberLink;
static
int
Open
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
VLC_SD_PROBE_HELPER
(
"upnp"
,
N_
(
"Universal Plug'n'Play"
))
VLC_SD_PROBE_HELPER
(
"upnp"
,
N_
(
"Universal Plug'n'Play"
)
,
SD_CAT_LAN
)
vlc_module_begin
()
set_shortname
(
"UPnP"
)
...
...
modules/services_discovery/upnp_intel.cpp
View file @
2a2dd551
...
...
@@ -55,7 +55,7 @@ struct services_discovery_sys_t
// VLC callback prototypes
static
int
Open
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
VLC_SD_PROBE_HELPER
(
"upnp"
,
N_
(
"Universal Plug'n'Play"
))
VLC_SD_PROBE_HELPER
(
"upnp"
,
N_
(
"Universal Plug'n'Play"
)
,
SD_CAT_LAN
)
// Module descriptor
...
...
modules/services_discovery/xcb_apps.c
View file @
2a2dd551
...
...
@@ -80,7 +80,7 @@ static int vlc_sd_probe_Open (vlc_object_t *obj)
return
VLC_PROBE_CONTINUE
;
xcb_disconnect
(
conn
);
return
vlc_sd_probe_Add
(
probe
,
"xcb_apps{longname=
\"
Screen capture
\"
}"
,
N_
(
"Screen capture"
));
N_
(
"Screen capture"
)
,
SD_CAT_MYCOMPUTER
);
}
/**
...
...
src/playlist/services_discovery.c
View file @
2a2dd551
...
...
@@ -37,12 +37,13 @@ typedef struct
{
char
*
name
;
char
*
longname
;
int
category
;
}
vlc_sd_probe_t
;
int
vlc_sd_probe_Add
(
vlc_probe_t
*
probe
,
const
char
*
name
,
const
char
*
longname
)
const
char
*
longname
,
int
category
)
{
vlc_sd_probe_t
names
=
{
strdup
(
name
),
strdup
(
longname
)
};
vlc_sd_probe_t
names
=
{
strdup
(
name
),
strdup
(
longname
)
,
category
};
if
(
unlikely
(
names
.
name
==
NULL
||
names
.
longname
==
NULL
||
vlc_probe_add
(
probe
,
&
names
,
sizeof
(
names
))))
...
...
@@ -59,7 +60,7 @@ int vlc_sd_probe_Add (vlc_probe_t *probe, const char *name,
/**
* Gets the list of available services discovery plugins.
*/
char
**
vlc_sd_GetNames
(
vlc_object_t
*
obj
,
char
***
pppsz_longnames
)
char
**
vlc_sd_GetNames
(
vlc_object_t
*
obj
,
char
***
pppsz_longnames
,
int
**
pp_categories
)
{
size_t
count
;
vlc_sd_probe_t
*
tab
=
vlc_probe
(
obj
,
"services probe"
,
&
count
);
...
...
@@ -72,17 +73,22 @@ char **vlc_sd_GetNames (vlc_object_t *obj, char ***pppsz_longnames)
char
**
names
=
malloc
(
sizeof
(
char
*
)
*
(
count
+
1
));
char
**
longnames
=
malloc
(
sizeof
(
char
*
)
*
(
count
+
1
));
int
*
categories
=
malloc
(
sizeof
(
int
)
*
(
count
+
1
));
if
(
unlikely
(
names
==
NULL
||
longnames
==
NULL
))
if
(
unlikely
(
names
==
NULL
||
longnames
==
NULL
||
categories
==
NULL
))
abort
();
for
(
size_t
i
=
0
;
i
<
count
;
i
++
)
{
names
[
i
]
=
tab
[
i
].
name
;
longnames
[
i
]
=
tab
[
i
].
longname
;
categories
[
i
]
=
tab
[
i
].
category
;
}
free
(
tab
);
names
[
count
]
=
longnames
[
count
]
=
NULL
;
categories
[
count
]
=
0
;
*
pppsz_longnames
=
longnames
;
if
(
pp_categories
)
*
pp_categories
=
categories
;
else
free
(
categories
);
return
names
;
}
...
...
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