Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLCKit
Manage
Activity
Members
Labels
Plan
Issues
123
Issue boards
Milestones
Code
Merge requests
5
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoLAN
VLCKit
Merge requests
!47
libvlc: add basic UPnP adapter discovery
Code
Review changes
Check out branch
Download
Patches
Plain diff
Closed
libvlc: add basic UPnP adapter discovery
fkuehne/VLCKit:upnpadapterfix
into
3.0
Overview
3
Commits
1
Pipelines
0
Changes
1
Closed
Felix Paul Kühne
requested to merge
fkuehne/VLCKit:upnpadapterfix
into
3.0
4 years ago
Overview
3
Commits
1
Pipelines
0
Changes
1
Expand
This fixes
#398 (closed)
for execution on iOS and tvOS devices
0
0
Merge request reports
Compare
3.0
3.0 (base)
and
latest version
latest version
d838cce2
1 commit,
4 years ago
1 file
+
72
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Resources/MobileVLCKit/patches/0031-upnp-add-basic-network-interface-discovery-for-iOS-a.patch
0 → 100644
+
72
−
0
Options
From b0c79859d5de6f99f711be12449699d6cc028f58 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <felix@feepk.net>
Date: Wed, 1 Jul 2020 13:45:29 +0200
Subject: [PATCH 31/31] upnp: add basic network interface discovery for iOS and
tvOS
---
modules/services_discovery/upnp.cpp | 47 +++++++++++++++++++++++++++--
1 file changed, 45 insertions(+), 2 deletions(-)
diff --git a/modules/services_discovery/upnp.cpp b/modules/services_discovery/upnp.cpp
index 13c1eb7971..3e7e39a225 100644
--- a/modules/services_discovery/upnp.cpp
+++ b/modules/services_discovery/upnp.cpp
@@ -1621,9 +1621,52 @@
inline char *getPreferedAdapter()
}
#else
-static char *getPreferedAdapter()
+inline bool necessaryFlagsSetOnInterface(struct ifaddrs *anInterface, const char *nameToCompare)
{
- return NULL;
+ if (strncmp (anInterface->ifa_name, nameToCompare, strlen(nameToCompare)) == 0) {
+ unsigned int flags = anInterface->ifa_flags;
+ if( (flags & IFF_UP) && (flags & IFF_RUNNING) && !(flags & IFF_LOOPBACK) ) {
+ return true;
+ }
+ }
+ return false;
+}
+
+inline char *getPreferedAdapter()
+{
+ struct ifaddrs *listOfInterfaces = NULL;
+ struct ifaddrs *anInterface = NULL;
+ int ret = getifaddrs(&listOfInterfaces);
+ char *adapterName = NULL;
+
+ if (ret == 0) {
+ anInterface = listOfInterfaces;
+
+ while (anInterface != NULL) {
+ bool ret = necessaryFlagsSetOnInterface(anInterface, "en0");
+ if (ret) {
+ adapterName = strdup(anInterface->ifa_name);
+ break;
+ }
+
+ ret = necessaryFlagsSetOnInterface(anInterface, "en1");
+ if (ret) {
+ adapterName = strdup(anInterface->ifa_name);
+ break;
+ }
+
+ ret = necessaryFlagsSetOnInterface(anInterface, "bridge100");
+ if (ret) {
+ adapterName = strdup(anInterface->ifa_name);
+ break;
+ }
+
+ anInterface = anInterface->ifa_next;
+ }
+ }
+ freeifaddrs(listOfInterfaces);
+
+ return adapterName;
}
#endif
--
2.21.1 (Apple Git-122.3)
Loading