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
6e160dae
Commit
6e160dae
authored
Feb 04, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SD: initialize config chain also in LibVLC media discovery, fix leaks
parent
711d1506
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
24 deletions
+31
-24
include/vlc_services_discovery.h
include/vlc_services_discovery.h
+4
-7
src/control/media_discoverer.c
src/control/media_discoverer.c
+6
-5
src/libvlccore.sym
src/libvlccore.sym
+1
-0
src/playlist/services_discovery.c
src/playlist/services_discovery.c
+20
-12
No files found.
include/vlc_services_discovery.h
View file @
6e160dae
...
...
@@ -48,6 +48,7 @@ struct services_discovery_t
vlc_event_manager_t
event_manager
;
/* Accessed through Setters for non class function */
char
*
psz_name
;
config_chain_t
*
p_cfg
;
services_discovery_sys_t
*
p_sys
;
...
...
@@ -64,14 +65,10 @@ VLC_EXPORT( char **, vlc_sd_GetNames, ( vlc_object_t *, char *** ) );
vlc_sd_GetNames(VLC_OBJECT(obj), pln)
/* Creation of a service_discovery object */
VLC_EXPORT
(
services_discovery_t
*
,
vlc_sd_Create
,
(
vlc_object_t
*
)
);
VLC_EXPORT
(
bool
,
vlc_sd_Start
,
(
services_discovery_t
*
,
const
char
*
)
);
VLC_EXPORT
(
services_discovery_t
*
,
vlc_sd_Create
,
(
vlc_object_t
*
,
const
char
*
)
);
VLC_EXPORT
(
bool
,
vlc_sd_Start
,
(
services_discovery_t
*
)
);
VLC_EXPORT
(
void
,
vlc_sd_Stop
,
(
services_discovery_t
*
)
);
static
inline
void
vlc_sd_Destroy
(
services_discovery_t
*
p_sd
)
{
vlc_object_release
(
VLC_OBJECT
(
p_sd
)
);
}
VLC_EXPORT
(
void
,
vlc_sd_Destroy
,
(
services_discovery_t
*
)
);
static
inline
void
vlc_sd_StopAndDestroy
(
services_discovery_t
*
p_this
)
{
...
...
src/control/media_discoverer.c
View file @
6e160dae
...
...
@@ -199,9 +199,9 @@ libvlc_media_discoverer_new_from_name( libvlc_instance_t * p_inst,
libvlc_event_manager_register_event_type
(
p_mdis
->
p_event_manager
,
libvlc_MediaDiscovererEnded
);
p_mdis
->
p_sd
=
vlc_sd_Create
(
(
vlc_object_t
*
)
p_inst
->
p_libvlc_int
);
if
(
!
p_mdis
->
p_sd
)
p_mdis
->
p_sd
=
vlc_sd_Create
(
(
vlc_object_t
*
)
p_inst
->
p_libvlc_int
,
psz_name
);
if
(
unlikely
(
p_mdis
->
p_sd
==
NULL
)
)
{
libvlc_printerr
(
"%s: no such discovery module found"
,
psz_name
);
libvlc_media_list_release
(
p_mdis
->
p_mlist
);
...
...
@@ -228,9 +228,10 @@ libvlc_media_discoverer_new_from_name( libvlc_instance_t * p_inst,
p_mdis
);
/* Here we go */
if
(
!
vlc_sd_Start
(
p_mdis
->
p_sd
,
psz_name
)
)
if
(
!
vlc_sd_Start
(
p_mdis
->
p_sd
)
)
{
libvlc_printerr
(
"%s: internal module error"
,
psz_name
);
libvlc_printerr
(
"%s: internal module error"
,
p_mdis
->
p_sd
->
psz_name
);
libvlc_media_list_release
(
p_mdis
->
p_mlist
);
libvlc_event_manager_release
(
p_mdis
->
p_event_manager
);
free
(
p_mdis
);
...
...
src/libvlccore.sym
View file @
6e160dae
...
...
@@ -557,6 +557,7 @@ vlc_rwlock_unlock
vlc_rwlock_wrlock
vlc_savecancel
vlc_sd_Create
vlc_sd_Destroy
vlc_sd_GetNames
vlc_sd_probe_Add
vlc_sdp_Start
...
...
src/playlist/services_discovery.c
View file @
6e160dae
...
...
@@ -107,7 +107,8 @@ static void services_discovery_Destructor ( vlc_object_t *p_obj );
/***********************************************************************
* Create
***********************************************************************/
services_discovery_t
*
vlc_sd_Create
(
vlc_object_t
*
p_super
)
services_discovery_t
*
vlc_sd_Create
(
vlc_object_t
*
p_super
,
const
char
*
cfg
)
{
services_discovery_t
*
p_sd
;
...
...
@@ -115,6 +116,7 @@ services_discovery_t *vlc_sd_Create( vlc_object_t *p_super )
"services discovery"
);
if
(
!
p_sd
)
return
NULL
;
free
(
config_ChainCreate
(
&
p_sd
->
psz_name
,
&
p_sd
->
p_cfg
,
cfg
));
vlc_event_manager_init
(
&
p_sd
->
event_manager
,
p_sd
,
(
vlc_object_t
*
)
p_sd
);
vlc_event_manager_register_event_type
(
&
p_sd
->
event_manager
,
...
...
@@ -135,12 +137,12 @@ services_discovery_t *vlc_sd_Create( vlc_object_t *p_super )
/***********************************************************************
* Stop
***********************************************************************/
bool
vlc_sd_Start
(
services_discovery_t
*
p_sd
,
const
char
*
module
)
bool
vlc_sd_Start
(
services_discovery_t
*
p_sd
)
{
assert
(
!
p_sd
->
p_module
);
p_sd
->
p_module
=
module_need
(
p_sd
,
"services_discovery"
,
module
,
true
);
p_sd
->
p_module
=
module_need
(
p_sd
,
"services_discovery"
,
p_sd
->
psz_name
,
true
);
if
(
p_sd
->
p_module
==
NULL
)
{
msg_Err
(
p_sd
,
"no suitable services discovery module"
);
...
...
@@ -169,6 +171,13 @@ void vlc_sd_Stop ( services_discovery_t * p_sd )
p_sd
->
p_module
=
NULL
;
}
void
vlc_sd_Destroy
(
services_discovery_t
*
p_sd
)
{
config_ChainDestroy
(
p_sd
->
p_cfg
);
free
(
p_sd
->
psz_name
);
vlc_object_release
(
p_sd
);
}
/***********************************************************************
* Destructor
***********************************************************************/
...
...
@@ -271,18 +280,17 @@ static void playlist_sd_item_removed( const vlc_event_t * p_event, void * user_d
playlist_DeleteFromInput
(
p_parent
->
p_playlist
,
p_input
,
false
);
}
int
playlist_ServicesDiscoveryAdd
(
playlist_t
*
p_playlist
,
const
char
*
psz_module
)
int
playlist_ServicesDiscoveryAdd
(
playlist_t
*
p_playlist
,
const
char
*
psz_name
)
{
/* Perform the addition */
msg_Dbg
(
p_playlist
,
"adding services_discovery %s..."
,
psz_module
)
;
services_discovery_t
*
p_sd
;
services_discovery_t
*
p_sd
=
vlc_sd_Create
(
VLC_OBJECT
(
p_playlist
)
);
msg_Dbg
(
p_playlist
,
"adding services_discovery %s..."
,
psz_name
);
p_sd
=
vlc_sd_Create
(
VLC_OBJECT
(
p_playlist
),
psz_name
);
if
(
!
p_sd
)
return
VLC_ENOMEM
;
char
*
psz_name
=
NULL
;
config_ChainCreate
(
&
psz_name
,
&
p_sd
->
p_cfg
,
psz_module
);
module_t
*
m
=
module_find_by_shortcut
(
psz_name
);
if
(
!
m
)
{
...
...
@@ -316,7 +324,7 @@ int playlist_ServicesDiscoveryAdd( playlist_t *p_playlist, const char *psz_modul
vlc_ServicesDiscoveryItemRemoved
,
playlist_sd_item_removed
,
p_node
);
if
(
!
vlc_sd_Start
(
p_sd
,
psz_name
)
)
if
(
!
vlc_sd_Start
(
p_sd
)
)
{
vlc_sd_Destroy
(
p_sd
);
free
(
p_sds
);
...
...
@@ -327,7 +335,7 @@ int playlist_ServicesDiscoveryAdd( playlist_t *p_playlist, const char *psz_modul
p_node
->
p_input
->
b_prefers_tree
=
true
;
p_sds
->
p_sd
=
p_sd
;
p_sds
->
p_node
=
p_node
;
p_sds
->
psz_name
=
strdup
(
psz_
modul
e
);
p_sds
->
psz_name
=
strdup
(
psz_
nam
e
);
PL_LOCK
;
TAB_APPEND
(
pl_priv
(
p_playlist
)
->
i_sds
,
pl_priv
(
p_playlist
)
->
pp_sds
,
p_sds
);
...
...
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