diff options
author | Matthew Waters <matthew@centricular.com> | 2018-02-13 22:20:18 +1100 |
---|---|---|
committer | Matthew Waters <matthew@centricular.com> | 2018-03-02 18:25:21 +1100 |
commit | 5a5a548b0918390d0c8cf9dfc3d61e19eb829073 (patch) | |
tree | 0078ce268dad22c1dc4c1b474a328bb428bd5f92 | |
parent | cbe24ecc8953c8fca48d3be22b173d8f6aa6ec2d (diff) |
plugins: Don't force 64-bit file/seek functions variants on android
Most functions are automatically chosen from the _FILE_OFFSET_BITS
define, the remaining one (fstat) is only available on API >= 21 so
check for that
-rw-r--r-- | plugins/elements/gstfdsink.c | 8 | ||||
-rw-r--r-- | plugins/elements/gstfdsrc.c | 4 | ||||
-rw-r--r-- | plugins/elements/gstfilesink.c | 13 | ||||
-rw-r--r-- | plugins/elements/gstfilesrc.c | 6 | ||||
-rw-r--r-- | plugins/elements/gstqueue2.c | 4 | ||||
-rw-r--r-- | plugins/elements/gstsparsefile.c | 7 |
6 files changed, 10 insertions, 32 deletions
diff --git a/plugins/elements/gstfdsink.c b/plugins/elements/gstfdsink.c index ef2480087..54a169b17 100644 --- a/plugins/elements/gstfdsink.c +++ b/plugins/elements/gstfdsink.c @@ -69,13 +69,11 @@ #define off_t guint64 #endif -#ifdef __BIONIC__ /* Android */ -#undef lseek -#define lseek lseek64 +#if defined(__BIONIC__) /* Android */ +#if defined(__ANDROID_API__) && __ANDROID_API__ >= 21 #undef fstat #define fstat fstat64 -#undef off_t -#define off_t guint64 +#endif #endif static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", diff --git a/plugins/elements/gstfdsrc.c b/plugins/elements/gstfdsrc.c index 963bcbd43..6d61efeb6 100644 --- a/plugins/elements/gstfdsrc.c +++ b/plugins/elements/gstfdsrc.c @@ -81,11 +81,11 @@ #include "gstfdsrc.h" #ifdef __BIONIC__ /* Android */ -#undef lseek -#define lseek lseek64 +#if defined(__ANDROID_API__) && __ANDROID_API__ >= 21 #undef fstat #define fstat fstat64 #endif +#endif static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, diff --git a/plugins/elements/gstfilesink.c b/plugins/elements/gstfilesink.c index 4ce527e30..58ae8d166 100644 --- a/plugins/elements/gstfilesink.c +++ b/plugins/elements/gstfilesink.c @@ -70,13 +70,6 @@ #include <unistd.h> #endif -#ifdef __BIONIC__ /* Android */ -#undef lseek -#define lseek lseek64 -#undef off_t -#define off_t guint64 -#endif - #include "gstelements_private.h" #include "gstfilesink.h" @@ -401,12 +394,12 @@ gst_file_sink_open_file (GstFileSink * sink) sink->buffer = g_malloc (sink->buffer_size); buffer_size = sink->buffer_size; } - /* Cygwin does not have __fbufsize */ -#if defined(HAVE_STDIO_EXT_H) && !defined(__CYGWIN__) + /* Cygwin does not have __fbufsize, android adds it in API 23 */ +#if defined(HAVE_STDIO_EXT_H) && (!defined(__CYGWIN__) && (!defined(__ANDROID_API__) || __ANDROID_API__ >= 23)) GST_DEBUG_OBJECT (sink, "change buffer size %u to %u, mode %d", (guint) __fbufsize (sink->file), buffer_size, mode); #else - GST_DEBUG_OBJECT (sink, "change buffer size to %u, mode %d", + GST_DEBUG_OBJECT (sink, "change buffer size to %u, mode %d", sink->buffer_size, mode); #endif if (setvbuf (sink->file, sink->buffer, mode, buffer_size) != 0) { diff --git a/plugins/elements/gstfilesrc.c b/plugins/elements/gstfilesrc.c index 530735196..76ab12cb4 100644 --- a/plugins/elements/gstfilesrc.c +++ b/plugins/elements/gstfilesrc.c @@ -66,12 +66,10 @@ #endif #ifdef __BIONIC__ /* Android */ -#undef lseek -#define lseek lseek64 +#if defined(__ANDROID_API__) && __ANDROID_API__ >= 21 #undef fstat #define fstat fstat64 -#undef off_t -#define off_t guint64 +#endif #endif #include <errno.h> diff --git a/plugins/elements/gstqueue2.c b/plugins/elements/gstqueue2.c index 4fdf3489b..fb5452e37 100644 --- a/plugins/elements/gstqueue2.c +++ b/plugins/elements/gstqueue2.c @@ -75,10 +75,6 @@ #endif #ifdef __BIONIC__ /* Android */ -#undef lseek -#define lseek lseek64 -#undef off_t -#define off_t guint64 #include <fcntl.h> #endif diff --git a/plugins/elements/gstsparsefile.c b/plugins/elements/gstsparsefile.c index f8a0af199..0ff6b16b6 100644 --- a/plugins/elements/gstsparsefile.c +++ b/plugins/elements/gstsparsefile.c @@ -36,13 +36,6 @@ #include <unistd.h> #endif -#ifdef __BIONIC__ /* Android */ -#undef lseek -#define lseek lseek64 -#undef off_t -#define off_t guint64 -#endif - #ifdef HAVE_FSEEKO #define FSEEK_FILE(file,offset) (fseeko (file, (off_t) offset, SEEK_SET) != 0) #elif defined (G_OS_UNIX) || defined (G_OS_WIN32) |