diff options
| author | Michele Calgaro <michele.calgaro@yahoo.it> | 2020-09-11 14:38:47 +0900 |
|---|---|---|
| committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2020-09-11 14:38:47 +0900 |
| commit | 884c8093d63402a1ad0b502244b791e3c6782be3 (patch) | |
| tree | a600d4ab0d431a2bdfe4c15b70df43c14fbd8dd0 /debian/transcode/transcode-1.1.7/pvm3 | |
| parent | 14e1aa2006796f147f3f4811fb908a6b01e79253 (diff) | |
| download | extra-dependencies-884c8093d63402a1ad0b502244b791e3c6782be3.tar.gz extra-dependencies-884c8093d63402a1ad0b502244b791e3c6782be3.zip | |
Added debian extra dependency packages.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'debian/transcode/transcode-1.1.7/pvm3')
16 files changed, 4698 insertions, 0 deletions
diff --git a/debian/transcode/transcode-1.1.7/pvm3/Makefile.am b/debian/transcode/transcode-1.1.7/pvm3/Makefile.am new file mode 100644 index 00000000..e644ebe3 --- /dev/null +++ b/debian/transcode/transcode-1.1.7/pvm3/Makefile.am @@ -0,0 +1,47 @@ +# # Makefile.am -- Process this file with automake to produce Makefile.in + +AM_CPPFLAGS = \ + $(PTHREAD_CFLAGS) \ + -DMOD_PATH=\"$(MOD_PATH)\" \ + -I$(top_srcdir) \ + -I$(top_srcdir)/src \ + $(PVM3_CFLAGS) + +AM_LDFLAGS = -export-dynamic + +pkgdir = $(MOD_PATH) + +bin_PROGRAMS = tcpvmexportd +pkg_LTLIBRARIES = pvm_functions.la + +pvm_functions_la_SOURCES = pvm_functions.c +pvm_functions_la_LDFLAGS = -module -avoid-version +pvm_functions_la_LIBADD = $(PVM3_LIBS) + +tcpvmexportd_SOURCES = \ + tcpvmexportd.c \ + export_pvm_slave.c \ + pvm_interface.c \ + pvm_parser.c \ + external_codec.c \ + vob_pack_unpack.c + +tcpvmexportd_LDADD = \ + $(ACLIB_LIBS) \ + $(LIBTC_LIBS) \ + -lm + +EXTRA_DIST = \ + pvm_functions.h \ + export_pvm_slave.h \ + pvm_interface.h \ + pvm_parser.h \ + external_codec.h \ + pvm_version.h \ + vob_pack_unpack.h + +install-data-local: + @$(NORMAL_INSTALL) + if test ! -e $(bindir)/pvmgs; then \ + ln -s $(PVM3_PVMGS) $(bindir)/pvmgs; \ + fi; diff --git a/debian/transcode/transcode-1.1.7/pvm3/Makefile.in b/debian/transcode/transcode-1.1.7/pvm3/Makefile.in new file mode 100644 index 00000000..94c69f1e --- /dev/null +++ b/debian/transcode/transcode-1.1.7/pvm3/Makefile.in @@ -0,0 +1,730 @@ +# 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@ + +# # Makefile.am -- 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 = tcpvmexportd$(EXEEXT) +subdir = pvm3 +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 = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__installdirs = "$(DESTDIR)$(pkgdir)" "$(DESTDIR)$(bindir)" +LTLIBRARIES = $(pkg_LTLIBRARIES) +am__DEPENDENCIES_1 = +pvm_functions_la_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_pvm_functions_la_OBJECTS = pvm_functions.lo +pvm_functions_la_OBJECTS = $(am_pvm_functions_la_OBJECTS) +pvm_functions_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(pvm_functions_la_LDFLAGS) $(LDFLAGS) -o $@ +PROGRAMS = $(bin_PROGRAMS) +am_tcpvmexportd_OBJECTS = tcpvmexportd.$(OBJEXT) \ + export_pvm_slave.$(OBJEXT) pvm_interface.$(OBJEXT) \ + pvm_parser.$(OBJEXT) external_codec.$(OBJEXT) \ + vob_pack_unpack.$(OBJEXT) +tcpvmexportd_OBJECTS = $(am_tcpvmexportd_OBJECTS) +tcpvmexportd_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +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 = $(pvm_functions_la_SOURCES) $(tcpvmexportd_SOURCES) +DIST_SOURCES = $(pvm_functions_la_SOURCES) $(tcpvmexportd_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)\" \ + -I$(top_srcdir) \ + -I$(top_srcdir)/src \ + $(PVM3_CFLAGS) + +AM_LDFLAGS = -export-dynamic +pkgdir = $(MOD_PATH) +pkg_LTLIBRARIES = pvm_functions.la +pvm_functions_la_SOURCES = pvm_functions.c +pvm_functions_la_LDFLAGS = -module -avoid-version +pvm_functions_la_LIBADD = $(PVM3_LIBS) +tcpvmexportd_SOURCES = \ + tcpvmexportd.c \ + export_pvm_slave.c \ + pvm_interface.c \ + pvm_parser.c \ + external_codec.c \ + vob_pack_unpack.c + +tcpvmexportd_LDADD = \ + $(ACLIB_LIBS) \ + $(LIBTC_LIBS) \ + -lm + +EXTRA_DIST = \ + pvm_functions.h \ + export_pvm_slave.h \ + pvm_interface.h \ + pvm_parser.h \ + external_codec.h \ + pvm_version.h \ + vob_pack_unpack.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 pvm3/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu pvm3/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-pkgLTLIBRARIES: $(pkg_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(pkgdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgdir)" + @list='$(pkg_LTLIBRARIES)'; test -n "$(pkgdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkgdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkgdir)"; \ + } + +uninstall-pkgLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(pkg_LTLIBRARIES)'; test -n "$(pkgdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$f"; \ + done + +clean-pkgLTLIBRARIES: + -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES) + @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +pvm_functions.la: $(pvm_functions_la_OBJECTS) $(pvm_functions_la_DEPENDENCIES) + $(pvm_functions_la_LINK) -rpath $(pkgdir) $(pvm_functions_la_OBJECTS) $(pvm_functions_la_LIBADD) $(LIBS) +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 +tcpvmexportd$(EXEEXT): $(tcpvmexportd_OBJECTS) $(tcpvmexportd_DEPENDENCIES) + @rm -f tcpvmexportd$(EXEEXT) + $(LINK) $(tcpvmexportd_OBJECTS) $(tcpvmexportd_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/export_pvm_slave.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/external_codec.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pvm_functions.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pvm_interface.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pvm_parser.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcpvmexportd.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vob_pack_unpack.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 $@ $< + +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 $(LTLIBRARIES) $(PROGRAMS) +installdirs: + for dir in "$(DESTDIR)$(pkgdir)" "$(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 \ + clean-pkgLTLIBRARIES 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-data-local install-pkgLTLIBRARIES + +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 uninstall-pkgLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-libtool clean-pkgLTLIBRARIES 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-data-local 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-pkgLTLIBRARIES 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 uninstall-pkgLTLIBRARIES + + +install-data-local: + @$(NORMAL_INSTALL) + if test ! -e $(bindir)/pvmgs; then \ + ln -s $(PVM3_PVMGS) $(bindir)/pvmgs; \ + fi; + +# 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/pvm3/export_pvm_slave.c b/debian/transcode/transcode-1.1.7/pvm3/export_pvm_slave.c new file mode 100644 index 00000000..082b10bb --- /dev/null +++ b/debian/transcode/transcode-1.1.7/pvm3/export_pvm_slave.c @@ -0,0 +1,1184 @@ +/* + * export_pvm_slave.c + * + * Copyright (C) Marzio Malanchini - July 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 <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> +#include <stdlib.h> +#include <string.h> +#include <stdio.h> + +#ifdef HAVE_DLFCN_H +#include <dlfcn.h> +#else +# ifdef OS_DARWIN +# include "libdldarwin/dlfcn.h" +# endif +#endif + +#include "pvm_interface.h" +#include "export_pvm_slave.h" +#include "external_codec.h" +#include "vob_pack_unpack.h" +#include "transcode.h" + + +#define MODULE "pvm_functions.so" +#define MAX_BUF 1024 +#define COPY_BUFFER 10485760 /*10 MB*/ + +extern char *p_param1,*p_param2,*p_param3; /*codec input parameter*/ +#define tc_export p_tc_export +extern int (*tc_export)(int,void *,void *); +extern int tc_accel; +extern int s_elab_type; +extern char *p_out_file_name; +extern int s_list_only,verbose; +extern char *p_request_func; +extern char *p_hostname; +extern char *p_merge_cmd; +extern int s_divxmultipass,s_internal_multipass; +extern int f_init_func(char *,char *); + +static vob_t *vob; + +/*start function required by some export modules*/ + +vob_t *tc_get_vob() {return(vob);} + +void tc_outstream_rotate() +{ +/*just to remove the file switch*/ +} + +/*end function required by some export modules*/ + +struct pvm_files_t { + int s_seq; + char s_file[2*MAX_BUF]; + char s_file_log[2*MAX_BUF]; + struct pvm_files_t *p_next; + }; + +char *f_filenamelist(char *p_option,pvm_config_env *p_pvm_conf,int s_type,int s_seq) +{ + + pvm_config_filelist *p_add_list; + int s_cont; + + s_cont=0; + if(!strcasecmp(p_option,"filelist")) + { + p_add_list=p_pvm_conf->p_add_list; + } + else if (!strcasecmp(p_option,"loglist")) + { + p_add_list=p_pvm_conf->p_add_loglist; + } + else + return(NULL); + for(;p_add_list!=NULL;p_add_list=p_add_list->p_next) + { + if ((s_cont==s_seq)&&(p_add_list->s_type==s_type)) + return(p_add_list->p_filename); + else if (p_add_list->s_type==s_type) + s_cont++; + } + return(NULL); + +} + +int f_system_merge(pvm_config_env *p_pvm_conf) +{ + pvm_config_filelist *p_video_list=NULL,*p_audio_list=NULL; + char s_buffer[MAX_BUF],*p_par=NULL; + int s_file_dest=-1,s_count=0; + + if (p_pvm_conf->s_build_intermed_file==0) + { + if ((s_file_dest=creat(p_pvm_conf->s_sys_list.p_destination,S_IWUSR|S_IRUSR|S_IRGRP|S_IROTH))==-1) + { + fprintf(stderr,"(%s) can't create %s output file.\n",__FILE__,p_pvm_conf->s_sys_list.p_destination); + pvm_parser_close(); + p_pvm_conf=NULL; + return(1); + } + } + for (p_video_list=p_pvm_conf->p_add_list;((p_video_list->s_type==TC_AUDIO)&&(p_video_list!=NULL));p_video_list=p_video_list->p_next); + for (p_audio_list=p_pvm_conf->p_add_list;((p_audio_list->s_type==TC_VIDEO)&&(p_audio_list!=NULL));p_audio_list=p_audio_list->p_next); + if (p_video_list==NULL) + { + fprintf(stderr,"(%s) request a system merge without video list inside %s .\n",__FILE__,p_out_file_name); + return(1); + } + else if (p_audio_list==NULL) + { + fprintf(stderr,"(%s) request a system merge without audio list inside %s .\n",__FILE__,p_out_file_name); + return(1); + } + p_par=strtok(p_pvm_conf->p_multiplex_cmd,"\""); + while ((p_video_list!=NULL)&&(p_audio_list!=NULL)) + { + memset(s_buffer,'\0',sizeof(s_buffer)); + tc_snprintf(s_buffer,sizeof(s_buffer),"%s-%06d",p_pvm_conf->s_sys_list.p_destination,s_count++); + if (f_multiplexer(p_pvm_conf->s_sys_list.p_codec,p_par,p_video_list->p_filename,p_audio_list->p_filename,s_buffer,verbose)) + { + fprintf(stderr,"(%s) unsupported codec %s.\n",__FILE__,p_merge_cmd); + return(1); + } + remove(p_video_list->p_filename); + remove(p_audio_list->p_filename); + if (p_pvm_conf->s_build_intermed_file==0) + { + if (verbose & TC_DEBUG) + fprintf(stderr,"(%s) multiplex audio %s and video %s into %s\n",__FILE__,p_audio_list->p_filename,p_video_list->p_filename,s_buffer); + if(f_copy_remove_func("open",s_buffer,s_file_dest)) + return(1); + if (verbose & TC_DEBUG) + fprintf(stderr,"(%s) merge into %s and remove file %s\n",__FILE__,p_pvm_conf->s_sys_list.p_destination,s_buffer); + } + p_video_list=p_video_list->p_next; + p_audio_list=p_audio_list->p_next; + } + if (p_pvm_conf->s_build_intermed_file==0) + close(s_file_dest); + return(0); +} + + +int f_copy_remove_func(char *p_option,char *p_file,int s_file_dest) +{ + FILE *p_file_src; + static char *p_buffer=NULL; + int s_tmp; + + + if(!strcasecmp(p_option,"open")) + { + if (p_buffer == NULL) + p_buffer=(char *)malloc(COPY_BUFFER); + if ((p_file_src=fopen(p_file,"r"))==NULL) /*file exist!*/ + { + fprintf(stderr,"(%s) file %s not found\n",__FILE__,p_file); + return(1); + } + while(!feof(p_file_src)) /*copy process*/ + { + s_tmp=fread(p_buffer,1,COPY_BUFFER,p_file_src); + write(s_file_dest,p_buffer,s_tmp); + } + fclose(p_file_src); + remove(p_file); + } + else if (!strcasecmp(p_option,"close")) + { + free(p_buffer); + p_buffer=NULL; + } + else + { + fprintf(stderr,"(%s) invalid option\n",__FILE__); + return(1); + } + return(0); +} + +static int f_internal_multipass(vob_t *p_vob,int s_size,int s_elab_type,transfer_t *p_export_param,char *p_input_stream) +{ + + int s_file_dest,s_tmp; + + s_file_dest=-1; + vob->divxmultipass=2; /*setup the pass*/ + if (s_elab_type==TC_VIDEO) + p_export_param->flag=TC_VIDEO; + else + p_export_param->flag=TC_AUDIO; + + if(f_init_func("open-external",p_request_func)) /*need because most of external module don't release the resources*/ + { + fprintf(stderr,"(%s) restarting the dlopen \n",__FILE__); + return(1); + } + p_export_param->flag=vob->verbose; + tc_export(TC_EXPORT_NAME,(void *)p_export_param,NULL); /*check the capability*/ + if (s_elab_type==TC_VIDEO) + { + switch (vob->im_v_codec) + { + case CODEC_RGB: + s_tmp=(p_export_param->flag & TC_CAP_RGB); + break; + case CODEC_YUV: + s_tmp=(p_export_param->flag & TC_CAP_YUV); + break; + case CODEC_RAW: + case CODEC_RAW_YUV: + s_tmp=(p_export_param->flag & TC_CAP_VID); + break; + default: + s_tmp=0; + } + p_export_param->flag=TC_VIDEO; + } + else /*audio codec*/ + { + switch (vob->im_a_codec) + { + case CODEC_PCM: + s_tmp=(p_export_param->flag & TC_CAP_PCM); + break; + case CODEC_AC3: + s_tmp=(p_export_param->flag & TC_CAP_AC3); + break; + case CODEC_RAW: + s_tmp=(p_export_param->flag & TC_CAP_AUD); + break; + default: + s_tmp=0; + } + p_export_param->flag=TC_AUDIO; + } + if (!s_tmp) + return(1); + if (tc_export(TC_EXPORT_INIT,(void *)p_export_param,vob)==TC_EXPORT_ERROR) /*check the capability*/ + { + if (s_elab_type==TC_VIDEO) + fprintf(stderr,"(%s) video export module error: init failed\n",__FILE__); + else + fprintf(stderr,"(%s) audio export module error: init failed\n",__FILE__); + return(1); + } + if (tc_export(TC_EXPORT_OPEN,(void *)p_export_param,vob)==TC_EXPORT_ERROR) + { + if (s_elab_type==TC_VIDEO) + fprintf(stderr,"(%s) video export module error: open failed\n",__FILE__); + else + fprintf(stderr,"(%s) audio export module error: open failed\n",__FILE__); + return(1); + } + if ((s_file_dest=open(p_input_stream,O_RDONLY))==-1) + { + fprintf(stderr,"(%s) can't open %s raw file.\n",__FILE__,p_input_stream); + return(1); + } + while (read(s_file_dest,p_export_param->buffer,s_size)==s_size) + { + if (tc_export(TC_EXPORT_ENCODE,(void *)p_export_param,vob)==TC_EXPORT_ERROR) + { + if (s_elab_type==TC_VIDEO) + fprintf(stderr,"(%s) video export module error: encode failed\n",__FILE__); + else + fprintf(stderr,"(%s) audio export module error: encode failed\n",__FILE__); + return(1); + } + } + if (tc_export(TC_EXPORT_CLOSE,(void *)p_export_param,NULL)==TC_EXPORT_ERROR) + { + if (s_elab_type==TC_VIDEO) + fprintf(stderr,"(%s) video export module error: close failed\n",__FILE__); + else + fprintf(stderr,"(%s) audio export module error: close failed\n",__FILE__); + return(1); + } + if (tc_export(TC_EXPORT_STOP,(void *)p_export_param,NULL)==TC_EXPORT_ERROR) + { + if (s_elab_type==TC_VIDEO) + fprintf(stderr,"(%s) video export module error: stop failed\n",__FILE__); + else + fprintf(stderr,"(%s) audio export module error: stop failed\n",__FILE__); + return(1); + } + if(f_init_func("close-external",p_request_func)) /*need because most of external module don't release the resources*/ + { + fprintf(stderr,"(%s) restarting the dlopen \n",__FILE__); + return(1); + } + close(s_file_dest); + vob->divxmultipass=1; /*reset the pass*/ + return(0); +} + + + +pvm_res_func_t *f_export_func(int s_option,char *p_buffer,int s_size,int s_seq) +{ + static int s_cicle=0,s_serial=0; + static pvm_res_func_t s_result={0,0,PVM_MSG_WRKN,0,NULL}; + static transfer_t s_export_param; + int s_tmp,s_rc; + static char s_filename[2*MAX_BUF]; + static char s_file_int_multipass[2*MAX_BUF]; + static char s_filename_log[2*MAX_BUF]; + static char *p_suffix=NULL; + static int s_file_dest=-1,s_first_encode=0,s_encode_size=0; + static struct pvm_files_t *p_file_elab=NULL,*p_file_erase=NULL,*p_file_erase_tmp=NULL; + struct pvm_files_t *p_file_elab_tmp=NULL,*p_search=NULL; + struct stat s_f_stat; + FILE *p_file_src=NULL; + static pvm_config_env *p_pvm_conf=NULL; + pvm_config_filelist *p_my_filelist=NULL; + char *p_filetmp=NULL; + + if (p_suffix==NULL) + p_suffix=f_external_suffix(p_request_func,p_param1); /*function codec based*/ + s_result.s_msg_type=PVM_MSG_WRKN; /*always initialized to PVM_MSG_WRKN*/ + if (s_result.p_result==NULL) + { + s_result.s_dim_buffer=(s_size> 4*MAX_BUF)?s_size:4*MAX_BUF; + s_result.p_result=(char *)calloc(s_result.s_dim_buffer,1); + } + else if (s_size>s_result.s_dim_buffer) + { + s_result.p_result=(char *)realloc(s_result.p_result,s_size); + s_result.s_dim_buffer=s_size; + } + memset(s_result.p_result,'\0',s_result.s_dim_buffer); + switch(s_option) + { + case PVM_JOIN_OPT_INIT: + if (verbose & TC_DEBUG) + fprintf(stderr,"(%s) enter in PVM_JOIN_OPT_INIT %d\n",__FILE__,s_elab_type); + memset(s_filename,'\0',sizeof(s_filename)); + if (!s_list_only) + tc_snprintf(s_filename,sizeof(s_filename),"%s%s",p_out_file_name,p_suffix); + else + { + if (s_elab_type==TC_VIDEO) + tc_snprintf(s_filename,sizeof(s_filename),"%s-video.lst",p_out_file_name); + else if (s_elab_type==TC_AUDIO) + tc_snprintf(s_filename,sizeof(s_filename),"%s-audio.lst",p_out_file_name); + else + tc_snprintf(s_filename,sizeof(s_filename),"%s-system.lst",p_out_file_name); + } + s_result.s_msg_type=PVM_MSG_JOIN; /*don't need a receive msg*/ + s_result.s_ret_size=0; + s_result.s_rc=0; + if (verbose & TC_DEBUG) + fprintf(stderr,"(%s) exit from PVM_JOIN_OPT_INIT %d\n",__FILE__,s_elab_type); + break; + case PVM_JOIN_OPT_RUN: + if (verbose & TC_DEBUG) + fprintf(stderr,"(%s) enter in PVM_JOIN_OPT_RUN %d\n",__FILE__,s_elab_type); + if ((s_elab_type==TC_VIDEO)||(s_elab_type==TC_AUDIO)) /*video and audio file*/ + { + if ((s_file_dest=creat(s_filename,S_IWUSR|S_IRUSR|S_IRGRP|S_IROTH))==-1) + { + fprintf(stderr,"can't open %s output file.\n",p_out_file_name); + s_result.s_rc=1; + break; + } + if ((s_divxmultipass==1)||(s_list_only)) + { + memset(s_filename,'\0',sizeof(s_filename)); + if (s_elab_type==TC_VIDEO) + tc_snprintf(s_filename,sizeof(s_filename),"[AddVideoList]\nDestination = %s%s\nCodec = %s\n",p_out_file_name,p_suffix,p_request_func); + else + tc_snprintf(s_filename,sizeof(s_filename),"[AddAudioList]\nDestination = %s%s\nCodec = %s\n",p_out_file_name,p_suffix,p_request_func); + write(s_file_dest,s_filename,strlen(s_filename)); + } + s_rc=0; + for(p_file_elab_tmp=p_file_elab;p_file_elab_tmp!=NULL;p_file_elab_tmp=p_file_elab_tmp->p_next) + { + if (!s_list_only) + { + if (f_copy_remove_func("open",p_file_elab_tmp->s_file,s_file_dest)) + { + s_rc=1; + } + } + else + { + memset(s_filename,'\0',sizeof(s_filename)); + tc_snprintf(s_filename,sizeof(s_filename),"%s\n",p_file_elab_tmp->s_file); + write(s_file_dest,s_filename,strlen(s_filename)); + } + } + if (s_divxmultipass==1) + { + memset(s_filename,'\0',sizeof(s_filename)); + if (s_elab_type==TC_VIDEO) + tc_snprintf(s_filename,sizeof(s_filename),"[LogVideoList]\n"); + else + tc_snprintf(s_filename,sizeof(s_filename),"[LogAudioList]\n"); + write(s_file_dest,s_filename,strlen(s_filename)); + for(p_file_elab_tmp=p_file_elab;p_file_elab_tmp!=NULL;p_file_elab_tmp=p_file_elab_tmp->p_next) + { + memset(s_filename_log,'\0',sizeof(s_filename_log)); + tc_snprintf(s_filename_log,sizeof(s_filename_log),"%s\n",p_file_elab_tmp->s_file_log); + write(s_file_dest,s_filename_log,strlen(s_filename_log)); + } + } + if ((s_divxmultipass==1)||(s_list_only)) + { + memset(s_filename,'\0',sizeof(s_filename)); + if (s_elab_type==TC_VIDEO) + memcpy(s_filename,"[RemoveVideoList]\n",19); + else + memcpy(s_filename,"[RemoveAudioList]\n",19); + write(s_file_dest,s_filename,strlen(s_filename)); + } + else + (int)f_copy_remove_func("close",NULL,0); + for(p_file_erase_tmp=p_file_erase;p_file_erase_tmp!=NULL;p_file_erase_tmp=p_file_erase_tmp->p_next) + { + if (!s_list_only) + { + remove(p_file_erase_tmp->s_file); /*some files are already removed*/ + if (p_file_erase_tmp->s_file_log[0]!=0) + remove(p_file_erase_tmp->s_file_log); /*some files are already removed*/ + } + else + { + memset(s_filename,'\0',sizeof(s_filename)); + tc_snprintf(s_filename,sizeof(s_filename),"%s\n",p_file_erase_tmp->s_file); + write(s_file_dest,s_filename,strlen(s_filename)); + if ((s_divxmultipass==1)||(s_divxmultipass==2)) + { + if (p_file_erase_tmp->s_file_log!=NULL) + { + memset(s_filename_log,'\0',sizeof(s_filename_log)); + tc_snprintf(s_filename_log,sizeof(s_filename_log),"%s\n",p_file_erase_tmp->s_file_log); + write(s_file_dest,s_filename_log,strlen(s_filename_log)); + } + } + } + } + close(s_file_dest); + s_result.s_rc=s_rc; + } + else /*system*/ + { + memset(s_filename,'\0',sizeof(s_filename)); + tc_snprintf(s_filename,sizeof(s_filename),"%s-system.lst",p_out_file_name); + if ((p_pvm_conf=pvm_parser_open(s_filename,verbose,1))==NULL) + { + fprintf(stderr,"(%s) error checking %s\n",__FILE__,s_filename); + s_result.s_rc=1; + } + else + { + s_result.s_rc=f_system_merge(p_pvm_conf); + for (p_my_filelist=p_pvm_conf->p_rem_list;p_my_filelist!=NULL;p_my_filelist=p_my_filelist->p_next) + { + if (verbose & TC_DEBUG) + fprintf(stderr,"(%s) remove file %s\n",__FILE__,p_my_filelist->p_filename); + remove(p_my_filelist->p_filename); + } + pvm_parser_close(); + p_pvm_conf=NULL; + } + } + s_result.s_msg_type=PVM_MSG_WORK; /*need a receive*/ + s_result.s_ret_size=0; + if (verbose & TC_DEBUG) + fprintf(stderr,"(%s) exit from PVM_JOIN_OPT_RUN %d\n",__FILE__,s_elab_type); + break; + case PVM_MSG_MERG_PASTE: + if (verbose & TC_DEBUG) + fprintf(stderr,"(%s) enter in PVM_MSG_MERG_PASTE %d\n",__FILE__,s_elab_type); + if (s_cicle==0) + { + if ((s_file_dest=creat(s_filename,S_IWUSR|S_IRUSR|S_IRGRP|S_IROTH))==-1) + { + fprintf(stderr,"can't open %s output file.\n",p_out_file_name); + s_result.s_rc=1; + break; + } + memset(s_filename,'\0',sizeof(s_filename)); + tc_snprintf(s_filename,sizeof(s_filename),"[SystemList]\nDestination = %s%s\nCodec = %s\nMultiplexParams = %s\nBuildOnlyIntermediateFile = %d\n",p_out_file_name,p_suffix,p_request_func,p_merge_cmd,(s_elab_type==TC_VIDEO_AUDIO)?0:1); + write(s_file_dest,s_filename,strlen(s_filename)); + } + write(s_file_dest,p_buffer,s_size); + s_cicle++; + if (s_cicle==2) /*need to paste two files*/ + { + close(s_file_dest); + s_result.s_msg_type=PVM_MSG_ENDTASK_SYSTEM; /*need a receive*/ + } + else + s_result.s_msg_type=PVM_MSG_WRKN; /*need a receive*/ + s_result.s_ret_size=0; /*nothing to send*/ + s_result.s_rc=0; + if (verbose & TC_DEBUG) + fprintf(stderr,"(%s) exit from PVM_MSG_MERG_PASTE %d\n",__FILE__,s_elab_type); + break; + case PVM_JOIN_OPT_SENDFILE: + if (verbose & TC_DEBUG) + fprintf(stderr,"(%s) enter in PVM_JOIN_OPT_SENDFILE %d\n",__FILE__,s_elab_type); + memset(s_filename,'\0',sizeof(s_filename)); + if (s_elab_type==TC_VIDEO) + tc_snprintf(s_filename,sizeof(s_filename),"%s-video.lst",p_out_file_name); + else + tc_snprintf(s_filename,sizeof(s_filename),"%s-audio.lst",p_out_file_name); + p_file_src=fopen(s_filename,"r"); /*file exist!*/ + stat(s_filename,&s_f_stat); + if (s_f_stat.st_size>s_result.s_dim_buffer) + { + s_result.p_result=(char *)realloc(s_result.p_result,s_f_stat.st_size); + s_result.s_dim_buffer=s_f_stat.st_size; + } + memset(s_result.p_result,'\0',s_result.s_dim_buffer); + fread(s_result.p_result,1,s_f_stat.st_size,p_file_src); + fclose(p_file_src); + s_result.s_msg_type=PVM_MSG_MERG_SEND; + s_result.s_ret_size=s_f_stat.st_size; + s_result.s_rc=0; + if (verbose & TC_DEBUG) + fprintf(stderr,"(%s) exit from PVM_JOIN_OPT_SENDFILE %d\n",__FILE__,s_elab_type); + break; + case PVM_JOIN_OPT_ADD_REMOVE: + if (verbose & TC_DEBUG) + fprintf(stderr,"(%s) enter in PVM_JOIN_OPT_ADD_REMOVE %d\n",__FILE__,s_elab_type); + if (p_file_erase==NULL) + { + p_file_erase=(struct pvm_files_t *)calloc(sizeof(struct pvm_files_t),1); + p_file_erase_tmp=p_file_erase; + } + else + { + p_file_erase_tmp->p_next=(struct pvm_files_t *)calloc(sizeof(struct pvm_files_t),1); + p_file_erase_tmp=p_file_erase_tmp->p_next; + } + p_file_erase_tmp->s_seq=s_seq; + memcpy(p_file_erase_tmp->s_file,p_buffer,strlen(p_buffer)); + if (*p_suffix!='\0') + memcpy(p_file_erase_tmp->s_file+strlen(p_buffer),p_suffix,strlen(p_suffix)); + if ((s_divxmultipass==1)||(s_divxmultipass==2)) + memcpy(p_file_erase_tmp->s_file_log,p_buffer+strlen(p_buffer)+1,s_size-(strlen(p_buffer)+1)); + s_result.s_msg_type=PVM_MSG_JOIN; + s_result.s_ret_size=0; + s_result.s_rc=0; + if (verbose & TC_DEBUG) + fprintf(stderr,"(%s) exit from PVM_JOIN_OPT_ADD_REMOVE %d\n",__FILE__,s_elab_type); + break; + case PVM_JOIN_OPT_ADD_ELAB: + if (verbose & TC_DEBUG) + fprintf(stderr,"(%s) enter in PVM_JOIN_OPT_ADD_ELAB %d\n",__FILE__,s_elab_type); + /*need to order for seq number*/ + if (p_file_elab==NULL) + { + p_file_elab_tmp=(struct pvm_files_t *)calloc(sizeof(struct pvm_files_t),1); + p_file_elab=p_file_elab_tmp; + } + else + { + p_file_elab_tmp=p_file_elab; + for (p_search=p_file_elab;p_search!=NULL;p_search=p_search->p_next) + { + if (p_search->s_seq >s_seq) + break; + else + p_file_elab_tmp=p_search; + } + if (p_search==p_file_elab) + { + p_file_elab_tmp=(struct pvm_files_t *)calloc(sizeof(struct pvm_files_t),1); + p_file_elab_tmp->p_next=p_file_elab; + p_file_elab=p_file_elab_tmp; + } + else + { + p_file_elab_tmp->p_next=(struct pvm_files_t *)calloc(sizeof(struct pvm_files_t),1); + p_file_elab_tmp=p_file_elab_tmp->p_next; + p_file_elab_tmp->p_next=p_search; + } + } + p_file_elab_tmp->s_seq=s_seq; + memcpy(p_file_elab_tmp->s_file,p_buffer,strlen(p_buffer)); + if (*p_suffix!='\0') + memcpy(p_file_elab_tmp->s_file+strlen(p_buffer),p_suffix,strlen(p_suffix)); + if (s_divxmultipass==1) + memcpy(p_file_elab_tmp->s_file_log,p_buffer+strlen(p_buffer)+1,s_size-(strlen(p_buffer)+1)); + s_result.s_msg_type=PVM_MSG_JOIN; /*don't need a receive msg*/ + s_result.s_ret_size=0; + s_result.s_rc=0; + if (verbose & TC_DEBUG) + fprintf(stderr,"(%s) exit from PVM_JOIN_OPT_ADD_ELAB %d\n",__FILE__,s_elab_type); + break; + case PVM_EXP_OPT_INIT: + if (verbose & TC_DEBUG) + fprintf(stderr,"(%s) enter in PVM_EXP_OPT_INIT %d\n",__FILE__,s_elab_type); + if (s_size<sizeof(vob_t)) + { + fprintf(stderr,"invalid vob_t size\n"); + s_result.s_msg_type=PVM_MSG_CONF; + s_result.s_ret_size=0; + s_result.s_rc=1; + } + else + { + vob=f_vob_unpack("open",p_buffer,s_size); + vob->ex_v_fcc=p_param1; /*override the default*/ + vob->ex_a_fcc=p_param2; /*override the default*/ + vob->ex_profile_name=p_param3; /*override the default*/ + vob->audio_file_flag=1; /*force audio track on different file*/ + vob->verbose=verbose; + memset(s_filename_log,'\0',sizeof(s_filename_log)); + tc_snprintf(s_filename_log,sizeof(s_filename_log),"%s-log-%s-%d-%d%s",p_out_file_name,p_hostname,getpid(),s_serial,p_suffix); + if (s_internal_multipass) + { + vob->divxmultipass=1; /*force multipass*/ + } + if (vob->divxmultipass==2) /*check the config file for multipass*/ + { + if (p_pvm_conf==NULL) /*check the config file for multipass*/ + { + if (s_elab_type==TC_VIDEO) + tc_snprintf(s_filename,sizeof(s_filename),"%s-video.lst",p_out_file_name); + else + tc_snprintf(s_filename,sizeof(s_filename),"%s-audio.lst",p_out_file_name); + if ((p_pvm_conf=pvm_parser_open(s_filename,verbose,1))==NULL) /*retreive the right config file*/ + { + fprintf(stderr,"(%s) error checking %s\n",__FILE__,s_filename); + s_result.s_rc=1; + s_result.s_msg_type=PVM_MSG_CONF_JOIN; + break; + } + } + /*retreive the correct sequence of filename and log*/ + if((p_filetmp=f_filenamelist("loglist",p_pvm_conf,s_elab_type,s_seq))==NULL) /*return the right file name*/ + { + fprintf(stderr,"(%s) invalid sequence number %d\n",__FILE__,s_seq); + s_result.s_rc=1; + s_result.s_msg_type=PVM_MSG_CONF_JOIN; + break; + } + memset(s_filename_log,'\0',sizeof(s_filename_log)); + memcpy(s_filename_log,p_filetmp,strlen(p_filetmp)); + } + s_export_param.flag=verbose; /*verbose option*/ + if(!s_cicle) + { + s_cicle++; + fprintf(stderr,"(%s) on host %s pid %d recall ",__FILE__,p_hostname,getpid()); + memset(s_result.p_result,'\0',s_result.s_dim_buffer); + } + tc_export(TC_EXPORT_NAME,&s_export_param,NULL); /*check the capability*/ + if (s_elab_type==TC_VIDEO) + { + switch (vob->im_v_codec) + { + case CODEC_RGB: + s_tmp=(s_export_param.flag & TC_CAP_RGB); + break; + case CODEC_YUV: + s_tmp=(s_export_param.flag & TC_CAP_YUV); + break; + case CODEC_RAW: + case CODEC_RAW_YUV: + s_tmp=(s_export_param.flag & TC_CAP_VID); + break; + default: + s_tmp=0; + } + s_export_param.flag=TC_VIDEO; + if ((vob->divxmultipass==1)||(vob->divxmultipass==2)) + vob->divxlogfile=s_filename_log; + } + else /*audio codec*/ + { + switch (vob->im_a_codec) + { + case CODEC_PCM: + s_tmp=(s_export_param.flag & TC_CAP_PCM); + break; + case CODEC_AC3: + s_tmp=(s_export_param.flag & TC_CAP_AC3); + break; + case CODEC_RAW: + s_tmp=(s_export_param.flag & TC_CAP_AUD); + break; + default: + s_tmp=0; + } + s_export_param.flag=TC_AUDIO; + if ((vob->divxmultipass==1)||(vob->divxmultipass==2)) + vob->audiologfile=s_filename_log; + } + if (!s_tmp) + { + s_result.s_msg_type=PVM_MSG_CONF; + s_result.s_ret_size=0; + s_result.s_rc=1; /*capability unsupported*/ + fprintf(stderr,"(%s) unsupported codec %d",__FILE__,vob->im_v_codec); + break; + } + if (tc_export(TC_EXPORT_INIT,&s_export_param,vob)==TC_EXPORT_ERROR) /*check the capability*/ + { + if (s_elab_type==TC_VIDEO) + fprintf(stderr,"(%s) video export module error: init failed\n",__FILE__); + else + fprintf(stderr,"(%s) audio export module error: init failed\n",__FILE__); + s_result.s_msg_type=PVM_MSG_CONF; + s_result.s_ret_size=0; + s_result.s_rc=-1; + break; + } + s_result.s_msg_type=PVM_MSG_CONF; + s_result.s_ret_size=0; + s_result.s_rc=0; + } + if (verbose & TC_DEBUG) + fprintf(stderr,"(%s) exit from PVM_EXP_OPT_INIT %d\n",__FILE__,s_elab_type); + break; + case PVM_EXP_OPT_OPEN: + if (verbose & TC_DEBUG) + fprintf(stderr,"(%s) enter in PVM_EXP_OPT_OPEN %d\n",__FILE__,s_elab_type); + memset(s_filename,'\0',sizeof(s_filename)); + if (vob->divxmultipass==2) /*check the config file for multipass*/ + { + if (p_pvm_conf==NULL) /*check the config file for multipass*/ + { + if (s_elab_type==TC_VIDEO) + tc_snprintf(s_filename,sizeof(s_filename),"%s-video.lst",p_out_file_name); + else + tc_snprintf(s_filename,sizeof(s_filename),"%s-audio.lst",p_out_file_name); + if ((p_pvm_conf=pvm_parser_open(s_filename,verbose,1))==NULL) /*retreive the right config file*/ + { + fprintf(stderr,"(%s) error checking %s\n",__FILE__,s_filename); + s_result.s_rc=1; + s_result.s_msg_type=PVM_MSG_CONF_JOIN; + break; + } + } + memset(s_filename,'\0',sizeof(s_filename)); + /*retreive the correct sequence of filename and log*/ + if((p_filetmp=f_filenamelist("filelist",p_pvm_conf,s_elab_type,s_seq))==NULL) /*return the right file name*/ + { + fprintf(stderr,"(%s) invalid sequence number %d\n",__FILE__,s_seq); + s_result.s_rc=1; + s_result.s_msg_type=PVM_MSG_CONF_JOIN; + break; + } + if (*p_suffix!='\0') + memcpy(s_filename,p_filetmp,(strstr(p_filetmp,p_suffix)-p_filetmp)); + else + memcpy(s_filename,p_filetmp,strlen(p_filetmp)); + } + else + { + tc_snprintf(s_filename,sizeof(s_filename),"%s-%s-%d-%d",p_out_file_name,p_hostname,getpid(),s_serial); + s_serial++; + } + if (s_elab_type==TC_VIDEO) + { + vob->video_out_file=s_filename; + s_export_param.flag=TC_VIDEO; + } + else /*audio codec*/ + { + vob->video_out_file=s_filename; /*some export module require it e.g. export_mpeg*/ + vob->audio_out_file=s_filename; + s_export_param.flag=TC_AUDIO; + } + if (tc_export(TC_EXPORT_OPEN,&s_export_param,vob)==TC_EXPORT_ERROR) + { + if (s_elab_type==TC_VIDEO) + fprintf(stderr,"(%s) video export module error: open failed\n",__FILE__); + else + fprintf(stderr,"(%s) audio export module error: open failed\n",__FILE__); + s_result.s_msg_type=PVM_MSG_CONF; + s_result.s_ret_size=0; + s_result.s_rc=-1; + break; + } + memset(s_result.p_result,'\0',s_result.s_dim_buffer); + if ((vob->divxmultipass==3)||(vob->divxmultipass==0)||(s_internal_multipass)) + { + memcpy(s_result.p_result,s_filename,strlen(s_filename)); + s_result.s_ret_size=strlen(s_filename); /*need a number !0*/ + } + else + { + memcpy(s_result.p_result,s_filename,strlen(s_filename)); + memcpy(s_result.p_result+1+strlen(s_filename),s_filename_log,strlen(s_filename_log)); + s_result.s_ret_size=1+strlen(s_filename)+strlen(s_filename_log); /*need a number !0*/ + } + s_result.s_msg_type=PVM_MSG_CONF_JOIN; + s_result.s_rc=0; + if (verbose & TC_DEBUG) + fprintf(stderr,"(%s) exit from PVM_EXP_OPT_OPEN %d\n",__FILE__,s_elab_type); + break; + case PVM_EXP_OPT_ENCODE: + if (verbose & TC_DEBUG) + fprintf(stderr,"(%s) enter in PVM_EXP_OPT_ENCODE %d\n",__FILE__,s_elab_type); + memcpy(&s_export_param,p_buffer,sizeof(transfer_t)); + s_export_param.buffer=p_buffer+sizeof(transfer_t); /*pointer to the data*/ + if (s_elab_type==TC_VIDEO) + s_export_param.flag=TC_VIDEO; + else + s_export_param.flag=TC_AUDIO; + if (s_internal_multipass) + { + if (s_file_dest==-1) + { + memset(s_file_int_multipass,'\0',sizeof(s_file_int_multipass)); + if (s_elab_type==TC_VIDEO) + tc_snprintf(s_file_int_multipass,sizeof(s_file_int_multipass),"%s-video.raw",p_out_file_name); + else + tc_snprintf(s_file_int_multipass,sizeof(s_file_int_multipass),"%s-audio.raw",p_out_file_name); + if ((s_file_dest=creat(s_file_int_multipass,O_TRUNC|S_IWUSR|S_IRUSR|S_IRGRP|S_IROTH))==-1) + { + fprintf(stderr,"can't open %s output file.\n",s_file_int_multipass); + s_result.s_rc=1; + break; + } + s_encode_size=s_export_param.size; + } + write(s_file_dest,(char *)s_export_param.buffer,s_encode_size); + } + if (tc_export(TC_EXPORT_ENCODE,&s_export_param,vob)==TC_EXPORT_ERROR) + { + if (s_elab_type==TC_VIDEO) + fprintf(stderr,"(%s) video export module error: encode failed\n",__FILE__); + else + fprintf(stderr,"(%s) audio export module error: encode failed\n",__FILE__); + s_result.s_msg_type=PVM_MSG_WORK; + s_result.s_ret_size=0; + s_result.s_rc=-1; + break; + } + if (s_first_encode) + { + s_result.s_msg_type=PVM_MSG_WRKN; + s_result.s_ret_size=0; + } + else + { + s_first_encode=1; + memset(s_result.p_result,'\0',s_result.s_dim_buffer); + if (vob->divxmultipass!=1) + { + s_result.s_ret_size=strlen(s_filename); /*need a number !0*/ + memcpy(s_result.p_result,s_filename,s_result.s_ret_size); + } + else + { + memcpy(s_result.p_result,s_filename,strlen(s_filename)); + memcpy(s_result.p_result+1+strlen(s_filename),s_filename_log,strlen(s_filename_log)); + s_result.s_ret_size=1+strlen(s_filename)+strlen(s_filename_log); /*need a number !0*/ + } + s_result.s_msg_type=PVM_JOIN_OPT_ADD_ELAB; + } + s_result.s_rc=0; + if (verbose & TC_DEBUG) + fprintf(stderr,"(%s) exit from PVM_EXP_OPT_ENCODE %d\n",__FILE__,s_elab_type); + break; + case PVM_EXP_OPT_CLOSE: + if (verbose & TC_DEBUG) + fprintf(stderr,"(%s) enter in PVM_EXP_OPT_CLOSE %d\n",__FILE__,s_elab_type); + if (s_elab_type==TC_VIDEO) + s_export_param.flag=TC_VIDEO; + else + s_export_param.flag=TC_AUDIO; + if(f_init_func("status-external",p_request_func)) /*need because most of external module don't release the resources*/ + { + if (tc_export(TC_EXPORT_CLOSE,&s_export_param,NULL)==TC_EXPORT_ERROR) + { + if (s_elab_type==TC_VIDEO) + fprintf(stderr,"(%s) video export module error: close failed\n",__FILE__); + else + fprintf(stderr,"(%s) audio export module error: close failed\n",__FILE__); + s_result.s_msg_type=PVM_MSG_CONF; + s_result.s_ret_size=0; + s_result.s_rc=-1; + break; + } + } + s_result.s_msg_type=PVM_MSG_CONF; + s_result.s_ret_size=0; + s_result.s_rc=0; + if (verbose & TC_DEBUG) + fprintf(stderr,"(%s) exit from PVM_EXP_OPT_CLOSE %d\n",__FILE__,s_elab_type); + break; + case PVM_EXP_OPT_STOP: + if (verbose & TC_DEBUG) + fprintf(stderr,"(%s) enter in PVM_EXP_OPT_STOP %d\n",__FILE__,s_elab_type); + if (s_elab_type==TC_VIDEO) + s_export_param.flag=TC_VIDEO; + else + s_export_param.flag=TC_AUDIO; + if(f_init_func("status-external",p_request_func)) /*need because most of external module don't release the resources*/ + { + if (tc_export(TC_EXPORT_STOP,&s_export_param,NULL)==TC_EXPORT_ERROR) + { + if (s_elab_type==TC_VIDEO) + fprintf(stderr,"(%s) video export module error: stop failed\n",__FILE__); + else + fprintf(stderr,"(%s) audio export module error: stop failed\n",__FILE__); + s_result.s_msg_type=PVM_MSG_CONF; + s_result.s_ret_size=0; + s_result.s_rc=-1; + break; + } + } + s_result.s_msg_type=PVM_MSG_CONF; + s_result.s_ret_size=0; + s_result.s_rc=0; + if (verbose & TC_DEBUG) + fprintf(stderr,"(%s) exit from PVM_EXP_OPT_STOP %d\n",__FILE__,s_elab_type); + break; + case PVM_EXP_OPT_RESTART_ENCODE1: + if (verbose & TC_DEBUG) + fprintf(stderr,"(%s) enter in PVM_EXP_OPT_RESTART_ENCODE1 %d\n",__FILE__,s_elab_type); + if (s_elab_type==TC_VIDEO) + s_export_param.flag=TC_VIDEO; + else + s_export_param.flag=TC_AUDIO; + /*force the encoder to close the file and reopen a new one*/ + if (tc_export(TC_EXPORT_CLOSE,&s_export_param,NULL)==TC_EXPORT_ERROR) + { + if (s_elab_type==TC_VIDEO) + fprintf(stderr,"(%s) video export module error: close failed\n",__FILE__); + else + fprintf(stderr,"(%s) audio export module error: close failed\n",__FILE__); + s_result.s_msg_type=PVM_MSG_WORK; + s_result.s_ret_size=0; + s_result.s_rc=-1; + break; + } + if (tc_export(TC_EXPORT_STOP,&s_export_param,NULL)==TC_EXPORT_ERROR) + { + if (s_elab_type==TC_VIDEO) + fprintf(stderr,"(%s) video export module error: stop failed\n",__FILE__); + else + fprintf(stderr,"(%s) audio export module error: stop failed\n",__FILE__); + s_result.s_msg_type=PVM_MSG_WORK; + s_result.s_ret_size=0; + s_result.s_rc=-1; + break; + } + if(f_init_func("close-external",p_request_func)) /*need because most of external module don't release the resources*/ + { + fprintf(stderr,"(%s) restarting the dlopen \n",__FILE__); + s_result.s_rc=-1; + s_result.s_msg_type=PVM_MSG_WORK; + break; + } + if (s_internal_multipass) + { + if (verbose & TC_DEBUG) + fprintf(stderr,"(%s) enter in f_internal_multipass\n",__FILE__); + close(s_file_dest); + s_file_dest=-1; /*reset the file desc*/ + if(f_internal_multipass(vob,s_encode_size,s_elab_type,&s_export_param,s_file_int_multipass)) + { + s_result.s_msg_type=PVM_MSG_WORK; + s_result.s_ret_size=0; + s_result.s_rc=-1; + break; + } + remove(s_file_int_multipass); + remove(s_filename_log); /*remove the log file*/ + if (verbose & TC_DEBUG) + fprintf(stderr,"(%s) exit from f_internal_multipass\n",__FILE__); + } + s_result.s_rc=0; + s_result.s_ret_size=0; + if (s_elab_type==TC_VIDEO) + s_result.s_msg_type=PVM_MSG_ENDTASK_VIDEO; + else + s_result.s_msg_type=PVM_MSG_ENDTASK_AUDIO; + if (verbose & TC_DEBUG) + fprintf(stderr,"(%s) exit from PVM_EXP_OPT_RESTART_ENCODE1 %d\n",__FILE__,s_elab_type); + break; + case PVM_EXP_OPT_RESTART_ENCODE2: + if (verbose & TC_DEBUG) + fprintf(stderr,"(%s) enter in PVM_EXP_OPT_RESTART_ENCODE2 %d\n",__FILE__,s_elab_type); + if (s_elab_type==TC_VIDEO) + s_export_param.flag=TC_VIDEO; + else + s_export_param.flag=TC_AUDIO; + if (vob->divxmultipass==2) /*check the config file for multipass*/ + { + if (p_pvm_conf==NULL) /*check the config file for multipass*/ + { + if (s_elab_type==TC_VIDEO) + tc_snprintf(s_filename,sizeof(s_filename),"%s-video.lst",p_out_file_name); + else + tc_snprintf(s_filename,sizeof(s_filename),"%s-audio.lst",p_out_file_name); + if ((p_pvm_conf=pvm_parser_open(s_filename,verbose,1))==NULL) /*retreive the right config file*/ + { + fprintf(stderr,"(%s) error checking %s\n",__FILE__,s_filename); + s_result.s_rc=-1; + s_result.s_msg_type=PVM_MSG_WORK; + break; + } + } + memset(s_filename,'\0',sizeof(s_filename)); + /*retreive the correct sequence of filename and log*/ + if((p_filetmp=f_filenamelist("filelist",p_pvm_conf,s_elab_type,s_seq))==NULL) /*return the right file name*/ + { + fprintf(stderr,"(%s) invalid sequence number %d\n",__FILE__,s_seq); + s_result.s_rc=-1; + s_result.s_msg_type=PVM_MSG_WORK; + break; + } + if (*p_suffix!='\0') + memcpy(s_filename,p_filetmp,(strstr(p_filetmp,p_suffix)-p_filetmp)); + else + memcpy(s_filename,p_filetmp,strlen(p_filetmp)); + memset(s_filename_log,'\0',sizeof(s_filename_log)); + /*retreive the correct sequence of filename and log*/ + if((p_filetmp=f_filenamelist("loglist",p_pvm_conf,s_elab_type,s_seq))==NULL) /*return the right file name*/ + { + fprintf(stderr,"(%s) invalid sequence number %d\n",__FILE__,s_seq); + s_result.s_rc=-1; + s_result.s_msg_type=PVM_MSG_WORK; + break; + } + memcpy(s_filename_log,p_filetmp,strlen(p_filetmp)); + } + else + { + memset(s_filename,'\0',sizeof(s_filename)); + tc_snprintf(s_filename,sizeof(s_filename),"%s-%s-%d-%d",p_out_file_name,p_hostname,getpid(),s_serial); + if (vob->divxmultipass==1) + { + memset(s_filename_log,'\0',sizeof(s_filename_log)); + /*next logfile*/ + tc_snprintf(s_filename_log,sizeof(s_filename_log),"%s-log-%s-%d-%d%s",p_out_file_name,p_hostname,getpid(),s_serial,p_suffix); + } + s_serial++; + } + if (s_elab_type==TC_VIDEO) + { + vob->video_out_file=s_filename; + if ((vob->divxmultipass!=3)||(vob->divxmultipass!=0)) /*check the config file for multipass*/ + vob->divxlogfile=s_filename_log; + s_export_param.flag=TC_VIDEO; + } + else + { + vob->video_out_file=s_filename; /*some export module require it e.g. export_mpeg*/ + vob->audio_out_file=s_filename; + if ((vob->divxmultipass!=3)||(vob->divxmultipass!=0)) /*check the config file for multipass*/ + vob->audiologfile=s_filename_log; + s_export_param.flag=TC_AUDIO; + } + if(f_init_func("open-external",p_request_func)) /*need because most of external module don't release the resources*/ + { + fprintf(stderr,"(%s) restarting the dlopen \n",__FILE__); + s_result.s_rc=-1; + s_result.s_msg_type=PVM_MSG_WORK; + break; + } + s_export_param.flag=verbose; /*verbose option*/ + tc_export(TC_EXPORT_NAME,&s_export_param,NULL); /*check the capability*/ + if (s_elab_type==TC_VIDEO) + { + switch (vob->im_v_codec) + { + case CODEC_RGB: + s_tmp=(s_export_param.flag & TC_CAP_RGB); + break; + case CODEC_YUV: + s_tmp=(s_export_param.flag & TC_CAP_YUV); + break; + case CODEC_RAW: + case CODEC_RAW_YUV: + s_tmp=(s_export_param.flag & TC_CAP_VID); + break; + default: + s_tmp=0; + } + s_export_param.flag=TC_VIDEO; + } + else /*audio codec*/ + { + switch (vob->im_a_codec) + { + case CODEC_PCM: + s_tmp=(s_export_param.flag & TC_CAP_PCM); + break; + case CODEC_AC3: + s_tmp=(s_export_param.flag & TC_CAP_AC3); + break; + case CODEC_RAW: + s_tmp=(s_export_param.flag & TC_CAP_AUD); + break; + default: + s_tmp=0; + } + s_export_param.flag=TC_AUDIO; + } + if (!s_tmp) + { + s_result.s_msg_type=PVM_MSG_CONF; + s_result.s_ret_size=0; + s_result.s_rc=1; /*capability unsupported*/ + fprintf(stderr,"(%s) unsupported codec %d",__FILE__,vob->im_v_codec); + break; + } + if (tc_export(TC_EXPORT_INIT,&s_export_param,vob)==TC_EXPORT_ERROR) /*check the capability*/ + { + if (s_elab_type==TC_VIDEO) + fprintf(stderr,"(%s) video export module error: init failed\n",__FILE__); + else + fprintf(stderr,"(%s) audio export module error: init failed\n",__FILE__); + s_result.s_msg_type=PVM_MSG_WORK; + s_result.s_ret_size=0; + s_result.s_rc=-1; + break; + } + if (tc_export(TC_EXPORT_OPEN,&s_export_param,vob)==TC_EXPORT_ERROR) + { + if (s_elab_type==TC_VIDEO) + fprintf(stderr,"(%s) video export module error: open failed\n",__FILE__); + else + fprintf(stderr,"(%s) audio export module error: open failed\n",__FILE__); + s_result.s_msg_type=PVM_MSG_WORK; + s_result.s_ret_size=0; + s_result.s_rc=-1; + break; + } + /*finished to encode the range so the task is free: send a msg to the father and another to the merger*/ + memset(s_result.p_result,'\0',s_result.s_dim_buffer); + if ((vob->divxmultipass==3)||(vob->divxmultipass==0)||(s_internal_multipass)) /*check the config file for multipass*/ + { + memcpy(s_result.p_result,s_filename,strlen(s_filename)); + s_result.s_ret_size=strlen(s_filename); /*need a number !0*/ + } + else + { + memcpy(s_result.p_result,s_filename,strlen(s_filename)); + memcpy(s_result.p_result+1+strlen(s_filename),s_filename_log,strlen(s_filename_log)); + s_result.s_ret_size=1+strlen(s_filename)+strlen(s_filename_log); /*need a number !0*/ + } + s_result.s_msg_type=PVM_MSG_ADD_REM; + s_first_encode=0; + s_result.s_rc=0; + if (verbose & TC_DEBUG) + fprintf(stderr,"(%s) exit from PVM_EXP_OPT_RESTART_ENCODE2 %d\n",__FILE__,s_elab_type); + break; + default: + break; + } + return((pvm_res_func_t *)&s_result); +} + diff --git a/debian/transcode/transcode-1.1.7/pvm3/export_pvm_slave.h b/debian/transcode/transcode-1.1.7/pvm3/export_pvm_slave.h new file mode 100644 index 00000000..6ed829e5 --- /dev/null +++ b/debian/transcode/transcode-1.1.7/pvm3/export_pvm_slave.h @@ -0,0 +1,41 @@ +/* + * export_pvm_slave.h + * + * Copyright (C) Marzio Malanchini - July 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. + * + */ + + + +#ifndef _EXPORT_PVM_MPEG_H +#define _EXPORT_PVM_MPEG_H + +#define PVM_DL_FUNC 1 +#include <pvm_functions.h> +#include <pvm_parser.h> + +#define TC_VIDEO_AUDIO 0x01000000 +#define TC_MULTI_VIDEO_AUDIO 0x10000000 + +int f_init_func(char *p_option,char *p_mod); +pvm_res_func_t *f_export_func(int s_option,char *p_buffer,int s_size,int s_seq); +int f_copy_remove_func(char *p_option,char *p_file,int s_file_dest); +int f_system_merge(pvm_config_env *p_pvm_conf); +char *f_filenamelist(char *p_option,pvm_config_env *p_pvm_conf,int s_type,int s_seq); +#endif diff --git a/debian/transcode/transcode-1.1.7/pvm3/external_codec.c b/debian/transcode/transcode-1.1.7/pvm3/external_codec.c new file mode 100644 index 00000000..cc685399 --- /dev/null +++ b/debian/transcode/transcode-1.1.7/pvm3/external_codec.c @@ -0,0 +1,207 @@ +/* + * external_codec.c + * + * Copyright (C) Marzio Malanchini - August 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 "external_codec.h" + +#include <stdlib.h> + +#define MPEG2ENC_MP2ENC_PROG "mplex" +#define MPEG_MPEG_PROG "tcmplex" +#define AVI_AVI_PROG "avimerge" + + +static char *p_supported_modules[] = { + "null", + "mpeg2enc", + "mp2enc", + "mpeg", + "divx5", + "ffmpeg", + "xvid", + NULL + }; + +void f_help_codec (char *p_module) +{ + int s_cont; + + fprintf(stderr, "[%s] Supported Modules\n",p_module); + fprintf(stderr, "[%s] --------------------\n",p_module); + for(s_cont=0;p_supported_modules[s_cont]!=NULL;s_cont++) + { + if (s_cont%2) + fprintf(stderr, "\t%s\n",p_supported_modules[s_cont]); + else + fprintf(stderr, "[%s] %s",p_module,p_supported_modules[s_cont]); + } + if ((s_cont-1)%2) + fprintf(stderr, "[%s] --------------------\n",p_module); + else + fprintf(stderr, "\n[%s] --------------------\n",p_module); +} + +char *f_supported_system(pvm_config_codec *p_v_codec,pvm_config_codec *p_a_codec) +{ + static char *p_buffer="mpeg1audio"; + + if ((!strcasecmp(p_v_codec->p_codec, "mpeg2enc"))&&(!strcasecmp(p_a_codec->p_codec, "mp2enc"))) + return((char *)"mpeg2enc-mp2enc"); + else if ((!strcasecmp(p_v_codec->p_codec, "mpeg"))&&(!strcasecmp(p_a_codec->p_codec, "mpeg"))) + return((char *)"mpeg-mpeg"); + else if ((!strcasecmp(p_v_codec->p_codec, "ffmpeg"))&&(!strcasecmp(p_a_codec->p_codec, "ffmpeg"))&&((!strcasecmp(p_v_codec->p_par1, "mpeg1video")))) + { + p_a_codec->p_par1=p_buffer; /*this isn't defined but useful to known the type of the output stram*/ + return((char *)"mpeg-mpeg"); + } + else + return((char *)"avi-avi"); + return(NULL); +} + +int f_supported_export_module(char *p_codec) +{ + int s_cont; + + for(s_cont=0;p_supported_modules[s_cont]!=NULL;s_cont++) + { + if (!strcasecmp(p_codec,p_supported_modules[s_cont])) + { + return(1); + } + } + return(0); +} + +int f_multiplexer(char *p_codec,char *p_merge_cmd,char *p_video_filename,char *p_audio_filename,char *p_dest_file,int s_verbose) +{ + char s_buffer[2*MAX_BUF]; + + if(!strcasecmp(p_codec,"mpeg2enc-mp2enc")) + { + memset(s_buffer,'\0',sizeof(s_buffer)); + if (p_merge_cmd!=NULL) + tc_snprintf(s_buffer,sizeof(s_buffer),"%s %s -o %s %s %s",MPEG2ENC_MP2ENC_PROG,p_merge_cmd,p_dest_file,p_video_filename,p_audio_filename); + else + tc_snprintf(s_buffer,sizeof(s_buffer),"%s -o %s %s %s",MPEG2ENC_MP2ENC_PROG,p_dest_file,p_video_filename,p_audio_filename); + if(s_verbose & TC_DEBUG) + fprintf(stderr,"(%s) multiplex cmd: %s\n",__FILE__,s_buffer); + (int)system(s_buffer); + return(0); + } + else if(!strcasecmp(p_codec,"mpeg-mpeg")) + { + memset(s_buffer,'\0',sizeof(s_buffer)); + if (p_merge_cmd!=NULL) + tc_snprintf(s_buffer,sizeof(s_buffer),"%s %s -o %s -i %s -p %s",MPEG_MPEG_PROG,p_merge_cmd,p_dest_file,p_video_filename,p_audio_filename); + else + tc_snprintf(s_buffer,sizeof(s_buffer),"%s -o %s -i %s -p %s",MPEG_MPEG_PROG,p_dest_file,p_video_filename,p_audio_filename); + if(s_verbose & TC_DEBUG) + fprintf(stderr,"(%s) multiplex cmd: %s\n",__FILE__,s_buffer); + (int)system(s_buffer); + return(0); + } + else if(!strcasecmp(p_codec,"avi-avi")) + { + memset(s_buffer,'\0',sizeof(s_buffer)); + if (p_merge_cmd!=NULL) + tc_snprintf(s_buffer,sizeof(s_buffer),"%s %s -o %s -i %s -p %s",AVI_AVI_PROG,p_merge_cmd,p_dest_file,p_video_filename,p_audio_filename); + else + tc_snprintf(s_buffer,sizeof(s_buffer),"%s -o %s -i %s -p %s",AVI_AVI_PROG,p_dest_file,p_video_filename,p_audio_filename); + if(s_verbose & TC_DEBUG) + fprintf(stderr,"(%s) multiplex cmd: %s\n",__FILE__,s_buffer); + (int)system(s_buffer); + return(0); + } + else + return(1); +} + +char *f_external_suffix(char *p_codec,char *p_param) +{ + + static char *p_suffix[]={".m1v\0",".m2v\0",".mpa\0",".mpeg\0","\0",NULL}; + char s_var; + if (p_param!=NULL) + { + if(!strcasecmp(p_codec,"mp2enc")) + { + return(p_suffix[2]); + } + else if((!strcasecmp(p_codec,"mpeg2enc-mp2enc"))||(!strcasecmp(p_codec,"mpeg-mpeg"))) + { + return(p_suffix[3]); + } + else if((!strcasecmp(p_codec,"ffmpeg"))&&((!strcasecmp(p_param,"mpeg1video")))) + { + return(p_suffix[0]); + } + else if((!strcasecmp(p_codec,"ffmpeg"))&&((!strcasecmp(p_param,"mpeg1audio")))) + { + return(p_suffix[4]); + } + else if(!strcasecmp(p_codec,"mpeg2enc")) + { + s_var=p_param[0]; + if (p_param==NULL) /*det the suffix*/ + return(p_suffix[0]); + else if (strchr("1234568", tolower(s_var))==NULL) + return(p_suffix[0]); + else if (strchr("34568",tolower(s_var))!=NULL) + return(p_suffix[1]); + else + return(p_suffix[0]); + } + else if(!strcasecmp(p_codec,"mpeg")) + { + s_var=p_param[0]; + if (p_param==NULL) /*det the suffix*/ + return(p_suffix[0]); + else if (strchr("1bvs2d", tolower(s_var))==NULL) + return(p_suffix[0]); + else if (strchr("1bv",tolower(s_var))!=NULL) + return(p_suffix[0]); + else + return(p_suffix[1]); + } + } + else + { + if(!strcasecmp(p_codec,"mp2enc")) + { + return(p_suffix[2]); + } + else if(!strcasecmp(p_codec,"mpeg")) /*valid only for audio (no param)*/ + { + return(p_suffix[2]); + } + else if((!strcasecmp(p_codec,"mpeg2enc-mp2enc"))||(!strcasecmp(p_codec,"mpeg-mpeg"))) + { + return(p_suffix[3]); + } + else + return(p_suffix[4]); + } + return(p_suffix[4]); +} + diff --git a/debian/transcode/transcode-1.1.7/pvm3/external_codec.h b/debian/transcode/transcode-1.1.7/pvm3/external_codec.h new file mode 100644 index 00000000..a9a759cf --- /dev/null +++ b/debian/transcode/transcode-1.1.7/pvm3/external_codec.h @@ -0,0 +1,42 @@ + +/* + * external_codec.h + * + * Copyright (C) Marzio Malanchini - August 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. + * + */ + + + + +#ifndef _EXTERNAL_CODEC_H +#define _EXTERNAL_CODEC_H + +#include <stdio.h> +#include <ctype.h> +#include <string.h> +#include <pvm_parser.h> + +#define MAX_BUF 1024 +int f_multiplexer(char *p_codec,char *p_merge_cmd,char *p_video_filename,char *p_audio_filename,char *p_dest_file,int s_verbose); +char *f_external_suffix(char *p_codec,char *p_param); +int f_supported_export_module(char *p_codec); +char *f_supported_system(pvm_config_codec *p_v_codec,pvm_config_codec *p_a_codec); +void f_help_codec (char *p_module); +#endif diff --git a/debian/transcode/transcode-1.1.7/pvm3/pvm_functions.c b/debian/transcode/transcode-1.1.7/pvm3/pvm_functions.c new file mode 100644 index 00000000..b936428d --- /dev/null +++ b/debian/transcode/transcode-1.1.7/pvm3/pvm_functions.c @@ -0,0 +1,529 @@ +/* + * pvm_functions.c + * + * Copyright (C) Marzio Malanchini - July 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 <stdlib.h> +#include <limits.h> +#include <string.h> +#include <unistd.h> +#include <sys/types.h> +#include <pvm_functions.h> + +#define MAX_BUF 1024 + +int f_pvm_start_single_process(char *p_spawn_process,char **p_argv,char *p_where) +{ + int s_slave_tid; + + if (pvm_spawn(p_spawn_process,p_argv,PvmTaskHost,p_where,1,&s_slave_tid)<0) /* start up merger */ + { + pvm_perror(""); + return(-1); + } + return(s_slave_tid); +} + +void f_pvm_stop_single_process(int s_slave_tid) +{ + if (s_slave_tid >=0) + pvm_kill(s_slave_tid); +} + +static int f_pvm_send_all(int s_buff_size,char *p_buffer,int s_option,pvm_func_t *p_func,int s_type,int s_pos_tids) +{ + static int s_seq=-1; + + if (s_type!=-1) + { + s_seq=s_type-1; + return(0); + } + if (s_pos_tids>p_func->s_nproc) + { + return(-1); + } + if (p_func->p_slave_tids ==NULL) + return(-1); + if (s_seq+1==PVM_MSG_LAST_SEQ) + s_seq=0; + else + s_seq++; + + pvm_initsend(PvmDataDefault); + pvm_pkint(&s_seq,1,1); + pvm_pkint(&s_option,1,1); + pvm_pkint(&s_buff_size,1,1); + pvm_pkbyte(p_buffer,s_buff_size,1); + pvm_send(p_func->p_slave_tids[s_pos_tids],PVM_MSG_WORK); + return(s_seq); +} + +int f_pvm_set_send(int s_set_seq) +{ + return(f_pvm_send_all(0,NULL,0,NULL,s_set_seq,0)); +} + +int f_pvm_send(int s_buff_size,char *p_buffer,int s_option,int s_pos_tids,pvm_func_t *p_func) +{ + return(f_pvm_send_all(s_buff_size,p_buffer,s_option,p_func,-1,s_pos_tids)); +} + +static int f_pvm_multi_send_all(int s_buff_size,char *p_buffer,int s_option,pvm_func_t *p_func,int s_wait) +{ + static int s_seq=-1; + int s_rec_seq,s_rc; + + if (p_func->p_slave_tids ==NULL) + return(-1); + pvm_initsend(PvmDataDefault); + if (!s_wait) + { + s_rec_seq=-1; + pvm_pkint(&s_rec_seq,1,1); /*no seq number */ + } + else + { + s_seq++; + pvm_pkint(&s_seq,1,1); + } + pvm_pkint(&s_option,1,1); + pvm_pkint(&s_buff_size,1,1); + pvm_pkbyte(p_buffer,s_buff_size,1); + pvm_mcast(p_func->p_slave_tids,p_func->s_nproc,PVM_MSG_CONF); + if (s_wait) + { + for(;;) + { + pvm_recv(-1,PVM_MSG_RING); /*waiting the close of the token*/ + pvm_upkint(&s_rec_seq,1,1); /*send the response to number*/ + pvm_upkint(&s_rc,1,1); /*retrive the rc*/ + if (s_rec_seq==s_seq) /*if the seq number match return ok*/ + return(s_rc); + } + } + else + { + return(0); + } +} + +int f_pvm_multi_send_nw(int s_buff_size,char *p_buffer,int s_option,pvm_func_t *p_func) +{ + return(f_pvm_multi_send_all(s_buff_size,p_buffer,s_option,p_func,0)); +} + +int f_pvm_multi_send(int s_buff_size,char *p_buffer,int s_option,pvm_func_t *p_func) +{ + return(f_pvm_multi_send_all(s_buff_size,p_buffer,s_option,p_func,1)); +} + +static int f_pvm_nrecv_check(int *p_buff_size,char *p_buffer,int s_init_seq,int *s_rc) +{ + static int s_seq_rec=0; + int s_tmp,s_bs,s_rc_int; + + if (s_init_seq != -1) + { + s_seq_rec=s_init_seq; /*set the inital seq number*/ + *s_rc=0; + return(0); + } + if(pvm_nrecv(-1,s_seq_rec)!=0) + { + pvm_upkint(&s_tmp,1,1); /*decode the seq number of the message*/ + pvm_upkint(&s_rc_int,1,1); /*decode the function rc */ + *s_rc=s_rc_int; /*rc*/ + pvm_upkint(&s_bs,1,1); /*decode the size of the next message*/ + if (s_bs!=0) + pvm_upkbyte(p_buffer,s_bs,1); /*decode the received buffer*/ + *p_buff_size=s_bs; + s_seq_rec++; /*this is the response of my request*/ + return(s_tmp); /*return the seq number of the recv message*/ + } + *s_rc=0; + return(-1); +} + +int f_pvm_nrecv(int *p_buff_size,char *p_buffer,int *s_rc) +{ + return(f_pvm_nrecv_check(p_buff_size,p_buffer,-1,s_rc)); +} + +int f_pvm_set_nrecv(int s_seq) +{ + int s_rc; + return(f_pvm_nrecv_check(NULL,NULL,s_seq,&s_rc)); +} + +static int f_pvm_recv_check(int *p_buff_size,char *p_buffer,int s_init_seq,int *s_rc) +{ + static int s_seq_rec=0; + int s_tmp,s_bs,s_rc_int; + + if (s_init_seq != -1) + { + s_seq_rec=s_init_seq; /*set the inital seq number*/ + *s_rc=0; + return(0); + } + pvm_recv(-1,s_seq_rec); + pvm_upkint(&s_tmp,1,1); /*decode the seq number of the message*/ + pvm_upkint(&s_rc_int,1,1); /*decode the function rc */ + *s_rc=s_rc_int; /*rc*/ + pvm_upkint(&s_bs,1,1); /*decode the size of the next message*/ + if (s_bs!=0) + pvm_upkbyte(p_buffer,s_bs,1); /*decode the received buffer*/ + if (s_seq_rec==INT_MAX) + s_seq_rec=0; + else + s_seq_rec++; /*this is the response of my request*/ + *p_buff_size=s_bs; + return(s_tmp); /*return the seq number of the recv message*/ +} + +int f_pvm_recv(int *p_buff_size,char *p_buffer,int *s_rc) +{ + return(f_pvm_recv_check(p_buff_size,p_buffer,-1,s_rc)); +} + +int f_pvm_set_recv(int s_seq) +{ + int s_rc; + return(f_pvm_recv_check(NULL,NULL,s_seq,&s_rc)); +} + + +/* This function must be included in the spawn process: it initialize the skeduler */ +void f_pvm_skeduler(pvm_res_func_t *(*f_my_elab_func)(int,char *,int,int)) +{ + int s_father_tid,s_rec_seq,s_src_tid,s_msg_type,s_msg_size,s_bufid; + int s_size=0,s_option,s_rc,s_my_tid,*p_other_tids,s_num_tids,s_cont; + static int s_alloc_size=0,s_nfrxtask=1,s_join=-1; + static char *p_buffer=NULL; + pvm_res_func_t *p_result=NULL; + char s_hostname[MAX_BUF]; + static int s_seq_preinit=-1; + + s_father_tid=pvm_parent(); + s_my_tid=pvm_mytid(); + s_num_tids = pvm_siblings(&p_other_tids); /* determine the size of my sibling list */ + for(;;) + { + s_bufid=pvm_recv(-1,-1); /*waiting for a message*/ + pvm_bufinfo(s_bufid,&s_msg_size,&s_msg_type,&s_src_tid); /*retrive info about the received message*/ + /*accept only from father and from all the slave process to merger not from itself or from ring*/ + if ((s_src_tid==s_father_tid)||((s_src_tid!=s_my_tid)&&(s_msg_type==PVM_MSG_JOIN))) + { + pvm_upkint(&s_rec_seq,1,1); /*retrive the sequence number*/ + pvm_upkint(&s_option,1,1); /*retrive the option number*/ + pvm_upkint(&s_size,1,1); /*retrive the size*/ + if (s_alloc_size < s_size) /*check the size of the buffer*/ + { + p_buffer=(char *)realloc(p_buffer,s_size); /*allocate/reallocate a buffer */ + s_alloc_size=s_size; + } + memset(p_buffer,'\0',s_alloc_size); + if (s_size>0) + pvm_upkbyte(p_buffer,s_size,1); /*data packet*/ + if ((s_msg_type==PVM_MSG_CONF)&&(s_option==PVM_CHECK_VERSION)) /*check which the type of msg*/ + { + if (memcmp((char *)EXPORT_PVM_VERSION,p_buffer,strlen(EXPORT_PVM_VERSION)) !=0) + { + s_rc=1; + if((gethostname(s_hostname,sizeof(s_hostname)))!=0) + { + memset(s_hostname,'\0',sizeof(s_hostname)); + snprintf(s_hostname,sizeof(s_hostname),"localhost-%d\n",getpid()); + } + fprintf(stderr,"(%s) Invalid version: (%s) request (%s) on host %s\n",__FILE__,EXPORT_PVM_VERSION,p_buffer,s_hostname); + } + else + s_rc=0; + } + else if ((s_msg_type==PVM_MSG_CONF)&&(s_option==PVM_INIT_SKED)) /*check which the type of msg*/ + { + memcpy(&s_nfrxtask,p_buffer,s_size); + s_rc=0; + } + else if ((s_msg_type==PVM_MSG_CONF)&&(s_option==PVM_INIT_JOIN)) /*check which the type of msg*/ + { + memcpy(&s_join,p_buffer,s_size); + s_rc=0; + } + else if ((s_msg_type==PVM_MSG_WORK)&&(s_option==PVM_MERGER_INIT)) /*check which the type of msg*/ + { + memcpy(&s_join,p_buffer,s_size); + s_msg_type=PVM_MSG_WRKN; + s_rc=0; + } + else if ((s_msg_type==PVM_MSG_WORK)&&(s_option==PVM_EXP_OPT_PREINIT)) /*check the option of msg*/ + { + memcpy(&s_seq_preinit,p_buffer,s_size); + s_msg_type=PVM_MSG_WRKN; + s_rc=0; + } + else + { + if ((s_seq_preinit!=-1)&&((s_option==PVM_EXP_OPT_OPEN)||(s_option==PVM_EXP_OPT_INIT))) + p_result=(*f_my_elab_func)(s_option,p_buffer,s_size,s_seq_preinit); + else + p_result=(*f_my_elab_func)(s_option,p_buffer,s_size,s_rec_seq); + s_rc=p_result->s_rc; + if (p_result->s_msg_type != s_msg_type) + s_msg_type=p_result->s_msg_type; /*the type of msg can be change by the f_my_elab_func routine*/ + } + switch (s_msg_type) /*check which the type of msg*/ + { + case PVM_JOIN_OPT_ADD_ELAB: + if (s_join==-1) + { + fprintf(stderr,"(%s) Merger not yet started\n",__FILE__); + for (s_cont=0;s_cont< s_num_tids;s_cont++) /* determine the index of my task*/ + { + if (p_other_tids[s_cont]!=s_my_tid) + { + pvm_kill(p_other_tids[s_cont]); + } + } + pvm_kill(s_father_tid); + break; + } + pvm_initsend(PvmDataDefault); /*initialize the send*/ + pvm_pkint(&s_rec_seq,1,1); /*send packet sequence*/ + s_cont=PVM_JOIN_OPT_ADD_ELAB; /*add to remove list*/ + pvm_pkint(&s_cont,1,1); /*option data packet*/ + pvm_pkint(&(p_result->s_ret_size),1,1); /*data packet*/ + pvm_pkbyte(p_result->p_result,p_result->s_ret_size,1); /*data packet*/ + pvm_send(s_join,PVM_MSG_JOIN); /*send the packet to the merger process*/ + break; + case PVM_MSG_CONF_JOIN: + if (s_join==-1) + { + fprintf(stderr,"(%s) Merger not yet started\n",__FILE__); + for (s_cont=0;s_cont< s_num_tids;s_cont++) /* determine the index of my task*/ + { + if (p_other_tids[s_cont]!=s_my_tid) + { + pvm_kill(p_other_tids[s_cont]); + } + } + pvm_kill(s_father_tid); + break; + } + pvm_initsend(PvmDataDefault); /*initialize the send*/ + pvm_pkint(&s_rec_seq,1,1); /*send packet sequence*/ + s_cont=PVM_JOIN_OPT_ADD_REMOVE; /*add to remove list*/ + pvm_pkint(&s_cont,1,1); /*option data packet*/ + pvm_pkint(&(p_result->s_ret_size),1,1); /*data packet*/ + pvm_pkbyte(p_result->p_result,p_result->s_ret_size,1); /*data packet*/ + pvm_send(s_join,PVM_MSG_JOIN); /*send the packet to the merger process*/ + /*don't close the case need to send to the ring*/ + case PVM_MSG_CONF: + s_msg_type=PVM_MSG_RING; + if (s_rec_seq!=-1) + (int)f_ring(s_father_tid,&s_rec_seq,s_msg_type,s_rc); /*wait for all task elaboration*/ + break; + case PVM_MSG_WORK: + pvm_initsend(PvmDataDefault); /*initialize the send*/ + pvm_pkint(&s_rec_seq,1,1); /*send packet sequence*/ + pvm_pkint(&(p_result->s_rc),1,1); /*send the function rc*/ + pvm_pkint(&(p_result->s_ret_size),1,1); /*data packet*/ + pvm_pkbyte(p_result->p_result,p_result->s_ret_size,1); /*data packet*/ + pvm_send(s_father_tid,s_rec_seq); /*send the packet*/ + break; + case PVM_MSG_ENDTASK_SYSTEM: + pvm_initsend(PvmDataDefault); /*initialize the send*/ + s_cont=0; + pvm_pkint(&s_rec_seq,1,1); /*send packet sequence*/ + pvm_pkint(&(p_result->s_rc),1,1); /*send the function rc*/ + pvm_pkint(&s_cont,1,1); /*data packet*/ +// pvm_pkbyte(p_result->p_result,p_result->s_ret_size,1); /*not really used*/ + pvm_send(s_father_tid,PVM_MSG_ENDTASK_SYSTEM); /*send the packet*/ + break; + case PVM_MSG_ENDTASK_VIDEO: + case PVM_MSG_ENDTASK_AUDIO: + pvm_initsend(PvmDataDefault); /*initialize the send*/ + s_cont=0; + pvm_pkint(&s_rec_seq,1,1); /*send packet sequence*/ + pvm_pkint(&(p_result->s_rc),1,1); /*send the function rc*/ + pvm_pkint(&s_cont,1,1); /*data packet*/ +// pvm_pkbyte(p_result->p_result,p_result->s_ret_size,1); /*not really used*/ + if (s_msg_type==PVM_MSG_ENDTASK_VIDEO) + pvm_send(s_father_tid,PVM_MSG_ENDTASK_VIDEO); /*send the packet*/ + else + pvm_send(s_father_tid,PVM_MSG_ENDTASK_AUDIO); /*send the packet*/ + break; + case PVM_MSG_MERG_SEND: + case PVM_MSG_ADD_REM: + if (s_join==-1) + { + fprintf(stderr,"(%s) Merger not yet started\n",__FILE__); + for (s_cont=0;s_cont< s_num_tids;s_cont++) /* determine the index of my task*/ + { + if (p_other_tids[s_cont]!=s_my_tid) + { + pvm_kill(p_other_tids[s_cont]); + } + } + pvm_kill(s_father_tid); + break; + } + pvm_initsend(PvmDataDefault); /*initialize the send*/ + pvm_pkint(&s_rec_seq,1,1); /*send packet sequence*/ + if (s_msg_type==PVM_MSG_MERG_SEND) + s_cont=PVM_MSG_MERG_PASTE; /*add to remove list*/ + else + s_cont=PVM_JOIN_OPT_ADD_REMOVE; /*add to remove list*/ + pvm_pkint(&s_cont,1,1); /*option data packet*/ + pvm_pkint(&(p_result->s_ret_size),1,1); /*data packet*/ + pvm_pkbyte(p_result->p_result,p_result->s_ret_size,1); /*data packet*/ + pvm_send(s_join,PVM_MSG_JOIN); /*send the packet to the merger process*/ + break; + case PVM_MSG_WRKN: + case PVM_MSG_JOIN: + default: + break; + } + } + } +} + + +pvm_func_t *f_pvm_master_start_stop(char *p_option,char *p_spawn_process,char **p_argv,int s_nproc_host,int s_nproc_max,pvm_func_t *p_func) +{ + int s_master_tid=-1; /* my task id */ + static int s_num_call=0; /* my task id */ + int s_started_task,s_cont,s_num_hosts,s_num_arch; + struct pvmhostinfo *p_host; + + if (!strcasecmp(p_option, "close")) + { + if (p_func->p_slave_tids !=NULL) + for(s_cont=0;s_cont<p_func->s_nproc;s_cont++) + pvm_kill((p_func->p_slave_tids[s_cont])); /*terminate all slave process*/ + if (s_num_call==1) + pvm_exit(); /* remove the master task from pvm*/ + s_num_call--; + free(p_func->p_used_tid); + return(NULL); + } + else if (!strcasecmp(p_option, "open")) + { + memset((char *)p_func,'\0',sizeof(pvm_func_t)); + s_num_call++; /*number of recall*/ + p_func->s_nproc=0; + if((p_func->p_slave_tids=calloc(sizeof(int)*s_nproc_max,1)) == NULL) /*allocate the slave buffer*/ + { + fprintf(stderr,"(%s) error allocating memory\n",__FILE__); + return(NULL); + } + if (s_num_call==1) + s_master_tid = pvm_mytid(); /* register the task in pvm */ + + /* Get config and set number of slaves to start */ + pvm_config( &s_num_hosts, &s_num_arch, &p_host ); + p_func->s_nhosts = s_num_hosts; + p_func->s_nproc = s_num_hosts * s_nproc_host; + if(p_func->s_nproc > s_nproc_max) + p_func->s_nproc = s_nproc_max; + + p_func->p_used_tid=(int *)malloc(sizeof(int)*(p_func->s_nproc)); /*allocate the buffer for the serial number of tid*/ + + pvm_setopt(PvmShowTids,0); + pvm_catchout(stderr); + + if ((s_started_task=pvm_spawn(p_spawn_process,p_argv,PvmTaskDefault,"",p_func->s_nproc,p_func->p_slave_tids))<0) /* start up all slave tasks */ + { + pvm_perror(""); + return(NULL); + } + else if (s_started_task < p_func->s_nproc) + { + for(s_cont=0;s_cont<p_func->s_nproc;s_cont++) + pvm_kill((p_func->p_slave_tids[s_cont])); /*terminate all slave process*/ + pvm_exit(); /* remove the master task from pvm*/ + return(NULL); + } + return(p_func); + } + else + { + fprintf(stderr,"(%s) invalid command \n",__FILE__); + return(NULL); + } +} + +int f_ring(int s_father_tid,int *s_rec_seq,int s_msg_type,int s_rc) +{ + int s_mytid; /* my task id */ + int *p_other_tids; /* array of task ids */ + int s_my_proc_id=0; /* my process number */ + int s_cont; + int s_num_tids; + int s_src_tid,s_dst_tid,s_rc_prev; + + s_mytid = pvm_mytid(); /*retrive tid*/ + s_num_tids = pvm_siblings(&p_other_tids); /* determine the size of my sibling list */ + for (s_cont=0;s_cont< s_num_tids;s_cont++) /* determine the index of my task*/ + { + if (p_other_tids[s_cont]==s_mytid) + { + s_my_proc_id=s_cont; + break; + } + } + if (s_my_proc_id==0) + s_src_tid=p_other_tids[s_num_tids-1]; /* if i'm the task 0 i need to wait the wake up of the task n. s_num_tids-1 */ + else + s_src_tid=p_other_tids[s_my_proc_id-1]; /* the other cases */ + + if (s_my_proc_id==s_num_tids-1) + s_dst_tid=p_other_tids[0]; /* if i'm the last task i need to wait the wake up of task n. 0 */ + else + s_dst_tid=p_other_tids[s_my_proc_id+1]; /* the other cases */ + + if(s_my_proc_id==0) + { + pvm_initsend(PvmDataDefault); /*initialize the send*/ + pvm_pkint(&s_rc,1,1); /*send the rc*/ + pvm_send(s_dst_tid,PVM_MSG_RING); /*send to the next process*/ + pvm_recv(s_src_tid,PVM_MSG_RING); /*waiting the close of the token*/ + pvm_upkint(&s_rc_prev,1,1); /*receive the prev rc*/ + pvm_initsend(PvmDataDefault); /*initialize the send to the main process*/ + pvm_pkint(s_rec_seq,1,1); /*send the response to number*/ + pvm_pkint(&s_rc_prev,1,1); /*send the rc*/ + pvm_send(s_father_tid,s_msg_type); /*send the ok to the mcast process*/ + return(0); + } + pvm_recv(s_src_tid,PVM_MSG_RING); /*waiting for the token*/ + pvm_upkint(&s_rc_prev,1,1); /*receive the prev rc*/ + if (s_rc_prev) + s_rc=s_rc_prev; /*send the prev error */ + pvm_initsend(PvmDataDefault); /*initialize the send*/ + pvm_pkint(&s_rc,1,1); /*send the rc*/ + pvm_send(s_dst_tid,PVM_MSG_RING); /*send to the next process*/ + return(0); +} diff --git a/debian/transcode/transcode-1.1.7/pvm3/pvm_functions.h b/debian/transcode/transcode-1.1.7/pvm3/pvm_functions.h new file mode 100644 index 00000000..bdf3e809 --- /dev/null +++ b/debian/transcode/transcode-1.1.7/pvm3/pvm_functions.h @@ -0,0 +1,125 @@ +/* + * pvm_functions.h + * + * Copyright (C) Marzio Malanchini - July 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. + * + */ + +#ifndef _PVM_FUNCTIONS_H +#define _PVM_FUNCTIONS_H + +#include <stdio.h> +#include <pvm3.h> +#include <pvm_version.h> + + +typedef struct _pvm_res_func_t { + int s_rc; + int s_ret_size; + int s_msg_type; + int s_dim_buffer; + char *p_result; + } pvm_res_func_t; + + +typedef struct _pvm_func_t { + int s_nproc; + int s_nhosts; + int s_current_tid; + int *p_slave_tids; + int *p_used_tid; + } pvm_func_t; + +#define PVM_EXP_OPT_INIT 0x00000000 +#define PVM_EXP_OPT_OPEN 0x00000001 +#define PVM_EXP_OPT_ENCODE 0x00000002 +#define PVM_EXP_OPT_CLOSE 0x00000003 +#define PVM_EXP_OPT_STOP 0x00000004 +#define PVM_EXP_OPT_RESTART_ENCODE1 0x00000005 +#define PVM_JOIN_OPT_RUN 0x00000006 +#define PVM_JOIN_OPT_ADD_ELAB 0x00000007 +#define PVM_JOIN_OPT_ADD_REMOVE 0x00000008 +#define PVM_JOIN_OPT_INIT 0x00000009 +#define PVM_INIT_SKED 0x0000000A +#define PVM_INIT_JOIN 0x0000000B +#define PVM_CHECK_VERSION 0x0000000C +#define PVM_JOIN_OPT_SENDFILE 0x0000000D +#define PVM_MERGER_INIT 0x0000000E +#define PVM_EXP_OPT_PREINIT 0x0000000F +#define PVM_EXP_OPT_RESTART_ENCODE2 0x00000010 + +#define PVM_MSG_WORK 0x00000020 +#define PVM_MSG_RING 0x00000021 +#define PVM_MSG_CONF 0x00000022 +#define PVM_MSG_WRKN 0x00000023 +#define PVM_MSG_JOIN 0x00000024 +#define PVM_MSG_CONF_JOIN 0x00000025 +#define PVM_MSG_MERG_SEND 0x00000026 +#define PVM_MSG_MERG_PASTE 0x00000027 +#define PVM_MSG_ADD_REM 0x00000028 +#define PVM_MSG_ENDTASK_SYSTEM INT_MAX-2 +#define PVM_MSG_ENDTASK_VIDEO INT_MAX-1 +#define PVM_MSG_ENDTASK_AUDIO INT_MAX +#define PVM_MSG_LAST_SEQ PVM_MSG_ENDTASK_SYSTEM + +#ifdef PVM_DL_FUNC + +/*public function*/ +pvm_func_t * (*f_pvm_master_start_stop)(char *p_option,char *p_spawn_process,char **p_argv,int s_nproc_host,int s_nproc_max,pvm_func_t *p_func); +void (*f_pvm_skeduler)(pvm_res_func_t *(*f_my_elab_func)(int,char *,int,int)); +int (*f_pvm_send)(int s_buff_size,char *p_buffer,int s_option,int s_pos_tids,pvm_func_t *p_func); +int (*f_pvm_set_send)(int s_set_seq); +int (*f_pvm_multi_send)(int s_buff_size,char *p_buffer,int s_option,pvm_func_t *p_func); +int (*f_pvm_multi_send_nw)(int s_buff_size,char *p_buffer,int s_option,pvm_func_t *p_func); +int (*f_pvm_nrecv)(int *s_buff_size,char *p_buffer,int *s_rc); +int (*f_pvm_recv)(int *s_buff_size,char *p_buffer,int *s_rc); +int (*f_pvm_set_nrecv)(int s_seq); +int (*f_pvm_set_recv)(int s_seq); +int (*f_pvm_start_single_process)(char *p_spawn_process,char **p_argv,char *p_where); +void (*f_pvm_stop_single_process)(int p_slave_tid); +#else + +/*private function*/ + +/* f_pvm_master_start_stop: + s_type: 1 start 0 end + p_spawn_process: process to spawn + s_nproc_host: number of process per host + s_nproc_max: max number of process +*/ +pvm_func_t *f_pvm_master_start_stop(char *p_option,char *p_spawn_process,char **p_argv,int s_nproc_host,int s_nproc_max,pvm_func_t *p_func); +/* the skeduler require a function to elab the input data*/ +void f_pvm_skeduler(pvm_res_func_t *(*f_my_elab_func)(int,char *,int,int)); +int f_pvm_send(int s_buff_size,char *p_buffer,int s_option,int s_pos_tids,pvm_func_t *p_func); +int f_pvm_set_send(int s_set_seq); +int f_pvm_multi_send(int s_buff_size,char *p_buffer,int s_option,pvm_func_t *p_func);/*broadcast the info and wait for the completition of all the task*/ +int f_pvm_multi_send_nw(int s_buff_size,char *p_buffer,int s_option,pvm_func_t *p_func);/*broadcast the info*/ +/* If you start with a non blocking receive you must continue with the save api or set the seq number with the set api*/ +int f_pvm_nrecv(int *s_buff_size,char *p_buffer,int *s_rc); +int f_pvm_recv(int *s_buff_size,char *p_buffer,int *s_rc); +int f_pvm_set_nrecv(int s_seq); +int f_pvm_set_recv(int s_seq); +int f_ring(int s_father_tid,int *s_rec_seq,int s_msg_type,int s_rc); +int f_pvm_start_single_process(char *p_spawn_process,char **p_argv,char *p_where); +void f_pvm_stop_single_process(int p_slave_tid); + + +#endif + +#endif diff --git a/debian/transcode/transcode-1.1.7/pvm3/pvm_interface.c b/debian/transcode/transcode-1.1.7/pvm3/pvm_interface.c new file mode 100644 index 00000000..2decbe1d --- /dev/null +++ b/debian/transcode/transcode-1.1.7/pvm3/pvm_interface.c @@ -0,0 +1,158 @@ +/* + * pvm_interface.c + * + * Copyright (C) Marzio Malanchini - July 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 <unistd.h> +#include <stdlib.h> +#include <string.h> + + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef HAVE_DLFCN_H +#include <dlfcn.h> +#else +# ifdef OS_DARWIN +# include "libdldarwin/dlfcn.h" +# endif +#endif + +/* + * WHY we need to dlopen() this?! Why standard linkage isn't enough? + * Moreover: this shared module is used in just _one_ plaece (tcpvmexportd) + * and it is _always_ used, so I don't really see the point to make it + * a shared object. What am I missing? -- FR + */ + + +#include <pvm_interface.h> + +#define MAX_BUF 1024 + +void *f_init_pvm_func(char *p_option,void *p_ret_handle) +{ + const char *p_error; + char s_module[MAX_BUF]; + void *p_handle; + + + if(!strcasecmp(p_option,"open")) + { + snprintf(s_module, sizeof(s_module), "%s/%s", MOD_PATH, M_LOAD_LIB); + p_handle=dlopen(s_module, RTLD_GLOBAL|RTLD_LAZY); + if (!p_handle) + { + fputs (dlerror(), stderr); + return(NULL); + } + f_pvm_start_single_process = dlsym(p_handle, "f_pvm_start_single_process"); + if ((p_error = dlerror()) != NULL) + { + fputs(p_error, stderr); + return(NULL); + } + f_pvm_stop_single_process = dlsym(p_handle, "f_pvm_stop_single_process"); + if ((p_error = dlerror()) != NULL) + { + fputs(p_error, stderr); + return(NULL); + } + f_pvm_master_start_stop = dlsym(p_handle, "f_pvm_master_start_stop"); + if ((p_error = dlerror()) != NULL) + { + fputs(p_error, stderr); + return(NULL); + } + f_pvm_set_send = dlsym(p_handle, "f_pvm_set_send"); + if ((p_error = dlerror()) != NULL) + { + fputs(p_error, stderr); + return(NULL); + } + f_pvm_send = dlsym(p_handle, "f_pvm_send"); + if ((p_error = dlerror()) != NULL) + { + fputs(p_error, stderr); + return(NULL); + } + f_pvm_multi_send_nw = dlsym(p_handle, "f_pvm_multi_send_nw"); + if ((p_error = dlerror()) != NULL) + { + fputs(p_error, stderr); + return(NULL); + } + f_pvm_multi_send = dlsym(p_handle, "f_pvm_multi_send"); + if ((p_error = dlerror()) != NULL) + { + fputs(p_error, stderr); + return(NULL); + } + f_pvm_nrecv = dlsym(p_handle, "f_pvm_nrecv"); + if ((p_error = dlerror()) != NULL) + { + fputs(p_error, stderr); + return(NULL); + } + f_pvm_recv = dlsym(p_handle, "f_pvm_recv"); + if ((p_error = dlerror()) != NULL) + { + fputs(p_error, stderr); + return(NULL); + } + f_pvm_set_recv = dlsym(p_handle, "f_pvm_set_recv"); + if ((p_error = dlerror()) != NULL) + { + fputs(p_error, stderr); + return(NULL); + } + f_pvm_set_nrecv = dlsym(p_handle, "f_pvm_set_nrecv"); + if ((p_error = dlerror()) != NULL) + { + fputs(p_error, stderr); + return(NULL); + } + f_pvm_skeduler = dlsym(p_handle, "f_pvm_skeduler"); + if ((p_error = dlerror()) != NULL) + { + fputs(p_error, stderr); + return(NULL); + } + return(p_handle); + } + else if(!strcasecmp(p_option,"close")) + { + if (p_ret_handle!=NULL) + dlclose(p_ret_handle); + return(NULL); + } + else + { + fprintf(stderr,"(%s) invalid command \"%s\"\n",__FILE__,p_option); + return(NULL); + } +} diff --git a/debian/transcode/transcode-1.1.7/pvm3/pvm_interface.h b/debian/transcode/transcode-1.1.7/pvm3/pvm_interface.h new file mode 100644 index 00000000..41e9bef1 --- /dev/null +++ b/debian/transcode/transcode-1.1.7/pvm3/pvm_interface.h @@ -0,0 +1,47 @@ +/* + * pvm_interface.h + * + * Copyright (C) Marzio Malanchini - August 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. + * + */ + +#ifndef _PVM_INTERFACE_H +#define _PVM_INTERFACE_H + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef HAVE_DLFCN_H +#include <dlfcn.h> +#else +# ifdef OS_DARWIN +# include "libdldarwin/dlfcn.h" +# endif +#endif + +#include <pvm_version.h> + +#define PVM_DL_FUNC 1 +#include <pvm_functions.h> + +/* WHY we need to dlopen() this?! Why standard linkage isn't enough? -- FR */ +void *f_init_pvm_func(char *p_option,void *p_ret_handle); + +#endif diff --git a/debian/transcode/transcode-1.1.7/pvm3/pvm_parser.c b/debian/transcode/transcode-1.1.7/pvm3/pvm_parser.c new file mode 100644 index 00000000..479bf105 --- /dev/null +++ b/debian/transcode/transcode-1.1.7/pvm3/pvm_parser.c @@ -0,0 +1,607 @@ +/* + * pvm_parser.c + * + * Copyright (C) Malanchini Marzio - August 2003 + * Updates and port to new libtc configuration file parser: + * (C) 2007 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, 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. + * + */ + +/* + * OK, I must say that I'm not very proud of my work done here. + * I think I'll must improve it soon. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "libtc/libtc.h" +#include "libtc/tclist.h" +#include "libtc/cfgfile.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <pvm_parser.h> +#include <pvm_version.h> + + +/*************************************************************************/ +/* helpers */ + +#define LOCALHOST "." +/* XXX ?! sic -- Fromani */ + +static char *pvm_hostname(char *candidate) +{ + if (candidate) { + tc_strstrip(candidate); + + if (strlen(candidate) > 0) { // XXX enlarge check value + return candidate; + } + } + return LOCALHOST; +} + +/* commodity */ +typedef char PVMString[TC_BUF_MIN]; + +typedef struct pvmnodedata_ PVMNodeData; +struct pvmnodedata_ { + PVMString hostname; + int enabled; /* flag */ + int maxprocs; +}; + +/*************************************************************************/ +/* main data structure */ + +static pvm_config_env s_pvm_conf; + +/*************************************************************************/ +/* forward declarations of dispatchers */ + +static pvm_config_filelist *dispatch_list(TCList *src, int type, + char *codec, char *destination, + pvm_config_filelist **ret); + +static int dispatch_node(int id, PVMNodeData *data, + pvm_config_env *env); + +static int dispatch_null(int id, pvm_config_env *env); +static int dispatch_merger(int id, pvm_config_env *env); +static int dispatch_modules(int id, pvm_config_env *env); +static int dispatch_syslist(int id, pvm_config_env *env); + + +/*************************************************************************/ +/* + * since configuration uses a lot of strings, we need a lot of temporary + * buffers to store them + */ +/* Nodes */ +static int nodes_num = 1; /* this is pretty ugly, isn't it? */ +static PVMNodeData nodes_data[PVM_MAX_NODES]; +/* SystemMerger */ +static PVMString systemmerger_hostname; +static PVMString systemmerger_mplexparams; +/* AudioMerger */ +static PVMString audiomerger_hostname; +/* VideoMerger */ +static PVMString videomerger_hostname; +/* ExportAudioModule */ +static PVMString exportaudiomod_codec; +static PVMString exportaudiomod_params[PVM_MAX_CODEC_PARAMS]; +/* ExportVideoModule */ +static PVMString exportvideomod_codec; +static PVMString exportvideomod_params[PVM_MAX_CODEC_PARAMS]; +/* SystemList */ +static PVMString systemlist_codec; +static PVMString systemlist_destination; +static PVMString systemlist_mplexparams; +/* AddAudio */ +static PVMString addaudio_codec; +static PVMString addaudio_destination; +/* AddVideo */ +static PVMString addvideo_codec; +static PVMString addvideo_destination; + +/*************************************************************************/ + +#define NODEINIT(ID) \ + { { "Hostname", (nodes_data[ID].hostname), TCCONF_TYPE_STRING, 0, 0, 0 }, \ + { "NumProcMax", &(nodes_data[ID].maxprocs), TCCONF_TYPE_INT, \ + 0, 1, PVM_MAX_NODE_PROCS }, \ + { "Enabled", &(nodes_data[ID].enabled), TCCONF_TYPE_FLAG, 0, 0, 1 }, \ + { NULL, NULL, 0, 0, 0, 0, } } + +static TCConfigEntry node_conf[PVM_MAX_NODES][4] = { + NODEINIT(0), + NODEINIT(1), + NODEINIT(2), + NODEINIT(3), + NODEINIT(4), + NODEINIT(5), + NODEINIT(6), + NODEINIT(7), +}; +#undef NODEINIT +static TCConfigEntry pvmhostcaps_conf[] = { + { "NumProcMaxForHost", &(s_pvm_conf.s_nproc), + TCCONF_TYPE_INT, 0, 1, PVM_NUM_NODE_PROCS }, + { "MaxProcForCluster", &(s_pvm_conf.s_max_proc), + TCCONF_TYPE_INT, 0, 1, PVM_MAX_CLUSTER_PROCS }, + { "NumElabFrameForTask", &(s_pvm_conf.s_num_frame_task), + TCCONF_TYPE_INT, 0, 1, PVM_NUM_TASK_FRAMES }, + { "InternalMultipass", &(s_pvm_conf.s_internal_multipass), + TCCONF_TYPE_FLAG, 0, 0, 1 }, + { "Nodes", &nodes_num, TCCONF_TYPE_INT, 0, 1, PVM_MAX_NODES }, + { NULL, NULL, 0, 0, 0, 0, }, +}; +static TCConfigEntry videomerger_conf[] = { + { "Hostname", videomerger_hostname, TCCONF_TYPE_STRING, 0, 0, 0 }, + { "BuildOnlyBatchMergeList", + &(s_pvm_conf.s_video_merger.s_build_only_list), + TCCONF_TYPE_FLAG, 0, 0, 1 }, + { NULL, NULL, 0, 0, 0, 0, }, +}; +static TCConfigEntry audiomerger_conf[] = { + { "Hostname", audiomerger_hostname, TCCONF_TYPE_STRING, 0, 0, 0 }, + { "BuildOnlyBatchMergeList", + &(s_pvm_conf.s_audio_merger.s_build_only_list), + TCCONF_TYPE_FLAG, 0, 0, 1 }, + { NULL, NULL, 0, 0, 0, 0, }, +}; +static TCConfigEntry systemmerger_conf[] = { + { "Hostname", systemmerger_hostname, TCCONF_TYPE_STRING, 0, 0, 0 }, + { "BuildOnlyBatchMergeList", + &(s_pvm_conf.s_system_merger.s_build_only_list), + TCCONF_TYPE_FLAG, 0, 0, 1 }, + { "MultiplexParams", systemmerger_mplexparams, + TCCONF_TYPE_STRING, 0, 0, }, + { NULL, NULL, 0, 0, 0, 0, }, +}; +static TCConfigEntry exportaudiomod_conf[] = { + { "Codec", exportaudiomod_codec, TCCONF_TYPE_STRING, 0, 0, 0 }, + { "Param1", exportaudiomod_params[0], TCCONF_TYPE_STRING, 0, 0, 0 }, + { "Param2", exportaudiomod_params[1], TCCONF_TYPE_STRING, 0, 0, 0 }, + { "Param3", exportaudiomod_params[2], TCCONF_TYPE_STRING, 0, 0, 0 }, + { NULL, NULL, 0, 0, 0, 0, }, +}; +static TCConfigEntry exportvideomod_conf[] = { + { "Codec", exportvideomod_codec, TCCONF_TYPE_STRING, 0, 0, 0 }, + { "Param1", exportvideomod_params[0], TCCONF_TYPE_STRING, 0, 0, 0 }, + { "Param2", exportvideomod_params[1], TCCONF_TYPE_STRING, 0, 0, 0 }, + { "Param3", exportvideomod_params[2], TCCONF_TYPE_STRING, 0, 0, 0 }, + { NULL, NULL, 0, 0, 0, 0, }, +}; +static TCConfigEntry systemlist_conf[] = { + { "Destination", systemlist_destination, TCCONF_TYPE_STRING, 0, 0, 0 }, + { "Codec", systemlist_codec, TCCONF_TYPE_STRING, 0, 0, 0 }, + { "BuildOnlyBatchMergeList", + &(s_pvm_conf.s_build_intermed_file), + TCCONF_TYPE_FLAG, 0, 0, 1 }, + { "MultiplexParams", systemlist_mplexparams, + TCCONF_TYPE_STRING, 0, 0, }, + { NULL, NULL, 0, 0, 0, 0, }, +}; +static TCConfigEntry addaudio_conf[] = { + { "Destination", addaudio_destination, TCCONF_TYPE_STRING, 0, 0, 0 }, + { "Codec", addaudio_codec, TCCONF_TYPE_STRING, 0, 0, 0 }, + { NULL, NULL, 0, 0, 0, 0, }, +}; +static TCConfigEntry addvideo_conf[] = { + { "Destination", addvideo_destination, TCCONF_TYPE_STRING, 0, 0, 0 }, + { "Codec", addvideo_codec, TCCONF_TYPE_STRING, 0, 0, 0 }, + { NULL, NULL, 0, 0, 0, 0, }, +}; + +/*************************************************************************/ + +typedef struct pvm_conf_item_ PVMConfItem; +struct pvm_conf_item_ { + const char *name; + TCConfigEntry *conf; + int (*dispatch)(int id, pvm_config_env *env); + int serverside; /* flag */ + int parsed; +}; + +/* BIGFAT WARNING: please take a great care to keep in sync */ +enum config_idx { + CONF_PVM_HOST_CAPS_IDX = 0, + CONF_AUDIO_MERGER_IDX, + CONF_VIDEO_MERGER_IDX, + CONF_SYSTEM_MERGER_IDX, + CONF_EXPORT_AUDIO_MOD_IDX, + CONF_EXPORT_VIDEO_MOD_IDX, + CONF_SYSTEM_LIST_IDX, + CONF_ADD_AUDIO_IDX, + CONF_ADD_VIDEO_IDX, +}; +static PVMConfItem pvm_config[] = { + { "PvmHostCapability", pvmhostcaps_conf, dispatch_null, 0, 0, }, + { "AudioMerger", audiomerger_conf, dispatch_merger, 0, 0, }, + { "VideoMerger", videomerger_conf, dispatch_merger, 0, 0, }, + { "SystemMerger", systemmerger_conf, dispatch_merger, 0, 0, }, + { "ExportAudioModule", exportaudiomod_conf, dispatch_modules, 0, 0, }, + { "ExportVideoModule", exportvideomod_conf, dispatch_modules, 0, 0, }, + { "SystemList", systemlist_conf, dispatch_syslist, 1, 0, }, + { "AddAudio", addaudio_conf, dispatch_null, 1, 0, }, + { "AddVideo", addvideo_conf, dispatch_null, 1, 0, }, + { NULL, NULL, NULL, 0, 0, }, +}; + +typedef struct pvm_list_item_ PVMListItem; +struct pvm_list_item_ { + const char *name; + pvm_config_filelist **list; + int type; + int parsed; + /* dispatcher can be generic, so no need for specific one */ +}; +static PVMListItem pvm_filelist[] = { + { "AddAudioList", &s_pvm_conf.p_add_list, TC_AUDIO, 0, }, + { "AddVideoList", &s_pvm_conf.p_add_list, TC_VIDEO, 0, }, + { "LogAudioList", &s_pvm_conf.p_add_loglist, TC_AUDIO, 0, }, + { "LogVideoList", &s_pvm_conf.p_add_loglist, TC_VIDEO, 0, }, + { "RemoveAudioList", &s_pvm_conf.p_rem_list, TC_AUDIO, 0, }, + { "RemoveVideoList", &s_pvm_conf.p_rem_list, TC_VIDEO, 0, }, + { NULL, NULL, 0, 0, }, +}; + +/*************************************************************************/ +/* dispatcher functions */ + +/* + * yes, that's ugly (and I don't really wnat expend too much on this). + * Improvements are warmly welcome, but a rewrite from scratch is + * probably the way to go. + */ + +struct dispatch_data { + pvm_config_filelist *head; + pvm_config_filelist *tail; + char *codec; + char *destination; + int type; +}; + + +static int dispatch_list_item(TCListItem *item, void *userdata) +{ + struct dispatch_data *DD = userdata; + int ret = 0; + + pvm_config_filelist *cur = tc_zalloc(sizeof(pvm_config_filelist)); // XXX + + if (!cur) { + ret = 1; + } else { + cur->s_type = DD->type; + cur->p_codec = DD->codec; // softref + cur->p_destination = DD->destination; // softref + cur->p_filename = item->data; // hardref + + if (!DD->head) { + DD->head = cur; + DD->tail = cur; + } else { + DD->tail->p_next = cur; + cur = DD->tail->p_next; + } + } + return ret; +} + +static pvm_config_filelist *dispatch_list(TCList *src, int type, + char *codec, char *destination, + pvm_config_filelist **ret) +{ + struct dispatch_data DD = { + .head = NULL, + .tail = NULL, + .type = type, + .codec = codec, + .destination = destination, + }; + + tc_list_foreach(src, dispatch_list_item, &DD); + + if (ret) { + *ret = DD.tail; + } + return DD.head; +} + + +static int dispatch_node(int id, PVMNodeData *data, + pvm_config_env *env) +{ + /* + * this insert nodes in reverse orders, so node defined last + * in configuration file is first on list, but nobody really + * cares about that. + */ + if (env && data && data->enabled) { + pvm_config_hosts *host = tc_zalloc(sizeof(pvm_config_hosts)); + if (host) { + /* fill */ + host->p_hostname = data->hostname; + host->s_nproc = data->maxprocs; + /* link */ + host->p_next = env->p_pvm_hosts; + env->p_pvm_hosts = host; + + return 1; + } + } + return 0; +} + + +static int dispatch_merger(int id, pvm_config_env *env) +{ + switch (id) { + case CONF_AUDIO_MERGER_IDX: + env->s_audio_merger.p_hostname = pvm_hostname(audiomerger_hostname); + return 1; + case CONF_VIDEO_MERGER_IDX: + env->s_video_merger.p_hostname = pvm_hostname(videomerger_hostname); + return 1; + case CONF_SYSTEM_MERGER_IDX: + env->s_system_merger.p_hostname = pvm_hostname(systemmerger_hostname); + tc_strstrip(systemmerger_mplexparams); + env->p_multiplex_cmd = systemmerger_mplexparams; + return 1; + default: /* cannot happen */ + return 0; + } + return 0; /* paranoia */ +} + +static int dispatch_null(int id, pvm_config_env *env) +{ + return (env != NULL) ?1 :0; +} + + +static int dispatch_modules(int id, pvm_config_env *env) +{ + pvm_config_codec *cfg = NULL; + char *codec = NULL; + PVMString *params = NULL; + + switch (id) { + case CONF_EXPORT_AUDIO_MOD_IDX: + cfg = &(env->s_audio_codec); + codec = exportaudiomod_codec; + params = exportaudiomod_params; + break; + case CONF_EXPORT_VIDEO_MOD_IDX: + cfg = &(env->s_video_codec); + codec = exportvideomod_codec; + params = exportvideomod_params; + break; + default: /* cannot happen */ + return 0; + } + + tc_strstrip(codec); + tc_strstrip(params[0]); + tc_strstrip(params[1]); + tc_strstrip(params[2]); + cfg->p_codec = codec; + cfg->p_par1 = params[0]; + cfg->p_par2 = params[1]; + cfg->p_par3 = params[2]; + return 1; +} + +static int dispatch_syslist(int id, pvm_config_env *env) +{ + if (env != NULL) { + tc_strstrip(systemlist_codec); + tc_strstrip(systemlist_destination); + tc_strstrip(systemlist_mplexparams); + env->s_sys_list.p_codec = systemlist_codec; + env->s_sys_list.p_destination = systemlist_destination; + env->p_multiplex_cmd = systemlist_mplexparams; + return 1; + } + return 0; +} + +/*************************************************************************/ + + +static int parse_nodes(char *p_hostfile, int nodes) +{ + int i = 0, ret = 0, parsed = 0; + char buf[TC_BUF_LINE]; + + if (nodes > PVM_MAX_NODES) { + tc_log_warn(__FILE__, "excessive nodes requested, autolimit to %i", + PVM_MAX_NODES); + nodes = PVM_MAX_NODES; + } + + for (i = 0; i < nodes; i++) { + tc_snprintf(buf, sizeof(buf), "Node%i", i+1); + + ret = module_read_config(p_hostfile, buf, node_conf[i], __FILE__); + if (ret) { + int done = dispatch_node(i, &nodes_data[i], &s_pvm_conf); + if (done) { + parsed++; + } + } + } + return parsed; +} + + +static void parse_config(char *p_hostfile, int full) +{ + int i = 0; + for (i = 0; pvm_config[i].name != NULL; i++) { + int ret = 0; + + if (!full && pvm_config[i].serverside) + continue; + ret = module_read_config(p_hostfile, pvm_config[i].name, + pvm_config[i].conf, __FILE__); + if (ret) { + int done = pvm_config[i].dispatch(i, &s_pvm_conf); + pvm_config[i].parsed = done; + } + } +} + +static void parse_filelist(char *p_hostfile) +{ + int i = 0; + for (i = 0; pvm_filelist[i].name != NULL; i++) { + TCList *list = module_read_config_list(p_hostfile, + pvm_filelist[i].name, + __FILE__); + if (list) { + int type = pvm_filelist[i].type; + char *codec = (type == TC_VIDEO) + ?addvideo_codec :addaudio_codec; + char *dest = (type == TC_VIDEO) + ?addvideo_destination :addaudio_destination; + pvm_config_filelist *tail = NULL; + pvm_config_filelist *head = dispatch_list(list, type, + codec, dest, &tail); + if (head) { /* then tail is valid too */ + pvm_filelist[i].parsed = 1; + if (*(pvm_filelist[i].list) != NULL) { + tail->p_next = *(pvm_filelist[i].list); + } + *(pvm_filelist[i].list) = head; + } + /* always */ + module_free_config_list(list, (head != NULL) ?1 :0); + } + } +} + +#define WAS_PARSED(IDX) pvm_config[(IDX)].parsed + +static pvm_config_env *validate(int nodes, int verbose) +{ + const char *errmsg = "???"; + + if (nodes < 0) { + errmsg = "Need one PVM node configured"; + goto failed; + } + if (((!s_pvm_conf.s_audio_codec.p_codec) && WAS_PARSED(CONF_EXPORT_AUDIO_MOD_IDX)) + || ((!s_pvm_conf.s_video_codec.p_codec) && WAS_PARSED(CONF_EXPORT_VIDEO_MOD_IDX))) { + errmsg = "Need at least Codec parameter in the" + " [ExportVideoModule] or [ExportAudioModule] section"; + goto failed; + } + if ((s_pvm_conf.s_system_merger.p_hostname != NULL) + && (s_pvm_conf.p_multiplex_cmd == NULL)) { + errmsg = "MultiplexParams parameter required in the" + " [SystemMerger] section"; + goto failed; + } else if (s_pvm_conf.s_system_merger.p_hostname != NULL) { + s_pvm_conf.s_video_merger.s_build_only_list = 1; + s_pvm_conf.s_audio_merger.s_build_only_list = 1; + } + if ((s_pvm_conf.p_add_list != NULL) + && (s_pvm_conf.p_add_list->p_codec == NULL) + && (WAS_PARSED(CONF_ADD_AUDIO_IDX) || WAS_PARSED(CONF_ADD_VIDEO_IDX))) { + errmsg = "Need at least Codec parameter in the [AddList] section"; + goto failed; + } + + /* done */ + return &s_pvm_conf; + +failed: + if (verbose) { + tc_log_error(__FILE__, "%s", errmsg); + } + pvm_parser_close(); + return NULL; +} + +#undef WAS_PARSED + + +pvm_config_env *pvm_parser_open(char *p_hostfile, int verbose, int full) +{ + int i = 0; + /* setup defaults */ + s_pvm_conf.p_pvm_hosts = NULL; + /* XXX: add more defaults? */ + /* get user data */ + parse_config(p_hostfile, full); + /* get node data */ + i = parse_nodes(p_hostfile, nodes_num); + /* get lists */ + if (full) { + parse_filelist(p_hostfile); + } + /* then validate it */ + return validate(i, verbose); +} + + +void pvm_parser_close(void) +{ + pvm_config_hosts *p_pvm_conf_host = NULL, *p_tmp = NULL; + pvm_config_filelist *p_pvm_conf_fileadd = NULL; + pvm_config_filelist *p_pvm_conf_filerem = NULL; + + for (p_pvm_conf_host = s_pvm_conf.p_pvm_hosts; p_pvm_conf_host != NULL; ) { + p_tmp = p_pvm_conf_host->p_next; + free(p_pvm_conf_host); + p_pvm_conf_host = p_tmp; + } + for (p_pvm_conf_fileadd = s_pvm_conf.p_add_list; p_pvm_conf_fileadd != NULL; ) { + p_pvm_conf_filerem = p_pvm_conf_fileadd->p_next; + free(p_pvm_conf_fileadd); + p_pvm_conf_fileadd = p_pvm_conf_filerem; + } + for (p_pvm_conf_fileadd = s_pvm_conf.p_rem_list; p_pvm_conf_fileadd != NULL; ) { + p_pvm_conf_filerem = p_pvm_conf_fileadd->p_next; + free(p_pvm_conf_fileadd); + p_pvm_conf_fileadd = p_pvm_conf_filerem; + } + memset(&s_pvm_conf, 0, sizeof(s_pvm_conf)); +} + +/*************************************************************************/ + +/* + * 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/pvm3/pvm_parser.h b/debian/transcode/transcode-1.1.7/pvm3/pvm_parser.h new file mode 100644 index 00000000..2fd533a2 --- /dev/null +++ b/debian/transcode/transcode-1.1.7/pvm3/pvm_parser.h @@ -0,0 +1,80 @@ +/* + * pvm_parser.h + * + * Copyright (C) Marzio Malanchini - August 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. + * + */ + +#ifndef _PVM_PARSER_H +#define _PVM_PARSER_H + +#include "tc_defaults.h" /*TC_xxxx variables*/ + +#define PVM_MAX_CODEC_PARAMS 3 + +typedef struct _pvm_config_filelist { + char *p_codec; + char *p_filename; + char *p_destination; + int s_type; + struct _pvm_config_filelist *p_next; +} pvm_config_filelist; + +typedef struct _pvm_config_merger { + char *p_hostname; + int s_build_only_list; +} pvm_config_merger; + +typedef struct _pvm_config_hosts { + char *p_hostname; + int s_nproc; + struct _pvm_config_hosts *p_next; +} pvm_config_hosts; + +typedef struct _pvm_config_codec { + char *p_codec; + char *p_par1; + char *p_par2; + char *p_par3; +} pvm_config_codec; + +typedef struct _pvm_config_env { + int s_nproc; + int s_max_proc; + int s_num_frame_task; + int s_build_intermed_file; + int s_internal_multipass; + char *p_multiplex_cmd; + pvm_config_codec s_audio_codec; + pvm_config_codec s_video_codec; + pvm_config_merger s_system_merger; + pvm_config_merger s_video_merger; + pvm_config_merger s_audio_merger; + pvm_config_hosts *p_pvm_hosts; + pvm_config_filelist *p_add_list; + pvm_config_filelist *p_add_loglist; + pvm_config_filelist *p_rem_list; + pvm_config_filelist s_sys_list; +} pvm_config_env; + + +pvm_config_env *pvm_parser_open(char *p_hostfile, int verbose, int full); +void pvm_parser_close(void); + +#endif diff --git a/debian/transcode/transcode-1.1.7/pvm3/pvm_version.h b/debian/transcode/transcode-1.1.7/pvm3/pvm_version.h new file mode 100644 index 00000000..816caa58 --- /dev/null +++ b/debian/transcode/transcode-1.1.7/pvm3/pvm_version.h @@ -0,0 +1,37 @@ +/* + * pvm_version.h + * + * Copyright (C) Marzio Malanchini - August 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. + * + */ + +#ifndef _PVM_VERSION_H +#define _PVM_VERSION_H + + +#define EXPORT_PVM_VERSION "v0.0.5 (2007-08-03)" +#define M_LOAD_LIB "pvm_functions.so" + +#define PVM_MAX_NODES 8 +#define PVM_NUM_NODE_PROCS 255 +#define PVM_MAX_NODE_PROCS 4095 +#define PVM_MAX_CLUSTER_PROCS 4095 +#define PVM_NUM_TASK_FRAMES 65535 + +#endif diff --git a/debian/transcode/transcode-1.1.7/pvm3/tcpvmexportd.c b/debian/transcode/transcode-1.1.7/pvm3/tcpvmexportd.c new file mode 100644 index 00000000..c497703d --- /dev/null +++ b/debian/transcode/transcode-1.1.7/pvm3/tcpvmexportd.c @@ -0,0 +1,360 @@ +/* + * tcpvmexportd.c + * + * Copyright (C) Marzio Malanchini - July 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 <unistd.h> +#include <stdlib.h> +#include <string.h> + + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "pvm_interface.h" +#include "pvm_parser.h" + +#include "transcode.h" +#include "export_pvm_slave.h" +#include "external_codec.h" + +#define EXE "tcpvmexportd" + +#define MAX_BUF 1024 + +#define MASTER_MODE 0x00000001 +#define SLAVE_MODE 0x00000010 +#define MERGER_MODE 0x00000100 +#define CHECK_MODE 0x00001000 +#define MAST_MERGE_MODE MASTER_MODE|MERGER_MODE +#define MAST_CHECK_MODE MASTER_MODE|CHECK_MODE +#define SLAVE_MERGE_MODE SLAVE_MODE|MERGER_MODE + + +void *f_handle=NULL; /*handle for dlopen/dlclose*/ +void *f_ext_handle=NULL; /*handle for dlopen/dlclose of the external module*/ +#define tc_export p_tc_export +int (*tc_export)(int,void *,void *); +char *p_param1=NULL,*p_param2=NULL,*p_param3=NULL; /*codec input parameter*/ +int tc_accel=-1; +int s_elab_type=TC_VIDEO,s_list_only=0; +char *p_out_file_name=NULL; +char *p_request_func=NULL; +char *p_hostname=NULL; +int verbose=TC_QUIET; +char *p_merge_cmd=NULL; +unsigned int tc_avi_limit=AVI_FILE_LIMIT; /*NEED TO CHECK*/ +int s_divxmultipass=0,s_internal_multipass=0; + +void version() +{ + /* id string */ + fprintf(stderr, "%s (%s v%s) (C) 2001-2003 Thomas Oestreich\n", + EXE, PACKAGE, VERSION); +} + + +static void usage(int status) +{ + version(); + fprintf(stderr,"\nUsage: %s -s|-m [options]\n", EXE); + fprintf(stderr,"\t -s start %s in slave mode [default]\n",EXE); + fprintf(stderr,"\t -m start %s in master mode [off]\n",EXE); + fprintf(stderr,"\t -j start %s in merge mode [off]\n",EXE); + fprintf(stderr,"\t -L create only the merge list [off]\n"); + fprintf(stderr,"\t -p number Multipass. [0]\n"); + fprintf(stderr,"\t -C Check the config or merge file [off]\n"); + fprintf(stderr,"\t -M Enable internal multipass [off]\n"); + fprintf(stderr,"\t -c name name of slave function req in slave mode [none]\n"); + fprintf(stderr,"\t -x parameters multiplex parameters [none]\n"); + fprintf(stderr,"\t -t type elab video or audio frame (video|audio|system|multisystem) [video]\n"); + fprintf(stderr,"\t -f name out file name [/tmp/my_file_name]\n"); + fprintf(stderr,"\t -1 param first parameter to pass to the slave function [null]\n"); + fprintf(stderr,"\t -2 param second parameter to pass to the slave function [null]\n"); + fprintf(stderr,"\t -3 param third parameter to pass to the slave function [null]\n"); + fprintf(stderr,"\t -d level verbose level 0|1|2 [0]\n"); + fprintf(stderr,"\t -h print this help\n"); + fprintf(stderr,"\t -v print version\n"); + exit(status); +} + + +int f_init_func(char *p_option,char *p_mod) +{ + const char *p_error; + char *p_modpath=MOD_PATH; + char s_module[MAX_BUF]; + + if(!strcasecmp(p_option,"open-external")) + { + if (p_mod!=NULL) + { + memset(s_module,'\0',sizeof(s_module)); + tc_snprintf(s_module, sizeof(s_module), "%s/export_%s.so", p_modpath,p_mod); + f_ext_handle=dlopen(s_module, RTLD_GLOBAL|RTLD_LAZY); + if (!f_ext_handle) + { + fputs (dlerror(), stderr); + dlclose(f_handle); + return(1); + } + tc_export = dlsym(f_ext_handle, "tc_export"); + if ((p_error = dlerror()) != NULL) + { + fputs(p_error, stderr); + return(1); + } + } + } + else if(!strcasecmp(p_option,"close-external")) + { + if (f_ext_handle!=NULL) + dlclose(f_ext_handle); + f_ext_handle=NULL; + tc_export=NULL; + } + else if(!strcasecmp(p_option,"status-external")) + { + if(f_ext_handle!=NULL) + return(1); + } + else if(!strcasecmp(p_option,"open")) + { + if (p_mod!=NULL) + { + tc_accel = ac_cpuinfo(); + memset(s_module,'\0',sizeof(s_module)); + tc_snprintf(s_module, sizeof(s_module), "%s/export_%s.so", p_modpath,p_mod); + f_ext_handle=dlopen(s_module, RTLD_GLOBAL|RTLD_LAZY); + if (!f_ext_handle) + { + fputs (dlerror(), stderr); + dlclose(f_handle); + return(1); + } + tc_export = dlsym(f_ext_handle, "tc_export"); + if ((p_error = dlerror()) != NULL) + { + fputs(p_error, stderr); + return(1); + } + } + if ((f_handle=f_init_pvm_func("open",NULL))==NULL) + return(1); + } + else if(!strcasecmp(p_option,"close")) + { + if (f_ext_handle!=NULL) + dlclose(f_ext_handle); + (void *)f_init_pvm_func("close",f_handle); + f_ext_handle=NULL; + f_handle=NULL; + } + else + { + fprintf(stderr,"(%s) invalid command \"%s\"\n",__FILE__,p_option); + return(1); + } + return(0); +} + + + +int main(int argc,char **argv) +{ + char s_cmd; + char *p_argv[]={"-s",(char*)0,(char*)0,(char*)0,(char*)0,(char*)0,(char*)0,(char*)0,(char*)0,(char*)0,(char*)0}; + int s_slave=0,s_cont=1,s_file_dest; + char *p_tmp_file="/tmp/my_file_name"; + pvm_config_env *p_pvm_conf; + pvm_config_filelist *p_my_filelist=NULL; + char s_hostname[MAX_BUF]; + + p_out_file_name=p_tmp_file; + + if((gethostname(s_hostname,sizeof(s_hostname)))!=0) + { + memset(s_hostname,'\0',sizeof(s_hostname)); + tc_snprintf(s_hostname,sizeof(s_hostname),"localhost-%d\n",getpid()); + } + p_hostname=(char *)s_hostname; + + while ((s_cmd = getopt(argc, argv, "mMCLsjx:c:1:2:3:t:f:d:p:vh")) != -1) + { + switch (s_cmd) + { + case 'c': + if(optarg[0]=='-') + usage(EXIT_FAILURE); + p_argv[s_cont++]="-c"; + p_argv[s_cont++]=p_request_func=optarg; + break; + case 'M': + s_internal_multipass=1; + break; + case 'p': + s_divxmultipass=((atoi(optarg)<0)||(atoi(optarg)>3))?0:atoi(optarg); + break; + case 'd': + verbose=((atoi(optarg)<0)||(atoi(optarg)>2))?0:atoi(optarg); + break; + case 'C': + s_slave|=CHECK_MODE; + break; + case 'L': + s_list_only=1; + break; + case 'j': + s_slave|=MERGER_MODE; + break; + case 's': + s_slave|=SLAVE_MODE; /*default*/ + break; + case 'm': + s_slave|=MASTER_MODE; + break; + case 'f': + p_argv[s_cont++]="-f"; + p_argv[s_cont++]=p_out_file_name=optarg; + break; + case 't': + p_argv[s_cont++]="-t"; + p_argv[s_cont++]=optarg; + if(!strcasecmp(optarg,"video")) + s_elab_type=TC_VIDEO; + else if(!strcasecmp(optarg,"audio")) + s_elab_type=TC_AUDIO; + else if(!strcasecmp(optarg,"system")) + s_elab_type=TC_VIDEO_AUDIO; + else if(!strcasecmp(optarg,"multisystem")) + s_elab_type=TC_MULTI_VIDEO_AUDIO; + else + usage(EXIT_FAILURE); + break; + case 'x': + p_merge_cmd=optarg; /*multiplex command*/ + break; + case '1': + p_param1=strtok(optarg,"\""); /*First parameter*/ + break; + case '2': + p_param2=strtok(optarg,"\""); /*Second parameter*/ + break; + case '3': + p_param3=strtok(optarg,"\""); /*Third parameter*/ + break; + case 'v': + version(); + exit(0); + break; + case 'h': + usage(EXIT_SUCCESS); + default: + usage(EXIT_FAILURE); + } + } + + if(optind < argc) + { + if(strcmp(argv[optind],"-")!=0) + usage(EXIT_FAILURE); + } + if(argc==1) + usage(EXIT_FAILURE); + if (((s_slave==SLAVE_MODE)||(s_slave==(SLAVE_MERGE_MODE)))&&(p_request_func==NULL)) + usage(EXIT_FAILURE); + if ((s_slave==(MAST_MERGE_MODE)||s_slave==(MAST_CHECK_MODE))&&(p_out_file_name==NULL)) + usage(EXIT_FAILURE); + switch(s_slave) + { + case MAST_CHECK_MODE: + case MAST_MERGE_MODE: + p_pvm_conf = pvm_parser_open(p_out_file_name,verbose, 1); + if (p_pvm_conf == NULL) + { + fprintf(stderr,"[%s] error checking %s\n",EXE,p_out_file_name); + exit(1); + } + if (s_slave == (MAST_MERGE_MODE)) + { + if (p_pvm_conf->s_sys_list.p_destination!=NULL) /*syslist?*/ + { + if(f_system_merge(p_pvm_conf)) /*if 1 then error*/ + exit(1); + } + else if (p_pvm_conf->p_add_list->p_destination!=NULL) + { + if ((s_file_dest=creat(p_pvm_conf->p_add_list->p_destination,S_IWUSR|S_IRUSR|S_IRGRP|S_IROTH))==-1) + { + fprintf(stderr,"[%s] can't create %s output file.\n",EXE,p_pvm_conf->p_add_list->p_destination); + pvm_parser_close(); + p_pvm_conf=NULL; + exit(1); + } + for (p_my_filelist=p_pvm_conf->p_add_list;p_my_filelist!=NULL;p_my_filelist=p_my_filelist->p_next) + { + fprintf(stderr,"[%s] merge into %s and remove file %s\n",EXE,p_pvm_conf->p_add_list->p_destination,p_my_filelist->p_filename); + if(f_copy_remove_func("open",p_my_filelist->p_filename,s_file_dest)) /*if 1 then error*/ + exit(1); + } + close(s_file_dest); + f_copy_remove_func("close",NULL,0); + } + else + { + fprintf(stderr,"[%s] no destination file name.\n",EXE); + exit(1); + } + for (p_my_filelist=p_pvm_conf->p_rem_list;p_my_filelist!=NULL;p_my_filelist=p_my_filelist->p_next) + { + fprintf(stderr,"[%s] remove file %s\n",EXE,p_my_filelist->p_filename); + remove(p_my_filelist->p_filename); + } + } + pvm_parser_close(); + p_pvm_conf=NULL; + break; + case SLAVE_MODE: + case SLAVE_MERGE_MODE: + if((!strcasecmp(p_request_func,"mpeg2enc-mp2enc"))||(!strcasecmp(p_request_func,"mpeg-mpeg"))||(!strcasecmp(p_request_func,"avi-avi"))) + { + if (f_init_func("open",NULL)) /*init the pvm interface*/ + exit(1); + f_pvm_skeduler(f_export_func); + } + else + { + if (f_init_func("open",p_request_func)) + exit(1); + f_pvm_skeduler(f_export_func); + } + break; + default: + break; + } + f_init_func("close",NULL); + return(0); +} diff --git a/debian/transcode/transcode-1.1.7/pvm3/vob_pack_unpack.c b/debian/transcode/transcode-1.1.7/pvm3/vob_pack_unpack.c new file mode 100644 index 00000000..2f8e95ab --- /dev/null +++ b/debian/transcode/transcode-1.1.7/pvm3/vob_pack_unpack.c @@ -0,0 +1,464 @@ +/* + * vob_pack_unpack.c + * + * Copyright (C) Marzio Malanchini - August 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 <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> +#include <stdlib.h> +#include <string.h> +#include <stdio.h> + + +#include <vob_pack_unpack.h> + +#define MAX_BUF 102400 + +char *f_vob_pack(char *p_option,vob_t *p_vob,int *p_size) +{ + static char *p_buffer=NULL; + vob_pack_unpack_t *p_pup_area; + + if(!strcasecmp(p_option,"open")) + { + if (p_buffer==NULL) + { + p_buffer=(char *)calloc(MAX_BUF,1); + } + memset((char *)p_buffer,'\0',MAX_BUF); + memcpy((char *)p_buffer,(char *)p_vob,sizeof(vob_t)); + *p_size=sizeof(vob_t); + p_pup_area=(vob_pack_unpack_t *)(p_buffer+sizeof(vob_t)); + if (p_vob->vmod_probed!=NULL) + { + p_pup_area->p_area=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t)); + p_pup_area->s_size=strlen(p_vob->vmod_probed); + memcpy(p_pup_area->p_area,p_vob->vmod_probed,p_pup_area->s_size); + p_pup_area->s_size+=1; /*strlen + \0 so the strings will be terminated*/ + } + else + p_pup_area->s_size=1; /*only \0*/ + *p_size=*p_size+p_pup_area->s_size+sizeof(vob_pack_unpack_t); + p_pup_area=(vob_pack_unpack_t *)(p_buffer+*p_size); /*pointer to the next section*/ + if (p_vob->amod_probed!=NULL) + { + p_pup_area->p_area=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t)); + p_pup_area->s_size=strlen(p_vob->amod_probed); + memcpy(p_pup_area->p_area,p_vob->amod_probed,p_pup_area->s_size); + p_pup_area->s_size+=1; /*strlen + \0 so the strings will be terminated*/ + } + else + p_pup_area->s_size=1; /*only \0*/ + *p_size=*p_size+p_pup_area->s_size+sizeof(vob_pack_unpack_t); + p_pup_area=(vob_pack_unpack_t *)(p_buffer+*p_size); /*pointer to the next section*/ + if (p_vob->vmod_probed_xml!=NULL) + { + p_pup_area->p_area=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t)); + p_pup_area->s_size=strlen(p_vob->vmod_probed_xml); + memcpy(p_pup_area->p_area,p_vob->vmod_probed_xml,p_pup_area->s_size); + p_pup_area->s_size+=1; /*strlen + \0 so the strings will be terminated*/ + } + else + p_pup_area->s_size=1; /*only \0*/ + *p_size=*p_size+p_pup_area->s_size+sizeof(vob_pack_unpack_t); + p_pup_area=(vob_pack_unpack_t *)(p_buffer+*p_size); /*pointer to the next section*/ + if (p_vob->amod_probed_xml!=NULL) + { + p_pup_area->p_area=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t)); + p_pup_area->s_size=strlen(p_vob->amod_probed_xml); + memcpy(p_pup_area->p_area,p_vob->amod_probed_xml,p_pup_area->s_size); + p_pup_area->s_size+=1; /*strlen + \0 so the strings will be terminated*/ + } + else + p_pup_area->s_size=1; /*only \0*/ + *p_size=*p_size+p_pup_area->s_size+sizeof(vob_pack_unpack_t); + p_pup_area=(vob_pack_unpack_t *)(p_buffer+*p_size); /*pointer to the next section*/ + if (p_vob->video_in_file!=NULL) + { + p_pup_area->p_area=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t)); + p_pup_area->s_size=strlen(p_vob->video_in_file); + memcpy(p_pup_area->p_area,p_vob->video_in_file,p_pup_area->s_size); + p_pup_area->s_size+=1; /*strlen + \0 so the strings will be terminated*/ + } + else + p_pup_area->s_size=1; /*only \0*/ + *p_size=*p_size+p_pup_area->s_size+sizeof(vob_pack_unpack_t); + p_pup_area=(vob_pack_unpack_t *)(p_buffer+*p_size); /*pointer to the next section*/ + if (p_vob->audio_in_file!=NULL) + { + p_pup_area->p_area=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t)); + p_pup_area->s_size=strlen(p_vob->audio_in_file); + memcpy(p_pup_area->p_area,p_vob->audio_in_file,p_pup_area->s_size); + p_pup_area->s_size+=1; /*strlen + \0 so the strings will be terminated*/ + } + else + p_pup_area->s_size=1; /*only \0*/ + *p_size=*p_size+p_pup_area->s_size+sizeof(vob_pack_unpack_t); + p_pup_area=(vob_pack_unpack_t *)(p_buffer+*p_size); /*pointer to the next section*/ + if (p_vob->nav_seek_file!=NULL) + { + p_pup_area->p_area=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t)); + p_pup_area->s_size=strlen(p_vob->nav_seek_file); + memcpy(p_pup_area->p_area,p_vob->nav_seek_file,p_pup_area->s_size); + p_pup_area->s_size+=1; /*strlen + \0 so the strings will be terminated*/ + } + else + p_pup_area->s_size=1; /*only \0*/ + *p_size=*p_size+p_pup_area->s_size+sizeof(vob_pack_unpack_t); + p_pup_area=(vob_pack_unpack_t *)(p_buffer+*p_size); /*pointer to the next section*/ + if (p_vob->vob_info_file!=NULL) + { + p_pup_area->p_area=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t)); + p_pup_area->s_size=strlen(p_vob->vob_info_file); + memcpy(p_pup_area->p_area,p_vob->vob_info_file,p_pup_area->s_size); + p_pup_area->s_size+=1; /*strlen + \0 so the strings will be terminated*/ + } + else + p_pup_area->s_size=1; /*only \0*/ + *p_size=*p_size+p_pup_area->s_size+sizeof(vob_pack_unpack_t); + p_pup_area=(vob_pack_unpack_t *)(p_buffer+*p_size); /*pointer to the next section*/ + if (p_vob->video_out_file!=NULL) + { + p_pup_area->p_area=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t)); + p_pup_area->s_size=strlen(p_vob->video_out_file); + memcpy(p_pup_area->p_area,p_vob->video_out_file,p_pup_area->s_size); + p_pup_area->s_size+=1; /*strlen + \0 so the strings will be terminated*/ + } + else + p_pup_area->s_size=1; /*only \0*/ + *p_size=*p_size+p_pup_area->s_size+sizeof(vob_pack_unpack_t); + p_pup_area=(vob_pack_unpack_t *)(p_buffer+*p_size); /*pointer to the next section*/ + if (p_vob->audio_out_file!=NULL) + { + p_pup_area->p_area=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t)); + p_pup_area->s_size=strlen(p_vob->audio_out_file); + memcpy(p_pup_area->p_area,p_vob->audio_out_file,p_pup_area->s_size); + p_pup_area->s_size+=1; /*strlen + \0 so the strings will be terminated*/ + } + else + p_pup_area->s_size=1; /*only \0*/ + *p_size=*p_size+p_pup_area->s_size+sizeof(vob_pack_unpack_t); + p_pup_area=(vob_pack_unpack_t *)(p_buffer+*p_size); /*pointer to the next section*/ + if (p_vob->divxlogfile!=NULL) + { + p_pup_area->p_area=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t)); + p_pup_area->s_size=strlen(p_vob->divxlogfile); + memcpy(p_pup_area->p_area,p_vob->divxlogfile,p_pup_area->s_size); + p_pup_area->s_size+=1; /*strlen + \0 so the strings will be terminated*/ + } + else + p_pup_area->s_size=1; /*only \0*/ + *p_size=*p_size+p_pup_area->s_size+sizeof(vob_pack_unpack_t); + p_pup_area=(vob_pack_unpack_t *)(p_buffer+*p_size); /*pointer to the next section*/ + if (p_vob->lame_preset!=NULL) + { + p_pup_area->p_area=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t)); + p_pup_area->s_size=strlen(p_vob->lame_preset); + memcpy(p_pup_area->p_area,p_vob->lame_preset,p_pup_area->s_size); + p_pup_area->s_size+=1; /*strlen + \0 so the strings will be terminated*/ + } + else + p_pup_area->s_size=1; /*only \0*/ + *p_size=*p_size+p_pup_area->s_size+sizeof(vob_pack_unpack_t); + p_pup_area=(vob_pack_unpack_t *)(p_buffer+*p_size); /*pointer to the next section*/ + if (p_vob->audiologfile!=NULL) + { + p_pup_area->p_area=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t)); + p_pup_area->s_size=strlen(p_vob->audiologfile); + memcpy(p_pup_area->p_area,p_vob->audiologfile,p_pup_area->s_size); + p_pup_area->s_size+=1; /*strlen + \0 so the strings will be terminated*/ + } + else + p_pup_area->s_size=1; /*only \0*/ + *p_size=*p_size+p_pup_area->s_size+sizeof(vob_pack_unpack_t); + p_pup_area=(vob_pack_unpack_t *)(p_buffer+*p_size); /*pointer to the next section*/ + if (p_vob->ex_v_fcc!=NULL) + { + p_pup_area->p_area=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t)); + p_pup_area->s_size=strlen(p_vob->ex_v_fcc); + memcpy(p_pup_area->p_area,p_vob->ex_v_fcc,p_pup_area->s_size); + p_pup_area->s_size+=1; /*strlen + \0 so the strings will be terminated*/ + } + else + p_pup_area->s_size=1; /*only \0*/ + *p_size=*p_size+p_pup_area->s_size+sizeof(vob_pack_unpack_t); + p_pup_area=(vob_pack_unpack_t *)(p_buffer+*p_size); /*pointer to the next section*/ + if (p_vob->ex_a_fcc!=NULL) + { + p_pup_area->p_area=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t)); + p_pup_area->s_size=strlen(p_vob->ex_a_fcc); + memcpy(p_pup_area->p_area,p_vob->ex_a_fcc,p_pup_area->s_size); + p_pup_area->s_size+=1; /*strlen + \0 so the strings will be terminated*/ + } + else + p_pup_area->s_size=1; /*only \0*/ + *p_size=*p_size+p_pup_area->s_size+sizeof(vob_pack_unpack_t); + p_pup_area=(vob_pack_unpack_t *)(p_buffer+*p_size); /*pointer to the next section*/ + if (p_vob->ex_profile_name!=NULL) + { + p_pup_area->p_area=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t)); + p_pup_area->s_size=strlen(p_vob->ex_profile_name); + memcpy(p_pup_area->p_area,p_vob->ex_profile_name,p_pup_area->s_size); + p_pup_area->s_size+=1; /*strlen + \0 so the strings will be terminated*/ + } + else + p_pup_area->s_size=1; /*only \0*/ + *p_size=*p_size+p_pup_area->s_size+sizeof(vob_pack_unpack_t); + p_pup_area=(vob_pack_unpack_t *)(p_buffer+*p_size); /*pointer to the next section*/ + if (p_vob->mod_path!=NULL) + { + p_pup_area->p_area=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t)); + p_pup_area->s_size=strlen(p_vob->mod_path); + memcpy(p_pup_area->p_area,p_vob->mod_path,p_pup_area->s_size); + p_pup_area->s_size+=1; /*strlen + \0 so the strings will be terminated*/ + } + else + p_pup_area->s_size=1; /*only \0*/ + *p_size=*p_size+p_pup_area->s_size+sizeof(vob_pack_unpack_t); + p_pup_area=(vob_pack_unpack_t *)(p_buffer+*p_size); /*pointer to the next section*/ + if (p_vob->im_v_string!=NULL) + { + p_pup_area->p_area=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t)); + p_pup_area->s_size=strlen(p_vob->im_v_string); + memcpy(p_pup_area->p_area,p_vob->im_v_string,p_pup_area->s_size); + p_pup_area->s_size+=1; /*strlen + \0 so the strings will be terminated*/ + } + else + p_pup_area->s_size=1; /*only \0*/ + *p_size=*p_size+p_pup_area->s_size+sizeof(vob_pack_unpack_t); + p_pup_area=(vob_pack_unpack_t *)(p_buffer+*p_size); /*pointer to the next section*/ + if (p_vob->im_a_string!=NULL) + { + p_pup_area->p_area=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t)); + p_pup_area->s_size=strlen(p_vob->im_a_string); + memcpy(p_pup_area->p_area,p_vob->im_a_string,p_pup_area->s_size); + p_pup_area->s_size+=1; /*strlen + \0 so the strings will be terminated*/ + } + else + p_pup_area->s_size=1; /*only \0*/ + *p_size=*p_size+p_pup_area->s_size+sizeof(vob_pack_unpack_t); + p_pup_area=(vob_pack_unpack_t *)(p_buffer+*p_size); /*pointer to the next section*/ + if (p_vob->ex_v_string!=NULL) + { + p_pup_area->p_area=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t)); + p_pup_area->s_size=strlen(p_vob->ex_v_string); + memcpy(p_pup_area->p_area,p_vob->ex_v_string,p_pup_area->s_size); + p_pup_area->s_size+=1; /*strlen + \0 so the strings will be terminated*/ + } + else + p_pup_area->s_size=1; /*only \0*/ + *p_size=*p_size+p_pup_area->s_size+sizeof(vob_pack_unpack_t); + p_pup_area=(vob_pack_unpack_t *)(p_buffer+*p_size); /*pointer to the next section*/ + if (p_vob->ex_a_string!=NULL) + { + p_pup_area->p_area=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t)); + p_pup_area->s_size=strlen(p_vob->ex_a_string); + memcpy(p_pup_area->p_area,p_vob->ex_a_string,p_pup_area->s_size); + p_pup_area->s_size+=1; /*strlen + \0 so the strings will be terminated*/ + } + else + p_pup_area->s_size=1; /*only \0*/ + *p_size=*p_size+p_pup_area->s_size+sizeof(vob_pack_unpack_t); + p_pup_area=(vob_pack_unpack_t *)(p_buffer+*p_size); /*pointer to the next section*/ + + /* avifile_in and avifile_out are setting by the export_module*/ + /* ttime not used in export_module*/ + + return(p_buffer); + } + else if(!strcasecmp(p_option,"close")) + { + free(p_buffer); + p_buffer=NULL; + return(NULL); + } + return(NULL); +} + + +vob_t *f_vob_unpack(char *p_option,char *p_area,int s_size) +{ + static char *p_buffer=NULL,*p_pun_buf; + int s_cont; + vob_pack_unpack_t *p_pup_area; + vob_t *p_vob; + + if(!strcasecmp(p_option,"open")) + { + if (p_buffer==NULL) + { + p_buffer=(char *)calloc(MAX_BUF,1); + } + memset((char *)p_buffer,'\0',MAX_BUF); + memcpy((char *)p_buffer,p_area,s_size); + p_vob=(vob_t *)p_buffer; + s_cont=sizeof(vob_t); + + p_pup_area=(vob_pack_unpack_t *)(p_buffer+s_cont); /*pointer to the next section*/ + p_pun_buf=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t)); + if (p_pup_area->s_size==1) + p_pun_buf=NULL; + p_vob->vmod_probed=p_pun_buf; + s_cont+=p_pup_area->s_size+sizeof(vob_pack_unpack_t); + p_pup_area=(vob_pack_unpack_t *)(p_buffer+s_cont); /*pointer to the next section*/ + p_pun_buf=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t)); + if (p_pup_area->s_size==1) + p_pun_buf=NULL; + p_vob->amod_probed=p_pun_buf; + s_cont+=p_pup_area->s_size+sizeof(vob_pack_unpack_t); + p_pup_area=(vob_pack_unpack_t *)(p_buffer+s_cont); /*pointer to the next section*/ + p_pun_buf=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t)); + if (p_pup_area->s_size==1) + p_pun_buf=NULL; + p_vob->vmod_probed_xml=p_pun_buf; + s_cont+=p_pup_area->s_size+sizeof(vob_pack_unpack_t); + + p_pup_area=(vob_pack_unpack_t *)(p_buffer+s_cont); /*pointer to the next section*/ + p_pun_buf=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t)); + if (p_pup_area->s_size==1) + p_pun_buf=NULL; + p_vob->amod_probed_xml=p_pun_buf; + s_cont+=p_pup_area->s_size+sizeof(vob_pack_unpack_t); + p_pup_area=(vob_pack_unpack_t *)(p_buffer+s_cont); /*pointer to the next section*/ + p_pun_buf=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t)); + if (p_pup_area->s_size==1) + p_pun_buf=NULL; + p_vob->video_in_file=p_pun_buf; + s_cont+=p_pup_area->s_size+sizeof(vob_pack_unpack_t); + p_pup_area=(vob_pack_unpack_t *)(p_buffer+s_cont); /*pointer to the next section*/ + p_pun_buf=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t)); + if (p_pup_area->s_size==1) + p_pun_buf=NULL; + p_vob->audio_in_file=p_pun_buf; + s_cont+=p_pup_area->s_size+sizeof(vob_pack_unpack_t); + p_pup_area=(vob_pack_unpack_t *)(p_buffer+s_cont); /*pointer to the next section*/ + p_pun_buf=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t)); + if (p_pup_area->s_size==1) + p_pun_buf=NULL; + p_vob->nav_seek_file=p_pun_buf; + s_cont+=p_pup_area->s_size+sizeof(vob_pack_unpack_t); + p_pup_area=(vob_pack_unpack_t *)(p_buffer+s_cont); /*pointer to the next section*/ + p_pun_buf=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t)); + if (p_pup_area->s_size==1) + p_pun_buf=NULL; + p_vob->vob_info_file=p_pun_buf; + s_cont+=p_pup_area->s_size+sizeof(vob_pack_unpack_t); + p_pup_area=(vob_pack_unpack_t *)(p_buffer+s_cont); /*pointer to the next section*/ + p_pun_buf=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t)); + if (p_pup_area->s_size==1) + p_pun_buf=NULL; + p_vob->video_out_file=p_pun_buf; + s_cont+=p_pup_area->s_size+sizeof(vob_pack_unpack_t); + p_pup_area=(vob_pack_unpack_t *)(p_buffer+s_cont); /*pointer to the next section*/ + p_pun_buf=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t)); + if (p_pup_area->s_size==1) + p_pun_buf=NULL; + p_vob->audio_out_file=p_pun_buf; + s_cont+=p_pup_area->s_size+sizeof(vob_pack_unpack_t); + p_pup_area=(vob_pack_unpack_t *)(p_buffer+s_cont); /*pointer to the next section*/ + p_pun_buf=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t)); + if (p_pup_area->s_size==1) + p_pun_buf=NULL; + p_vob->divxlogfile=p_pun_buf; + s_cont+=p_pup_area->s_size+sizeof(vob_pack_unpack_t); + p_pup_area=(vob_pack_unpack_t *)(p_buffer+s_cont); /*pointer to the next section*/ + p_pun_buf=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t)); + if (p_pup_area->s_size==1) + p_pun_buf=NULL; + p_vob->lame_preset=p_pun_buf; + s_cont+=p_pup_area->s_size+sizeof(vob_pack_unpack_t); + p_pup_area=(vob_pack_unpack_t *)(p_buffer+s_cont); /*pointer to the next section*/ + p_pun_buf=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t)); + if (p_pup_area->s_size==1) + p_pun_buf=NULL; + p_vob->audiologfile=p_pun_buf; + s_cont+=p_pup_area->s_size+sizeof(vob_pack_unpack_t); + p_pup_area=(vob_pack_unpack_t *)(p_buffer+s_cont); /*pointer to the next section*/ + p_pun_buf=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t)); + if (p_pup_area->s_size==1) + p_pun_buf=NULL; + p_vob->ex_v_fcc=p_pun_buf; + s_cont+=p_pup_area->s_size+sizeof(vob_pack_unpack_t); + p_pup_area=(vob_pack_unpack_t *)(p_buffer+s_cont); /*pointer to the next section*/ + p_pun_buf=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t)); + if (p_pup_area->s_size==1) + p_pun_buf=NULL; + p_vob->ex_a_fcc=p_pun_buf; + s_cont+=p_pup_area->s_size+sizeof(vob_pack_unpack_t); + p_pup_area=(vob_pack_unpack_t *)(p_buffer+s_cont); /*pointer to the next section*/ + p_pun_buf=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t)); + if (p_pup_area->s_size==1) + p_pun_buf=NULL; + p_vob->ex_profile_name=p_pun_buf; + s_cont+=p_pup_area->s_size+sizeof(vob_pack_unpack_t); + p_pup_area=(vob_pack_unpack_t *)(p_buffer+s_cont); /*pointer to the next section*/ + p_pun_buf=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t)); + if (p_pup_area->s_size==1) + p_pun_buf=NULL; + p_vob->mod_path=p_pun_buf; + s_cont+=p_pup_area->s_size+sizeof(vob_pack_unpack_t); + p_pup_area=(vob_pack_unpack_t *)(p_buffer+s_cont); /*pointer to the next section*/ + p_pun_buf=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t)); + if (p_pup_area->s_size==1) + p_pun_buf=NULL; + p_vob->im_v_string=p_pun_buf; + s_cont+=p_pup_area->s_size+sizeof(vob_pack_unpack_t); + p_pup_area=(vob_pack_unpack_t *)(p_buffer+s_cont); /*pointer to the next section*/ + p_pun_buf=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t)); + if (p_pup_area->s_size==1) + p_pun_buf=NULL; + p_vob->im_a_string=p_pun_buf; + s_cont+=p_pup_area->s_size+sizeof(vob_pack_unpack_t); + p_pup_area=(vob_pack_unpack_t *)(p_buffer+s_cont); /*pointer to the next section*/ + p_pun_buf=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t)); + if (p_pup_area->s_size==1) + p_pun_buf=NULL; + p_vob->ex_v_string=p_pun_buf; + s_cont+=p_pup_area->s_size+sizeof(vob_pack_unpack_t); + p_pup_area=(vob_pack_unpack_t *)(p_buffer+s_cont); /*pointer to the next section*/ + p_pun_buf=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t)); + if (p_pup_area->s_size==1) + p_pun_buf=NULL; + p_vob->ex_a_string=p_pun_buf; + s_cont+=p_pup_area->s_size+sizeof(vob_pack_unpack_t); + + /* avifile_in and avifile_out are setting by the export_module*/ + /* ttime not used in export_module*/ + + p_vob->avifile_in=(avi_t *)NULL; + p_vob->avifile_out=(avi_t *)NULL; + p_vob->ttime=NULL; + + return(p_vob); + } + else if(!strcasecmp(p_option,"close")) + { + free(p_buffer); + p_buffer=NULL; + return(NULL); + } + return(NULL); +} diff --git a/debian/transcode/transcode-1.1.7/pvm3/vob_pack_unpack.h b/debian/transcode/transcode-1.1.7/pvm3/vob_pack_unpack.h new file mode 100644 index 00000000..51e9779d --- /dev/null +++ b/debian/transcode/transcode-1.1.7/pvm3/vob_pack_unpack.h @@ -0,0 +1,40 @@ +/* + * vob_pack_unpack.h + * + * Copyright (C) Marzio Malanchini - August 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. + * + */ + + + +#ifndef _VOB_PACK_UNPACK_H +#define _VOB_PACK_UNPACK_H + +#include "transcode.h" + + +typedef struct _vob_pack_unpack_t { + int s_size; + char *p_area; + } vob_pack_unpack_t; + +char *f_vob_pack(char *p_option,vob_t *p_vob,int *p_size); +vob_t *f_vob_unpack(char *p_option,char *p_area,int s_size); + +#endif |
