Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
mediastreamer2
Commits
07824fcf
Commit
07824fcf
authored
Mar 15, 2013
by
Yann Diorcet
Browse files
Add libupnp check for patched version
parent
f223705f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
7 deletions
+24
-7
configure.ac
configure.ac
+11
-0
src/upnp/upnp_igd.c
src/upnp/upnp_igd.c
+5
-5
src/upnp/upnp_igd_cmd.c
src/upnp/upnp_igd_cmd.c
+1
-2
src/upnp/upnp_igd_private.h
src/upnp/upnp_igd_private.h
+7
-0
No files found.
configure.ac
View file @
07824fcf
...
...
@@ -570,6 +570,17 @@ if test "$build_upnp" != "false" ; then
PKG_CHECK_MODULES([LIBUPNP], [libupnp],
[if pkg-config --atleast-version=1.6 "libupnp < 1.7"; then
build_upnp=true
old_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $LIBUPNP_CFLAGS"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <upnp.h>
]], [[
struct Upnp_Action_Complete aa;
char *url = aa.CtrlUrl;
url = url;
]])],,
CFLAGS="$old_CFLAGS"
AC_DEFINE(USE_PATCHED_UPNP, 1, [Define if upnp is patched]))
else
AC_MSG_ERROR([libupnp >= 1.6 < 1.5 required.])
fi],
...
...
src/upnp/upnp_igd.c
View file @
07824fcf
...
...
@@ -883,7 +883,7 @@ int upnp_igd_callback(Upnp_EventType event_type, void* event, void *cookie) {
if
(
a_event
->
ErrCode
!=
UPNP_E_SUCCESS
)
{
upnp_igd_print
(
igd_ctxt
,
UPNP_IGD_ERROR
,
"Error in Action Complete Callback -- %d"
,
a_event
->
ErrCode
);
}
else
{
upnp_igd_handle_send_action
(
igd_ctxt
,
a_event
->
CtrlUrl
,
a_event
->
ActionRequest
,
a_event
->
ActionResult
);
upnp_igd_handle_send_action
(
igd_ctxt
,
UPNP_STRING
(
a_event
->
CtrlUrl
)
,
a_event
->
ActionRequest
,
a_event
->
ActionResult
);
}
}
break
;
...
...
@@ -893,7 +893,7 @@ int upnp_igd_callback(Upnp_EventType event_type, void* event, void *cookie) {
if
(
sv_event
->
ErrCode
!=
UPNP_E_SUCCESS
)
{
upnp_igd_print
(
igd_ctxt
,
UPNP_IGD_ERROR
,
"Error in Get Var Complete Callback -- %d"
,
sv_event
->
ErrCode
);
}
else
{
upnp_igd_handle_get_var
(
igd_ctxt
,
sv_event
->
CtrlUrl
,
sv_event
->
StateVarName
,
sv_event
->
CurrentVal
);
upnp_igd_handle_get_var
(
igd_ctxt
,
UPNP_STRING
(
sv_event
->
CtrlUrl
)
,
sv_event
->
StateVarName
,
sv_event
->
CurrentVal
);
}
}
break
;
...
...
@@ -912,7 +912,7 @@ int upnp_igd_callback(Upnp_EventType event_type, void* event, void *cookie) {
if
(
es_event
->
ErrCode
!=
UPNP_E_SUCCESS
)
{
upnp_igd_print
(
igd_ctxt
,
UPNP_IGD_ERROR
,
"Error in Event Subscribe Callback -- %d"
,
es_event
->
ErrCode
);
}
else
{
upnp_igd_handle_subscribe_update
(
igd_ctxt
,
es_event
->
PublisherUrl
,
es_event
->
Sid
,
es_event
->
TimeOut
);
upnp_igd_handle_subscribe_update
(
igd_ctxt
,
UPNP_STRING
(
es_event
->
PublisherUrl
)
,
es_event
->
Sid
,
es_event
->
TimeOut
);
}
}
break
;
...
...
@@ -923,10 +923,10 @@ int upnp_igd_callback(Upnp_EventType event_type, void* event, void *cookie) {
Upnp_SID
newSID
;
int
ret
;
ret
=
UpnpSubscribe
(
igd_ctxt
->
upnp_handle
,
es_event
->
PublisherUrl
,
&
TimeOut
,
newSID
);
ret
=
UpnpSubscribe
(
igd_ctxt
->
upnp_handle
,
UPNP_STRING
(
es_event
->
PublisherUrl
)
,
&
TimeOut
,
newSID
);
if
(
ret
==
UPNP_E_SUCCESS
)
{
upnp_igd_print
(
igd_ctxt
,
UPNP_IGD_DEBUG
,
"Subscribed to EventURL with SID=%s"
,
newSID
);
upnp_igd_handle_subscribe_update
(
igd_ctxt
,
es_event
->
PublisherUrl
,
newSID
,
TimeOut
);
upnp_igd_handle_subscribe_update
(
igd_ctxt
,
UPNP_STRING
(
es_event
->
PublisherUrl
)
,
newSID
,
TimeOut
);
}
else
{
upnp_igd_print
(
igd_ctxt
,
UPNP_IGD_ERROR
,
"Error Subscribing to EventURL -- %d"
,
ret
);
}
...
...
src/upnp/upnp_igd_cmd.c
View file @
07824fcf
...
...
@@ -5,7 +5,6 @@
#include <stdio.h>
#include <stdlib.h>
typedef
struct
_upnp_igd_port_mapping_context
{
upnp_igd_context
*
igd_ctxt
;
upnp_igd_port_mapping
mapping
;
...
...
@@ -74,7 +73,7 @@ int upnp_igd_port_mapping_callback(Upnp_EventType event_type, void* event, void
switch
(
event_type
)
{
case
UPNP_CONTROL_ACTION_COMPLETE
:
{
struct
Upnp_Action_Complete
*
a_event
=
(
struct
Upnp_Action_Complete
*
)
event
;
upnp_igd_port_mapping_handle_action
(
igd_port_mapping_ctxt
,
a_event
->
ErrCode
,
a_event
->
CtrlUrl
,
a_event
->
ActionRequest
,
a_event
->
ActionResult
);
upnp_igd_port_mapping_handle_action
(
igd_port_mapping_ctxt
,
a_event
->
ErrCode
,
UPNP_STRING
(
a_event
->
CtrlUrl
)
,
a_event
->
ActionRequest
,
a_event
->
ActionResult
);
}
break
;
...
...
src/upnp/upnp_igd_private.h
View file @
07824fcf
...
...
@@ -3,6 +3,7 @@
#include "mediastreamer2/upnp_igd.h"
#include "mediastreamer-config.h"
#include <upnp.h>
#include <ithread.h>
...
...
@@ -84,6 +85,12 @@ struct _upnp_igd_context {
};
#ifndef USE_PATCHED_UPNP
#define UPNP_STRING(x) (x)
#else
#define UPNP_STRING(x) UpnpString_get_String(x)
#endif //USE_PATCHED_UPNP
extern
const
char
*
IGDDeviceType
;
extern
const
char
*
IGDServiceType
[];
extern
const
char
*
IGDServiceName
[];
...
...
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