Re: gst-plugins-good: v4l2: Add run-time environment to enable libv4l2

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: gst-plugins-good: v4l2: Add run-time environment to enable libv4l2

Kirill Novichikhin
+ v4l2object->mmap = mmap;
This change breaks build on arm/32 (probably other 32bit targets)
Since last arg of mmap is __off_t and last arg of v4l2_mmap is  uint64_t, a wrapper is probably needed.

I worked around it with the following patch:

diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c
index c6886b1..9364c83 100644
--- a/sys/v4l2/gstv4l2object.c
+++ b/sys/v4l2/gstv4l2object.c
@@ -454,6 +454,10 @@ gst_v4l2_object_install_m2m_properties_helper (GObjectClass * gobject_class)
           GST_TYPE_STRUCTURE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 }
 
+static void* mmap_stub(void *addr, gsize length, gint prot, gint flags, gint fd, gint64 offset) {
+  return mmap(addr, (size_t)length, prot, flags, fd, (__off_t)offset);
+}
+
 GstV4l2Object *
 gst_v4l2_object_new (GstElement * element,
     enum v4l2_buf_type type,
@@ -509,9 +513,9 @@ gst_v4l2_object_new (GstElement * element,
     v4l2object->dup = dup;
     v4l2object->ioctl = ioctl;
     v4l2object->read = read;
-    v4l2object->mmap = mmap;
+    v4l2object->mmap = mmap_stub;
     v4l2object->munmap = munmap;
   }
 
   return v4l2object;
 }

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: gst-plugins-good: v4l2: Add run-time environment to enable libv4l2

Nicolas Dufresne-5


Le 28 juil. 2017 4:26 AM, "Kirill Novichikhin" <[hidden email]> a écrit :
+ v4l2object->mmap = mmap;
This change breaks build on arm/32 (probably other 32bit targets)
Since last arg of mmap is __off_t and last arg of v4l2_mmap is  uint64_t, a wrapper is probably needed.

That's interesting, I blindly copied the definition from libv4l2 headers, I didn't expect that. Please file bug and attach your patch at bugs.gnome.org I'll have a loop on Monday.

I worked around it with the following patch:

diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c
index c6886b1..9364c83 100644
--- a/sys/v4l2/gstv4l2object.c
+++ b/sys/v4l2/gstv4l2object.c
@@ -454,6 +454,10 @@ gst_v4l2_object_install_m2m_properties_helper (GObjectClass * gobject_class)
           GST_TYPE_STRUCTURE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 }

+static void* mmap_stub(void *addr, gsize length, gint prot, gint flags, gint fd, gint64 offset) {
+  return mmap(addr, (size_t)length, prot, flags, fd, (__off_t)offset);
+}
+
 GstV4l2Object *
 gst_v4l2_object_new (GstElement * element,
     enum v4l2_buf_type type,
@@ -509,9 +513,9 @@ gst_v4l2_object_new (GstElement * element,
     v4l2object->dup = dup;
     v4l2object->ioctl = ioctl;
     v4l2object->read = read;
-    v4l2object->mmap = mmap;
+    v4l2object->mmap = mmap_stub;
     v4l2object->munmap = munmap;
   }

   return v4l2object;
 }

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Loading...