diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile.am | 10 | ||||
-rw-r--r-- | Makefile.in | 6 | ||||
-rwxr-xr-x | configure | 237 | ||||
-rw-r--r-- | configure.ac | 23 | ||||
-rw-r--r-- | example/Makefile.am | 7 | ||||
-rw-r--r-- | example/Makefile.in | 556 | ||||
-rw-r--r-- | example/decode_filter_encode.c | 364 | ||||
-rw-r--r-- | src/itc.c | 8 | ||||
-rw-r--r-- | src/tuberia.c | 4 | ||||
-rw-r--r-- | src/utils.c | 2 | ||||
-rw-r--r-- | src/utils.h | 2 | ||||
-rw-r--r-- | test/Makefile.am | 5 | ||||
-rw-r--r-- | test/Makefile.in | 44 |
14 files changed, 1217 insertions, 52 deletions
@@ -18,3 +18,4 @@ test/*.log test/*.trs test/test_itc test/test_tuberia +decode_filter_encode diff --git a/Makefile.am b/Makefile.am index b4b5bc3..cc30fa8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1 +1,9 @@ -SUBDIRS = src test +SUBDIRS = src + +if TESTS +SUBDIRS += test +endif +if EXAMPLES +SUBDIRS += example +endif + diff --git a/Makefile.in b/Makefile.in index dd93300..b19d2d5 100644 --- a/Makefile.in +++ b/Makefile.in @@ -85,6 +85,8 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : +@TESTS_TRUE@am__append_1 = test +@EXAMPLES_TRUE@am__append_2 = example subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac @@ -154,7 +156,7 @@ am__define_uniq_tagged_files = \ ETAGS = etags CTAGS = ctags CSCOPE = cscope -DIST_SUBDIRS = $(SUBDIRS) +DIST_SUBDIRS = src test example am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(srcdir)/tuberia.pc.in COPYING INSTALL ar-lib compile depcomp \ install-sh missing @@ -292,7 +294,7 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -SUBDIRS = src test +SUBDIRS = src $(am__append_1) $(am__append_2) all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive @@ -631,6 +631,8 @@ ITCTEST_FALSE ITCTEST_TRUE TESTS_FALSE TESTS_TRUE +EXAMPLES_FALSE +EXAMPLES_TRUE has_valgrind LIBOBJS EGREP @@ -727,10 +729,11 @@ ac_user_opts=' enable_option_checking enable_silent_rules enable_dependency_tracking -enable_valgrind +enable_examples enable_tests enable_itc_test enable_tuberia_test +enable_valgrind ' ac_precious_vars='build_alias host_alias @@ -1361,10 +1364,11 @@ Optional Features: do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build - --disable-valgrind Disable the use of valgrind in tests + --disable-examples Disable all examples --disable-tests Disable all tests --disable-itc-test Disable ITC test --disable-tuberia-test Disable Tuberia test + --disable-valgrind Disable the use of valgrind in tests Some influential environment variables: CC C compiler command @@ -4167,6 +4171,175 @@ _ACEOF fi +has_ffmpeg=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for avcodec_version in -lavcodec" >&5 +$as_echo_n "checking for avcodec_version in -lavcodec... " >&6; } +if ${ac_cv_lib_avcodec_avcodec_version+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lavcodec $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char avcodec_version (); +int +main () +{ +return avcodec_version (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_avcodec_avcodec_version=yes +else + ac_cv_lib_avcodec_avcodec_version=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_avcodec_avcodec_version" >&5 +$as_echo "$ac_cv_lib_avcodec_avcodec_version" >&6; } +if test "x$ac_cv_lib_avcodec_avcodec_version" = xyes; then : + has_avcodec=yes +else + has_avcodec=no +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for avformat_version in -lavformat" >&5 +$as_echo_n "checking for avformat_version in -lavformat... " >&6; } +if ${ac_cv_lib_avformat_avformat_version+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lavformat $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char avformat_version (); +int +main () +{ +return avformat_version (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_avformat_avformat_version=yes +else + ac_cv_lib_avformat_avformat_version=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_avformat_avformat_version" >&5 +$as_echo "$ac_cv_lib_avformat_avformat_version" >&6; } +if test "x$ac_cv_lib_avformat_avformat_version" = xyes; then : + has_avformat=yes +else + has_avformat=no +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for avutil_version in -lavutil" >&5 +$as_echo_n "checking for avutil_version in -lavutil... " >&6; } +if ${ac_cv_lib_avutil_avutil_version+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lavutil $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char avutil_version (); +int +main () +{ +return avutil_version (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_avutil_avutil_version=yes +else + ac_cv_lib_avutil_avutil_version=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_avutil_avutil_version" >&5 +$as_echo "$ac_cv_lib_avutil_avutil_version" >&6; } +if test "x$ac_cv_lib_avutil_avutil_version" = xyes; then : + has_avutil=yes +else + has_avutil=no +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for swscale_version in -lswscale" >&5 +$as_echo_n "checking for swscale_version in -lswscale... " >&6; } +if ${ac_cv_lib_swscale_swscale_version+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lswscale $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char swscale_version (); +int +main () +{ +return swscale_version (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_swscale_swscale_version=yes +else + ac_cv_lib_swscale_swscale_version=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_swscale_swscale_version" >&5 +$as_echo "$ac_cv_lib_swscale_swscale_version" >&6; } +if test "x$ac_cv_lib_swscale_swscale_version" = xyes; then : + has_swscale=yes +else + has_swscale=no +fi + # Checks for header files. ac_ext=c @@ -4701,11 +4874,11 @@ fi -# Check whether --enable-valgrind was given. -if test "${enable_valgrind+set}" = set; then : - enableval=$enable_valgrind; +# Check whether --enable-examples was given. +if test "${enable_examples+set}" = set; then : + enableval=$enable_examples; else - enable_valgrind="yes" + enable_examples="yes" fi # Check whether --enable-tests was given. @@ -4729,12 +4902,39 @@ else enable_tuberia_test="yes" fi +# Check whether --enable-valgrind was given. +if test "${enable_valgrind+set}" = set; then : + enableval=$enable_valgrind; +else + enable_valgrind="yes" +fi + if test "x$has_valgrind" = xyes; then : else enable_valgrind=no fi +if test "x$has_avcodec" = xno; then : + enable_examples=no +fi +if test "x$has_avformat" = xno; then : + enable_examples=no +fi +if test "x$has_avutil" = xno; then : + enable_examples=no +fi +if test "x$has_swscale" = xno; then : + enable_examples=no +fi + + if test x$enable_examples = xyes; then + EXAMPLES_TRUE= + EXAMPLES_FALSE='#' +else + EXAMPLES_TRUE='#' + EXAMPLES_FALSE= +fi if test x$enable_tests = xyes; then TESTS_TRUE= @@ -4769,7 +4969,7 @@ else fi -ac_config_files="$ac_config_files Makefile src/Makefile test/Makefile tuberia.pc" +ac_config_files="$ac_config_files Makefile src/Makefile test/Makefile example/Makefile tuberia.pc" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -4904,6 +5104,10 @@ if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${EXAMPLES_TRUE}" && test -z "${EXAMPLES_FALSE}"; then + as_fn_error $? "conditional \"EXAMPLES\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${TESTS_TRUE}" && test -z "${TESTS_FALSE}"; then as_fn_error $? "conditional \"TESTS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -5517,6 +5721,7 @@ do "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;; + "example/Makefile") CONFIG_FILES="$CONFIG_FILES example/Makefile" ;; "tuberia.pc") CONFIG_FILES="$CONFIG_FILES tuberia.pc" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; @@ -6250,18 +6455,28 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: has valgrind: $has_valgrind" >&5 $as_echo "$as_me: has valgrind: $has_valgrind" >&6;} -{ $as_echo "$as_me:${as_lineno-$LINENO}: enable valgrind: $enable_valgrind" >&5 -$as_echo "$as_me: enable valgrind: $enable_valgrind" >&6;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: has avcodec: $has_avcodec" >&5 +$as_echo "$as_me: has avcodec: $has_avcodec" >&6;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: has avformat: $has_avformat" >&5 +$as_echo "$as_me: has avformat: $has_avformat" >&6;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: has avutil: $has_avutil" >&5 +$as_echo "$as_me: has avutil: $has_avutil" >&6;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: has swscale: $has_swscale" >&5 +$as_echo "$as_me: has swscale: $has_swscale" >&6;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: enable examples: $enable_examples" >&5 +$as_echo "$as_me: enable examples: $enable_examples" >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: enable tests: $enable_tests" >&5 $as_echo "$as_me: enable tests: $enable_tests" >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: enable itc tests: $enable_itc_test" >&5 $as_echo "$as_me: enable itc tests: $enable_itc_test" >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: enable tuberia tests: $enable_tuberia_test" >&5 $as_echo "$as_me: enable tuberia tests: $enable_tuberia_test" >&6;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: enable valgrind: $enable_valgrind" >&5 +$as_echo "$as_me: enable valgrind: $enable_valgrind" >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: prefix: $prefix" >&5 $as_echo "$as_me: prefix: $prefix" >&6;} -{ $as_echo "$as_me:${as_lineno-$LINENO}: exec_prefix: $execprefix" >&5 -$as_echo "$as_me: exec_prefix: $execprefix" >&6;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: exec_prefix: $exec_prefix" >&5 +$as_echo "$as_me: exec_prefix: $exec_prefix" >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: libdir: $libdir" >&5 $as_echo "$as_me: libdir: $libdir" >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: includedir: $includedir" >&5 diff --git a/configure.ac b/configure.ac index 002d050..b47529b 100644 --- a/configure.ac +++ b/configure.ac @@ -20,6 +20,11 @@ AC_SUBST([AM_CFLAGS]) # Checks for libraries. AC_CHECK_LIB([pthread], [pthread_self]) +AS_VAR_SET([has_ffmpeg], [yes]) +AC_CHECK_LIB([avcodec], [avcodec_version], [AS_VAR_SET([has_avcodec], [yes])], [AS_VAR_SET([has_avcodec], [no])]) +AC_CHECK_LIB([avformat], [avformat_version], [AS_VAR_SET([has_avformat], [yes])], [AS_VAR_SET([has_avformat], [no])]) +AC_CHECK_LIB([avutil], [avutil_version], [AS_VAR_SET([has_avutil], [yes])], [AS_VAR_SET([has_avutil], [no])]) +AC_CHECK_LIB([swscale], [swscale_version], [AS_VAR_SET([has_swscale], [yes])], [AS_VAR_SET([has_swscale], [no])]) # Checks for header files. AC_CHECK_HEADERS([stdlib.h sys/time.h]) @@ -32,13 +37,19 @@ AC_CHECK_FUNCS([gettimeofday]) AC_CHECK_PROG([has_valgrind], [valgrind], [yes], [no]) -AC_ARG_ENABLE([valgrind], AS_HELP_STRING([--disable-valgrind], [Disable the use of valgrind in tests]), [], [enable_valgrind="yes"]) +AC_ARG_ENABLE([examples], AS_HELP_STRING([--disable-examples], [Disable all examples]), [], [enable_examples="yes"]) AC_ARG_ENABLE([tests], AS_HELP_STRING([--disable-tests], [Disable all tests]), [], [enable_tests="yes"]) AC_ARG_ENABLE([itc-test], AS_HELP_STRING([--disable-itc-test], [Disable ITC test]), [], [enable_itc_test="yes"]) AC_ARG_ENABLE([tuberia-test], AS_HELP_STRING([--disable-tuberia-test], [Disable Tuberia test]), [], [enable_tuberia_test="yes"]) +AC_ARG_ENABLE([valgrind], AS_HELP_STRING([--disable-valgrind], [Disable the use of valgrind in tests]), [], [enable_valgrind="yes"]) AS_VAR_IF([has_valgrind], [yes], [], [AS_VAR_SET([enable_valgrind], [no])]) +AS_VAR_IF([has_avcodec], [no], [AS_VAR_SET([enable_examples], [no])], []) +AS_VAR_IF([has_avformat], [no], [AS_VAR_SET([enable_examples], [no])], []) +AS_VAR_IF([has_avutil], [no], [AS_VAR_SET([enable_examples], [no])], []) +AS_VAR_IF([has_swscale], [no], [AS_VAR_SET([enable_examples], [no])], []) +AM_CONDITIONAL([EXAMPLES], [test x$enable_examples = xyes]) AM_CONDITIONAL([TESTS], [test x$enable_tests = xyes]) AM_CONDITIONAL([ITCTEST], [test x$enable_itc_test = xyes]) AM_CONDITIONAL([TUBERIATEST], [test x$enable_tuberia_test = xyes]) @@ -47,16 +58,22 @@ AM_CONDITIONAL([VALGRIND], [test x$enable_valgrind = xyes]) AC_CONFIG_FILES([Makefile src/Makefile test/Makefile + example/Makefile tuberia.pc]) AC_OUTPUT AC_MSG_NOTICE([has valgrind: $has_valgrind]) -AC_MSG_NOTICE([enable valgrind: $enable_valgrind]) +AC_MSG_NOTICE([has avcodec: $has_avcodec]) +AC_MSG_NOTICE([has avformat: $has_avformat]) +AC_MSG_NOTICE([has avutil: $has_avutil]) +AC_MSG_NOTICE([has swscale: $has_swscale]) +AC_MSG_NOTICE([enable examples: $enable_examples]) AC_MSG_NOTICE([enable tests: $enable_tests]) AC_MSG_NOTICE([enable itc tests: $enable_itc_test]) AC_MSG_NOTICE([enable tuberia tests: $enable_tuberia_test]) +AC_MSG_NOTICE([enable valgrind: $enable_valgrind]) AC_MSG_NOTICE([prefix: $prefix]) -AC_MSG_NOTICE([exec_prefix: $execprefix]) +AC_MSG_NOTICE([exec_prefix: $exec_prefix]) AC_MSG_NOTICE([libdir: $libdir]) AC_MSG_NOTICE([includedir: $includedir]) diff --git a/example/Makefile.am b/example/Makefile.am new file mode 100644 index 0000000..f7bee12 --- /dev/null +++ b/example/Makefile.am @@ -0,0 +1,7 @@ +noinst_PROGRAMS = decode_filter_encode + +decode_filter_encode_CFLAGS = $(AM_CFLAGS) -I../src +decode_filter_encode_LDADD = ../src/libtuberia.a +decode_filter_encode_LDFLAGS = -lpthread -lavcodec -lavformat -lavutil -lswscale +decode_filter_encode_SOURCES = decode_filter_encode.c + diff --git a/example/Makefile.in b/example/Makefile.in new file mode 100644 index 0000000..6cdb8cf --- /dev/null +++ b/example/Makefile.in @@ -0,0 +1,556 @@ +# Makefile.in generated by automake 1.16.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2020 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@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +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 = : +noinst_PROGRAMS = decode_filter_encode$(EXEEXT) +subdir = example +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +PROGRAMS = $(noinst_PROGRAMS) +am_decode_filter_encode_OBJECTS = \ + decode_filter_encode-decode_filter_encode.$(OBJEXT) +decode_filter_encode_OBJECTS = $(am_decode_filter_encode_OBJECTS) +decode_filter_encode_DEPENDENCIES = ../src/libtuberia.a +decode_filter_encode_LINK = $(CCLD) $(decode_filter_encode_CFLAGS) \ + $(CFLAGS) $(decode_filter_encode_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = \ + ./$(DEPDIR)/decode_filter_encode-decode_filter_encode.Po +am__mv = mv -f +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(decode_filter_encode_SOURCES) +DIST_SOURCES = $(decode_filter_encode_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_CFLAGS = @AM_CFLAGS@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +OBJEXT = @OBJEXT@ +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@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +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@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build_alias = @build_alias@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +has_valgrind = @has_valgrind@ +host_alias = @host_alias@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +decode_filter_encode_CFLAGS = $(AM_CFLAGS) -I../src +decode_filter_encode_LDADD = ../src/libtuberia.a +decode_filter_encode_LDFLAGS = -lpthread -lavcodec -lavformat -lavutil -lswscale +decode_filter_encode_SOURCES = decode_filter_encode.c +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: $(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) --foreign example/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign example/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__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstPROGRAMS: + -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) + +decode_filter_encode$(EXEEXT): $(decode_filter_encode_OBJECTS) $(decode_filter_encode_DEPENDENCIES) $(EXTRA_decode_filter_encode_DEPENDENCIES) + @rm -f decode_filter_encode$(EXEEXT) + $(AM_V_CCLD)$(decode_filter_encode_LINK) $(decode_filter_encode_OBJECTS) $(decode_filter_encode_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/decode_filter_encode-decode_filter_encode.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +decode_filter_encode-decode_filter_encode.o: decode_filter_encode.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(decode_filter_encode_CFLAGS) $(CFLAGS) -MT decode_filter_encode-decode_filter_encode.o -MD -MP -MF $(DEPDIR)/decode_filter_encode-decode_filter_encode.Tpo -c -o decode_filter_encode-decode_filter_encode.o `test -f 'decode_filter_encode.c' || echo '$(srcdir)/'`decode_filter_encode.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/decode_filter_encode-decode_filter_encode.Tpo $(DEPDIR)/decode_filter_encode-decode_filter_encode.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='decode_filter_encode.c' object='decode_filter_encode-decode_filter_encode.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(decode_filter_encode_CFLAGS) $(CFLAGS) -c -o decode_filter_encode-decode_filter_encode.o `test -f 'decode_filter_encode.c' || echo '$(srcdir)/'`decode_filter_encode.c + +decode_filter_encode-decode_filter_encode.obj: decode_filter_encode.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(decode_filter_encode_CFLAGS) $(CFLAGS) -MT decode_filter_encode-decode_filter_encode.obj -MD -MP -MF $(DEPDIR)/decode_filter_encode-decode_filter_encode.Tpo -c -o decode_filter_encode-decode_filter_encode.obj `if test -f 'decode_filter_encode.c'; then $(CYGPATH_W) 'decode_filter_encode.c'; else $(CYGPATH_W) '$(srcdir)/decode_filter_encode.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/decode_filter_encode-decode_filter_encode.Tpo $(DEPDIR)/decode_filter_encode-decode_filter_encode.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='decode_filter_encode.c' object='decode_filter_encode-decode_filter_encode.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(decode_filter_encode_CFLAGS) $(CFLAGS) -c -o decode_filter_encode-decode_filter_encode.obj `if test -f 'decode_filter_encode.c'; then $(CYGPATH_W) 'decode_filter_encode.c'; else $(CYGPATH_W) '$(srcdir)/decode_filter_encode.c'; fi` + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + 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-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + 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" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) +installdirs: +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: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +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-generic clean-noinstPROGRAMS mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/decode_filter_encode-decode_filter_encode.Po + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-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 -f ./$(DEPDIR)/decode_filter_encode-decode_filter_encode.Po + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-noinstPROGRAMS cscopelist-am ctags \ + ctags-am distclean distclean-compile distclean-generic \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# 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/example/decode_filter_encode.c b/example/decode_filter_encode.c new file mode 100644 index 0000000..48f31a7 --- /dev/null +++ b/example/decode_filter_encode.c @@ -0,0 +1,364 @@ +#include <bits/pthreadtypes.h> +#include <inttypes.h> +#include <libavcodec/avcodec.h> +#include <libavfilter/avfilter.h> +#include <libavformat/avformat.h> +#include <libavutil/pixdesc.h> +#include <libswscale/swscale.h> +#include <stdio.h> +#include <stdlib.h> +#include <tuberia.h> +#include <unistd.h> + +const char *optstring = "hi:o:s:T"; + +static void printhelp(const char *argv0) +{ + printf( + "%s -i <input> -o <output> -s <size> [-T]\n" + "%s -h\n" + "\n" + " -i input the input file\n" + " -o output the output file\n" + " -s WIDTHxHEIGHT the size to scale the video\n" + " -T don't use libtuberia\n" + " -h print this help\n", argv0, argv0); +} + +static void close_codec(AVCodecContext **ctx) +{ + avcodec_free_context(ctx); +} + +static void close_input(AVFormatContext **ctx) +{ + avformat_close_input(ctx); +} + +static int open_input(AVFormatContext **avformatin, AVCodecContext **avcodecin, + const char *file) +{ + AVFormatContext *ctx = NULL; + AVCodec *codec = NULL; + int i = 0; + + if (avformatin == NULL || avcodecin == NULL || file == NULL || !file[0]) { + return -1; + } + + printf("Opening input file %s\n", file); + if (avformat_open_input(&ctx, file, NULL, NULL)) { + return -1; + } + printf("Parsing input file %s\n", file); + if (avformat_find_stream_info(ctx, NULL) < 0) { + close_input(&ctx); + return -1; + } + + for (i = 0; i < (int)ctx->nb_streams; i++) { + if (ctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { + codec = avcodec_find_decoder(ctx->streams[i]->codecpar->codec_id); + if (codec == NULL) { + fprintf(stderr, "Couldn't find decoder for codec id %d (%s)\n", + ctx->streams[i]->codecpar->codec_id, + avcodec_get_name(ctx->streams[i]->codecpar->codec_id)); + close_input(&ctx); + return -1; + } + printf("Opening input codec %s (%d)\n", avcodec_get_name(codec->id), + codec->id); + *avcodecin = avcodec_alloc_context3(codec); + avcodec_parameters_to_context(*avcodecin, ctx->streams[i]->codecpar); + (*avcodecin)->time_base = ctx->streams[i]->time_base; + if (avcodec_open2(*avcodecin, codec, NULL) < 0) { + fprintf(stderr, "Couldn't open codec %d (%s)\n", + ctx->streams[i]->codecpar->codec_id, + avcodec_get_name(ctx->streams[i]->codecpar->codec_id)); + close_input(&ctx); + close_codec(avcodecin); + return -1; + } + break; + } + } + + *avformatin = ctx; + + return 0; +} + +static void close_sws(struct SwsContext **ctx) +{ + sws_freeContext(*ctx); + *ctx = NULL; +} + +static void close_output(AVFormatContext **ctx) +{ + av_write_trailer(*ctx); + avformat_flush(*ctx); + avio_closep(&(*ctx)->pb); + avformat_free_context(*ctx); + *ctx = NULL; +} + +static int open_output(AVFormatContext **avformatout, + AVCodecContext **avcodecout, struct SwsContext **sws, const char *file, + const AVFormatContext *input, int width, int height) +{ + AVFormatContext *ctx = NULL; + int i = 0; + const AVCodec *codec = NULL; + const AVCodecParameters *codecparin = NULL; + AVStream *stream = NULL; + + if (avformatout == NULL || avcodecout == NULL || input == NULL + || file == NULL || !file[0]) { + return -1; + } + printf("Opening output file %s\n", file); + if (avformat_alloc_output_context2(&ctx, NULL, NULL, file) < 0 + || ctx == NULL) { + return -1; + } + + for (i = 0; i < (int)input->nb_streams; i++) { + codecparin = input->streams[i]->codecpar; + codec = avcodec_find_encoder(codecparin->codec_id); + if (codec == NULL) { + fprintf(stderr, "Couldn't find encoder for codec id %d (%s)\n", + codecparin->codec_id, avcodec_get_name(codecparin->codec_id)); + close_output(&ctx); + return -1; + } + printf("Opening output codec %s (%d)\n", avcodec_get_name(codec->id), + codec->id); + stream = avformat_new_stream(ctx, codec); + avcodec_parameters_copy(stream->codecpar, codecparin); + stream->time_base = input->streams[i]->time_base; + if (stream->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { + stream->codecpar->width = width; + stream->codecpar->height = height; + } + if (stream->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { + *avcodecout = avcodec_alloc_context3(codec); + avcodec_parameters_to_context(*avcodecout, stream->codecpar); + (*avcodecout)->time_base = stream->time_base; + if (avcodec_open2(*avcodecout, codec, NULL) < 0) { + fprintf(stderr, "Couldn't open codec %s (%d)\n", + avcodec_get_name(codecparin->codec_id), + codecparin->codec_id); + close_output(&ctx); + close_codec(avcodecout); + return -1; + } + printf("Opening resize context %dx%d %s -> %dx%d %s\n", + codecparin->width, codecparin->height, + av_get_pix_fmt_name((enum AVPixelFormat)codecparin->format), + stream->codecpar->width, stream->codecpar->height, + av_get_pix_fmt_name((enum AVPixelFormat)stream->codecpar->format)); + *sws = sws_getContext(codecparin->width, codecparin->height, + (enum AVPixelFormat)codecparin->format, + stream->codecpar->width, stream->codecpar->height, + (enum AVPixelFormat)stream->codecpar->format, + SWS_GAUSS, NULL, NULL, NULL); + if (*sws == NULL) { + fprintf(stderr, "Couldn't open resize context %dx%d %s -> %dx%d %s\n", + codecparin->width, codecparin->height, + av_get_pix_fmt_name((enum AVPixelFormat)codecparin->format), + stream->codecpar->width, stream->codecpar->height, + av_get_pix_fmt_name((enum AVPixelFormat)stream->codecpar->format)); + close_output(&ctx); + close_codec(avcodecout); + close_sws(sws); + } + } + } + + if (!(ctx->flags & AVFMT_NOFILE)) { + int ret = avio_open(&ctx->pb, file, AVIO_FLAG_WRITE); + if (ret < 0) { + fprintf(stderr, "Couldn't create output file %s %s (%d)\n", file, + av_err2str(ret), ret); + close_output(&ctx); + close_codec(avcodecout); + close_sws(sws); + return -1; + } + } + if (avformat_write_header(ctx, NULL) < 0) { + fprintf(stderr, "Couldn't write header to output file %s\n", file); + } + *avformatout = ctx; + return 0; +} + +static void do_tuberia(AVFormatContext *avformatin, AVCodecContext *avcodecin, + AVFormatContext *avformatout, struct SwsContext *sws, + AVCodecContext *avcodecout) +{ + //TODO + (void)avformatin; + (void)avcodecin; + (void)avformatout; + (void)avcodecout; + (void)sws; + printf("Starting to transcode with libtuberia\n"); + printf("Transcode with libtuberia finished\n"); +} + +static int decode_packet(AVCodecContext *ctx, AVPacket *packet, AVFrame *frame) +{ + int ret = 0; + ret = avcodec_send_packet(ctx, packet); + av_packet_unref(packet); + if (!ret) { + ret = avcodec_receive_frame(ctx, frame); + } else { + fprintf(stderr, "Couldn't decode video packet\n"); + } + + return ret; +} + +static int scale_frame(struct SwsContext *sws, AVFrame *frame, AVFrame *scaled, + int width, int height, enum AVPixelFormat pix_fmt) +{ + av_frame_copy_props(scaled, frame); + scaled->width = width; + scaled->height = height; + scaled->format = pix_fmt; + av_frame_get_buffer(scaled, 0); + sws_scale(sws, (const uint8_t * const *)frame->data, frame->linesize, + 0, frame->height, scaled->data, scaled->linesize); + av_frame_unref(frame); + + return 0; +} + +static int encode_frame(AVCodecContext *ctx, AVFrame *frame, AVPacket *packet) +{ + int ret = 0; + + ret = avcodec_send_frame(ctx, frame); + av_frame_unref(frame); + if (!ret) { + ret = avcodec_receive_packet(ctx, packet); + } else { + fprintf(stderr, "Couldn't encode video packet\n"); + } + + return ret; +} + +static void do_no_tuberia(AVFormatContext *avformatin, AVCodecContext *avcodecin, + AVFormatContext *avformatout, struct SwsContext *sws, + AVCodecContext *avcodecout) +{ + AVPacket *packet = NULL; + AVFrame *frame = NULL; + AVFrame *scaled = NULL; + int idx = 0; + + printf("Starting to transcode without libtuberia\n"); + + packet = av_packet_alloc(); + frame = av_frame_alloc(); + scaled = av_frame_alloc(); + while (!av_read_frame(avformatin, packet)) { + idx = packet->stream_index; + if (avformatin->streams[idx]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { + if (decode_packet(avcodecin, packet, frame)) { + continue; + } + scale_frame(sws, frame, scaled, avcodecout->width, + avcodecout->height, avcodecout->pix_fmt); + if (encode_frame(avcodecout, scaled, packet)) { + continue; + } + packet->stream_index = idx; + } + av_packet_rescale_ts(packet, avformatin->streams[idx]->time_base, + avformatout->streams[idx]->time_base); + av_interleaved_write_frame(avformatout, packet); + } + av_packet_free(&packet); + av_frame_free(&frame); + av_frame_free(&scaled); + + printf("Transcode without libtuberia finished\n"); +} + +int main(int argc, char **argv) +{ + int c = 0; + char *input = NULL; + char *output = NULL; + int width = 720; + int height = 404; + int notuberia = 0; + AVFormatContext *avformatin = NULL; + AVFormatContext *avformatout = NULL; + AVCodecContext *avcodecin = NULL; + AVCodecContext *avcodecout = NULL; + struct SwsContext *sws = NULL; + + while ((c = getopt(argc, argv, optstring)) >= 0) { + switch (c) { + case 'h': + printhelp(argv[0]); + return 0; + break; + case 'i': + input = optarg; + break; + case 'o': + output = optarg; + break; + case 's': + if (sscanf(optarg, "%dx%d", &width, &height) != 2) { + fprintf(stderr, "Size parameter must be WxH, instead it is %s\n", + optarg); + return -1; + } + break; + case 'T': + notuberia = 1; + break; + case '?': + default: + fprintf(stderr, "Incorrect arguments. Run %s -h\n", argv[0]); + return -1; + } + } + if (input == NULL || !input[0]) { + printhelp(argv[0]); + return -1; + } + + if (open_input(&avformatin, &avcodecin, input) < 0) { + fprintf(stderr, "Couldn't open input %s\n", input); + return -1; + } + if (open_output(&avformatout, &avcodecout, &sws, output, avformatin, width, + height) < 0) { + fprintf(stderr, "Couldn't initiate output %s\n", output); + return -1; + } + + if (notuberia) { + do_no_tuberia(avformatin, avcodecin, avformatout, sws, avcodecout); + } else { + do_tuberia(avformatin, avcodecin, avformatout, sws, avcodecout); + } + + close_input(&avformatin); + close_output(&avformatout); + close_codec(&avcodecin); + close_codec(&avcodecout); + close_sws(&sws); + + return 0; +} + @@ -24,7 +24,7 @@ itc *itc_alloc(int nslots) ctx = calloc(1, sizeof(*ctx)); ctx->nslots = nslots; - ctx->slots = calloc(nslots, sizeof(*ctx->slots)); + ctx->slots = (void **)calloc(nslots, sizeof(*ctx->slots)); sem_init(&ctx->emptied, 0, nslots); sem_init(&ctx->occupied, 0, 0); @@ -41,7 +41,7 @@ void itc_free(itc **ctx, itc_free_element free_element) sem_destroy(&(*ctx)->emptied); sem_destroy(&(*ctx)->occupied); - free((*ctx)->slots); + free((void *)(*ctx)->slots); free(*ctx); *ctx = NULL; } @@ -55,7 +55,7 @@ void *itc_retrive(itc *ctx, int timeout_ms) return NULL; } - timespec_add_ms(gettimespec(&ts), timeout_ms); + timespec_add_ms(get_timespec(&ts), timeout_ms); if (sem_timedwait(&ctx->occupied, &ts)) { return NULL; @@ -75,7 +75,7 @@ int itc_inject(itc *ctx, int timeout_ms, void *element) return -1; } - timespec_add_ms(gettimespec(&ts), timeout_ms); + timespec_add_ms(get_timespec(&ts), timeout_ms); if (sem_timedwait(&ctx->emptied, &ts)) { return -1; diff --git a/src/tuberia.c b/src/tuberia.c index d8b5688..d9af3c8 100644 --- a/src/tuberia.c +++ b/src/tuberia.c @@ -148,8 +148,8 @@ tube *tube_alloc(const tube_source *source, tube_sink sink, void *opaque) for (ctx->nitcs = 1, s = source->next; s != NULL; ctx->nitcs++) { s = s->next; } - ctx->itcs = calloc(ctx->nitcs, sizeof(itc *)); - ctx->free_element = calloc(ctx->nitcs, sizeof(tube_free_element)); + ctx->itcs = (struct itc **)calloc(ctx->nitcs, sizeof(itc *)); + ctx->free_element = (tube_free_element *)calloc(ctx->nitcs, sizeof(tube_free_element)); ctx->itcs[0] = itc_alloc(source->nslots); ctx->free_element[0] = source->free_element; for (i = 1, s = source->next; s != NULL; s = s->next, i++) { diff --git a/src/utils.c b/src/utils.c index 6b2ff46..23adc5c 100644 --- a/src/utils.c +++ b/src/utils.c @@ -18,7 +18,7 @@ struct timespec *timespec_add_ms(struct timespec *ts, int timeout_ms) return ts; } -struct timespec *gettimespec(struct timespec *ts) +struct timespec *get_timespec(struct timespec *ts) { struct timeval tv; diff --git a/src/utils.h b/src/utils.h index 0fde429..d72cc00 100644 --- a/src/utils.h +++ b/src/utils.h @@ -4,7 +4,7 @@ #include <sys/time.h> struct timespec *timespec_add_ms(struct timespec *ts, int timeout_ms); -struct timespec *gettimespec(struct timespec *ts); +struct timespec *get_timespec(struct timespec *ts); #endif //LIBTUBERIA_UTILS_H__ diff --git a/test/Makefile.am b/test/Makefile.am index 4800141..b5d4e28 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -2,8 +2,6 @@ check_PROGRAMS = TESTS = check_HEADERS = test.h -if TESTS - if ITCTEST check_PROGRAMS += test_itc if VALGRIND @@ -11,6 +9,7 @@ TESTS += test_itc_valgrind else TESTS += test_itc endif + test_itc_SOURCES = test_itc.c test.h test_itc_LDADD = ../src/libtuberia.a test_itc_LDFLAGS = -lpthread @@ -29,5 +28,3 @@ test_tuberia_LDADD = ../src/libtuberia.a test_tuberia_LDFLAGS = -lpthread endif -endif - diff --git a/test/Makefile.in b/test/Makefile.in index 72afc44..87eefea 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -88,12 +88,12 @@ POST_UNINSTALL = : check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) TESTS = $(am__append_2) $(am__EXEEXT_3) $(am__append_5) \ $(am__EXEEXT_4) -@ITCTEST_TRUE@@TESTS_TRUE@am__append_1 = test_itc -@ITCTEST_TRUE@@TESTS_TRUE@@VALGRIND_TRUE@am__append_2 = test_itc_valgrind -@ITCTEST_TRUE@@TESTS_TRUE@@VALGRIND_FALSE@am__append_3 = test_itc -@TESTS_TRUE@@TUBERIATEST_TRUE@am__append_4 = test_tuberia -@TESTS_TRUE@@TUBERIATEST_TRUE@@VALGRIND_TRUE@am__append_5 = test_tuberia_valgrind -@TESTS_TRUE@@TUBERIATEST_TRUE@@VALGRIND_FALSE@am__append_6 = test_tuberia +@ITCTEST_TRUE@am__append_1 = test_itc +@ITCTEST_TRUE@@VALGRIND_TRUE@am__append_2 = test_itc_valgrind +@ITCTEST_TRUE@@VALGRIND_FALSE@am__append_3 = test_itc +@TUBERIATEST_TRUE@am__append_4 = test_tuberia +@TUBERIATEST_TRUE@@VALGRIND_TRUE@am__append_5 = test_tuberia_valgrind +@TUBERIATEST_TRUE@@VALGRIND_FALSE@am__append_6 = test_tuberia subdir = test ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac @@ -105,20 +105,18 @@ mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = -@ITCTEST_TRUE@@TESTS_TRUE@am__EXEEXT_1 = test_itc$(EXEEXT) -@TESTS_TRUE@@TUBERIATEST_TRUE@am__EXEEXT_2 = test_tuberia$(EXEEXT) +@ITCTEST_TRUE@am__EXEEXT_1 = test_itc$(EXEEXT) +@TUBERIATEST_TRUE@am__EXEEXT_2 = test_tuberia$(EXEEXT) am__test_itc_SOURCES_DIST = test_itc.c test.h -@ITCTEST_TRUE@@TESTS_TRUE@am_test_itc_OBJECTS = test_itc.$(OBJEXT) +@ITCTEST_TRUE@am_test_itc_OBJECTS = test_itc.$(OBJEXT) test_itc_OBJECTS = $(am_test_itc_OBJECTS) -@ITCTEST_TRUE@@TESTS_TRUE@test_itc_DEPENDENCIES = ../src/libtuberia.a +@ITCTEST_TRUE@test_itc_DEPENDENCIES = ../src/libtuberia.a test_itc_LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(test_itc_LDFLAGS) \ $(LDFLAGS) -o $@ am__test_tuberia_SOURCES_DIST = test_tuberia.c test.h -@TESTS_TRUE@@TUBERIATEST_TRUE@am_test_tuberia_OBJECTS = \ -@TESTS_TRUE@@TUBERIATEST_TRUE@ test_tuberia.$(OBJEXT) +@TUBERIATEST_TRUE@am_test_tuberia_OBJECTS = test_tuberia.$(OBJEXT) test_tuberia_OBJECTS = $(am_test_tuberia_OBJECTS) -@TESTS_TRUE@@TUBERIATEST_TRUE@test_tuberia_DEPENDENCIES = \ -@TESTS_TRUE@@TUBERIATEST_TRUE@ ../src/libtuberia.a +@TUBERIATEST_TRUE@test_tuberia_DEPENDENCIES = ../src/libtuberia.a test_tuberia_LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(test_tuberia_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) @@ -362,9 +360,9 @@ am__set_TESTS_bases = \ bases=`echo $$bases` RECHECK_LOGS = $(TEST_LOGS) AM_RECURSIVE_TARGETS = check recheck -@ITCTEST_TRUE@@TESTS_TRUE@@VALGRIND_FALSE@am__EXEEXT_3 = \ -@ITCTEST_TRUE@@TESTS_TRUE@@VALGRIND_FALSE@ test_itc$(EXEEXT) -@TESTS_TRUE@@TUBERIATEST_TRUE@@VALGRIND_FALSE@am__EXEEXT_4 = test_tuberia$(EXEEXT) +@ITCTEST_TRUE@@VALGRIND_FALSE@am__EXEEXT_3 = test_itc$(EXEEXT) +@TUBERIATEST_TRUE@@VALGRIND_FALSE@am__EXEEXT_4 = \ +@TUBERIATEST_TRUE@@VALGRIND_FALSE@ test_tuberia$(EXEEXT) TEST_SUITE_LOG = test-suite.log TEST_EXTENSIONS = @EXEEXT@ .test LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver @@ -481,12 +479,12 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ check_HEADERS = test.h -@ITCTEST_TRUE@@TESTS_TRUE@test_itc_SOURCES = test_itc.c test.h -@ITCTEST_TRUE@@TESTS_TRUE@test_itc_LDADD = ../src/libtuberia.a -@ITCTEST_TRUE@@TESTS_TRUE@test_itc_LDFLAGS = -lpthread -@TESTS_TRUE@@TUBERIATEST_TRUE@test_tuberia_SOURCES = test_tuberia.c test.h -@TESTS_TRUE@@TUBERIATEST_TRUE@test_tuberia_LDADD = ../src/libtuberia.a -@TESTS_TRUE@@TUBERIATEST_TRUE@test_tuberia_LDFLAGS = -lpthread +@ITCTEST_TRUE@test_itc_SOURCES = test_itc.c test.h +@ITCTEST_TRUE@test_itc_LDADD = ../src/libtuberia.a +@ITCTEST_TRUE@test_itc_LDFLAGS = -lpthread +@TUBERIATEST_TRUE@test_tuberia_SOURCES = test_tuberia.c test.h +@TUBERIATEST_TRUE@test_tuberia_LDADD = ../src/libtuberia.a +@TUBERIATEST_TRUE@test_tuberia_LDFLAGS = -lpthread all: all-am .SUFFIXES: |