[vlc-devel] [PATCH 02/13] contrib: live555: fix undeclared off64_t functions

Victorien Le Couviour--Tuffet victorien.lecouviour.tuffet at gmail.com
Tue Oct 2 11:14:25 CEST 2018


Fixes android NDK 17 build:
ftello and fseeko are available from API level 24.
---
 contrib/src/live555/file-offset-bits-64.patch | 22 +++++++++++++++++++
 contrib/src/live555/rules.mak                 |  2 ++
 2 files changed, 24 insertions(+)
 create mode 100644 contrib/src/live555/file-offset-bits-64.patch

diff --git a/contrib/src/live555/file-offset-bits-64.patch b/contrib/src/live555/file-offset-bits-64.patch
new file mode 100644
index 0000000000..7231c8892d
--- /dev/null
+++ b/contrib/src/live555/file-offset-bits-64.patch
@@ -0,0 +1,22 @@
+diff --git a/liveMedia/InputFile.cpp b/liveMedia/InputFile.cpp
+index 57bd262..fe1a73b 100644
+--- a/liveMedia/InputFile.cpp
++++ b/liveMedia/InputFile.cpp
+@@ -78,7 +78,7 @@ int64_t SeekFile64(FILE *fid, int64_t offset, int whence) {
+ #if (defined(__WIN32__) || defined(_WIN32)) && !defined(_WIN32_WCE)
+   return _lseeki64(_fileno(fid), offset, whence) == (int64_t)-1 ? -1 : 0;
+ #else
+-#if defined(_WIN32_WCE)
++#if defined(_WIN32_WCE) || (defined(__ANDROID__) && __ANDROID_API__ < 24)
+   return fseek(fid, (long)(offset), whence);
+ #else
+   return fseeko(fid, (off_t)(offset), whence);
+@@ -94,7 +94,7 @@ int64_t TellFile64(FILE *fid) {
+ #if (defined(__WIN32__) || defined(_WIN32)) && !defined(_WIN32_WCE)
+   return _telli64(_fileno(fid));
+ #else
+-#if defined(_WIN32_WCE)
++#if defined(_WIN32_WCE) || (defined(__ANDROID__) && __ANDROID_API__ < 24)
+   return ftell(fid);
+ #else
+   return ftello(fid);
diff --git a/contrib/src/live555/rules.mak b/contrib/src/live555/rules.mak
index 6796535e64..9f6a997517 100644
--- a/contrib/src/live555/rules.mak
+++ b/contrib/src/live555/rules.mak
@@ -82,6 +82,8 @@ endif
 ifdef HAVE_ANDROID
 	# Fix in_addr.s_addr field access
 	$(APPLY) $(SRC)/live555/in_addr-s_addr-field.patch
+	# Don't use unavailable off64_t functions
+	$(APPLY) $(SRC)/live555/file-offset-bits-64.patch
 endif
 
 	mv live.$(LIVE555_VERSION) $@ && touch $@
-- 
2.19.0



More information about the vlc-devel mailing list