[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libcvd-members] libcvd configure configure.in cvd/videofilebuff...
From: |
Edward Rosten |
Subject: |
[libcvd-members] libcvd configure configure.in cvd/videofilebuff... |
Date: |
Thu, 14 Aug 2008 16:12:28 +0000 |
CVSROOT: /cvsroot/libcvd
Module name: libcvd
Changes by: Edward Rosten <edrosten> 08/08/14 16:12:28
Modified files:
. : configure configure.in
cvd : videofilebuffer.h
cvd_src : videofilebuffer.cc
Log message:
Support for new FFMPEG (tested against the latest SVN version as of the
date of this commit).
img_convert has been depracated in favour of the GPL only libswscale.
FFMPEG will only be compiled in if you use --enable-gpl. If you
distribute
programs which use libCVD with ffmpeg, then they have to be GPL'd.
libCVD has an array of colourspace conversion functions, so it may be
possible
to use them instead of libswscale. That would enable the use of FFMPEG
under
libCVD with the LGPL license.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/libcvd/configure?cvsroot=libcvd&r1=1.130&r2=1.131
http://cvs.savannah.gnu.org/viewcvs/libcvd/configure.in?cvsroot=libcvd&r1=1.131&r2=1.132
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd/videofilebuffer.h?cvsroot=libcvd&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd_src/videofilebuffer.cc?cvsroot=libcvd&r1=1.15&r2=1.16
Patches:
Index: configure
===================================================================
RCS file: /cvsroot/libcvd/libcvd/configure,v
retrieving revision 1.130
retrieving revision 1.131
diff -u -b -r1.130 -r1.131
--- configure 12 Aug 2008 15:21:53 -0000 1.130
+++ configure 14 Aug 2008 16:12:27 -0000 1.131
@@ -863,6 +863,7 @@
Optional Features:
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --enable-gpl Allow the use of GPL libraries.
--disable-ssefast9 Disable the probably OK SSE FAST-9 detector
(debgging only)
--disable-ssefast10 Disable the probably OK SSE FAST-10 detector
(debgging only)
--disable-ssefast12 Disable the probably OK SSE FAST-12 detector
(debgging only)
@@ -5265,6 +5266,12 @@
echo Checking for operating system specific features
echo -----------------------------------------------
+# Check whether --enable-gpl or --disable-gpl was given.
+if test "${enable_gpl+set}" = set; then
+ enableval="$enable_gpl"
+
+fi;
+
# Check whether --with-dvbuffer or --without-dvbuffer was given.
if test "${with_dvbuffer+set}" = set; then
@@ -9743,18 +9750,13 @@
save_CXXFLAGS="$CXXFLAGS"
a=
- if test "$with_ffmpeg" != yes
- then
- LIBS="$LIBS -L $with_ffmpeg"
- fi
- if test "`$CXX -dumpversion`" = 4.1.0
+ if test "$enable_gpl" != no && test "$enable_gpl" != ""
then
- CXXFLAGS="$CXXFLAGS -D__STDC_CONSTANT_MACROS"
- fi
-for ac_header in ffmpeg/avcodec.h ffmpeg/avformat.h
+
+for ac_header in ffmpeg/avcodec.h ffmpeg/avformat.h ffmpeg/swscale.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
if eval "test \"\${$as_ac_Header+set}\" = set"; then
@@ -9898,7 +9900,159 @@
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
+ ffmpeg_old_headers=1
+fi
+
+done
+
+
+
+
+for ac_header in libavcodec/avcodec.h libavformat/avformat.h
libswscale/swscale.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_cxx_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_cxx_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler,
rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the
preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the
compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be
compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing
prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite
headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf
documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But
Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be
Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the
preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result"
>&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler
will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take
precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------ ##
+## Report this to the CVD lists. ##
+## ------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+ ffmpeg_new_headers=1
else
a=1
fi
@@ -9906,6 +10060,18 @@
done
+
+ if test "$ffmpeg_old_headers" == 1 || test
"$ffmpeg_new_headers" == 1
+ then
+ if test "$ffmpeg_old_headers" == 1
+ then
+ cat >>confdefs.h <<\_ACEOF
+#define CVD_INTERNAL_HAVE_FFMPEG_OLD_HEADERS 1
+_ACEOF
+
+ fi
+
+
echo "$as_me:$LINENO: checking for main in -lavutil" >&5
echo $ECHO_N "checking for main in -lavutil... $ECHO_C" >&6
if test "${ac_cv_lib_avutil_main+set}" = set; then
@@ -10198,6 +10364,106 @@
fi
+echo "$as_me:$LINENO: checking for sws_getContext in -lswscale" >&5
+echo $ECHO_N "checking for sws_getContext in -lswscale... $ECHO_C" >&6
+if test "${ac_cv_lib_swscale_sws_getContext+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lswscale $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char sws_getContext ();
+int
+main ()
+{
+sws_getContext ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_cxx_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_swscale_sws_getContext=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_swscale_sws_getContext=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_swscale_sws_getContext" >&5
+echo "${ECHO_T}$ac_cv_lib_swscale_sws_getContext" >&6
+if test $ac_cv_lib_swscale_sws_getContext = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBSWSCALE 1
+_ACEOF
+
+ LIBS="-lswscale $LIBS"
+
+else
+ a=1
+fi
+
+ else
+ a=1
+ fi
+ else
+ a=1
+ { echo "$as_me:$LINENO: WARNING: FFMPEG currently requires the
use of --enable-gpl" >&5
+echo "$as_me: WARNING: FFMPEG currently requires the use of --enable-gpl" >&2;}
+ fi
+ #if test "$with_ffmpeg" != yes
+ #then
+# APPEND(LIBS, [-L $with_ffmpeg])
+# fi
+# if test "`$CXX -dumpversion`" = 4.1.0
+# then
+# APPEND(CXXFLAGS, -D__STDC_CONSTANT_MACROS)
+# fi
+
+ #Old ffmpeg?
+ #AC_CHECK_HEADERS(ffmpeg/avcodec.h ffmpeg/avformat.h, [], [a=1])
+ #AC_CHECK_LIB(avutil, main, [], [a=1])
+ #AC_CHECK_LIB(avformat, av_open_input_file, [], [a=1])
+ #AC_CHECK_LIB(avformat, av_read_frame, [ffmpeg_recent=yes], [a=1])
#only in >= 0.4.9
+ #AC_CHECK_LIB(avcodec, avcodec_open, [], [a=1])
+
+
if test x$a == x
then
Index: configure.in
===================================================================
RCS file: /cvsroot/libcvd/libcvd/configure.in,v
retrieving revision 1.131
retrieving revision 1.132
diff -u -b -r1.131 -r1.132
--- configure.in 12 Aug 2008 15:21:54 -0000 1.131
+++ configure.in 14 Aug 2008 16:12:27 -0000 1.132
@@ -398,6 +398,8 @@
echo Checking for operating system specific features
echo -----------------------------------------------
+AC_ARG_ENABLE(gpl, [ --enable-gpl Allow the use of GPL
libraries.])
+
AC_ARG_WITH(dvbuffer, [ --without-dvbuffer compile without dvbuffer
(libDC1394v1) support (Linux only)])
AC_ARG_WITH(dvbuffer3, [ --without-dvbuffer3 compile without dvbuffer3
(libDC1394v{1,2}) support (Linux only)])
AC_ARG_WITH(dc1394v2, [ --without-dc1394v2 do not use libDC1394v2 (use
v1 instead) for dvbuffer3 (Linux only)])
@@ -751,20 +753,48 @@
CHECK_FOR_OPTION(ffmpeg, [
- if test "$with_ffmpeg" != yes
+ if test "$enable_gpl" != no && test "$enable_gpl" != ""
then
- APPEND(LIBS, [-L $with_ffmpeg])
- fi
- if test "`$CXX -dumpversion`" = 4.1.0
+
+ AC_CHECK_HEADERS(ffmpeg/avcodec.h ffmpeg/avformat.h
ffmpeg/swscale.h, [ffmpeg_old_headers=1], [])
+ AC_CHECK_HEADERS(libavcodec/avcodec.h libavformat/avformat.h
libswscale/swscale.h, [ffmpeg_new_headers=1], [a=1])
+
+
+ if test "$ffmpeg_old_headers" == 1 || test
"$ffmpeg_new_headers" == 1
+ then
+ if test "$ffmpeg_old_headers" == 1
then
- APPEND(CXXFLAGS, -D__STDC_CONSTANT_MACROS)
+ AC_DEFINE(CVD_INTERNAL_HAVE_FFMPEG_OLD_HEADERS,
1)
fi
- AC_CHECK_HEADERS(ffmpeg/avcodec.h ffmpeg/avformat.h, [], [a=1])
AC_CHECK_LIB(avutil, main, [], [a=1])
AC_CHECK_LIB(avformat, av_open_input_file, [], [a=1])
AC_CHECK_LIB(avformat, av_read_frame, [ffmpeg_recent=yes], [a=1]) #only
in >= 0.4.9
AC_CHECK_LIB(avcodec, avcodec_open, [], [a=1])
+ AC_CHECK_LIB(swscale, sws_getContext, [], [a=1])
+ else
+ a=1
+ fi
+ else
+ a=1
+ AC_MSG_WARN([FFMPEG currently requires the use of --enable-gpl])
+ fi
+ #if test "$with_ffmpeg" != yes
+ #then
+# APPEND(LIBS, [-L $with_ffmpeg])
+# fi
+# if test "`$CXX -dumpversion`" = 4.1.0
+# then
+# APPEND(CXXFLAGS, -D__STDC_CONSTANT_MACROS)
+# fi
+
+ #Old ffmpeg?
+ #AC_CHECK_HEADERS(ffmpeg/avcodec.h ffmpeg/avformat.h, [], [a=1])
+ #AC_CHECK_LIB(avutil, main, [], [a=1])
+ #AC_CHECK_LIB(avformat, av_open_input_file, [], [a=1])
+ #AC_CHECK_LIB(avformat, av_read_frame, [ffmpeg_recent=yes], [a=1])
#only in >= 0.4.9
+ #AC_CHECK_LIB(avcodec, avcodec_open, [], [a=1])
+
])
AC_CHECK_PROG(docs, doxygen, docs, no)
Index: cvd/videofilebuffer.h
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd/videofilebuffer.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- cvd/videofilebuffer.h 7 Jun 2007 14:25:00 -0000 1.14
+++ cvd/videofilebuffer.h 14 Aug 2008 16:12:28 -0000 1.15
@@ -35,9 +35,18 @@
#include <cvd/byte.h>
#include <cvd/rgb.h>
+#include <cvd/config.h>
+
extern "C" {
-#include <ffmpeg/avcodec.h>
-#include <ffmpeg/avformat.h>
+#ifdef CVD_INTERNAL_HAVE_FFMPEG_OLD_HEADERS
+ #include <ffmpeg/avcodec.h>
+ #include <ffmpeg/avformat.h>
+ #include <ffmpeg/swscale.h>
+#else
+ #include <libavcodec/avcodec.h>
+ #include <libavformat/avformat.h>
+ #include <libswscale/swscale.h>
+#endif
}
struct AVFormatContext;
@@ -175,6 +184,7 @@
AVCodecContext* pCodecContext;
AVFrame* pFrame;
AVFrame* pFrameRGB;
+ SwsContext *img_convert_ctx;
CVD::Image<CVD::Rgb<byte> > next_frame_rgb;
CVD::Image<CVD::byte> next_frame;
Index: cvd_src/videofilebuffer.cc
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd_src/videofilebuffer.cc,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- cvd_src/videofilebuffer.cc 19 Nov 2007 14:03:10 -0000 1.15
+++ cvd_src/videofilebuffer.cc 14 Aug 2008 16:12:28 -0000 1.16
@@ -79,6 +79,7 @@
pFrame(0),
pFrameRGB(0),
//buffer(0),
+ img_convert_ctx(0),
frame_time(0.0),
is_rgb(rgbp)
{
@@ -265,11 +266,23 @@
// Did we get a video frame?
if(got_picture)
{
+
+ if(img_convert_ctx == NULL)
+ {
+ img_convert_ctx =
sws_getContext(pCodecContext->width, pCodecContext->height,
pCodecContext->pix_fmt, //Src format
+
pCodecContext->width, pCodecContext->height,
is_rgb?PIX_FMT_RGB24:PIX_FMT_GRAY8, //Dest format
+
SWS_POINT, //The nastiest scaler should be OK, since
we're not scaling. Right?
+
NULL, NULL, NULL);
+ }
+
+ /*
// Convert the image from its native format to
RGB
img_convert((AVPicture *)pFrameRGB,
is_rgb?PIX_FMT_RGB24:PIX_FMT_GRAY8,
(AVPicture*)pFrame,
pCodecContext->pix_fmt,
pCodecContext->width,
pCodecContext->height);
+ */
+ sws_scale(img_convert_ctx, pFrame->data,
pFrame->linesize, 0, pCodecContext->height, pFrameRGB->data,
pFrameRGB->linesize);
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [libcvd-members] libcvd configure configure.in cvd/videofilebuff...,
Edward Rosten <=