Re: [PATCH] add Android makefile for libv4l2 and libv4lconvert

2015-04-03 Thread Hans Verkuil
Hi Benjamin,

On 03/27/2015 09:29 AM, Benjamin Gaignard wrote:
 Hello,
 
 On behalf of Paramanand, I would have to have your opinion on this patch.
 The goal is to enable more v4l2 lib features on Android to be able to
 do video decoding using v4l2 devices.

Can you repost the patch? It is mangled, tabs seems to be replaced by spaces
or just lost and some lines wrapped around.

Thanks!

Hans
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] add Android makefile for libv4l2 and libv4lconvert

2015-03-27 Thread Benjamin Gaignard
Hello,

On behalf of Paramanand, I would have to have your opinion on this patch.
The goal is to enable more v4l2 lib features on Android to be able to
do video decoding using v4l2 devices.

Regards,
Benjamin

commit 85f40dcc5248b5fb03464fe25fd2d1acb30f9722
Author: Paramanand SINGH paramanand.si...@linaro.org
Date:   Wed Mar 11 15:41:28 2015 +0530

libv4l2: Changes for compilation in Android 5.0

Added Android makefiles for libv4l2 and
libv4lconvert. Minor changes to include
android-config.h. Changed the plugin
loading mechanism to avoid using
unsupported glob.h header. Current mechanism
supports a list of plugin search paths
including /system/lib and /vendor/lib.

Signed-off-by: Paramanand Singh paramanand.si...@linaro.org

diff --git a/android-config.h b/android-config.h
index f474330..9f12b8f 100644
--- a/android-config.h
+++ b/android-config.h
@@ -1,3 +1,5 @@
+#ifndef __V4L_ANDROID_CONFIG_H__
+#define __V4L_ANDROID_CONFIG_H__
 /* config.h.  Generated from config.h.in by configure.  */
 /* config.h.in.  Generated from configure.ac by autoheader.  */

@@ -358,3 +360,4 @@ getsubopt (char **optionp, char *const *tokens,
char **valuep)

   return -1;
 }
+#endif
diff --git a/lib/Android.mk b/lib/Android.mk
new file mode 100644
index 000..2e43120
--- /dev/null
+++ b/lib/Android.mk
@@ -0,0 +1,4 @@
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/lib/libv4l2/Android.mk b/lib/libv4l2/Android.mk
new file mode 100644
index 000..7d723fb
--- /dev/null
+++ b/lib/libv4l2/Android.mk
@@ -0,0 +1,31 @@
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := \
+log.c \
+libv4l2.c \
+v4l2convert.c \
+v4l2-plugin-android.c
+
+LOCAL_CFLAGS += -Wno-missing-field-initializers
+LOCAL_CFLAGS += -Wno-sign-compare
+
+LOCAL_C_INCLUDES := \
+$(LOCAL_PATH)/../include \
+$(LOCAL_PATH)/../../include \
+$(LOCAL_PATH)/../.. \
+ $(TOP)/bionic/libc/upstream-openbsd/lib/libc/gen
+
+LOCAL_SHARED_LIBRARIES := \
+libutils \
+libcutils \
+libdl \
+libssl \
+libz
+
+LOCAL_STATIC_LIBRARIES := libv4l_convert
+LOCAL_MODULE := libv4l2
+LOCAL_MODULE_TAGS := optional
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/lib/libv4l2/libv4l2.c b/lib/libv4l2/libv4l2.c
index 966a000..70a6fd2 100644
--- a/lib/libv4l2/libv4l2.c
+++ b/lib/libv4l2/libv4l2.c
@@ -55,7 +55,11 @@
When modifications are made, one should be careful that this behavior is
preserved.
  */
+#ifdef ANDROID
+#include android-config.h
+#else
 #include config.h
+#endif
 #include errno.h
 #include stdarg.h
 #include stdio.h
diff --git a/lib/libv4l2/log.c b/lib/libv4l2/log.c
index d1042ed..9d3eab1 100644
--- a/lib/libv4l2/log.c
+++ b/lib/libv4l2/log.c
@@ -18,7 +18,11 @@
 # Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335  USA
  */

+#ifdef ANDROID
+#include android-config.h
+#else
 #include config.h
+#endif
 #include stdio.h
 #include stdlib.h
 #include string.h
diff --git a/lib/libv4l2/v4l2-plugin-android.c
b/lib/libv4l2/v4l2-plugin-android.c
new file mode 100644
index 000..af7f4ae
--- /dev/null
+++ b/lib/libv4l2/v4l2-plugin-android.c
@@ -0,0 +1,153 @@
+/*
+* Copyright (C) 2010 Nokia Corporation multime...@maemo.org
+
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation; either version 2.1 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+#ifdef ANDROID
+#include android-config.h
+#else
+#include config.h
+#endif
+#include stdarg.h
+#include dlfcn.h
+#include fcntl.h
+#include glob.h
+#include sys/stat.h
+#include sys/mman.h
+#include sys/types.h
+#include dirent.h
+#include stdlib.h
+#include string.h
+#include libv4l2.h
+#include libv4l2-priv.h
+#include libv4l-plugin.h
+
+/* libv4l plugin support:
+   it is provided by functions v4l2_plugin_[open,close,etc].
+
+   When open() is called libv4l dlopens files in /usr/lib[64]/libv4l/plugins
+   1 at a time and call open callback passing through the applications
+   parameters unmodified.
+
+   If a plugin is relevant for the specified device node, it can indicate so
+   by returning a value other then -1 (the actual file descriptor).
+   As soon as a plugin returns another value then -1 plugin loading stops and
+   information about it (fd and corresponding library handle) is stored. For
+   each function 

Re: [PATCH] add Android makefile for libv4l2 and libv4lconvert

2015-03-27 Thread Benjamin Gaignard
Yes we would like to have it merge upstream :-)

2015-03-27 14:37 GMT+01:00 Hans de Goede hdego...@redhat.com:
 Hi,

 On 27-03-15 09:29, Benjamin Gaignard wrote:

 Hello,

 On behalf of Paramanand, I would have to have your opinion on this patch.
 The goal is to enable more v4l2 lib features on Android to be able to
 do video decoding using v4l2 devices.


 This looks fine to me, you say that
 I would have to have your opinion on this patch.

 So I've not merged it yet, let me know if you want to have this patch merged
 upstream.

 Regards,

 Hans





 Regards,
 Benjamin

 commit 85f40dcc5248b5fb03464fe25fd2d1acb30f9722
 Author: Paramanand SINGH paramanand.si...@linaro.org
 Date:   Wed Mar 11 15:41:28 2015 +0530

  libv4l2: Changes for compilation in Android 5.0

  Added Android makefiles for libv4l2 and
  libv4lconvert. Minor changes to include
  android-config.h. Changed the plugin
  loading mechanism to avoid using
  unsupported glob.h header. Current mechanism
  supports a list of plugin search paths
  including /system/lib and /vendor/lib.

  Signed-off-by: Paramanand Singh paramanand.si...@linaro.org

 diff --git a/android-config.h b/android-config.h
 index f474330..9f12b8f 100644
 --- a/android-config.h
 +++ b/android-config.h
 @@ -1,3 +1,5 @@
 +#ifndef __V4L_ANDROID_CONFIG_H__
 +#define __V4L_ANDROID_CONFIG_H__
   /* config.h.  Generated from config.h.in by configure.  */
   /* config.h.in.  Generated from configure.ac by autoheader.  */

 @@ -358,3 +360,4 @@ getsubopt (char **optionp, char *const *tokens,
 char **valuep)

 return -1;
   }
 +#endif
 diff --git a/lib/Android.mk b/lib/Android.mk
 new file mode 100644
 index 000..2e43120
 --- /dev/null
 +++ b/lib/Android.mk
 @@ -0,0 +1,4 @@
 +LOCAL_PATH:= $(call my-dir)
 +include $(CLEAR_VARS)
 +
 +include $(call all-makefiles-under,$(LOCAL_PATH))
 diff --git a/lib/libv4l2/Android.mk b/lib/libv4l2/Android.mk
 new file mode 100644
 index 000..7d723fb
 --- /dev/null
 +++ b/lib/libv4l2/Android.mk
 @@ -0,0 +1,31 @@
 +LOCAL_PATH:= $(call my-dir)
 +
 +include $(CLEAR_VARS)
 +
 +LOCAL_SRC_FILES := \
 +log.c \
 +libv4l2.c \
 +v4l2convert.c \
 +v4l2-plugin-android.c
 +
 +LOCAL_CFLAGS += -Wno-missing-field-initializers
 +LOCAL_CFLAGS += -Wno-sign-compare
 +
 +LOCAL_C_INCLUDES := \
 +$(LOCAL_PATH)/../include \
 +$(LOCAL_PATH)/../../include \
 +$(LOCAL_PATH)/../.. \
 + $(TOP)/bionic/libc/upstream-openbsd/lib/libc/gen
 +
 +LOCAL_SHARED_LIBRARIES := \
 +libutils \
 +libcutils \
 +libdl \
 +libssl \
 +libz
 +
 +LOCAL_STATIC_LIBRARIES := libv4l_convert
 +LOCAL_MODULE := libv4l2
 +LOCAL_MODULE_TAGS := optional
 +
 +include $(BUILD_SHARED_LIBRARY)
 diff --git a/lib/libv4l2/libv4l2.c b/lib/libv4l2/libv4l2.c
 index 966a000..70a6fd2 100644
 --- a/lib/libv4l2/libv4l2.c
 +++ b/lib/libv4l2/libv4l2.c
 @@ -55,7 +55,11 @@
  When modifications are made, one should be careful that this behavior
 is
  preserved.
*/
 +#ifdef ANDROID
 +#include android-config.h
 +#else
   #include config.h
 +#endif
   #include errno.h
   #include stdarg.h
   #include stdio.h
 diff --git a/lib/libv4l2/log.c b/lib/libv4l2/log.c
 index d1042ed..9d3eab1 100644
 --- a/lib/libv4l2/log.c
 +++ b/lib/libv4l2/log.c
 @@ -18,7 +18,11 @@
   # Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA
 02110-1335  USA
*/

 +#ifdef ANDROID
 +#include android-config.h
 +#else
   #include config.h
 +#endif
   #include stdio.h
   #include stdlib.h
   #include string.h
 diff --git a/lib/libv4l2/v4l2-plugin-android.c
 b/lib/libv4l2/v4l2-plugin-android.c
 new file mode 100644
 index 000..af7f4ae
 --- /dev/null
 +++ b/lib/libv4l2/v4l2-plugin-android.c
 @@ -0,0 +1,153 @@
 +/*
 +* Copyright (C) 2010 Nokia Corporation multime...@maemo.org
 +
 +* This program is free software; you can redistribute it and/or modify
 +* it under the terms of the GNU Lesser General Public License as
 published by
 +* the Free Software Foundation; either version 2.1 of the License, or
 +* (at your option) any later version.
 +*
 +* This program is distributed in the hope that it will be useful,
 +* but WITHOUT ANY WARRANTY; without even the implied warranty of
 +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 +* Lesser General Public License for more details.
 +*
 +* You should have received a copy of the GNU Lesser General Public
 License
 +* along with this program; if not, write to the Free Software
 +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 USA
 +*/
 +
 +#ifdef ANDROID
 +#include android-config.h
 +#else
 +#include config.h
 +#endif
 +#include stdarg.h
 +#include dlfcn.h
 +#include fcntl.h
 +#include glob.h
 +#include sys/stat.h
 +#include sys/mman.h
 +#include sys/types.h
 +#include dirent.h
 +#include stdlib.h
 +#include string.h
 +#include libv4l2.h
 +#include libv4l2-priv.h
 +#include libv4l-plugin.h
 +
 +/* libv4l plugin support:
 +   it is provided by functions 

Re: [PATCH] add Android makefile for libv4l2 and libv4lconvert

2015-03-27 Thread Hans de Goede

Hi,

On 27-03-15 09:29, Benjamin Gaignard wrote:

Hello,

On behalf of Paramanand, I would have to have your opinion on this patch.
The goal is to enable more v4l2 lib features on Android to be able to
do video decoding using v4l2 devices.


This looks fine to me, you say that
I would have to have your opinion on this patch.

So I've not merged it yet, let me know if you want to have this patch merged
upstream.

Regards,

Hans






Regards,
Benjamin

commit 85f40dcc5248b5fb03464fe25fd2d1acb30f9722
Author: Paramanand SINGH paramanand.si...@linaro.org
Date:   Wed Mar 11 15:41:28 2015 +0530

 libv4l2: Changes for compilation in Android 5.0

 Added Android makefiles for libv4l2 and
 libv4lconvert. Minor changes to include
 android-config.h. Changed the plugin
 loading mechanism to avoid using
 unsupported glob.h header. Current mechanism
 supports a list of plugin search paths
 including /system/lib and /vendor/lib.

 Signed-off-by: Paramanand Singh paramanand.si...@linaro.org

diff --git a/android-config.h b/android-config.h
index f474330..9f12b8f 100644
--- a/android-config.h
+++ b/android-config.h
@@ -1,3 +1,5 @@
+#ifndef __V4L_ANDROID_CONFIG_H__
+#define __V4L_ANDROID_CONFIG_H__
  /* config.h.  Generated from config.h.in by configure.  */
  /* config.h.in.  Generated from configure.ac by autoheader.  */

@@ -358,3 +360,4 @@ getsubopt (char **optionp, char *const *tokens,
char **valuep)

return -1;
  }
+#endif
diff --git a/lib/Android.mk b/lib/Android.mk
new file mode 100644
index 000..2e43120
--- /dev/null
+++ b/lib/Android.mk
@@ -0,0 +1,4 @@
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/lib/libv4l2/Android.mk b/lib/libv4l2/Android.mk
new file mode 100644
index 000..7d723fb
--- /dev/null
+++ b/lib/libv4l2/Android.mk
@@ -0,0 +1,31 @@
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := \
+log.c \
+libv4l2.c \
+v4l2convert.c \
+v4l2-plugin-android.c
+
+LOCAL_CFLAGS += -Wno-missing-field-initializers
+LOCAL_CFLAGS += -Wno-sign-compare
+
+LOCAL_C_INCLUDES := \
+$(LOCAL_PATH)/../include \
+$(LOCAL_PATH)/../../include \
+$(LOCAL_PATH)/../.. \
+ $(TOP)/bionic/libc/upstream-openbsd/lib/libc/gen
+
+LOCAL_SHARED_LIBRARIES := \
+libutils \
+libcutils \
+libdl \
+libssl \
+libz
+
+LOCAL_STATIC_LIBRARIES := libv4l_convert
+LOCAL_MODULE := libv4l2
+LOCAL_MODULE_TAGS := optional
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/lib/libv4l2/libv4l2.c b/lib/libv4l2/libv4l2.c
index 966a000..70a6fd2 100644
--- a/lib/libv4l2/libv4l2.c
+++ b/lib/libv4l2/libv4l2.c
@@ -55,7 +55,11 @@
 When modifications are made, one should be careful that this behavior is
 preserved.
   */
+#ifdef ANDROID
+#include android-config.h
+#else
  #include config.h
+#endif
  #include errno.h
  #include stdarg.h
  #include stdio.h
diff --git a/lib/libv4l2/log.c b/lib/libv4l2/log.c
index d1042ed..9d3eab1 100644
--- a/lib/libv4l2/log.c
+++ b/lib/libv4l2/log.c
@@ -18,7 +18,11 @@
  # Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335  USA
   */

+#ifdef ANDROID
+#include android-config.h
+#else
  #include config.h
+#endif
  #include stdio.h
  #include stdlib.h
  #include string.h
diff --git a/lib/libv4l2/v4l2-plugin-android.c
b/lib/libv4l2/v4l2-plugin-android.c
new file mode 100644
index 000..af7f4ae
--- /dev/null
+++ b/lib/libv4l2/v4l2-plugin-android.c
@@ -0,0 +1,153 @@
+/*
+* Copyright (C) 2010 Nokia Corporation multime...@maemo.org
+
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation; either version 2.1 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+#ifdef ANDROID
+#include android-config.h
+#else
+#include config.h
+#endif
+#include stdarg.h
+#include dlfcn.h
+#include fcntl.h
+#include glob.h
+#include sys/stat.h
+#include sys/mman.h
+#include sys/types.h
+#include dirent.h
+#include stdlib.h
+#include string.h
+#include libv4l2.h
+#include libv4l2-priv.h
+#include libv4l-plugin.h
+
+/* libv4l plugin support:
+   it is provided by functions v4l2_plugin_[open,close,etc].
+
+   When open() is called libv4l dlopens files in /usr/lib[64]/libv4l/plugins
+   1 at a time and call open callback passing through the applications
+   parameters unmodified.
+
+   If a plugin is relevant for the specified device node, it can