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
24ed0b35
Commit
24ed0b35
authored
Aug 28, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bonjour: use the avahi thread backend
Simpler and free from arbitrary wake ups
parent
d20d0224
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
30 deletions
+11
-30
modules/services_discovery/bonjour.c
modules/services_discovery/bonjour.c
+11
-30
No files found.
modules/services_discovery/bonjour.c
View file @
24ed0b35
/*****************************************************************************
* bonjour.c: Bonjour services discovery module
*****************************************************************************
* Copyright (C) 2005 the VideoLAN team
* Copyright (C) 2005
-2008
the VideoLAN team
* $Id$
*
* Authors: Jon Lech Johansen <jon@nanocrew.net>
...
...
@@ -39,7 +39,7 @@
# include <avahi-client/publish.h>
# include <avahi-client/lookup.h>
#endif
#include <avahi-common/
simple
-watch.h>
#include <avahi-common/
thread
-watch.h>
#include <avahi-common/malloc.h>
#include <avahi-common/error.h>
...
...
@@ -66,7 +66,7 @@ vlc_module_end();
struct
services_discovery_sys_t
{
Avahi
SimplePoll
*
simple_
poll
;
Avahi
ThreadedPoll
*
poll
;
AvahiClient
*
client
;
AvahiServiceBrowser
*
sb
;
vlc_dictionary_t
services_name_to_input_item
;
...
...
@@ -96,7 +96,7 @@ static void client_callback( AvahiClient *c, AvahiClientState state,
#endif
{
msg_Err
(
p_sd
,
"avahi client disconnected"
);
avahi_
simple_poll_quit
(
p_sys
->
simple_
poll
);
avahi_
threaded_poll_quit
(
p_sys
->
poll
);
}
}
...
...
@@ -279,14 +279,14 @@ static int Open( vlc_object_t *p_this )
vlc_dictionary_init
(
&
p_sys
->
services_name_to_input_item
,
1
);
p_sys
->
simple_poll
=
avahi_simple
_poll_new
();
if
(
p_sys
->
simple_
poll
==
NULL
)
p_sys
->
poll
=
avahi_threaded
_poll_new
();
if
(
p_sys
->
poll
==
NULL
)
{
msg_Err
(
p_sd
,
"failed to create
avahi simple
poll"
);
msg_Err
(
p_sd
,
"failed to create
Avahi threaded
poll"
);
goto
error
;
}
p_sys
->
client
=
avahi_client_new
(
avahi_
simple_poll_get
(
p_sys
->
simple_
poll
),
p_sys
->
client
=
avahi_client_new
(
avahi_
threaded_poll_get
(
p_sys
->
poll
),
#ifdef HAVE_AVAHI_06
0
,
#endif
...
...
@@ -313,8 +313,6 @@ static int Open( vlc_object_t *p_this )
services_discovery_SetLocalizedName
(
p_sd
,
_
(
"Bonjour"
)
);
p_sd
->
pf_run
=
Run
;
return
VLC_SUCCESS
;
error:
...
...
@@ -322,8 +320,8 @@ error:
avahi_service_browser_free
(
p_sys
->
sb
);
if
(
p_sys
->
client
!=
NULL
)
avahi_client_free
(
p_sys
->
client
);
if
(
p_sys
->
simple_
poll
!=
NULL
)
avahi_
simple_poll_free
(
p_sys
->
simple_
poll
);
if
(
p_sys
->
poll
!=
NULL
)
avahi_
threaded_poll_free
(
p_sys
->
poll
);
vlc_dictionary_clear
(
&
p_sys
->
services_name_to_input_item
);
free
(
p_sys
);
...
...
@@ -341,25 +339,8 @@ static void Close( vlc_object_t *p_this )
avahi_service_browser_free
(
p_sys
->
sb
);
avahi_client_free
(
p_sys
->
client
);
avahi_
simple_poll_free
(
p_sys
->
simple_
poll
);
avahi_
threaded_poll_free
(
p_sys
->
poll
);
vlc_dictionary_clear
(
&
p_sys
->
services_name_to_input_item
);
free
(
p_sys
);
}
/*****************************************************************************
* Run: main thread
*****************************************************************************/
static
void
Run
(
services_discovery_t
*
p_sd
)
{
services_discovery_sys_t
*
p_sys
=
p_sd
->
p_sys
;
while
(
vlc_object_alive
(
p_sd
)
)
{
if
(
avahi_simple_poll_iterate
(
p_sys
->
simple_poll
,
100
)
!=
0
)
{
msg_Err
(
p_sd
,
"poll iterate failed"
);
break
;
}
}
}
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