Re: [patch, libv4l]: add sdlcam example for testing digital still camera functionality
Hi! > > Utilities like v4l2-ctl are tied closely to the kernel and are updated > > whenever > > new APIs appear. But yet another viewer? > > > > Mauro, I find that v4l-utils is a bit polluted with non-core utilities. > > IMHO it should only contain the core libv4l2, core utilities and > > driver-specific > > utilities. I wonder if we should make a media-utils-contrib for all the > > non-core > > stuff. > > > > What is your opinion? > > One of the purposes the v4l-utils repository has is that the distributions > get these programs included to their v4l-utils package as it's typically > called. It's debatable whether or how much it should contain device specific > or otherwise random projects, but having a common location for such programs > has clear benefits, too. > > Based on how this one looks it is definitely not an end user application (I > hope I'm not miscategorising it) and as Pavel mentioned, it has been useful > in testing automatic focus / gain control on N900. Well, testing camera drivers without userspace support is not really possible. Yes, you can use mplayer to display the data in "preview" mode, and yavta to adjust focus/exposure... But that's really hard/slow and preview quality does not tell you much about quality of final photo. So... yes, I'd like to see this in. Best regards, Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html signature.asc Description: Digital signature
Re: [patch, libv4l]: add sdlcam example for testing digital still camera functionality
Hi! > > Utilities like v4l2-ctl are tied closely to the kernel and are updated > > whenever > > new APIs appear. But yet another viewer? > > > > Mauro, I find that v4l-utils is a bit polluted with non-core utilities. > > IMHO it should only contain the core libv4l2, core utilities and > > driver-specific > > utilities. I wonder if we should make a media-utils-contrib for all the > > non-core > > stuff. > > > > What is your opinion? > > One of the purposes the v4l-utils repository has is that the distributions > get these programs included to their v4l-utils package as it's typically > called. It's debatable whether or how much it should contain device specific > or otherwise random projects, but having a common location for such programs > has clear benefits, too. > > Based on how this one looks it is definitely not an end user application (I > hope I'm not miscategorising it) and as Pavel mentioned, it has been useful > in testing automatic focus / gain control on N900. Well, I intend to take some photos with it. But yes, it is more useful for testing -- it is hard to test digital camera without taking photos -- and eventually I'd like to turn most of it into a library which "real" camera application would link to. But that's future. For now I'd like to have something I can test the kernel drivers with, and perhaps take some photos in the process. Best regards, Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html signature.asc Description: Digital signature
Re: [patch, libv4l]: add sdlcam example for testing digital still camera functionality
Hi Hans, Pavel, Mauro, others, On Mon, May 29, 2017 at 10:02:26AM +0200, Hans Verkuil wrote: > On 05/29/2017 09:32 AM, Pavel Machek wrote: > >On Mon 2017-05-29 08:13:22, Hans Verkuil wrote: > >>Hi Pavel, > >> > >>On 05/21/2017 12:33 PM, Pavel Machek wrote: > >>>Add simple SDL-based application for capturing photos. Manual > >>>focus/gain/exposure can be set, flash can be controlled and > >>>autofocus/autogain can be selected if camera supports that. > >>> > >>>It is already useful for testing autofocus/autogain improvements to > >>>the libraries on Nokia N900. > >>> > >>>Signed-off-by: Pavel Machek > >> > >>I think this is more suitable as a github project. To be honest, I feel that > >>v4l-utils already contains too many random utilities, so I prefer not to add > >>to that. > > > >>On the other hand, there is nothing against sharing this as on github as it > >>certainly can be useful. > > > >Can I get you to reconsider that? > > > >Originally, I planed to keep the utility separate, but then I got > >comments from Mauro ( https://lkml.org/lkml/2017/4/24/457 ) explaining > >that hard sdl dependency is not acceptable etc, and how I should do > >automake. > > > >So I had a lot of fun with automake integration, and generally doing > >things right. > > > >So getting "we all ready have too many utilities" _now_ is quite an > >unwelcome surprise. > > Too many *random* utilities. > > Utilities like v4l2-ctl are tied closely to the kernel and are updated > whenever > new APIs appear. But yet another viewer? > > Mauro, I find that v4l-utils is a bit polluted with non-core utilities. > IMHO it should only contain the core libv4l2, core utilities and > driver-specific > utilities. I wonder if we should make a media-utils-contrib for all the > non-core > stuff. > > What is your opinion? One of the purposes the v4l-utils repository has is that the distributions get these programs included to their v4l-utils package as it's typically called. It's debatable whether or how much it should contain device specific or otherwise random projects, but having a common location for such programs has clear benefits, too. Based on how this one looks it is definitely not an end user application (I hope I'm not miscategorising it) and as Pavel mentioned, it has been useful in testing automatic focus / gain control on N900. Just my 5 euro cents... -- Regards, Sakari Ailus e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk
Re: [patch, libv4l]: add sdlcam example for testing digital still camera functionality
On 05/29/2017 09:32 AM, Pavel Machek wrote: On Mon 2017-05-29 08:13:22, Hans Verkuil wrote: Hi Pavel, On 05/21/2017 12:33 PM, Pavel Machek wrote: Add simple SDL-based application for capturing photos. Manual focus/gain/exposure can be set, flash can be controlled and autofocus/autogain can be selected if camera supports that. It is already useful for testing autofocus/autogain improvements to the libraries on Nokia N900. Signed-off-by: Pavel Machek I think this is more suitable as a github project. To be honest, I feel that v4l-utils already contains too many random utilities, so I prefer not to add to that. On the other hand, there is nothing against sharing this as on github as it certainly can be useful. Can I get you to reconsider that? Originally, I planed to keep the utility separate, but then I got comments from Mauro ( https://lkml.org/lkml/2017/4/24/457 ) explaining that hard sdl dependency is not acceptable etc, and how I should do automake. So I had a lot of fun with automake integration, and generally doing things right. So getting "we all ready have too many utilities" _now_ is quite an unwelcome surprise. Too many *random* utilities. Utilities like v4l2-ctl are tied closely to the kernel and are updated whenever new APIs appear. But yet another viewer? Mauro, I find that v4l-utils is a bit polluted with non-core utilities. IMHO it should only contain the core libv4l2, core utilities and driver-specific utilities. I wonder if we should make a media-utils-contrib for all the non-core stuff. What is your opinion? Regards, Hans Regards, Pavel
Re: [patch, libv4l]: add sdlcam example for testing digital still camera functionality
On Mon 2017-05-29 08:13:22, Hans Verkuil wrote: > Hi Pavel, > > On 05/21/2017 12:33 PM, Pavel Machek wrote: > >Add simple SDL-based application for capturing photos. Manual > >focus/gain/exposure can be set, flash can be controlled and > >autofocus/autogain can be selected if camera supports that. > > > >It is already useful for testing autofocus/autogain improvements to > >the libraries on Nokia N900. > > > >Signed-off-by: Pavel Machek > > I think this is more suitable as a github project. To be honest, I feel that > v4l-utils already contains too many random utilities, so I prefer not to add > to that. > On the other hand, there is nothing against sharing this as on github as it > certainly can be useful. Can I get you to reconsider that? Originally, I planed to keep the utility separate, but then I got comments from Mauro ( https://lkml.org/lkml/2017/4/24/457 ) explaining that hard sdl dependency is not acceptable etc, and how I should do automake. So I had a lot of fun with automake integration, and generally doing things right. So getting "we all ready have too many utilities" _now_ is quite an unwelcome surprise. Regards, Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html signature.asc Description: Digital signature
Re: [patch, libv4l]: add sdlcam example for testing digital still camera functionality
Hi Pavel, On 05/21/2017 12:33 PM, Pavel Machek wrote: Add simple SDL-based application for capturing photos. Manual focus/gain/exposure can be set, flash can be controlled and autofocus/autogain can be selected if camera supports that. It is already useful for testing autofocus/autogain improvements to the libraries on Nokia N900. Signed-off-by: Pavel Machek I think this is more suitable as a github project. To be honest, I feel that v4l-utils already contains too many random utilities, so I prefer not to add to that. On the other hand, there is nothing against sharing this as on github as it certainly can be useful. Regards, Hans
Re: [patch, libv4l]: add sdlcam example for testing digital still camera functionality
On 05/26/2017 10:41 PM, Pavel Machek wrote: > Hi! > >> Add simple SDL-based application for capturing photos. Manual >> focus/gain/exposure can be set, flash can be controlled and >> autofocus/autogain can be selected if camera supports that. >> >> It is already useful for testing autofocus/autogain improvements to >> the libraries on Nokia N900. >> >> Signed-off-by: Pavel Machek > > Could I get some feedback here, or get you to apply the patch? I plan to look at it next week (Monday or Friday). Regards, Hans
Re: [patch, libv4l]: add sdlcam example for testing digital still camera functionality
Hi! > Add simple SDL-based application for capturing photos. Manual > focus/gain/exposure can be set, flash can be controlled and > autofocus/autogain can be selected if camera supports that. > > It is already useful for testing autofocus/autogain improvements to > the libraries on Nokia N900. > > Signed-off-by: Pavel Machek Could I get some feedback here, or get you to apply the patch? Thanks, Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html signature.asc Description: Digital signature
[patch, libv4l]: add sdlcam example for testing digital still camera functionality
Add simple SDL-based application for capturing photos. Manual focus/gain/exposure can be set, flash can be controlled and autofocus/autogain can be selected if camera supports that. It is already useful for testing autofocus/autogain improvements to the libraries on Nokia N900. Signed-off-by: Pavel Machek diff --git a/configure.ac b/configure.ac index f30d66d..2c8ad7e 100644 --- a/configure.ac +++ b/configure.ac @@ -88,6 +88,247 @@ LIBDVBV5_DOMAIN="libdvbv5" AC_DEFINE([LIBDVBV5_DOMAIN], "libdvbv5", [libdvbv5 domain]) AC_SUBST(LIBDVBV5_DOMAIN) +# Configure paths for SDL +# Sam Lantinga 9/21/99 +# stolen from Manish Singh +# stolen back from Frank Belew +# stolen from Manish Singh +# Shamelessly stolen from Owen Taylor +# +# Changelog: +# * also look for SDL2.framework under Mac OS X + +# serial 1 + +dnl AM_PATH_SDL2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS +dnl +AC_DEFUN([AM_PATH_SDL2], +[dnl +dnl Get the cflags and libraries from the sdl2-config script +dnl +AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)], +sdl_prefix="$withval", sdl_prefix="") +AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)], +sdl_exec_prefix="$withval", sdl_exec_prefix="") +AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program], + , enable_sdltest=yes) +AC_ARG_ENABLE(sdlframework, [ --disable-sdlframework Do not search for SDL2.framework], +, search_sdl_framework=yes) + +AC_ARG_VAR(SDL2_FRAMEWORK, [Path to SDL2.framework]) + + min_sdl_version=ifelse([$1], ,2.0.0,$1) + + if test "x$sdl_prefix$sdl_exec_prefix" = x ; then +PKG_CHECK_MODULES([SDL], [sdl2 >= $min_sdl_version], + [sdl_pc=yes], + [sdl_pc=no]) + else +sdl_pc=no +if test x$sdl_exec_prefix != x ; then + sdl_config_args="$sdl_config_args --exec-prefix=$sdl_exec_prefix" + if test x${SDL2_CONFIG+set} != xset ; then +SDL2_CONFIG=$sdl_exec_prefix/bin/sdl2-config + fi +fi +if test x$sdl_prefix != x ; then + sdl_config_args="$sdl_config_args --prefix=$sdl_prefix" + if test x${SDL2_CONFIG+set} != xset ; then +SDL2_CONFIG=$sdl_prefix/bin/sdl2-config + fi +fi + fi + + if test "x$sdl_pc" = xyes ; then +no_sdl="" +SDL2_CONFIG="pkg-config sdl2" + else +as_save_PATH="$PATH" +if test "x$prefix" != xNONE && test "$cross_compiling" != yes; then + PATH="$prefix/bin:$prefix/usr/bin:$PATH" +fi +AC_PATH_PROG(SDL2_CONFIG, sdl2-config, no, [$PATH]) +PATH="$as_save_PATH" +no_sdl="" + +if test "$SDL2_CONFIG" = "no" -a "x$search_sdl_framework" = "xyes"; then + AC_MSG_CHECKING(for SDL2.framework) + if test "x$SDL2_FRAMEWORK" != x; then +sdl_framework=$SDL2_FRAMEWORK + else +for d in / ~/ /System/; do + if test -d "$dLibrary/Frameworks/SDL2.framework"; then +sdl_framework="$dLibrary/Frameworks/SDL2.framework" + fi +done + fi + + if test -d $sdl_framework; then +AC_MSG_RESULT($sdl_framework) +sdl_framework_dir=`dirname $sdl_framework` +SDL_CFLAGS="-F$sdl_framework_dir -Wl,-framework,SDL2 -I$sdl_framework/include" +SDL_LIBS="-F$sdl_framework_dir -Wl,-framework,SDL2" + else +no_sdl=yes + fi +fi + +if test "$SDL2_CONFIG" != "no"; then + if test "x$sdl_pc" = "xno"; then +AC_MSG_CHECKING(for SDL - version >= $min_sdl_version) +SDL_CFLAGS=`$SDL2_CONFIG $sdl_config_args --cflags` +SDL_LIBS=`$SDL2_CONFIG $sdl_config_args --libs` + fi + + sdl_major_version=`$SDL2_CONFIG $sdl_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + sdl_minor_version=`$SDL2_CONFIG $sdl_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + sdl_micro_version=`$SDL2_CONFIG $sdl_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test "x$enable_sdltest" = "xyes" ; then +ac_save_CFLAGS="$CFLAGS" +ac_save_CXXFLAGS="$CXXFLAGS" +ac_save_LIBS="$LIBS" +CFLAGS="$CFLAGS $SDL_CFLAGS" +CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" +LIBS="$LIBS $SDL_LIBS" +dnl +dnl Now check if the installed SDL is sufficiently new. (Also sanity +dnl checks the results of sdl2-config to some extent +dnl + rm -f conf.sdltest + AC_TRY_RUN([ +#include +#include +#include +#include "SDL.h" + +char* +my_strdup (char *str) +{ + char *new_str; + + if (str) +{ + new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char)); + strcpy (new_str, str); +} + else +new_str = NULL; + + return new_str; +} + +int main (int argc, char *argv[]) +{ + int major, minor, micro; + char *tmp_v