summaryrefslogtreecommitdiffstats
path: root/debian/transcode/transcode-1.1.7/tools
diff options
context:
space:
mode:
Diffstat (limited to 'debian/transcode/transcode-1.1.7/tools')
-rw-r--r--debian/transcode/transcode-1.1.7/tools/Makefile.am155
-rw-r--r--debian/transcode/transcode-1.1.7/tools/Makefile.in1086
-rw-r--r--debian/transcode/transcode-1.1.7/tools/aud_scan.c364
-rw-r--r--debian/transcode/transcode-1.1.7/tools/aud_scan.h36
-rw-r--r--debian/transcode/transcode-1.1.7/tools/aud_scan_avi.c199
-rw-r--r--debian/transcode/transcode-1.1.7/tools/aud_scan_avi.h34
-rw-r--r--debian/transcode/transcode-1.1.7/tools/avifix.c335
-rw-r--r--debian/transcode/transcode-1.1.7/tools/aviindex.c914
-rw-r--r--debian/transcode/transcode-1.1.7/tools/avimerge.c824
-rw-r--r--debian/transcode/transcode-1.1.7/tools/avimisc.c99
-rw-r--r--debian/transcode/transcode-1.1.7/tools/avisplit.c717
-rw-r--r--debian/transcode/transcode-1.1.7/tools/avisync.c778
-rw-r--r--debian/transcode/transcode-1.1.7/tools/buffer.c158
-rw-r--r--debian/transcode/transcode-1.1.7/tools/buffer.h57
-rw-r--r--debian/transcode/transcode-1.1.7/tools/rawsource.c288
-rw-r--r--debian/transcode/transcode-1.1.7/tools/rawsource.h34
-rw-r--r--debian/transcode/transcode-1.1.7/tools/tcexport.c585
-rw-r--r--debian/transcode/transcode-1.1.7/tools/tcmodchain.c536
-rw-r--r--debian/transcode/transcode-1.1.7/tools/tcmodinfo.c382
-rw-r--r--debian/transcode/transcode-1.1.7/tools/tcmp3cut.c306
-rw-r--r--debian/transcode/transcode-1.1.7/tools/tcstub.c273
-rw-r--r--debian/transcode/transcode-1.1.7/tools/tcstub.h91
-rw-r--r--debian/transcode/transcode-1.1.7/tools/tcyait.c1969
23 files changed, 10220 insertions, 0 deletions
diff --git a/debian/transcode/transcode-1.1.7/tools/Makefile.am b/debian/transcode/transcode-1.1.7/tools/Makefile.am
new file mode 100644
index 00000000..e25125c1
--- /dev/null
+++ b/debian/transcode/transcode-1.1.7/tools/Makefile.am
@@ -0,0 +1,155 @@
+# # Process this file with automake to produce Makefile.in.
+
+AM_CPPFLAGS = \
+ $(PTHREAD_CFLAGS) \
+ -DMOD_PATH=\"$(MOD_PATH)\" \
+ -DPROF_PATH=\"$(PROF_PATH)\" \
+ -DTC_ENCODER_NG=1 \
+ -DTCEXPORT_PROFILE=1 \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/src
+
+if ENABLE_EXPERIMENTAL
+NMS_PROGS = tcexport tcmodchain
+endif
+
+bin_PROGRAMS = \
+ avifix \
+ aviindex \
+ avimerge \
+ avisplit \
+ avisync \
+ tcmodinfo \
+ tcmp3cut \
+ tcyait \
+ $(NMS_PROGS)
+
+avisync_SOURCES = \
+ avisync.c \
+ avimisc.c \
+ buffer.c \
+ buffer.h \
+ aud_scan.c \
+ aud_scan_avi.c \
+ aud_scan_avi.h \
+ aud_scan.h
+avisync_LDADD = \
+ $(AVILIB_LIBS) \
+ $(XIO_LIBS) \
+ $(ACLIB_LIBS) \
+ $(LIBTC_LIBS)
+
+avimerge_SOURCES = \
+ avimerge.c \
+ avimisc.c \
+ aud_scan.c \
+ aud_scan_avi.c \
+ aud_scan_avi.h \
+ aud_scan.h
+avimerge_LDADD = \
+ $(AVILIB_LIBS) \
+ $(XIO_LIBS) \
+ $(ACLIB_LIBS) \
+ $(LIBTC_LIBS)
+
+avifix_SOURCES = \
+ avifix.c \
+ avimisc.c
+avifix_LDADD = \
+ $(AVILIB_LIBS) \
+ $(XIO_LIBS) \
+ $(ACLIB_LIBS) \
+ $(LIBTC_LIBS)
+
+aviindex_SOURCES = \
+ aviindex.c \
+ avimisc.c \
+ aud_scan.c \
+ aud_scan.h
+aviindex_LDADD = \
+ $(AVILIB_LIBS) \
+ $(XIO_LIBS) \
+ $(ACLIB_LIBS) \
+ $(LIBTC_LIBS)
+
+avisplit_SOURCES = \
+ avisplit.c \
+ avimisc.c \
+ aud_scan.c \
+ aud_scan_avi.c \
+ aud_scan.h
+ aud_scan_avi.h
+avisplit_LDADD = \
+ $(AVILIB_LIBS) \
+ $(XIO_LIBS) \
+ $(ACLIB_LIBS) \
+ $(LIBTC_LIBS)
+
+tcmodinfo_SOURCES = tcmodinfo.c tcstub.c
+tcmodinfo_CPPFLAGS = $(AM_CPPFLAGS) \
+ $(DLDARWIN_CFLAGS)
+tcmodinfo_LDADD = \
+ $(DLDARWIN_LIBS) \
+ $(ACLIB_LIBS) \
+ $(AVILIB_LIBS) \
+ $(WAVLIB_LIBS) \
+ $(LIBTC_LIBS) \
+ $(LIBTCVIDEO_LIBS) \
+ $(PTHREAD_LIBS) \
+ -lm
+tcmodinfo_LDFLAGS = -export-dynamic
+
+tcmodchain_SOURCES = tcmodchain.c tcstub.c
+tcmodchain_CPPFLAGS = $(AM_CPPFLAGS) \
+ $(DLDARWIN_CFLAGS)
+tcmodchain_LDADD = \
+ $(DLDARWIN_LIBS) \
+ $(ACLIB_LIBS) \
+ $(AVILIB_LIBS) \
+ $(WAVLIB_LIBS) \
+ $(LIBTC_LIBS) \
+ $(LIBTCVIDEO_LIBS) \
+ $(PTHREAD_LIBS) \
+ -lm
+tcmodchain_LDFLAGS = -export-dynamic
+
+tcexport_SOURCES = tcexport.c \
+ tcstub.c \
+ rawsource.c \
+ rawsource.h \
+ ../src/probe.c \
+ ../src/dl_loader.c \
+ ../src/counter.c \
+ ../src/encoder.c \
+ ../src/encoder-common.c \
+ ../src/export_profile.c \
+ ../src/framebuffer.c
+tcexport_CPPFLAGS = $(AM_CPPFLAGS) \
+ $(DLDARWIN_CFLAGS)
+tcexport_LDADD = \
+ $(DLDARWIN_LIBS) \
+ $(ACLIB_LIBS) \
+ $(AVILIB_LIBS) \
+ $(WAVLIB_LIBS) \
+ $(LIBTC_LIBS) \
+ $(LIBTCVIDEO_LIBS) \
+ $(LIBTCAUDIO_LIBS) \
+ $(XIO_LIBS) \
+ $(PTHREAD_LIBS) \
+ -lm
+tcexport_LDFLAGS = -export-dynamic
+
+tcmp3cut_SOURCES = \
+ tcmp3cut.c \
+ aud_scan.c \
+ aud_scan.h
+tcmp3cut_LDADD = \
+ $(LIBTC_LIBS)
+
+tcyait_SOURCES = \
+ tcyait.c
+tcyait_LDADD = \
+ -lm
+
+EXTRA_DIST = \
+ tcstub.h \ No newline at end of file
diff --git a/debian/transcode/transcode-1.1.7/tools/Makefile.in b/debian/transcode/transcode-1.1.7/tools/Makefile.in
new file mode 100644
index 00000000..c666943a
--- /dev/null
+++ b/debian/transcode/transcode-1.1.7/tools/Makefile.in
@@ -0,0 +1,1086 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# # Process this file with automake to produce Makefile.in.
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+bin_PROGRAMS = avifix$(EXEEXT) aviindex$(EXEEXT) avimerge$(EXEEXT) \
+ avisplit$(EXEEXT) avisync$(EXEEXT) tcmodinfo$(EXEEXT) \
+ tcmp3cut$(EXEEXT) tcyait$(EXEEXT) $(am__EXEEXT_1)
+subdir = tools
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+@ENABLE_EXPERIMENTAL_TRUE@am__EXEEXT_1 = tcexport$(EXEEXT) \
+@ENABLE_EXPERIMENTAL_TRUE@ tcmodchain$(EXEEXT)
+am__installdirs = "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS)
+am_avifix_OBJECTS = avifix.$(OBJEXT) avimisc.$(OBJEXT)
+avifix_OBJECTS = $(am_avifix_OBJECTS)
+am__DEPENDENCIES_1 =
+avifix_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+am_aviindex_OBJECTS = aviindex.$(OBJEXT) avimisc.$(OBJEXT) \
+ aud_scan.$(OBJEXT)
+aviindex_OBJECTS = $(am_aviindex_OBJECTS)
+aviindex_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+am_avimerge_OBJECTS = avimerge.$(OBJEXT) avimisc.$(OBJEXT) \
+ aud_scan.$(OBJEXT) aud_scan_avi.$(OBJEXT)
+avimerge_OBJECTS = $(am_avimerge_OBJECTS)
+avimerge_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+am_avisplit_OBJECTS = avisplit.$(OBJEXT) avimisc.$(OBJEXT) \
+ aud_scan.$(OBJEXT) aud_scan_avi.$(OBJEXT)
+avisplit_OBJECTS = $(am_avisplit_OBJECTS)
+avisplit_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+am_avisync_OBJECTS = avisync.$(OBJEXT) avimisc.$(OBJEXT) \
+ buffer.$(OBJEXT) aud_scan.$(OBJEXT) aud_scan_avi.$(OBJEXT)
+avisync_OBJECTS = $(am_avisync_OBJECTS)
+avisync_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+am_tcexport_OBJECTS = tcexport-tcexport.$(OBJEXT) \
+ tcexport-tcstub.$(OBJEXT) tcexport-rawsource.$(OBJEXT) \
+ tcexport-probe.$(OBJEXT) tcexport-dl_loader.$(OBJEXT) \
+ tcexport-counter.$(OBJEXT) tcexport-encoder.$(OBJEXT) \
+ tcexport-encoder-common.$(OBJEXT) \
+ tcexport-export_profile.$(OBJEXT) \
+ tcexport-framebuffer.$(OBJEXT)
+tcexport_OBJECTS = $(am_tcexport_OBJECTS)
+tcexport_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+tcexport_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(tcexport_LDFLAGS) \
+ $(LDFLAGS) -o $@
+am_tcmodchain_OBJECTS = tcmodchain-tcmodchain.$(OBJEXT) \
+ tcmodchain-tcstub.$(OBJEXT)
+tcmodchain_OBJECTS = $(am_tcmodchain_OBJECTS)
+tcmodchain_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+tcmodchain_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(tcmodchain_LDFLAGS) $(LDFLAGS) -o $@
+am_tcmodinfo_OBJECTS = tcmodinfo-tcmodinfo.$(OBJEXT) \
+ tcmodinfo-tcstub.$(OBJEXT)
+tcmodinfo_OBJECTS = $(am_tcmodinfo_OBJECTS)
+tcmodinfo_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+tcmodinfo_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(tcmodinfo_LDFLAGS) $(LDFLAGS) -o $@
+am_tcmp3cut_OBJECTS = tcmp3cut.$(OBJEXT) aud_scan.$(OBJEXT)
+tcmp3cut_OBJECTS = $(am_tcmp3cut_OBJECTS)
+tcmp3cut_DEPENDENCIES = $(am__DEPENDENCIES_1)
+am_tcyait_OBJECTS = tcyait.$(OBJEXT)
+tcyait_OBJECTS = $(am_tcyait_OBJECTS)
+tcyait_DEPENDENCIES =
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/autotools/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(avifix_SOURCES) $(aviindex_SOURCES) $(avimerge_SOURCES) \
+ $(avisplit_SOURCES) $(avisync_SOURCES) $(tcexport_SOURCES) \
+ $(tcmodchain_SOURCES) $(tcmodinfo_SOURCES) $(tcmp3cut_SOURCES) \
+ $(tcyait_SOURCES)
+DIST_SOURCES = $(avifix_SOURCES) $(aviindex_SOURCES) \
+ $(avimerge_SOURCES) $(avisplit_SOURCES) $(avisync_SOURCES) \
+ $(tcexport_SOURCES) $(tcmodchain_SOURCES) $(tcmodinfo_SOURCES) \
+ $(tcmp3cut_SOURCES) $(tcyait_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+A52_CFLAGS = @A52_CFLAGS@
+A52_LIBS = @A52_LIBS@
+ACLIB_LIBS = @ACLIB_LIBS@
+ACLOCAL = @ACLOCAL@
+ALTIVEC_CFLAGS = @ALTIVEC_CFLAGS@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AVILIB_LIBS = @AVILIB_LIBS@
+AWK = @AWK@
+BSDAV_CFLAGS = @BSDAV_CFLAGS@
+BSDAV_LIBS = @BSDAV_LIBS@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXXCPP = @CXXCPP@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLDARWIN_CFLAGS = @DLDARWIN_CFLAGS@
+DLDARWIN_LIBS = @DLDARWIN_LIBS@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FAAC_CFLAGS = @FAAC_CFLAGS@
+FAAC_LIBS = @FAAC_LIBS@
+FGREP = @FGREP@
+FREETYPE2_CFLAGS = @FREETYPE2_CFLAGS@
+FREETYPE2_LIBS = @FREETYPE2_LIBS@
+GREP = @GREP@
+IBP_LIBS = @IBP_LIBS@
+ICONV_CFLAGS = @ICONV_CFLAGS@
+ICONV_LIBS = @ICONV_LIBS@
+IMAGEMAGICK_CFLAGS = @IMAGEMAGICK_CFLAGS@
+IMAGEMAGICK_LIBS = @IMAGEMAGICK_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LAME_CFLAGS = @LAME_CFLAGS@
+LAME_LIBS = @LAME_LIBS@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBAVCODEC_CFLAGS = @LIBAVCODEC_CFLAGS@
+LIBAVCODEC_LIBS = @LIBAVCODEC_LIBS@
+LIBAVFORMAT_CFLAGS = @LIBAVFORMAT_CFLAGS@
+LIBAVFORMAT_LIBS = @LIBAVFORMAT_LIBS@
+LIBDVDREAD_CFLAGS = @LIBDVDREAD_CFLAGS@
+LIBDVDREAD_LIBS = @LIBDVDREAD_LIBS@
+LIBDV_CFLAGS = @LIBDV_CFLAGS@
+LIBDV_LIBS = @LIBDV_LIBS@
+LIBJPEG_CFLAGS = @LIBJPEG_CFLAGS@
+LIBJPEG_LIBS = @LIBJPEG_LIBS@
+LIBMPEG2CONVERT_CFLAGS = @LIBMPEG2CONVERT_CFLAGS@
+LIBMPEG2CONVERT_LIBS = @LIBMPEG2CONVERT_LIBS@
+LIBMPEG2_CFLAGS = @LIBMPEG2_CFLAGS@
+LIBMPEG2_LIBS = @LIBMPEG2_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBPOSTPROC_CFLAGS = @LIBPOSTPROC_CFLAGS@
+LIBPOSTPROC_LIBS = @LIBPOSTPROC_LIBS@
+LIBQUICKTIME_CFLAGS = @LIBQUICKTIME_CFLAGS@
+LIBQUICKTIME_LIBS = @LIBQUICKTIME_LIBS@
+LIBS = @LIBS@
+LIBTCAUDIO_LIBS = @LIBTCAUDIO_LIBS@
+LIBTCVIDEO_LIBS = @LIBTCVIDEO_LIBS@
+LIBTC_LIBS = @LIBTC_LIBS@
+LIBTOOL = @LIBTOOL@
+LIBV4L2_CFLAGS = @LIBV4L2_CFLAGS@
+LIBV4L2_LIBS = @LIBV4L2_LIBS@
+LIBV4LCONVERT_CFLAGS = @LIBV4LCONVERT_CFLAGS@
+LIBV4LCONVERT_LIBS = @LIBV4LCONVERT_LIBS@
+LIBXML2_CFLAGS = @LIBXML2_CFLAGS@
+LIBXML2_LIBS = @LIBXML2_LIBS@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LZO_CFLAGS = @LZO_CFLAGS@
+LZO_LIBS = @LZO_LIBS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MJPEGTOOLS_CFLAGS = @MJPEGTOOLS_CFLAGS@
+MJPEGTOOLS_LIBS = @MJPEGTOOLS_LIBS@
+MKDIR_P = @MKDIR_P@
+MOD_PATH = @MOD_PATH@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OGG_CFLAGS = @OGG_CFLAGS@
+OGG_LIBS = @OGG_LIBS@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PATH_TO_AWK = @PATH_TO_AWK@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PROF_PATH = @PROF_PATH@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+PVM3_CFLAGS = @PVM3_CFLAGS@
+PVM3_LIBS = @PVM3_LIBS@
+PVM3_PVMGS = @PVM3_PVMGS@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_LIBS = @SDL_LIBS@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SIMD_FLAGS = @SIMD_FLAGS@
+STRIP = @STRIP@
+THEORA_CFLAGS = @THEORA_CFLAGS@
+THEORA_LIBS = @THEORA_LIBS@
+USE_DLDARWIN = @USE_DLDARWIN@
+VERSION = @VERSION@
+VORBIS_CFLAGS = @VORBIS_CFLAGS@
+VORBIS_LIBS = @VORBIS_LIBS@
+WAVLIB_LIBS = @WAVLIB_LIBS@
+X264_CFLAGS = @X264_CFLAGS@
+X264_LIBS = @X264_LIBS@
+XIO_CFLAGS = @XIO_CFLAGS@
+XIO_LIBS = @XIO_LIBS@
+XMKMF = @XMKMF@
+XVID_CFLAGS = @XVID_CFLAGS@
+XVID_LIBS = @XVID_LIBS@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+a52_config = @a52_config@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+bsdav_config = @bsdav_config@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+faac_config = @faac_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+iconv_config = @iconv_config@
+imagemagick_config = @imagemagick_config@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+lame_config = @lame_config@
+libdir = @libdir@
+libdvdread_config = @libdvdread_config@
+libexecdir = @libexecdir@
+libjpeg_config = @libjpeg_config@
+libjpegmmx_config = @libjpegmmx_config@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lzo_config = @lzo_config@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pvm3_config = @pvm3_config@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+x_includes = @x_includes@
+x_libraries = @x_libraries@
+xvid_config = @xvid_config@
+AM_CPPFLAGS = \
+ $(PTHREAD_CFLAGS) \
+ -DMOD_PATH=\"$(MOD_PATH)\" \
+ -DPROF_PATH=\"$(PROF_PATH)\" \
+ -DTC_ENCODER_NG=1 \
+ -DTCEXPORT_PROFILE=1 \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/src
+
+@ENABLE_EXPERIMENTAL_TRUE@NMS_PROGS = tcexport tcmodchain
+avisync_SOURCES = \
+ avisync.c \
+ avimisc.c \
+ buffer.c \
+ buffer.h \
+ aud_scan.c \
+ aud_scan_avi.c \
+ aud_scan_avi.h \
+ aud_scan.h
+
+avisync_LDADD = \
+ $(AVILIB_LIBS) \
+ $(XIO_LIBS) \
+ $(ACLIB_LIBS) \
+ $(LIBTC_LIBS)
+
+avimerge_SOURCES = \
+ avimerge.c \
+ avimisc.c \
+ aud_scan.c \
+ aud_scan_avi.c \
+ aud_scan_avi.h \
+ aud_scan.h
+
+avimerge_LDADD = \
+ $(AVILIB_LIBS) \
+ $(XIO_LIBS) \
+ $(ACLIB_LIBS) \
+ $(LIBTC_LIBS)
+
+avifix_SOURCES = \
+ avifix.c \
+ avimisc.c
+
+avifix_LDADD = \
+ $(AVILIB_LIBS) \
+ $(XIO_LIBS) \
+ $(ACLIB_LIBS) \
+ $(LIBTC_LIBS)
+
+aviindex_SOURCES = \
+ aviindex.c \
+ avimisc.c \
+ aud_scan.c \
+ aud_scan.h
+
+aviindex_LDADD = \
+ $(AVILIB_LIBS) \
+ $(XIO_LIBS) \
+ $(ACLIB_LIBS) \
+ $(LIBTC_LIBS)
+
+avisplit_SOURCES = \
+ avisplit.c \
+ avimisc.c \
+ aud_scan.c \
+ aud_scan_avi.c \
+ aud_scan.h
+
+avisplit_LDADD = \
+ $(AVILIB_LIBS) \
+ $(XIO_LIBS) \
+ $(ACLIB_LIBS) \
+ $(LIBTC_LIBS)
+
+tcmodinfo_SOURCES = tcmodinfo.c tcstub.c
+tcmodinfo_CPPFLAGS = $(AM_CPPFLAGS) \
+ $(DLDARWIN_CFLAGS)
+
+tcmodinfo_LDADD = \
+ $(DLDARWIN_LIBS) \
+ $(ACLIB_LIBS) \
+ $(AVILIB_LIBS) \
+ $(WAVLIB_LIBS) \
+ $(LIBTC_LIBS) \
+ $(LIBTCVIDEO_LIBS) \
+ $(PTHREAD_LIBS) \
+ -lm
+
+tcmodinfo_LDFLAGS = -export-dynamic
+tcmodchain_SOURCES = tcmodchain.c tcstub.c
+tcmodchain_CPPFLAGS = $(AM_CPPFLAGS) \
+ $(DLDARWIN_CFLAGS)
+
+tcmodchain_LDADD = \
+ $(DLDARWIN_LIBS) \
+ $(ACLIB_LIBS) \
+ $(AVILIB_LIBS) \
+ $(WAVLIB_LIBS) \
+ $(LIBTC_LIBS) \
+ $(LIBTCVIDEO_LIBS) \
+ $(PTHREAD_LIBS) \
+ -lm
+
+tcmodchain_LDFLAGS = -export-dynamic
+tcexport_SOURCES = tcexport.c \
+ tcstub.c \
+ rawsource.c \
+ rawsource.h \
+ ../src/probe.c \
+ ../src/dl_loader.c \
+ ../src/counter.c \
+ ../src/encoder.c \
+ ../src/encoder-common.c \
+ ../src/export_profile.c \
+ ../src/framebuffer.c
+
+tcexport_CPPFLAGS = $(AM_CPPFLAGS) \
+ $(DLDARWIN_CFLAGS)
+
+tcexport_LDADD = \
+ $(DLDARWIN_LIBS) \
+ $(ACLIB_LIBS) \
+ $(AVILIB_LIBS) \
+ $(WAVLIB_LIBS) \
+ $(LIBTC_LIBS) \
+ $(LIBTCVIDEO_LIBS) \
+ $(LIBTCAUDIO_LIBS) \
+ $(XIO_LIBS) \
+ $(PTHREAD_LIBS) \
+ -lm
+
+tcexport_LDFLAGS = -export-dynamic
+tcmp3cut_SOURCES = \
+ tcmp3cut.c \
+ aud_scan.c \
+ aud_scan.h
+
+tcmp3cut_LDADD = \
+ $(LIBTC_LIBS)
+
+tcyait_SOURCES = \
+ tcyait.c
+
+tcyait_LDADD = \
+ -lm
+
+EXTRA_DIST = \
+ tcstub.h
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tools/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu tools/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p || test -f $$p1; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+avifix$(EXEEXT): $(avifix_OBJECTS) $(avifix_DEPENDENCIES)
+ @rm -f avifix$(EXEEXT)
+ $(LINK) $(avifix_OBJECTS) $(avifix_LDADD) $(LIBS)
+aviindex$(EXEEXT): $(aviindex_OBJECTS) $(aviindex_DEPENDENCIES)
+ @rm -f aviindex$(EXEEXT)
+ $(LINK) $(aviindex_OBJECTS) $(aviindex_LDADD) $(LIBS)
+avimerge$(EXEEXT): $(avimerge_OBJECTS) $(avimerge_DEPENDENCIES)
+ @rm -f avimerge$(EXEEXT)
+ $(LINK) $(avimerge_OBJECTS) $(avimerge_LDADD) $(LIBS)
+avisplit$(EXEEXT): $(avisplit_OBJECTS) $(avisplit_DEPENDENCIES)
+ @rm -f avisplit$(EXEEXT)
+ $(LINK) $(avisplit_OBJECTS) $(avisplit_LDADD) $(LIBS)
+avisync$(EXEEXT): $(avisync_OBJECTS) $(avisync_DEPENDENCIES)
+ @rm -f avisync$(EXEEXT)
+ $(LINK) $(avisync_OBJECTS) $(avisync_LDADD) $(LIBS)
+tcexport$(EXEEXT): $(tcexport_OBJECTS) $(tcexport_DEPENDENCIES)
+ @rm -f tcexport$(EXEEXT)
+ $(tcexport_LINK) $(tcexport_OBJECTS) $(tcexport_LDADD) $(LIBS)
+tcmodchain$(EXEEXT): $(tcmodchain_OBJECTS) $(tcmodchain_DEPENDENCIES)
+ @rm -f tcmodchain$(EXEEXT)
+ $(tcmodchain_LINK) $(tcmodchain_OBJECTS) $(tcmodchain_LDADD) $(LIBS)
+tcmodinfo$(EXEEXT): $(tcmodinfo_OBJECTS) $(tcmodinfo_DEPENDENCIES)
+ @rm -f tcmodinfo$(EXEEXT)
+ $(tcmodinfo_LINK) $(tcmodinfo_OBJECTS) $(tcmodinfo_LDADD) $(LIBS)
+tcmp3cut$(EXEEXT): $(tcmp3cut_OBJECTS) $(tcmp3cut_DEPENDENCIES)
+ @rm -f tcmp3cut$(EXEEXT)
+ $(LINK) $(tcmp3cut_OBJECTS) $(tcmp3cut_LDADD) $(LIBS)
+tcyait$(EXEEXT): $(tcyait_OBJECTS) $(tcyait_DEPENDENCIES)
+ @rm -f tcyait$(EXEEXT)
+ $(LINK) $(tcyait_OBJECTS) $(tcyait_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aud_scan.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aud_scan_avi.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avifix.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aviindex.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avimerge.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avimisc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avisplit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avisync.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/buffer.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcexport-counter.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcexport-dl_loader.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcexport-encoder-common.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcexport-encoder.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcexport-export_profile.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcexport-framebuffer.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcexport-probe.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcexport-rawsource.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcexport-tcexport.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcexport-tcstub.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmodchain-tcmodchain.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmodchain-tcstub.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmodinfo-tcmodinfo.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmodinfo-tcstub.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmp3cut.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcyait.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+tcexport-tcexport.o: tcexport.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcexport_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tcexport-tcexport.o -MD -MP -MF $(DEPDIR)/tcexport-tcexport.Tpo -c -o tcexport-tcexport.o `test -f 'tcexport.c' || echo '$(srcdir)/'`tcexport.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tcexport-tcexport.Tpo $(DEPDIR)/tcexport-tcexport.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tcexport.c' object='tcexport-tcexport.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcexport_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tcexport-tcexport.o `test -f 'tcexport.c' || echo '$(srcdir)/'`tcexport.c
+
+tcexport-tcexport.obj: tcexport.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcexport_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tcexport-tcexport.obj -MD -MP -MF $(DEPDIR)/tcexport-tcexport.Tpo -c -o tcexport-tcexport.obj `if test -f 'tcexport.c'; then $(CYGPATH_W) 'tcexport.c'; else $(CYGPATH_W) '$(srcdir)/tcexport.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tcexport-tcexport.Tpo $(DEPDIR)/tcexport-tcexport.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tcexport.c' object='tcexport-tcexport.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcexport_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tcexport-tcexport.obj `if test -f 'tcexport.c'; then $(CYGPATH_W) 'tcexport.c'; else $(CYGPATH_W) '$(srcdir)/tcexport.c'; fi`
+
+tcexport-tcstub.o: tcstub.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcexport_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tcexport-tcstub.o -MD -MP -MF $(DEPDIR)/tcexport-tcstub.Tpo -c -o tcexport-tcstub.o `test -f 'tcstub.c' || echo '$(srcdir)/'`tcstub.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tcexport-tcstub.Tpo $(DEPDIR)/tcexport-tcstub.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tcstub.c' object='tcexport-tcstub.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcexport_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tcexport-tcstub.o `test -f 'tcstub.c' || echo '$(srcdir)/'`tcstub.c
+
+tcexport-tcstub.obj: tcstub.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcexport_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tcexport-tcstub.obj -MD -MP -MF $(DEPDIR)/tcexport-tcstub.Tpo -c -o tcexport-tcstub.obj `if test -f 'tcstub.c'; then $(CYGPATH_W) 'tcstub.c'; else $(CYGPATH_W) '$(srcdir)/tcstub.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tcexport-tcstub.Tpo $(DEPDIR)/tcexport-tcstub.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tcstub.c' object='tcexport-tcstub.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcexport_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tcexport-tcstub.obj `if test -f 'tcstub.c'; then $(CYGPATH_W) 'tcstub.c'; else $(CYGPATH_W) '$(srcdir)/tcstub.c'; fi`
+
+tcexport-rawsource.o: rawsource.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcexport_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tcexport-rawsource.o -MD -MP -MF $(DEPDIR)/tcexport-rawsource.Tpo -c -o tcexport-rawsource.o `test -f 'rawsource.c' || echo '$(srcdir)/'`rawsource.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tcexport-rawsource.Tpo $(DEPDIR)/tcexport-rawsource.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='rawsource.c' object='tcexport-rawsource.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcexport_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tcexport-rawsource.o `test -f 'rawsource.c' || echo '$(srcdir)/'`rawsource.c
+
+tcexport-rawsource.obj: rawsource.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcexport_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tcexport-rawsource.obj -MD -MP -MF $(DEPDIR)/tcexport-rawsource.Tpo -c -o tcexport-rawsource.obj `if test -f 'rawsource.c'; then $(CYGPATH_W) 'rawsource.c'; else $(CYGPATH_W) '$(srcdir)/rawsource.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tcexport-rawsource.Tpo $(DEPDIR)/tcexport-rawsource.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='rawsource.c' object='tcexport-rawsource.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcexport_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tcexport-rawsource.obj `if test -f 'rawsource.c'; then $(CYGPATH_W) 'rawsource.c'; else $(CYGPATH_W) '$(srcdir)/rawsource.c'; fi`
+
+tcexport-probe.o: ../src/probe.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcexport_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tcexport-probe.o -MD -MP -MF $(DEPDIR)/tcexport-probe.Tpo -c -o tcexport-probe.o `test -f '../src/probe.c' || echo '$(srcdir)/'`../src/probe.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tcexport-probe.Tpo $(DEPDIR)/tcexport-probe.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/probe.c' object='tcexport-probe.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcexport_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tcexport-probe.o `test -f '../src/probe.c' || echo '$(srcdir)/'`../src/probe.c
+
+tcexport-probe.obj: ../src/probe.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcexport_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tcexport-probe.obj -MD -MP -MF $(DEPDIR)/tcexport-probe.Tpo -c -o tcexport-probe.obj `if test -f '../src/probe.c'; then $(CYGPATH_W) '../src/probe.c'; else $(CYGPATH_W) '$(srcdir)/../src/probe.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tcexport-probe.Tpo $(DEPDIR)/tcexport-probe.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/probe.c' object='tcexport-probe.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcexport_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tcexport-probe.obj `if test -f '../src/probe.c'; then $(CYGPATH_W) '../src/probe.c'; else $(CYGPATH_W) '$(srcdir)/../src/probe.c'; fi`
+
+tcexport-dl_loader.o: ../src/dl_loader.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcexport_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tcexport-dl_loader.o -MD -MP -MF $(DEPDIR)/tcexport-dl_loader.Tpo -c -o tcexport-dl_loader.o `test -f '../src/dl_loader.c' || echo '$(srcdir)/'`../src/dl_loader.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tcexport-dl_loader.Tpo $(DEPDIR)/tcexport-dl_loader.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/dl_loader.c' object='tcexport-dl_loader.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcexport_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tcexport-dl_loader.o `test -f '../src/dl_loader.c' || echo '$(srcdir)/'`../src/dl_loader.c
+
+tcexport-dl_loader.obj: ../src/dl_loader.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcexport_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tcexport-dl_loader.obj -MD -MP -MF $(DEPDIR)/tcexport-dl_loader.Tpo -c -o tcexport-dl_loader.obj `if test -f '../src/dl_loader.c'; then $(CYGPATH_W) '../src/dl_loader.c'; else $(CYGPATH_W) '$(srcdir)/../src/dl_loader.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tcexport-dl_loader.Tpo $(DEPDIR)/tcexport-dl_loader.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/dl_loader.c' object='tcexport-dl_loader.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcexport_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tcexport-dl_loader.obj `if test -f '../src/dl_loader.c'; then $(CYGPATH_W) '../src/dl_loader.c'; else $(CYGPATH_W) '$(srcdir)/../src/dl_loader.c'; fi`
+
+tcexport-counter.o: ../src/counter.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcexport_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tcexport-counter.o -MD -MP -MF $(DEPDIR)/tcexport-counter.Tpo -c -o tcexport-counter.o `test -f '../src/counter.c' || echo '$(srcdir)/'`../src/counter.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tcexport-counter.Tpo $(DEPDIR)/tcexport-counter.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/counter.c' object='tcexport-counter.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcexport_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tcexport-counter.o `test -f '../src/counter.c' || echo '$(srcdir)/'`../src/counter.c
+
+tcexport-counter.obj: ../src/counter.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcexport_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tcexport-counter.obj -MD -MP -MF $(DEPDIR)/tcexport-counter.Tpo -c -o tcexport-counter.obj `if test -f '../src/counter.c'; then $(CYGPATH_W) '../src/counter.c'; else $(CYGPATH_W) '$(srcdir)/../src/counter.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tcexport-counter.Tpo $(DEPDIR)/tcexport-counter.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/counter.c' object='tcexport-counter.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcexport_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tcexport-counter.obj `if test -f '../src/counter.c'; then $(CYGPATH_W) '../src/counter.c'; else $(CYGPATH_W) '$(srcdir)/../src/counter.c'; fi`
+
+tcexport-encoder.o: ../src/encoder.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcexport_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tcexport-encoder.o -MD -MP -MF $(DEPDIR)/tcexport-encoder.Tpo -c -o tcexport-encoder.o `test -f '../src/encoder.c' || echo '$(srcdir)/'`../src/encoder.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tcexport-encoder.Tpo $(DEPDIR)/tcexport-encoder.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/encoder.c' object='tcexport-encoder.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcexport_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tcexport-encoder.o `test -f '../src/encoder.c' || echo '$(srcdir)/'`../src/encoder.c
+
+tcexport-encoder.obj: ../src/encoder.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcexport_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tcexport-encoder.obj -MD -MP -MF $(DEPDIR)/tcexport-encoder.Tpo -c -o tcexport-encoder.obj `if test -f '../src/encoder.c'; then $(CYGPATH_W) '../src/encoder.c'; else $(CYGPATH_W) '$(srcdir)/../src/encoder.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tcexport-encoder.Tpo $(DEPDIR)/tcexport-encoder.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/encoder.c' object='tcexport-encoder.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcexport_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tcexport-encoder.obj `if test -f '../src/encoder.c'; then $(CYGPATH_W) '../src/encoder.c'; else $(CYGPATH_W) '$(srcdir)/../src/encoder.c'; fi`
+
+tcexport-encoder-common.o: ../src/encoder-common.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcexport_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tcexport-encoder-common.o -MD -MP -MF $(DEPDIR)/tcexport-encoder-common.Tpo -c -o tcexport-encoder-common.o `test -f '../src/encoder-common.c' || echo '$(srcdir)/'`../src/encoder-common.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tcexport-encoder-common.Tpo $(DEPDIR)/tcexport-encoder-common.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/encoder-common.c' object='tcexport-encoder-common.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcexport_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tcexport-encoder-common.o `test -f '../src/encoder-common.c' || echo '$(srcdir)/'`../src/encoder-common.c
+
+tcexport-encoder-common.obj: ../src/encoder-common.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcexport_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tcexport-encoder-common.obj -MD -MP -MF $(DEPDIR)/tcexport-encoder-common.Tpo -c -o tcexport-encoder-common.obj `if test -f '../src/encoder-common.c'; then $(CYGPATH_W) '../src/encoder-common.c'; else $(CYGPATH_W) '$(srcdir)/../src/encoder-common.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tcexport-encoder-common.Tpo $(DEPDIR)/tcexport-encoder-common.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/encoder-common.c' object='tcexport-encoder-common.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcexport_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tcexport-encoder-common.obj `if test -f '../src/encoder-common.c'; then $(CYGPATH_W) '../src/encoder-common.c'; else $(CYGPATH_W) '$(srcdir)/../src/encoder-common.c'; fi`
+
+tcexport-export_profile.o: ../src/export_profile.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcexport_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tcexport-export_profile.o -MD -MP -MF $(DEPDIR)/tcexport-export_profile.Tpo -c -o tcexport-export_profile.o `test -f '../src/export_profile.c' || echo '$(srcdir)/'`../src/export_profile.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tcexport-export_profile.Tpo $(DEPDIR)/tcexport-export_profile.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/export_profile.c' object='tcexport-export_profile.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcexport_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tcexport-export_profile.o `test -f '../src/export_profile.c' || echo '$(srcdir)/'`../src/export_profile.c
+
+tcexport-export_profile.obj: ../src/export_profile.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcexport_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tcexport-export_profile.obj -MD -MP -MF $(DEPDIR)/tcexport-export_profile.Tpo -c -o tcexport-export_profile.obj `if test -f '../src/export_profile.c'; then $(CYGPATH_W) '../src/export_profile.c'; else $(CYGPATH_W) '$(srcdir)/../src/export_profile.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tcexport-export_profile.Tpo $(DEPDIR)/tcexport-export_profile.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/export_profile.c' object='tcexport-export_profile.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcexport_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tcexport-export_profile.obj `if test -f '../src/export_profile.c'; then $(CYGPATH_W) '../src/export_profile.c'; else $(CYGPATH_W) '$(srcdir)/../src/export_profile.c'; fi`
+
+tcexport-framebuffer.o: ../src/framebuffer.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcexport_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tcexport-framebuffer.o -MD -MP -MF $(DEPDIR)/tcexport-framebuffer.Tpo -c -o tcexport-framebuffer.o `test -f '../src/framebuffer.c' || echo '$(srcdir)/'`../src/framebuffer.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tcexport-framebuffer.Tpo $(DEPDIR)/tcexport-framebuffer.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/framebuffer.c' object='tcexport-framebuffer.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcexport_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tcexport-framebuffer.o `test -f '../src/framebuffer.c' || echo '$(srcdir)/'`../src/framebuffer.c
+
+tcexport-framebuffer.obj: ../src/framebuffer.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcexport_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tcexport-framebuffer.obj -MD -MP -MF $(DEPDIR)/tcexport-framebuffer.Tpo -c -o tcexport-framebuffer.obj `if test -f '../src/framebuffer.c'; then $(CYGPATH_W) '../src/framebuffer.c'; else $(CYGPATH_W) '$(srcdir)/../src/framebuffer.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tcexport-framebuffer.Tpo $(DEPDIR)/tcexport-framebuffer.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/framebuffer.c' object='tcexport-framebuffer.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcexport_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tcexport-framebuffer.obj `if test -f '../src/framebuffer.c'; then $(CYGPATH_W) '../src/framebuffer.c'; else $(CYGPATH_W) '$(srcdir)/../src/framebuffer.c'; fi`
+
+tcmodchain-tcmodchain.o: tcmodchain.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcmodchain_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tcmodchain-tcmodchain.o -MD -MP -MF $(DEPDIR)/tcmodchain-tcmodchain.Tpo -c -o tcmodchain-tcmodchain.o `test -f 'tcmodchain.c' || echo '$(srcdir)/'`tcmodchain.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tcmodchain-tcmodchain.Tpo $(DEPDIR)/tcmodchain-tcmodchain.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tcmodchain.c' object='tcmodchain-tcmodchain.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcmodchain_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tcmodchain-tcmodchain.o `test -f 'tcmodchain.c' || echo '$(srcdir)/'`tcmodchain.c
+
+tcmodchain-tcmodchain.obj: tcmodchain.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcmodchain_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tcmodchain-tcmodchain.obj -MD -MP -MF $(DEPDIR)/tcmodchain-tcmodchain.Tpo -c -o tcmodchain-tcmodchain.obj `if test -f 'tcmodchain.c'; then $(CYGPATH_W) 'tcmodchain.c'; else $(CYGPATH_W) '$(srcdir)/tcmodchain.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tcmodchain-tcmodchain.Tpo $(DEPDIR)/tcmodchain-tcmodchain.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tcmodchain.c' object='tcmodchain-tcmodchain.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcmodchain_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tcmodchain-tcmodchain.obj `if test -f 'tcmodchain.c'; then $(CYGPATH_W) 'tcmodchain.c'; else $(CYGPATH_W) '$(srcdir)/tcmodchain.c'; fi`
+
+tcmodchain-tcstub.o: tcstub.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcmodchain_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tcmodchain-tcstub.o -MD -MP -MF $(DEPDIR)/tcmodchain-tcstub.Tpo -c -o tcmodchain-tcstub.o `test -f 'tcstub.c' || echo '$(srcdir)/'`tcstub.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tcmodchain-tcstub.Tpo $(DEPDIR)/tcmodchain-tcstub.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tcstub.c' object='tcmodchain-tcstub.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcmodchain_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tcmodchain-tcstub.o `test -f 'tcstub.c' || echo '$(srcdir)/'`tcstub.c
+
+tcmodchain-tcstub.obj: tcstub.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcmodchain_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tcmodchain-tcstub.obj -MD -MP -MF $(DEPDIR)/tcmodchain-tcstub.Tpo -c -o tcmodchain-tcstub.obj `if test -f 'tcstub.c'; then $(CYGPATH_W) 'tcstub.c'; else $(CYGPATH_W) '$(srcdir)/tcstub.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tcmodchain-tcstub.Tpo $(DEPDIR)/tcmodchain-tcstub.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tcstub.c' object='tcmodchain-tcstub.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcmodchain_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tcmodchain-tcstub.obj `if test -f 'tcstub.c'; then $(CYGPATH_W) 'tcstub.c'; else $(CYGPATH_W) '$(srcdir)/tcstub.c'; fi`
+
+tcmodinfo-tcmodinfo.o: tcmodinfo.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcmodinfo_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tcmodinfo-tcmodinfo.o -MD -MP -MF $(DEPDIR)/tcmodinfo-tcmodinfo.Tpo -c -o tcmodinfo-tcmodinfo.o `test -f 'tcmodinfo.c' || echo '$(srcdir)/'`tcmodinfo.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tcmodinfo-tcmodinfo.Tpo $(DEPDIR)/tcmodinfo-tcmodinfo.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tcmodinfo.c' object='tcmodinfo-tcmodinfo.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcmodinfo_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tcmodinfo-tcmodinfo.o `test -f 'tcmodinfo.c' || echo '$(srcdir)/'`tcmodinfo.c
+
+tcmodinfo-tcmodinfo.obj: tcmodinfo.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcmodinfo_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tcmodinfo-tcmodinfo.obj -MD -MP -MF $(DEPDIR)/tcmodinfo-tcmodinfo.Tpo -c -o tcmodinfo-tcmodinfo.obj `if test -f 'tcmodinfo.c'; then $(CYGPATH_W) 'tcmodinfo.c'; else $(CYGPATH_W) '$(srcdir)/tcmodinfo.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tcmodinfo-tcmodinfo.Tpo $(DEPDIR)/tcmodinfo-tcmodinfo.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tcmodinfo.c' object='tcmodinfo-tcmodinfo.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcmodinfo_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tcmodinfo-tcmodinfo.obj `if test -f 'tcmodinfo.c'; then $(CYGPATH_W) 'tcmodinfo.c'; else $(CYGPATH_W) '$(srcdir)/tcmodinfo.c'; fi`
+
+tcmodinfo-tcstub.o: tcstub.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcmodinfo_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tcmodinfo-tcstub.o -MD -MP -MF $(DEPDIR)/tcmodinfo-tcstub.Tpo -c -o tcmodinfo-tcstub.o `test -f 'tcstub.c' || echo '$(srcdir)/'`tcstub.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tcmodinfo-tcstub.Tpo $(DEPDIR)/tcmodinfo-tcstub.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tcstub.c' object='tcmodinfo-tcstub.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcmodinfo_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tcmodinfo-tcstub.o `test -f 'tcstub.c' || echo '$(srcdir)/'`tcstub.c
+
+tcmodinfo-tcstub.obj: tcstub.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcmodinfo_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tcmodinfo-tcstub.obj -MD -MP -MF $(DEPDIR)/tcmodinfo-tcstub.Tpo -c -o tcmodinfo-tcstub.obj `if test -f 'tcstub.c'; then $(CYGPATH_W) 'tcstub.c'; else $(CYGPATH_W) '$(srcdir)/tcstub.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tcmodinfo-tcstub.Tpo $(DEPDIR)/tcmodinfo-tcstub.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tcstub.c' object='tcmodinfo-tcstub.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tcmodinfo_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tcmodinfo-tcstub.obj `if test -f 'tcstub.c'; then $(CYGPATH_W) 'tcstub.c'; else $(CYGPATH_W) '$(srcdir)/tcstub.c'; fi`
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool ctags distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-binPROGRAMS install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am \
+ uninstall-binPROGRAMS
+
+ aud_scan_avi.h
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/debian/transcode/transcode-1.1.7/tools/aud_scan.c b/debian/transcode/transcode-1.1.7/tools/aud_scan.c
new file mode 100644
index 00000000..68c8c1cb
--- /dev/null
+++ b/debian/transcode/transcode-1.1.7/tools/aud_scan.c
@@ -0,0 +1,364 @@
+/*
+ * aud_scan.c
+ *
+ * Scans the audio track
+ *
+ * Copyright (C) Tilmann Bitterberg - June 2003
+ *
+ * This file is part of transcode, a video stream processing tool
+ *
+ * transcode is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * transcode 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "aud_scan.h"
+
+// MP3
+
+// from mencoder
+//----------------------- mp3 audio frame header parser -----------------------
+
+static int tabsel_123[2][3][16] = {
+ { {0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,0},
+ {0,32,48,56, 64, 80, 96,112,128,160,192,224,256,320,384,0},
+ {0,32,40,48, 56, 64, 80, 96,112,128,160,192,224,256,320,0} },
+
+ { {0,32,48,56,64,80,96,112,128,144,160,176,192,224,256,0},
+ {0,8,16,24,32,40,48,56,64,80,96,112,128,144,160,0},
+ {0,8,16,24,32,40,48,56,64,80,96,112,128,144,160,0} }
+};
+static long freqs[9] = { 44100, 48000, 32000, 22050, 24000, 16000 , 11025 , 12000 , 8000 };
+
+/*
+ * return frame size or -1 (bad frame)
+ */
+int tc_get_mp3_header(uint8_t* hbuf, int* chans, int* srate, int *bitrate){
+ int stereo, ssize, crc, lsf, mpeg25, framesize;
+ int padding, bitrate_index, sampling_frequency;
+ uint32_t newhead =
+ hbuf[0] << 24 |
+ hbuf[1] << 16 |
+ hbuf[2] << 8 |
+ hbuf[3];
+
+ // head_check:
+ if ( (newhead & 0xffe00000) != 0xffe00000
+ || (newhead & 0x0000fc00) == 0x0000fc00) {
+ // fprintf( stderr, "[%s] head_check failed\n", __FILE__);
+ return -1;
+ }
+
+ if ((4 - ((newhead >> 17) & 3)) != 3) {
+ return -1;
+ }
+
+ if (newhead & ((long)1 << 20)) {
+ lsf = (newhead & ((long)1 << 19)) ?0x0 :0x1;
+ mpeg25 = 0;
+ } else {
+ lsf = 1;
+ mpeg25 = 1;
+ }
+
+ if (mpeg25) {
+ sampling_frequency = 6 + ((newhead>>10)&0x3);
+ } else {
+ sampling_frequency = ((newhead>>10)&0x3) + (lsf*3);
+ }
+
+ if (sampling_frequency > 8) {
+ return -1; // valid: 0..8
+ }
+
+ crc = ((newhead >> 16) & 0x1) ^ 0x1;
+ bitrate_index = ((newhead >> 12) & 0xf);
+ padding = ((newhead >> 9) & 0x1);
+
+ stereo = ((((newhead >> 6) & 0x3)) == 3) ?1 :2;
+
+ if (!bitrate_index) {
+ return -1;
+ }
+
+ if (lsf) {
+ ssize = (stereo == 1) ?9 :17;
+ } else {
+ ssize = (stereo == 1) ?17 :32;
+ }
+ if(crc) {
+ ssize += 2;
+ }
+
+ framesize = tabsel_123[lsf][2][bitrate_index] * 144000;
+ if (bitrate) {
+ *bitrate = tabsel_123[lsf][2][bitrate_index];
+ }
+
+ if (!framesize){
+ return -1; // valid: 1..14
+ }
+
+ framesize /= freqs[sampling_frequency]<<lsf;
+ framesize += padding;
+
+ if (srate) {
+ *srate = freqs[sampling_frequency];
+ }
+ if (chans) {
+ *chans = stereo;
+ }
+ return framesize;
+}
+
+static const uint8_t nfchans[] = {
+ 2, 1, 2, 3, 3, 4, 4, 5, 1, 1, 2
+};
+
+struct frmsize_s {
+ uint16_t bit_rate;
+ uint16_t frm_size[3];
+} frmsize_t;
+
+static const struct frmsize_s frmsizecod_tbl[] = {
+ { 32 ,{64 ,69 ,96 } },
+ { 32 ,{64 ,70 ,96 } },
+ { 40 ,{80 ,87 ,120 } },
+ { 40 ,{80 ,88 ,120 } },
+ { 48 ,{96 ,104 ,144 } },
+ { 48 ,{96 ,105 ,144 } },
+ { 56 ,{112 ,121 ,168 } },
+ { 56 ,{112 ,122 ,168 } },
+ { 64 ,{128 ,139 ,192 } },
+ { 64 ,{128 ,140 ,192 } },
+ { 80 ,{160 ,174 ,240 } },
+ { 80 ,{160 ,175 ,240 } },
+ { 96 ,{192 ,208 ,288 } },
+ { 96 ,{192 ,209 ,288 } },
+ { 112 ,{224 ,243 ,336 } },
+ { 112 ,{224 ,244 ,336 } },
+ { 128 ,{256 ,278 ,384 } },
+ { 128 ,{256 ,279 ,384 } },
+ { 160 ,{320 ,348 ,480 } },
+ { 160 ,{320 ,349 ,480 } },
+ { 192 ,{384 ,417 ,576 } },
+ { 192 ,{384 ,418 ,576 } },
+ { 224 ,{448 ,487 ,672 } },
+ { 224 ,{448 ,488 ,672 } },
+ { 256 ,{512 ,557 ,768 } },
+ { 256 ,{512 ,558 ,768 } },
+ { 320 ,{640 ,696 ,960 } },
+ { 320 ,{640 ,697 ,960 } },
+ { 384 ,{768 ,835 ,1152 } },
+ { 384 ,{768 ,836 ,1152 } },
+ { 448 ,{896 ,975 ,1344 } },
+ { 448 ,{896 ,976 ,1344 } },
+ { 512 ,{1024 ,1114 ,1536 } },
+ { 512 ,{1024 ,1115 ,1536 } },
+ { 576 ,{1152 ,1253 ,1728 } },
+ { 576 ,{1152 ,1254 ,1728 } },
+ { 640 ,{1280 ,1393 ,1920 } },
+ { 640 ,{1280 ,1394 ,1920 } }
+};
+
+#define fscd_tbl_entries (sizeof(frmsizecod_tbl)/sizeof(frmsize_t))
+
+static uint32_t get_ac3_header(uint8_t *buf)
+{
+ int i = 0;
+ uint32_t tmp = 0;
+
+ tmp = (tmp << 8) + (buf[i++] & 0xff);
+ tmp = (tmp << 8) + (buf[i++] & 0xff);
+ tmp = (tmp << 8) + (buf[i++] & 0xff);
+
+ return tmp;
+}
+
+static int get_ac3_framesize(uint8_t *buf)
+{
+ int fscod, frmsizecod;
+ uint32_t tmp = get_ac3_header(buf);
+
+ if (tmp < 0) {
+ return -1;
+ }
+
+ fscod = (tmp >> 6) & 0x3;
+ frmsizecod = tmp & 0x3f;
+
+ if (frmsizecod >= fscd_tbl_entries || fscod > 2) {
+ return -1;
+ }
+ return frmsizecod_tbl[frmsizecod].frm_size[fscod];
+}
+
+// FIXME: recheck me up, 1.0.x is reference
+// We try to find the number of chans in the ac3 header (BSI)
+static int get_ac3_nfchans(uint8_t *buf)
+{
+ /* skip syncinfo (size = 5bytes) */
+ /* skip to acmod */
+ int acmod = buf[6]>>5;
+ /* LFE flags is on, we have one more channel */
+ int lfe = ((buf[2] & 0x40) == 0x40);
+
+ if (acmod < 0 || acmod > 11)
+ return -1;
+ return (nfchans[acmod] + lfe);
+}
+
+
+static int get_ac3_bitrate(uint8_t *buf)
+{
+ int frmsizecod = 0;
+ uint32_t tmp = get_ac3_header(buf);
+
+ frmsizecod = tmp & 0x3f;
+
+ if (frmsizecod >= fscd_tbl_entries) {
+ return -1;
+ }
+ return frmsizecod_tbl[frmsizecod].bit_rate;
+}
+
+
+static int get_ac3_samplerate(uint8_t *buf)
+{
+ int fscod, sampling_rate;
+ uint32_t tmp = get_ac3_header(buf);
+
+ // Get the sampling rate
+ fscod = (tmp >> 6) & 0x3;
+
+ if (fscod == 3) {
+ return -1; //invalid sampling rate code
+ } else if (fscod == 2) {
+ sampling_rate = 32000;
+ } else if (fscod == 1) {
+ sampling_rate = 44100;
+ } else {
+ sampling_rate = 48000;
+ }
+ return sampling_rate;
+}
+
+
+int tc_get_ac3_header(uint8_t *_buf, int len, int *chans, int *srate, int *bitrate )
+{
+ int j = 0, i = 0;
+ uint8_t *buffer = _buf;
+ uint16_t sync_word = 0;
+
+ // need to find syncframe:
+
+ for (i = 0; i < len-4; i++) {
+ sync_word = (sync_word << 8) + (uint8_t) buffer[i];
+ if (sync_word == 0x0b77) {
+ break;
+ }
+ }
+
+ if (sync_word != 0x0b77) {
+ return -1;
+ }
+
+ if (srate) {
+ *srate = get_ac3_samplerate(&buffer[i+1]);
+ }
+ if (bitrate) {
+ *bitrate = get_ac3_bitrate(&buffer[i+1]);
+ }
+ if (chans) {
+ *chans = get_ac3_nfchans(&buffer[i+1]);
+ }
+
+ if (j < 0 || bitrate < 0) {
+ return -1;
+ }
+ return 2 * get_ac3_framesize(&buffer[i+1]);
+}
+
+
+int tc_get_audio_header(uint8_t *buf, int buflen, int format, int *chans, int *srate, int *bitrate )
+{
+ switch (format) {
+ case 0x55: // MP3
+ return tc_get_mp3_header(buf, chans, srate, bitrate);
+ break;
+ case 0x2000: // AC3
+ return tc_get_ac3_header(buf, buflen, chans, srate, bitrate);
+ break;
+ default:
+ return -1;
+ }
+ return -1;
+}
+
+int tc_probe_audio_header(uint8_t *buf, int buflen)
+{
+ if (tc_get_mp3_header(buf, NULL, NULL, NULL) > 0) {
+ return 0x55;
+ }
+ if (tc_get_ac3_header(buf, buflen, NULL, NULL, NULL) > 0) {
+ return 0x2000;
+ }
+ return -1;
+}
+
+int tc_format_ms_supported(int format)
+{
+ return (format == 0x55 /* MP3 */
+ || format == 0x2000 /* AC3 */
+ || format == 0x1); /* PCM */
+}
+
+void tc_format_mute(uint8_t *buf, int buflen, int format)
+{
+ switch (format) {
+ case 0x1:
+ memset(buf + 0, 0, buflen - 0);
+ break;
+ case 0x55:
+ memset(buf + 4, 0, buflen - 4);
+ break;
+ case 0x2000:
+ // check me!
+ memset(buf + 5, 0, buflen - 5);
+ break;
+ default: /* we're already fine */
+ break;
+ }
+}
+
+/*************************************************************************/
+
+/*
+ * Local variables:
+ * c-file-style: "stroustrup"
+ * c-file-offsets: ((case-label . *) (statement-case-intro . *))
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+ */
diff --git a/debian/transcode/transcode-1.1.7/tools/aud_scan.h b/debian/transcode/transcode-1.1.7/tools/aud_scan.h
new file mode 100644
index 00000000..dddfbfa7
--- /dev/null
+++ b/debian/transcode/transcode-1.1.7/tools/aud_scan.h
@@ -0,0 +1,36 @@
+/*
+ * aud_scan.h
+ *
+ * Scans the audio track
+ *
+ * Copyright (C) Tilmann Bitterberg - June 2003
+ *
+ * This file is part of transcode, a video stream processing tool
+ *
+ * transcode is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * transcode 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+int tc_get_mp3_header(unsigned char* hbuf, int* chans, int* srate, int *bitrate);
+#define tc_decode_mp3_header(hbuf) tc_get_mp3_header(hbuf, NULL, NULL, NULL)
+int tc_get_ac3_header(unsigned char* _buf, int len, int* chans, int* srate, int *bitrate);
+
+// main entrance
+int tc_get_audio_header(unsigned char* buf, int buflen, int format, int* chans, int* srate, int *bitrate);
+int tc_probe_audio_header(unsigned char* buf, int buflen);
+
+int tc_format_ms_supported(int format);
+void tc_format_mute(unsigned char *buf, int buflen, int format);
+
diff --git a/debian/transcode/transcode-1.1.7/tools/aud_scan_avi.c b/debian/transcode/transcode-1.1.7/tools/aud_scan_avi.c
new file mode 100644
index 00000000..655e4450
--- /dev/null
+++ b/debian/transcode/transcode-1.1.7/tools/aud_scan_avi.c
@@ -0,0 +1,199 @@
+/*
+ * aud_scan_avi.c
+ *
+ * Scans the audio track - AVI specific functions
+ *
+ * Copyright (C) Tilmann Bitterberg - June 2003
+ *
+ * This file is part of transcode, a video stream processing tool
+ *
+ * transcode is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * transcode 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "aud_scan_avi.h"
+#include "aud_scan.h"
+
+// ------------------------
+// You must set the requested audio before entering this function
+// the AVI file out must be filled with correct values.
+// ------------------------
+
+int sync_audio_video_avi2avi (double vid_ms, double *aud_ms, avi_t *in, avi_t *out)
+{
+ static char *data = NULL;
+ int vbr = AVI_get_audio_vbr(out);
+ int mp3rate = AVI_audio_mp3rate(out);
+ int format = AVI_audio_format(out);
+ int chan = AVI_audio_channels(out);
+ long rate = AVI_audio_rate(out);
+ int bits = AVI_audio_bits(out);
+ long bytes = 0;
+
+ bits = (bits == 0)?16:bits;
+
+ if (!data) data = malloc(48000*16*4);
+ if (!data) fprintf (stderr, "Malloc failed at %s:%d\n", __FILE__, __LINE__);
+
+ if (format == 0x1) {
+ mp3rate = rate*chan*bits;
+ } else {
+ mp3rate *= 1000;
+ }
+
+ if (tc_format_ms_supported(format)) {
+
+ while (*aud_ms < vid_ms) {
+
+ if( (bytes = AVI_read_audio_chunk(in, data)) < 0) {
+ AVI_print_error("AVI audio read frame");
+ //*aud_ms = vid_ms;
+ return(-2);
+ }
+ //fprintf(stderr, "len (%ld)\n", bytes);
+
+ if(AVI_write_audio(out, data, bytes)<0) {
+ AVI_print_error("AVI write audio frame");
+ return(-1);
+ }
+
+ // pass-through null frames
+ if (bytes == 0) {
+ *aud_ms = vid_ms;
+ break;
+ }
+
+ if ( vbr && tc_get_audio_header(data, bytes, format, NULL, NULL, &mp3rate)<0) {
+ // if this is the last frame of the file, slurp in audio chunks
+ //if (n == frames-1) continue;
+ *aud_ms = vid_ms;
+ } else {
+ if (vbr) mp3rate *= 1000;
+ *aud_ms += (bytes*8.0*1000.0)/(double)mp3rate;
+ }
+ /*
+ fprintf(stderr, "%s track (%d) %8.0lf->%8.0lf len (%ld) rate (%ld)\n",
+ format==0x55?"MP3":format==0x1?"PCM":"AC3",
+ j, vid_ms, aud_ms[j], bytes, mp3rate);
+ */
+ }
+
+ } else { // fallback for not supported audio format
+
+ do {
+ if ( (bytes = AVI_read_audio_chunk(in, data) ) < 0) {
+ AVI_print_error("AVI audio read frame");
+ return -2;
+ }
+
+ if(AVI_write_audio(out, data, bytes)<0) {
+ AVI_print_error("AVI write audio frame");
+ return(-1);
+ }
+ } while (AVI_can_read_audio(in));
+ }
+
+
+ return 0;
+}
+
+int sync_audio_video_avi2avi_ro (double vid_ms, double *aud_ms, avi_t *in)
+{
+ static char *data = NULL;
+ int vbr = AVI_get_audio_vbr(in);
+ int mp3rate = AVI_audio_mp3rate(in);
+ int format = AVI_audio_format(in);
+ int chan = AVI_audio_channels(in);
+ long rate = AVI_audio_rate(in);
+ int bits = AVI_audio_bits(in);
+ long bytes = 0;
+
+ bits = (bits == 0)?16:bits;
+
+ if (!data) data = malloc(48000*16*4);
+ if (!data) fprintf (stderr, "Malloc failed at %s:%d\n", __FILE__, __LINE__);
+
+ if (format == 0x1) {
+ mp3rate = rate*chan*bits;
+ } else {
+ mp3rate *= 1000;
+ }
+
+ if (tc_format_ms_supported(format)) {
+
+ while (*aud_ms < vid_ms) {
+
+ if( (bytes = AVI_read_audio_chunk(in, data)) < 0) {
+ AVI_print_error("AVI audio read frame");
+ //*aud_ms = vid_ms;
+ return(-2);
+ }
+ //fprintf(stderr, "len (%ld)\n", bytes);
+
+ // pass-through null frames
+ if (bytes == 0) {
+ *aud_ms = vid_ms;
+ break;
+ }
+
+ if ( vbr && tc_get_audio_header(data, bytes, format, NULL, NULL, &mp3rate)<0) {
+ // if this is the last frame of the file, slurp in audio chunks
+ //if (n == frames-1) continue;
+ *aud_ms = vid_ms;
+ } else {
+ if (vbr) mp3rate *= 1000;
+ *aud_ms += (bytes*8.0*1000.0)/(double)mp3rate;
+ }
+ /*
+ fprintf(stderr, "%s track (%d) %8.0lf->%8.0lf len (%ld) rate (%ld)\n",
+ format==0x55?"MP3":format==0x1?"PCM":"AC3",
+ j, vid_ms, aud_ms[j], bytes, mp3rate);
+ */
+ }
+
+ } else { // fallback for not supported audio format
+
+ do {
+ if ( (bytes = AVI_read_audio_chunk(in, data) ) < 0) {
+ AVI_print_error("AVI audio read frame");
+ return -2;
+ }
+ } while (AVI_can_read_audio(in));
+ }
+
+
+ return 0;
+}
+
+/*************************************************************************/
+
+/*
+ * Local variables:
+ * c-file-style: "stroustrup"
+ * c-file-offsets: ((case-label . *) (statement-case-intro . *))
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+ */
diff --git a/debian/transcode/transcode-1.1.7/tools/aud_scan_avi.h b/debian/transcode/transcode-1.1.7/tools/aud_scan_avi.h
new file mode 100644
index 00000000..8e9bcd33
--- /dev/null
+++ b/debian/transcode/transcode-1.1.7/tools/aud_scan_avi.h
@@ -0,0 +1,34 @@
+/*
+ * aud_scan_avi.h
+ *
+ * Scans the audio track - AVI specific functions
+ *
+ * Copyright (C) Tilmann Bitterberg - June 2003
+ *
+ * This file is part of transcode, a video stream processing tool
+ *
+ * transcode is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * transcode 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#include "avilib/avilib.h"
+
+// ------------------------
+// You must set the requested audio before entering this function
+// the AVI file out must be filled with correct values.
+// ------------------------
+
+int sync_audio_video_avi2avi (double vid_ms, double *aud_ms, avi_t *in, avi_t *out);
+int sync_audio_video_avi2avi_ro (double vid_ms, double *aud_ms, avi_t *in);
diff --git a/debian/transcode/transcode-1.1.7/tools/avifix.c b/debian/transcode/transcode-1.1.7/tools/avifix.c
new file mode 100644
index 00000000..cfd7d6ac
--- /dev/null
+++ b/debian/transcode/transcode-1.1.7/tools/avifix.c
@@ -0,0 +1,335 @@
+/*
+ * avifix.c
+ *
+ * Copyright (C) Thomas Oestreich - June 2001
+ *
+ * This file is part of transcode, a video stream processing tool
+ *
+ * transcode is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * transcode 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#include "transcode.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+
+#include "avilib/avilib.h"
+
+#define EXE "avifix"
+
+/* AVI_info is no longer in avilib */
+void AVI_info(avi_t *avifile);
+
+void version(void)
+{
+ printf("%s (%s v%s) (C) 2001-2003 Thomas Oestreich,"
+ " 2003-2010 Transcode Team\n",
+ EXE, PACKAGE, VERSION);
+}
+
+static void usage(int status)
+{
+ version();
+ printf("\nUsage: %s [options]\n", EXE);
+ printf(" -i name AVI file name\n");
+ printf(" -F string video codec FOURCC\n");
+ printf(" -f val1,val2 video frame rate (fps=val1/val2)\n");
+ printf(" -N 0xnn audio format identifier\n");
+ printf(" -b bitrate audio encoder bitrate (kbps)\n");
+ printf(" -e r[,b[,c]] audio stream parameter (samplerate,bits,channels)\n");
+ printf(" -a num audio track number [0]\n");
+ printf(" -d print debug information\n");
+ printf(" -v print version\n");
+ exit(status);
+}
+
+/* read or die! */
+static void hdr_read(const char *tag, int fd, void *hdr, size_t bytes)
+{
+ ssize_t r = read(fd, hdr, bytes);
+ if (bytes != r) {
+ tc_log_error(EXE, "(%s) error reading AVI-file", tag);
+ exit(1);
+ }
+}
+
+/* write or die! */
+static void hdr_write(const char *tag, int fd, const void *hdr, size_t bytes)
+{
+ ssize_t w = write(fd, hdr, bytes);
+ if (bytes != w) {
+ tc_log_error(EXE, "(%s) error writing AVI-file", tag);
+ exit(1);
+ }
+}
+
+
+#define VALIDATE_OPTION if (optarg[0]=='-') usage(EXIT_FAILURE)
+
+enum {
+ /* video in the lower bits */
+ CHANGE_VIDEO_FOURCC = (1UL),
+ CHANGE_VIDEO_FPS = (1UL << 1),
+ /* audio in the higher bits */
+ CHANGE_AUDIO_FMT = (1UL << 16),
+ CHANGE_AUDIO_BR = (1UL << 17),
+ CHANGE_AUDIO_RATE = (1UL << 18),
+ CHANGE_AUDIO_BITS = (1UL << 19),
+ CHANGE_AUDIO_CHANS = (1UL << 20)
+};
+#define CHANGE_NOTHING (0UL)
+#define NEED_AUDIO_CHANGE(FLAGS) (FLAGS & 0xFFFF0000)
+#define NEED_VIDEO_CHANGE(FLAGS) (FLAGS & 0x0000FFFF)
+
+
+
+int main(int argc, char *argv[])
+{
+ struct common_struct rtf;
+ struct AVIStreamHeader ash, vsh;
+ avi_t *avifile;
+ int err, fd, id = 0, track_num = 0, n, ch, debug = TC_FALSE;
+ int brate = 0, val1 = 0, val2 = 1, a_rate, a_chan, a_bits;
+ long ah_off = 0, af_off = 0, vh_off = 0, vf_off = 0;
+ char codec[5], *str = NULL, *filename = NULL;
+ uint32_t change = CHANGE_NOTHING;
+
+ ac_init(AC_ALL);
+
+ if (argc==1) usage(EXIT_FAILURE);
+
+ while ((ch = getopt(argc, argv, "df:i:N:F:vb:e:a:?h")) != -1) {
+ switch (ch) {
+ case 'N':
+ VALIDATE_OPTION;
+ id = strtol(optarg, NULL, 16);
+ if (id < 0) {
+ tc_log_error(EXE, "invalid parameter set for option -N");
+ } else {
+ change |= CHANGE_AUDIO_FMT;
+ }
+ break;
+
+ case 'a':
+ VALIDATE_OPTION;
+ track_num = atoi(optarg);
+ if (track_num < 0)
+ usage(EXIT_FAILURE);
+ break;
+
+ case 'f':
+ VALIDATE_OPTION;
+ n = sscanf(optarg,"%d,%d", &val1, &val2);
+ if (n != 2 || val1 < 0 || val2 < 0) {
+ tc_log_error(EXE, "invalid parameter set for option -f");
+ } else {
+ change |= CHANGE_VIDEO_FPS;
+ }
+ break;
+
+ case 'F':
+ VALIDATE_OPTION;
+ str = optarg;
+ if(strlen(str) > 4 || strlen(str) == 0) {
+ tc_log_error(EXE, "invalid parameter set for option -F");
+ } else {
+ change |= CHANGE_VIDEO_FOURCC;
+ }
+ break;
+
+ case 'i':
+ VALIDATE_OPTION;
+ filename = optarg;
+ break;
+
+ case 'b':
+ VALIDATE_OPTION;
+ brate = atoi(optarg);
+ change |= CHANGE_AUDIO_BR;
+ break;
+
+ case 'v':
+ version();
+ exit(0);
+
+ case 'e':
+ VALIDATE_OPTION;
+ n = sscanf(optarg,"%d,%d,%d", &a_rate, &a_bits, &a_chan);
+ switch (n) {
+ case 3:
+ change |= CHANGE_AUDIO_RATE;
+ case 2:
+ change |= CHANGE_AUDIO_BITS;
+ case 1:
+ change |= CHANGE_AUDIO_CHANS;
+ break;
+ default:
+ tc_log_error(EXE, "invalid parameter set for option -e");
+ }
+ break;
+
+ case 'd':
+ debug = TC_TRUE;
+ break;
+ case 'h':
+ usage(EXIT_SUCCESS);
+ default:
+ usage(EXIT_FAILURE);
+ }
+ }
+
+ if (!filename)
+ usage(EXIT_FAILURE);
+
+ tc_log_info(EXE, "scanning AVI-file %s for header information", filename);
+
+ avifile = AVI_open_input_file(filename, 1);
+ if (!avifile) {
+ AVI_print_error("AVI open");
+ exit(1);
+ }
+
+ AVI_info(avifile);
+
+ if (AVI_set_audio_track(avifile, track_num) < 0) {
+ tc_log_error(EXE, "invalid audio track");
+ }
+
+ ah_off = AVI_audio_codech_offset(avifile);
+ af_off = AVI_audio_codecf_offset(avifile);
+ vh_off = AVI_video_codech_offset(avifile);
+ vf_off = AVI_video_codecf_offset(avifile);
+
+ if (debug) {
+ tc_log_info(EXE,
+ "offsets: ah=%li af=%li vh=%li vf=%li",
+ ah_off, af_off, vh_off, vf_off);
+ }
+
+ AVI_close(avifile);
+
+ fd = open(filename, O_RDWR);
+ if (fd < 0) {
+ perror("open");
+ exit(1);
+ }
+
+ lseek(fd, vh_off, SEEK_SET);
+ hdr_read("video codec [h]", fd, codec, 4);
+ codec[4] = 0;
+
+ lseek(fd, vf_off, SEEK_SET);
+ hdr_read("video codec [f]", fd, codec, 4);
+ codec[4] = 0;
+
+ if (change & CHANGE_VIDEO_FPS) {
+ lseek(fd, vh_off-4, SEEK_SET);
+ hdr_read("video fps", fd, &vsh, sizeof(vsh));
+
+ vsh.dwRate = (long)val1;
+ vsh.dwScale = (long)val2;
+
+ lseek(fd, vh_off-4, SEEK_SET);
+ hdr_write("video fps", fd, &vsh, sizeof(vsh));
+ }
+
+ if (change & CHANGE_VIDEO_FOURCC) {
+ lseek(fd,vh_off,SEEK_SET);
+
+ if (strncmp(str,"RGB",3) == 0) {
+ hdr_write("video 4cc", fd, codec, 4);
+ } else {
+ hdr_write("video 4cc", fd, str, 4);
+ }
+
+ lseek(fd,vf_off,SEEK_SET);
+
+ if(strncmp(str,"RGB",3)==0) {
+ memset(codec, 0, 4);
+ hdr_write("video 4cc", fd, codec, 4);
+ } else {
+ hdr_write("video 4cc", fd, str, 4);
+ }
+ }
+
+ if (NEED_AUDIO_CHANGE(change)) {
+ lseek(fd, ah_off, SEEK_SET);
+ hdr_read("audio header [h]", fd, &ash, sizeof(ash));
+
+ lseek(fd, af_off, SEEK_SET);
+ hdr_read("audio header [f]", fd, &rtf, sizeof(rtf));
+
+ if (change & CHANGE_AUDIO_FMT) {
+ rtf.wFormatTag = (unsigned short) id;
+ }
+ if (change & CHANGE_AUDIO_BR) {
+ rtf.dwAvgBytesPerSec = (long) 1000*brate/8;
+ ash.dwRate = (long) 1000*brate/8;
+ ash.dwScale = 1;
+ }
+ if (change & CHANGE_AUDIO_CHANS) {
+ rtf.wChannels = (short) a_chan;
+ }
+ if (change & CHANGE_AUDIO_BITS) {
+ rtf.wBitsPerSample = (short) a_bits;
+ }
+ if (change & CHANGE_AUDIO_RATE) {
+ rtf.dwSamplesPerSec = (long) a_rate;
+ }
+
+ lseek(fd, ah_off ,SEEK_SET);
+ hdr_write("audio header [h]", fd, &ash, sizeof(ash));
+ lseek(fd, af_off ,SEEK_SET);
+ hdr_write("audio header [f]", fd, &rtf, sizeof(rtf));
+ }
+
+ err = close(fd);
+ if (err) {
+ perror("close");
+ exit(1);
+ }
+
+ avifile = AVI_open_input_file(filename, 1);
+ if (!avifile) {
+ AVI_print_error("AVI open");
+ exit(1);
+ }
+
+ tc_log_info(EXE, "updated AVI file %s", filename);
+
+ AVI_info(avifile);
+
+ AVI_close(avifile);
+
+ return 0;
+}
+
+/*************************************************************************/
+
+/*
+ * Local variables:
+ * c-file-style: "stroustrup"
+ * c-file-offsets: ((case-label . *) (statement-case-intro . *))
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+ */
diff --git a/debian/transcode/transcode-1.1.7/tools/aviindex.c b/debian/transcode/transcode-1.1.7/tools/aviindex.c
new file mode 100644
index 00000000..8a34234f
--- /dev/null
+++ b/debian/transcode/transcode-1.1.7/tools/aviindex.c
@@ -0,0 +1,914 @@
+/*
+ * aviindex.c
+ *
+ * extracts the index of an AVI file for easy seeking with --nav_seek
+ *
+ * Copyright (C) Tilmann Bitterberg - June 2003
+ *
+ * This file is part of transcode, a video stream processing tool
+ *
+ * transcode is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * transcode 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#include "transcode.h"
+
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include "libtc/xio.h"
+
+#include "aud_scan.h"
+
+#define EXE "aviindex"
+
+/* AVI_info is no longer in avilib */
+void AVI_info(avi_t *avifile);
+
+void version(void)
+{
+ printf("%s (%s v%s) (C) 2003-2004 Tilmann Bitterberg,"
+ " 2004-2010 Transcode Team\n",
+ EXE, PACKAGE, VERSION);
+}
+
+
+static void usage(int status)
+{
+ version();
+ printf("\nUsage: %s [options]\n", EXE);
+ printf(" -o file output file\n");
+ printf(" -i file input file\n");
+ printf(" -f force the use of the existing index\n");
+ printf(" only to use when avi > 2GB, because\n");
+ printf(" the default is to -n with big files\n");
+ printf(" -n read index in \"smart\" mode: don't use the existing index\n");
+ printf(" -x don't use the existing index to generate the keyframes\n");
+ printf(" this flag forces -n\n");
+ printf(" -v print version\n");
+ exit(status);
+}
+
+#define PAD_EVEN(x) ( ((x)+1) & ~1 )
+static unsigned long str2ulong(unsigned char *str)
+{
+ return ( str[0] | (str[1]<<8) | (str[2]<<16) | (str[3]<<24) );
+}
+
+#define AVI_MAX_LEN (UINT_MAX-(1<<20)*16-2048)
+
+static inline uint32_t SWAP(uint32_t a) {
+#ifdef WORDS_BIGENDIAN
+ return ( (a<<24&0xff000000) | (a<< 8&0x00ff0000) |
+ (a>> 8&0x0000ff00) | (a>>24&0x000000ff));
+#else
+ return a;
+#endif
+}
+
+static inline int avi_stream_id(unsigned int id){
+ unsigned char *p=(unsigned char *)&id;
+ unsigned char a,b;
+#if WORDS_BIGENDIAN
+ a=p[3]-'0'; b=p[2]-'0';
+#else
+ a=p[0]-'0'; b=p[1]-'0';
+#endif
+ if(a>9 || b>9) return 100; // invalid ID
+ return a*10+b;
+}
+
+// returns 1 for video
+// 2 for 1st audio
+// 3 for 2nd audio
+static int avi_stream_nr(int id)
+{
+ unsigned char *p = (unsigned char *)&id;
+
+#if WORDS_BIGENDIAN
+ if (p[1] == 'd') {
+ return 1;
+ } else {
+ int res = (p[3]-'0')+(p[2]-'0');
+ res = (res==0)?2:res+1;
+ return res;
+ }
+#else
+ if (p[2] == 'd') {
+ return 1;
+ } else {
+ int res = (p[0]-'0')+(p[1]-'0');
+ res = (res==0)?2:res+1;
+ return res;
+ }
+#endif
+ return 0;
+}
+
+const int LEN=10;
+
+typedef enum {
+ UNKNOWN = 0,
+ RIFF,
+ AVIIDX1,
+ MPIDX1,
+} ftype_t;
+
+typedef struct {
+ uint32_t ckid;
+ uint32_t dwFlags;
+ uint32_t dwChunkOffset;
+ uint32_t dwChunkLength;
+} AVIINDEXENTRY;
+
+static int aviidx1_to_mpidx1(char *in_file, FILE *out_fd)
+{
+ char *data;
+ FILE *in;
+ int size=0, i;
+ AVIINDEXENTRY *idx;
+ char line[255], d;
+
+ in = fopen (in_file, "r");
+ if (!in) return 1;
+
+ // skip header
+ fgets (line, 255, in);
+ fgets (line, 255, in);
+ while (fgets(line, 255, in)) {
+ d = line[5] - '1';
+ if (d == 0) {
+ size++;
+ } else if (d == 1 || d == 2 || d == 3 || d == 4 ||
+ d == 5 || d == 6 || d == 7 || d == 8 ) {
+ size++;
+ } else continue;
+ }
+ data = malloc (size * sizeof (AVIINDEXENTRY));
+ fseek(in, 0, SEEK_SET);
+ fgets (line, 255, in); fgets (line, 255, in);
+
+ i = size;
+ idx = &((AVIINDEXENTRY *)data)[0];
+ while (fgets(line, 255, in) && i--) {
+ char *c=line;
+ idx->ckid=*(int *)c;
+ idx->ckid=SWAP(idx->ckid);
+ c = strchr(c, ' ')+1; // type
+ c = strchr(c, ' ')+1; // chunk
+ c = strchr(c, ' ')+1; // chunk/type
+ c = strchr(c, ' ')+1; // pos
+ idx->dwChunkOffset = strtol(c, &c, 10);
+ idx->dwChunkLength = strtol(c+1, &c, 10);
+ idx->dwFlags = strtol(c+1, &c, 10);
+ idx->dwFlags = idx->dwFlags?0x10:0;
+ idx++;
+
+ }
+ fwrite ("MPIDX1", 6, 1, out_fd);
+ fwrite (&size, 4, 1, out_fd);
+ fwrite (data, sizeof(AVIINDEXENTRY), size, out_fd);
+
+ free(data);
+ fclose (in);
+ fclose(out_fd);
+ return 0;
+}
+
+static int mpidx1_to_aviidx1(char *in_file, FILE *out_fd)
+{
+ char head[10];
+ char *data;
+ FILE *in;
+ int size, i;
+ AVIINDEXENTRY *idx;
+ int streams[100];
+
+ in = fopen (in_file, "r");
+ if (!in) return 1;
+ fread (head, 10, 1, in);
+
+ // header. Magic tag is AVIIDX1
+ fprintf(out_fd, "AVIIDX1 # Generated by %s (%s-%s)\n", EXE, PACKAGE, VERSION); // Magic
+ fprintf(out_fd, "TAG TYPE CHUNK CHUNK/TYPE POS LEN KEY MS\n");
+
+ size = *(int *)(head+6);
+ data = malloc (size * sizeof(AVIINDEXENTRY));
+ memset (streams, 0, sizeof(streams));
+ if (size != fread (data, sizeof(AVIINDEXENTRY), size, in)) {
+ perror("fread"); return 1;
+ }
+ for (i = 0; i<size; i++) {
+ uint32_t ckid;
+ idx = &((AVIINDEXENTRY *)data)[i];
+ ckid = SWAP(idx->ckid);
+ fprintf(out_fd,
+ "%.4s %d %d %d %d %d %d 0\n",
+ (char *)&ckid,
+ avi_stream_nr(idx->ckid),
+ i,
+ streams[avi_stream_id(idx->ckid)],
+ idx->dwChunkOffset,
+ idx->dwChunkLength,
+ idx->dwFlags?1:0);
+
+ streams[avi_stream_id(idx->ckid)]++;
+ }
+
+
+ free(data);
+ fclose (in);
+ fclose(out_fd);
+
+ return 0;
+}
+
+// data is only 8 bytes long
+static int AVI_read_data_fast(avi_t *AVI, char *buf, off_t *pos, off_t *len, off_t *key, char *data)
+{
+
+/*
+ * Return codes:
+ *
+ * 0 = reached EOF
+ * 1 = video data read
+ * 2 = audio data read from track 0
+ * 3 = audio data read from track 1
+ * 4 = audio data read from track 2
+ * ....
+ * 10 = traditional idx1 chunk
+ */
+
+ off_t n;
+ int rlen;
+ *key=(off_t)0;
+
+ if(AVI->mode==AVI_MODE_WRITE) return 0;
+
+ while(1)
+ {
+ /* Read tag and length */
+
+ if( xio_read(AVI->fdes,data,8) != 8 ) return 0;
+
+ n = PAD_EVEN(str2ulong(data+4));
+
+ if(strncasecmp(data,"LIST",4) == 0 ||
+ strncasecmp(data,"RIFF",4) == 0) { // prevents skipping extended RIFF chunks
+ if( xio_read(AVI->fdes,data,4) != 4 ) return 0;
+ n -= 4;
+ // put here tags of lists that need to be looked into
+ if(strncasecmp(data,"movi",4) == 0 ||
+ strncasecmp(data,"rec ",4) == 0 ||
+ strncasecmp(data,"AVI ",4) == 0 ||
+ strncasecmp(data,"AVIX",4) == 0) {
+ // xio_lseek(AVI->fdes,-4,SEEK_CUR);
+ continue; // proceed to look into it
+ } // otherwise seek over it later on
+ }
+
+ // the following list of comparisons should not include list tags;
+ // these should all go in the list above
+ if(strncasecmp(data,"IDX1",4) == 0)
+ {
+ // deal with it to extract keyframe info
+ *len = str2ulong(data+4);
+ *pos = xio_lseek(AVI->fdes, 0, SEEK_CUR)-(off_t)8;
+ //fprintf (stderr, "Found an index chunk at %lld len %lld\n", *pos, *len);
+ if(xio_lseek(AVI->fdes,n,SEEK_CUR)==(off_t)-1) return 0;
+ return 10;
+ }
+
+ if(strncasecmp(data,AVI->video_tag,3) == 0)
+ {
+ *len = str2ulong(data+4);
+ *pos = xio_lseek(AVI->fdes, 0, SEEK_CUR)-(off_t)8;
+ AVI->video_pos++;
+ rlen = n;
+ xio_read(AVI->fdes, buf, rlen);
+ if(xio_lseek(AVI->fdes,n-rlen,SEEK_CUR)==(off_t)-1) return 0;
+ return 1;
+ }
+ else if(AVI->anum>=1 && strncasecmp(data,AVI->track[0].audio_tag,4) == 0)
+ {
+ *len = str2ulong(data+4);
+ *pos = xio_lseek(AVI->fdes, 0, SEEK_CUR)-(off_t)8;
+ AVI->track[0].audio_posc++;
+ rlen = (n<LEN)?n:LEN;
+ xio_read(AVI->fdes, buf, rlen);
+ if(xio_lseek(AVI->fdes,n-rlen,SEEK_CUR)==(off_t)-1) return 0;
+ return 2;
+ break;
+ }
+ else if(AVI->anum>=2 && strncasecmp(data,AVI->track[1].audio_tag,4) == 0)
+ {
+ *len = str2ulong(data+4);
+ *pos = xio_lseek(AVI->fdes, 0, SEEK_CUR)-(off_t)8;
+ AVI->track[1].audio_posc++;
+ rlen = (n<LEN)?n:LEN;
+ xio_read(AVI->fdes, buf, rlen);
+ if(xio_lseek(AVI->fdes,n-rlen,SEEK_CUR)==(off_t)-1) return 0;
+ return 3;
+ break;
+ }
+ else if(AVI->anum>=3 && strncasecmp(data,AVI->track[2].audio_tag,4) == 0)
+ {
+ *len = str2ulong(data+4);
+ *pos = xio_lseek(AVI->fdes, 0, SEEK_CUR)-(off_t)8;
+ AVI->track[2].audio_posc++;
+ rlen = (n<LEN)?n:LEN;
+ xio_read(AVI->fdes, buf, rlen);
+ if(xio_lseek(AVI->fdes,n-rlen,SEEK_CUR)==(off_t)-1) return 0;
+ return 4;
+ break;
+ }
+ else if(AVI->anum>=4 && strncasecmp(data,AVI->track[3].audio_tag,4) == 0)
+ {
+ *len = str2ulong(data+4);
+ *pos = xio_lseek(AVI->fdes, 0, SEEK_CUR)-(off_t)8;
+ AVI->track[3].audio_posc++;
+ rlen = (n<LEN)?n:LEN;
+ xio_read(AVI->fdes, buf, rlen);
+ if(xio_lseek(AVI->fdes,n-rlen,SEEK_CUR)==(off_t)-1) return 0;
+ return 5;
+ break;
+ }
+ else if(AVI->anum>=5 && strncasecmp(data,AVI->track[4].audio_tag,4) == 0)
+ {
+ *len = str2ulong(data+4);
+ *pos = xio_lseek(AVI->fdes, 0, SEEK_CUR)-(off_t)8;
+ AVI->track[4].audio_posc++;
+ rlen = (n<LEN)?n:LEN;
+ xio_read(AVI->fdes, buf, rlen);
+ if(xio_lseek(AVI->fdes,n-rlen,SEEK_CUR)==(off_t)-1) return 0;
+ return 6;
+ break;
+ }
+ else if(AVI->anum>=6 && strncasecmp(data,AVI->track[5].audio_tag,4) == 0)
+ {
+ *len = str2ulong(data+4);
+ *pos = xio_lseek(AVI->fdes, 0, SEEK_CUR)-(off_t)8;
+ AVI->track[5].audio_posc++;
+ rlen = (n<LEN)?n:LEN;
+ xio_read(AVI->fdes, buf, rlen);
+ if(xio_lseek(AVI->fdes,n-rlen,SEEK_CUR)==(off_t)-1) return 0;
+ return 7;
+ break;
+ }
+ else if(AVI->anum>=7 && strncasecmp(data,AVI->track[6].audio_tag,4) == 0)
+ {
+ *len = str2ulong(data+4);
+ *pos = xio_lseek(AVI->fdes, 0, SEEK_CUR)-(off_t)8;
+ AVI->track[6].audio_posc++;
+ rlen = (n<LEN)?n:LEN;
+ xio_read(AVI->fdes, buf, rlen);
+ if(xio_lseek(AVI->fdes,n-rlen,SEEK_CUR)==(off_t)-1) return 0;
+ return 8;
+ break;
+ }
+ else if(AVI->anum>=8 && strncasecmp(data,AVI->track[7].audio_tag,4) == 0)
+ {
+ *len = str2ulong(data+4);
+ *pos = xio_lseek(AVI->fdes, 0, SEEK_CUR)-(off_t)8;
+ AVI->track[7].audio_posc++;
+ rlen = (n<LEN)?n:LEN;
+ xio_read(AVI->fdes, buf, rlen);
+ if(xio_lseek(AVI->fdes,n-rlen,SEEK_CUR)==(off_t)-1) return 0;
+ return 9;
+ break;
+ } else {
+ if(xio_lseek(AVI->fdes,n,SEEK_CUR)==(off_t)-1) return 0;
+ }
+ // else if(xio_lseek(AVI->fdes,n,SEEK_CUR)==(off_t)-1) return 0;
+ }
+}
+
+static int is_key(unsigned char *data, long size, char *codec)
+{
+ if (strncasecmp(codec, "div3", 4) == 0) {
+
+ int32_t c=( (data[0]<<24) | (data[1]<<16) | (data[2]<<8) | (data[3]&0xff) );
+ if(c&0x40000000) return(0);
+ else return 1;
+
+ } else if (strncasecmp(codec, "xvid", 4) == 0 || strncasecmp(codec, "divx", 4) == 0
+ || strncasecmp(codec, "dx50", 4) == 0 || strncasecmp(codec, "div4", 4) == 0
+ || strncasecmp(codec, "mpg4", 4) == 0) {
+ int result = 0;
+ int i;
+
+ for(i = 0; i < size - 5; i++)
+ {
+ if( data[i] == 0x00 && data[i + 1] == 0x00 &&
+ data[i + 2] == 0x01 && data[i + 3] == 0xb6) {
+
+ if((data[i + 4] & 0xc0) == 0x0) return 1;
+ else return 0;
+ }
+ }
+
+ return result;
+
+ }
+
+ // mjpeg, uncompressed, etc
+ return 1;
+
+}
+
+
+int main(int argc, char *argv[])
+{
+
+ avi_t *avifile1=NULL;
+
+ char *in_file=NULL, *out_file=NULL;
+
+ long frames;
+
+ double fps;
+
+ int track_num=0, aud_tracks;
+
+ int ret;
+ long i=0, chunk=0;
+
+ int ch;
+ int progress=0, old_progress=0;
+
+ long rate;
+ int format, chan, bits;
+ int aud_bitrate = 0;
+
+ FILE *out_fd = NULL;
+ int open_without_index=0,index_keyframes=0;
+ int force_with_index=0;
+
+ double vid_ms = 0.0, print_ms = 0.0;
+ double aud_ms [ AVI_MAX_TRACKS ];
+ char tag[8];
+ char *data;
+ int vid_chunks=0, aud_chunks[AVI_MAX_TRACKS];
+ off_t pos, len, key=0, index_pos=0, index_len=0,size=0;
+ struct stat st;
+ char *codec;
+ int idx_type=0;
+ off_t ioff;
+ char fcclen[8]; // FOURCC + len
+
+ ftype_t ftype;
+ FILE *idxfile;
+
+ ac_init(AC_ALL);
+
+ if(argc==1) usage(EXIT_FAILURE);
+
+ for (i=0; i<AVI_MAX_TRACKS; i++) {
+ aud_chunks[i] = 0;
+ aud_ms[i] = 0;
+ }
+
+ while ((ch = getopt(argc, argv, "a:vi:o:nxf?h")) != -1)
+ {
+
+ switch (ch) {
+
+ case 'i':
+
+ if(optarg[0]=='-') usage(EXIT_FAILURE);
+ in_file=optarg;
+
+ break;
+
+ case 'a':
+
+ if(optarg[0]=='-') usage(EXIT_FAILURE);
+ track_num = atoi(optarg);
+
+ if(track_num<0) usage(EXIT_FAILURE);
+
+ break;
+
+ case 'o':
+
+ if(optarg[0]=='-') usage(EXIT_FAILURE);
+ out_file=optarg;
+
+ break;
+
+ case 'n':
+
+ open_without_index=1;
+
+ break;
+
+ case 'x':
+
+ open_without_index=1;
+ index_keyframes=1;
+
+ break;
+
+ case 'f':
+ force_with_index=1;
+ break;
+
+ case 'v':
+ version();
+ exit(0);
+ break;
+ case 'h':
+ usage(EXIT_SUCCESS);
+ default:
+ usage(EXIT_FAILURE);
+ }
+ }
+
+ // check
+ if(in_file==NULL) usage(EXIT_FAILURE);
+ if (!out_file) out_fd = stdout;
+ else out_fd = fopen(out_file, "w+r");
+
+ if (!out_fd) {
+ perror("ERROR cannot open outputfile");
+ exit(1);
+ }
+
+ idxfile = fopen(in_file, "r");
+ fread (fcclen, 8, 1, idxfile);
+ if (strncasecmp(fcclen, "RIFF", 4) == 0) ftype = RIFF;
+ else if (strncasecmp(fcclen, "AVIIDX1", 7) == 0) ftype = AVIIDX1;
+ else if (strncasecmp(fcclen, "MPIDX1", 6) == 0) ftype = MPIDX1;
+ else ftype = UNKNOWN;
+
+ fclose (idxfile);
+
+ switch (ftype) {
+ case RIFF: fprintf(stderr, "[%s] Seems to be an AVI file.\n", EXE); break;
+ case AVIIDX1: fprintf(stderr, "[%s] Converting a transcode to an mplayer index file.\n", EXE);
+ return aviidx1_to_mpidx1(in_file, out_fd);
+ case MPIDX1: fprintf(stderr, "[%s] Converting an mplayer to a transcode index file.\n", EXE);
+ return mpidx1_to_aviidx1(in_file, out_fd);
+ default: fprintf(stderr, "[%s] Unrecognized format\n", EXE); return (1);
+ }
+
+
+ // if file is larger than 2GB, regen index
+
+ if (stat(in_file, &st)<0) {
+ perror("Stat input file");
+ return 1;
+ }
+
+ size = st.st_size;
+ if (size > (off_t)AVI_MAX_LEN/2)
+ if (!force_with_index) open_without_index = 1;
+
+ if (open_without_index)
+ if (index_keyframes) fprintf(stderr, "[%s] Open \"%s\" without index and don't use index for keyframes info\n",EXE, in_file);
+ else fprintf(stderr, "[%s] Open \"%s\" without index but use index (if any) for keyframes info\n",EXE, in_file);
+ else
+ fprintf(stderr, "[%s] Open \"%s\" with index (fast)\n", EXE, in_file);
+
+ // header. Magic tag is AVIIDX1
+ fprintf(out_fd, "AVIIDX1 # Generated by %s (%s-%s)\n", EXE, PACKAGE, VERSION); // Magic
+ fprintf(out_fd, "TAG TYPE CHUNK CHUNK/TYPE POS LEN KEY MS\n");
+
+ data = malloc (5*1024*1204);
+
+ if (open_without_index) {
+
+ // open file with index.
+ if(NULL == (avifile1 = AVI_open_input_file(in_file,0))) {
+ AVI_print_error("AVI open input file");
+ exit(1);
+ }
+
+ aud_tracks = frames = 0;
+ frames = AVI_video_frames(avifile1);
+ fps = AVI_frame_rate (avifile1);
+ codec = AVI_video_compressor(avifile1);
+
+ aud_tracks = AVI_audio_tracks(avifile1);
+ //printf("frames (%ld), aud_tracks (%d)\n", frames, aud_tracks);
+
+ pos = key = len = (off_t)0;
+ i = 0;
+
+ while ( (ret = AVI_read_data_fast (avifile1, data, &pos, &len, &key, fcclen)) != 0) {
+ int audtr = ret-2;
+
+ /* don't need this and it saves time
+ * */
+ if (audtr>=0 && audtr<=7) {
+ AVI_set_audio_track(avifile1, audtr);
+ format = AVI_audio_format (avifile1);
+ chan = AVI_audio_channels(avifile1);
+ rate = AVI_audio_rate (avifile1);
+ bits = AVI_audio_bits (avifile1);
+ bits = bits==0?16:bits;
+ if (tc_format_ms_supported(format)) {
+
+ aud_bitrate = format==0x1?1:0;
+
+ if (!aud_bitrate && tc_get_audio_header(data, LEN, format, NULL, NULL, &aud_bitrate)<0) {
+ aud_ms[audtr] = vid_ms;
+ } else
+ aud_ms[audtr] += (len*8.0)/(format==0x1?((double)(rate*chan*bits)/1000.0):aud_bitrate);
+ }
+ }
+
+ switch (ret) {
+ case 1: ac_memcpy(tag, fcclen, 4);
+ print_ms = vid_ms = (avifile1->video_pos)*1000.0/fps;
+ chunk = avifile1->video_pos;
+ key = is_key(data, len, codec);
+ break;
+ case 2: case 3:
+ case 4: case 5:
+ case 6: case 7:
+ case 8:
+ case 9: ac_memcpy(tag, fcclen, 4);
+ print_ms = aud_ms[audtr];
+ chunk = avifile1->track[audtr].audio_posc;
+ break;
+ case 10: tc_snprintf(tag, sizeof(tag), "idx1");
+ index_pos = pos;
+ index_len = len;
+ print_ms = 0.0;
+ chunk = 0;
+ break;
+
+ case 0:
+ default:
+ // never get here
+ break;
+ }
+
+
+ //if (index_pos != pos)
+ // tag, chunk_nr
+ fprintf(out_fd, "%.4s %d %ld %ld %lld %lld %lld %.2f\n",
+ tag, ret, i, chunk-1,
+ (long long)pos, (long long)len, (long long)key,
+ print_ms);
+ i++;
+
+ // don't update the counter every chunk
+ progress = (int)(pos*100/size)+1;
+ if (old_progress != progress) {
+ fprintf(stderr, "[%s] Scanning ... %d%%\r", EXE, progress);
+ old_progress = progress;
+ }
+
+ }
+ fprintf(stderr, "\n");
+
+ // check if we have found an index chunk to restore keyframe info
+ if (!index_pos || !index_len || index_keyframes)
+ goto aviout;
+
+ fprintf(stderr, "[%s] Found an index chunk. Using it to regenerate keyframe info.\n", EXE);
+ fseek (out_fd, 0, SEEK_SET);
+
+ fgets(data, 100, out_fd); // magic
+ fgets(data, 100, out_fd); // comment
+
+ len = (off_t)0;
+ vid_chunks = 0;
+
+ xio_lseek(avifile1->fdes, index_pos+8, SEEK_SET);
+ while (len<index_len) {
+ xio_read(avifile1->fdes, tag, 8);
+
+ // if its a keyframe and is a video chunk
+ if (str2ulong(tag+4) && tag[1] == '0') {
+ int typen, keyn;
+ long chunkn, chunkptypen;
+ long long posn, lenn;
+ char tagn[5];
+ double msn=0.0;
+
+ chunk = (long)(len/16);
+ i = 0;
+ //fprintf(stderr, "keyframe in chunk %ld\n", chunk);
+
+ // find line "chunk" in the logfile
+
+ while (i<chunk-vid_chunks) {
+ fgets(data, 100, out_fd);
+ i++;
+ }
+
+ vid_chunks += (chunk-vid_chunks);
+ posn = ftell(out_fd);
+ fgets(data, 100, out_fd);
+ fseek(out_fd, posn, SEEK_SET);
+ sscanf(data, "%s %d %ld %ld %lld %lld %d %lf",
+ tagn, &typen, &chunkn, &chunkptypen, &posn, &lenn, &keyn, &msn);
+ fprintf(out_fd, "%s %d %ld %ld %lld %lld %d %.2f",
+ tagn, typen, chunkn, chunkptypen, posn, lenn, 1, msn);
+ }
+
+ xio_lseek(avifile1->fdes, 8, SEEK_CUR);
+ len += 16;
+ }
+
+
+
+ } else { // with index
+
+ // open file with index.
+ if(NULL == (avifile1 = AVI_open_input_file(in_file,1))) {
+ AVI_print_error("AVI open input file");
+ exit(1);
+ }
+ i=0;
+
+ AVI_info(avifile1);
+
+ // idx1 contains only info for first chunk of opendml AVI
+ if(avifile1->idx && !avifile1->is_opendml)
+ {
+ off_t pos, len;
+
+ /* Search the first videoframe in the idx1 and look where
+ it is in the file */
+
+ for(i=0;i<avifile1->n_idx;i++)
+ if( strncasecmp(avifile1->idx[i],avifile1->video_tag,3)==0 ) break;
+
+ pos = str2ulong(avifile1->idx[i]+ 8);
+ len = str2ulong(avifile1->idx[i]+12);
+
+ xio_lseek(avifile1->fdes,pos,SEEK_SET);
+ if(xio_read(avifile1->fdes,data,8)!=8) return 1;
+ if( strncasecmp(data,avifile1->idx[i],4)==0 && str2ulong(data+4)==len )
+ {
+ idx_type = 1; /* Index from start of file */
+ }
+ else
+ {
+ xio_lseek(avifile1->fdes,pos+avifile1->movi_start-4,SEEK_SET);
+ if(xio_read(avifile1->fdes,data,8)!=8) return 1;
+ if( strncasecmp(data,avifile1->idx[i],4)==0 && str2ulong(data+4)==len )
+ {
+ idx_type = 2; /* Index from start of movi list */
+ }
+ }
+ /* idx_type remains 0 if neither of the two tests above succeeds */
+
+
+ ioff = idx_type == 1 ? 0 : avifile1->movi_start-4;
+ //fprintf(stderr, "index type (%d), ioff (%ld)\n", idx_type, (long)ioff);
+ i=0;
+
+ //printf("nr idx: %d\n", avifile1->n_idx);
+ while (i<avifile1->n_idx) {
+ ac_memcpy(tag, avifile1->idx[i], 4);
+ // tag
+ fprintf(out_fd, "%c%c%c%c",
+ avifile1->idx[i][0], avifile1->idx[i][1],
+ avifile1->idx[i][2], avifile1->idx[i][3]);
+
+ // type, absolute chunk number
+ fprintf(out_fd, " %c %ld", avifile1->idx[i][1]+1, i);
+
+
+ switch (avifile1->idx[i][1]) {
+ case '0':
+ fprintf(out_fd, " %d", vid_chunks);
+ vid_chunks++;
+ break;
+ case '1': case '2':
+ case '3': case '4':
+ case '5': case '6':
+ case '7': case '8':
+ // uhoh
+ ret = avifile1->idx[i][1]-'0';
+ fprintf(out_fd, " %d", aud_chunks[ret]);
+ aud_chunks[ret]++;
+ break;
+ default:
+ fprintf(out_fd, " %d", -1);
+ break;
+ }
+
+ pos = str2ulong(avifile1->idx[i]+ 8);
+ pos += ioff;
+ // pos
+ fprintf(out_fd, " %llu", (unsigned long long)pos);
+ // len
+ fprintf(out_fd, " %lu", str2ulong(avifile1->idx[i]+12));
+ // flags (keyframe?);
+ fprintf(out_fd, " %d", (str2ulong(avifile1->idx[i]+ 4))?1:0);
+
+ // ms (not available here)
+ fprintf(out_fd, " %.2f", 0.0);
+
+ fprintf(out_fd, "\n");
+
+ i++;
+ }
+ }
+
+ else
+ { // try to extract from the index that AVILIB built,
+ // possibly from OpenDML superindex
+
+ long aud_entry [ AVI_MAX_TRACKS ] = { 0 };
+ long vid_entry = 0;
+ char* tagp;
+
+ off_t pos, len = 0;
+ i = chunk = 0;
+
+
+ while (1) {
+ ret = pos = 0;
+ int j = 0;
+
+ if(vid_entry < avifile1->video_frames) {
+ pos = avifile1->video_index[vid_entry].pos;
+ len = avifile1->video_index[vid_entry].len;
+ key = (avifile1->video_index[vid_entry].key) & 16 ? 1 : 0;
+ chunk = vid_entry;
+ ret = 1;
+ }
+ for(j = 0; j < AVI_audio_tracks(avifile1); ++j) {
+ if(aud_entry[j] < avifile1->track[j].audio_chunks) {
+ if(!ret || avifile1->track[j].audio_index[aud_entry[j]].pos < pos) {
+ pos = avifile1->track[j].audio_index[aud_entry[j]].pos;
+ len = avifile1->track[j].audio_index[aud_entry[j]].len;
+ key = 0;
+ chunk = aud_entry[j];
+ ret = j + 2;
+ }
+ }
+ }
+
+ if(!ret) // end of all index streams
+ break;
+
+ if (ret == 1)
+ {
+ ++vid_entry;
+ tagp = avifile1->video_tag;
+ }
+ else
+ {
+ aud_entry[ret-2]++;
+ tagp = avifile1->track[ret-2].audio_tag;
+ }
+
+ // index points to data in chunk, but chunk offset is needed here
+ pos -= 8;
+ fprintf(out_fd, "%.4s %d %ld %ld %lld %lld %lld %.2f\n",
+ tagp, ret, i, chunk,
+ (long long)pos, (long long)len, (long long)key,
+ 0.0);
+ i++;
+
+ }
+
+ }
+
+ }
+
+
+aviout:
+ free(data);
+ if (out_fd!=stdout) fclose (out_fd);
+ AVI_close(avifile1);
+
+ return(0);
+}
+
+/*************************************************************************/
+
+/*
+ * Local variables:
+ * c-file-style: "stroustrup"
+ * c-file-offsets: ((case-label . *) (statement-case-intro . *))
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+ */
diff --git a/debian/transcode/transcode-1.1.7/tools/avimerge.c b/debian/transcode/transcode-1.1.7/tools/avimerge.c
new file mode 100644
index 00000000..84527ad5
--- /dev/null
+++ b/debian/transcode/transcode-1.1.7/tools/avimerge.c
@@ -0,0 +1,824 @@
+/*
+ * avimerge.c
+ *
+ * Copyright (C) Thomas Oestreich - June 2001
+ *
+ * This file is part of transcode, a video stream processing tool
+ *
+ * transcode is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * transcode 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+// TODO: Simplify this code. Immediatly
+
+#include "transcode.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+#include "aud_scan.h"
+#include "aud_scan_avi.h"
+
+#define EXE "avimerge"
+
+/* AVI_info is no longer in avilib */
+void AVI_info(avi_t *avifile);
+
+void version(void)
+{
+ printf("%s (%s v%s) (C) 2001-2004 Thomas Oestreich, T. Bitterberg"
+ " 2004-2010 Transcode Team\n",
+ EXE, PACKAGE, VERSION);
+}
+
+static void usage(int status)
+{
+ version();
+ printf("\nUsage: %s [options]\n", EXE);
+ printf(" -o file output file name\n");
+ printf(" -i file1 [file2 [...]] input file(s)\n");
+ printf(" -p file multiplex additional audio track from file\n");
+ printf(" -a num select audio track number from input file [0]\n");
+ printf(" -A num select audio track number in output file [next]\n");
+ printf(" -b n handle vbr audio [autodetect]\n");
+ printf(" -c drop video frames in case audio is missing [off]\n");
+ printf(" -f FILE read AVI comments from FILE [off]\n");
+ printf(" -x FILE read AVI index from FILE [off] (see aviindex(1))\n");
+ exit(status);
+}
+
+static char data[SIZE_RGB_FRAME];
+static char *comfile = NULL;
+static char *indexfile = NULL;
+long sum_frames = 0;
+int is_vbr=1;
+int drop_video=0;
+
+
+static int merger(avi_t *out, char *file)
+{
+ avi_t *in;
+ long frames, n, bytes;
+ int key, j, aud_tracks;
+ static int init = 0;
+ static int vid_chunks = 0;
+
+ double fps;
+ static double vid_ms;
+ static double aud_ms[AVI_MAX_TRACKS];
+ int have_printed=0;
+ int do_drop_video=0;
+
+ if (!init) {
+ for (j=0; j<AVI_MAX_TRACKS; j++)
+ aud_ms[j] = 0.0;
+ vid_ms = 0;
+ vid_chunks = 0;
+ init = 1;
+ }
+
+ if(indexfile) {
+ if (NULL == (in = AVI_open_input_indexfile(file, 0, indexfile))) {
+ AVI_print_error("AVI open with indexfile");
+ return(-1);
+ }
+ }
+ else if(NULL == (in = AVI_open_input_file(file,1))) {
+ AVI_print_error("AVI open");
+ return(-1);
+ }
+
+ AVI_seek_start(in);
+ fps = AVI_frame_rate(in);
+ frames = AVI_video_frames(in);
+ aud_tracks = AVI_audio_tracks(in);
+
+ for (n=0; n<frames; ++n) {
+
+ ++vid_chunks;
+ vid_ms = vid_chunks*1000.0/fps;
+
+ // audio
+ for(j=0; j<aud_tracks; ++j) {
+
+ int ret;
+ double old_ms = aud_ms[j];
+
+ AVI_set_audio_track(in, j);
+ AVI_set_audio_track(out, j);
+
+ ret = sync_audio_video_avi2avi (vid_ms, &aud_ms[j], in, out);
+ if (ret<0) {
+ if (ret==-2) {
+ if (aud_ms[j] == old_ms) {
+ do_drop_video = 1;
+ if (!have_printed) {
+ fprintf(stderr, "\nNo audiodata left for track %d->%d (%.2f=%.2f) %s ..\n",
+ AVI_get_audio_track(in), AVI_get_audio_track(out),
+ old_ms, aud_ms[j], (do_drop_video && drop_video)?"breaking (-c)":"continuing");
+ have_printed++;
+ }
+ }
+ } else {
+ fprintf(stderr, "\nAn error happend at frame %ld track %d\n", n, j);
+ }
+ }
+
+ }
+
+ if (do_drop_video && drop_video) {
+ fprintf(stderr, "\n[avimerge] Dropping %ld frames\n", frames-n-1);
+ goto out;
+ }
+
+ // video
+ bytes = AVI_read_frame(in, data, &key);
+
+ if(bytes < 0) {
+ AVI_print_error("AVI read video frame");
+ return(-1);
+ }
+
+ if(AVI_write_frame(out, data, bytes, key)<0) {
+ AVI_print_error("AVI write video frame");
+ return(-1);
+ }
+
+ // progress
+ fprintf(stderr, "[%s] (%06ld-%06ld) (%.2f <-> %.2f)\r", file, sum_frames, sum_frames + n, vid_ms, aud_ms[0]);
+ }
+out:
+ fprintf(stderr, "\n");
+
+ AVI_close(in);
+
+ sum_frames += n;
+
+ return(0);
+}
+
+
+int main(int argc, char *argv[])
+{
+ avi_t *avifile, *avifile1, *avifile2;
+
+ char *outfile=NULL, *infile=NULL, *audfile=NULL;
+
+ long rate, mp3rate;
+
+ int j, ch, cc=0, track_num=0, out_track_num=-1;
+ int width, height, format=0, format_add, chan, bits, aud_error=0;
+
+ double fps;
+
+ char *codec;
+
+ long offset, frames, n, bytes, aud_offset=0;
+
+ int key;
+
+ int aud_tracks;
+
+ // for mp3 audio
+ FILE *f=NULL;
+ int len, headlen, chan_i, rate_i, mp3rate_i;
+ unsigned long vid_chunks=0;
+ char head[8];
+ off_t pos;
+ double aud_ms = 0.0, vid_ms = 0.0;
+ double aud_ms_w[AVI_MAX_TRACKS];
+
+ ac_init(AC_ALL);
+
+ if(argc==1) usage(EXIT_FAILURE);
+
+ while ((ch = getopt(argc, argv, "A:a:b:ci:o:p:f:x:?hv")) != -1) {
+
+ switch (ch) {
+
+ case 'i':
+
+ if(optarg[0]=='-') usage(EXIT_FAILURE);
+ infile = optarg;
+
+ break;
+
+ case 'A':
+
+ if(optarg[0]=='-') usage(EXIT_FAILURE);
+ out_track_num = atoi(optarg);
+
+ if(out_track_num<-1) usage(EXIT_FAILURE);
+
+ break;
+
+ case 'a':
+
+ if(optarg[0]=='-') usage(EXIT_FAILURE);
+ track_num = atoi(optarg);
+
+ if(track_num<0) usage(EXIT_FAILURE);
+
+ break;
+
+ case 'b':
+
+ if(optarg[0]=='-') usage(EXIT_FAILURE);
+ is_vbr = atoi(optarg);
+
+ if(is_vbr<0) usage(EXIT_FAILURE);
+
+ break;
+
+ case 'c':
+
+ drop_video = 1;
+
+ break;
+
+ case 'o':
+
+ if(optarg[0]=='-') usage(EXIT_FAILURE);
+ outfile = optarg;
+
+ break;
+
+ case 'p':
+
+ if(optarg[0]=='-') usage(EXIT_FAILURE);
+ audfile = optarg;
+
+ break;
+
+ case 'f':
+
+ if(optarg[0]=='-') usage(EXIT_FAILURE);
+ comfile = optarg;
+
+ break;
+
+
+ case 'x':
+
+ if(optarg[0]=='-') usage(EXIT_FAILURE);
+ indexfile = optarg;
+
+ break;
+
+ case 'v':
+ version();
+ exit(EXIT_SUCCESS);
+ case 'h':
+ usage(EXIT_SUCCESS);
+ default:
+ usage(EXIT_FAILURE);
+ }
+ }
+
+ if(outfile == NULL || infile == NULL) usage(EXIT_FAILURE);
+
+ printf("scanning file %s for video/audio parameter\n", infile);
+
+ // open first file for video/audio info read only
+ if(indexfile) {
+ if (NULL == (avifile1 = AVI_open_input_indexfile(infile,0,indexfile))) {
+ AVI_print_error("AVI open with index file");
+ }
+ }
+ else if(NULL == (avifile1 = AVI_open_input_file(infile,1))) {
+ AVI_print_error("AVI open");
+ exit(1);
+ }
+
+ AVI_info(avifile1);
+
+ // safety checks
+
+ if(strcmp(infile, outfile)==0) {
+ printf("error: output filename conflicts with input filename\n");
+ exit(1);
+ }
+
+ ch = optind;
+
+ while (ch < argc) {
+
+ if(tc_file_check(argv[ch]) != 0) {
+ printf("error: file not found\n");
+ exit(1);
+ }
+
+ if(strcmp(argv[ch++], outfile)==0) {
+ printf("error: output filename conflicts with input filename\n");
+ exit(1);
+ }
+ }
+
+ // open output file
+ if(NULL == (avifile = AVI_open_output_file(outfile))) {
+ AVI_print_error("AVI open");
+ exit(1);
+ }
+
+
+ // read video info;
+
+ width = AVI_video_width(avifile1);
+ height = AVI_video_height(avifile1);
+
+ fps = AVI_frame_rate(avifile1);
+ codec = AVI_video_compressor(avifile1);
+
+ //set video in outputfile
+ AVI_set_video(avifile, width, height, fps, codec);
+
+ if (comfile!=NULL)
+ AVI_set_comment_fd(avifile, open(comfile, O_RDONLY));
+
+ //multi audio tracks?
+ aud_tracks = AVI_audio_tracks(avifile1);
+ if (out_track_num < 0) out_track_num = aud_tracks;
+
+ for(j=0; j<aud_tracks; ++j) {
+
+ if (out_track_num == j) continue;
+ AVI_set_audio_track(avifile1, j);
+
+ rate = AVI_audio_rate(avifile1);
+ chan = AVI_audio_channels(avifile1);
+ bits = AVI_audio_bits(avifile1);
+
+ format = AVI_audio_format(avifile1);
+ mp3rate= AVI_audio_mp3rate(avifile1);
+ //printf("TRACK %d MP3RATE %ld VBR %ld\n", j, mp3rate, AVI_get_audio_vbr(avifile1));
+
+ //set next track of output file
+ AVI_set_audio_track(avifile, j);
+ AVI_set_audio(avifile, chan, rate, bits, format, mp3rate);
+ AVI_set_audio_vbr(avifile, AVI_get_audio_vbr(avifile1));
+ }
+
+ if(audfile!=NULL) goto audio_merge;
+
+ // close reopen in merger function
+ AVI_close(avifile1);
+
+ //-------------------------------------------------------------
+
+ printf("merging multiple AVI-files (concatenating) ...\n");
+
+ // extract and write to new files
+
+ printf ("file %02d %s\n", ++cc, infile);
+ merger(avifile, infile);
+
+ while (optind < argc) {
+
+ printf ("file %02d %s\n", ++cc, argv[optind]);
+ merger(avifile, argv[optind++]);
+ }
+
+ // close new AVI file
+
+ AVI_close(avifile);
+
+ printf("... done merging %d file(s) in %s\n", cc, outfile);
+
+ // reopen file for video/audio info
+ if(NULL == (avifile = AVI_open_input_file(outfile,1))) {
+ AVI_print_error("AVI open");
+ exit(1);
+ }
+ AVI_info(avifile);
+
+ return(0);
+
+ //-------------------------------------------------------------
+
+
+// *************************************************
+// Merge the audio track of an additional AVI file
+// *************************************************
+
+ audio_merge:
+
+ printf("merging audio %s track %d (multiplexing) into %d ...\n", audfile, track_num, out_track_num);
+
+ // open audio file read only
+ if(NULL == (avifile2 = AVI_open_input_file(audfile,1))) {
+ int f=open(audfile, O_RDONLY), ret=0;
+ char head[1024], *c;
+ c = head;
+ if (f>0 && (1024 == read(f, head, 1024)) ) {
+ while ((c-head<1024-8) && (ret = tc_probe_audio_header(c, 8))<=0 ) {
+ c++;
+ }
+ close(f);
+
+ if (ret > 0) {
+ aud_offset = c-head;
+ //printf("found atrack 0x%x off=%ld\n", ret, aud_offset);
+ goto merge_mp3;
+ }
+ }
+
+ AVI_print_error("AVI open");
+ exit(1);
+ }
+
+ AVI_info(avifile2);
+
+ //switch to requested track
+
+ if(AVI_set_audio_track(avifile2, track_num)<0) {
+ fprintf(stderr, "invalid audio track\n");
+ }
+
+ rate = AVI_audio_rate(avifile2);
+ chan = AVI_audio_channels(avifile2);
+ bits = AVI_audio_bits(avifile2);
+
+ format = AVI_audio_format(avifile2);
+ mp3rate= AVI_audio_mp3rate(avifile2);
+
+ //set next track
+ AVI_set_audio_track(avifile, out_track_num);
+ AVI_set_audio(avifile, chan, rate, bits, format, mp3rate);
+ AVI_set_audio_vbr(avifile, AVI_get_audio_vbr(avifile2));
+
+ AVI_seek_start(avifile1);
+ frames = AVI_video_frames(avifile1);
+ offset = 0;
+
+ printf ("file %02d %s\n", ++cc, infile);
+
+ for (n=0; n<AVI_MAX_TRACKS; n++)
+ aud_ms_w[n] = 0.0;
+ vid_chunks=0;
+
+ for (n=0; n<frames; ++n) {
+
+ // video
+ bytes = AVI_read_frame(avifile1, data, &key);
+
+ if(bytes < 0) {
+ AVI_print_error("AVI read video frame");
+ return(-1);
+ }
+
+ if(AVI_write_frame(avifile, data, bytes, key)<0) {
+ AVI_print_error("AVI write video frame");
+ return(-1);
+ }
+ ++vid_chunks;
+ vid_ms = vid_chunks*1000.0/fps;
+
+ for(j=0; j<aud_tracks; ++j) {
+
+ if (j == out_track_num) continue;
+ AVI_set_audio_track(avifile1, j);
+ AVI_set_audio_track(avifile, j);
+ chan = AVI_audio_channels(avifile1);
+
+ // audio
+ chan = AVI_audio_channels(avifile1);
+ if(chan) {
+ sync_audio_video_avi2avi(vid_ms, &aud_ms_w[j], avifile1, avifile);
+ }
+ }
+
+
+ // merge additional track
+
+ // audio
+ chan = AVI_audio_channels(avifile2);
+ AVI_set_audio_track(avifile, out_track_num);
+
+ if(chan) {
+ sync_audio_video_avi2avi(vid_ms, &aud_ms, avifile2, avifile);
+ }
+
+ // progress
+ fprintf(stderr, "[%s] (%06ld-%06ld)\r", outfile, offset, offset + n);
+
+ }
+
+ fprintf(stderr,"\n");
+
+ offset = frames;
+
+ //more files to merge?
+
+ AVI_close(avifile1);
+
+ while (optind < argc) {
+
+ printf ("file %02d %s\n", ++cc, argv[optind]);
+
+ if(NULL == ( avifile1 = AVI_open_input_file(argv[optind++],1))) {
+ AVI_print_error("AVI open");
+ goto finish;
+ }
+
+ AVI_seek_start(avifile1);
+ frames = AVI_video_frames(avifile1);
+
+ for (n=0; n<frames; ++n) {
+
+ // video
+ bytes = AVI_read_frame(avifile1, data, &key);
+
+ if(bytes < 0) {
+ AVI_print_error("AVI read video frame");
+ return(-1);
+ }
+
+ if(AVI_write_frame(avifile, data, bytes, key)<0) {
+ AVI_print_error("AVI write video frame");
+ return(-1);
+ }
+
+ ++vid_chunks;
+ vid_ms = vid_chunks*1000.0/fps;
+
+ // audio
+ for(j=0; j<aud_tracks; ++j) {
+
+ if (j == out_track_num) continue;
+ AVI_set_audio_track(avifile1, j);
+ AVI_set_audio_track(avifile, j);
+
+ chan = AVI_audio_channels(avifile1);
+
+ if(chan) {
+ sync_audio_video_avi2avi(vid_ms, &aud_ms_w[j], avifile1, avifile);
+ }
+ }
+
+ // merge additional track
+
+ chan = AVI_audio_channels(avifile2);
+ AVI_set_audio_track(avifile, out_track_num);
+
+ if(chan) {
+ sync_audio_video_avi2avi(vid_ms, &aud_ms, avifile2, avifile);
+ } // chan
+
+ // progress
+ fprintf(stderr, "[%s] (%06ld-%06ld)\r", outfile, offset, offset + n);
+ }
+
+ fprintf(stderr, "\n");
+
+ offset += frames;
+ AVI_close(avifile1);
+ }
+
+ finish:
+
+ // close new AVI file
+
+ printf("... done multiplexing in %s\n", outfile);
+
+ AVI_info(avifile);
+ AVI_close(avifile);
+
+ return(0);
+
+
+// *************************************************
+// Merge a raw audio file which is either MP3 or AC3
+// *************************************************
+
+merge_mp3:
+
+ f = fopen(audfile,"rb");
+ if (!f) { perror ("fopen"); exit(1); }
+
+ fseek(f, aud_offset, SEEK_SET);
+ len = fread(head, 1, 8, f);
+ format_add = tc_probe_audio_header(head, len);
+ headlen = tc_get_audio_header(head, len, format_add, &chan_i, &rate_i, &mp3rate_i);
+ fprintf(stderr, "... this looks like a %s track ...\n", (format_add==0x55)?"MP3":"AC3");
+
+ fseek(f, aud_offset, SEEK_SET);
+
+ //set next track
+ AVI_set_audio_track(avifile, out_track_num);
+ AVI_set_audio(avifile, chan_i, rate_i, 16, format_add, mp3rate_i);
+ AVI_set_audio_vbr(avifile, is_vbr);
+
+ AVI_seek_start(avifile1);
+ frames = AVI_video_frames(avifile1);
+ offset = 0;
+
+ for (n=0; n<AVI_MAX_TRACKS; ++n)
+ aud_ms_w[n] = 0.0;
+
+ for (n=0; n<frames; ++n) {
+
+ // video
+ bytes = AVI_read_frame(avifile1, data, &key);
+
+ if(bytes < 0) {
+ AVI_print_error("AVI read video frame");
+ return(-1);
+ }
+
+ if(AVI_write_frame(avifile, data, bytes, key)<0) {
+ AVI_print_error("AVI write video frame");
+ return(-1);
+ }
+
+ vid_chunks++;
+ vid_ms = vid_chunks*1000.0/fps;
+
+ for(j=0; j<aud_tracks; ++j) {
+
+ if (j == out_track_num) continue;
+ AVI_set_audio_track(avifile1, j);
+ AVI_set_audio_track(avifile, j);
+ chan = AVI_audio_channels(avifile1);
+
+ if(chan) {
+ sync_audio_video_avi2avi(vid_ms, &aud_ms_w[j], avifile1, avifile);
+ }
+ }
+
+
+ // merge additional track
+
+ if(headlen>4 && !aud_error) {
+ while (aud_ms < vid_ms) {
+ //printf("reading Audio Chunk ch(%ld) vms(%lf) ams(%lf)\n", vid_chunks, vid_ms, aud_ms);
+ pos = ftell(f);
+
+ len = fread (head, 1, 8, f);
+ if (len<=0) { //eof
+ fprintf(stderr, "EOF in %s; continuing ..\n", audfile);
+ aud_error=1;
+ break;
+ }
+
+ if ( (headlen = tc_get_audio_header(head, len, format_add, NULL, NULL, &mp3rate_i))<0) {
+ fprintf(stderr, "Broken %s track #(%d)? skipping\n", (format_add==0x55?"MP3":"AC3"), aud_tracks);
+ aud_ms = vid_ms;
+ aud_error=1;
+ } else { // look in import/tcscan.c for explanation
+ aud_ms += (headlen*8.0)/(mp3rate_i);
+ }
+
+ fseek (f, pos, SEEK_SET);
+
+ len = fread (data, headlen, 1, f);
+ if (len<=0) { //eof
+ fprintf(stderr, "EOF in %s; continuing ..\n", audfile);
+ aud_error=1;
+ break;
+ }
+
+ AVI_set_audio_track(avifile, out_track_num);
+
+ if(AVI_write_audio(avifile, data, headlen)<0) {
+ AVI_print_error("AVI write audio frame");
+ return(-1);
+ }
+
+ }
+ }
+
+ // progress
+ fprintf(stderr, "[%s] (%06ld-%06ld)\r", outfile, offset, offset + n);
+
+ }
+
+ fprintf(stderr,"\n");
+ offset = frames;
+
+ // more files?
+ while (optind < argc) {
+
+ printf ("file %02d %s\n", ++cc, argv[optind]);
+
+ if(NULL == ( avifile1 = AVI_open_input_file(argv[optind++],1))) {
+ AVI_print_error("AVI open");
+ goto finish;
+ }
+
+ AVI_seek_start(avifile1);
+ frames = AVI_video_frames(avifile1);
+
+ for (n=0; n<frames; ++n) {
+
+ // video
+ bytes = AVI_read_frame(avifile1, data, &key);
+
+ if(bytes < 0) {
+ AVI_print_error("AVI read video frame");
+ return(-1);
+ }
+
+ if(AVI_write_frame(avifile, data, bytes, key)<0) {
+ AVI_print_error("AVI write video frame");
+ return(-1);
+ }
+
+ vid_chunks++;
+ vid_ms = vid_chunks*1000.0/fps;
+
+ for(j=0; j<aud_tracks; ++j) {
+
+ if (j == out_track_num) continue;
+ AVI_set_audio_track(avifile1, j);
+ AVI_set_audio_track(avifile, j);
+ chan = AVI_audio_channels(avifile1);
+
+ if(chan) {
+ sync_audio_video_avi2avi(vid_ms, &aud_ms_w[j], avifile1, avifile);
+ }
+ }
+
+ // merge additional track
+ // audio
+
+ if(headlen>4 && !aud_error) {
+ while (aud_ms < vid_ms) {
+ //printf("reading Audio Chunk ch(%ld) vms(%lf) ams(%lf)\n", vid_chunks, vid_ms, aud_ms);
+ pos = ftell(f);
+
+ len = fread (head, 8, 1, f);
+ if (len<=0) { //eof
+ fprintf(stderr, "EOF in %s; continuing ..\n", audfile);
+ aud_error=1; break;
+ }
+
+ if ( (headlen = tc_get_audio_header(head, len, format_add, NULL, NULL, &mp3rate_i))<0) {
+ fprintf(stderr, "Broken %s track #(%d)?\n", (format_add==0x55?"MP3":"AC3"), aud_tracks);
+ aud_ms = vid_ms;
+ aud_error=1;
+ } else { // look in import/tcscan.c for explanation
+ aud_ms += (headlen*8.0)/(mp3rate_i);
+ }
+
+ fseek (f, pos, SEEK_SET);
+
+ len = fread (data, headlen, 1, f);
+ if (len<=0) { //eof
+ fprintf(stderr, "EOF in %s; continuing ..\n", audfile);
+ aud_error=1; break;
+ }
+
+ AVI_set_audio_track(avifile, out_track_num);
+
+ if(AVI_write_audio(avifile, data, headlen)<0) {
+ AVI_print_error("AVI write audio frame");
+ return(-1);
+ }
+
+ }
+ }
+
+ // progress
+ fprintf(stderr, "[%s] (%06ld-%06ld)\r", outfile, offset, offset + n);
+ }
+
+ fprintf(stderr, "\n");
+
+ offset += frames;
+ AVI_close(avifile1);
+ }
+
+
+ if (f) fclose(f);
+
+ printf("... done multiplexing in %s\n", outfile);
+
+ AVI_close(avifile);
+
+ return(0);
+}
+
+/*************************************************************************/
+
+/*
+ * Local variables:
+ * c-file-style: "stroustrup"
+ * c-file-offsets: ((case-label . *) (statement-case-intro . *))
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+ */
diff --git a/debian/transcode/transcode-1.1.7/tools/avimisc.c b/debian/transcode/transcode-1.1.7/tools/avimisc.c
new file mode 100644
index 00000000..b1495149
--- /dev/null
+++ b/debian/transcode/transcode-1.1.7/tools/avimisc.c
@@ -0,0 +1,99 @@
+/*
+ * avimisc.c
+ *
+ * Copyright (C) Thomas Oestreich - June 2001
+ *
+ * This file is part of transcode, a video stream processing tool
+ *
+ * transcode is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * transcode 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#include "avilib/avilib.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#if !defined(COMP_MSC)
+#include <unistd.h>
+#endif
+
+#include <sys/stat.h>
+#include <string.h>
+
+#include "libtc/xio.h"
+
+void AVI_info(avi_t *avifile);
+
+void AVI_info(avi_t *avifile)
+{
+ if (avifile == NULL) {
+ fprintf(stderr, "[avilib] bad avi reference\n");
+ } else {
+ long frames = AVI_video_frames(avifile);
+ int width = AVI_video_width(avifile);
+ int height = AVI_video_height(avifile);
+ double fps = AVI_frame_rate(avifile);
+ const char *codec = AVI_video_compressor(avifile);
+ int tracks = AVI_audio_tracks(avifile);
+ int tmp = AVI_get_audio_track(avifile);
+ int j = 0;
+
+ printf("[avilib] V: %6.3f fps, codec=%s, frames=%ld,"
+ " width=%d, height=%d\n",
+ fps, ((strlen(codec)==0)? "RGB": codec), frames,
+ width, height);
+
+ for (j = 0; j < tracks; j++) {
+ long rate, mp3rate, chunks, tot_bytes;
+ int format, chan, bits;
+
+ AVI_set_audio_track(avifile, j);
+ rate = AVI_audio_rate(avifile);
+ format = AVI_audio_format(avifile);
+ chan = AVI_audio_channels(avifile);
+ bits = AVI_audio_bits(avifile);
+ mp3rate = AVI_audio_mp3rate(avifile);
+
+ chunks = AVI_audio_chunks(avifile);
+ tot_bytes = AVI_audio_bytes(avifile);
+
+ if (chan > 0) {
+ printf("[avilib] A: %ld Hz, format=0x%02x, bits=%d,"
+ " channels=%d, bitrate=%ld kbps,\n",
+ rate, format, bits,
+ chan, mp3rate);
+ printf("[avilib] %ld chunks, %ld bytes, %s\n",
+ chunks, tot_bytes,
+ (AVI_get_audio_vbr(avifile)?"VBR":"CBR"));
+ } else {
+ printf("[avilib] A: no audio track found\n");
+ }
+ }
+ AVI_set_audio_track(avifile, tmp); //reset
+ }
+}
+
+/*************************************************************************/
+
+/*
+ * Local variables:
+ * c-file-style: "stroustrup"
+ * c-file-offsets: ((case-label . *) (statement-case-intro . *))
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+ */
diff --git a/debian/transcode/transcode-1.1.7/tools/avisplit.c b/debian/transcode/transcode-1.1.7/tools/avisplit.c
new file mode 100644
index 00000000..d439e486
--- /dev/null
+++ b/debian/transcode/transcode-1.1.7/tools/avisplit.c
@@ -0,0 +1,717 @@
+/*
+ * avisplit.c
+ *
+ * Copyright (C) Thomas Oestreich - June 2001
+ *
+ * This file is part of transcode, a video stream processing tool
+ *
+ * transcode is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * transcode 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#include "transcode.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include "limits.h"
+#include <string.h>
+#include "buffer.h"
+#include "avilib/avilib.h"
+#include "libtc/framecode.h"
+#include "aud_scan_avi.h"
+
+#define EXE "avisplit"
+#define MBYTE (1<<20)
+
+/* AVI_info is no longer in avilib */
+void AVI_info(avi_t *avifile);
+
+void version(void)
+{
+ printf("%s (%s v%s) (C) 2001-2003 Thomas Oestreich,"
+ " 2003-2010 Transcode Team\n",
+ EXE, PACKAGE, VERSION);
+}
+
+static void usage(int status)
+{
+ version();
+ printf("\nUsage: %s [options]\n", EXE);
+ printf(" -i name file name\n");
+ printf(" -s size de-chunk based on size in MB (0=dechunk)\n");
+ printf(" -H n split only first n chunks [all]\n");
+ printf(" -t s1-s2[,s3-s4,..] de-chunk based on time/framecode (n:m:l.k) [off]\n");
+ printf(" -c merge chunks on-the-fly for option -t [off]\n");
+ printf(" -m force split at upper limit for option -t [off]\n");
+ printf(" -o base split to base-%%04d.avi [name-%%04d]\n");
+ printf(" -b n handle vbr audio [autodetect]\n");
+ printf(" -f FILE read AVI comments from FILE [off]\n");
+ printf(" -v print version\n");
+ exit(status);
+}
+
+// buffer
+static char data[SIZE_RGB_FRAME];
+static char out_file[1024];
+static char *comfile = NULL;
+int is_vbr = 1;
+
+enum split_type
+{
+ SPLIT_BY_SIZE,
+ SPLIT_BY_TIME
+};
+
+int main(int argc, char *argv[])
+{
+
+ avi_t *in=NULL;
+ avi_t *out=NULL;
+
+ char *in_file=NULL;
+
+ long i, frames, bytes, bytes_to_key, tmpreturn;
+
+ uint64_t size=0;
+
+ double fsize=0.0, fps;
+
+ char *codec;
+
+ int j, n, m, key, k;
+
+ int key_boundary=1;
+
+ int chunk=0, is_open, ch, split_next=INT_MAX;
+
+ long rate, mp3rate=0L;
+
+ int width, height, format=0, chan, bits;
+
+ char *base=NULL;
+ char argcopy[1024];
+
+ /* added variables */
+ long start_audio_keyframe[ AVI_MAX_TRACKS ];
+ long byte_count_audio[ AVI_MAX_TRACKS ];
+ long byte_count_at_start[ AVI_MAX_TRACKS ];
+ static char *single_output_file=NULL;
+ struct fc_time * ttime = NULL;
+ struct fc_time * tstart = NULL;
+ int start_keyframe=0;
+ int split_option=0;
+ int first_frame=1;
+ int num_frames;
+ int didread = 0;
+
+ double aud_ms[ AVI_MAX_TRACKS ];
+ double aud_ms_w[ AVI_MAX_TRACKS ];
+
+ int vid_chunks=0;
+ //int aud_chunks=0;
+ double vid_ms_w = 0.0;
+ double vid_ms = 0.0;
+
+ char separator[] = ",";
+
+ ac_init(AC_ALL);
+
+ if(argc==1) usage(EXIT_FAILURE);
+ memset(byte_count_at_start, 0 , sizeof(long)*AVI_MAX_TRACKS);
+
+ while ((ch = getopt(argc, argv, "b:mco:vs:i:f:t:H:?h")) != -1) {
+
+ switch (ch) {
+
+ case 'b':
+
+ if(optarg[0]=='-') usage(EXIT_FAILURE);
+ is_vbr = atoi(optarg);
+
+ if(is_vbr<0) usage(EXIT_FAILURE);
+
+ break;
+
+ case 'c': // cat
+ single_output_file = out_file;
+ break;
+
+ case 'm':
+ key_boundary = 0;
+ break;
+
+ case 'H':
+
+ if(optarg[0]=='-') usage(EXIT_FAILURE);
+ split_next = atoi(optarg);
+
+ if(split_next <= 0) {
+ fprintf(stderr, "(%s) invalid parameter for option -H\n", __FILE__);
+ exit(0);
+ }
+ break;
+
+ case 'i':
+
+ if(optarg[0]=='-') usage(EXIT_FAILURE);
+ in_file=optarg;
+
+ break;
+
+ case 's':
+
+ if(optarg[0]=='-') usage(EXIT_FAILURE);
+ chunk = atoi(optarg);
+ split_option=SPLIT_BY_SIZE;
+
+ break;
+
+ case 't':
+ split_option=SPLIT_BY_TIME;
+ strncpy (argcopy, optarg, 1024);
+
+ break;
+
+ case 'o':
+
+ if(optarg[0]=='-') usage(EXIT_FAILURE);
+ base = optarg;
+
+ break;
+
+ case 'f':
+
+ if(optarg[0]=='-') usage(EXIT_FAILURE);
+ comfile = optarg;
+
+ break;
+
+ case 'v':
+ version();
+ exit(0);
+ break;
+
+ case 'h':
+ usage(EXIT_SUCCESS);
+
+ default:
+ usage(EXIT_FAILURE);
+ }
+ }
+ /*
+ * check
+ */
+ switch (split_option) {
+ case SPLIT_BY_SIZE:
+
+ if(in_file==NULL || chunk < 0) usage(EXIT_FAILURE);
+
+ break;
+
+ case SPLIT_BY_TIME:
+
+ if(in_file==NULL) usage(EXIT_FAILURE);
+
+ break;
+ }
+
+
+ // open file
+ if(NULL == (in = AVI_open_input_file(in_file,1))) {
+ AVI_print_error("AVI open");
+ exit(1);
+ }
+
+ // read video info;
+
+ AVI_info(in);
+
+ // read video info;
+
+ frames = AVI_video_frames(in);
+ width = AVI_video_width(in);
+ height = AVI_video_height(in);
+
+ fps = AVI_frame_rate(in);
+ codec = AVI_video_compressor(in);
+ rate = AVI_audio_rate(in);
+ chan = AVI_audio_channels(in);
+ bits = AVI_audio_bits(in);
+
+ for (k = 0; k<AVI_MAX_TRACKS; k++)
+ aud_ms[k] = 0.0;
+
+ for (k = 0; k<AVI_MAX_TRACKS; k++)
+ aud_ms_w[k] = 0.0;
+
+ switch (split_option) {
+
+ case SPLIT_BY_SIZE:
+ // no file open yet
+ is_open=0;
+ // index of split files
+ j=0;
+ // start frame
+ i=0;
+
+ //some header may be broken
+ if(frames<=0) frames=INT_MAX;
+
+ for (n=0; n<frames; ++n) {
+
+ // read video frame
+ bytes = AVI_read_frame(in, data, &key);
+
+ if(bytes < 0) {
+ fprintf(stderr, "%d (%ld)\n", n, bytes);
+ AVI_print_error("AVI read video frame");
+ break;
+ }
+
+ //check for closing outputfile
+
+ if(key && is_open && n && split_next) {
+
+ // loop through from this keyframe to the next to find out this chunks real size
+ // save bytes from first query
+ bytes_to_key = bytes;
+
+ //Loop until next keyframe
+ for(m=0; (!key || m==0); ++m) {
+ //video
+ tmpreturn = AVI_audio_size(in, n+m);
+ if (tmpreturn == -1) break;
+ bytes_to_key += tmpreturn;
+ //audio
+ tmpreturn = AVI_read_frame(in, NULL, &key);
+ if (tmpreturn == -1) break;
+ bytes_to_key += tmpreturn;
+ }
+ //rewind to correct position, the last keyframe.
+ AVI_set_video_position(in, n);
+
+ size = AVI_bytes_written(out);
+ fsize = ((double) size)/MBYTE;
+
+ if((size + bytes_to_key) > (uint64_t)(chunk*MBYTE)) {
+
+ // limit exceeded, close file
+
+ fprintf(stderr, "\n");
+ AVI_close(out);
+ out=NULL;
+ --split_next; //0 for trailer split mode after first chunk.
+ is_open=0;
+ ++j;
+ i=n;
+ }
+ }
+
+
+ // progress
+ if(out) {
+ vid_ms = vid_chunks*1000.0/fps;
+
+ fprintf(stderr, "[%s] (%06ld-%06d), size %4.1f MB. (V/A) (%.0f/%.0f)ms\r", out_file, i, n-1, ((double) AVI_bytes_written(out))/MBYTE, vid_ms, aud_ms [0]);
+ }
+
+ if (split_next == 0) {
+ if(in != NULL)
+ AVI_close(in);
+ in=NULL;
+ if(out != NULL)
+ AVI_close(out);
+
+ return (0);
+ }
+
+ // need new output file
+ if(!is_open) {
+
+ if(base == NULL || strlen(base)==0) {
+ tc_snprintf(out_file, sizeof(out_file), "%s-%04d", in_file, j);
+ } else {
+ tc_snprintf(out_file, sizeof(out_file), "%s-%04d.avi", base, j);
+ }
+
+ // prepare output file
+
+ if(NULL == (out = AVI_open_output_file(out_file))) {
+ AVI_print_error("AVI open");
+ exit(1);
+ }
+
+ AVI_set_video(out, width, height, fps, codec);
+ if (comfile!=NULL)
+ AVI_set_comment_fd(out, open(comfile, O_RDONLY));
+
+ for(k=0; k< AVI_audio_tracks(in); ++k) {
+
+ AVI_set_audio_track(in, k);
+
+ rate = AVI_audio_rate(in);
+ chan = AVI_audio_channels(in);
+ bits = AVI_audio_bits(in);
+
+ format = AVI_audio_format(in);
+ mp3rate= AVI_audio_mp3rate(in);
+
+
+ //set next track of output file
+ AVI_set_audio_track(out, j);
+ AVI_set_audio(out, chan, rate, bits, format, mp3rate);
+ AVI_set_audio_vbr(out, AVI_get_audio_vbr(in));
+ }
+
+ is_open=1;
+ }
+
+ //write frame
+
+ if(AVI_write_frame(out, data, bytes, key)<0) {
+ AVI_print_error("AVI write video frame");
+ return(-1);
+ }
+
+ vid_chunks++;
+ vid_ms = vid_chunks*1000.0/fps;
+
+ //audio
+ for(k=0; k< AVI_audio_tracks(in); ++k) {
+
+ AVI_set_audio_track(in, k);
+ AVI_set_audio_track(out, k);
+
+ sync_audio_video_avi2avi(vid_ms, &aud_ms[k], in, out);
+ }
+
+ }//process all frames
+
+ if(in != NULL)
+ AVI_close(in);
+
+ size = AVI_bytes_written(out);
+ vid_ms = vid_chunks*1000.0/fps;
+
+ fprintf(stderr, "[%s] (%06ld-%06d), size %4.1f MB. vid=%8.2f ms aud=%8.2f ms\n", out_file, i, n-1, ((double) AVI_bytes_written(out))/MBYTE, vid_ms, aud_ms[0]);
+
+ if(out != NULL)
+ AVI_close(out);
+
+ break;
+
+ // XXX: use aud_ms like above
+ case SPLIT_BY_TIME:
+
+ if( parse_fc_time_string( argcopy, fps, separator, 1, &ttime ) == -1 )
+ usage(EXIT_FAILURE);
+ /*
+ * pointer into the fc_list
+ */
+ tstart = ttime;
+ /*
+ * index of split files
+ */
+ j = 0;
+ /*
+ * no single output file
+ */
+ if( single_output_file != NULL ) {
+
+ if(base == NULL || strlen(base)==0) {
+ tc_snprintf(out_file, sizeof(out_file), "%s-%04d", in_file, j++ );
+ } else {
+ tc_snprintf(out_file, sizeof(out_file), "%s", base );
+ }
+ if( ( out = AVI_open_output_file( out_file ) ) == NULL ) {
+ AVI_print_error( "AVI open" );
+ exit( 1 );
+ }
+ /*
+ * set video params in the output file
+ */
+ AVI_set_video( out, width, height, fps, codec );
+ if (comfile!=NULL)
+ AVI_set_comment_fd(out, open(comfile, O_RDONLY));
+ /*
+ * set audio params in the output file
+ */
+ for( k = 0; k < AVI_audio_tracks( in ); k++ ) {
+
+ AVI_set_audio_track( in, k );
+ AVI_set_audio_track( out, k );
+
+ rate = AVI_audio_rate ( in );
+ chan = AVI_audio_channels( in );
+ bits = AVI_audio_bits ( in );
+ format = AVI_audio_format ( in );
+ mp3rate= AVI_audio_mp3rate ( in );
+
+ AVI_set_audio( out, chan, rate, bits, format, mp3rate );
+ AVI_set_audio_vbr( out, AVI_get_audio_vbr(in));
+ }
+ }
+ /*
+ * process next fc_time_string
+ */
+ while( ttime != NULL ) {
+ first_frame = 1;
+ start_keyframe = 0;
+ num_frames = ttime->etf - ttime->stf;
+
+ /*
+ * reset input file
+ */
+ AVI_seek_start( in );
+ for( k = 0; k < AVI_audio_tracks( in ); k++ ) {
+ byte_count_audio[ k ] = 0;
+ start_audio_keyframe[ k ] = 0;
+ AVI_set_audio_track (in, k);
+ AVI_set_audio_position_index (in, 0);
+ }
+ AVI_set_audio_track (in, 0);
+ // reset counters
+ vid_chunks = 0;
+ vid_ms_w = 0.0;
+ vid_ms = 0.0;
+
+ for (k = 0; k<AVI_MAX_TRACKS; k++) {
+ aud_ms_w[k] = 0.0;
+ aud_ms[k] = 0.0;
+ }
+
+
+ printf("\nProcessing %d frames %4d to %4d.", num_frames, ttime->stf, ttime->etf);
+ /*
+ * some header may be broken
+ */
+ if( frames <= 0 )
+ frames=INT_MAX;
+ /*
+ * not a single output file
+ */
+ if( single_output_file == NULL ) {
+ /*
+ * prepare output file
+ */
+ if( base == NULL || strlen( base ) == 0 ) {
+ tc_snprintf( out_file, sizeof(out_file), "%s-%04d", in_file, j++ );
+ }
+ else {
+ tc_snprintf( out_file, sizeof(out_file), "%s-%04d", base, j++ );
+ }
+
+ if( ( out = AVI_open_output_file( out_file ) ) == NULL ) {
+ AVI_print_error( "AVI open" );
+ exit( 1 );
+ }
+ /*
+ * set video params in the output file
+ */
+ AVI_set_video( out, width, height, fps, codec );
+ if (comfile!=NULL)
+ AVI_set_comment_fd(out, open(comfile, O_RDONLY));
+ /*
+ * set audio params in the output file
+ */
+ for( k = 0; k < AVI_audio_tracks( in ); k++ ) {
+ AVI_set_audio_track( in, k );
+
+ rate = AVI_audio_rate ( in );
+ chan = AVI_audio_channels( in );
+ bits = AVI_audio_bits ( in );
+ format = AVI_audio_format ( in );
+ mp3rate = AVI_audio_mp3rate ( in );
+
+ AVI_set_audio_track( out, k );
+ AVI_set_audio( out, chan, rate, bits, format, mp3rate );
+ AVI_set_audio_vbr( out, AVI_get_audio_vbr(in) );
+ }
+ }
+ /*
+ * process all frames
+ */
+ for( n = 0; n < frames; n++) {
+ /*
+ * read video frame
+ */
+ bytes = AVI_read_frame( in, data, &key );
+ if( bytes < 0 ) {
+ fprintf( stderr, "%d (%ld)\n", n, bytes );
+ AVI_print_error( "AVI read video frame" );
+ break;
+ }
+
+ vid_ms = (n+1)*1000.0/fps;
+
+ /*
+ * store the key frame
+ */
+ if( n <= ttime->stf && key ) {
+ start_keyframe = n;
+ vid_ms_w = n*1000.0/fps;
+ }
+ /*
+ * read audio frame
+ */
+ for( k = 0; k < AVI_audio_tracks( in ); k++ ) {
+
+ double tms = aud_ms[k];
+ AVI_set_audio_track( in, k );
+
+ byte_count_audio[ k ] = AVI_get_audio_position_index(in);
+
+ if (!didread) {
+ sync_audio_video_avi2avi_ro (vid_ms, &aud_ms[k], in);
+ }
+
+ /*
+ * store the key frame
+ */
+ if( n <= ttime->stf && key ) {
+ start_audio_keyframe[ k ] = byte_count_audio[ k ];
+ aud_ms_w[k] = tms;
+ }
+
+ }
+ /*
+ * if one of the preferred frames write frame (video+audio)
+ * but don't stop until the next keyframe
+ */
+ if( n >= ttime->stf && ( n <= ttime->etf || ( n >= ttime->stf && ! key ) ) ) {
+ /*
+ * do the following ONLY for the first frame
+ */
+ if( first_frame ) {
+ /*
+ * rewind n to point to the last keyframe
+ */
+ printf( "\nFirst Setting start frame to: %d\n", start_keyframe );
+ n = start_keyframe;
+ fc_set_start_time( ttime, n );
+ /*
+ * first the video
+ */
+ AVI_set_video_position( in, start_keyframe );
+ /*
+ * then the audio
+ */
+ //printf("Start Audio (%ld)\n", start_audio_keyframe[ 0 ]);
+ for( k = 0; k < AVI_audio_tracks( in ); k++ ) {
+ AVI_set_audio_track( in, k );
+ //AVI_set_audio_position( in, start_audio_keyframe[ k ] );
+ AVI_set_audio_position_index( in, start_audio_keyframe[ k ]);
+ aud_ms[k] = aud_ms_w[k];
+ }
+ /*
+ * re-read video and audio from rewound position
+ */
+ bytes = AVI_read_frame( in, data, &key );
+
+ // count the frame which will be written also this, too
+ vid_ms = vid_ms_w+1000.0/fps;
+
+ //printf("start_frame (%d) (%f) (%f)\n", n, vid_ms, aud_ms[0]);
+
+ first_frame = 0;
+ }
+ /*
+ * do the write
+ */
+ if( AVI_write_frame( out, data, bytes, key ) < 0 ) {
+ AVI_print_error( "AVI write video frame" );
+ return( -1 );
+ }
+ /*
+ vid_chunks++;
+ vid_ms_w = vid_chunks*1000.0/fps;
+ */
+
+ //printf("Before Enter (%d) (%f) (%f)\n", n, vid_ms, aud_ms[0]);
+ for( k = 0; k < AVI_audio_tracks( in ); k++ ) {
+
+ AVI_set_audio_track( in, k );
+ AVI_set_audio_track( out, k );
+
+ sync_audio_video_avi2avi (vid_ms, &aud_ms[k], in, out);
+ } // foreach audio track
+
+ didread = 1;
+ /*
+ * print our progress
+ */
+ printf( "[%s] (%06d-%06d)\r", out_file, start_keyframe, n);
+ } else {
+ didread = 0;
+ }
+
+ if( key_boundary ) {
+ if( n > ttime->etf && key ) {
+ printf( "\n" );
+ break;
+ }
+ } else {
+ if( n > ttime->etf) {
+ printf( "\n" );
+ break;
+ }
+ }
+ }
+ /*
+ * if we're using split files
+ * close output file
+ */
+ if( single_output_file == NULL ) {
+ if( out != NULL )
+ AVI_close( out );
+ }
+
+ ttime = ttime->next;
+
+ printf( "\nSetting end frame to: %d | cnt(%ld)\n", n - 1, byte_count_audio[0] );
+ }
+
+ if( in != NULL ) AVI_close( in );
+ /*
+ * close up single output file
+ */
+ if( single_output_file != NULL ) {
+ if( out != NULL ) AVI_close( out );
+ }
+
+ if( tstart != NULL )
+ free_fc_time( tstart );
+
+ printf( "\n" );
+
+ break;
+ }
+
+ return( 0 );
+}
+
+
+/*************************************************************************/
+
+/*
+ * Local variables:
+ * c-file-style: "stroustrup"
+ * c-file-offsets: ((case-label . *) (statement-case-intro . *))
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+ */
diff --git a/debian/transcode/transcode-1.1.7/tools/avisync.c b/debian/transcode/transcode-1.1.7/tools/avisync.c
new file mode 100644
index 00000000..dcf967e9
--- /dev/null
+++ b/debian/transcode/transcode-1.1.7/tools/avisync.c
@@ -0,0 +1,778 @@
+/*
+ * avisync.c
+ *
+ * Copyright (C) Thomas Oestreich - June 2001
+ *
+ * This file is part of transcode, a video stream processing tool
+ *
+ * transcode is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * transcode 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#include "transcode.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+#include "buffer.h"
+#include "avilib/avilib.h"
+
+#include "aud_scan.h"
+#include "aud_scan_avi.h"
+
+#define EXE "avisync"
+
+/* AVI_info is no longer in avilib */
+void AVI_info(avi_t *avifile);
+
+void version(void)
+{
+ printf("%s (%s v%s) (C) 2001-2003 Thomas Oestreich,"
+ " 2003-2010 Transcode Team\n",
+ EXE, PACKAGE, VERSION);
+}
+
+
+static void usage(int status)
+{
+ version();
+ printf("\nUsage: %s [options]\n", EXE);
+ printf(" -o file output file\n");
+ printf(" -i file input file\n");
+ printf(" -q be quiet\n");
+ printf(" -a num audio track number [0]\n");
+ printf(" -b n handle vbr audio [1]\n");
+ printf(" -f FILE read AVI comments from FILE [off]\n");
+ //printf(" -N enocde a real silent frame [off]\n");
+ printf(" -n count shift audio by count frames [0]\n");
+ printf(" count>0: audio starts with frame 'count'\n");
+ printf(" count<0: prepend 'count' padding audio frames\n");
+ exit(status);
+}
+
+// buffer
+static char data[SIZE_RGB_FRAME];
+static char ptrdata[SIZE_RGB_FRAME];
+static int ptrlen=0;
+static char *comfile = NULL;
+int is_vbr = 1;
+
+int main(int argc, char *argv[])
+{
+
+ avi_t *avifile1=NULL;
+ avi_t *avifile2=NULL;
+ avi_t *avifile3=NULL;
+
+ char *in_file=NULL, *out_file=NULL;
+
+ long frames, bytes;
+
+ double fps;
+
+ char *codec;
+
+ int track_num=0, aud_tracks;
+ int encode_null=0;
+
+ int i, j, n, key, shift=0;
+
+ int ch, preload=0;
+
+ long rate, mp3rate;
+
+ int width, height, format, chan, bits;
+
+ int be_quiet = 0;
+ FILE *status_fd = stderr;
+
+ /* for null frame encoding */
+ char nulls[32000];
+ long nullbytes=0;
+ char tmp0[] = "/tmp/nullfile.00.avi"; /* XXX: use mktemp*() */
+
+ buffer_list_t *ptr;
+
+ double vid_ms = 0.0, shift_ms = 0.0, one_vid_ms = 0.0;
+ double aud_ms [ AVI_MAX_TRACKS ];
+ int aud_bitrate = 0;
+ int aud_chunks = 0;
+
+ ac_init(AC_ALL);
+
+ if(argc==1) usage(EXIT_FAILURE);
+
+ while ((ch = getopt(argc, argv, "a:b:vi:o:n:Nq?h")) != -1)
+ {
+
+ switch (ch) {
+
+ case 'i':
+
+ if(optarg[0]=='-') usage(EXIT_FAILURE);
+ in_file=optarg;
+
+ break;
+
+ case 'a':
+
+ if(optarg[0]=='-') usage(EXIT_FAILURE);
+ track_num = atoi(optarg);
+
+ if(track_num<0) usage(EXIT_FAILURE);
+
+ break;
+
+ case 'b':
+
+ if(optarg[0]=='-') usage(EXIT_FAILURE);
+ is_vbr = atoi(optarg);
+
+ if(is_vbr<0) usage(EXIT_FAILURE);
+
+ break;
+
+ case 'o':
+
+ if(optarg[0]=='-') usage(EXIT_FAILURE);
+ out_file=optarg;
+
+ break;
+
+ case 'f':
+
+ if(optarg[0]=='-') usage(EXIT_FAILURE);
+ comfile = optarg;
+
+ break;
+
+ case 'n':
+
+ if(sscanf(optarg,"%d", &shift)!=1) {
+ fprintf(stderr, "invalid parameter for option -n\n");
+ usage(EXIT_FAILURE);
+ }
+ break;
+
+ case 'N':
+ encode_null=1;
+ break;
+ case 'q':
+ be_quiet = 1;
+ break;
+ case 'v':
+ version();
+ exit(0);
+ break;
+ case 'h':
+ usage(EXIT_SUCCESS);
+ default:
+ usage(EXIT_FAILURE);
+ }
+ }
+
+ // check
+ if(in_file==NULL || out_file == NULL) usage(EXIT_FAILURE);
+
+ if(shift == 0) fprintf(stderr, "no sync requested - exit");
+
+ memset (nulls, 0, sizeof(nulls));
+
+
+ // open file
+ if(NULL == (avifile1 = AVI_open_input_file(in_file,1))) {
+ AVI_print_error("AVI open");
+ exit(1);
+ }
+
+ if(strcmp(in_file, out_file)==0) {
+ printf("error: output filename conflicts with input filename\n");
+ exit(1);
+ }
+
+ if(NULL == (avifile2 = AVI_open_output_file(out_file))) {
+ AVI_print_error("AVI open");
+ exit(1);
+ }
+
+ if (be_quiet) {
+ if (!(status_fd = fopen("/dev/null", "w"))) {
+ fprintf(stderr, "Can't open /dev/null\n");
+ exit(1);
+ }
+ }
+
+ // read video info;
+
+ AVI_info(avifile1);
+
+ // read video info;
+
+ frames = AVI_video_frames(avifile1);
+ width = AVI_video_width(avifile1);
+ height = AVI_video_height(avifile1);
+
+ fps = AVI_frame_rate(avifile1);
+ codec = AVI_video_compressor(avifile1);
+
+ //set video in outputfile
+ AVI_set_video(avifile2, width, height, fps, codec);
+
+ if (comfile!=NULL)
+ AVI_set_comment_fd(avifile2, open(comfile, O_RDONLY));
+
+ aud_tracks = AVI_audio_tracks(avifile1);
+
+ for(j=0; j<aud_tracks; ++j) {
+
+ AVI_set_audio_track(avifile1, j);
+
+ rate = AVI_audio_rate(avifile1);
+ chan = AVI_audio_channels(avifile1);
+ bits = AVI_audio_bits(avifile1);
+
+ format = AVI_audio_format(avifile1);
+ mp3rate= AVI_audio_mp3rate(avifile1);
+
+ //set next track of output file
+ AVI_set_audio_track(avifile2, j);
+ AVI_set_audio(avifile2, chan, rate, bits, format, mp3rate);
+ AVI_set_audio_vbr(avifile2, is_vbr);
+ }
+
+ //switch to requested audio_channel
+
+ if(AVI_set_audio_track(avifile1, track_num)<0) {
+ fprintf(stderr, "invalid auto track\n");
+ }
+
+ AVI_set_audio_track(avifile2, track_num);
+
+ if (encode_null) {
+ char cmd[1024];
+
+ rate = AVI_audio_rate(avifile2);
+ chan = AVI_audio_channels(avifile2);
+ bits = AVI_audio_bits(avifile2);
+ format = AVI_audio_format(avifile2);
+ mp3rate= AVI_audio_mp3rate(avifile2);
+
+ if (bits==0) bits=16;
+ if (mp3rate%2) mp3rate++;
+
+ fprintf(status_fd, "Creating silent mp3 frame with current parameter\n");
+ memset (cmd, 0, sizeof(cmd));
+ tc_snprintf(cmd, sizeof(cmd), "transcode -i /dev/zero -o %s -x raw,raw"
+ " -n 0x1 -g 16x16 -y raw,raw -c 0-5 -e %ld,%d,%d -b %ld -q0",
+ tmp0, rate,bits,chan, mp3rate);
+
+ printf("%s\n", cmd);
+ system(cmd);
+
+ if(NULL == (avifile3 = AVI_open_input_file(tmp0,1))) {
+ AVI_print_error("AVI open");
+ exit(1);
+ }
+
+ nullbytes = AVI_audio_size(avifile3, 3);
+
+ /* just read a few frames */
+ if(AVI_read_audio(avifile3, nulls, nullbytes) < 0) {
+ AVI_print_error("AVI audio read frame");
+ return(-1);
+ }
+ memset (nulls, 0, sizeof(nulls));
+ if(AVI_read_audio(avifile3, nulls, nullbytes) < 0) {
+ AVI_print_error("AVI audio read frame");
+ return(-1);
+ }
+ memset (nulls, 0, sizeof(nulls));
+ if(AVI_read_audio(avifile3, nulls, nullbytes) < 0) {
+ AVI_print_error("AVI audio read frame");
+ return(-1);
+ }
+
+
+ /*
+ printf("\nBytes (%ld): \n", nullbytes);
+ {
+ int asd=0;
+ for (asd=0; asd<nullbytes; asd++){
+ printf("%x ",(unsigned char)nulls[asd]);
+ }
+ printf("\n");
+ }
+ */
+
+
+
+ }
+
+ vid_ms = 0.0;
+ shift_ms = 0.0;
+ for (n=0; n<AVI_MAX_TRACKS; ++n)
+ aud_ms[n] = 0.0;
+
+ // ---------------------------------------------------------------------
+
+ for (n=0; n<frames; ++n) {
+
+ // video unchanged
+ bytes = AVI_read_frame(avifile1, data, &key);
+
+ if(bytes < 0) {
+ AVI_print_error("AVI read video frame");
+ return(-1);
+ }
+
+ if(AVI_write_frame(avifile2, data, bytes, key)<0) {
+ AVI_print_error("AVI write video frame");
+ return(-1);
+ }
+
+ vid_ms = (n+1)*1000.0/fps;
+
+
+ // Pass-through all other audio tracks.
+ for(j=0; j<aud_tracks; ++j) {
+
+ // skip track we want to modify
+ if (j == track_num) continue;
+
+ // switch to track
+ AVI_set_audio_track(avifile1, j);
+ AVI_set_audio_track(avifile2, j);
+ sync_audio_video_avi2avi(vid_ms, &aud_ms[j], avifile1, avifile2);
+ }
+
+ //switch to requested audio_channel
+ if(AVI_set_audio_track(avifile1, track_num)<0) {
+ fprintf(stderr, "invalid auto track\n");
+ }
+ AVI_set_audio_track(avifile2, track_num);
+ shift_ms = (double)shift*1000.0/fps;
+ one_vid_ms = 1000.0/fps;
+ format = AVI_audio_format(avifile1);
+ rate = AVI_audio_rate(avifile1);
+ chan = AVI_audio_channels(avifile1);
+ bits = AVI_audio_bits(avifile1);
+ bits = bits==0?16:bits;
+ mp3rate= AVI_audio_mp3rate(avifile1);
+
+
+ if(shift>0) {
+
+ // for n < shift, shift audio frames are discarded
+
+ if(!preload) {
+
+ if (tc_format_ms_supported(format)) {
+ for(i=0;i<shift;++i) {
+ //fprintf (stderr, "shift (%d) i (%d) n (%d) a (%d)\n", shift, i, n, aud_chunks);
+ while (aud_ms[track_num] < vid_ms + one_vid_ms*(double)i) {
+
+ aud_bitrate = (format==0x1||format==0x2000)?1:0;
+ aud_chunks++;
+ if( (bytes = AVI_read_audio_chunk(avifile1, data)) <= 0) {
+ aud_ms[track_num] = vid_ms + one_vid_ms*i;
+ if (bytes == 0) continue;
+ AVI_print_error("AVI 2 audio read frame");
+ break;
+ }
+
+ if ( !aud_bitrate && tc_get_audio_header(data, bytes, format, NULL, NULL, &aud_bitrate)<0) {
+ // if this is the last frame of the file, slurp in audio chunks
+ if (n == frames-1) continue;
+ aud_ms[track_num] = vid_ms + one_vid_ms*i;
+ } else
+ aud_ms[track_num] += (bytes*8.0)/(format==0x1?((double)(rate*chan*bits)/1000.0):
+ (format==0x2000?(double)(mp3rate):aud_bitrate));
+ }
+ }
+
+ } else { // fallback
+ bytes=0;
+ for(i=0;i<shift;++i) {
+ do {
+ if( (bytes = AVI_read_audio_chunk(avifile1, data)) < 0) {
+ AVI_print_error("AVI audio read frame");
+ return(-1);
+ }
+ } while (AVI_can_read_audio(avifile1));
+ }
+ }
+ preload=1;
+ }
+
+
+ // copy rest of the track
+ if(n<frames-shift) {
+ if (tc_format_ms_supported(format)) {
+
+ while (aud_ms[track_num] < vid_ms + shift_ms) {
+
+ aud_chunks++;
+ aud_bitrate = (format==0x1||format==0x2000)?1:0;
+
+ if( (bytes = AVI_read_audio_chunk(avifile1, data)) < 0) {
+ aud_ms[track_num] = vid_ms + shift_ms;
+ AVI_print_error("AVI 3 audio read frame");
+ break;
+ }
+
+ if(AVI_write_audio(avifile2, data, bytes) < 0) {
+ AVI_print_error("AVI 3 write audio frame");
+ return(-1);
+ }
+
+ fprintf(status_fd, "V [%05d][%08.2f] | A [%05d][%08.2f] [%05ld]\r", n, vid_ms, aud_chunks, aud_ms[track_num], bytes);
+
+ if (bytes == 0) {
+ aud_ms[track_num] = vid_ms + shift_ms;
+ continue;
+ }
+
+ if(n>=frames-2*shift) {
+
+ // save audio frame for later
+ ptr = buffer_register(n);
+
+ if(ptr==NULL) {
+ fprintf(stderr,"buffer allocation failed\n");
+ break;
+ }
+
+ ac_memcpy(ptr->data, data, bytes);
+ ptr->size = bytes;
+ ptr->status = BUFFER_READY;
+ }
+
+
+ if ( !aud_bitrate && tc_get_audio_header(data, bytes, format, NULL, NULL, &aud_bitrate)<0) {
+ if (n == frames-1) continue;
+ aud_ms[track_num] = vid_ms + shift_ms;
+ } else
+ aud_ms[track_num] += (bytes*8.0)/(format==0x1?((double)(rate*chan*bits)/1000.0):
+ (format==0x2000?(double)(mp3rate):aud_bitrate));
+ }
+
+ } else { // fallback
+ bytes = AVI_audio_size(avifile1, n+shift-1);
+
+ do {
+ if( (bytes = AVI_read_audio_chunk(avifile1, data)) < 0) {
+ AVI_print_error("AVI audio read frame");
+ return(-1);
+ }
+
+ if(AVI_write_audio(avifile2, data, bytes) < 0) {
+ AVI_print_error("AVI write audio frame");
+ return(-1);
+ }
+
+ fprintf(status_fd, "V [%05d] | A [%05d] [%05ld]\r", n, n+shift, bytes);
+
+ if(n>=frames-2*shift) {
+
+ // save audio frame for later
+ ptr = buffer_register(n);
+
+ if(ptr==NULL) {
+ fprintf(stderr,"buffer allocation failed\n");
+ break;
+ }
+
+ ac_memcpy(ptr->data, data, bytes);
+ ptr->size = bytes;
+ ptr->status = BUFFER_READY;
+ }
+ } while (AVI_can_read_audio(avifile1));
+ }
+ }
+
+ // padding at the end
+ if(n>=frames-shift) {
+
+ if (!ptrlen) {
+ ptr = buffer_retrieve();
+ ac_memcpy (ptrdata, ptr->data, ptr->size);
+ ptrlen = ptr->size;
+ }
+
+ if (tc_format_ms_supported(format)) {
+
+ while (aud_ms[track_num] < vid_ms + shift_ms) {
+
+ aud_bitrate = (format==0x1||format==0x2000)?1:0;
+
+ // mute this -- check if can mute (valid A header)!
+ if (tc_probe_audio_header(ptrdata, ptrlen) > 0)
+ tc_format_mute(ptrdata, ptrlen, format);
+
+ if(AVI_write_audio(avifile2, ptrdata, ptrlen) < 0) {
+ AVI_print_error("AVI write audio frame");
+ return(-1);
+ }
+
+ fprintf(status_fd, " V [%05d][%08.2f] | A [%05d][%08.2f] [%05ld]\r", n, vid_ms, n+shift, aud_ms[track_num], bytes);
+
+ if ( !aud_bitrate && tc_get_audio_header(ptrdata, ptrlen, format, NULL, NULL, &aud_bitrate)<0) {
+ //if (n == frames-1) continue;
+ aud_ms[track_num] = vid_ms + shift_ms;
+ } else
+ aud_ms[track_num] += (ptrlen*8.0)/(format==0x1?((double)(rate*chan*bits)/1000.0):
+ (format==0x2000?(double)(mp3rate):aud_bitrate));
+ }
+
+ } else { // fallback
+
+ // get next audio frame
+ ptr = buffer_retrieve();
+
+ while (1) {
+ printf("ptr->id (%d) ptr->size (%d)\n", ptr->id, ptr->size);
+
+ if(ptr==NULL) {
+ fprintf(stderr,"no buffer found\n");
+ break;
+ }
+
+ if (encode_null) {
+ if(AVI_write_audio(avifile2, nulls, nullbytes)<0) {
+ AVI_print_error("AVI write audio frame");
+ return(-1);
+ }
+ } else {
+ // simple keep old frames to force exact time delay
+ if(AVI_write_audio(avifile2, ptr->data, ptr->size)<0) {
+ AVI_print_error("AVI write audio frame");
+ return(-1);
+ }
+ }
+
+ fprintf(status_fd, "V [%05d] | padding\r", n);
+
+ if (ptr->next && ptr->next->id == ptr->id) {
+ buffer_remove(ptr);
+ ptr = buffer_retrieve();
+ continue;
+ }
+
+ buffer_remove(ptr);
+ break;
+ } // 1
+ }
+ }
+
+
+// *************************************
+// negative shift (pad audio at start)
+// *************************************
+
+ } else {
+
+ if (tc_format_ms_supported(format)) {
+ /*
+ fprintf(status_fd, "n(%d) -shift(%d) shift_ms (%.2lf) vid_ms(%.2lf) aud_ms[%d](%.2lf) v-s(%.2lf)\n",
+ n, -shift, shift_ms, vid_ms, track_num, aud_ms[track_num], vid_ms + shift_ms);
+ */
+
+ // shift<0 -> shift_ms<0 !
+ while (aud_ms[track_num] < vid_ms) {
+ /*
+ fprintf(stderr, " 1 (%02d) %s frame_read len=%4ld (A/V) (%8.2f/%8.2f)\n",
+ n, format==0x55?"MP3":"AC3", bytes, aud_ms[track_num], vid_ms);
+ */
+
+ aud_bitrate = (format==0x1||format==0x2000)?1:0;
+
+ if( (bytes = AVI_read_audio_chunk(avifile1, data)) < 0) {
+ AVI_print_error("AVI 2 audio read frame");
+ aud_ms[track_num] = vid_ms;
+ break;
+ //return(-1);
+ }
+
+ // save audio frame for later
+ ptr = buffer_register(n);
+
+ if(ptr==NULL) {
+ fprintf(stderr,"buffer allocation failed\n");
+ break;
+ }
+
+ ac_memcpy(ptr->data, data, bytes);
+ ptr->size = bytes;
+ ptr->status = BUFFER_READY;
+
+ if(n<-shift) {
+
+ // mute this -- check if can mute!
+ if (tc_probe_audio_header(data, bytes) > 0)
+ tc_format_mute(data, bytes, format);
+
+ // simple keep old frames to force exact time delay
+ if(AVI_write_audio(avifile2, data, bytes)<0) {
+ AVI_print_error("AVI write audio frame");
+ return(-1);
+ }
+
+ fprintf(status_fd, "V [%05d] | padding\r", n);
+
+ } else {
+ if (n==-shift)
+ fprintf(status_fd, "\n");
+
+ // get next audio frame
+ ptr = buffer_retrieve();
+
+ if(ptr==NULL) {
+ fprintf(stderr,"no buffer found\n");
+ break;
+ }
+
+ if(AVI_write_audio(avifile2, ptr->data, ptr->size)<0) {
+ AVI_print_error("AVI write audio frame");
+ return(-1);
+ }
+ bytes = ptr->size;
+ ac_memcpy (data, ptr->data, bytes);
+
+ fprintf(status_fd, "V [%05d] | A [%05d]\r", n, ptr->id);
+
+ buffer_remove(ptr);
+ }
+
+ if ( !aud_bitrate && tc_get_audio_header(data, bytes, format, NULL, NULL, &aud_bitrate)<0) {
+ if (n == frames-1) continue;
+ aud_ms[track_num] = vid_ms;
+ } else
+ aud_ms[track_num] += (bytes*8.0)/(format==0x1?((double)(rate*chan*bits)/1000.0):
+ (format==0x2000?(double)(mp3rate):aud_bitrate));
+
+ /*
+ fprintf(stderr, " 1 (%02d) %s frame_read len=%4ld (A/V) (%8.2f/%8.2f)\n",
+ n, format==0x55?"MP3":"AC3", bytes, aud_ms[track_num], vid_ms);
+ */
+
+ }
+
+
+
+
+
+
+
+
+ } else { // no supported format
+
+ bytes = AVI_audio_size(avifile1, n);
+
+
+ if(bytes > SIZE_RGB_FRAME) {
+ fprintf(stderr, "invalid frame size\n");
+ return(-1);
+ }
+
+ if(AVI_read_audio(avifile1, data, bytes) < 0) {
+ AVI_print_error("AVI audio read frame");
+ return(-1);
+ }
+
+ // save audio frame for later
+ ptr = buffer_register(n);
+
+ if(ptr==NULL) {
+ fprintf(stderr,"buffer allocation failed\n");
+ break;
+ }
+
+ ac_memcpy(ptr->data, data, bytes);
+ ptr->size = bytes;
+ ptr->status = BUFFER_READY;
+
+
+ if(n<-shift) {
+
+ if (encode_null) {
+ if(AVI_write_audio(avifile2, nulls, nullbytes)<0) {
+ AVI_print_error("AVI write audio frame");
+ return(-1);
+ }
+ } else {
+ // simple keep old frames to force exact time delay
+ if(AVI_write_audio(avifile2, data, bytes)<0) {
+ AVI_print_error("AVI write audio frame");
+ return(-1);
+ }
+ }
+
+ fprintf(status_fd, "V [%05d] | padding\r", n);
+
+ } else {
+
+ // get next audio frame
+ ptr = buffer_retrieve();
+
+ if(ptr==NULL) {
+ fprintf(stderr,"no buffer found\n");
+ break;
+ }
+
+ if(AVI_write_audio(avifile2, ptr->data, ptr->size)<0) {
+ AVI_print_error("AVI write audio frame");
+ return(-1);
+ }
+
+ fprintf(status_fd, "V [%05d] | A [%05d]\r", n, ptr->id);
+
+ buffer_remove(ptr);
+ }
+ }
+ }
+ }
+
+ fprintf(status_fd, "\n");
+
+ if (be_quiet) {
+ fclose(status_fd);
+ }
+
+ AVI_close(avifile1);
+ AVI_close(avifile2);
+
+ if (avifile3) {
+ memset(nulls, 0, sizeof(nulls));
+ tc_snprintf(nulls, sizeof(nulls), "rm -f %s", tmp0);
+ system(nulls);
+ AVI_close(avifile3);
+ }
+
+ return(0);
+}
+
+/*************************************************************************/
+
+/*
+ * Local variables:
+ * c-file-style: "stroustrup"
+ * c-file-offsets: ((case-label . *) (statement-case-intro . *))
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+ */
diff --git a/debian/transcode/transcode-1.1.7/tools/buffer.c b/debian/transcode/transcode-1.1.7/tools/buffer.c
new file mode 100644
index 00000000..2f513357
--- /dev/null
+++ b/debian/transcode/transcode-1.1.7/tools/buffer.c
@@ -0,0 +1,158 @@
+/*
+ * buffer.c
+ *
+ * Copyright (C) Thomas Oestreich - June 2001
+ *
+ * This file is part of transcode, a video stream processing tool
+ *
+ * transcode is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * transcode 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "buffer.h"
+
+#include <stdlib.h>
+#include <unistd.h>
+
+buffer_list_t *buffer_list_head;
+buffer_list_t *buffer_list_tail;
+
+buffer_list_t *buffer_register(int id)
+
+{
+
+ /* objectives:
+ ===========
+
+ register new buffer
+
+ allocate space for new buffer and establish backward reference
+
+
+ */
+
+ buffer_list_t *ptr;
+
+ // retrive a valid pointer from the pool
+
+ if((ptr = malloc(sizeof(buffer_list_t))) == NULL) return(NULL);
+
+ if((ptr->data = (char *) malloc(MAX_PCM_BUFFER)) == NULL) return(NULL);
+
+ ptr->status = BUFFER_EMPTY;
+
+ ptr->next = NULL;
+ ptr->prev = NULL;
+
+ ptr->id = id;
+
+ if(buffer_list_tail != NULL)
+ {
+ buffer_list_tail->next = ptr;
+ ptr->prev = buffer_list_tail;
+ }
+
+ buffer_list_tail = ptr;
+
+ /* first buffer registered must set buffer_list_head */
+
+ if(buffer_list_head == NULL) buffer_list_head = ptr;
+
+ return(ptr);
+
+}
+
+
+/* ------------------------------------------------------------------ */
+
+
+void buffer_remove(buffer_list_t *ptr)
+
+{
+
+ /* objectives:
+ ===========
+
+ remove buffer from chained list
+
+ */
+
+
+ if(ptr == NULL) return; // do nothing if null pointer
+
+ if(ptr->prev != NULL) (ptr->prev)->next = ptr->next;
+ if(ptr->next != NULL) (ptr->next)->prev = ptr->prev;
+
+ if(ptr == buffer_list_tail) buffer_list_tail = ptr->prev;
+ if(ptr == buffer_list_head) buffer_list_head = ptr->next;
+
+ // release valid pointer to pool
+ ptr->status = BUFFER_EMPTY;
+
+ free(ptr->data);
+ free(ptr);
+ ptr=NULL;
+
+}
+
+
+/* ------------------------------------------------------------------ */
+
+
+buffer_list_t *buffer_retrieve()
+
+{
+
+ /* objectives:
+ ===========
+
+ get pointer to next full buffer
+
+ */
+
+ buffer_list_t *ptr;
+
+ ptr = buffer_list_head;
+
+ /* move along the chain and check for status */
+
+ while(ptr != NULL)
+ {
+ if(ptr->status == BUFFER_READY)
+ {
+
+ return(ptr);
+ }
+ ptr = ptr->next;
+ }
+
+ return(NULL);
+}
+
+/*************************************************************************/
+
+/*
+ * Local variables:
+ * c-file-style: "stroustrup"
+ * c-file-offsets: ((case-label . *) (statement-case-intro . *))
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+ */
diff --git a/debian/transcode/transcode-1.1.7/tools/buffer.h b/debian/transcode/transcode-1.1.7/tools/buffer.h
new file mode 100644
index 00000000..332929f9
--- /dev/null
+++ b/debian/transcode/transcode-1.1.7/tools/buffer.h
@@ -0,0 +1,57 @@
+/*
+ * buffer.h
+ *
+ * Copyright (C) Thomas Oestreich - June 2001
+ *
+ * This file is part of transcode, a video stream processing tool
+ *
+ * transcode is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * transcode 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#include "transcode.h"
+
+#ifndef _BUFFER_H
+#define _BUFFER_H
+
+#define BUFFER_NULL -1
+#define BUFFER_EMPTY 0
+#define BUFFER_READY 1
+
+#define MAX_PCM_BUFFER (SIZE_PCM_FRAME<<2)
+
+
+typedef struct buffer_list {
+
+ int id; // buffer number
+ int status; // buffer status
+
+ struct buffer_list *next;
+ struct buffer_list *prev;
+
+ int size;
+
+ char *data;
+
+} buffer_list_t;
+
+buffer_list_t *buffer_register(int id);
+void buffer_remove(buffer_list_t *ptr);
+buffer_list_t *buffer_retrieve(void);
+
+extern buffer_list_t *buffer_list_head;
+extern buffer_list_t *buffer_list_tail;
+
+#endif
diff --git a/debian/transcode/transcode-1.1.7/tools/rawsource.c b/debian/transcode/transcode-1.1.7/tools/rawsource.c
new file mode 100644
index 00000000..4951a0a8
--- /dev/null
+++ b/debian/transcode/transcode-1.1.7/tools/rawsource.c
@@ -0,0 +1,288 @@
+/*
+ * rawsource.c -- (almost) raw source reader interface for encoder
+ * expect WAV audio and YUV4MPEG2 video
+ * (C) 2006-2010 - Francesco Romani <fromani at gmail dot com>
+ *
+ * This file is part of transcode, a video stream processing tool.
+ *
+ * transcode is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * transcode 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <string.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include "framebuffer.h"
+#include "dl_loader.h"
+#include "rawsource.h"
+#include "libtc/libtc.h"
+#include "libtc/tcframes.h"
+#include "avilib/wavlib.h"
+#include "rawsource.h"
+
+#define RAWSOURCE_IM_MOD "yuv4mpeg"
+
+static int rawsource_read_video(TCEncoderBuffer *buf, vob_t *vob);
+static int rawsource_read_audio(TCEncoderBuffer *buf, vob_t *vob);
+static void rawsource_dummy(TCEncoderBuffer *buf);
+
+
+typedef struct tcrawsource_ {
+ void *im_handle;
+ transfer_t im_para;
+
+ int eof_flag;
+ int sources;
+
+ vframe_list_t *vframe;
+ aframe_list_t *aframe;
+ int acount;
+} TCFileSource;
+
+static TCFileSource rawsource = {
+ .im_handle = NULL,
+
+ .eof_flag = TC_FALSE,
+ .sources = 0,
+
+ .vframe = NULL,
+ .aframe = NULL,
+ .acount = 0,
+};
+
+static TCEncoderBuffer raw_buffer = {
+ .frame_id = 0,
+
+ .vptr = NULL,
+ .aptr = NULL,
+
+ .acquire_video_frame = rawsource_read_video,
+ .acquire_audio_frame = rawsource_read_audio,
+ .dispose_video_frame = rawsource_dummy,
+ .dispose_audio_frame = rawsource_dummy,
+};
+TCEncoderBuffer *tc_rawsource_buffer = NULL;
+
+static int rawsource_read_video(TCEncoderBuffer *buf, vob_t *vob)
+{
+ int ret;
+
+ if (!buf) {
+ /* paranoia */
+ return -1;
+ }
+ if (vob->im_v_size > rawsource.vframe->video_size) {
+ /* paranoia */
+ tc_log_error(__FILE__, "video buffer too small"
+ " (this should'nt happen)");
+ return -1;
+ }
+
+ rawsource.im_para.buffer = rawsource.vframe->video_buf;
+ rawsource.im_para.buffer2 = NULL;
+ rawsource.im_para.size = vob->im_v_size;
+ rawsource.im_para.flag = TC_VIDEO;
+
+ ret = tcv_import(TC_IMPORT_DECODE, &rawsource.im_para, vob);
+ if (ret != TC_IMPORT_OK) {
+ /* read failed */
+ rawsource.eof_flag = TC_TRUE;
+ return -1;
+ }
+ rawsource.vframe->video_size = rawsource.im_para.size;
+ rawsource.vframe->attributes = rawsource.im_para.attributes;
+
+ raw_buffer.vptr = rawsource.vframe;
+ raw_buffer.frame_id++;
+ return 0;
+}
+
+static int rawsource_read_audio(TCEncoderBuffer *buf, vob_t *vob)
+{
+ int ret = 0;
+ int abytes = vob->im_a_size;
+
+ // audio adjustment for non PAL frame rates:
+
+ if (rawsource.acount != 0 && rawsource.acount % TC_LEAP_FRAME == 0) {
+ abytes += vob->a_leap_bytes;
+ }
+
+ if (!buf) {
+ /* paranoia */
+ return -1;
+ }
+ if (abytes > rawsource.aframe->audio_size) {
+ /* paranoia */
+ tc_log_error(__FILE__, "audio buffer too small"
+ " (this should'nt happen)");
+ return -1;
+ }
+
+ rawsource.im_para.buffer = rawsource.aframe->audio_buf;
+ rawsource.im_para.buffer2 = NULL;
+ rawsource.im_para.size = abytes;
+ rawsource.im_para.flag = TC_AUDIO;
+
+ ret = tca_import(TC_IMPORT_DECODE, &rawsource.im_para, vob);
+ if (ret != TC_IMPORT_OK) {
+ /* read failed */
+ rawsource.eof_flag = TC_TRUE;
+ return -1;
+ }
+ rawsource.acount++;
+ rawsource.aframe->audio_size = rawsource.im_para.size;
+ rawsource.aframe->attributes = rawsource.im_para.attributes;
+
+ raw_buffer.aptr = rawsource.aframe;
+ return 0;
+}
+
+static void rawsource_dummy(TCEncoderBuffer *buf)
+{
+ return;
+}
+
+int tc_rawsource_open(vob_t *vob)
+{
+ int ret = 0;
+ int num_sources = 0;
+ double samples;
+
+ if (!vob) {
+ goto vframe_failed;
+ }
+
+ rawsource.vframe = tc_new_video_frame(vob->im_v_width, vob->im_v_height,
+ vob->im_v_codec, TC_TRUE);
+ if (!rawsource.vframe) {
+ tc_log_error(__FILE__, "can't allocate video frame buffer");
+ goto vframe_failed;
+ }
+ samples = TC_AUDIO_SAMPLES_IN_FRAME(vob->a_rate, vob->ex_fps);
+ rawsource.aframe = tc_new_audio_frame(samples, vob->a_chan, vob->a_bits);
+ if (!rawsource.aframe) {
+ tc_log_error(__FILE__, "can't allocate audio frame buffer");
+ goto aframe_failed;
+ }
+
+ rawsource.im_handle = load_module(RAWSOURCE_IM_MOD, TC_IMPORT|TC_AUDIO|TC_VIDEO);
+ if (!rawsource.im_handle) {
+ tc_log_error(__FILE__, "can't load import module");
+ goto load_failed;
+ }
+
+ /* hello, module! */
+ memset(&rawsource.im_para, 0, sizeof(transfer_t));
+ rawsource.im_para.flag = vob->verbose;
+ tca_import(TC_IMPORT_NAME, &rawsource.im_para, NULL);
+
+ memset(&rawsource.im_para, 0, sizeof(transfer_t));
+ rawsource.im_para.flag = vob->verbose;
+ tcv_import(TC_IMPORT_NAME, &rawsource.im_para, NULL);
+
+ /* open sources */
+ memset(&rawsource.im_para, 0, sizeof(transfer_t));
+ rawsource.im_para.flag = TC_AUDIO;
+ ret = tca_import(TC_IMPORT_OPEN, &rawsource.im_para, vob);
+ if (TC_IMPORT_OK == ret) {
+ num_sources++;
+ rawsource.sources |= TC_AUDIO;
+ }
+
+ memset(&rawsource.im_para, 0, sizeof(transfer_t));
+ rawsource.im_para.flag = TC_VIDEO;
+ ret = tcv_import(TC_IMPORT_OPEN, &rawsource.im_para, vob);
+ if (TC_IMPORT_OK == ret) {
+ num_sources++;
+ rawsource.sources |= TC_VIDEO;
+ }
+
+ if (num_sources > 0) {
+ tc_rawsource_buffer = &raw_buffer;
+ }
+ return num_sources;
+
+load_failed:
+ tc_del_audio_frame(rawsource.aframe);
+aframe_failed:
+ tc_del_video_frame(rawsource.vframe);
+vframe_failed:
+ return -1;
+}
+
+static void tc_rawsource_free(void)
+{
+ if (rawsource.vframe != NULL) {
+ tc_del_video_frame(rawsource.vframe);
+ rawsource.vframe = NULL;
+ }
+ if (rawsource.aframe != NULL) {
+ tc_del_audio_frame(rawsource.aframe);
+ rawsource.aframe = NULL;
+ }
+}
+
+/* errors not fatal, but notified */
+int tc_rawsource_close(void)
+{
+ tc_rawsource_free();
+
+ if (rawsource.im_handle != NULL) {
+ int ret = 0;
+
+ memset(&rawsource.im_para, 0, sizeof(transfer_t));
+ rawsource.im_para.flag = TC_VIDEO;
+ ret = tcv_import(TC_IMPORT_CLOSE, &rawsource.im_para, NULL);
+ if(ret != TC_IMPORT_OK) {
+ tc_log_warn(__FILE__, "video import module error: CLOSE failed");
+ } else {
+ rawsource.sources &= ~TC_VIDEO;
+ }
+
+ memset(&rawsource.im_para, 0, sizeof(transfer_t));
+ rawsource.im_para.flag = TC_AUDIO;
+ ret = tca_import(TC_IMPORT_CLOSE, &rawsource.im_para, NULL);
+ if(ret != TC_IMPORT_OK) {
+ tc_log_warn(__FILE__, "audio import module error: CLOSE failed");
+ } else {
+ rawsource.sources &= ~TC_AUDIO;
+ }
+
+ if (!rawsource.sources) {
+ unload_module(rawsource.im_handle);
+ rawsource.im_handle = NULL;
+ }
+ }
+ return 0;
+}
+
+/*************************************************************************/
+
+/*
+ * Local variables:
+ * c-file-style: "stroustrup"
+ * c-file-offsets: ((case-label . *) (statement-case-intro . *))
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+ */
diff --git a/debian/transcode/transcode-1.1.7/tools/rawsource.h b/debian/transcode/transcode-1.1.7/tools/rawsource.h
new file mode 100644
index 00000000..e945f932
--- /dev/null
+++ b/debian/transcode/transcode-1.1.7/tools/rawsource.h
@@ -0,0 +1,34 @@
+/*
+ * rawsource.h -- (almost) raw source reader interface for encoder
+ * expect WAV audio and YUV4MPEG2 video
+ * (C) 2006-2010 - Francesco Romani <fromani at gmail dot com>
+ *
+ * This file is part of transcode, a video stream processing tool.
+ *
+ * transcode is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * transcode 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _FILE_SOURCE_H
+#define _FILE_SOURCE_H
+
+#include "transcode.h"
+#include "encoder.h"
+
+extern TCEncoderBuffer *tc_rawsource_buffer;
+
+int tc_rawsource_open(vob_t *vob);
+int tc_rawsource_close(void);
+
+#endif /* _FILE_SOURCE_H */
diff --git a/debian/transcode/transcode-1.1.7/tools/tcexport.c b/debian/transcode/transcode-1.1.7/tools/tcexport.c
new file mode 100644
index 00000000..d6223096
--- /dev/null
+++ b/debian/transcode/transcode-1.1.7/tools/tcexport.c
@@ -0,0 +1,585 @@
+/*
+ * tcexport.c -- standalone encoder frontend for transcode
+ * (C) 2006-2010 - Francesco Romani <fromani at gmail dot com>
+ *
+ * This file is part of transcode, a video stream processing tool.
+ *
+ * transcode is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * transcode 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+#include "transcode.h"
+#include "export_profile.h"
+#include "framebuffer.h"
+#include "counter.h"
+#include "probe.h"
+#include "encoder.h"
+#include "filter.h"
+#include "socket.h"
+#include "libtc/tcmodule-core.h"
+#include "libtc/libtc.h"
+#include "libtc/cfgfile.h"
+#include "libtc/tccodecs.h"
+#include "libtc/tcframes.h"
+
+#include "rawsource.h"
+#include "tcstub.h"
+
+#define EXE "tcexport"
+
+enum {
+ STATUS_DONE = -1, /* used internally */
+ STATUS_OK = 0,
+ STATUS_BAD_PARAM,
+ STATUS_IO_ERROR,
+ STATUS_NO_MODULE,
+ STATUS_MODULE_ERROR,
+ STATUS_PROBE_FAILED,
+ /* ... */
+ STATUS_INTERNAL_ERROR = 64, /* must be the last one */
+};
+
+#define VIDEO_LOG_FILE "mpeg4.log"
+#define AUDIO_LOG_FILE "pcm.log"
+
+#define VIDEO_CODEC "yuv420p"
+#define AUDIO_CODEC "pcm"
+
+#define RANGE_STR_SEP ","
+
+typedef struct tcencconf_ TCEncConf;
+
+struct tcencconf_ {
+ int dry_run; /* flag */
+ vob_t *vob;
+
+ char *video_codec;
+ char *audio_codec;
+
+ char vlogfile[32];
+ char alogfile[32];
+
+ char video_mod_buf[64];
+ char audio_mod_buf[64];
+ char mplex_mod_buf[64];
+
+ char *video_mod;
+ char *audio_mod;
+ char *mplex_mod;
+
+ char *range_str;
+};
+
+
+void version(void)
+{
+ printf("%s v%s (C) 2006-2010 Transcode Team\n",
+ EXE, VERSION);
+}
+
+static void usage(void)
+{
+ version();
+ printf("Usage: %s [options]\n", EXE);
+ printf(" -d verbosity Verbosity mode [1 == TC_INFO]\n");
+ printf(" -D dry run, only loads module (used"
+ " for testing)\n");
+ printf(" -m path Use PATH as module path\n");
+ printf(" -c f1-f2[,f3-f4] encode only f1-f2[,f3-f4]"
+ " (frames or HH:MM:SS) [all]\n");
+ printf(" -b b[,v[,q[,m]]] audio encoder bitrate kBits/s"
+ "[,vbr[,quality[,mode]]] [%i,%i,%i,%i]\n",
+ ABITRATE, AVBR, AQUALITY, AMODE);
+ printf(" -i file video input file name\n");
+ printf(" -p file audio input file name\n");
+ printf(" -o file output file (base)name\n");
+ printf(" -P profile select export profile."
+ " if you want to use more than one profile,\n"
+ " provide a comma separated list.\n");
+ printf(" -N V,A Video,Audio output format"
+ " (encoder) [%s,%s]\n", VIDEO_CODEC, AUDIO_CODEC);
+ printf(" -y V,A,M Video,Audio,Multiplexor export"
+ " modules [%s,%s,%s]\n", TC_DEFAULT_EXPORT_VIDEO,
+ TC_DEFAULT_EXPORT_AUDIO, TC_DEFAULT_EXPORT_MPLEX);
+ printf(" -w b[,k[,c]] encoder"
+ " bitrate[,keyframes[,crispness]] [%d,%d,%d]\n",
+ VBITRATE, VKEYFRAMES, VCRISPNESS);
+ printf(" -R n[,f1[,f2]] enable multi-pass encoding"
+ " (0-3) [%d,mpeg4.log,pcm.log]\n", VMULTIPASS);
+}
+
+static void config_init(TCEncConf *conf, vob_t *vob)
+{
+ conf->dry_run = TC_FALSE;
+ conf->vob = vob;
+
+ conf->range_str = NULL;
+
+ strlcpy(conf->vlogfile, VIDEO_LOG_FILE, sizeof(conf->vlogfile));
+ strlcpy(conf->alogfile, AUDIO_LOG_FILE, sizeof(conf->alogfile));
+
+ conf->video_mod = TC_DEFAULT_EXPORT_VIDEO;
+ conf->audio_mod = TC_DEFAULT_EXPORT_AUDIO;
+ conf->mplex_mod = TC_DEFAULT_EXPORT_MPLEX;
+}
+
+/* split up module string (=options) to module name */
+static char *setup_mod_string(char *mod)
+{
+ size_t modlen = strlen(mod);
+ char *sep = strchr(mod, '=');
+ char *opts = NULL;
+
+ if (modlen > 0 && sep != NULL) {
+ size_t optslen;
+
+ opts = sep + 1;
+ optslen = strlen(opts);
+
+ if (!optslen) {
+ opts = NULL; /* no options or bad options given */
+ }
+ *sep = '\0'; /* mark end of module name */
+ }
+ return opts;
+}
+
+/* basic sanity check */
+#define VALIDATE_OPTION \
+ if (optarg[0] == '-') { \
+ usage(); \
+ return STATUS_BAD_PARAM; \
+ }
+
+static int parse_options(int argc, char** argv, TCEncConf *conf)
+{
+ int ch, n;
+ char acodec[32], vcodec[32];
+ vob_t *vob = conf->vob;
+
+ if (argc == 1) {
+ usage();
+ return STATUS_BAD_PARAM;
+ }
+
+ libtc_init(&argc, &argv);
+
+ while (1) {
+ ch = getopt(argc, argv, "b:c:Dd:hi:m:N:o:p:R:y:w:v?");
+ if (ch == -1) {
+ break;
+ }
+
+ switch (ch) {
+ case 'D':
+ conf->dry_run = TC_TRUE;
+ break;
+ case 'd':
+ VALIDATE_OPTION;
+ vob->verbose = atoi(optarg);
+ break;
+ case 'c':
+ VALIDATE_OPTION;
+ conf->range_str = optarg;
+ break;
+ case 'b':
+ VALIDATE_OPTION;
+ n = sscanf(optarg, "%i,%i,%f,%i",
+ &vob->mp3bitrate, &vob->a_vbr, &vob->mp3quality,
+ &vob->mp3mode);
+ if (n < 0
+ || vob->mp3bitrate < 0
+ || vob->a_vbr < 0
+ || vob->mp3quality < -1.00001
+ || vob->mp3mode < 0) {
+ tc_log_error(EXE, "invalid parameter for -b");
+ return STATUS_BAD_PARAM;
+ }
+ break;
+ case 'i':
+ VALIDATE_OPTION;
+ vob->video_in_file = optarg;
+ break;
+ case 'm':
+ VALIDATE_OPTION;
+ vob->mod_path = optarg;
+ break;
+ case 'N':
+ VALIDATE_OPTION;
+ n = sscanf(optarg,"%32[^,],%32s", vcodec, acodec);
+ if (n != 2) {
+ tc_log_error(EXE, "invalid parameter for option -N"
+ " (you must specify ALL parameters)");
+ return STATUS_BAD_PARAM;
+ }
+
+ vob->ex_v_codec = tc_codec_from_string(vcodec);
+ vob->ex_a_codec = tc_codec_from_string(acodec);
+
+ if (vob->ex_v_codec == TC_CODEC_ERROR
+ || vob->ex_a_codec == TC_CODEC_ERROR) {
+ tc_log_error(EXE, "unknown A/V format");
+ return STATUS_BAD_PARAM;
+ }
+ break;
+ case 'p':
+ VALIDATE_OPTION;
+ vob->audio_in_file = optarg;
+ break;
+ case 'R':
+ VALIDATE_OPTION;
+ n = sscanf(optarg,"%d,%64[^,],%64s",
+ &vob->divxmultipass, conf->vlogfile, conf->alogfile);
+
+ if (n == 3) {
+ vob->audiologfile = conf->alogfile;
+ vob->divxlogfile = conf->vlogfile;
+ } else if (n == 2) {
+ vob->divxlogfile = conf->vlogfile;
+ } else if (n != 1) {
+ tc_log_error(EXE, "invalid parameter for option -R");
+ return STATUS_BAD_PARAM;
+ }
+
+ if (vob->divxmultipass < 0 || vob->divxmultipass > 3) {
+ tc_log_error(EXE, "invalid multi-pass in option -R");
+ return STATUS_BAD_PARAM;
+ }
+ break;
+ case 'o':
+ VALIDATE_OPTION;
+ vob->video_out_file = optarg;
+ break;
+ case 'w':
+ VALIDATE_OPTION;
+ sscanf(optarg,"%d,%d,%d",
+ &vob->divxbitrate, &vob->divxkeyframes,
+ &vob->divxcrispness);
+
+ if (vob->divxcrispness < 0 || vob->divxcrispness > 100
+ || vob->divxbitrate <= 0 || vob->divxkeyframes < 0) {
+ tc_log_error(EXE, "invalid parameter for option -w");
+ return STATUS_BAD_PARAM;
+ }
+ break;
+ case 'y':
+ VALIDATE_OPTION;
+ n = sscanf(optarg,"%64[^,],%64[^,],%64s",
+ conf->video_mod_buf, conf->audio_mod_buf,
+ conf->mplex_mod_buf);
+ if (n != 3) {
+ tc_log_error(EXE, "invalid parameter for option -y"
+ " (you must specify ALL parameters)");
+ return STATUS_BAD_PARAM;
+ }
+ conf->video_mod = conf->video_mod_buf;
+ conf->audio_mod = conf->audio_mod_buf;
+ conf->mplex_mod = conf->mplex_mod_buf;
+
+ vob->ex_v_string = setup_mod_string(conf->video_mod);
+ vob->ex_a_string = setup_mod_string(conf->audio_mod);
+ vob->ex_m_string = setup_mod_string(conf->mplex_mod);
+ break;
+ case 'v':
+ version();
+ return STATUS_DONE;
+ case '?': /* fallthrough */
+ case 'h': /* fallthrough */
+ default:
+ usage();
+ return STATUS_BAD_PARAM;
+ }
+ }
+ return STATUS_OK;
+}
+
+static void setup_im_size(vob_t *vob)
+{
+ double fch;
+ int leap_bytes1, leap_bytes2;
+
+ /* update vob structure */
+ /* assert(YUV420P source) */
+ vob->im_v_size = (3 * vob->im_v_width * vob->im_v_height) / 2;
+ /* borrowed from transcode.c */
+ /* samples per audio frame */
+ // fch = vob->a_rate/vob->ex_fps;
+ /*
+ * XXX I still have to understand why we
+ * doing like this in transcode.c, so I'll simplify things here
+ */
+ fch = vob->a_rate/vob->fps;
+ /* bytes per audio frame */
+ vob->im_a_size = (int)(fch * (vob->a_bits/8) * vob->a_chan);
+ vob->im_a_size = (vob->im_a_size>>2)<<2;
+
+ fch *= (vob->a_bits/8) * vob->a_chan;
+
+ leap_bytes1 = TC_LEAP_FRAME * (fch - vob->im_a_size);
+ leap_bytes2 = - leap_bytes1 + TC_LEAP_FRAME * (vob->a_bits/8) * vob->a_chan;
+ leap_bytes1 = (leap_bytes1 >>2)<<2;
+ leap_bytes2 = (leap_bytes2 >>2)<<2;
+
+ if (leap_bytes1 < leap_bytes2) {
+ vob->a_leap_bytes = leap_bytes1;
+ } else {
+ vob->a_leap_bytes = -leap_bytes2;
+ vob->im_a_size += (vob->a_bits/8) * vob->a_chan;
+ }
+}
+
+static void setup_ex_params(vob_t *vob)
+{
+ /* common */
+ vob->ex_fps = vob->fps;
+ vob->ex_frc = vob->im_frc;
+ /* video */
+ vob->ex_v_width = vob->im_v_width;
+ vob->ex_v_height = vob->im_v_height;
+ vob->ex_v_size = vob->im_v_size;
+ /* audio */
+ vob->ex_a_size = vob->im_a_size;
+ /* a_rate already correctly setup */
+ vob->mp3frequency = vob->a_rate;
+ vob->dm_bits = vob->a_bits;
+ vob->dm_chan = vob->a_chan;
+}
+
+static int setup_ranges(TCEncConf *conf)
+{
+ vob_t *vob = conf->vob;
+ int ret = 0;
+
+ if (conf->range_str != NULL) {
+ ret = parse_fc_time_string(conf->range_str, vob->fps,
+ RANGE_STR_SEP, vob->verbose,
+ &vob->ttime);
+ } else {
+ vob->ttime = new_fc_time();
+ if (vob->ttime == NULL) {
+ ret = -1;
+ } else {
+ vob->ttime->stf = TC_FRAME_FIRST;
+ vob->ttime->etf = TC_FRAME_LAST;
+ vob->ttime->vob_offset = 0;
+ vob->ttime->next = NULL;
+ }
+ }
+ return ret;
+}
+
+
+#define MOD_OPTS(opts) (((opts) != NULL) ?((opts)) :"none")
+static void print_summary(TCEncConf *conf, int verbose)
+{
+ vob_t *vob = conf->vob;
+
+ version();
+ if (verbose >= TC_INFO) {
+ tc_log_info(EXE, "M: %-16s | %s", "destination",
+ vob->video_out_file);
+ tc_log_info(EXE, "E: %-16s | %i,%i kbps", "bitrate(A,V)",
+ vob->divxbitrate, vob->mp3bitrate);
+ tc_log_info(EXE, "E: %-16s | %s,%s", "logfile (A,V)",
+ vob->divxlogfile, vob->audiologfile);
+ tc_log_info(EXE, "V: %-16s | %s (options=%s)", "encoder",
+ conf->video_mod, MOD_OPTS(vob->ex_v_string));
+ tc_log_info(EXE, "A: %-16s | %s (options=%s)", "encoder",
+ conf->audio_mod, MOD_OPTS(vob->ex_a_string));
+ tc_log_info(EXE, "M: %-16s | %s (options=%s)", "format",
+ conf->mplex_mod, MOD_OPTS(vob->ex_m_string));
+ tc_log_info(EXE, "M: %-16s | %.3f", "fps", vob->fps);
+ tc_log_info(EXE, "V: %-16s | %ix%i", "picture size",
+ vob->im_v_width, vob->im_v_height);
+ tc_log_info(EXE, "V: %-16s | %i", "bytes per frame",
+ vob->im_v_size);
+ tc_log_info(EXE, "V: %-16s | %i", "pass", vob->divxmultipass);
+ tc_log_info(EXE, "A: %-16s | %i,%i,%i", "rate,chans,bits",
+ vob->a_rate, vob->a_chan, vob->a_bits);
+ tc_log_info(EXE, "A: %-16s | %i", "bytes per frame",
+ vob->im_a_size);
+ tc_log_info(EXE, "A: %-16s | %i@%i", "adjustement",
+ vob->a_leap_bytes, vob->a_leap_frame);
+ }
+}
+#undef MOD_OPTS
+
+/************************************************************************/
+
+#define EXIT_IF(cond, msg, status) \
+ if((cond)) { \
+ tc_log_error(EXE, msg); \
+ return status; \
+ }
+
+#define GET_MODULE(mod) ((mod) != NULL) ?(mod) :"null"
+
+int main(int argc, char *argv[])
+{
+ int ret = 0, status = STATUS_OK;
+ double samples = 0;
+ /* needed by some modules */
+ TCFactory factory = NULL;
+ const TCExportInfo *info = NULL;
+ TCVHandle tcv_handle = tcv_init();
+ TCEncConf config;
+ vob_t *vob = tc_get_vob();
+
+ /* reset some fields */
+ vob->audiologfile = AUDIO_LOG_FILE;
+ vob->divxlogfile = VIDEO_LOG_FILE;
+
+ ac_init(AC_ALL);
+ tc_set_config_dir(NULL);
+ config_init(&config, vob);
+ counter_on();
+
+ filter[0].id = 0; /* to make gcc happy */
+
+ /* we want to modify real argc/argv pair */
+ ret = tc_setup_export_profile(&argc, &argv);
+ if (ret < 0) {
+ /* error, so bail out */
+ return STATUS_BAD_PARAM;
+ }
+ info = tc_load_export_profile();
+ config.audio_mod = GET_MODULE(info->audio.module);
+ config.video_mod = GET_MODULE(info->video.module);
+ config.mplex_mod = GET_MODULE(info->mplex.module);
+ tc_export_profile_to_vob(info, vob);
+
+ ret = parse_options(argc, argv, &config);
+ if (ret != STATUS_OK) {
+ return (ret == STATUS_DONE) ?STATUS_OK :ret;
+ }
+ if (vob->ex_v_codec == TC_CODEC_ERROR
+ || vob->ex_a_codec == TC_CODEC_ERROR) {
+ tc_log_error(EXE, "bad export codec/format (use -N)");
+ return STATUS_BAD_PARAM;
+ }
+ verbose = vob->verbose;
+ ret = probe_source(vob->video_in_file, vob->audio_in_file,
+ 1, 0, vob);
+ if (!ret) {
+ return STATUS_PROBE_FAILED;
+ }
+
+ samples = TC_AUDIO_SAMPLES_IN_FRAME(vob->a_rate, vob->ex_fps);
+ vob->im_a_size = tc_audio_frame_size(samples, vob->a_chan, vob->a_bits,
+ &vob->a_leap_bytes);
+ vob->im_v_size = tc_video_frame_size(vob->im_v_width, vob->im_v_height,
+ vob->im_v_codec);
+ setup_im_size(vob);
+ setup_ex_params(vob);
+ ret = setup_ranges(&config);
+ if (ret != 0) {
+ tc_log_error(EXE, "error using -c option."
+ " Recheck your frame ranges!");
+ return STATUS_BAD_PARAM;
+ }
+ print_summary(&config, verbose);
+
+ factory = tc_new_module_factory(vob->mod_path, vob->verbose);
+ EXIT_IF(!factory, "can't setup module factory", STATUS_MODULE_ERROR);
+
+ /* open the A/V source */
+ ret = tc_rawsource_open(vob);
+ EXIT_IF(ret != 2, "can't open input sources", STATUS_IO_ERROR);
+
+ EXIT_IF(tc_rawsource_buffer == NULL, "can't get rawsource handle",
+ STATUS_IO_ERROR);
+ ret = tc_export_init(tc_rawsource_buffer, factory);
+ EXIT_IF(ret != 0, "can't setup export subsystem", STATUS_MODULE_ERROR);
+
+ ret = tc_export_setup(vob,
+ config.audio_mod, config.video_mod, config.mplex_mod);
+ EXIT_IF(ret != 0, "can't setup export modules", STATUS_MODULE_ERROR);
+
+ if (!config.dry_run) {
+ struct fc_time *tstart = NULL;
+ int last_etf = 0;
+ ret = tc_encoder_init(vob);
+ EXIT_IF(ret != 0, "can't initialize encoder", STATUS_INTERNAL_ERROR);
+
+ ret = tc_encoder_open(vob);
+ EXIT_IF(ret != 0, "can't open encoder files", STATUS_IO_ERROR);
+
+ /* first setup counter ranges */
+ counter_reset_ranges();
+ for (tstart = vob->ttime; tstart != NULL; tstart = tstart->next) {
+ if (tstart->etf == TC_FRAME_LAST) {
+ // variable length range, oh well
+ counter_reset_ranges();
+ break;
+ }
+ if (tstart->stf > last_etf) {
+ counter_add_range(last_etf, tstart->stf-1, 0);
+ }
+ counter_add_range(tstart->stf, tstart->etf-1, 1);
+ last_etf = tstart->etf;
+ }
+
+ /* ok, now we can do the real (ranged) encoding */
+ for (tstart = vob->ttime; tstart != NULL; tstart = tstart->next) {
+ tc_encoder_loop(vob, tstart->stf, tstart->etf);
+ printf("\n"); /* dont' mess (too much) counter output */
+ }
+
+ ret = tc_encoder_stop();
+ ret = tc_encoder_close();
+
+ }
+
+ tc_export_shutdown();
+
+ ret = tc_rawsource_close();
+ ret = tc_del_module_factory(factory);
+ tcv_free(tcv_handle);
+ free_fc_time(vob->ttime);
+ tc_cleanup_export_profile();
+
+ if(verbose >= TC_INFO) {
+ long encoded = tc_get_frames_encoded();
+ long dropped = - tc_get_frames_dropped();
+ long cloned = tc_get_frames_cloned();
+
+ tc_log_info(EXE, "encoded %ld frames (%ld dropped, %ld cloned),"
+ " clip length %6.2f s",
+ encoded, dropped, cloned, encoded/vob->fps);
+ }
+ return status;
+}
+
+/*************************************************************************/
+
+/*
+ * Local variables:
+ * c-file-style: "stroustrup"
+ * c-file-offsets: ((case-label . *) (statement-case-intro . *))
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+ */
diff --git a/debian/transcode/transcode-1.1.7/tools/tcmodchain.c b/debian/transcode/transcode-1.1.7/tools/tcmodchain.c
new file mode 100644
index 00000000..cd553190
--- /dev/null
+++ b/debian/transcode/transcode-1.1.7/tools/tcmodchain.c
@@ -0,0 +1,536 @@
+/*
+ * tcmodchain.c -- simple module system explorer frontend
+ * (C) 2006-2010 - Francesco Romani <fromani at gmail dot com>
+ *
+ * This file is part of transcode, a video stream processing tool.
+ *
+ * transcode is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * transcode 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#include <glob.h>
+#include "tcstub.h"
+
+#define EXE "tcmodchain"
+
+/*************************************************************************/
+
+
+void version(void)
+{
+ printf("%s v%s (C) 2006-2010 Transcode Team\n", EXE, VERSION);
+}
+
+enum {
+ STATUS_DONE = -1, /* used internally */
+ STATUS_OK = 0,
+ STATUS_BAD_PARAM,
+ STATUS_MODULE_ERROR,
+ STATUS_MODULE_MISMATCH,
+ STATUS_GLOB_FAILED,
+};
+
+
+#define MAX_MODS (16)
+
+typedef struct modrequest_ ModRequest;
+struct modrequest_ {
+ char **rawdata; /* main reference */
+
+ const char *type; /* commodity */
+ const char *name; /* commodity */
+
+ TCModule module;
+};
+
+
+static void modrequest_init(ModRequest *modr);
+static int modrequest_load(TCFactory factory,
+ ModRequest *modr, const char *str);
+static int modrequest_scan(const char *modpath, const char *modstr,
+ glob_t *globbuf);
+static int modrequest_fill(TCFactory factory, ModRequest *mods,
+ size_t maxmods, size_t *modnum, glob_t *globbuf);
+#define modrequest_free(GLOBBUF) globfree((GLOBBUF))
+static int modrequest_unload(TCFactory factory, ModRequest *modr);
+
+/*************************************************************************/
+
+enum {
+ TC_MODULE_DEMUXER = 1, /* future */
+ TC_MODULE_DECODER = 2, /* future */
+ TC_MODULE_FILTER = 4, /* future */
+ TC_MODULE_ENCODER = 8,
+ TC_MODULE_MUXER = 16,
+
+ TC_MODULE_FIXED = 1024,
+ TC_MODULE_TEMPLATE = 2048,
+};
+
+
+static uint32_t parse_modstr(const char *str)
+{
+ uint32_t ret = 0;
+ if (str != NULL && strlen(str) > 0) {
+ struct {
+ const char *name;
+ int kind;
+ size_t off;
+ } tags[] = {
+ { "encode:", TC_MODULE_ENCODER, strlen("encode:") },
+ { "multiplex:", TC_MODULE_MUXER, strlen("multiplex:") },
+ { NULL, 0, 0 },
+ };
+ int i = 0;
+
+ for (i = 0; tags[i].name != NULL; i++) {
+ if (strncmp(str, tags[i].name, tags[i].off) == 0) {
+ ret |= tags[i].kind;
+ str += tags[i].off;
+ break;
+ }
+ }
+
+ /* found something supported/making sense */
+ if (ret != 0 && (str != NULL && strlen(str) > 0)) {
+ if (!strcmp(str, "*")) {
+ ret |= TC_MODULE_TEMPLATE;
+ } else {
+ ret |= TC_MODULE_FIXED;
+ }
+ }
+ }
+ return ret;
+}
+
+static int parse_path(const char *fullpath, char *modstr, size_t buflen)
+{
+ const char *pc = NULL;
+ char *pr = NULL;
+
+ if (!fullpath || !modstr || (buflen < TC_BUF_MIN)) {
+ return TC_ERROR;
+ }
+
+ pc = strrchr(fullpath, '/');
+ if (pc == NULL || strlen(pc + 1) > buflen) {
+ return TC_ERROR;
+ }
+ strlcpy(modstr, pc + 1, buflen);
+
+ pr = strrchr(modstr, '.');
+ if (pr == NULL) {
+ return TC_ERROR;
+ }
+ *pr = '\0';
+
+ pr = strchr(modstr, '_');
+ if (pr == NULL) {
+ return TC_ERROR;
+ }
+ *pr = ':';
+
+ return TC_OK;
+}
+
+
+/*************************************************************************/
+
+static void modrequest_init(ModRequest *modr)
+{
+ if (modr != NULL) {
+ modr->rawdata = NULL;
+ modr->type = NULL;
+ modr->name = NULL;
+ modr->module = NULL;
+ }
+}
+
+static int modrequest_load(TCFactory factory,
+ ModRequest *modr, const char *str)
+{
+ size_t pieces = 0;
+
+ if (factory == NULL || modr == NULL || str == NULL) {
+ tc_log_warn(EXE, "wrong parameters for modrequest_load");
+ return TC_ERROR;
+ }
+
+ modr->rawdata = tc_strsplit(str, ':', &pieces);
+ if (modr->rawdata == NULL || pieces != 2) {
+ tc_log_warn(EXE, "malformed module string: %s", str);
+ return TC_ERROR;
+ }
+ modr->type = modr->rawdata[0];
+ modr->name = modr->rawdata[1];
+
+ modr->module = tc_new_module(factory, modr->type, modr->name, TC_NONE);
+ if (modr->module == NULL) {
+ tc_log_warn(EXE, "failed creation of module: %s", str);
+ return TC_ERROR;
+ }
+ return TC_OK;
+}
+
+static int modrequest_unload(TCFactory factory, ModRequest *modr)
+{
+ if (factory == NULL || modr == NULL) {
+ tc_log_warn(EXE, "wrong parameters for modrequest_load");
+ return TC_ERROR;
+ }
+
+ tc_del_module(factory, modr->module);
+ tc_strfreev(modr->rawdata);
+
+ /* re-blank fields */
+ modrequest_init(modr);
+
+ return TC_OK;
+}
+
+static int modrequest_scan(const char *modpath, const char *modstr,
+ glob_t *globbuf)
+{
+ char path_model[PATH_MAX];
+ char buf[TC_BUF_MIN];
+ const char *pc = NULL;
+ int err = 0;
+
+ pc = strchr(modstr, ':');
+ if (pc == NULL) {
+ return 1;
+ }
+ if ((pc - modstr + 1) > sizeof(buf)) {
+ return 2; /* XXX watch out here */
+ }
+ strlcpy(buf, modstr, pc - modstr + 1);
+
+ tc_snprintf(path_model, sizeof(path_model), "%s/%s_*.so", modpath, buf);
+ err = glob(path_model, GLOB_ERR, NULL, globbuf);
+
+ if (err) {
+ tc_log_error(EXE, "error while scanning for modules: %s",
+ (err == GLOB_NOSPACE) ?"can't get enough memory" :
+ (err == GLOB_ABORTED) ?"read error" :
+ /* GLOB_NOMATCH */ "no modules found");
+ return -1;
+ }
+ return 0;
+}
+
+static int modrequest_fill(TCFactory factory, ModRequest *mods,
+ size_t maxmods, size_t *modnum, glob_t *globbuf)
+{
+ char modstr[TC_BUF_MIN];
+ int i = 0, count = 0, lim = 0;
+
+ if (!factory || !mods || !globbuf) {
+ return TC_ERROR;
+ }
+ if (maxmods < globbuf->gl_pathc) {
+ tc_log_warn(EXE, "found %u candidate modules, but "
+ "only %u allowed (dropping remaining)",
+ (unsigned)globbuf->gl_pathc, (unsigned)maxmods);
+ }
+ lim = TC_MIN(maxmods, globbuf->gl_pathc);
+
+ for (i = 0; i < lim; i++) {
+ int ret;
+
+ ret = parse_path(globbuf->gl_pathv[i], modstr, TC_BUF_MIN);
+ if (ret != 0) {
+ tc_log_warn(EXE, "error while parsing '%s', skipping",
+ globbuf->gl_pathv[i]);
+ continue;
+ }
+ ret = modrequest_load(factory, &mods[i], modstr);
+ if (ret != 0) {
+ tc_log_warn(EXE, "error while loading '%s', skipping",
+ modstr);
+ continue;
+ }
+ count++;
+ }
+
+ if (modnum != NULL) {
+ *modnum += count;
+ }
+
+ return TC_OK;
+}
+
+/*************************************************************************/
+
+typedef struct cmdletdata_ CmdLetData;
+struct cmdletdata_ {
+ ModRequest mods[MAX_MODS];
+ size_t modsnum;
+
+ const char *modpath;
+ TCFactory factory;
+};
+
+typedef int (*CmdLet)(CmdLetData *cdata, int argc, char **argv);
+
+
+#define CLEANUP(CDATA) do { \
+ int i = 0; \
+ for (i = 0; i < (CDATA)->modsnum; i++) { \
+ modrequest_unload((CDATA)->factory, &((CDATA)->mods[i])); \
+ } \
+ (CDATA)->modsnum = 0; \
+} while (0)
+
+/* XXX */
+static int check_module_pair(const ModRequest *head,
+ const ModRequest *tail,
+ const ModRequest *ref,
+ int verbose)
+{
+ int ret = 0;
+
+ if (head->module == NULL || tail->module == NULL) {
+ tc_log_error(EXE, "check_module_pair: missing module handle");
+ return -1;
+ }
+
+ ret = tc_module_info_match(TC_CODEC_ANY,
+ tc_module_get_info(head->module),
+ tc_module_get_info(tail->module));
+ if (verbose >= TC_DEBUG) {
+ tc_log_info(EXE, "%s:%s | %s:%s [%s]",
+ head->type, head->name, tail->type, tail->name,
+ (ret == 1) ?"OK" :"MISMATCH");
+ } else if (verbose >= TC_INFO) {
+ if (ret == 1) {
+ printf("%s\n", ref->name);
+ }
+ }
+ return ret;
+}
+
+static int cmdlet_usage(CmdLetData *unused, int ac, char **av)
+{
+ version();
+ printf("Usage: %s [options] module [module... [module...]]\n",
+ EXE);
+ printf(" -L list mode (see manpage for details)\n");
+ printf(" -C check mode (see manpage for details)\n");
+ printf(" -d verbosity verbosity mode [1 == TC_INFO]\n");
+ printf(" -m PATH use PATH as module path\n");
+ printf(" -v show program version and exit\n");
+ printf(" -h show this help message\n");
+ return STATUS_OK;
+}
+
+
+static int cmdlet_check(CmdLetData *cdata, int ac, char **av)
+{
+ int i = 0, matches = 0;
+ int status = STATUS_OK; /* let's be optimisc, once in lifetime */
+
+ if (ac < 2) {
+ tc_log_error(EXE, "not enough arguments for `check' mode");
+ return STATUS_BAD_PARAM;
+ }
+
+ for (i = 0; i < ac; i++) {
+ modrequest_load(cdata->factory, &cdata->mods[cdata->modsnum], av[i]);
+ cdata->modsnum++;
+ }
+
+ status = STATUS_OK;
+ if (cdata->modsnum >= 2) {
+ /* N modules, so N - 1 interfaces */
+ for (i = 0; i < cdata->modsnum - 1; i++) {
+ int ret = check_module_pair(&cdata->mods[i], &cdata->mods[i + 1],
+ &cdata->mods[i],
+ (verbose >= TC_INFO) ?TC_DEBUG :TC_QUIET);
+ if (ret != -1) { /* no error */
+ matches += ret;
+ }
+
+ }
+ if (matches < cdata->modsnum - 1) {
+ status = STATUS_MODULE_MISMATCH;
+ }
+ }
+
+ if (verbose) {
+ if (status == STATUS_OK) {
+ tc_log_info(EXE, "module chain OK");
+ } else {
+ tc_log_info(EXE, "module chain ILLEGAL");
+ }
+ }
+
+ CLEANUP(cdata);
+ return status;
+}
+
+static int cmdlet_list(CmdLetData *cdata, int ac, char **av)
+{
+ glob_t globbuf;
+ int ret, i = 0, fid = 0 /* fixed id */, tid = 0; /* template id */
+ uint32_t modkind[2] = { 0, 0 };
+ ModRequest fixed;
+
+ if (ac != 2) {
+ tc_log_error(EXE, "wrong number of arguments for `list' mode");
+ return STATUS_BAD_PARAM;
+ }
+ /* we support only encoder|multiplexor, yet */
+ modkind[0] = parse_modstr(av[0]);
+ if (!(modkind[0] & TC_MODULE_ENCODER)) {
+ tc_log_error(EXE, "unknown/unsupported module '%s'", av[0]);
+ return STATUS_BAD_PARAM;
+ }
+ modkind[1] = parse_modstr(av[1]);
+ if (!(modkind[1] & TC_MODULE_MUXER)) {
+ tc_log_error(EXE, "unknown/unsupported module '%s'", av[1]);
+ return STATUS_BAD_PARAM;
+ }
+
+ if ((modkind[0] & TC_MODULE_FIXED)
+ && (modkind[1] & TC_MODULE_TEMPLATE)) {
+ fid = 0;
+ tid = 1;
+ } else if ((modkind[0] & TC_MODULE_TEMPLATE)
+ && (modkind[1] & TC_MODULE_FIXED)) {
+ fid = 1;
+ tid = 0;
+ } else {
+ tc_log_error(EXE, "incorrect arguments,"
+ " maybe you want to use `check' mode?");
+ return STATUS_BAD_PARAM;
+ }
+
+ modrequest_init(&fixed);
+ ret = modrequest_load(cdata->factory, &fixed, av[fid]);
+ if (ret != TC_OK) {
+ return STATUS_MODULE_ERROR;
+ }
+
+ ret = modrequest_scan(cdata->modpath, av[tid], &globbuf);
+ if (ret != 0) {
+ return STATUS_GLOB_FAILED;
+ }
+ ret = modrequest_fill(cdata->factory, cdata->mods, MAX_MODS,
+ &cdata->modsnum, &globbuf);
+ if (ret != TC_OK) {
+ return STATUS_MODULE_ERROR;
+ }
+
+ for (i = 0; i < cdata->modsnum; i++) {
+ const ModRequest *H = (tid == 0) ?(&cdata->mods[i]) :(&fixed);
+ const ModRequest *T = (tid == 1) ?(&cdata->mods[i]) :(&fixed);
+ check_module_pair(H, T, &(cdata->mods[i]),
+ (verbose == 0) ?TC_INFO :verbose);
+ }
+
+ CLEANUP(cdata);
+ modrequest_free(&globbuf);
+ ret = modrequest_unload(cdata->factory, &fixed);
+ if (ret != TC_OK) {
+ return STATUS_MODULE_ERROR;
+ }
+ return STATUS_OK;
+}
+
+/*************************************************************************/
+
+int main(int argc, char *argv[])
+{
+ /* needed by filter modules */
+ TCVHandle tcv_handle = tcv_init();
+ CmdLet cmdlet = cmdlet_usage;
+ int ch, ret, status, i = 0;
+
+ CmdLetData cdata = {
+ .modpath = MOD_PATH,
+ .factory = NULL,
+ .modsnum = 0,
+ };
+
+ ac_init(AC_ALL);
+ tc_set_config_dir(NULL);
+ libtc_init(&argc, &argv);
+
+ filter[0].id = 0; /* to make gcc happy */
+ for (i = 0; i < MAX_MODS; i++) {
+ modrequest_init(&cdata.mods[i]);
+ }
+
+ while (1) {
+ ch = getopt(argc, argv, "LCd:?vhm:");
+ if (ch == -1) {
+ break;
+ }
+
+ switch (ch) {
+ case 'L':
+ cmdlet = cmdlet_list;
+ break;
+ case 'C':
+ cmdlet = cmdlet_check;
+ break;
+ case 'd':
+ if (optarg[0] == '-') {
+ cmdlet_usage(&cdata, argc, argv);
+ return STATUS_BAD_PARAM;
+ }
+ verbose = atoi(optarg);
+ break;
+ case 'm':
+ cdata.modpath = optarg;
+ break;
+ case 'v':
+ version();
+ return STATUS_OK;
+ case '?': /* fallthrough */
+ case 'h': /* fallthrough */
+ default:
+ cmdlet_usage(&cdata, argc, argv);
+ return STATUS_OK;
+ }
+ }
+
+ /* XXX: watch out here */
+ argc -= optind;
+ argv += optind;
+
+ /*
+ * we can't distinguish from OMS and NMS modules at glance, so try
+ * first using new module system
+ */
+ cdata.factory = tc_new_module_factory(cdata.modpath, verbose);
+
+ status = cmdlet(&cdata, argc, argv);
+
+ ret = tc_del_module_factory(cdata.factory); /* XXX: unchecked */
+ tcv_free(tcv_handle);
+ return status;
+}
+
+/*************************************************************************/
+
+/*
+ * Local variables:
+ * c-file-style: "stroustrup"
+ * c-file-offsets: ((case-label . *) (statement-case-intro . *))
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+ */
diff --git a/debian/transcode/transcode-1.1.7/tools/tcmodinfo.c b/debian/transcode/transcode-1.1.7/tools/tcmodinfo.c
new file mode 100644
index 00000000..60224cda
--- /dev/null
+++ b/debian/transcode/transcode-1.1.7/tools/tcmodinfo.c
@@ -0,0 +1,382 @@
+/*
+ * tcmodinfo.c
+ *
+ * Copyright (C) Tilmann Bitterberg - August 2002
+ * updated and partially rewritten by
+ * Copyright (C) Francesco Romani - January 2006
+ *
+ * This file is part of transcode, a video stream processing tool
+ *
+ * transcode is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * transcode 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#include "config.h"
+#include "tcstub.h"
+
+#define EXE "tcmodinfo"
+
+enum {
+ STATUS_OK = 0,
+ STATUS_BAD_PARAM,
+ STATUS_NO_MODULE,
+ STATUS_MODULE_ERROR,
+ STATUS_NO_SOCKET,
+ STATUS_SOCKET_ERROR,
+ STATUS_BAD_MODULES,
+ STATUS_MODULE_FAILED,
+};
+
+void version(void)
+{
+ printf("%s (%s v%s) (C) 2001-2010 Tilmann Bitterberg, "
+ "Transcode Team\n", EXE, PACKAGE, VERSION);
+}
+
+static void usage(void)
+{
+ version();
+ tc_log_info(EXE, "Usage: %s [options]", EXE);
+ fprintf(stderr, " -i name Module name information (like \'smooth\')\n");
+ fprintf(stderr, " -p Print the compiled-in module path\n");
+ fprintf(stderr, " -d verbosity Verbosity mode [1 == TC_INFO]\n");
+#ifdef ENABLE_EXPERIMENTAL
+ fprintf(stderr, " -m path Use PATH as module path\n");
+ fprintf(stderr, " -M element Request to module informations about <element>\n");
+ fprintf(stderr, " -C string Request to configure module using configuration <string>\n");
+ fprintf(stderr, " -t type Type of module (filter, encode, multiplex)\n");
+#endif
+ fprintf(stderr, " -s socket Connect to transcode socket\n");
+ fprintf(stderr, "\n");
+}
+
+static int do_connect_socket(const char *socketfile)
+{
+ int sock, retval;
+ struct sockaddr_un server;
+ char buf[OPTS_SIZE];
+ fd_set rfds;
+ struct timeval tv;
+ ssize_t n;
+
+ sock = socket(AF_UNIX, SOCK_STREAM, 0);
+ if (sock < 0) {
+ perror("opening stream socket");
+ return STATUS_NO_SOCKET;
+ }
+ server.sun_family = AF_UNIX;
+ strlcpy(server.sun_path, socketfile, sizeof(server.sun_path));
+
+ if (connect(sock, (struct sockaddr *) &server,
+ sizeof(struct sockaddr_un)) < 0) {
+ close(sock);
+ perror("connecting stream socket");
+ return STATUS_NO_SOCKET;
+ }
+
+ while (1) {
+ /* Watch stdin (fd 0) to see when it has input. */
+ FD_ZERO(&rfds);
+ FD_SET(0, &rfds); // stdin
+ FD_SET(sock, &rfds);
+ /* Wait up to five seconds. */
+ tv.tv_sec = 5;
+ tv.tv_usec = 0;
+
+ retval = select(sock+1, &rfds, NULL, NULL, NULL);
+ /* Don't rely on the value of tv now! */
+
+ memset(buf, 0, sizeof (buf)); // null-termination in advance, slowly
+
+ if (retval>0) {
+ if (FD_ISSET(0, &rfds)) {
+ fgets(buf, OPTS_SIZE, stdin);
+ }
+ if (FD_ISSET(sock, &rfds)) {
+ if ( (n = read(sock, buf, OPTS_SIZE)) < 0) {
+ perror("reading on stream socket");
+ break;
+ } else if (n == 0) { // EOF
+ fprintf (stderr, "Server closed connection\n");
+ break;
+ }
+ printf("%s", buf);
+ continue;
+ }
+ }
+
+ if (write(sock, buf, strlen(buf)) < 0)
+ perror("writing on stream socket");
+
+ memset(buf, 0, sizeof (buf));
+
+ if (read(sock, buf, OPTS_SIZE) < 0)
+ perror("reading on stream socket");
+
+ printf("%s", buf);
+
+ if (!isatty(0))
+ break;
+ }
+
+ close(sock);
+ return STATUS_OK;
+}
+
+int main(int argc, char *argv[])
+{
+ int ch;
+ const char *filename = NULL;
+ const char *modpath = MOD_PATH;
+#ifdef ENABLE_EXPERIMENTAL
+ const char *modtype = "filter";
+ const char *modarg = ""; /* nothing */
+ const char *modcfg = ""; /* nothing */
+#endif
+ const char *socketfile = NULL;
+ char options[OPTS_SIZE] = { '\0', };
+ int print_mod = 0;
+ int connect_socket = 0;
+ int ret = 0;
+ int status = STATUS_NO_MODULE;
+
+ /* needed by filter modules */
+ TCVHandle tcv_handle = tcv_init();
+#ifdef ENABLE_EXPERIMENTAL
+ TCFactory factory = NULL;
+ TCModule module = NULL;
+#endif
+
+ vframe_list_t ptr;
+
+ memset(&ptr, 0, sizeof(ptr));
+
+ ac_init(AC_ALL);
+ tc_set_config_dir(NULL);
+
+ if (argc == 1) {
+ usage();
+ return STATUS_BAD_PARAM;
+ }
+
+ libtc_init(&argc, &argv);
+
+ while (1) {
+#ifdef ENABLE_EXPERIMENTAL
+ ch = getopt(argc, argv, "C:d:i:?vhpm:M:s:t:");
+#else /* !ENABLE_EXPERIMENTAL */
+ ch = getopt(argc, argv, "d:i:?vhps:");
+#endif
+ if (ch == -1) {
+ break;
+ }
+
+ switch (ch) {
+ case 'd':
+ if (optarg[0] == '-') {
+ usage();
+ return STATUS_BAD_PARAM;
+ }
+ verbose = atoi(optarg);
+ break;
+ case 'i':
+ if (optarg[0] == '-') {
+ usage();
+ return STATUS_BAD_PARAM;
+ }
+ filename = optarg;
+ break;
+#ifdef ENABLE_EXPERIMENTAL
+ case 'C':
+ modcfg = optarg;
+ break;
+ case 'm':
+ modpath = optarg;
+ break;
+ case 'M':
+ modarg = optarg;
+ break;
+ case 't':
+ if (!optarg) {
+ usage();
+ return STATUS_BAD_PARAM;
+ }
+ if (!strcmp(optarg, "filter")
+ || !strcmp(optarg, "encode")
+ || !strcmp(optarg, "multiplex")) {
+ modtype = optarg;
+ } else {
+ modtype = NULL;
+ }
+ break;
+#endif
+ case 's':
+ if (optarg[0] == '-') {
+ usage();
+ return STATUS_BAD_PARAM;
+ }
+ connect_socket = 1;
+ socketfile = optarg;
+ break;
+ case 'p':
+ print_mod = 1;
+ break;
+ case 'v':
+ version();
+ return STATUS_OK;
+ case '?': /* fallthrough */
+ case 'h': /* fallthrough */
+ default:
+ usage();
+ return STATUS_OK;
+ }
+ }
+
+ if (print_mod) {
+ printf("%s\n", modpath);
+ return STATUS_OK;
+ }
+
+ if (connect_socket) {
+ do_connect_socket(socketfile);
+ return STATUS_OK;
+ }
+
+ if (!filename) {
+ usage();
+ return STATUS_BAD_PARAM;
+ }
+
+#ifdef ENABLE_EXPERIMENTAL
+ if (!modtype || !strcmp(modtype, "import")) {
+ tc_log_error(EXE, "Unknown module type (not in filter, encode, multiplex)");
+ return STATUS_BAD_PARAM;
+ }
+
+ if (strlen(modcfg) > 0 && strlen(modarg) > 0) {
+ tc_log_error(EXE, "Cannot configure and inspect module on the same time");
+ return STATUS_BAD_PARAM;
+ }
+
+ /*
+ * we can't distinguish from OMS and NMS modules at glance, so try
+ * first using new module system
+ */
+ factory = tc_new_module_factory(modpath, TC_MAX(verbose - 4, 0));
+ module = tc_new_module(factory, modtype, filename, TC_NONE);
+
+ if (module != NULL) {
+ const char *answer = NULL;
+
+ if (verbose >= TC_DEBUG) {
+ tc_log_info(EXE, "using new module system");
+ }
+ if (strlen(modcfg) > 0) {
+ int ret = tc_module_configure(module, modcfg, tc_get_vob());
+ if (ret == TC_OK) {
+ status = STATUS_OK;
+ } else {
+ status = STATUS_MODULE_FAILED;
+ tc_log_error(EXE, "configure returned error");
+ }
+ tc_module_stop(module);
+ } else {
+ if (verbose >= TC_INFO) {
+ /* overview and options */
+ tc_module_inspect(module, "help", &answer);
+ puts(answer);
+ /* module capabilities */
+ tc_module_show_info(module, verbose);
+ }
+ if (strlen(modarg) > 0) {
+ tc_log_info(EXE, "informations about '%s' for "
+ "module:", modarg);
+ tc_module_inspect(module, modarg, &answer);
+ puts(answer);
+ }
+ status = STATUS_OK;
+ }
+ tc_del_module(factory, module);
+ } else if (!strcmp(modtype, "filter"))
+#endif /* ENABLE_EXPERIMENTAL */
+ {
+ char namebuf[NAME_LEN];
+#ifdef ENABLE_EXPERIMENTAL
+ /* compatibility support only for filters */
+ if (verbose >= TC_DEBUG) {
+ tc_log_info(EXE, "using old module system");
+ }
+#endif
+ /* ok, fallback to old module system */
+ strlcpy(namebuf, filename, NAME_LEN);
+ filter[0].name = namebuf;
+
+ ret = load_plugin(modpath, 0, verbose);
+ if (ret != 0) {
+ tc_log_error(__FILE__, "unable to load filter `%s' (path=%s)",
+ filter[0].name, modpath);
+ status = STATUS_NO_MODULE;
+ } else {
+ strlcpy(options, "help", OPTS_SIZE);
+ ptr.tag = TC_FILTER_INIT;
+ if ((ret = filter[0].entry(&ptr, options)) != 0) {
+ status = STATUS_MODULE_ERROR;
+ } else {
+ memset(options, 0, OPTS_SIZE);
+ ptr.tag = TC_FILTER_GET_CONFIG;
+ ret = filter[0].entry(&ptr, options);
+
+ if (ret == 0) {
+ if (verbose >= TC_INFO) {
+ fputs("START\n", stdout);
+ fputs(options, stdout);
+ fputs("END\n", stdout);
+ }
+ status = STATUS_OK;
+ }
+ }
+ }
+ }
+
+#ifdef ENABLE_EXPERIMENTAL
+ ret = tc_del_module_factory(factory);
+#endif
+ tcv_free(tcv_handle);
+ return status;
+}
+
+/* just for correct linking purposes */
+#ifdef ENABLE_EXPERIMENTAL
+#include "libtc/tcframes.h"
+void dummy_tcframes(void);
+void dummy_tcframes(void) {
+ tc_del_video_frame(NULL);
+ tc_del_audio_frame(NULL);
+}
+
+
+#endif
+
+/*************************************************************************/
+
+/*
+ * Local variables:
+ * c-file-style: "stroustrup"
+ * c-file-offsets: ((case-label . *) (statement-case-intro . *))
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+ */
diff --git a/debian/transcode/transcode-1.1.7/tools/tcmp3cut.c b/debian/transcode/transcode-1.1.7/tools/tcmp3cut.c
new file mode 100644
index 00000000..6730e84a
--- /dev/null
+++ b/debian/transcode/transcode-1.1.7/tools/tcmp3cut.c
@@ -0,0 +1,306 @@
+/*
+ * tcmp3cut.c
+ *
+ * Copyright (C) Thomas Oestreich - June 2001
+ *
+ * This file is part of transcode, a video stream processing tool
+ *
+ * transcode is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * transcode 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#include "transcode.h"
+#include "framebuffer.h"
+#include "aud_scan.h"
+
+#include <sys/errno.h>
+
+
+#define EXE "tcmp3cut"
+
+int verbose=TC_QUIET;
+
+#define CHUNK_SIZE 4096
+
+static int min=0, max=0;
+
+
+
+/* ------------------------------------------------------------
+ *
+ * print a usage/version message
+ *
+ * ------------------------------------------------------------*/
+
+void version(void)
+{
+ printf("%s (%s v%s) (C) 2003 Tilmann Bitterberg\n", EXE, PACKAGE, VERSION);
+}
+
+static void usage(int status)
+{
+ version();
+
+ fprintf(stderr,"\nUsage: %s [options]\n", EXE);
+
+ fprintf(stderr," -i file input file name\n");
+ fprintf(stderr," -o base output file name base\n");
+ fprintf(stderr," -e r[,b[,c]] MP3 audio stream parameter [%d,%d,%d]\n", RATE, BITS, CHANNELS);
+ fprintf(stderr," -t c1[,c2[,.]] cut points in milliseconds\n");
+ fprintf(stderr," -d mode verbosity mode\n");
+ fprintf(stderr," -v print version\n");
+
+ exit(status);
+
+}
+
+
+/* ------------------------------------------------------------
+ *
+ * scan stream
+ *
+ * ------------------------------------------------------------*/
+
+#define MAX_SONGS 50
+
+int main(int argc, char *argv[])
+{
+
+
+ int fd=-1;
+ FILE *out=NULL;
+
+ int n=0, ch;
+ char *name=NULL, *offset=NULL, *base=NULL;
+ char outfile[1024];
+ int cursong=0;
+
+ int bytes_read;
+
+ uint64_t total=0;
+
+ int a_rate=RATE, a_bits=BITS, chan=CHANNELS;
+ int songs[MAX_SONGS];
+ int numsongs=0;
+
+ int on=1;
+
+ char buffer[CHUNK_SIZE];
+
+ uint32_t i=0;
+
+ if (argc<2)
+ usage(EXIT_SUCCESS);
+
+ while ((ch = getopt(argc, argv, "o:e:i:t:d:v?h")) != -1) {
+
+ switch (ch) {
+ case 'd':
+
+ if(optarg[0]=='-') usage(EXIT_FAILURE);
+ verbose = atoi(optarg);
+
+ break;
+
+ case 'e':
+
+ if(optarg[0]=='-') usage(EXIT_FAILURE);
+
+ if (3 != sscanf(optarg,"%d,%d,%d", &a_rate, &a_bits, &chan)) fprintf(stderr, "invalid pcm parameter set for option -e");
+
+ if(a_rate > RATE || a_rate <= 0) {
+ fprintf(stderr, "invalid pcm parameter 'rate' for option -e");
+ usage(EXIT_FAILURE);
+ }
+
+ if(!(a_bits == 16 || a_bits == 8)) {
+ fprintf(stderr, "invalid pcm parameter 'bits' for option -e");
+ usage(EXIT_FAILURE);
+ }
+
+ if(!(chan == 0 || chan == 1 || chan == 2)) {
+ fprintf(stderr, "invalid pcm parameter 'channels' for option -e");
+ usage(EXIT_FAILURE);
+ }
+
+ break;
+
+ case 'i':
+
+ if(optarg[0]=='-') usage(EXIT_FAILURE);
+ name = optarg;
+ break;
+
+ case 't':
+ if(optarg[0]=='-') usage(EXIT_FAILURE);
+
+ offset = optarg;
+ i=0;
+ songs[i]=atoi(offset);
+ while ((offset = strchr(offset,','))) {
+ offset++;
+ i++;
+ songs[i]=atoi(offset);
+ }
+ numsongs=i+1;
+ break;
+
+ case 'o':
+ if(optarg[0]=='-') usage(EXIT_FAILURE);
+ base = optarg;
+ break;
+ case 'v':
+ version();
+ exit(0);
+ break;
+
+ case 'h':
+ usage(EXIT_SUCCESS);
+ default:
+ usage(EXIT_FAILURE);
+ }
+ }
+
+ printf("Got %d songs:\n", numsongs);
+ for (n=0; n<numsongs; n++)
+ printf("%d : %d\n", n, songs[n]);
+
+
+ if (!name) {
+ fprintf(stderr, "No filename given\n");
+ exit (EXIT_FAILURE);
+ }
+
+ if ( (fd = open(name, O_RDONLY)) < 0) {
+ perror("open()");
+ return -1;
+ }
+
+ if ( (fd = open(name, O_RDONLY)) < 0) {
+ perror("open()");
+ return -1;
+ }
+
+ tc_snprintf(outfile, sizeof(outfile), "%s-%04d.mp3", base, cursong);
+ if ( (out = fopen(outfile, "w")) == NULL) {
+ perror ("fopen() output");
+ return -1;
+ }
+
+ if(1) {
+
+ uint8_t header[4];
+ int framesize = 0;
+ int chunks = 0;
+ int srate=0 , chans=0, bitrate=0;
+ off_t pos=0;
+ double ms = 0;
+
+ min = 500;
+ max = 0;
+
+ pos = lseek(fd, 0, SEEK_CUR);
+ // find mp3 header
+ while ((total += read(fd, header, 4))) {
+ if ( (framesize = tc_get_mp3_header (header, &chans, &srate, &bitrate)) > 0) {
+ fwrite (header, 4, 1,out);
+ ms += (framesize*8)/(bitrate);
+ break;
+ }
+ pos++;
+ lseek(fd, pos, SEEK_SET);
+ }
+ printf("POS %lld\n", (long long)pos);
+
+ // Example for _1_ mp3 chunk
+ //
+ // fps = 25
+ // framesize = 480 bytes
+ // bitrate = 160 kbit/s == 20 kbytes/s == 20480 bytes/s == 819.20 bytes / frame
+ //
+ // 480 bytes = 480/20480 s/bytes = .0234 s = 23.4 ms
+ //
+ // ms = (framesize*1000*8)/(bitrate*1000);
+ // why 1000 and not 1024?
+ // correct? yes! verified with "cat file.mp3|mpg123 -w /dev/null -v -" -- tibit
+
+ while (on) {
+ if ( (bytes_read = read(fd, buffer, framesize-4)) != framesize-4) {
+ on = 0;
+ } else {
+ total += bytes_read;
+ fwrite (buffer, bytes_read, 1,out);
+ while ((total += read(fd, header, 4))) {
+
+ //printf("%x %x %x %x\n", header[0]&0xff, header[1]&0xff, header[2]&0xff, header[3]&0xff);
+
+ if ( (framesize = tc_get_mp3_header (header, &chans, &srate, &bitrate)) < 0) {
+ fprintf(stderr, "[%s] corrupt mp3 file?\n", EXE);
+ on = 0;
+ break;
+ } else {
+
+ /*
+ printf("Found new header (%d) (framesize = %d) chan(%d) srate(%d) bitrate(%d)\n",
+ chunks, framesize, chans, srate, bitrate);
+ */
+
+ ms += (framesize*8)/(bitrate);
+ // close/open
+
+ if (ms>=songs[cursong]) {
+ fclose(out);
+ cursong++;
+ if (cursong>numsongs)
+ break;
+ tc_snprintf(outfile, sizeof(outfile), "%s-%04d.mp3", base, cursong);
+ if ( (out = fopen(outfile, "w")) == NULL) {
+ perror ("fopen() output");
+ return -1;
+ }
+ }
+ fwrite (header, 4, 1,out);
+
+ ++chunks;
+ break;
+ }
+ }
+
+
+ }
+ }
+ fclose(out);
+ close(fd);
+ return(0);
+ }
+
+
+ fprintf(stderr, "[%s] unable to handle codec/filetype\n", EXE);
+
+ exit(1);
+
+}
+
+/*************************************************************************/
+
+/*
+ * Local variables:
+ * c-file-style: "stroustrup"
+ * c-file-offsets: ((case-label . *) (statement-case-intro . *))
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+ */
diff --git a/debian/transcode/transcode-1.1.7/tools/tcstub.c b/debian/transcode/transcode-1.1.7/tools/tcstub.c
new file mode 100644
index 00000000..50271d8f
--- /dev/null
+++ b/debian/transcode/transcode-1.1.7/tools/tcstub.c
@@ -0,0 +1,273 @@
+/*
+ * tcstub.c - stub (but with sane values) symbols for transcode
+ * support programs.
+ *
+ * Copyright (C) Tilmann Bitterberg - August 2002
+ * updated and partially rewritten by
+ * Copyright (C) Francesco Romani - January 2006
+ *
+ * This file is part of transcode, a video stream processing tool
+ *
+ * transcode is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * transcode 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#include "tcstub.h"
+
+struct filter_struct filter[MAX_FILTERS];
+
+/* FIXME: what about ex_asr and ex_par ? */
+static vob_t vob = {
+ .verbose = TC_INFO,
+
+ .has_video = 1,
+ .has_audio = 1,
+
+ /* some sane settings, mostly identical to transcode's ones */
+ .fps = PAL_FPS,
+ .ex_fps = PAL_FPS,
+ .im_v_width = PAL_W,
+ .ex_v_width = PAL_W,
+ .im_v_height= PAL_H,
+ .ex_v_height= PAL_H,
+
+ .im_v_codec = CODEC_YUV,
+ .im_a_codec = CODEC_PCM,
+ .ex_v_codec = CODEC_YUV,
+ .ex_a_codec = CODEC_PCM,
+
+ .im_frc = 3,
+ .ex_frc = 3,
+
+ .a_rate = RATE,
+ .a_chan = CHANNELS,
+ .a_bits = BITS,
+ .a_vbr = AVBR,
+
+ .mod_path = MOD_PATH,
+
+ .video_in_file = "/dev/zero",
+ .audio_in_file = "/dev/zero",
+ .video_out_file = "/dev/null",
+ .audio_out_file = "/dev/null",
+ .audiologfile = "/dev/null",
+
+ .mp3bitrate = ABITRATE,
+ .mp3quality = AQUALITY,
+ .mp3mode = AMODE,
+ .mp3frequency = RATE,
+
+ .divxlogfile = "/dev/null",
+ .divxmultipass = VMULTIPASS,
+ .divxbitrate = VBITRATE,
+ .divxkeyframes = VKEYFRAMES,
+ .divxcrispness = VCRISPNESS,
+
+ .a_leap_frame = TC_LEAP_FRAME,
+ .a_leap_bytes = 0,
+
+ .export_attributes= TC_EXPORT_ATTRIBUTE_NONE,
+};
+
+// dependencies
+// Yeah, this sucks
+vob_t *tc_get_vob()
+{
+ return &vob;
+}
+
+int tc_filter_add(const char *name, const char *options)
+{
+ return 0;
+}
+
+int tc_filter_find(const char *name)
+{
+ return 0;
+}
+
+pthread_mutex_t abuffer_im_fill_lock = PTHREAD_MUTEX_INITIALIZER;
+uint32_t abuffer_im_fill_ctr = 0;
+pthread_mutex_t abuffer_ex_fill_lock = PTHREAD_MUTEX_INITIALIZER;
+uint32_t abuffer_ex_fill_ctr = 0;
+pthread_mutex_t abuffer_xx_fill_lock = PTHREAD_MUTEX_INITIALIZER;
+uint32_t abuffer_xx_fill_ctr = 0;
+pthread_mutex_t vbuffer_im_fill_lock = PTHREAD_MUTEX_INITIALIZER;
+uint32_t vbuffer_im_fill_ctr = 0;
+pthread_mutex_t vbuffer_ex_fill_lock = PTHREAD_MUTEX_INITIALIZER;
+uint32_t vbuffer_ex_fill_ctr = 0;
+pthread_mutex_t vbuffer_xx_fill_lock = PTHREAD_MUTEX_INITIALIZER;
+uint32_t vbuffer_xx_fill_ctr = 0;
+
+int tc_import_status()
+{
+ return 1;
+}
+
+#ifdef TC_FRAMEBUFFER_STUBS
+void vframe_copy(vframe_list_t *dst, const vframe_list_t *src, int copy_data)
+{
+ return;
+}
+
+void aframe_copy(aframe_list_t *dst, const aframe_list_t *src, int copy_data)
+{
+ return;
+}
+
+
+vframe_list_t *tc_new_video_frame(int width, int height, int format,
+ int partial)
+{
+ return NULL;
+}
+
+aframe_list_t *tc_new_audio_frame(double samples, int channels, int bits)
+{
+ return NULL;
+}
+
+void tc_del_video_frame(vframe_list_t *vptr)
+{
+ return;
+}
+
+void tc_del_audio_frame(aframe_list_t *aptr)
+{
+ return;
+}
+
+#endif /* TC_FRAMEBUFFER_STUBS */
+
+
+int tc_progress_meter = 1;
+int tc_progress_rate = 1;
+
+int resize1 = 0; // probe_source_xml()
+int resize2 = 0; // probe_source_xml()
+int zoom = 0; // probe_source_xml()
+
+
+int tc_cluster_mode = 0;
+pid_t tc_probe_pid = 0;
+
+/* symbols needed by modules */
+int verbose = TC_INFO;
+int rgbswap = 0;
+int tc_accel = -1; //acceleration code
+int flip = 0;
+int max_frame_buffer = 0;
+int gamma_table_flag = 0;
+
+void tc_socket_config(void);
+void tc_socket_disable(void);
+void tc_socket_enable(void);
+void tc_socket_list(void);
+void tc_socket_load(void);
+void tc_socket_parameter(void);
+void tc_socket_preview(void);
+void tc_socket_config(void) {}
+void tc_socket_disable(void) {}
+void tc_socket_enable(void) {}
+void tc_socket_list(void) {}
+void tc_socket_load(void) {}
+void tc_socket_parameter(void) {}
+void tc_socket_preview(void) {}
+void tc_socket_poll(void) {}
+void tc_socket_wait(void) {}
+
+int tc_import_video_running(void)
+{
+ return TC_TRUE;
+}
+
+int tc_import_audio_running(void)
+{
+ return TC_TRUE;
+}
+
+
+int load_plugin(const char *path, int id, int verbose)
+{
+ const char *error = NULL;
+ char module[TC_BUF_MAX];
+ int n;
+
+ if (filter[id].name == NULL) {
+ tc_log_error(__FILE__, "bad filter#%i name (%s)",
+ id, filter[id].name);
+ return -1;
+ }
+
+ filter[id].options = NULL;
+
+ /* replace "=" by "/0" in filter name */
+ for (n = 0; n < strlen(filter[id].name); n++) {
+ if (filter[id].name[n] == '=') {
+ filter[id].name[n] = '\0';
+ filter[id].options = filter[id].name + n + 1;
+ break;
+ }
+ }
+
+ tc_snprintf(module, sizeof(module), "%s/filter_%s.so", path, filter[id].name);
+
+ /* try transcode's module directory */
+ filter[id].handle = dlopen(module, RTLD_LAZY);
+
+ if (filter[id].handle != NULL) {
+ filter[id].entry = dlsym(filter[id].handle, "tc_filter");
+ } else {
+ if (verbose) {
+ tc_log_error(__FILE__, "loading filter module '%s' failed (reason: %s)",
+ module, dlerror());
+ }
+ return -1;
+ }
+
+ error = dlerror();
+ if (error != NULL) {
+ if (verbose) {
+ tc_log_error(__FILE__, "error while loading '%s': %s\n",
+ module, error);
+ }
+ return -1;
+ }
+ return 0;
+}
+
+#include "libtc/ratiocodes.h"
+void dummy_misc(void);
+void dummy_misc(void)
+{
+ int n, d;
+ tc_frc_code_to_ratio(3, &n, &d);
+}
+
+#include "libtc/static_optstr.h"
+#include "avilib/static_avilib.h"
+#include "avilib/static_wavlib.h"
+
+/*************************************************************************/
+
+/*
+ * Local variables:
+ * c-file-style: "stroustrup"
+ * c-file-offsets: ((case-label . *) (statement-case-intro . *))
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+ */
diff --git a/debian/transcode/transcode-1.1.7/tools/tcstub.h b/debian/transcode/transcode-1.1.7/tools/tcstub.h
new file mode 100644
index 00000000..8fa004b7
--- /dev/null
+++ b/debian/transcode/transcode-1.1.7/tools/tcstub.h
@@ -0,0 +1,91 @@
+/*
+ * tcstub.h - stub (but with sane values) symbols declatations
+ * for transcode support programs.
+ *
+ * Copyright (C) Tilmann Bitterberg - August 2002
+ * updated and partially rewritten by
+ * Copyright (C) Francesco Romani - January 2006
+ *
+ * This file is part of transcode, a video stream processing tool
+ *
+ * transcode is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * transcode 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#ifndef TC_STUB_H
+#define TC_STUB_H
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <pthread.h>
+
+#ifdef HAVE_DLFCN_H
+#include <dlfcn.h>
+#else
+# ifdef OS_DARWIN
+# include "libdldarwin/dlfcn.h"
+# endif
+#endif
+
+#include "framebuffer.h"
+#include "transcode.h"
+#include "filter.h"
+#include "socket.h"
+#include "video_trans.h"
+
+#include "libtc/cfgfile.h"
+#include "libtc/tcframes.h"
+#include "libtc/tcmodule-core.h"
+
+#define OPTS_SIZE 8192 //Buffersize
+#define NAME_LEN 256
+
+/* FIXME: this should use the routines from filter.c */
+struct filter_struct {
+ int id;
+ int status;
+ int unload;
+ char *options;
+ void *handle;
+ char *name;
+ int namelen;
+ int (*entry)(void *ptr, void *options);
+};
+
+extern struct filter_struct filter[MAX_FILTERS];
+
+int load_plugin(const char *path, int id, int verbose);
+
+int tc_import_video_running(void);
+int tc_import_audio_running(void);
+
+int tc_import_status();
+
+#endif /* TC_STUB_H */
+
+/* vim: sw=4
+ */
diff --git a/debian/transcode/transcode-1.1.7/tools/tcyait.c b/debian/transcode/transcode-1.1.7/tools/tcyait.c
new file mode 100644
index 00000000..84882fa6
--- /dev/null
+++ b/debian/transcode/transcode-1.1.7/tools/tcyait.c
@@ -0,0 +1,1969 @@
+/*
+ * tcyait.c
+ *
+ * Copyright (C) Allan Snider - February 2007
+ *
+ * This file is part of transcode, a video stream processing tool
+ *
+ * transcode is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * transcode 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+/*
+ * tcyait:
+ * Yet Another Inverse Telecine filter.
+ *
+ * Usage:
+ * tcyait [-dnlotbwmEO] [arg...]
+ * -d Print debug information to stdout
+ * -n Do not drop frames, always de-interlace
+ * -k No forced keep frames
+ * -l log Input yait log file name
+ * -o ops Output yait frame ops file name
+ * -t thresh Interlace detection threshold (>1)
+ * -b blend forced blend threshold (>thresh)
+ * -w size Drop frame look ahead window (0-20)
+ * -m mode Transcode blend method (0-5)
+ * -E thresh Even pattern threhold [thresh]
+ * -O thresh Odd pattern threhold [thresh]
+ * -N noise minimum normalized delta, else considered noise
+ *
+ * By default, reads "yait.log" and produces "yait.ops".
+ *
+ * Description:
+ *
+ * Read a yait log file (generated via -J yait=log), and analyze it to
+ * produce a yait frame operations file. The frame operations file contains
+ * commands to the yait filter to drop, copy or save rows (to de-interlace),
+ * or blend frames. This will convert from NTSC 29.97 to 23.976 fps. The file
+ * generated is used as input for another transcode pass (-J yait=ops).
+ */
+
+
+#define YAIT_VERSION "v0.2"
+
+#define TRUE 1
+#define FALSE 0
+
+/* program defaults */
+#define Y_LOG_FN "yait.log" /* log file read */
+#define Y_OPS_FN "yait.ops" /* frame operation file written */
+#define Y_THRESH 1.2 /* even/odd ratio to detect interlace */
+#define Y_DROPWIN_SIZE 15 /* drop frame look ahead window */
+#define Y_DEINT_MODE 3 /* default transcode de-interlace mode */
+
+/* limits */
+#define Y_DEINT_MIN 0
+#define Y_DEINT_MAX 5
+#define Y_DROPWIN_MIN 0
+#define Y_DROPWIN_MAX 60
+
+#define Y_MTHRESH 1.02 /* minimum ratio allowing de-interlace */
+#define Y_NOISE 0.003 /* normalized delta too weak, noise */
+#define Y_SCENE_CHANGE 0.15 /* normalized delta > 15% of max delta */
+
+/* force de-interlace */
+#define Y_FBLEND 1.6 /* if ratio is > this */
+#define Y_FWEIGHT 0.01 /* if over this weight */
+
+/* frame operation flags */
+#define Y_OP_ODD 0x10
+#define Y_OP_EVEN 0x20
+#define Y_OP_PAT 0x30
+
+#define Y_OP_NOP 0x0
+#define Y_OP_SAVE 0x1
+#define Y_OP_COPY 0x2
+#define Y_OP_DROP 0x4
+#define Y_OP_DEINT 0x8
+
+/* group flags */
+#define Y_HAS_DROP 1
+#define Y_BANK_DROP 2
+#define Y_WITHDRAW_DROP 3
+#define Y_BORROW_DROP 4
+#define Y_RETURN_DROP 5
+#define Y_FORCE_DEINT 6
+#define Y_FORCE_DROP 7
+#define Y_FORCE_KEEP 8
+
+/* frame information */
+typedef struct fi_t Fi;
+struct fi_t
+ {
+ double r; /* even/odd delta ratio, filtered */
+ double ro; /* ratio, original value */
+ double w; /* statistical strength */
+ double nd; /* normalized delta */
+ int fn; /* frame number */
+ int ed; /* even row delta */
+ int od; /* odd row delta */
+ int gi; /* group array index */
+ int ip; /* telecine pattern */
+ int op; /* frame operation, nop, save/copy row */
+ int drop; /* frame is to be dropped */
+ int gf; /* group flag */
+ Fi *next;
+ };
+
+
+/*
+ * globals:
+ */
+
+char *Prog; /* argv[0] */
+char *LogFn; /* log file name, default "yait.log" */
+char *OpsFn; /* ops file name, default "yait.ops" */
+double Thresh; /* row delta ratio interlace detection threshold */
+double EThresh; /* even interlace detection threshold */
+double OThresh; /* odd interlace detection threshold */
+double Blend; /* force frame blending over this threshold */
+double Noise; /* minimum normalized delta */
+int DropWin; /* drop frame look ahead window */
+int DeintMode; /* transcode de-interlace mode, (1-5) */
+int DebugFi; /* dump debug frame info */
+int NoDrops; /* force de-interlace everywhere (non vfr) */
+int NoKeeps; /* Don't force keep frames (allows a/v sync drift) */
+
+FILE *LogFp; /* log file */
+FILE *OpsFp; /* ops file */
+
+Fi *Fl; /* frame list */
+Fi **Fa; /* frame array */
+Fi **Ga; /* group array */
+int *Da; /* drop count array */
+int Nf; /* number of frames */
+int Ng; /* number of elements in Ga */
+int Nd; /* number of elements in Da */
+int Md; /* max delta */
+
+int Stat_nd; /* total number of dropped frames */
+int Stat_nb; /* total number of blended frames */
+int Stat_no; /* total number of odd interlaced pairs */
+int Stat_ne; /* total number of even interlaced pairs */
+int Stat_fd; /* total number of forced drops */
+int Stat_fk; /* total number of forced keeps */
+
+
+/*
+ * protos:
+ */
+
+static void yait_parse_args( int, char** );
+static void yait_chkac( int* );
+static void yait_usage( void );
+static void yait_read_log( void );
+static double yait_calc_ratio( int, int );
+static void yait_find_ip( void );
+static void yait_chk_ip( int );
+static void yait_chk_pairs( int );
+static void yait_chk_tuplets( int );
+static int yait_find_odd( double, int, double*, int );
+static int yait_find_even( double, int, double*, int );
+static int yait_ffmin( int, int );
+static int yait_ffmax( int, int );
+static int yait_m5( int );
+static void yait_mark_grp( int, int, double );
+static void yait_find_drops( void );
+static int yait_cnt_drops( int );
+static int yait_extra_drop( int );
+static int yait_missing_drop( int );
+static void yait_keep_frame( int );
+static int yait_get_hdrop( int, int* );
+static void yait_ivtc_keep( int );
+static void yait_ivtc_grps( void );
+static int yait_scan_bk( int );
+static int yait_scan_fw( int );
+static void yait_drop_frame( int );
+static int yait_ivtc_grp( int, int, int );
+static double yait_tst_ip( int, int );
+static void yait_deint( void );
+static void yait_write_ops( void );
+static char *yait_write_op( Fi* );
+static void yait_fini( void );
+
+static void yait_debug_fi( void );
+static char *yait_op( int op );
+static char *yait_drop( Fi *f );
+static char *yait_grp( int flg );
+
+
+/*
+ * main:
+ */
+
+int
+main( int argc, char **argv )
+ {
+ /* parse args */
+ yait_parse_args( argc, argv );
+
+ LogFp = fopen( LogFn, "r" );
+ if( !LogFp )
+ {
+ perror( "fopen" );
+ fprintf( stderr, "Cannot open YAIT delta log file (%s)\n", LogFn );
+ exit( 1 );
+ }
+
+ OpsFp = fopen( OpsFn, "w" );
+ if( !OpsFp )
+ {
+ perror( "fopen" );
+ fprintf( stderr, "Cannot create YAIT frame ops file (%s)\n", OpsFn );
+ exit( 1 );
+ }
+
+ /* read the log */
+ yait_read_log();
+
+ /* find interleave patterns */
+ yait_find_ip();
+
+ /* find drop frames */
+ yait_find_drops();
+
+ /* complete groups missing an interleave pattern */
+ yait_ivtc_grps();
+
+ /* let transcode de-interlace frames we missed */
+ yait_deint();
+
+ /* print frame ops file */
+ yait_write_ops();
+
+ if( DebugFi )
+ yait_debug_fi();
+
+ /* graceful exit */
+ yait_fini();
+
+ return( 0 );
+ }
+
+
+/*
+ * yait_parse_args:
+ */
+
+static void
+yait_parse_args( int argc, char **argv )
+ {
+ int opt;
+ char *p;
+
+ LogFn = Y_LOG_FN;
+ OpsFn = Y_OPS_FN;
+ Thresh = Y_THRESH;
+ EThresh = 0;
+ OThresh = 0;
+ Blend = Y_FBLEND;
+ Noise = Y_NOISE;
+ DeintMode = Y_DEINT_MODE;
+ DropWin = Y_DROPWIN_SIZE;
+
+ --argc;
+ Prog = *argv++;
+ while( (p = *argv) )
+ {
+ if( *p++ != '-' )
+ break;
+ while( (opt = *p++) )
+ switch( opt )
+ {
+ case 'd':
+ DebugFi = TRUE;
+ break;
+
+ case 'n':
+ NoDrops = TRUE;
+ break;
+
+ case 'k':
+ NoKeeps = TRUE;
+ break;
+
+ case 'l':
+ yait_chkac( &argc );
+ LogFn = *++argv;
+ break;
+
+ case 'o':
+ yait_chkac( &argc );
+ OpsFn = *++argv;
+ break;
+
+ case 't':
+ yait_chkac( &argc );
+ Thresh = atof( *++argv );
+ break;
+
+ case 'E':
+ yait_chkac( &argc );
+ EThresh = atof( *++argv );
+ break;
+
+ case 'O':
+ yait_chkac( &argc );
+ OThresh = atof( *++argv );
+ break;
+
+ case 'b':
+ yait_chkac( &argc );
+ Blend = atof( *++argv );
+ break;
+
+ case 'N':
+ yait_chkac( &argc );
+ Noise = atof( *++argv );
+ break;
+
+ case 'w':
+ yait_chkac( &argc );
+ DropWin = atoi( *++argv );
+ break;
+
+ case 'm':
+ yait_chkac( &argc );
+ DeintMode = atoi( *++argv );
+ break;
+
+ default:
+ yait_usage();
+ break;
+ }
+ --argc;
+ argv++;
+ }
+
+ if( Thresh <= 1 )
+ {
+ printf( "Invalid threshold specified (%g).\n\n", Thresh );
+ yait_usage();
+ }
+
+ if( Blend <= Thresh )
+ {
+ printf( "Invalid blend threshold specified (%g).\n\n", Blend );
+ yait_usage();
+ }
+
+ if( DropWin<Y_DROPWIN_MIN || DropWin>Y_DROPWIN_MAX )
+ {
+ printf( "Invalid drop window size specified (%d).\n\n", DropWin );
+ yait_usage();
+ }
+
+ if( DeintMode<Y_DEINT_MIN || DeintMode>Y_DEINT_MAX )
+ {
+ printf( "Invalid de-interlace method specified (%d).\n\n", DeintMode );
+ yait_usage();
+ }
+
+ if( !EThresh )
+ EThresh = Thresh;
+ if( !OThresh )
+ OThresh = Thresh;
+
+ if( argc )
+ yait_usage();
+ }
+
+
+/*
+ * yait_chkac:
+ */
+
+static void
+yait_chkac( int *ac )
+ {
+ if( *ac < 1 )
+ yait_usage();
+ --*ac;
+ }
+
+
+/*
+ * yait_usage:
+ */
+
+static void
+yait_usage( void )
+ {
+ printf( "Usage: %s [-dnklotbwmEON] [arg...] \n", Prog );
+ printf( "\t-d\t\tPrint debug information to stdout.\n" );
+ printf( "\t-n\t\tDo not drop frames, always de-interlace.\n" );
+ printf( "\t-k\t\tNo forced keep frames.\n" );
+ printf( "\t-l log\t\tInput yait log file name [%s].\n", Y_LOG_FN );
+ printf( "\t-o ops\t\tOutput yait frame ops file name [%s].\n", Y_OPS_FN );
+ printf( "\t-t thresh\tInterlace detection threshold (>1) [%g].\n", Y_THRESH );
+ printf( "\t-b blend\tforced blend threshold (>thresh) [%g].\n", Y_FBLEND );
+ printf( "\t-w size\t\tDrop frame look ahead window (0-20) [%d].\n", Y_DROPWIN_SIZE );
+ printf( "\t-m mode\t\tTranscode blend method (0-5) [%d].\n", Y_DEINT_MODE );
+ printf( "\t-E thresh\tEven pattern threshold [%g].\n", Y_THRESH );
+ printf( "\t-O thresh\tOdd pattern threshold [%g].\n", Y_THRESH );
+ printf( "\t-N noise\tMinimum normalized delta, else noise [%g].\n", Y_NOISE );
+ printf( "\n" );
+
+ exit( 1 );
+ }
+
+
+/*
+ * yait_read_log:
+ */
+
+static void
+yait_read_log( void )
+ {
+ Fi **fa, *pf, *f;
+ int fn, ed, od;
+ int s, n;
+
+ s = 0;
+ pf = NULL;
+ for( Nf=0; ; Nf++ )
+ {
+ n = fscanf( LogFp, "%d: e: %d, o: %d\n", &fn, &ed, &od );
+ if( n != 3 )
+ break;
+
+ /* starting frame number */
+ if( !Nf )
+ s = fn;
+
+ if( (fn-s) != Nf )
+ {
+ printf( "Broken log file, line %d\n", Nf );
+ exit( 1 );
+ }
+
+ f = (Fi*) malloc( sizeof(Fi) );
+ if( !f )
+ {
+ perror( "malloc" );
+ exit( 1 );
+ }
+
+ memset( (void*) f, 0, sizeof(Fi) );
+ if( !Fl )
+ Fl = f;
+ if( pf )
+ pf->next = f;
+ pf = f;
+
+ f->r = yait_calc_ratio( ed, od );
+ f->ro = f->r;
+ f->fn = fn;
+ f->ed = ed;
+ f->od = od;
+ f->ip = -1;
+ }
+
+ if( !Fl )
+ {
+ fprintf( stderr, "Invalid log file.\n" );
+ exit( 1 );
+ }
+
+ /* number of 5 frame groups */
+ Nd = Nf / 5;
+
+ Fa = (Fi**) malloc( (Nf+1) * sizeof(Fi*) );
+ Ga = (Fi**) malloc( (Nf+1) * sizeof(Fi*) );
+ Da = (int*) malloc( Nd * sizeof(int) );
+ if( !Fa || !Ga || !Da )
+ {
+ perror( "malloc" );
+ exit( 1 );
+ }
+
+ fa = Fa;
+ for( f=Fl; f; f=f->next )
+ *fa++ = f;
+ *fa = NULL;
+ }
+
+
+/*
+ * yait_calc_ratio:
+ * Compute a ratio between even/odd row deltas. A high ratio indicates an
+ * interlace present. Use the sign of the ratio to indicate even row (<0), or odd
+ * row (>0) correlation.
+ *
+ * If the magnitude of the ratio is > 1.1, this is usually enough to
+ * indicate interlacing. A value around 1.0 indicates no row correlation at
+ * all.
+ *
+ * Assigning the ratios in this manner result in the following patterns
+ * present for interlaced material. Assume 0 for fabs(r)<thresh, else +/- 1:
+ *
+ * An odd interlace pattern (for a five frame group) would appear as:
+ *
+ * frame: 1 2 3 4 5
+ * even: a a b c d
+ * odd: a b c c d
+ *
+ * ratio: 0 -1 0 1 0
+ *
+ * If we detect this pattern, we assign the following frame operations:
+ *
+ * frame: 1 2 3 4 5
+ * even: a a b c d
+ * odd: a b c c d
+ *
+ * ratio: 0 -1 0 1 0
+ * op: osd oc
+ *
+ * osd = save odd rows and drop the frame
+ * oc = copy in saved odd rows
+ *
+ * This results with:
+ *
+ * frame: 1 |2| 3 4 5
+ * even: a |a| b c d
+ * odd: a |b|--> b c d
+ * drop
+ *
+ * For even interlace patterns, the signs are reversed, or simply:
+ *
+ * ratio: 0 1 0 -1 0
+ * esd ec
+ *
+ * The entire approach of this tool depends on these specific ratio patterns
+ * to be present, and should be for 2:3 pulldown. Lots of complications arise
+ * around still and abrupt scene changes. Again, it might be useful for the
+ * filter to produce a combing co-efficient as well as the delta information.
+ *
+ * Side note:
+ * For yuv, deltas based only on luminance yeilded much stronger
+ * interlace patterns, however, I suppose there are (rare) cases where
+ * chroma could be the only indicator, so chroma is included in the
+ * delta calculation, even though it results in weaker ratios.
+ */
+
+static double
+yait_calc_ratio( int ed, int od )
+ {
+ double r;
+
+ r = 1;
+
+ /* compute ratio, >1 odd, <-1 even */
+ if( !ed && !od )
+ /* duplicate frame */
+ r = 0;
+
+ if( ed && !od )
+ r = 100;
+
+ if( !ed && od )
+ r = -100;
+
+ if( ed && od )
+ {
+ r = (double) ed / (double) od;
+
+ if( r < 1 )
+ r = -1.0 / r;
+
+ if( r > 100 )
+ r = 100;
+ if( r < -100 )
+ r = -100;
+ }
+
+ return( r );
+ }
+
+
+/*
+ * yait_find_ip:
+ * - Mark isolated duplicate frames to be hard dropped.
+ * - Create the group array which is used to processes interleave
+ * patterns without duplicate frames present.
+ * - Find the maximum frame delta value. This is used to normalize
+ * frame deltas to filter out weak frames (noise which may cause
+ * erroneous interleave patterns to be detected).
+ * - Detect local interleave patterns.
+ */
+
+static void
+yait_find_ip( void )
+ {
+ Fi *f;
+ double w;
+ int m, p, i;
+
+ /* mark obvious drop frames */
+ if( !NoDrops )
+ for( i=1; i<Nf-1; i++ )
+ {
+ f = Fa[i];
+ if( f->r )
+ continue;
+
+ if( !Fa[i-1]->r && !Fa[i+1]->r )
+ continue;
+
+ f->drop = TRUE;
+ }
+
+ /* create group array, ommiting drops */
+ Ng = 0;
+ for( i=0; i<Nf; i++ )
+ {
+ f = Fa[i];
+ if( f->drop )
+ continue;
+
+ f->gi = Ng;
+ Ga[Ng++] = f;
+ }
+ Ga[Ng] = NULL;
+
+ /* find max row delta */
+ m = 0;
+ for( i=0; i<Nf; i++ )
+ {
+ f = Fa[i];
+ if( f->ed > m )
+ m = f->ed;
+ if( f->od > m )
+ m = f->od;
+ }
+
+ Md = m;
+ if( !Md )
+ {
+ fprintf( stderr, "All empty frames?\n" );
+ exit( 1 );
+ }
+
+ /* compute normalized row deltas and */
+ /* filter out weak r values (noise) */
+ for( i=0; i<Ng; i++ )
+ {
+ f = Ga[i];
+ f->nd = (f->ed + f->od) / (double) Md;
+ if( f->nd < Noise )
+ f->r = 1;
+ }
+
+ /* adjust for incomplete interleave patterns */
+ /* (indexing Fa[0,..,i+6]) */
+ for( i=0; i<Ng-6; i++ )
+ yait_chk_ip( i );
+
+ /* find interleave patterns */
+ for( i=0; i<Ng; i++ )
+ {
+ f = Ga[i];
+ if( f->op & Y_OP_COPY )
+ {
+ /* finish this group before looking for another pattern */
+ i++;
+ continue;
+ }
+
+ p = yait_find_odd( OThresh, i, &w, 4 );
+ if( p != -1 )
+ {
+ yait_mark_grp( p, i, w );
+ continue;
+ }
+
+ p = yait_find_even( EThresh, i, &w, 4 );
+ if( p != -1 )
+ yait_mark_grp( p+10, i, w );
+ }
+ }
+
+
+/*
+ * yait_chk_ip:
+ * Two cases to look for. An isolated pair of high r's, and an
+ * isolated tuplet of high r's. These can be caused by interlacing over
+ * still and abrupt scene changes.
+ */
+
+static void
+yait_chk_ip( int n )
+ {
+ if( !NoDrops )
+ yait_chk_pairs( n );
+
+ yait_chk_tuplets( n );
+ }
+
+
+/*
+ * yait_chk_pairs:
+ * Look for patterns of the type:
+ * i: 0 1 2 3 4 5
+ * odd: 0 0 -1 1 0 0
+ * even: 0 0 1 -1 0 0
+ *
+ * If detected, force the drop of the (single) interlaced frame.
+ * De-interlacing would just incur a redundant copy operation.
+ */
+
+static void
+yait_chk_pairs( int n )
+ {
+ Fi *fa[6];
+ double ra[6];
+ int i;
+
+ for( i=0; i<6; i++ )
+ {
+ fa[i] = Ga[n+i];
+ ra[i] = fabs( fa[i]->r );
+ }
+
+ for( i=2; i<4; i++ )
+ if( ra[i] < Thresh )
+ return;
+
+ /* adjacent frames to the tuplet must be <thresh */
+ if( ra[1]>Thresh || ra[4]>Thresh )
+ return;
+
+ /* we only need one edge frame to be <thresh */
+ if( ra[0]>Thresh && ra[5]>Thresh )
+ return;
+
+ if( fa[2]->r>0 && fa[3]->r>0 )
+ return;
+
+ if( fa[2]->r<0 && fa[3]->r<0 )
+ return;
+
+ /* two isolated high r values of opposite sign */
+ /* drop the interlaced frame, erase the pattern */
+ fa[2]->r = 1;
+ fa[3]->r = 1;
+
+ fa[2]->drop = TRUE;
+ }
+
+
+/*
+ * yait_chk_tuplets:
+ * Look for patterns of the type:
+ * i: 0 1 2 3 4 5 6
+ * odd: 0 0 -1 +/-2 1 0 0
+ * even: 0 0 1 +/-2 -1 0 0
+ *
+ * and complete to:
+ *
+ * odd: 0 0 -1 0 1 0 0
+ * even: 0 0 1 0 -1 0 0
+ */
+
+static void
+yait_chk_tuplets( int n )
+ {
+ Fi *fa[7];
+ double ra[7];
+ int i;
+
+ for( i=0; i<7; i++ )
+ {
+ fa[i] = Ga[n+i];
+ ra[i] = fabs( fa[i]->r );
+ }
+
+ for( i=2; i<5; i++ )
+ if( ra[i] < Thresh )
+ return;
+
+ /* adjacent frames to the tuplet must be <thresh */
+ if( ra[1]>Thresh || ra[5]>Thresh )
+ return;
+
+ /* we only need one edge frame to be <thresh */
+ if( ra[0]>Thresh && ra[6]>Thresh )
+ return;
+
+ if( fa[2]->r>0 && fa[4]->r>0 )
+ return;
+
+ if( fa[2]->r<0 && fa[4]->r<0 )
+ return;
+
+ /* isolated tuplet of high r values of opposite sign */
+ if( ra[3]>ra[2] || ra[3]>ra[4] )
+ fa[3]->r = 1;
+ }
+
+
+/*
+ * yait_find_odd:
+ */
+
+static int
+yait_find_odd( double thresh, int n, double *w, int win )
+ {
+ double re, ro;
+ int me, mo;
+ int p;
+
+ /* find max even/odd correlations */
+ /* (r<0 - even, r>0 - odd) */
+ me = yait_ffmin( n, win );
+ mo = yait_ffmax( n, win );
+
+ p = -1;
+ if( yait_m5(mo-2) == yait_m5(me) )
+ {
+ re = fabs( Ga[me]->r );
+ ro = fabs( Ga[mo]->r );
+ if( re>thresh && ro>thresh )
+ {
+ p = yait_m5( mo - 4 );
+ if( w )
+ *w = re + ro;
+ }
+ }
+
+ return( p );
+ }
+
+
+/*
+ * yait_find_even:
+ */
+
+static int
+yait_find_even( double thresh, int n, double *w, int win )
+ {
+ double re, ro;
+ int me, mo;
+ int p;
+
+ me = yait_ffmin( n, win );
+ mo = yait_ffmax( n, win );
+
+ p = -1;
+ if( yait_m5(me-2) == yait_m5(mo) )
+ {
+ re = fabs( Ga[me]->r );
+ ro = fabs( Ga[mo]->r );
+ if( re>thresh && ro>thresh )
+ {
+ p = yait_m5( me - 4 );
+ if( w )
+ *w = re + ro;
+ }
+ }
+
+ return( p );
+ }
+
+
+/*
+ * yait_ffmin:
+ */
+
+static int
+yait_ffmin( int n, int w )
+ {
+ Fi *f;
+ int m, i;
+ double r;
+
+ r = 0;
+ m = 0;
+ for( i=n; i<n+w; i++ )
+ {
+ if( i < 0 )
+ break;
+
+ f = Ga[i];
+ if( !f )
+ break;
+
+ if( f->r < r )
+ {
+ r = f->r;
+ m = i;
+ }
+ }
+
+ return( m );
+ }
+
+
+/*
+ * yait_ffmax:
+ */
+
+static int
+yait_ffmax( int n, int w )
+ {
+ Fi *f;
+ int m, i;
+ double r;
+
+ r = 0;
+ m = 0;
+ for( i=n; i<n+w; i++ )
+ {
+ if( i < 0 )
+ break;
+
+ f = Ga[i];
+ if( !f )
+ break;
+
+ if( f->r > r )
+ {
+ r = f->r;
+ m = i;
+ }
+ }
+
+ return( m );
+ }
+
+
+/*
+ * yait_m5:
+ */
+
+static int
+yait_m5( int n )
+ {
+ while( n < 0 )
+ n += 5;
+ return( n % 5 );
+ }
+
+
+/*
+ * yait_mark_grp:
+ * Try to catch the situation where a progressive frame is missing
+ * between interlace groups. This will cause an erroneous (opposite) ip
+ * pattern to be detected. The first sequence shown below is a normal (odd)
+ * telecine pattern. The second shows what happens when a progressive frame
+ * is missing. We want to reject the even pattern detected. Therefore, if
+ * we find an identical pattern at n+4 we keep it. If not, we reject if an
+ * opposite pattern follows at n+2 of greater weight.
+ *
+ * n: 0 1 2 3 4 0 1 2 3 4
+ * r: 0 -1 0 1 0 0 -1 0 1 0
+ * odd odd
+ *
+ * n: 0 1 2 3 4 1 2 3 4
+ * r: 0 -1 0 1 0 -1 0 1 0
+ * odd even odd
+ */
+
+static void
+yait_mark_grp( int p, int n, double w )
+ {
+ Fi *f;
+ double nw;
+ int np, t, i;
+
+ if( n%5 != (p+2)%5 )
+ return;
+
+ /* only overwrite an existing pattern if weight is greater */
+ f = Ga[n];
+ if( w <= f->w )
+ return;
+
+ /* check for same pattern at n+4 */
+ if( p < 10 )
+ np = yait_find_odd( OThresh, n+4, NULL, 5 );
+ else
+ np = yait_find_even( EThresh, n+4, NULL, 5 );
+ if( np < 0 )
+ {
+ /* no pattern at n+4, reject if opposite ip at n+2 */
+ if( p < 10 )
+ np = yait_find_even( EThresh, n+2, &nw, 5 );
+ else
+ np = yait_find_odd( OThresh, n+2, &nw, 5 );
+
+ if( np>=0 && nw>w )
+ return;
+ }
+
+ /* erase previous pattern */
+ if( n > 1 )
+ {
+ Ga[n-1]->op = 0;
+ Ga[n-2]->op = 0;
+ }
+
+ /* this frame and next are interlaced */
+ t = (p < 10) ? Y_OP_ODD : Y_OP_EVEN;
+ f->op = t | Y_OP_SAVE | Y_OP_DROP;
+ f = Ga[n+1];
+ f->op = t | Y_OP_COPY;
+
+ /* assume 1 progressive on either side of the tuplet */
+ for( i=n-1; i<n+4; i++ )
+ {
+ if( i<0 || i>=Ng )
+ continue;
+
+ f = Ga[i];
+ f->ip = p;
+ f->w = w;
+ }
+ }
+
+
+/*
+ * yait_find_drops:
+ * For every group of 5 frames, make sure we drop a frame. Allow up to a
+ * DropWin (default 15) group lookahead to make up for extra or missing drops. (The
+ * duplicated frames generated by --hard_fps can be quite early or late in the sequence).
+ * If a group requires a drop, but none exists, mark the group as requiring de-interlacing.
+ * Finally, consequetive marked groups inherit surrounding interleave patterns.
+ *
+ * Each group will receive one of the following flags:
+ *
+ * Y_HAS_DROP - group has a single drop frame
+ * Y_BANK_DROP - extra drop, can be used forward
+ * Y_WITHDRAW_DROP - missing drop, use banked drop from behind
+ * Y_RETURN_DROP - extra drop, can be used behind
+ * Y_BORROW_DROP - missing drop, use future extra drop
+ * Y_FORCE_DEINT - force de-interlacing, (produces a drop)
+ * Y_FORCE_DROP - missing drop, no extras and no interleave found
+ * Y_FORCE_KEEP - extra drop, no consumer so have to keep it
+ *
+ * For any flags other than FORCE, no action is required. Eeach group already has
+ * an available frame to drop, whether a marked duplicate, or a locally detected
+ * interleave pattern (which produces a drop).
+ *
+ * For Y_FORCE_DEINT, assemble consecutive groups of this type and try to inherit
+ * adjacent interleave patterns. If no pattern is available, mark them as
+ * Y_FORCE_DROP.
+ */
+
+static void
+yait_find_drops( void )
+ {
+ Fi *f;
+ int d, l;
+
+ /* populate drop counts */
+ for( d=0; d<Nd; d++ )
+ Da[d] = yait_cnt_drops( d*5 );
+
+ /* balance drop counts restricted by window size */
+ for( d=0; d<Nd; d++ )
+ {
+ f = Fa[d*5];
+
+ /* this is what we want to see */
+ if( Da[d] == 1 )
+ {
+ if( !f->gf )
+ f->gf = Y_HAS_DROP;
+ continue;
+ }
+
+ /* group is missing a drop? */
+ if( !Da[d] )
+ {
+ /* look ahead for an extra drop */
+ l = yait_extra_drop( d );
+ if( l )
+ {
+ /* found one */
+ Da[d]++;
+ f->gf = Y_BORROW_DROP;
+
+ --Da[l];
+ Fa[l*5]->gf = Y_RETURN_DROP;
+ continue;
+ }
+
+ /* no extra drops exist, mark for de-interlacing */
+ f->gf = Y_FORCE_DEINT;
+ continue;
+ }
+
+ /* we have too many drops */
+ while( Da[d] > 1 )
+ {
+ --Da[d];
+
+ /* look ahead for a missing drop */
+ l = yait_missing_drop( d );
+ if( l )
+ {
+ /* found one */
+ f->gf = Y_BANK_DROP;
+
+ Da[l]++;
+ Fa[l*5]->gf = Y_WITHDRAW_DROP;
+ continue;
+ }
+
+ /* we have to keep a drop */
+ if( !NoKeeps )
+ {
+ f->gf = Y_FORCE_KEEP;
+ yait_keep_frame( d*5 );
+
+ Stat_fk++;
+ }
+ }
+ }
+ }
+
+
+/*
+ * yait_cnt_drops:
+ */
+
+static int
+yait_cnt_drops( int n )
+ {
+ Fi *f;
+ int d, i;
+
+ d = 0;
+ for( i=n; i<n+5 && i<Nf; i++ )
+ {
+ f = Fa[i];
+ if( f->drop || f->op&Y_OP_DROP )
+ d++;
+ }
+
+ return( d );
+ }
+
+
+/*
+ * yait_extra_drop:
+ * Scan DropWin groups ahead for an extra drop.
+ */
+
+static int
+yait_extra_drop( int d )
+ {
+ int l, w;
+
+ for( w=0; w<DropWin; w++ )
+ {
+ l = d + w + 1;
+ if( l >= Nd )
+ return( 0 );
+
+ if( Da[l] > 1 )
+ return( l );
+ }
+
+ return( 0 );
+ }
+
+
+/*
+ * yait_missing_drop:
+ * Scan DropWin groups ahead for a missing drop.
+ */
+
+static int
+yait_missing_drop( int d )
+ {
+ int l, w;
+
+ for( w=0; w<DropWin; w++ )
+ {
+ l = d + w + 1;
+ if( l >= Nd )
+ return( 0 );
+
+ if( !Da[l] )
+ return( l );
+ }
+
+ return( 0 );
+ }
+
+
+/*
+ * yait_keep_frame:
+ * Multiple drops exist. Pick the best frame to keep. This can be difficult,
+ * as we do not want to keep a duplicate of an interlaced frame. First, try to find
+ * a hard dropped frame which does not follow an interlace. If one can be found, then
+ * simply negate the drop flag. If we are duplicating an interlace, alter the frame
+ * operations for the group to produce a non-interlaced duplicate.
+ */
+
+static void
+yait_keep_frame( int n )
+ {
+ Fi *f;
+ int da[6], bd, d, i;
+
+ d = yait_get_hdrop( n, da );
+
+ if( !d )
+ {
+ /* no hard drop frames were found, so ... */
+ /* two interlace drops exist, keep one, but blend it */
+ for( i=n; i<n+5 && i<Nf; i++ )
+ {
+ f = Fa[i];
+ if( f->op & Y_OP_DROP )
+ {
+ f->op &= ~Y_OP_DROP;
+ f->op |= Y_OP_DEINT;
+ return;
+ }
+ }
+
+ /* sanity check */
+ f = Fa[n];
+ fprintf( stderr, "No drop frame can be found, frame: %d\n", f->fn );
+ exit( 1 );
+ }
+
+ /* try to use a drop frame that isn't an interlace duplicate */
+ bd = -1;
+ for( i=0; i<5; i++ )
+ {
+ d = da[i];
+ if( !d )
+ /* can't access before Fa[0] */
+ continue;
+
+ if( d < 0 )
+ /* end of drop list */
+ break;
+
+ f = Fa[d-1];
+ if( f->drop )
+ /* two dups in a row */
+ f = Fa[d-2];
+
+ if( !f->op )
+ {
+ /* good */
+ f = Fa[d];
+ f->drop = FALSE;
+ return;
+ }
+
+ if( f->op & Y_OP_COPY )
+ bd = d;
+ }
+
+ /* keeping a duplicate of an interlace, try to use one which duplicates the */
+ /* second of an interlace pair, as that is cleaner to deal with */
+ /* bd (best drop) was set earlier in the loop if such a frame was found */
+ if( bd < 0 )
+ bd = da[0];
+
+ yait_ivtc_keep( bd );
+ }
+
+
+/*
+ * yait_get_hdrop:
+ * Populate an index array of the hard dropped frames, and return
+ * the count of how many were found.
+ */
+
+static int
+yait_get_hdrop( int n, int *da )
+ {
+ Fi *f;
+ int d, i;
+
+ d = 0;
+ for( i=n; i<n+5 && i<Nf; i++ )
+ {
+ f = Fa[i];
+ if( f->drop )
+ {
+ *da++ = i;
+ d++;
+ }
+ }
+ *da = -1;
+
+ return( d );
+ }
+
+
+/*
+ * yait_ivtc_keep
+ * Depending upon the position of the DROP in the pattern, alter the
+ * frame ops to generate a non-interlaced frame, and keep it.
+ *
+ * Case 1:
+ * If the duplicated frame is the second of the interlaced pair, then
+ * simply repeat the row copy operation and keep the frame.
+ *
+ * Original (odd pattern):
+ * sd c
+ * even: 2 2 3 3 4
+ * odd: 2 3 4 4 4
+ * drop DROP
+ *
+ * yeilds (bad keep frame):
+ * even: 2 3 3 4
+ * odd: 2 3 4 4
+ * KEEP
+ * Revised:
+ * sd c c
+ * even: 2 2 3 3 4
+ * odd: 2 3 4 4 4
+ * drop DROP
+ * yeilds:
+ * even: 2 3 3 4
+ * odd: 2 3 3 4
+ * KEEP
+ *
+ * Case 2:
+ * If the duplicated frame copies the first of the interlaced pair, more
+ * work must be done:
+ *
+ * Original (odd pattern):
+ * sd c
+ * even: 2 2 2 3 4
+ * odd: 2 3 3 4 4
+ * drop DROP
+ *
+ * yeilds (bad keep frame):
+ * even: 2 2 3 4
+ * odd: 2 3 3 4
+ * KEEP
+ * Revised:
+ * s c sd c
+ * even: 2 2 2 3 4
+ * odd: 2 3 3 4 4
+ * drop
+ * yeilds:
+ * even: 2 2 3 4
+ * odd: 2 2 3 4
+ * (keep)
+ */
+
+static void
+yait_ivtc_keep( int d )
+ {
+ Fi *fd, *fp;
+ int t;
+
+ fd = Fa[d];
+ fp = Fa[d-1];
+ if( fp->drop )
+ fp = Fa[d-2];
+
+ if( fp->op & Y_OP_COPY )
+ {
+ /* case 1 */
+ fd->op = fp->op;
+ fd->drop = FALSE;
+ return;
+ }
+
+ /* case 2 */
+ if( d < 2 )
+ {
+ /* can't access before Fa[0] */
+ /* (unlikely we would see this the first two frames of a film) */
+ fd->drop = FALSE;
+ return;
+ }
+
+ fd->op = fp->op;
+ fd->drop = FALSE;
+
+ t = fp->op & Y_OP_PAT;
+ fp->op = t | Y_OP_COPY;
+ fp = Fa[d-2];
+ fp->op = t | Y_OP_SAVE;
+ }
+
+
+/*
+ * yait_ivtc_grps:
+ * For each group missing an interleave pattern, scan backward and forward
+ * for an adjacent pattern. Consider hard dropped frames as barriers. If two
+ * different patterns exist, test the pattern against the original r values to find
+ * the best match. For consecutive (forced) interleave groups, use the previously
+ * found pattern values, until the forward scan value is used, which is then
+ * propagated to the rest of the sequence. (This avoids an O(n^2) search).
+ *
+ * If no pattern can be found, force a drop of a frame in the group.
+ *
+ * TODO:
+ * I should really be detecting scene changes as well, and consider them
+ * barriers.
+ */
+
+static void
+yait_ivtc_grps( void )
+ {
+ Fi *f;
+ int pb, pf, fg;
+ int p, n;
+
+ /* process by groups of 5 */
+ fg = TRUE;
+ pb = -1;
+ pf = -1;
+ for( n=0; n<Nf; n+=5 )
+ {
+ f = Fa[n];
+ if( f->gf != Y_FORCE_DEINT )
+ {
+ fg = TRUE;
+ continue;
+ }
+
+ if( fg )
+ {
+ /* this is the first group of a sequence, scan */
+ fg = FALSE;
+ pb = yait_scan_bk( n );
+ pf = yait_scan_fw( n );
+ }
+
+ if( pb<0 && pf<0 )
+ {
+ /* no pattern exists */
+ f->gf = Y_FORCE_DROP;
+ yait_drop_frame( n );
+ continue;
+ }
+
+ /* deinterlace the group with one of the given patterns */
+ /* if the pattern used is forward, keep it from now on */
+ p = yait_ivtc_grp( n, pb, pf );
+ if( p < 0 )
+ {
+ /* no pattern will match */
+ f->gf = Y_FORCE_DROP;
+ yait_drop_frame( n );
+ continue;
+ }
+
+ if( p == pf )
+ pb = -1;
+ }
+ }
+
+
+/*
+ * yait_scan_bk:
+ */
+
+static int
+yait_scan_bk( int n )
+ {
+ Fi *f;
+ int i;
+
+ for( i=n-1; i>=0; --i )
+ {
+ f = Fa[i];
+ if( !f )
+ return( -1 );
+
+ if( f->drop )
+ return( -1 );
+
+ if( f->ip != -1 )
+ return( f->ip );
+ }
+
+ return( -1 );
+ }
+
+
+/*
+ * yait_scan_fw:
+ */
+
+static int
+yait_scan_fw( int n )
+ {
+ Fi *f;
+ int i;
+
+ for( i=n+5; i<Nf; i++ )
+ {
+ f = Fa[i];
+
+ if( f->drop )
+ return( -1 );
+
+ if( f->ip != -1 )
+ return( f->ip );
+ }
+
+ return( -1 );
+ }
+
+
+/*
+ * yait_drop_frame:
+ * Choose a frame to drop. We want the frame with the highest fabs(r) value,
+ * as it is likely an interlaced frame. Do not use a frame which follows an assigned
+ * ip pattern, (it is the trailing element of a tuplet). If no r values exceed the
+ * threshold, choose the frame with the minimum delta.
+ *
+ * Frame: 0 1 2 3 4 | 5 6 7 8 9
+ * Ratio: 0 0 0 -1 0 | 1 0 0 0 0
+ * Op: sd c |
+ * group boundary
+ *
+ * In the above example, the first frame of the second group (5) may have the highest
+ * ratio value, but is the worst choice because it is part of the detected pattern and
+ * is a unique progressive frame.
+ */
+
+static void
+yait_drop_frame( int n )
+ {
+ Fi *f;
+ double mr, r;
+ int md, d;
+ int fr, fd;
+ int i;
+
+ mr = 0;
+ md = 0;
+ fr = n;
+ fd = n;
+
+ for( i=n; i<n+5 && i<Nf-1; i++ )
+ {
+ if( !i )
+ /* can't access before Fa[0] */
+ continue;
+
+ if( Fa[i-1]->drop || Fa[i+1]->drop )
+ /* avoid two consequetive drops */
+ continue;
+
+ if( Fa[i-1]->op & Y_OP_PAT )
+ /* trailing tuplet element */
+ continue;
+
+ f = Fa[i];
+
+ r = fabs( f->ro );
+ if( r > mr )
+ {
+ mr = r;
+ fr = i;
+ }
+
+ d = f->ed + f->od;
+ if( !md || d<md )
+ {
+ md = d;
+ fd = i;
+ }
+ }
+
+ Fa[ (mr>Thresh)?fr:fd ]->drop = TRUE;
+ Stat_fd++;
+ }
+
+
+/*
+ * yait_ivtc_grp:
+ * We need to de-interlace this group. Given are two potential patterns.
+ * If both are valid, test both and keep the one with the best r value matches.
+ * For the pattern used, mark the group, set the frame ops accordingly, and return
+ * it as the function value.
+ */
+
+static int
+yait_ivtc_grp( int n, int p1, int p2 )
+ {
+ Fi *f;
+ double thresh, m1, m2;
+ int p, t, i;
+
+ m1 = (p1 < 0) ? -1 : yait_tst_ip(n,p1);
+ m2 = (p2 < 0) ? -1 : yait_tst_ip(n,p2);
+
+ /* yait_tst_ip() returns the sum of two ratios */
+ /* we want both ratios > Y_MTHRESH */
+ thresh = Y_MTHRESH * 2;
+ if( !NoDrops && m1<thresh && m2<thresh )
+ /* neither pattern matches, force a drop instead */
+ return( -1 );
+
+ p = (m1 > m2) ? p1 : p2;
+
+ /* sanity check */
+ if( p < 0 )
+ {
+ f = Fa[n];
+ fprintf( stderr, "Impossible interlace pattern computed (%d), frame: %d\n",
+ p, f->fn );
+ exit( 1 );
+ }
+
+ /* we have a pattern, mark group */
+ for( i=n; i<n+5 && i<Nf; i++ )
+ {
+ f = Fa[i];
+ if( f->drop )
+ {
+ fprintf( stderr,
+ "De-interlace, horribly confused now, frame: %d.\n", f->fn );
+ exit( 1 );
+ }
+ f->ip = p;
+ }
+
+ f = Fa[n];
+ n = f->gi;
+
+ /* sanity check */
+ if( Ga[n] != f )
+ {
+ fprintf( stderr, "Lost our frame in the group array, frame: %d\n", f->fn );
+ exit( 1 );
+ }
+
+ t = (p < 10) ? Y_OP_ODD : Y_OP_EVEN;
+ for( i=n; i<n+5 && i<Ng-1; i++ )
+ {
+ if( i%5 == (p+2)%5 )
+ {
+ f = Ga[i];
+ f->op = t | Y_OP_SAVE | Y_OP_DROP;
+
+ /* don't overwrite an existing frame drop */
+ f = Ga[i+1];
+ if( !(f->op&Y_OP_DROP) )
+ f->op = t | Y_OP_COPY;
+
+ break;
+ }
+ }
+
+ return( p );
+ }
+
+
+/*
+ * yait_tst_ip:
+ */
+
+static double
+yait_tst_ip( int n, int p )
+ {
+ double rs, r;
+ int s, i;
+
+ s = (p < 10) ? 1 : -1;
+ rs = 0;
+
+ n = Fa[n]->gi;
+ for( i=n; i<n+5 && i<Ng-2; i++ )
+ {
+ if( i%5 != (p+2)%5 )
+ continue;
+
+ /* strong pattern would have r[i]<-thresh and r[i+2]>thresh */
+ r = s * Ga[i]->ro;
+ if( r < 0 )
+ rs += fabs( r );
+
+ r = s * Ga[i+2]->ro;
+ if( r > 0 )
+ rs += r;
+
+ break;
+ }
+
+ return( rs );
+ }
+
+
+/*
+ * yait_deint:
+ * For non 3/2 telecine patterns, we may have let interlaced frames
+ * through. Tell transcode to de-interlace (blend) these. This is the case for
+ * any frame having a high ratio with no interlace pattern detected.
+ *
+ * TODO:
+ * This was an afterthought. Perhaps we can avoid a 32detect pass on
+ * the video by performing this, although it is difficult to detect out of
+ * pattern interlace frames solely on row delta information. Perhaps we should
+ * have built 32detect into the log generation, and added an extra flag field if
+ * we thought the frame was interlaced. This also would help when trying to
+ * assign ambiguous ip patterns.
+ */
+
+static void
+yait_deint( void )
+ {
+ Fi *fp, *fn, *f;
+ int i;
+
+ for( i=1; i<Ng-1; i++ )
+ {
+ fp = Ga[i-1];
+ f = Ga[i];
+ fn = Ga[i+1];
+
+ if( f->op&Y_OP_PAT || f->drop )
+ /* already being de-interlaced or dropped */
+ continue;
+
+ if( fp->op & Y_OP_PAT )
+ /* trailing element of a tuplet */
+ continue;
+
+ if( fabs(f->r) < Blend )
+ /* it isn't interlaced (we think) */
+ continue;
+
+ if( f->nd < Y_FWEIGHT )
+ /* delta is too weak, interlace is likely not visible */
+ continue;
+
+ if( fp->nd>Y_SCENE_CHANGE || f->nd>Y_SCENE_CHANGE )
+ /* can't make a decision over scene changes */
+ continue;
+
+ /* this frame is interlaced with no operation assigned */
+ f->op = Y_OP_DEINT;
+
+ /* if the next frame ratio < thresh, it is similar, unless */
+ /* a scene change, therefore interlaced as well */
+ if( fabs(fn->r)<Thresh && fn->nd<Y_SCENE_CHANGE )
+ if( !(fn->op&Y_OP_PAT) && !fn->drop )
+ fn->op = Y_OP_DEINT;
+
+ /* if the next frame(s) are duplicates of this, mark them */
+ /* for blending as well, as the may eventually be force kept */
+ while( f->next && !f->next->gi )
+ {
+ f = f->next;
+ f->op = Y_OP_DEINT;
+ }
+ }
+ }
+
+
+/*
+ * yait_write_ops:
+ */
+
+static void
+yait_write_ops( void )
+ {
+ Fi *f;
+
+ for( f=Fl; f; f=f->next )
+ fprintf( OpsFp, "%d: %s\n", f->fn, yait_write_op(f) );
+ }
+
+
+/*
+ * yait_write_op:
+ */
+
+static char*
+yait_write_op( Fi *f )
+ {
+ static char buf[10];
+ char *p;
+ int op;
+
+ p = buf;
+ if( f->drop )
+ {
+ *p++ = 'd';
+ *p = 0;
+ Stat_nd++;
+ return( buf );
+ }
+
+ op = f->op;
+ if( op & Y_OP_ODD )
+ *p++ = 'o';
+ if( op & Y_OP_EVEN )
+ *p++ = 'e';
+ if( op & Y_OP_SAVE )
+ *p++ = 's';
+ if( op & Y_OP_COPY )
+ *p++ = 'c';
+ if( op & Y_OP_DROP )
+ {
+ *p++ = 'd';
+ Stat_nd++;
+ if( op & Y_OP_ODD )
+ Stat_no++;
+ else
+ Stat_ne++;
+ }
+ if( op & Y_OP_DEINT )
+ {
+ *p++ = '0' + DeintMode;
+ Stat_nb++;
+ }
+ *p = 0;
+
+ return( buf );
+ }
+
+
+/*
+ * yait_fini:
+ * Free up allocations.
+ */
+
+static void
+yait_fini( void )
+ {
+ int i;
+
+ for( i=0; i<Nf; i++ )
+ free( Fa[i] );
+
+ free( Fa );
+ free( Ga );
+ free( Da );
+ }
+
+
+/*
+ * Output debug information to stdout
+ */
+
+static void
+yait_debug_fi( void )
+ {
+ Fi *f;
+ int i;
+
+ printf( "Options:\n" );
+ printf( "\tLog file: %s\n", LogFn );
+ printf( "\tOps file: %s\n", OpsFn );
+ printf( "\tEven Threshold: %g\n", EThresh );
+ printf( "\tOdd Threshold: %g\n", OThresh );
+ printf( "\tBlend threshold: %g\n", Blend );
+ printf( "\tDrop window size: %d\n", DropWin );
+ printf( "\tDe-interlace mode: %d\n\n", DeintMode );
+
+ printf( "Stats:\n" );
+ printf( "\tTotal number of frames: %d\n", Nf );
+ printf( "\tNumber of frames divided by 5: %d\n", Nf/5 );
+ printf( "\tTotal dropped frames: %d\n", Stat_nd );
+ printf( "\tTotal blended frames: %d\n", Stat_nb );
+ printf( "\tTotal odd interlaced pairs: %d\n", Stat_no );
+ printf( "\tTotal even interlaced pairs: %d\n", Stat_ne );
+ printf( "\tNumber of forced frame drops: %d\n", Stat_fd );
+ printf( "\tNumber of forced frame keeps: %d\n\n", Stat_fk );
+ printf( "\tMax row delta: %d\n\n", Md );
+
+ i = 0;
+ for( f=Fl; f; f=f->next, i++ )
+ {
+ if( i && !(i%5) )
+ printf( "\n" );
+
+ printf( "Frame %6d: e: %8d, o: %8d, r: %7.3f, ro: %7.3f, w: %8.4f, "
+ "ip: %2d, gi: %6d, op: %-4s d: %s %s\n",
+ f->fn, f->ed, f->od, f->r, f->ro, f->w, f->ip, f->gi,
+ yait_op(f->op), yait_drop(f), yait_grp(f->gf) );
+ }
+ }
+
+static char*
+yait_op( int op )
+ {
+ static char buf[10];
+ char *p;
+
+ p = buf;
+ *p = 0;
+ if( !op )
+ return( buf );
+
+ if( op & Y_OP_ODD )
+ *p++ = 'o';
+ if( op & Y_OP_EVEN )
+ *p++ = 'e';
+ if( op & Y_OP_SAVE )
+ *p++ = 's';
+ if( op & Y_OP_COPY )
+ *p++ = 'c';
+ if( op & Y_OP_DROP )
+ *p++ = 'd';
+ if( op & Y_OP_DEINT )
+ *p++ = '0' + DeintMode;
+ *p = 0;
+
+ return( buf );
+ }
+
+static char*
+yait_drop( Fi *f )
+ {
+ if( f->drop )
+ return( "DROP" );
+
+ if( f->op&Y_OP_ODD && f->op&Y_OP_DROP )
+ return( "odd " );
+
+ if( f->op&Y_OP_EVEN && f->op&Y_OP_DROP )
+ return( "even" );
+
+ return( " " );
+ }
+
+static char*
+yait_grp( int flg )
+ {
+ switch( flg )
+ {
+ case Y_HAS_DROP:
+ return( "has drop" );
+ case Y_BANK_DROP:
+ return( "bank" );
+ case Y_WITHDRAW_DROP:
+ return( "withdraw" );
+ case Y_BORROW_DROP:
+ return( "borrow" );
+ case Y_RETURN_DROP:
+ return( "return" );
+ case Y_FORCE_DEINT:
+ return( "force deint" );
+ case Y_FORCE_DROP:
+ return( "force drop" );
+ case Y_FORCE_KEEP:
+ return( "force keep" );
+ }
+ return( "" );
+ }