Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
8b61d4ef
Commit
8b61d4ef
authored
Nov 08, 2004
by
Clément Stenac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial Services discovery support
parent
cd24fec6
Changes
14
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
332 additions
and
132 deletions
+332
-132
Makefile.am
Makefile.am
+1
-0
configure.ac
configure.ac
+4
-2
include/vlc_common.h
include/vlc_common.h
+2
-0
include/vlc_objects.h
include/vlc_objects.h
+1
-0
include/vlc_playlist.h
include/vlc_playlist.h
+22
-0
modules/misc/Modules.am
modules/misc/Modules.am
+0
-1
modules/services_discovery/hal.c
modules/services_discovery/hal.c
+38
-41
modules/services_discovery/sap.c
modules/services_discovery/sap.c
+85
-85
src/interface/interface.c
src/interface/interface.c
+0
-2
src/libvlc.c
src/libvlc.c
+4
-0
src/libvlc.h
src/libvlc.h
+7
-0
src/misc/objects.c
src/misc/objects.c
+4
-0
src/playlist/playlist.c
src/playlist/playlist.c
+6
-1
src/playlist/services_discovery.c
src/playlist/services_discovery.c
+158
-0
No files found.
Makefile.am
View file @
8b61d4ef
...
@@ -330,6 +330,7 @@ SOURCES_libvlc_common = \
...
@@ -330,6 +330,7 @@ SOURCES_libvlc_common = \
src/playlist/item.c
\
src/playlist/item.c
\
src/playlist/item-ext.c
\
src/playlist/item-ext.c
\
src/playlist/info.c
\
src/playlist/info.c
\
src/playlist/services_discovery.c
\
src/input/access.c
\
src/input/access.c
\
src/input/clock.c
\
src/input/clock.c
\
src/input/control.c
\
src/input/control.c
\
...
...
configure.ac
View file @
8b61d4ef
...
@@ -678,8 +678,9 @@ fi
...
@@ -678,8 +678,9 @@ fi
dnl Check for hal
dnl Check for hal
PKG_CHECK_MODULES(HAL, hal >= 0.2.97,
PKG_CHECK_MODULES(HAL, hal >= 0.2.97,
[AC_DEFINE(HAVE_HAL, [], [Define if you have the HAL library])
[AC_DEFINE(HAVE_HAL, [], [Define if you have the HAL library])
VLC_ADD_LDFLAGS([vlc],[$HAL_LIBS])
VLC_ADD_PLUGINS([hal])
VLC_ADD_CFLAGS([vlc],[$HAL_CFLAGS])],
VLC_ADD_LDFLAGS([vlc hal],[$HAL_LIBS])
VLC_ADD_CFLAGS([vlc hal],[$HAL_CFLAGS])],
[AC_MSG_WARN(HAL library not found)])
[AC_MSG_WARN(HAL library not found)])
dnl Build the gtk_main plugins?
dnl Build the gtk_main plugins?
...
@@ -4216,6 +4217,7 @@ AC_CONFIG_FILES([
...
@@ -4216,6 +4217,7 @@ AC_CONFIG_FILES([
modules/mux/Makefile
modules/mux/Makefile
modules/mux/mpeg/Makefile
modules/mux/mpeg/Makefile
modules/packetizer/Makefile
modules/packetizer/Makefile
modules/services_discovery/Makefile
modules/stream_out/Makefile
modules/stream_out/Makefile
modules/stream_out/transrate/Makefile
modules/stream_out/transrate/Makefile
modules/video_chroma/Makefile
modules/video_chroma/Makefile
...
...
include/vlc_common.h
View file @
8b61d4ef
...
@@ -221,6 +221,8 @@ typedef struct playlist_t playlist_t;
...
@@ -221,6 +221,8 @@ typedef struct playlist_t playlist_t;
typedef
struct
playlist_item_t
playlist_item_t
;
typedef
struct
playlist_item_t
playlist_item_t
;
typedef
struct
playlist_view_t
playlist_view_t
;
typedef
struct
playlist_view_t
playlist_view_t
;
typedef
struct
playlist_export_t
playlist_export_t
;
typedef
struct
playlist_export_t
playlist_export_t
;
typedef
struct
services_discovery_t
services_discovery_t
;
typedef
struct
services_discovery_sys_t
services_discovery_sys_t
;
/* Modules */
/* Modules */
typedef
struct
module_bank_t
module_bank_t
;
typedef
struct
module_bank_t
module_bank_t
;
...
...
include/vlc_objects.h
View file @
8b61d4ef
...
@@ -57,6 +57,7 @@
...
@@ -57,6 +57,7 @@
#define VLC_OBJECT_VOD (-23)
#define VLC_OBJECT_VOD (-23)
#define VLC_OBJECT_SPU (-24)
#define VLC_OBJECT_SPU (-24)
#define VLC_OBJECT_TLS (-25)
#define VLC_OBJECT_TLS (-25)
#define VLC_OBJECT_SD (-26)
#define VLC_OBJECT_GENERIC (-666)
#define VLC_OBJECT_GENERIC (-666)
...
...
include/vlc_playlist.h
View file @
8b61d4ef
...
@@ -112,6 +112,19 @@ struct playlist_view_t
...
@@ -112,6 +112,19 @@ struct playlist_view_t
*/
*/
typedef
enum
{
PLAYLIST_STOPPED
,
PLAYLIST_RUNNING
,
PLAYLIST_PAUSED
}
playlist_status_t
;
typedef
enum
{
PLAYLIST_STOPPED
,
PLAYLIST_RUNNING
,
PLAYLIST_PAUSED
}
playlist_status_t
;
struct
services_discovery_t
{
VLC_COMMON_MEMBERS
const
char
*
psz_module
;
module_t
*
p_module
;
services_discovery_sys_t
*
p_sys
;
void
(
*
pf_run
)
(
services_discovery_t
*
);
};
/**
/**
* Structure containing information about the playlist
* Structure containing information about the playlist
*/
*/
...
@@ -146,6 +159,9 @@ struct playlist_t
...
@@ -146,6 +159,9 @@ struct playlist_t
playlist_item_t
*
p_general
;
/**< Keep a pointer on the "general"
playlist_item_t
*
p_general
;
/**< Keep a pointer on the "general"
category */
category */
services_discovery_t
**
pp_sds
;
int
i_sds
;
vlc_bool_t
b_go_next
;
/*< Go further than the parent node ? */
vlc_bool_t
b_go_next
;
/*< Go further than the parent node ? */
struct
{
struct
{
...
@@ -210,6 +226,12 @@ VLC_EXPORT( int, playlist_Control, ( playlist_t *, int, ... ) );
...
@@ -210,6 +226,12 @@ VLC_EXPORT( int, playlist_Control, ( playlist_t *, int, ... ) );
VLC_EXPORT
(
int
,
playlist_Clear
,
(
playlist_t
*
)
);
VLC_EXPORT
(
int
,
playlist_Clear
,
(
playlist_t
*
)
);
/* Services discovery */
VLC_EXPORT
(
int
,
playlist_ServicesDiscoveryAdd
,
(
playlist_t
*
,
const
char
*
));
VLC_EXPORT
(
void
,
playlist_ServicesDiscoveryRemove
,
(
playlist_t
*
,
const
char
*
));
VLC_EXPORT
(
int
,
playlist_AddSDModules
,
(
playlist_t
*
,
char
*
));
/* Item management functions (act on items) */
/* Item management functions (act on items) */
#define playlist_AddItem(p,pi,i1,i2) playlist_ItemAdd(p,pi,i1,i2)
#define playlist_AddItem(p,pi,i1,i2) playlist_ItemAdd(p,pi,i1,i2)
#define playlist_ItemNew( a , b, c ) __playlist_ItemNew(VLC_OBJECT(a) , b , c )
#define playlist_ItemNew( a , b, c ) __playlist_ItemNew(VLC_OBJECT(a) , b , c )
...
...
modules/misc/Modules.am
View file @
8b61d4ef
...
@@ -2,7 +2,6 @@ SOURCES_gtk_main = gtk_main.c
...
@@ -2,7 +2,6 @@ SOURCES_gtk_main = gtk_main.c
SOURCES_gnome_main = gtk_main.c
SOURCES_gnome_main = gtk_main.c
SOURCES_gtk2_main = gtk_main.c
SOURCES_gtk2_main = gtk_main.c
SOURCES_gnome2_main = gtk_main.c
SOURCES_gnome2_main = gtk_main.c
SOURCES_sap = sap.c
SOURCES_screensaver = screensaver.c
SOURCES_screensaver = screensaver.c
SOURCES_qte_main = qte_main.cpp
SOURCES_qte_main = qte_main.cpp
SOURCES_freetype = freetype.c
SOURCES_freetype = freetype.c
...
...
modules/
misc
/hal.c
→
modules/
services_discovery
/hal.c
View file @
8b61d4ef
...
@@ -62,7 +62,7 @@
...
@@ -62,7 +62,7 @@
vlc_module_begin
();
vlc_module_begin
();
set_description
(
_
(
"HAL device detection"
)
);
set_description
(
_
(
"HAL device detection"
)
);
set_capability
(
"
interface
"
,
0
);
set_capability
(
"
services_discovery
"
,
0
);
set_callbacks
(
Open
,
Close
);
set_callbacks
(
Open
,
Close
);
vlc_module_end
();
vlc_module_end
();
...
@@ -72,7 +72,7 @@ vlc_module_end();
...
@@ -72,7 +72,7 @@ vlc_module_end();
* Local structures
* Local structures
*****************************************************************************/
*****************************************************************************/
struct
intf
_sys_t
struct
services_discovery
_sys_t
{
{
LibHalContext
*
p_ctx
;
LibHalContext
*
p_ctx
;
...
@@ -86,42 +86,42 @@ struct intf_sys_t
...
@@ -86,42 +86,42 @@ struct intf_sys_t
*****************************************************************************/
*****************************************************************************/
/* Main functions */
/* Main functions */
static
void
Run
(
intf_thread
_t
*
p_intf
);
static
void
Run
(
services_discovery
_t
*
p_intf
);
/*****************************************************************************
/*****************************************************************************
* Open: initialize and create stuff
* Open: initialize and create stuff
*****************************************************************************/
*****************************************************************************/
static
int
Open
(
vlc_object_t
*
p_this
)
static
int
Open
(
vlc_object_t
*
p_this
)
{
{
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
p_this
;
services_discovery_t
*
p_sd
=
(
services_discovery_t
*
)
p_this
;
intf_sys_t
*
p_sys
=
malloc
(
sizeof
(
intf_sys_t
)
);
services_discovery_sys_t
*
p_sys
=
malloc
(
sizeof
(
services_discovery_sys_t
)
);
playlist_t
*
p_playlist
;
playlist_t
*
p_playlist
;
playlist_view_t
*
p_view
;
playlist_view_t
*
p_view
;
p_
intf
->
pf_run
=
Run
;
p_
sd
->
pf_run
=
Run
;
p_
intf
->
p_sys
=
p_sys
;
p_
sd
->
p_sys
=
p_sys
;
if
(
!
(
p_sys
->
p_ctx
=
hal_initialize
(
NULL
,
FALSE
)
)
)
if
(
!
(
p_sys
->
p_ctx
=
hal_initialize
(
NULL
,
FALSE
)
)
)
{
{
free
(
p_sys
);
free
(
p_sys
);
msg_Err
(
p_
intf
,
"hal not available"
);
msg_Err
(
p_
sd
,
"hal not available"
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
/* Create our playlist node */
/* Create our playlist node */
p_playlist
=
(
playlist_t
*
)
vlc_object_find
(
p_
intf
,
VLC_OBJECT_PLAYLIST
,
p_playlist
=
(
playlist_t
*
)
vlc_object_find
(
p_
sd
,
VLC_OBJECT_PLAYLIST
,
FIND_ANYWHERE
);
FIND_ANYWHERE
);
if
(
!
p_playlist
)
if
(
!
p_playlist
)
{
{
msg_Warn
(
p_
intf
,
"unable to find playlist, cancelling HAL listening"
);
msg_Warn
(
p_
sd
,
"unable to find playlist, cancelling HAL listening"
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
p_view
=
playlist_ViewFind
(
p_playlist
,
VIEW_CATEGORY
);
p_view
=
playlist_ViewFind
(
p_playlist
,
VIEW_CATEGORY
);
p_sys
->
p_node
=
playlist_NodeCreate
(
p_playlist
,
VIEW_CATEGORY
,
p_sys
->
p_node
=
playlist_NodeCreate
(
p_playlist
,
VIEW_CATEGORY
,
_
(
"Devices"
),
p_view
->
p_root
);
_
(
"Devices"
),
p_view
->
p_root
);
vlc_object_release
(
p_playlist
);
vlc_object_release
(
p_playlist
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
...
@@ -132,27 +132,27 @@ static int Open( vlc_object_t *p_this )
...
@@ -132,27 +132,27 @@ static int Open( vlc_object_t *p_this )
*****************************************************************************/
*****************************************************************************/
static
void
Close
(
vlc_object_t
*
p_this
)
static
void
Close
(
vlc_object_t
*
p_this
)
{
{
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
p_this
;
services_discovery_t
*
p_sd
=
(
services_discovery_t
*
)
p_sd
;
intf_sys_t
*
p_sys
=
p_intf
->
p_sys
;
services_discovery_sys_t
*
p_sys
=
malloc
(
sizeof
(
services_discovery_sys_t
)
);
free
(
p_sys
);
free
(
p_sys
);
}
}
static
void
AddDvd
(
intf_thread_t
*
p_intf
,
char
*
psz_device
)
static
void
AddDvd
(
services_discovery_t
*
p_sd
,
char
*
psz_device
)
{
{
char
*
psz_name
;
char
*
psz_name
;
char
*
psz_uri
;
char
*
psz_uri
;
char
*
psz_blockdevice
;
char
*
psz_blockdevice
;
intf_sys_t
*
p_sys
=
p_intf
->
p_sys
;
services_discovery_sys_t
*
p_sys
=
p_sd
->
p_sys
;
playlist_t
*
p_playlist
;
playlist_t
*
p_playlist
;
playlist_item_t
*
p_item
;
playlist_item_t
*
p_item
;
psz_name
=
hal_device_get_property_string
(
p_
intf
->
p_sys
->
p_ctx
,
psz_name
=
hal_device_get_property_string
(
p_
sd
->
p_sys
->
p_ctx
,
psz_device
,
"volume.label"
);
psz_device
,
"volume.label"
);
psz_blockdevice
=
hal_device_get_property_string
(
p_
intf
->
p_sys
->
p_ctx
,
psz_blockdevice
=
hal_device_get_property_string
(
p_
sd
->
p_sys
->
p_ctx
,
psz_device
,
"block.device"
);
psz_device
,
"block.device"
);
asprintf
(
&
psz_uri
,
"dvd://%s"
,
psz_blockdevice
);
asprintf
(
&
psz_uri
,
"dvd://%s"
,
psz_blockdevice
);
/* Create the playlist item here */
/* Create the playlist item here */
p_item
=
playlist_ItemNew
(
p_
intf
,
psz_uri
,
p_item
=
playlist_ItemNew
(
p_
sd
,
psz_uri
,
psz_name
);
psz_name
);
free
(
psz_uri
);
free
(
psz_uri
);
hal_free_string
(
psz_device
);
hal_free_string
(
psz_device
);
...
@@ -161,11 +161,11 @@ static void AddDvd( intf_thread_t *p_intf, char *psz_device )
...
@@ -161,11 +161,11 @@ static void AddDvd( intf_thread_t *p_intf, char *psz_device )
return
;
return
;
}
}
p_item
->
i_flags
&=
~
PLAYLIST_SKIP_FLAG
;
p_item
->
i_flags
&=
~
PLAYLIST_SKIP_FLAG
;
p_playlist
=
(
playlist_t
*
)
vlc_object_find
(
p_
intf
,
VLC_OBJECT_PLAYLIST
,
p_playlist
=
(
playlist_t
*
)
vlc_object_find
(
p_
sd
,
VLC_OBJECT_PLAYLIST
,
FIND_ANYWHERE
);
FIND_ANYWHERE
);
if
(
!
p_playlist
)
if
(
!
p_playlist
)
{
{
msg_Err
(
p_
intf
,
"playlist not found"
);
msg_Err
(
p_
sd
,
"playlist not found"
);
return
;
return
;
}
}
...
@@ -173,22 +173,21 @@ static void AddDvd( intf_thread_t *p_intf, char *psz_device )
...
@@ -173,22 +173,21 @@ static void AddDvd( intf_thread_t *p_intf, char *psz_device )
PLAYLIST_APPEND
,
PLAYLIST_END
);
PLAYLIST_APPEND
,
PLAYLIST_END
);
vlc_object_release
(
p_playlist
);
vlc_object_release
(
p_playlist
);
}
}
static
void
AddCdda
(
intf_thread_t
*
p_intf
,
char
*
psz_device
)
static
void
AddCdda
(
services_discovery_t
*
p_sd
,
char
*
psz_device
)
{
{
char
*
psz_name
=
"Audio CD"
;
char
*
psz_name
=
"Audio CD"
;
char
*
psz_uri
;
char
*
psz_uri
;
char
*
psz_blockdevice
;
char
*
psz_blockdevice
;
intf_sys_t
*
p_sys
=
p_intf
->
p_sys
;
services_discovery_sys_t
*
p_sys
=
p_sd
->
p_sys
;
playlist_t
*
p_playlist
;
playlist_t
*
p_playlist
;
playlist_item_t
*
p_item
;
playlist_item_t
*
p_item
;
psz_blockdevice
=
hal_device_get_property_string
(
p_
intf
->
p_sys
->
p_ctx
,
psz_blockdevice
=
hal_device_get_property_string
(
p_
sd
->
p_sys
->
p_ctx
,
psz_device
,
"block.device"
);
psz_device
,
"block.device"
);
asprintf
(
&
psz_uri
,
"cdda://%s"
,
psz_blockdevice
);
asprintf
(
&
psz_uri
,
"cdda://%s"
,
psz_blockdevice
);
/* Create the playlist item here */
/* Create the playlist item here */
p_item
=
playlist_ItemNew
(
p_
intf
,
psz_uri
,
p_item
=
playlist_ItemNew
(
p_
sd
,
psz_uri
,
psz_name
);
psz_name
);
free
(
psz_uri
);
free
(
psz_uri
);
hal_free_string
(
psz_device
);
hal_free_string
(
psz_device
);
...
@@ -197,11 +196,11 @@ static void AddCdda( intf_thread_t *p_intf, char *psz_device )
...
@@ -197,11 +196,11 @@ static void AddCdda( intf_thread_t *p_intf, char *psz_device )
return
;
return
;
}
}
p_item
->
i_flags
&=
~
PLAYLIST_SKIP_FLAG
;
p_item
->
i_flags
&=
~
PLAYLIST_SKIP_FLAG
;
p_playlist
=
(
playlist_t
*
)
vlc_object_find
(
p_
intf
,
VLC_OBJECT_PLAYLIST
,
p_playlist
=
(
playlist_t
*
)
vlc_object_find
(
p_
sd
,
VLC_OBJECT_PLAYLIST
,
FIND_ANYWHERE
);
FIND_ANYWHERE
);
if
(
!
p_playlist
)
if
(
!
p_playlist
)
{
{
msg_Err
(
p_
intf
,
"playlist not found"
);
msg_Err
(
p_
sd
,
"playlist not found"
);
return
;
return
;
}
}
...
@@ -210,13 +209,12 @@ static void AddCdda( intf_thread_t *p_intf, char *psz_device )
...
@@ -210,13 +209,12 @@ static void AddCdda( intf_thread_t *p_intf, char *psz_device )
vlc_object_release
(
p_playlist
);
vlc_object_release
(
p_playlist
);
}
}
static
void
ParseDevice
(
intf_thread_t
*
p_intf
,
char
*
psz_device
)
static
void
ParseDevice
(
services_discovery_t
*
p_sd
,
char
*
psz_device
)
{
{
char
*
psz_disc_type
;
char
*
psz_disc_type
;
intf_sys_t
*
p_sys
=
p_intf
->
p_sys
;
services_discovery_sys_t
*
p_sys
=
p_sd
->
p_sys
;
if
(
hal_device_property_exists
(
p_sys
->
p_ctx
,
psz_device
,
if
(
hal_device_property_exists
(
p_sys
->
p_ctx
,
psz_device
,
"volume.disc.type"
)
)
"volume.disc.type"
)
)
{
{
...
@@ -225,40 +223,39 @@ static void ParseDevice( intf_thread_t *p_intf, char *psz_device )
...
@@ -225,40 +223,39 @@ static void ParseDevice( intf_thread_t *p_intf, char *psz_device )
"volume.disc.type"
);
"volume.disc.type"
);
if
(
!
strcmp
(
psz_disc_type
,
"dvd_rom"
)
)
if
(
!
strcmp
(
psz_disc_type
,
"dvd_rom"
)
)
{
{
AddDvd
(
p_
intf
,
psz_device
);
AddDvd
(
p_
sd
,
psz_device
);
}
}
else
if
(
!
strcmp
(
psz_disc_type
,
"cd_rom"
)
)
else
if
(
!
strcmp
(
psz_disc_type
,
"cd_rom"
)
)
{
{
if
(
hal_device_get_property_bool
(
p_sys
->
p_ctx
,
psz_device
,
"volume.disc.has_audio"
)
)
if
(
hal_device_get_property_bool
(
p_sys
->
p_ctx
,
psz_device
,
"volume.disc.has_audio"
)
)
{
{
AddCdda
(
p_
intf
,
psz_device
);
AddCdda
(
p_
sd
,
psz_device
);
}
}
}
}
hal_free_string
(
psz_disc_type
);
hal_free_string
(
psz_disc_type
);
}
}
}
}
/*****************************************************************************
/*****************************************************************************
* Run: main HAL thread
* Run: main HAL thread
*****************************************************************************/
*****************************************************************************/
static
void
Run
(
intf_thread_t
*
p_intf
)
static
void
Run
(
services_discovery_t
*
p_sd
)
{
{
int
i
,
i_devices
;
int
i
,
i_devices
;
char
**
devices
;
char
**
devices
;
intf_sys_t
*
p_sys
=
p_intf
->
p_sys
;
services_discovery_sys_t
*
p_sys
=
p_sd
->
p_sys
;
/* parse existing devices first */
/* parse existing devices first */
if
(
(
devices
=
hal_get_all_devices
(
p_sys
->
p_ctx
,
&
i_devices
)
)
)
if
(
(
devices
=
hal_get_all_devices
(
p_sys
->
p_ctx
,
&
i_devices
)
)
)
{
{
for
(
i
=
0
;
i
<
i_devices
;
i
++
)
for
(
i
=
0
;
i
<
i_devices
;
i
++
)
{
{
ParseDevice
(
p_
intf
,
devices
[
i
]
);
ParseDevice
(
p_
sd
,
devices
[
i
]
);
}
}
}
}
while
(
!
p_
intf
->
b_die
)
while
(
!
p_
sd
->
b_die
)
{
{
msleep
(
1000
);
msleep
(
1000
00
);
}
}
}
}
modules/
misc
/sap.c
→
modules/
services_discovery
/sap.c
View file @
8b61d4ef
This diff is collapsed.
Click to expand it.
src/interface/interface.c
View file @
8b61d4ef
...
@@ -359,8 +359,6 @@ static void RunInterface( intf_thread_t *p_intf )
...
@@ -359,8 +359,6 @@ static void RunInterface( intf_thread_t *p_intf )
var_Change
(
p_intf
,
"intf-add"
,
VLC_VAR_ADDCHOICE
,
&
val
,
&
text
);
var_Change
(
p_intf
,
"intf-add"
,
VLC_VAR_ADDCHOICE
,
&
val
,
&
text
);
val
.
psz_string
=
"logger"
;
text
.
psz_string
=
"Debug logging"
;
val
.
psz_string
=
"logger"
;
text
.
psz_string
=
"Debug logging"
;
var_Change
(
p_intf
,
"intf-add"
,
VLC_VAR_ADDCHOICE
,
&
val
,
&
text
);
var_Change
(
p_intf
,
"intf-add"
,
VLC_VAR_ADDCHOICE
,
&
val
,
&
text
);
val
.
psz_string
=
"sap"
;
text
.
psz_string
=
"SAP Playlist"
;
var_Change
(
p_intf
,
"intf-add"
,
VLC_VAR_ADDCHOICE
,
&
val
,
&
text
);
val
.
psz_string
=
"gestures"
;
text
.
psz_string
=
"Mouse Gestures"
;
val
.
psz_string
=
"gestures"
;
text
.
psz_string
=
"Mouse Gestures"
;
var_Change
(
p_intf
,
"intf-add"
,
VLC_VAR_ADDCHOICE
,
&
val
,
&
text
);
var_Change
(
p_intf
,
"intf-add"
,
VLC_VAR_ADDCHOICE
,
&
val
,
&
text
);
...
...
src/libvlc.c
View file @
8b61d4ef
...
@@ -649,6 +649,10 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] )
...
@@ -649,6 +649,10 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] )
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
/* Add service discovery modules */
playlist_AddSDModules
(
p_playlist
,
config_GetPsz
(
p_playlist
,
"services-discovery"
)
);
/*
/*
* Load background interfaces
* Load background interfaces
*/
*/
...
...
src/libvlc.h
View file @
8b61d4ef
...
@@ -545,6 +545,11 @@ static char *ppsz_align_descriptions[] =
...
@@ -545,6 +545,11 @@ static char *ppsz_align_descriptions[] =
"These options define the behavior of the playlist. Some " \
"These options define the behavior of the playlist. Some " \
"of them can be overridden in the playlist dialog box." )
"of them can be overridden in the playlist dialog box." )
#define SD_TEXT N_( "Services discovery modules")
#define SD_LONGTEXT N_( \
"Specifies the services discovery modules to load, separated by commas." \
"Typical values are sap, hal, ..." )
#define RANDOM_TEXT N_("Play files randomly forever")
#define RANDOM_TEXT N_("Play files randomly forever")
#define RANDOM_LONGTEXT N_( \
#define RANDOM_LONGTEXT N_( \
"When selected, VLC will randomly play files in the playlist until " \
"When selected, VLC will randomly play files in the playlist until " \
...
@@ -994,6 +999,8 @@ vlc_module_begin();
...
@@ -994,6 +999,8 @@ vlc_module_begin();
/* Playlist options */
/* Playlist options */
add_category_hint
(
N_
(
"Playlist"
),
PLAYLIST_CAT_LONGTEXT
,
VLC_FALSE
);
add_category_hint
(
N_
(
"Playlist"
),
PLAYLIST_CAT_LONGTEXT
,
VLC_FALSE
);
add_string
(
"services-discovery"
,
0
,
NULL
,
SD_TEXT
,
SD_LONGTEXT
,
VLC_FALSE
);
add_bool
(
"random"
,
0
,
NULL
,
RANDOM_TEXT
,
RANDOM_LONGTEXT
,
VLC_FALSE
);
add_bool
(
"random"
,
0
,
NULL
,
RANDOM_TEXT
,
RANDOM_LONGTEXT
,
VLC_FALSE
);
change_short
(
'Z'
);
change_short
(
'Z'
);
add_bool
(
"loop"
,
0
,
NULL
,
LOOP_TEXT
,
LOOP_LONGTEXT
,
VLC_FALSE
);
add_bool
(
"loop"
,
0
,
NULL
,
LOOP_TEXT
,
LOOP_LONGTEXT
,
VLC_FALSE
);
...
...
src/misc/objects.c
View file @
8b61d4ef
...
@@ -126,6 +126,10 @@ void * __vlc_object_create( vlc_object_t *p_this, int i_type )
...
@@ -126,6 +126,10 @@ void * __vlc_object_create( vlc_object_t *p_this, int i_type )
i_size
=
sizeof
(
playlist_t
);
i_size
=
sizeof
(
playlist_t
);
psz_type
=
"playlist"
;
psz_type
=
"playlist"
;
break
;
break
;
case
VLC_OBJECT_SD
:
i_size
=
sizeof
(
services_discovery_t
);
psz_type
=
"services discovery"
;
break
;
case
VLC_OBJECT_INPUT
:
case
VLC_OBJECT_INPUT
:
i_size
=
sizeof
(
input_thread_t
);
i_size
=
sizeof
(
input_thread_t
);
psz_type
=
"input"
;
psz_type
=
"input"
;
...
...
src/playlist/playlist.c
View file @
8b61d4ef
...
@@ -134,7 +134,6 @@ playlist_t * __playlist_Create ( vlc_object_t *p_parent )
...
@@ -134,7 +134,6 @@ playlist_t * __playlist_Create ( vlc_object_t *p_parent )
p_playlist
->
i_sort
=
SORT_ID
;
p_playlist
->
i_sort
=
SORT_ID
;
p_playlist
->
i_order
=
ORDER_NORMAL
;
p_playlist
->
i_order
=
ORDER_NORMAL
;
/* Finally, launch the thread ! */
/* Finally, launch the thread ! */
if
(
vlc_thread_create
(
p_playlist
,
"playlist"
,
RunThread
,
if
(
vlc_thread_create
(
p_playlist
,
"playlist"
,
RunThread
,
VLC_THREAD_PRIORITY_LOW
,
VLC_TRUE
)
)
VLC_THREAD_PRIORITY_LOW
,
VLC_TRUE
)
)
...
@@ -161,6 +160,12 @@ void playlist_Destroy( playlist_t * p_playlist )
...
@@ -161,6 +160,12 @@ void playlist_Destroy( playlist_t * p_playlist )
int
i
;
int
i
;
p_playlist
->
b_die
=
1
;
p_playlist
->
b_die
=
1
;
for
(
i
=
0
;
i
<
p_playlist
->
i_sds
;
i
++
)
{
playlist_ServicesDiscoveryRemove
(
p_playlist
,
p_playlist
->
pp_sds
[
i
]
->
psz_module
);
}
vlc_thread_join
(
p_playlist
);
vlc_thread_join
(
p_playlist
);
var_Destroy
(
p_playlist
,
"intf-change"
);
var_Destroy
(
p_playlist
,
"intf-change"
);
...
...
src/playlist/services_discovery.c
0 → 100644
View file @
8b61d4ef
/*****************************************************************************
* services_discovery.c : Manage playlist services_discovery modules
*****************************************************************************
* Copyright (C) 1999-2004 VideoLAN
* $Id: playlist.c 9216 2004-11-07 10:43:52Z zorglub $
*
* Authors: Clment Stenac <zorglub@videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include <stdlib.h>
/* free(), strtol() */
#include <stdio.h>
/* sprintf() */
#include <string.h>
/* strerror() */
#include <vlc/vlc.h>
#include <vlc/vout.h>
#include <vlc/sout.h>
#include <vlc/input.h>
#include "vlc_playlist.h"
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static
void
RunSD
(
services_discovery_t
*
p_sd
);
/***************************************************************************
***************************************************************************/
int
playlist_ServicesDiscoveryAdd
(
playlist_t
*
p_playlist
,
const
char
*
psz_module
)
{
services_discovery_t
*
p_sd
;
p_sd
=
vlc_object_create
(
p_playlist
,
VLC_OBJECT_SD
);
p_sd
->
pf_run
=
NULL
;
p_sd
->
p_module
=
module_Need
(
p_sd
,
"services_discovery"
,
psz_module
,
0
);
if
(
p_sd
->
p_module
==
NULL
)
{
msg_Err
(
p_playlist
,
"no suitable services discovery module"
);
vlc_object_destroy
(
p_sd
);
return
VLC_EGENERIC
;
}
p_sd
->
psz_module
=
strdup
(
psz_module
);
p_sd
->
b_die
=
VLC_FALSE
;
vlc_mutex_lock
(
&
p_playlist
->
object_lock
);
INSERT_ELEM
(
p_playlist
->
pp_sds
,
p_playlist
->
i_sds
,
p_playlist
->
i_sds
,
p_sd
);
vlc_mutex_unlock
(
&
p_playlist
->
object_lock
);
if
(
vlc_thread_create
(
p_sd
,
"services_discovery"
,
RunSD
,
VLC_THREAD_PRIORITY_LOW
,
VLC_FALSE
)
)
{
msg_Err
(
p_sd
,
"cannot create services discovery thread"
);
vlc_object_destroy
(
p_sd
);
return
VLC_EGENERIC
;
}
return
VLC_SUCCESS
;
}
void
playlist_ServicesDiscoveryRemove
(
playlist_t
*
p_playlist
,
const
char
*
psz_module
)
{
int
i
;
services_discovery_t
*
p_sd
=
NULL
;
vlc_mutex_lock
(
&
p_playlist
->
object_lock
);
for
(
i
=
0
;
i
<
p_playlist
->
i_sds
;
i
++
)
{
if
(
!
strcmp
(
psz_module
,
p_playlist
->
pp_sds
[
i
]
->
psz_module
)
)
{
p_sd
=
p_playlist
->
pp_sds
[
i
];
REMOVE_ELEM
(
p_playlist
->
pp_sds
,
p_playlist
->
i_sds
,
i
);
break
;
}
}
if
(
p_sd
)
{
p_sd
->
b_die
=
VLC_TRUE
;
vlc_thread_join
(
p_sd
);
module_Unneed
(
p_sd
,
p_sd
->
p_module
);
vlc_object_destroy
(
p_sd
);
}
else
{
msg_Warn
(
p_playlist
,
"module %s is not loaded"
,
psz_module
);
}
vlc_mutex_unlock
(
&
p_playlist
->
object_lock
);
return
;
}
/**
* Load all service discovery modules in a string
*
* \param p_playlist the playlist
* \param psz_modules a list of modules separated by commads
* return VLC_SUCCESS or an error
*/
int
playlist_AddSDModules
(
playlist_t
*
p_playlist
,
char
*
psz_modules
)
{
if
(
psz_modules
&&
*
psz_modules
)
{
char
*
psz_parser
=
psz_modules
;
char
*
psz_next
;
while
(
psz_parser
&&
*
psz_parser
)
{
while
(
*
psz_parser
==
' '
||
*
psz_parser
==
','
)
{
psz_parser
++
;
}
if
(
(
psz_next
=
strchr
(
psz_parser
,
','
)
)
)
{
*
psz_next
++
=
'\0'
;
}
if
(
*
psz_parser
==
'\0'
)
{
break
;
}
playlist_ServicesDiscoveryAdd
(
p_playlist
,
psz_parser
);
psz_parser
=
psz_next
;
}
}
return
VLC_SUCCESS
;
}
static
void
RunSD
(
services_discovery_t
*
p_sd
)
{
p_sd
->
pf_run
(
p_sd
);
return
;
}
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