Commit 07824fcf authored by Yann Diorcet's avatar Yann Diorcet

Add libupnp check for patched version

parent f223705f
......@@ -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],
......
......@@ -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);
}
......
......@@ -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;
......
......@@ -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[];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment