diff --git a/.github/workflows/binaries.yml b/.github/workflows/binaries.yml index 3973779cf9..3a2c744950 100644 --- a/.github/workflows/binaries.yml +++ b/.github/workflows/binaries.yml @@ -1,9 +1,9 @@ name: Binaries on: push: - branches: [ master ] + branches: [ master, next ] pull_request: - branches: [ master ] + branches: [ master, next ] jobs: build: @@ -16,29 +16,29 @@ jobs: fetch-depth: '0' - name: Build x64 run: | - ./configure --enable-static + ./configure --enable-static CC="clang -static" --disable-netcv make DDCI=1 zip -9 -r /minisatip_x64.zip minisatip html - name: Build ARM run: | make clean - ./configure --enable-static --host=arm-linux-gnueabihf + ./configure --disable-netcv --enable-static --host=arm-linux-gnueabihf CC="clang -target arm-linux-gnueabihf -static" make zip -9 -r /minisatip_arm.zip minisatip html - name: Build AXE run: | make clean - ./configure --disable-dvbapi --enable-static --host=sh4-linux --disable-dvbaes --disable-dvbca --enable-axe + ./configure --disable-netcv --disable-dvbapi --enable-static --host=sh4-linux --disable-dvbaes --disable-dvbca --enable-axe make PMT=0 zip -9 -r /minisatip_axe.zip minisatip html - name: Build MIPS run: | make clean - ./configure --enable-static --host=mipsel-tuxbox-linux-gnu - make + ./configure --disable-netcv --enable-static --host=mipsel-linux-gnu CC="zig cc -target mipsel-linux-gnueabihf.2.34 -static" + make EXTRA_CFLAGS="-I/sysroot/mipsel/include -L/sysroot/mipsel/lib" EMBEDDED=1 zip -9 -r /minisatip_mips.zip minisatip html diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7f962fa1cc..6079ba45d6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,7 +20,7 @@ jobs: - name: Install build essentials run: | apt-get -y update - apt-get -y install build-essential + DEBIAN_FRONTEND=noninteractive apt-get -y install build-essential git clang - name: Build all disabled run: | @@ -29,10 +29,19 @@ jobs: - name: Install additional build dependencies run: | - apt-get -y install libdvbcsa-dev libssl-dev + DEBIAN_FRONTEND=noninteractive apt-get -y install libdvbcsa-dev libssl-dev zlib1g-dev libxml2-dev + git clone https://github.com/vdr-projects/libnetceiver/ + cd libnetceiver/ && make install + cd .. - name: Build all enabled run: | make clean - ./configure --enable-linuxdvb --enable-dvbca --enable-dvbcsa --enable-netcv --enable-satipc --enable-dvbapi --enable-axe + ./configure --enable-linuxdvb --enable-dvbca --enable-dvbcsa --enable-netcv --enable-dvbapi --enable-axe + make + + - name: Build clang + run: | + make clean + ./configure --enable-linuxdvb --enable-dvbca --enable-dvbcsa --enable-netcv --enable-dvbapi --enable-axe CC=clang make diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 652fe54c2d..963f27a481 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -53,7 +53,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: dependencies - run: sudo apt-get install -y -f libdvbcsa-dev libssl-dev + run: sudo DEBIAN_FRONTEND=noninteractive apt-get install -y -f libdvbcsa-dev libssl-dev - name: Autobuild uses: github/codeql-action/autobuild@v1 diff --git a/.github/workflows/debian.yml b/.github/workflows/debian.yml index 73f30c9f91..18cf121f41 100644 --- a/.github/workflows/debian.yml +++ b/.github/workflows/debian.yml @@ -17,7 +17,7 @@ jobs: - name: Install build dependencies run: | - sudo apt-get -y install build-essential dpkg-dev libdvbcsa-dev libssl-dev debhelper-compat vdr-dev + sudo DEBIAN_FRONTEND=noninteractive apt-get -y install build-essential dpkg-dev libdvbcsa-dev libssl-dev debhelper-compat vdr-dev - name: Build Debian package run: | diff --git a/configure b/configure index dbccce9d14..7c6c9d5f4d 100755 --- a/configure +++ b/configure @@ -648,8 +648,8 @@ ac_includes_default="\ #endif" ac_header_c_list= -ac_func_c_list= ac_subst_vars='LTLIBOBJS +LIBOBJS AXE DVBAPI STATIC @@ -659,15 +659,6 @@ EMBEDDED DVBCA DVBCSA LINUXDVB -LIBOBJS -host_os -host_vendor -host_cpu -host -build_os -build_vendor -build_cpu -build OBJEXT EXEEXT ac_ct_CC @@ -721,7 +712,6 @@ enable_linuxdvb enable_dvbca enable_dvbcsa enable_netcv -with_mcli with_xml2 enable_satipc enable_static @@ -1341,10 +1331,6 @@ Fine tuning of the installation directories: _ACEOF cat <<\_ACEOF - -System types: - --build=BUILD configure for building on BUILD [guessed] - --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi @@ -1371,8 +1357,6 @@ Optional Features: Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-mcli specify vdr-mcli-plugin directory - default=../../vdr-mcli-plugin --with-xml2 specify libxml2 directory default=/usr/include/libxml2 @@ -1585,243 +1569,6 @@ printf "%s\n" "$ac_res" >&6; } } # ac_fn_c_check_header_compile -# ac_fn_c_find_intX_t LINENO BITS VAR -# ----------------------------------- -# Finds a signed integer type with width BITS, setting cache variable VAR -# accordingly. -ac_fn_c_find_intX_t () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5 -printf %s "checking for int$2_t... " >&6; } -if eval test \${$3+y} -then : - printf %s "(cached) " >&6 -else $as_nop - eval "$3=no" - # Order is important - never check a type that is potentially smaller - # than half of the expected target width. - for ac_type in int$2_t 'int' 'long int' \ - 'long long int' 'short int' 'signed char'; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default - enum { N = $2 / 2 - 1 }; -int -main (void) -{ -static int test_array [1 - 2 * !(0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1))]; -test_array [0] = 0; -return test_array [0]; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default - enum { N = $2 / 2 - 1 }; -int -main (void) -{ -static int test_array [1 - 2 * !(($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1) - < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 2))]; -test_array [0] = 0; -return test_array [0]; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - -else $as_nop - case $ac_type in #( - int$2_t) : - eval "$3=yes" ;; #( - *) : - eval "$3=\$ac_type" ;; -esac -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - if eval test \"x\$"$3"\" = x"no" -then : - -else $as_nop - break -fi - done -fi -eval ac_res=\$$3 - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_find_intX_t - -# ac_fn_c_check_type LINENO TYPE VAR INCLUDES -# ------------------------------------------- -# Tests whether TYPE exists after having included INCLUDES, setting cache -# variable VAR accordingly. -ac_fn_c_check_type () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -printf %s "checking for $2... " >&6; } -if eval test \${$3+y} -then : - printf %s "(cached) " >&6 -else $as_nop - eval "$3=no" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main (void) -{ -if (sizeof ($2)) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main (void) -{ -if (sizeof (($2))) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - -else $as_nop - eval "$3=yes" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -eval ac_res=\$$3 - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_type - -# ac_fn_c_find_uintX_t LINENO BITS VAR -# ------------------------------------ -# Finds an unsigned integer type with width BITS, setting cache variable VAR -# accordingly. -ac_fn_c_find_uintX_t () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 -printf %s "checking for uint$2_t... " >&6; } -if eval test \${$3+y} -then : - printf %s "(cached) " >&6 -else $as_nop - eval "$3=no" - # Order is important - never check a type that is potentially smaller - # than half of the expected target width. - for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \ - 'unsigned long long int' 'unsigned short int' 'unsigned char'; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default -int -main (void) -{ -static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)]; -test_array [0] = 0; -return test_array [0]; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - case $ac_type in #( - uint$2_t) : - eval "$3=yes" ;; #( - *) : - eval "$3=\$ac_type" ;; -esac -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - if eval test \"x\$"$3"\" = x"no" -then : - -else $as_nop - break -fi - done -fi -eval ac_res=\$$3 - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_find_uintX_t - -# ac_fn_c_try_run LINENO -# ---------------------- -# Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that -# executables *can* be run. -ac_fn_c_try_run () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; } -then : - ac_retval=0 -else $as_nop - printf "%s\n" "$as_me: program exited with status $ac_status" >&5 - printf "%s\n" "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=$ac_status -fi - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_run - # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly @@ -2495,106 +2242,6 @@ as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H" as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H" as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H" as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H" -as_fn_append ac_header_c_list " sys/param.h sys_param_h HAVE_SYS_PARAM_H" -as_fn_append ac_func_c_list " getpagesize HAVE_GETPAGESIZE" - -# Auxiliary files required by this configure script. -ac_aux_files="config.guess config.sub" - -# Locations in which to look for auxiliary files. -ac_aux_dir_candidates="${srcdir}${PATH_SEPARATOR}${srcdir}/..${PATH_SEPARATOR}${srcdir}/../.." - -# Search for a directory containing all of the required auxiliary files, -# $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates. -# If we don't find one directory that contains all the files we need, -# we report the set of missing files from the *first* directory in -# $ac_aux_dir_candidates and give up. -ac_missing_aux_files="" -ac_first_candidate=: -printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5 -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_found=false -for as_dir in $ac_aux_dir_candidates -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - as_found=: - - printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying $as_dir" >&5 - ac_aux_dir_found=yes - ac_install_sh= - for ac_aux in $ac_aux_files - do - # As a special case, if "install-sh" is required, that requirement - # can be satisfied by any of "install-sh", "install.sh", or "shtool", - # and $ac_install_sh is set appropriately for whichever one is found. - if test x"$ac_aux" = x"install-sh" - then - if test -f "${as_dir}install-sh"; then - printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install-sh found" >&5 - ac_install_sh="${as_dir}install-sh -c" - elif test -f "${as_dir}install.sh"; then - printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install.sh found" >&5 - ac_install_sh="${as_dir}install.sh -c" - elif test -f "${as_dir}shtool"; then - printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}shtool found" >&5 - ac_install_sh="${as_dir}shtool install -c" - else - ac_aux_dir_found=no - if $ac_first_candidate; then - ac_missing_aux_files="${ac_missing_aux_files} install-sh" - else - break - fi - fi - else - if test -f "${as_dir}${ac_aux}"; then - printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}${ac_aux} found" >&5 - else - ac_aux_dir_found=no - if $ac_first_candidate; then - ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}" - else - break - fi - fi - fi - done - if test "$ac_aux_dir_found" = yes; then - ac_aux_dir="$as_dir" - break - fi - ac_first_candidate=false - - as_found=false -done -IFS=$as_save_IFS -if $as_found -then : - -else $as_nop - as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 -fi - - -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -if test -f "${ac_aux_dir}config.guess"; then - ac_config_guess="$SHELL ${ac_aux_dir}config.guess" -fi -if test -f "${ac_aux_dir}config.sub"; then - ac_config_sub="$SHELL ${ac_aux_dir}config.sub" -fi -if test -f "$ac_aux_dir/configure"; then - ac_configure="$SHELL ${ac_aux_dir}configure" -fi - # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false @@ -3708,7 +3355,34 @@ then : fi -# Checks for header files. +FM="\nminisatip configuration\n\n" +linux_dvb="Linux DVB:\t\t\t\t " +dvb_csa="DVBCSA (needs libdvbcsa):\t\t " +CI="Common Interface (CI)\t\t\t " +dvb_ca="Common Interface (needs DVBEN50221):\t " +emb="Embedded system:\t\t\t " +netcv="Netceiver support:\t\t\t " +satipc="SatIP Client:\t\t\t\t " +static="Static:\t\t\t\t\t " +dvbapi="dvbapi:\t\t\t\t\t " +axe="axe:\t\t\t\t\t " +enigma="enigma:\t\t\t\t\t " +LINUXDVB=0 +DVBCA=0 +DVBCSA=0 +NETCVCLIENT=0 +SATIPCLIENT=0 +STATIC=0 +AXE=0 +DVBAPI=0 + +# Check whether --enable-linuxdvb was given. +if test ${enable_linuxdvb+y} +then : + enableval=$enable_linuxdvb; +fi + + ac_header= ac_cache= for ac_item in $ac_header_c_list do @@ -3738,603 +3412,6 @@ then : printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h fi -ac_fn_c_check_header_compile "$LINENO" "arpa/inet.h" "ac_cv_header_arpa_inet_h" "$ac_includes_default" -if test "x$ac_cv_header_arpa_inet_h" = xyes -then : - printf "%s\n" "#define HAVE_ARPA_INET_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "fcntl.h" "ac_cv_header_fcntl_h" "$ac_includes_default" -if test "x$ac_cv_header_fcntl_h" = xyes -then : - printf "%s\n" "#define HAVE_FCNTL_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "netdb.h" "ac_cv_header_netdb_h" "$ac_includes_default" -if test "x$ac_cv_header_netdb_h" = xyes -then : - printf "%s\n" "#define HAVE_NETDB_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "netinet/in.h" "ac_cv_header_netinet_in_h" "$ac_includes_default" -if test "x$ac_cv_header_netinet_in_h" = xyes -then : - printf "%s\n" "#define HAVE_NETINET_IN_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "stdint.h" "ac_cv_header_stdint_h" "$ac_includes_default" -if test "x$ac_cv_header_stdint_h" = xyes -then : - printf "%s\n" "#define HAVE_STDINT_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" -if test "x$ac_cv_header_stdlib_h" = xyes -then : - printf "%s\n" "#define HAVE_STDLIB_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "string.h" "ac_cv_header_string_h" "$ac_includes_default" -if test "x$ac_cv_header_string_h" = xyes -then : - printf "%s\n" "#define HAVE_STRING_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "sys/ioctl.h" "ac_cv_header_sys_ioctl_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_ioctl_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_IOCTL_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "sys/socket.h" "ac_cv_header_sys_socket_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_socket_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_SOCKET_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "sys/time.h" "ac_cv_header_sys_time_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_time_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_TIME_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "syslog.h" "ac_cv_header_syslog_h" "$ac_includes_default" -if test "x$ac_cv_header_syslog_h" = xyes -then : - printf "%s\n" "#define HAVE_SYSLOG_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default" -if test "x$ac_cv_header_unistd_h" = xyes -then : - printf "%s\n" "#define HAVE_UNISTD_H 1" >>confdefs.h - -fi - - -# Checks for typedefs, structures, and compiler characteristics. -ac_fn_c_find_intX_t "$LINENO" "16" "ac_cv_c_int16_t" -case $ac_cv_c_int16_t in #( - no|yes) ;; #( - *) - -printf "%s\n" "#define int16_t $ac_cv_c_int16_t" >>confdefs.h -;; -esac - -ac_fn_c_find_intX_t "$LINENO" "64" "ac_cv_c_int64_t" -case $ac_cv_c_int64_t in #( - no|yes) ;; #( - *) - -printf "%s\n" "#define int64_t $ac_cv_c_int64_t" >>confdefs.h -;; -esac - -ac_fn_c_find_intX_t "$LINENO" "8" "ac_cv_c_int8_t" -case $ac_cv_c_int8_t in #( - no|yes) ;; #( - *) - -printf "%s\n" "#define int8_t $ac_cv_c_int8_t" >>confdefs.h -;; -esac - -ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" -if test "x$ac_cv_type_size_t" = xyes -then : - -else $as_nop - -printf "%s\n" "#define size_t unsigned int" >>confdefs.h - -fi - -ac_fn_c_find_uintX_t "$LINENO" "16" "ac_cv_c_uint16_t" -case $ac_cv_c_uint16_t in #( - no|yes) ;; #( - *) - - -printf "%s\n" "#define uint16_t $ac_cv_c_uint16_t" >>confdefs.h -;; - esac - -ac_fn_c_find_uintX_t "$LINENO" "32" "ac_cv_c_uint32_t" -case $ac_cv_c_uint32_t in #( - no|yes) ;; #( - *) - -printf "%s\n" "#define _UINT32_T 1" >>confdefs.h - - -printf "%s\n" "#define uint32_t $ac_cv_c_uint32_t" >>confdefs.h -;; - esac - -ac_fn_c_find_uintX_t "$LINENO" "64" "ac_cv_c_uint64_t" -case $ac_cv_c_uint64_t in #( - no|yes) ;; #( - *) - -printf "%s\n" "#define _UINT64_T 1" >>confdefs.h - - -printf "%s\n" "#define uint64_t $ac_cv_c_uint64_t" >>confdefs.h -;; - esac - -ac_fn_c_find_uintX_t "$LINENO" "8" "ac_cv_c_uint8_t" -case $ac_cv_c_uint8_t in #( - no|yes) ;; #( - *) - -printf "%s\n" "#define _UINT8_T 1" >>confdefs.h - - -printf "%s\n" "#define uint8_t $ac_cv_c_uint8_t" >>confdefs.h -;; - esac - - -# Checks for library functions. - - - - # Make sure we can run config.sub. -$SHELL "${ac_aux_dir}config.sub" sun4 >/dev/null 2>&1 || - as_fn_error $? "cannot run $SHELL ${ac_aux_dir}config.sub" "$LINENO" 5 - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 -printf %s "checking build system type... " >&6; } -if test ${ac_cv_build+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_build_alias=$build_alias -test "x$ac_build_alias" = x && - ac_build_alias=`$SHELL "${ac_aux_dir}config.guess"` -test "x$ac_build_alias" = x && - as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 -ac_cv_build=`$SHELL "${ac_aux_dir}config.sub" $ac_build_alias` || - as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $ac_build_alias failed" "$LINENO" 5 - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 -printf "%s\n" "$ac_cv_build" >&6; } -case $ac_cv_build in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; -esac -build=$ac_cv_build -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_build -shift -build_cpu=$1 -build_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -build_os=$* -IFS=$ac_save_IFS -case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 -printf %s "checking host system type... " >&6; } -if test ${ac_cv_host+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test "x$host_alias" = x; then - ac_cv_host=$ac_cv_build -else - ac_cv_host=`$SHELL "${ac_aux_dir}config.sub" $host_alias` || - as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $host_alias failed" "$LINENO" 5 -fi - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 -printf "%s\n" "$ac_cv_host" >&6; } -case $ac_cv_host in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; -esac -host=$ac_cv_host -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_host -shift -host_cpu=$1 -host_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -host_os=$* -IFS=$ac_save_IFS -case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 -printf %s "checking for GNU libc compatible malloc... " >&6; } -if test ${ac_cv_func_malloc_0_nonnull+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test "$cross_compiling" = yes -then : - case "$host_os" in # (( - # Guess yes on platforms where we know the result. - *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ - | hpux* | solaris* | cygwin* | mingw* | msys* ) - ac_cv_func_malloc_0_nonnull=yes ;; - # If we don't know, assume the worst. - *) ac_cv_func_malloc_0_nonnull=no ;; - esac -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -int -main (void) -{ -void *p = malloc (0); - int result = !p; - free (p); - return result; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO" -then : - ac_cv_func_malloc_0_nonnull=yes -else $as_nop - ac_cv_func_malloc_0_nonnull=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 -printf "%s\n" "$ac_cv_func_malloc_0_nonnull" >&6; } -if test $ac_cv_func_malloc_0_nonnull = yes -then : - -printf "%s\n" "#define HAVE_MALLOC 1" >>confdefs.h - -else $as_nop - printf "%s\n" "#define HAVE_MALLOC 0" >>confdefs.h - - case " $LIBOBJS " in - *" malloc.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS malloc.$ac_objext" - ;; -esac - - -printf "%s\n" "#define malloc rpl_malloc" >>confdefs.h - -fi - - - -ac_func= -for ac_item in $ac_func_c_list -do - if test $ac_func; then - ac_fn_c_check_func "$LINENO" $ac_func ac_cv_func_$ac_func - if eval test \"x\$ac_cv_func_$ac_func\" = xyes; then - echo "#define $ac_item 1" >> confdefs.h - fi - ac_func= - else - ac_func=$ac_item - fi -done - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working mmap" >&5 -printf %s "checking for working mmap... " >&6; } -if test ${ac_cv_func_mmap_fixed_mapped+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test "$cross_compiling" = yes -then : - case "$host_os" in # (( - # Guess yes on platforms where we know the result. - linux*) ac_cv_func_mmap_fixed_mapped=yes ;; - # If we don't know, assume the worst. - *) ac_cv_func_mmap_fixed_mapped=no ;; - esac -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default -/* malloc might have been renamed as rpl_malloc. */ -#undef malloc - -/* Thanks to Mike Haertel and Jim Avera for this test. - Here is a matrix of mmap possibilities: - mmap private not fixed - mmap private fixed at somewhere currently unmapped - mmap private fixed at somewhere already mapped - mmap shared not fixed - mmap shared fixed at somewhere currently unmapped - mmap shared fixed at somewhere already mapped - For private mappings, we should verify that changes cannot be read() - back from the file, nor mmap's back from the file at a different - address. (There have been systems where private was not correctly - implemented like the infamous i386 svr4.0, and systems where the - VM page cache was not coherent with the file system buffer cache - like early versions of FreeBSD and possibly contemporary NetBSD.) - For shared mappings, we should conversely verify that changes get - propagated back to all the places they're supposed to be. - - Grep wants private fixed already mapped. - The main things grep needs to know about mmap are: - * does it exist and is it safe to write into the mmap'd area - * how to use it (BSD variants) */ - -#include -#include - -/* This mess was copied from the GNU getpagesize.h. */ -#ifndef HAVE_GETPAGESIZE -# ifdef _SC_PAGESIZE -# define getpagesize() sysconf(_SC_PAGESIZE) -# else /* no _SC_PAGESIZE */ -# ifdef HAVE_SYS_PARAM_H -# include -# ifdef EXEC_PAGESIZE -# define getpagesize() EXEC_PAGESIZE -# else /* no EXEC_PAGESIZE */ -# ifdef NBPG -# define getpagesize() NBPG * CLSIZE -# ifndef CLSIZE -# define CLSIZE 1 -# endif /* no CLSIZE */ -# else /* no NBPG */ -# ifdef NBPC -# define getpagesize() NBPC -# else /* no NBPC */ -# ifdef PAGESIZE -# define getpagesize() PAGESIZE -# endif /* PAGESIZE */ -# endif /* no NBPC */ -# endif /* no NBPG */ -# endif /* no EXEC_PAGESIZE */ -# else /* no HAVE_SYS_PARAM_H */ -# define getpagesize() 8192 /* punt totally */ -# endif /* no HAVE_SYS_PARAM_H */ -# endif /* no _SC_PAGESIZE */ - -#endif /* no HAVE_GETPAGESIZE */ - -int -main (void) -{ - char *data, *data2, *data3; - const char *cdata2; - int i, pagesize; - int fd, fd2; - - pagesize = getpagesize (); - - /* First, make a file with some known garbage in it. */ - data = (char *) malloc (pagesize); - if (!data) - return 1; - for (i = 0; i < pagesize; ++i) - *(data + i) = rand (); - umask (0); - fd = creat ("conftest.mmap", 0600); - if (fd < 0) - return 2; - if (write (fd, data, pagesize) != pagesize) - return 3; - close (fd); - - /* Next, check that the tail of a page is zero-filled. File must have - non-zero length, otherwise we risk SIGBUS for entire page. */ - fd2 = open ("conftest.txt", O_RDWR | O_CREAT | O_TRUNC, 0600); - if (fd2 < 0) - return 4; - cdata2 = ""; - if (write (fd2, cdata2, 1) != 1) - return 5; - data2 = (char *) mmap (0, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd2, 0L); - if (data2 == MAP_FAILED) - return 6; - for (i = 0; i < pagesize; ++i) - if (*(data2 + i)) - return 7; - close (fd2); - if (munmap (data2, pagesize)) - return 8; - - /* Next, try to mmap the file at a fixed address which already has - something else allocated at it. If we can, also make sure that - we see the same garbage. */ - fd = open ("conftest.mmap", O_RDWR); - if (fd < 0) - return 9; - if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_FIXED, fd, 0L)) - return 10; - for (i = 0; i < pagesize; ++i) - if (*(data + i) != *(data2 + i)) - return 11; - - /* Finally, make sure that changes to the mapped area do not - percolate back to the file as seen by read(). (This is a bug on - some variants of i386 svr4.0.) */ - for (i = 0; i < pagesize; ++i) - *(data2 + i) = *(data2 + i) + 1; - data3 = (char *) malloc (pagesize); - if (!data3) - return 12; - if (read (fd, data3, pagesize) != pagesize) - return 13; - for (i = 0; i < pagesize; ++i) - if (*(data + i) != *(data3 + i)) - return 14; - close (fd); - free (data); - free (data3); - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO" -then : - ac_cv_func_mmap_fixed_mapped=yes -else $as_nop - ac_cv_func_mmap_fixed_mapped=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_mmap_fixed_mapped" >&5 -printf "%s\n" "$ac_cv_func_mmap_fixed_mapped" >&6; } -if test $ac_cv_func_mmap_fixed_mapped = yes; then - -printf "%s\n" "#define HAVE_MMAP 1" >>confdefs.h - -fi -rm -f conftest.mmap conftest.txt - -ac_fn_c_check_func "$LINENO" "bzero" "ac_cv_func_bzero" -if test "x$ac_cv_func_bzero" = xyes -then : - printf "%s\n" "#define HAVE_BZERO 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "clock_gettime" "ac_cv_func_clock_gettime" -if test "x$ac_cv_func_clock_gettime" = xyes -then : - printf "%s\n" "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "dup2" "ac_cv_func_dup2" -if test "x$ac_cv_func_dup2" = xyes -then : - printf "%s\n" "#define HAVE_DUP2 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname" -if test "x$ac_cv_func_gethostbyname" = xyes -then : - printf "%s\n" "#define HAVE_GETHOSTBYNAME 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "gettimeofday" "ac_cv_func_gettimeofday" -if test "x$ac_cv_func_gettimeofday" = xyes -then : - printf "%s\n" "#define HAVE_GETTIMEOFDAY 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "inet_ntoa" "ac_cv_func_inet_ntoa" -if test "x$ac_cv_func_inet_ntoa" = xyes -then : - printf "%s\n" "#define HAVE_INET_NTOA 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "memset" "ac_cv_func_memset" -if test "x$ac_cv_func_memset" = xyes -then : - printf "%s\n" "#define HAVE_MEMSET 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "munmap" "ac_cv_func_munmap" -if test "x$ac_cv_func_munmap" = xyes -then : - printf "%s\n" "#define HAVE_MUNMAP 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "socket" "ac_cv_func_socket" -if test "x$ac_cv_func_socket" = xyes -then : - printf "%s\n" "#define HAVE_SOCKET 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "strchr" "ac_cv_func_strchr" -if test "x$ac_cv_func_strchr" = xyes -then : - printf "%s\n" "#define HAVE_STRCHR 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "strerror" "ac_cv_func_strerror" -if test "x$ac_cv_func_strerror" = xyes -then : - printf "%s\n" "#define HAVE_STRERROR 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "strncasecmp" "ac_cv_func_strncasecmp" -if test "x$ac_cv_func_strncasecmp" = xyes -then : - printf "%s\n" "#define HAVE_STRNCASECMP 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "strstr" "ac_cv_func_strstr" -if test "x$ac_cv_func_strstr" = xyes -then : - printf "%s\n" "#define HAVE_STRSTR 1" >>confdefs.h - -fi - - -FM="\nminisatip configuration\n\n" -linux_dvb="Linux DVB:\t\t\t\t " -dvb_csa="DVBCSA (needs libdvbcsa):\t\t " -CI="Common Interface (CI)\t\t\t " -dvb_ca="Common Interface (needs DVBEN50221):\t " -emb="Embedded system:\t\t\t " -netcv="Netceiver support:\t\t\t " -satipc="SatIP Client:\t\t\t\t " -static="Static:\t\t\t\t\t " -dvbapi="dvbapi:\t\t\t\t\t " -axe="axe:\t\t\t\t\t " -enigma="enigma:\t\t\t\t\t " -LINUXDVB=0 -DVBCA=0 -DVBCSA=0 -NETCVCLIENT=0 -SATIPCLIENT=0 -STATIC=0 -AXE=0 -DVBAPI=0 - -# Check whether --enable-linuxdvb was given. -if test ${enable_linuxdvb+y} -then : - enableval=$enable_linuxdvb; -fi - - if test "x$enable_linuxdvb" != "xno" then : @@ -4463,18 +3540,9 @@ then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: == Checking NETCVCLIENT == " >&5 printf "%s\n" "$as_me: == Checking NETCVCLIENT == " >&6;} -mcli_dir="../../vdr-mcli-plugin" xml2_dir="/usr/include/libxml2" -# Check whether --with-mcli was given. -if test ${with_mcli+y} -then : - withval=$with_mcli; mcli_dir=$with_mcli -fi - - - # Check whether --with-xml2 was given. if test ${with_xml2+y} then : @@ -4482,16 +3550,15 @@ then : fi -CFLAGS="-I. -I$mcli_dir/mcast/client -I$mcli_dir/mcast/common -L$mcli_dir/mcast/client -I$xml2_dir" -CPPFLAGS="-I. -I$mcli_dir/mcast/client -I$mcli_dir/mcast/common -L$mcli_dir/mcast/client -I$xml2_dir" +CFLAGS="-I$xml2_dir" cd src - for ac_header in netceiver.h + for ac_header in libnetceiver/netcv/headers.h do : - ac_fn_c_check_header_compile "$LINENO" "netceiver.h" "ac_cv_header_netceiver_h" "$ac_includes_default" -if test "x$ac_cv_header_netceiver_h" = xyes + ac_fn_c_check_header_compile "$LINENO" "libnetceiver/netcv/headers.h" "ac_cv_header_libnetceiver_netcv_headers_h" "$ac_includes_default" +if test "x$ac_cv_header_libnetceiver_netcv_headers_h" = xyes then : - printf "%s\n" "#define HAVE_NETCEIVER_H 1" >>confdefs.h + printf "%s\n" "#define HAVE_LIBNETCEIVER_NETCV_HEADERS_H 1" >>confdefs.h NETCVCLIENT=1 else $as_nop NETCVCLIENT=0 @@ -4620,7 +3687,7 @@ then : fi ac_save_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -fsanitize=bounds -fsanitize-undefined-trap-on-error" +CFLAGS="$CFLAGS -fsanitize=bounds -fsanitize-trap=all" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ diff --git a/configure.ac b/configure.ac index 24cf025c93..fca59383f0 100755 --- a/configure.ac +++ b/configure.ac @@ -13,24 +13,6 @@ AC_PROG_CC # FIXME: Replace `main' with a function in `-lrt': AC_CHECK_LIB([rt], [main]) -# Checks for header files. -AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdint.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h syslog.h unistd.h]) - -# Checks for typedefs, structures, and compiler characteristics. -AC_TYPE_INT16_T -AC_TYPE_INT64_T -AC_TYPE_INT8_T -AC_TYPE_SIZE_T -AC_TYPE_UINT16_T -AC_TYPE_UINT32_T -AC_TYPE_UINT64_T -AC_TYPE_UINT8_T - -# Checks for library functions. -AC_FUNC_MALLOC -AC_FUNC_MMAP -AC_CHECK_FUNCS([bzero clock_gettime dup2 gethostbyname gettimeofday inet_ntoa memset munmap socket strchr strerror strncasecmp strstr]) - FM="\nminisatip configuration\n\n" linux_dvb="Linux DVB:\t\t\t\t " dvb_csa="DVBCSA (needs libdvbcsa):\t\t " @@ -114,24 +96,17 @@ AC_ARG_ENABLE([netcv], AS_IF([test "x$enable_netcv" != "xno"], [ AC_MSG_NOTICE([ == Checking NETCVCLIENT == ]) -mcli_dir="../../vdr-mcli-plugin" xml2_dir="/usr/include/libxml2" -AC_ARG_WITH([mcli], - [AS_HELP_STRING([--with-mcli], - [specify vdr-mcli-plugin directory default=../../vdr-mcli-plugin])], - [mcli_dir=$with_mcli]) - AC_ARG_WITH([xml2], [AS_HELP_STRING([--with-xml2], [specify libxml2 directory default=/usr/include/libxml2])], [xml2_dir=$with_xml2]) -CFLAGS="-I. -I$mcli_dir/mcast/client -I$mcli_dir/mcast/common -L$mcli_dir/mcast/client -I$xml2_dir" -CPPFLAGS="-I. -I$mcli_dir/mcast/client -I$mcli_dir/mcast/common -L$mcli_dir/mcast/client -I$xml2_dir" +CFLAGS="-I$xml2_dir" cd src -AC_CHECK_HEADERS([netceiver.h],[NETCVCLIENT=1],[NETCVCLIENT=0]) +AC_CHECK_HEADERS([libnetceiver/netcv/headers.h],[NETCVCLIENT=1],[NETCVCLIENT=0]) cd .. ]) diff --git a/src/Makefile.in b/src/Makefile.in index 634b0ba5dd..bceafa1632 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -106,7 +106,7 @@ endif ifeq ($(NETCVCLIENT),1) SOURCES+=netceiver.c -LDFLAGS+=-lmcli -lxml2 +LDFLAGS+=-lnetceiver -lxml2 else CFLAGS+=-DDISABLE_NETCVCLIENT endif @@ -138,9 +138,9 @@ CFLAGS-$(DEBUG) += -fsanitize=address -fno-omit-frame-pointer -fsanitize=leak -f ifeq ($(STATIC),1) -LDFLAGS+=$(addsuffix .a,$(addprefix -l:lib,$(LIBS))) + LDFLAGS+=$(addsuffix .a,$(addprefix -l:lib,$(LIBS))) else -LDFLAGS+=$(addprefix -l,$(LIBS)) + LDFLAGS+=$(addprefix -l,$(LIBS)) endif SOURCES+=$(SOURCES-1) diff --git a/src/ca.c b/src/ca.c index 86e7116622..61406518f8 100644 --- a/src/ca.c +++ b/src/ca.c @@ -2483,9 +2483,7 @@ int ca_write_apdu(ca_session_t *s, int tag, const void *data, int len) { // reads a TPDU from the CAM. This is called only on DVBCA path int ca_read_tpdu(int socket, void *buf, int buf_len, sockets *ss, int *rb) { - static int i; ca_device_t *c = ca_devices[ss->sid]; - i += 1; *rb = 0; uint8_t data[4096]; int len; diff --git a/src/netceiver.c b/src/netceiver.c index 2a8902d7ff..90b4705022 100644 --- a/src/netceiver.c +++ b/src/netceiver.c @@ -28,6 +28,7 @@ #include #include #include +#include "utils/alloc.h" #define DEFAULT_LOG LOG_NETCEIVER diff --git a/src/netceiver.h b/src/netceiver.h index 2fdc6ece3a..c6521ab8e8 100644 --- a/src/netceiver.h +++ b/src/netceiver.h @@ -6,7 +6,7 @@ #define API_SOCK #ifndef DISABLE_LINUXDVB #undef AOT_CA_PMT -#include "headers.h" +#include "libnetceiver/netcv/headers.h" #else #include "netceiver_mcli_defs.h" #endif diff --git a/src/pmt.c b/src/pmt.c index 6027aa19d3..597fd3b0e0 100644 --- a/src/pmt.c +++ b/src/pmt.c @@ -70,12 +70,6 @@ int nfilters; char *listmgmt_str[] = {"CLM_MORE", "CLM_FIRST", "CLM_LAST", "CLM_ONLY", "CLM_ADD", "CLM_UPDATE"}; -static inline SCW *get_cw(int id) { - if (id < 0 || id >= MAX_CW || !cws[id] || !cws[id]->enabled) - return NULL; - return cws[id]; -} - static inline SPMT *get_pmt_for_existing_pid(SPid *p) { SPMT *pmt = NULL; if (p && p->pmt >= 0 && p->pmt < npmts && pmts[p->pmt] && @@ -105,70 +99,6 @@ static inline int get_has_pcr(uint8_t *b) { return 1; } -static inline int get_has_pusi(uint8_t *b) { - if ((b[1] & 0x40) == 0) - return 0; - else - return 1; -} - -static inline int get_has_pes_header(uint8_t *b) { - if (!get_has_pusi(b)) - return 0; - - // Check it's not scrambled and it has payload - if ((b[3] & 0xd0) != 0x10) - return 0; - - // Check if payload is a PES Header - int pesheader = get_adaptation_len(b); - if (b[pesheader] != 0x00 || b[pesheader + 1] != 0x00 || - b[pesheader + 2] != 0x01) - return 0; - - return pesheader; -} - -static inline int get_streamid(uint8_t *b) { - int pesheader = get_has_pes_header(b); - if (pesheader == 0) - return 0; - - return b[pesheader + 3]; -} - -static inline uint64_t get_pts_dts(uint8_t *b) { - int pesheader = get_has_pes_header(b); - if (pesheader == 0) - return 0; - - uint64_t tts = 0xFFFFFFFFFFFFFFFF; - - if ((b[pesheader + 7] & 0x80) != 0x80) // No PTS or DTS indicator - return tts; - - int offset = pesheader + 9; // PTS position - - if ((b[pesheader + 7] & 0xc0) == 0xc0) { - // PTS and DTS present, get DTS as packet time instead of PTS - offset += 5; - } - - // LOGM("pmt: PTS detection: pesheader=%d,offset=%d %2x %2x,%2x %2x,%2x", - // pesheader,offset,b[offset+0],b[offset+1],b[offset+2],b[offset+3],b[offset+4]); - tts = (b[offset + 0] & 0x0e) >> 1; - tts <<= 8; - tts |= b[offset + 1]; - tts <<= 7; - tts |= (b[offset + 2] & 0xfe) >> 1; - tts <<= 8; - tts |= b[offset + 3]; - tts <<= 7; - tts |= (b[offset + 4] & 0xfe) >> 1; - - return tts; -} - static inline void mark_pid_null(uint8_t *b) { b[1] |= 0x1F; b[2] |= 0xFF; @@ -178,7 +108,7 @@ static inline void mark_padding_header(uint8_t *b) { // Generate a clean packet without any payload if ((b[3] & 0x10) == 0) // No Payload... { - b[3] &= 0x3F; // clean encrypted bits and pass it + b[3] &= 0x3F; // clean encrypted bits and pass it return; } @@ -2026,7 +1956,8 @@ int process_pmt(int filter, unsigned char *b, int len, void *opaque) { return 0; } -void copy_en300468_string(char *dest, int dest_len, unsigned char *src, int len) { +void copy_en300468_string(char *dest, int dest_len, unsigned char *src, + int len) { int start = (src[0] < 0x20) ? 1 : 0; uint32_t charset = 0; int i; @@ -2076,8 +2007,8 @@ int process_sdt(int filter, unsigned char *sdt, int len, void *opaque) { sdt_len = (sdt[1] & 0xF) * 256 + sdt[2]; i = 11; DEBUGM("Processing SDT for transponder %d (%x) with length %d, sdt[5] " - "%02X", - tsid, tsid, sdt_len, sdt[5]); + "%02X", + tsid, tsid, sdt_len, sdt[5]); for (i = 11; i < sdt_len - 1; i += desc_loop_len) { b = sdt + i; @@ -2086,8 +2017,8 @@ int process_sdt(int filter, unsigned char *sdt, int len, void *opaque) { desc_loop_len = (b[3] & 0xF) * 256 + b[4]; desc_loop_len += 5; pmt = get_all_pmt_for_sid(ad->id, sid); - DEBUGM("Detected service ID %d (%X) status:%d CA:%d, pos %d len %d", sid, - sid, (status >> 1), (status & 0x1), i, desc_loop_len); + DEBUGM("Detected service ID %d (%X) status:%d CA:%d, pos %d len %d", + sid, sid, (status >> 1), (status & 0x1), i, desc_loop_len); if (!pmt) { DEBUGM("%s: no PMT found for sid %d (%X)", __FUNCTION__, sid, sid); continue; @@ -2099,8 +2030,7 @@ int process_sdt(int filter, unsigned char *sdt, int len, void *opaque) { if (c[0] == 0x48 && !pmt->name[0]) { int name_size = sizeof(pmt->name) - 1; c += 3; - copy_en300468_string(pmt->provider, name_size, c + 1, - c[0]); + copy_en300468_string(pmt->provider, name_size, c + 1, c[0]); c += c[0] + 1; copy_en300468_string(pmt->name, name_size, c + 1, c[0]); LOG("SDT PMT %d: name %s provider %s, sid: %d (%X)", pmt->id, diff --git a/src/utils.c b/src/utils.c index 7234122426..12e36fde38 100644 --- a/src/utils.c +++ b/src/utils.c @@ -826,11 +826,8 @@ int get_random(unsigned char *dest, int len) { } void _strncpy(char *a, char *b, int n) { -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wstringop-truncation" strncpy(a, b, n); a[n - 1] = 0; -#pragma GCC diagnostic pop } /* diff --git a/tests/test_ddci.c b/tests/test_ddci.c index 60d4c87408..16f543757b 100644 --- a/tests/test_ddci.c +++ b/tests/test_ddci.c @@ -220,7 +220,7 @@ int test_add_del_pmt() { int test_copy_ts_from_ddci() { ddci_device_t d; ddci_mapping_table_t *m; - adapter ad; + adapter ad, ad0; uint8_t buf[188 * 10], buf2[188 * 10]; memset(&d, 0, sizeof(d)); memset(buf, 0, sizeof(buf)); @@ -233,6 +233,7 @@ int test_copy_ts_from_ddci() { ddci_devices[0] = &d; create_adapter(&ad, 1); + create_adapter(&ad0, 0); ad.buf = buf2; ad.lbuf = sizeof(buf2); int pid = 1000; @@ -291,7 +292,7 @@ int test_ddci_process_ts() { uint8_t buf[188 * 10]; uint8_t fifo[188 * 3]; int i; - adapter ad, ad2; + adapter ad, ad2, ad0; memset(&d, 0, sizeof(d)); memset(buf, 0, sizeof(buf)); memset(fifo, 0, sizeof(fifo)); @@ -302,6 +303,7 @@ int test_ddci_process_ts() { memset(ddci_devices, 0, sizeof(ddci_devices)); ddci_devices[0] = &d; mutex_init(&d.mutex); + create_adapter(&ad0, 0); create_adapter(&ad, 1); create_adapter(&ad2, 2); ad.buf = buf; @@ -496,6 +498,8 @@ int test_create_pmt() { pmt->version = 0; strcpy((char *)pmt->name, "TEST CHANNEL HD"); ddci_pmt_t dp = {.ver = 0, .pcr_pid = 8191}; + ca_devices[0] = NULL; + ca_devices[1] = NULL; psi_len = ddci_create_pmt(&d, pmt, psi, sizeof(psi), &dp); cc = 1;