summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.com>2018-03-07 14:16:02 -0500
committerNicolas Dufresne <nicolas.dufresne@collabora.com>2018-03-07 14:16:24 -0500
commit7d4702e2fb052adf716bdf02fd086cfc13aae9c9 (patch)
tree87c691fa95f11a2a3c2b023f1bec7e54403bc0ff
parent0da4d409b9fa37e7669ef6ecf5b579497e3e3e04 (diff)
v4l2: Fix support for 32bit mmap
https://bugzilla.gnome.org/show_bug.cgi?id=793103
-rw-r--r--sys/v4l2/gstv4l2object.c20
-rw-r--r--sys/v4l2/gstv4l2object.h2
2 files changed, 17 insertions, 5 deletions
diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c
index a5e67076f..1f14cd607 100644
--- a/sys/v4l2/gstv4l2object.c
+++ b/sys/v4l2/gstv4l2object.c
@@ -55,10 +55,6 @@ GST_DEBUG_CATEGORY_EXTERN (v4l2_debug);
#define ENCODED_BUFFER_SIZE (2 * 1024 * 1024)
-#if SIZEOF_OFF_T == 8 && !defined(mmap64)
-#define mmap64 mmap
-#endif
-
enum
{
PROP_0,
@@ -460,6 +456,22 @@ gst_v4l2_object_install_m2m_properties_helper (GObjectClass * gobject_class)
GST_TYPE_STRUCTURE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
}
+/* Support for 32bit off_t, this wrapper is casting off_t to gint64 */
+#ifdef HAVE_LIBV4L2
+#if SIZEOF_OFF_T < 8
+
+static gpointer
+v4l2_mmap_wrapper (gpointer start, gsize length, gint prot, gint flags, gint fd,
+ off_t offset)
+{
+ return v4l2_mmap (start, length, prot, flags, fd, (gint64) offset);
+}
+
+#define v4l2_mmap v4l2_mmap_wrapper
+
+#endif /* SIZEOF_OFF_T < 8 */
+#endif /* HAVE_LIBV4L2 */
+
GstV4l2Object *
gst_v4l2_object_new (GstElement * element,
GstObject * debug_object,
diff --git a/sys/v4l2/gstv4l2object.h b/sys/v4l2/gstv4l2object.h
index 73ba62416..fc3c4c7ed 100644
--- a/sys/v4l2/gstv4l2object.h
+++ b/sys/v4l2/gstv4l2object.h
@@ -194,7 +194,7 @@ struct _GstV4l2Object {
gint (*ioctl) (gint fd, gulong request, ...);
gssize (*read) (gint fd, gpointer buffer, gsize n);
gpointer (*mmap) (gpointer start, gsize length, gint prot, gint flags,
- gint fd, gint64 offset);
+ gint fd, off_t offset);
gint (*munmap) (gpointer _start, gsize length);
/* Quirks */