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
5a530e55
Commit
5a530e55
authored
May 19, 2011
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Converted bonjour module to vlc_clone().
parent
8aa0cd82
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
29 deletions
+16
-29
modules/access_output/bonjour.c
modules/access_output/bonjour.c
+16
-29
No files found.
modules/access_output/bonjour.c
View file @
5a530e55
...
@@ -46,18 +46,11 @@
...
@@ -46,18 +46,11 @@
/*****************************************************************************
/*****************************************************************************
* Structures
* Structures
*****************************************************************************/
*****************************************************************************/
typedef
struct
poll_thread_t
{
VLC_COMMON_MEMBERS
AvahiSimplePoll
*
simple_poll
;
}
poll_thread_t
;
typedef
struct
bonjour_t
typedef
struct
bonjour_t
{
{
vlc_object_t
*
p_log
;
vlc_object_t
*
p_log
;
poll_thread_t
*
poll_
thread
;
vlc_thread_t
thread
;
AvahiSimplePoll
*
simple_poll
;
AvahiSimplePoll
*
simple_poll
;
AvahiEntryGroup
*
group
;
AvahiEntryGroup
*
group
;
AvahiClient
*
client
;
AvahiClient
*
client
;
...
@@ -172,16 +165,19 @@ static void client_callback( AvahiClient *c,
...
@@ -172,16 +165,19 @@ static void client_callback( AvahiClient *c,
/*****************************************************************************
/*****************************************************************************
* poll_iterate_thread
* poll_iterate_thread
*****************************************************************************/
*****************************************************************************/
static
void
*
poll_iterate_thread
(
vlc_object_t
*
p_this
)
static
void
*
poll_iterate_thread
(
void
*
data
)
{
{
poll_thread_t
*
p_pt
=
(
poll_thread_t
*
)
p_this
;
AvahiSimplePoll
*
simple_poll
=
data
;
int
canc
=
vlc_savecancel
();
while
(
vlc_object_alive
(
p_pt
)
)
for
(
;;
)
if
(
avahi_simple_poll_iterate
(
p_pt
->
simple_poll
,
100
)
!=
0
)
{
vlc_testcancel
();
int
canc
=
vlc_savecancel
();
int
ret
=
avahi_simple_poll_iterate
(
p_pt
->
simple_poll
,
100
);
vlc_restorecancel
(
canc
);
if
(
ret
)
break
;
break
;
}
vlc_restorecancel
(
canc
);
return
NULL
;
return
NULL
;
}
}
...
@@ -228,15 +224,9 @@ void *bonjour_start_service( vlc_object_t *p_log, const char *psz_stype,
...
@@ -228,15 +224,9 @@ void *bonjour_start_service( vlc_object_t *p_log, const char *psz_stype,
goto
error
;
goto
error
;
}
}
p_sys
->
poll_thread
=
vlc_object_create
(
p_sys
->
p_log
,
if
(
vlc_clone
(
&
p_sys
->
thread
,
sizeof
(
poll_thread_t
)
);
poll_iterate_thread
,
p_sys
->
simple_poll
,
if
(
p_sys
->
poll_thread
==
NULL
)
VLC_THREAD_PRIORITY_HIGHEST
)
)
goto
error
;
p_sys
->
poll_thread
->
simple_poll
=
p_sys
->
simple_poll
;
if
(
vlc_thread_create
(
p_sys
->
poll_thread
,
poll_iterate_thread
,
VLC_THREAD_PRIORITY_HIGHEST
)
)
{
{
msg_Err
(
p_sys
->
p_log
,
"failed to create poll iterate thread"
);
msg_Err
(
p_sys
->
p_log
,
"failed to create poll iterate thread"
);
goto
error
;
goto
error
;
...
@@ -245,8 +235,6 @@ void *bonjour_start_service( vlc_object_t *p_log, const char *psz_stype,
...
@@ -245,8 +235,6 @@ void *bonjour_start_service( vlc_object_t *p_log, const char *psz_stype,
return
(
void
*
)
p_sys
;
return
(
void
*
)
p_sys
;
error:
error:
if
(
p_sys
->
poll_thread
!=
NULL
)
vlc_object_release
(
p_sys
->
poll_thread
);
if
(
p_sys
->
client
!=
NULL
)
if
(
p_sys
->
client
!=
NULL
)
avahi_client_free
(
p_sys
->
client
);
avahi_client_free
(
p_sys
->
client
);
if
(
p_sys
->
simple_poll
!=
NULL
)
if
(
p_sys
->
simple_poll
!=
NULL
)
...
@@ -270,9 +258,8 @@ void bonjour_stop_service( void *_p_sys )
...
@@ -270,9 +258,8 @@ void bonjour_stop_service( void *_p_sys )
{
{
bonjour_t
*
p_sys
=
(
bonjour_t
*
)
_p_sys
;
bonjour_t
*
p_sys
=
(
bonjour_t
*
)
_p_sys
;
vlc_object_kill
(
p_sys
->
poll_thread
);
vlc_cancel
(
p_sys
->
thread
);
vlc_thread_join
(
p_sys
->
poll_thread
);
vlc_join
(
p_sys
->
thread
,
NULL
);
vlc_object_release
(
p_sys
->
poll_thread
);
if
(
p_sys
->
group
!=
NULL
)
if
(
p_sys
->
group
!=
NULL
)
avahi_entry_group_free
(
p_sys
->
group
);
avahi_entry_group_free
(
p_sys
->
group
);
...
...
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