[Sumover-dev] [svn commit] r3803 - in vic/trunk: .

sumover-dev at cs.ucl.ac.uk sumover-dev at cs.ucl.ac.uk
Tue Sep 5 01:53:20 BST 2006


Author: rhys
Date: Tue Sep  5 01:52:30 2006
New Revision: 3803

Added:
   vic/trunk/codec/decoder-dv.cpp
Modified:
   vic/trunk/configure
   vic/trunk/configure.in

Log:
Added dv decoding to vic. Untested.
To enable, configure with --enable-dvdecode.



Added: vic/trunk/codec/decoder-dv.cpp
==============================================================================
--- (empty file)
+++ vic/trunk/codec/decoder-dv.cpp	Tue Sep  5 01:52:30 2006
@@ -0,0 +1,247 @@
+
+#ifdef USE_DVDECODER
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "inet.h"
+#include "rtp.h"
+#include "decoder.h"
+#include "renderer.h"
+
+#include <libdv/dv.h>
+
+class DVDecoder : public Decoder {
+    public:
+	DVDecoder();
+	virtual ~DVDecoder();
+	virtual void info(char* wrk) const;
+	virtual void recv(pktbuf*);
+	int colorhist(u_int* hist) const;
+	virtual void stats(char* wrk);
+    protected:
+	void decode(const u_char* vh, const u_char* bp, int cc);
+	virtual void redraw();
+
+        dv_decoder_t *dv_decoder;
+        u_char *dv_buffer;
+
+        u_char *dv_frame;
+
+        bool header_received;
+        bool headers_received[12];
+        bool vaux_received[12];
+
+        unsigned int difblocks;
+};
+
+static class DVDecoderMatcher : public Matcher {
+    public:
+	DVDecoderMatcher() : Matcher("decoder") {}
+	TclObject* match(const char* id) {
+		if (strcasecmp(id, "dv") == 0)
+			return (new DVDecoder());
+		return (0);
+	}
+} dm_dvdecoder;
+
+#define STAT_BAD_PSC	0
+#define STAT_BAD_GOB	1
+#define STAT_BAD_SYNTAX	2
+#define STAT_BAD_FMT	3
+#define STAT_FMT_CHANGE 4	/* # times fmt changed */
+#define STAT_BAD_HEADER 5
+
+/* From libdv's encode.h */
+#define DV_WIDTH       720
+#define DV_PAL_HEIGHT  576
+#define DV_NTSC_HEIGHT 480
+
+DVDecoder::DVDecoder() : Decoder(0), 
+			 dv_decoder(0), 
+			 dv_buffer(new u_char[144000]), 
+			 dv_frame(new u_char[(DV_WIDTH * DV_PAL_HEIGHT * 3)/2]), 
+			 header_received(false),
+			 difblocks(0)
+{
+	stat_[STAT_BAD_PSC].name = "H261-Bad-PSC";
+	stat_[STAT_BAD_GOB].name = "H261-Bad-GOB";
+	stat_[STAT_BAD_SYNTAX].name = "H261-Bad-Syntax";
+	stat_[STAT_BAD_FMT].name = "H261-Bad-fmt";
+	stat_[STAT_FMT_CHANGE].name = "H261-Fmt-change";
+	stat_[STAT_BAD_HEADER].name = "H261-Bad-Header";
+	nstat_ = 6;
+
+	/*
+         * libdv does either yv12 or yuyv and this is determined at
+	 * libdv's compile time. There is no way programatically to 
+	 * check this, so the default of yv12 is assumed. yv12 is the
+	 * same as i420 but with the u and v planes swapped.
+	 */
+	decimation_ = 411;
+
+	/*
+	 * Assume PAL. 
+	 */
+	inw_ = DV_WIDTH;
+	inh_ = DV_PAL_HEIGHT;
+
+	/*XXX*/
+	resize(inw_, inh_);
+
+	for (int i = 0; i < 12; i ++) {
+	  headers_received[i] = false;
+	  vaux_received[i] = false;
+	}
+
+	dv_decoder = dv_decoder_new(0, TRUE, TRUE);
+	//dv_decoder->quality = DV_QUALITY_FASTEST;
+	dv_decoder->quality = DV_QUALITY_BEST;
+
+	memset(dv_buffer, 0, 144000);
+	memset(dv_frame, 127, (DV_WIDTH * DV_PAL_HEIGHT * 3)/2);
+}
+
+DVDecoder::~DVDecoder()
+{
+
+}
+
+void DVDecoder::info(char* wrk) const
+{
+        *wrk = 0;
+}
+
+void DVDecoder::stats(char* wrk)
+{
+        Decoder::stats(wrk);
+}
+
+int DVDecoder::colorhist(u_int* hist) const
+{
+        UNUSED(hist);
+	return (0);
+}
+
+void DVDecoder::recv(pktbuf* pb)
+{	
+	rtphdr* rh = (rtphdr*)pb->dp;
+	u_char* vh = (u_char*)(rh + 1);
+	u_int cc = pb->len - sizeof(*rh);
+
+	while (cc >= 80) {
+	  u_int sct = (u_int)(vh[0] & 0xe0) >> 5;
+	  u_int dseq = (u_int)(vh[1] & 0xf0) >> 4;
+	  u_int dbn = (u_int)(vh[2]);
+	  u_int offset;
+
+	  switch(sct) {
+	  case 0: // Header
+	    offset = dseq * 12000;
+	    headers_received[dseq] = true;
+	    break;
+
+	  case 1: // Subcode
+	    offset = dseq * 12000 + (dbn + 1) * 80;
+	    break;
+
+	  case 2: // VAUX
+	    offset = dseq * 12000 + (dbn + 3) * 80;
+	    vaux_received[dseq] = true;
+	    break;
+
+	  case 3: // Audio
+	    offset = dseq * 12000 + 480 + (dbn * 16 * 80);
+	    break;
+	    
+	  case 4: // Video
+	    offset = (dseq * 150 + 7 + dbn + dbn/15) * 80;
+	    break;
+
+	  default:
+	    // TODO: Log error here.
+	    continue;
+	  }
+
+	  if (offset + 80 > 144000) {
+	    // TODO: Log error here.
+	    continue;
+	  }
+
+	  memcpy(dv_buffer + offset, vh, 80);
+	  difblocks ++;
+
+	  vh += 80;
+	  cc -= 80;
+	}
+	   
+	/*XXX*/
+	if (ntohs(rh->rh_flags) & RTP_M) {
+	        /*
+	         * Don't try and decode until we're sure what system of dv
+		 * we have and the best way to tell is to make sure we have
+		 * the headers and vaux headers.
+	         */
+	        if (!header_received) {
+  		        header_received = true;
+		        for (int i = 0; i < 10; i ++) {
+		                if (!headers_received[i] || 
+				    !vaux_received[i]) {
+		                        header_received = false;
+		                        break;
+		                }
+		        }
+		}
+
+		if (header_received) {
+		        if (dv_parse_header(dv_decoder, 
+					    (const uint8_t*)dv_buffer) >= 0 &&
+			    dv_decoder->system != e_dv_system_none) {
+
+		                switch(dv_decoder->system) {
+		                case e_dv_system_525_60: // NTSC
+		                        if (inh_ != DV_NTSC_HEIGHT) {
+			                        inh_ = DV_NTSC_HEIGHT;
+			                        resize(inw_, inh_);
+		                        }
+		                        break;
+
+		                case e_dv_system_625_50: // PAL
+		                        if (inh_ != DV_PAL_HEIGHT) {
+			                        inh_ = DV_PAL_HEIGHT;
+			                        resize(inw_, inh_);
+		                        }
+		                        break;
+				case e_dv_system_none:
+				        // Handled in if statement above.
+				        break;
+				}
+
+				unsigned char *pixels[3];
+				int pitches[3];
+
+				// U and V planes deliberately swapped here.
+				pixels[0] = dv_frame;
+				pixels[1] = dv_frame + (inh_ * inw_ * 5)/4;
+				pixels[2] = dv_frame + (inh_ * inw_);
+
+				dv_decode_full_frame(dv_decoder,
+						     (const uint8_t*)dv_buffer,
+						     e_dv_color_yuv,
+						     pixels,
+						     pitches);
+				
+				render_frame(dv_frame);
+			}
+		}
+		difblocks = 0;
+	}
+	pb->release();
+}
+
+void DVDecoder::redraw()
+{
+        Decoder::redraw(dv_frame);
+}
+
+#endif // USE_DVDECODER

Modified: vic/trunk/configure
==============================================================================
--- vic/trunk/configure	(original)
+++ vic/trunk/configure	Tue Sep  5 01:52:30 2006
@@ -309,7 +309,7 @@
 # include <unistd.h>
 #endif"
 
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX CPP EGREP V_INCLUDE_X11 V_LIB_X11 V_INCLUDE_TCL V_LIB_TCL V_LIBRARY_TCL V_TKDOSNAMES V_INCLUDE_TK V_LIB_TK V_LIBRARY_TK V_INCLUDE_GRABBER V_LIB_GRABBER V_OBJ_GRABBER V_LIB_XIL V_OBJ_XIL V_OBJ V_STATIC V_TAR_TARGET V_ALL V_CCOPT V_CCOPT_H261 V_TAR_EXTRA V_LIB V_DEFINE V_SIGRET V_SHELL V_TARCMD V_INCLUDE V_BROKEN_OBJ V_OBJ_CRYPT LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX CPP EGREP V_INCLUDE_X11 V_LIB_X11 V_INCLUDE_TCL V_LIB_TCL V_LIBRARY_TCL V_TKDOSNAMES V_INCLUDE_TK V_LIB_TK V_LIBRARY_TK V_INCLUDE_GRABBER V_LIB_GRABBER V_OBJ_GRABBER V_LIB_XIL V_OBJ_XIL V_OBJ V_LIB V_STATIC V_TAR_TARGET V_ALL V_CCOPT V_CCOPT_H261 V_TAR_EXTRA V_DEFINE V_SIGRET V_SHELL V_TARCMD V_INCLUDE V_BROKEN_OBJ V_OBJ_CRYPT LIBOBJS LTLIBOBJS'
 ac_subst_files=''
 
 # Initialize some variables set by options.
@@ -855,7 +855,8 @@
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
 --enable-debug		build with debugging enabled
 --enable-ipv6		build with ipv6 enabled
---enable-h261as    Enable or disable the h261as codec
+--enable-h261as         Enable or disable the h261as codec
+--enable-dvdecode       Enable or disable dv decoding
 --enable-v4l2old    Enable or disable old Video4Linux2 grabber
 --enable-XvGrabber    Enable or disable old XvGrabber
 
@@ -1324,6 +1325,9 @@
 V_ALL="$V_PROG"
 V_SHM="-DUSE_SHM"
 
+V_OBJ=""
+V_LIB=""
+
 
 ac_aux_dir=
 for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
@@ -4488,7 +4492,6 @@
 	exit 1
 fi
 
-V_OBJ=""
 V_H261AS=""
 
 # Check whether --enable-h261as or --disable-h261as was given.
@@ -4503,6 +4506,248 @@
    V_H261AS="-DUSE_H261AS"
 fi
 
+V_DV=""
+# Check whether --enable-dvdecode or --disable-dvdecode was given.
+if test "${enable_dvdecode+set}" = set; then
+  enableval="$enable_dvdecode"
+  dvdecode=yes
+else
+  dvdecode=no
+fi;
+if test "$dvdecode" = "yes"; then
+
+echo "$as_me:$LINENO: checking for main in -ldv" >&5
+echo $ECHO_N "checking for main in -ldv... $ECHO_C" >&6
+if test "${ac_cv_lib_dv_main+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldv  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+
+int
+main ()
+{
+main ();
+  ;
+  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_c_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_dv_main=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_dv_main=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_dv_main" >&5
+echo "${ECHO_T}$ac_cv_lib_dv_main" >&6
+if test $ac_cv_lib_dv_main = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBDV 1
+_ACEOF
+
+  LIBS="-ldv $LIBS"
+
+else
+
+      echo "Error! libdv not available. Please install libdv."
+      exit 1
+
+fi
+
+
+for ac_header in libdv/dv.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_c_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_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_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_c_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 AC_PACKAGE_NAME 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
+
+else
+
+      echo "Error! libdv/dv.h not found. Please install libdv developer package."
+      exit 1
+
+fi
+
+done
+
+   V_OBJ="$V_OBJ codec/decoder-dv.o"
+   V_DV="-DUSE_DVDECODER"
+   V_LIB="$V_LIB -ldv"
+fi
+
 # lots of hairy special cases for detecting which frame capture
 # support to compile in
 
@@ -4838,7 +5083,8 @@
 
 
 
-V_DEFINE="$V_DEFINE $V_SHM $V_H261AS"
+
+V_DEFINE="$V_DEFINE $V_SHM $V_H261AS $V_DV"
 
 
 # tcl7.5 needs a dynamic loading library (unless built with the
@@ -5726,13 +5972,13 @@
 s, at V_LIB_XIL@,$V_LIB_XIL,;t t
 s, at V_OBJ_XIL@,$V_OBJ_XIL,;t t
 s, at V_OBJ@,$V_OBJ,;t t
+s, at V_LIB@,$V_LIB,;t t
 s, at V_STATIC@,$V_STATIC,;t t
 s, at V_TAR_TARGET@,$V_TAR_TARGET,;t t
 s, at V_ALL@,$V_ALL,;t t
 s, at V_CCOPT@,$V_CCOPT,;t t
 s, at V_CCOPT_H261@,$V_CCOPT_H261,;t t
 s, at V_TAR_EXTRA@,$V_TAR_EXTRA,;t t
-s, at V_LIB@,$V_LIB,;t t
 s, at V_DEFINE@,$V_DEFINE,;t t
 s, at V_SIGRET@,$V_SIGRET,;t t
 s, at V_SHELL@,$V_SHELL,;t t

Modified: vic/trunk/configure.in
==============================================================================
--- vic/trunk/configure.in	(original)
+++ vic/trunk/configure.in	Tue Sep  5 01:52:30 2006
@@ -7,6 +7,9 @@
 V_ALL="$V_PROG"
 V_SHM="-DUSE_SHM"
 
+V_OBJ=""
+V_LIB=""
+
 builtin(include, configure.in.head)
 
 #XXX
@@ -29,16 +32,32 @@
 	exit 1
 fi
 
-V_OBJ=""
 V_H261AS=""
 
 dnl h261 as (arbitrary size) 
-AC_ARG_ENABLE(h261as, --enable-h261as    Enable or disable the h261as codec, h261as=yes, h261as=no)
+AC_ARG_ENABLE(h261as, --enable-h261as         Enable or disable the h261as codec, h261as=yes, h261as=no)
 if test "$h261as" = "yes"; then
    V_OBJ="$V_OBJ codec/p64/p64as.o codec/decoder-h261as.o codec/encoder-h261as.o"
    V_H261AS="-DUSE_H261AS"
 fi
 
+V_DV=""
+dnl dv decoding support
+AC_ARG_ENABLE(dvdecode, --enable-dvdecode       Enable or disable dv decoding, dvdecode=yes, dvdecode=no)
+if test "$dvdecode" = "yes"; then
+   AC_CHECK_LIB([dv], [main], [], [
+      echo "Error! libdv not available. Please install libdv."
+      exit 1
+      ])
+   AC_CHECK_HEADERS([libdv/dv.h], [], [
+      echo "Error! libdv/dv.h not found. Please install libdv developer package."
+      exit 1
+      ])
+   V_OBJ="$V_OBJ codec/decoder-dv.o"
+   V_DV="-DUSE_DVDECODER"
+   V_LIB="$V_LIB -ldv"
+fi
+
 # lots of hairy special cases for detecting which frame capture
 # support to compile in
 
@@ -362,7 +381,8 @@
 AC_SUBST(V_LIB_XIL)
 AC_SUBST(V_OBJ_XIL)
 AC_SUBST(V_OBJ)
+AC_SUBST(V_LIB)
 
-V_DEFINE="$V_DEFINE $V_SHM $V_H261AS"
+V_DEFINE="$V_DEFINE $V_SHM $V_H261AS $V_DV"
 
 builtin(include, configure.in.tail)



More information about the Sumover-dev mailing list