ccc7f468f6
UPnP/DLNA Plugin for Video Disk Recorder This Plugins extends the VDR with the possibility to act as an UPnP/DLNA Media Server (DMS). It will serve VDR's contents in the network to any UPnP-AV and DLNA capable devices. This still is an alpha version! WWW: http://upnp.vdr-developer.org/
83 lines
2.4 KiB
Text
83 lines
2.4 KiB
Text
--- a/misc/util.cpp
|
|
+++ b/misc/util.cpp
|
|
@@ -12,6 +12,14 @@
|
|
#include <string.h>
|
|
#include <string>
|
|
#include <sys/ioctl.h>
|
|
+#ifdef __FreeBSD__
|
|
+#include <sys/socket.h>
|
|
+#include <ifaddrs.h>
|
|
+#include <net/if.h>
|
|
+#include <net/if_dl.h>
|
|
+#include <net/if_types.h>
|
|
+#include <net/ethernet.h>
|
|
+#endif
|
|
#include <net/if.h>
|
|
#include <upnp/ixml.h>
|
|
#include <arpa/inet.h>
|
|
@@ -74,6 +82,7 @@ char* substr(const char* str, unsigned i
|
|
}
|
|
|
|
const char* getMACFromInterface(const char* Interface) {
|
|
+#ifndef __FreeBSD__
|
|
int fd;
|
|
struct ifreq ifr;
|
|
|
|
@@ -95,6 +104,31 @@ const char* getMACFromInterface(const ch
|
|
(unsigned char)ifr.ifr_hwaddr.sa_data[3],
|
|
(unsigned char)ifr.ifr_hwaddr.sa_data[4],
|
|
(unsigned char)ifr.ifr_hwaddr.sa_data[5]);
|
|
+#else
|
|
+ struct ifaddrs *ifa, *ifp = NULL;
|
|
+ char *ret = new char[18];
|
|
+ strcpy(ret, "00:00:00:00:00:00");
|
|
+
|
|
+ if (!Interface || getifaddrs(&ifp) < 0)
|
|
+ return ret;
|
|
+
|
|
+ for (ifa = ifp; ifa != NULL; ifa = ifa->ifa_next) {
|
|
+ if (strcmp(ifa->ifa_name, Interface))
|
|
+ continue;
|
|
+
|
|
+ if (ifa->ifa_addr->sa_family == AF_LINK) {
|
|
+ struct sockaddr_dl *sdl =
|
|
+ (struct sockaddr_dl *)ifa->ifa_addr;
|
|
+
|
|
+ if (sdl->sdl_type == IFT_ETHER &&
|
|
+ sdl->sdl_alen == ETHER_ADDR_LEN)
|
|
+ snprintf(ret, 18, "%s",
|
|
+ ether_ntoa((struct ether_addr *)LLADDR(sdl)));
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+ freeifaddrs(ifp);
|
|
+#endif
|
|
|
|
return ret;
|
|
}
|
|
--- a/server/server.cpp
|
|
+++ b/server/server.cpp
|
|
@@ -8,6 +8,9 @@
|
|
#include <vdr/plugin.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
+#ifdef __FreeBSD__
|
|
+#include <sys/socket.h>
|
|
+#endif
|
|
#include <arpa/inet.h>
|
|
#include <upnp/upnp.h>
|
|
#include "server.h"
|
|
--- a/database/database.cpp
|
|
+++ b/database/database.cpp
|
|
@@ -161,7 +161,11 @@ bool cRow::fetchColumn(char** Column, ch
|
|
|
|
int cSQLiteDatabase::initialize(){
|
|
int ret;
|
|
+#ifdef __FreeBSD__
|
|
+ const char* dbdir = (cUPnPConfig::get()->mDatabaseFolder) ? cUPnPConfig::get()->mDatabaseFolder : "/var/cache/vdr/upnp";
|
|
+#else
|
|
const char* dbdir = (cUPnPConfig::get()->mDatabaseFolder) ? cUPnPConfig::get()->mDatabaseFolder : cPluginUpnp::getConfigDirectory();
|
|
+#endif
|
|
cString File = cString::sprintf("%s/%s", dbdir, SQLITE_DB_FILE);
|
|
if((ret = sqlite3_open(File, &this->mDatabase))){
|
|
ERROR("Unable to open database file %s (Error code: %d)!", *File, ret);
|