diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..ba38587c --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +Makefile +Makefile.in +config.* +/aclocal.m4 +/compile +/configure +/depcomp +/missing +/autom4te.cache +/install-sh +/src/.deps/ +/src/mumudvb +/src/stamp-h1 +*.o +*.sw[po] diff --git a/configure.ac b/configure.ac index b6564cc6..22f34b3a 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ([2.61]) -AC_INIT([MuMuDVB], [1.7.3_20131116_master], [mumudvb@braice.net]) +AC_INIT([MuMuDVB], [1.7.3_20140822_master], [mumudvb@braice.net]) AC_CONFIG_SRCDIR([src/mumudvb.c]) AM_INIT_AUTOMAKE AC_CONFIG_HEADERS([src/config.h]) @@ -60,20 +60,37 @@ dnl scam support dnl AC_ARG_ENABLE(scam_support, [ --enable-scam-support SCAM support (default enabled)],,[enable_scam_support="yes"]) +AC_ARG_ENABLE(scam_descrambler_support, + [ --enable-scam-descrambler-support SCAM descrambler support (default enabled)],,[enable_scam_descrambler_support="yes"]) -if test "${enable_scam_support}" = "yes" +if test "${enable_scam_descrambler_support}" = "yes" then - AC_CHECK_LIB([dvbcsa], [dvbcsa_bs_decrypt],[], [enable_scam_support="no"]) - if test "${enable_scam_support}" != "no" + if test "${enable_scam_support}" = "yes" then - AC_DEFINE(ENABLE_SCAM_SUPPORT, 1, Define if you want the SCAM support) + AC_CHECK_LIB([dvbcsa], [dvbcsa_bs_decrypt],[], [enable_scam_support="no"]) + if test "${enable_scam_support}" != "no" + then + AC_DEFINE(ENABLE_SCAM_SUPPORT, 1, Define if you want the SCAM support) + AC_DEFINE(ENABLE_SCAM_DESCRAMBLER_SUPPORT, 1, Define if you want the SCAM descrambler support) + else + enable_scam_descrambler_support="no" + AC_MSG_WARN([libdvbcsa is needed for SCAM support]) + fi else - AC_MSG_WARN([libdvbcsa are needed for SCAM support]) + enable_scam_support="no" + enable_scam_descrambler_support="no" fi else - enable_scam_support="no" + enable_scam_descrambler_support="no" + if test "${enable_scam_support}" = "yes" + then + AC_DEFINE(ENABLE_SCAM_SUPPORT, 1, Define if you want the SCAM support) + else + enable_scam_support="yes" + fi fi AM_CONDITIONAL(BUILD_SCAMSUPPORT, [test "${enable_scam_support}" != "no"]) +AM_CONDITIONAL(BUILD_SCAMDESCRAMBLERSUPPORT, [test "${enable_scam_descrambler_support}" != "no"]) dnl dnl Test coverage @@ -105,6 +122,13 @@ then fi fi +AC_ARG_ENABLE(android, + [ --enable-android Build for android (default disabled)],,[enable_android="no"]) + +if test "${enable_android}" = "yes" +then + AC_DEFINE(ANDROID, 1, Define if you want build for android) +fi # Checks for header files. AC_HEADER_RESOLV @@ -145,12 +169,24 @@ else echo "Build with SCAM support: no" fi +if test "${enable_scam_descrambler_support}" != "no" ; then + echo "Build with SCAM descrambler support: yes" +else + echo "Build with SCAM descrambler support: no" +fi + if test "${atsc_long_names}" = "yes" ; then echo "Build with ATSC long names support: yes" else echo "Build with ATSC long names support: no" fi +if test "${enable_android}" = "yes" ; then + echo "Build with compatibility for android: yes" +else + echo "Build with compatibility for android: no" +fi + echo "" echo "Debugging" echo "" diff --git a/doc/Makefile.am b/doc/Makefile.am index 40fb1443..8eeac7d0 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -1,7 +1,7 @@ #We just have a doc target to compile the documentation, no installation is made ASCIIDOCFLAGS = -a toc -a numbered htmldocdir = html -html_DOC = $(htmldocdir)/README.html $(htmldocdir)/README_CONF.html $(htmldocdir)/QUICKSTART.html $(htmldocdir)/TRANSCODE.html $(htmldocdir)/WEBSERVICES.html $(htmldocdir)/TRANSCODE_EXTERNAL.html $(htmldocdir)/index.html +html_DOC = $(htmldocdir)/README.html $(htmldocdir)/README_CONF.html $(htmldocdir)/QUICKSTART.html $(htmldocdir)/WEBSERVICES.html $(htmldocdir)/TRANSCODE_EXTERNAL.html $(htmldocdir)/index.html #DISTCLEANFILES = $(html_DOC) doc: $(html_DOC) diff --git a/doc/QUICKSTART.txt b/doc/QUICKSTART.txt index 6048935b..2a49831a 100644 --- a/doc/QUICKSTART.txt +++ b/doc/QUICKSTART.txt @@ -5,7 +5,7 @@ Brice Dubost What is this quickstart guide ? ------------------------------- -It this guide I'll explain how to stream a full transponder (all the channels +In this guide I'll explain how to stream a full transponder (all the channels multiplexed on the same carrier frequency) over a network, by assigning each channel to a different multicast IP. The SAP announces will automatically be generated. @@ -13,7 +13,7 @@ For HTTP unicast or more advanced features, please refer to the full documentati I'll take an example for DVB-S (satellite) and DVB-T (terrestrial). DVB-C and ATSC are similar. -I suppose you have one DVB card wich is already working, if you have more than +I suppose you have one DVB card which is already working, if you have more than one card refer to the full documentation. If you don't know your transponder frequencies, have a look to the README_CONF @@ -25,11 +25,11 @@ DVB-S * Use the debian package, or * type `./configure` then `make` in the mumudvb directory and, as root, `make install` -- You have to find wich transponder you want to stream. +- You have to find which transponder you want to stream. * For European users you can use http://www.kingofsat.net/[King Of Sat] - * You need : the frequency, the polarisation and the symbol rate (srate) + * You need: the frequency, the polarisation and the symbol rate (srate) -- Now create a config file, wich contains : +- Now create a config file, which contains : ------------------------------------ autoconfiguration=full @@ -65,7 +65,7 @@ If you want to stream a subset of the transponder you can use autoconf_sid_list DVB-T ----- -- It's the same way as DVB-S excepted that you need other informations for +- It's the same way as DVB-S except that you need other information on tuning your card. You can find these informations in : `/usr/share/doc/dvb-utils/examples/scan/dvb-t/` if you installed the dvb-utils @@ -89,7 +89,7 @@ The SAP (session announcement protocol) announces will be sent automatically. Troubleshooting --------------- -- Try adding one ore several `-v` to the mumudvb command line to have more detailled messages +- Try adding one ore several `-v` to the mumudvb command line to have more detailed messages - If you experience tuning issues, try with other dvb software like scan or szap and check your parameters - If it still don't work, look at common issues in the README and you can diff --git a/doc/README.txt b/doc/README.txt index ff2593bc..7b4de2d0 100644 --- a/doc/README.txt +++ b/doc/README.txt @@ -39,6 +39,7 @@ Authors and contacts - mailto:glondu@REMOVEMEcrans.ens-cachan.fr[Stéphane Glondu] (man page, debian package) - Special thanks to Dave Chapman (dvbstream author and contributor) - Pierre Gronlier, Sébastien Raillard, Ludovic Boué, Romolo Manfredini +- Others, please see git logs .Mailing list: - mailto:mumudvb-dev@REMOVEMElists.crans.org[MuMuDVB dev] @@ -64,7 +65,7 @@ Features overview - Support for RTP headers (only for multicast) - CAM menu access while streaming (using a web/AJAX interface - see WEBSERVICES.txt and CAM_menu_interface.png for screenshot) - Software descrambling through oscam dvbapi and libdvbcsa - +- Support for embedded platforms based on UCLIBC and ANDROID Detailled feature list ~~~~~~~~~~~~~~~~~~~~~~ @@ -117,6 +118,9 @@ Then you have a source which can be installed as a release package. From a release package ^^^^^^^^^^^^^^^^^^^^^^ +[NOTE] +If you want to compile for OpenWRT, please follow http://ocsovszki-dorian.blogspot.co.uk/2014/01/tl-wdr4900-openwrt-dvb-t-with-ite9135.html[OpenWRT tutorial] + In order to install MuMuDVB type: --------------------------------- @@ -132,6 +136,7 @@ The `[configure options]` specific to MuMuDVB are: --enable-scam-support SCAM support (default enabled) (see note below) --enable-coverage build for test coverage (default disabled) --enable-duma Debbuging DUMA library (default disabled) + --enable-android Support for Android (default disabled) --------------------------------------------------------------------- [NOTE] @@ -497,8 +502,16 @@ will give you the channel with the service id 100, or a 404 error if there is no Get the channel by name ^^^^^^^^^^^^^^^^^^^^^^^ -[NOTE] -This is not implemented for the moment, it will be implemented in a future release +You can ask the channel by the channel name. +The search is case insensitive. If your channel name contains spaces, replace them by '-' character. + +If you server is listening on the ip 10.0.0.1 and the port 4242, + +---------------------------------------------------- +vlc http://10.0.0.1:4242/byname/your-tv-station-name +---------------------------------------------------- + +will give you the channel with name "Your TV station name". This works also with xine and mplayer. Get the channels list ^^^^^^^^^^^^^^^^^^^^^ diff --git a/doc/README_CONF.txt b/doc/README_CONF.txt index cb08507d..b3243bfb 100644 --- a/doc/README_CONF.txt +++ b/doc/README_CONF.txt @@ -53,7 +53,7 @@ pids=272 256 257 258 --------------------------- -See <> section for a list of detailled parameters. +See <> section for a list of detailed parameters. Example config files -------------------- @@ -78,10 +78,10 @@ In the following list, only the parameter `freq` is mandatory |================================================================================================================== |Parameter name |Description | Default value | Comments |freq | transponder's frequency in MHz | | Mandatory -|modulation | The kind of modulation used (can be : QPSK QAM16 QAM32 QAM64 QAM128 QAM256 QAMAUTO VSB8 VSB16 8PSK 16APSK 32APSK DQPSK) | ATSC: VSB_8, cable/terrestrial: QAM_AUTO, satellite: QPSK | Optionnal most of the times +|modulation | The kind of modulation used (can be : QPSK QAM16 QAM32 QAM64 QAM128 QAM256 QAMAUTO VSB8 VSB16 8PSK 16APSK 32APSK DQPSK) | ATSC: VSB_8, cable/terrestrial: QAM_AUTO, satellite: QPSK | Optional most of the times |delivery_system | the delivery system used (can be DVBT DVBT2 DVBS DVBS2 DVBC_ANNEX_AC DVBC_ANNEX_B ATSC) | Undefined | Set it if you want to use the new tuning API (DVB API 5/S2API). Mandatory for DVB-S2 and DVB-T2 |card | The DVB/ATSC card number | 0 | only limited by your OS -|tuner | The tuner number | 0 | If you have a card with multiple tuners (ie there is several frontend* in /dev/dvb/adapter%card) +|tuner | The tuner number | 0 | If you have a card with multiple tuners (ie there are several frontend* in /dev/dvb/adapter%card) |card_dev_path | The path of the DVB card devices. Use it if you have a personalised path like /dev/dvb/astra%card | /dev/dvb/adapter%card | The template %card can be used |tuning_timeout |tuning timeout in seconds. | 300 | 0 = no timeout |timeout_no_diff |If no channels are streamed, MuMuDVB will kill himself after this time (specified in seconds) | 600 | 0 = infinite timeout @@ -107,6 +107,7 @@ Parameters specific to satellite |sat_number |The satellite number in case you have multiples lnb, no effect if 0 (only 22kHz tone and 13/18V), send a diseqc message if non 0 | 0 | 1 to 4 | If you have equipment which support more, please contact |switch_input |The switch input number in case you have multiples lnb, overrides sat_number, send a diseqc message if non 0 | 0 | 0 to 15| If you have equipment which support more, please contact |switch_type | The DiSEqC switch type: Committed or Uncommitted | C | C, c, U or u | +|diseqc_repeat | Do we repeat the DiSEqC message (useful for some switches) | 0 | 0 or 1 | |lnb_voltage_off |Force the LNB voltage to be 0V (instead of 13V or 18V). This is useful when your LNB have it's own power supply. | 0 | 0 or 1 | |coderate |coderate, also called FEC | auto | none, 1/2, 2/3, 3/4, 4/5, 5/6, 6/7, 7/8, 8/9, auto | |rolloff |rolloff important only for DVB-S2 | 35 | 35, 20, 25, auto | The default value should work most of the times @@ -190,14 +191,14 @@ Packets sending parameters [width="80%",cols="2,8,1,2,3",options="header"] |================================================================================================================== |Parameter name |Description | Default value | Possible values | Comments -|dont_send_scrambled | If set to 1 don't send the packets detected as scrambled. this will also remove indirectly the sap announces for the scrambled channels |0 | | +|dont_send_scrambled | If set to 1 don't send the packets detected as scrambled. This will also remove indirectly the sap announces for the scrambled channels |0 | | |filter_transport_error | If set to 1 don't send the packets tagged with errors by the demodulator. |0 | | |psi_tables_filtering | If set to 'pat', TS packets with PID from 0x01 to 0x1F are discarded. If set to 'pat_cat', TS packets with PID from 0x02 to 0x1F are discarded. | 'none' | Option to keep only mandatory PSI PID | |rewrite_pat | Do we rewrite the PAT PID | 0, 1 in full autoconf | 0 or 1 | See README, important for some set top boxes |rewrite_sdt | Do we rewrite the SDT PID | 0, 1 in full autoconf | 0 or 1 | See README |rewrite_eit sort_eit | Do we rewrite/sort the EIT PID | 0 | 0 or 1 | See README -|sdt_force_eit | Do we force the EIT_schedule_flag and EIT_present_following_flag in SDT | 0 | 0 or 1 | Let to 0 if you don't understand -|rtp_header | Send the stream with the rtp headers (execpt for HTTP unicast) | 0 | 0 or 1 | +|sdt_force_eit | Do we force the EIT_schedule_flag and EIT_present_following_flag in SDT | 0 | 0 or 1 | Set to 0 if you don't understand +|rtp_header | Send the stream with the rtp headers (except for HTTP unicast) | 0 | 0 or 1 | |================================================================================================================== Logs parameters @@ -209,7 +210,7 @@ Logs parameters |log_header | specify the logging header | %priority: %module | | The implemented templates are %priority %module %timeepoch %date %pid |log_flush_interval | LogFile flushing interval (in seconds) | -1 : no periodic flushing | | |log_type | Where the log information will go | If neither this option and logfile are specified the log destination will be syslog if MuMuDVB run as a deamon, console otherwise | syslog, console | The first time you specify a logging way, it replaces the default one. Then, each time you sepcify a logging channel, it is added to the previous -|log_file | The file in wich the logs will be written to | no file log | | The following templates are allowed %card %tuner %server +|log_file | The file in which the logs will be written to | no file log | | The following templates are allowed %card %tuner %server |================================================================================================================== Multicast parameters @@ -275,12 +276,12 @@ SAP announces parameters |================================================================================================================== |Parameter name |Description | Default value | Possible values | Comments |sap | Generation of SAP announces | 0 (1 if full autoconfiguration) | 0 or 1 | -|sap_organisation |Organisation field sent in the SAP announces | MuMuDVB | | Optionnal -|sap_uri |URI field sent in the SAP announces | | | Optionnal -|sap_sending_ip4 |The SAP sender IPv4 address | 0.0.0.0 | | Optionnal, not autodetected, if set, enable RFC 4570 SDP Source Filters field -|sap_sending_ip6 |The SAP sender IPv6 address | :: | | Optionnal, not autodetected, if set, enable RFC 4570 SDP Source Filters field +|sap_organisation |Organisation field sent in the SAP announces | MuMuDVB | | Optional +|sap_uri |URI field sent in the SAP announces | | | Optional +|sap_sending_ip4 |The SAP sender IPv4 address | 0.0.0.0 | | Optional, not autodetected, if set, enable RFC 4570 SDP Source Filters field +|sap_sending_ip6 |The SAP sender IPv6 address | :: | | Optional, not autodetected, if set, enable RFC 4570 SDP Source Filters field |sap_interval |Interval in seconds between sap announces | 5 | positive integers | -|sap_default_group | The default playlist group for sap announces | | string | Optionnal. You can use the keyword %type, see README +|sap_default_group | The default playlist group for sap announces | | string | Optional. You can use the keyword %type, see README |sap_ttl |The TTL for the multicast SAP packets | 255 | | The RFC 2974 says "SAP announcements ... SHOULD be sent with an IP time-to-live of 255 (the use of TTL scoping for multicast is discouraged [RFC 2365])." |================================================================================================================== @@ -292,7 +293,7 @@ HTTP unicast parameters |unicast |Set this option to one to activate HTTP unicast | 0 | see the README for more details |ip_http |the listening ip for http unicast, if you want to listen to all interfaces put 0.0.0.0 | 0.0.0.0 | see the README for more details |port_http | The listening port for http unicast | 4242 | You can use mathematical expressions containing integers, * and +. You can use the `%card`, `%tuner` and %server template. Ex `port_http=2000+%card*100` -|unicast_consecutive_errors_timeout | The timeout for disconnecting a client wich is not responding | 5 | A client will be disconnected if no data have been sucessfully sent during this interval. A value of 0 deactivate the timeout (unadvised). +|unicast_consecutive_errors_timeout | The timeout for disconnecting a client which is not responding | 5 | A client will be disconnected if no data have been sucessfully sent during this interval. A value of 0 deactivate the timeout (unadvised). |unicast_max_clients | The limit on the number of connected clients | 0 | 0 : no limit. |unicast_queue_size | The maximum size of the buffering when writting to a client fails | 512kBytes | in Bytes. |================================================================================================================== @@ -311,11 +312,11 @@ Concerning the PIDs see the <> section [width="80%",cols="2,8,1,1,3",options="header"] |================================================================================================================== |Parameter name |Description | Default value | Possible values | Comments -|ip |multicast (can also be unicast, in raw UDP ) ipv4 where the chanel will be streamed | | | Optionnal if you set multicast=0 (if not used you must use channel_next) -|ip6 |multicast (can also be unicast, in raw UDP ) ipv6 where the chanel will be streamed | | | Optionnal if you set multicast=0 +|ip |multicast (can also be unicast, in raw UDP ) ipv4 where the chanel will be streamed | | | Optional if you set multicast=0 (if not used you must use channel_next) +|ip6 |multicast (can also be unicast, in raw UDP ) ipv6 where the chanel will be streamed | | | Optional if you set multicast=0 |port | The port | 1234 or common_port | | Ports below 1024 needs root rights. |unicast_port | The HTTP unicast port for this channel | | | Ports below 1024 needs root rights. You need to activate HTTP unicast with `ip_http` -|sap_group |The playlist group for SAP announces | | string | optionnal +|sap_group |The playlist group for SAP announces | | string | optional |cam_pmt_pid |Only for scrambled channels. The PMT PID for CAM support | | | This option needs to be specified for descrambling the channel. |service_id |The service id (program number), olny for autoconfiguration, or rewrite (PAT or SDT) see README for more details | | | |name | The name of the channel. Will be used for /var/run/mumudvb/channels_streamed_adapter%d_tuner%d, logging and SAP announces | | | Mandatory @@ -365,7 +366,7 @@ You can find wscan in the http://wirbel.htpc-forum.de/w_scan/index2.html[w_scan w_scan have one disavantage over dvb-apps scan: it takes (usually) more time. But it have several advantages: no need for initial tuning file, card autodection and deeper channel search. -Once you compiled it (optionnal for x86), launch it with the options needed (country is mandatory for terrestrial and cable. for DVB-S/S2 you need to specify your satellite) +Once you compiled it (optional for x86), launch it with the options needed (country is mandatory for terrestrial and cable. for DVB-S/S2 you need to specify your satellite) [NOTE] Here's the main options for w_scan diff --git a/openwrt/packages/mumudvb/Makefile b/openwrt/packages/mumudvb/Makefile index 16fbcc54..81928377 100644 --- a/openwrt/packages/mumudvb/Makefile +++ b/openwrt/packages/mumudvb/Makefile @@ -1,45 +1,49 @@ -# -# Copyright (C) 2009 Brice DUBOST -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -include $(TOPDIR)/rules.mk -include $(INCLUDE_DIR)/kernel.mk - -PKG_NAME:=mumudvb -PKG_VERSION:=1.6.1-openwrt -PKG_RELEASE:=1 - -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=http://mumudvb.braice.net/mumudvb/mumudvb-beta -PKG_BUILD_DIR:=$(BUILD_DIR)/mumudvb -EXTRA_CPPFLAGS+=-std=gnu99 - - -include $(INCLUDE_DIR)/package.mk - - -define Package/mumudvb - SECTION:=utils - CATEGORY:=Utilities - DEFAULT:=n - TITLE:=MuMuDVB streaming software - URL:=http://mumudvb.braice.net/ -endef - -define Package/mumudvb/description - MuMuDVB streaming software -endef - -define Build/Configure - $(call Build/Configure/Default,--with-linux-headers=$(LINUX_DIR)) -endef - -define Package/mumudvb/install - $(INSTALL_DIR) $(1)/usr/bin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/mumudvb $(1)/usr/bin/mumudvb -endef - -$(eval $(call BuildPackage,mumudvb)) +# +# Copyright (C) 2009 Brice DUBOST +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=mumudvb +PKG_VERSION:=1.7.3 +PKG_SOURCE_VERSION:=6d7c5791ba2bca9f801c7218b1eec7f267cabd8f + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=git://github.com/braice/MuMuDVB.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME) +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR) + +EXTRA_CFLAGS+=-std=gnu99 + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk + +define Package/mumudvb + SECTION:=utils + CATEGORY:=Utilities + DEPENDS:=+librt +libpthread +libiconv + DEFAULT:=n + TITLE:=MuMuDVB streaming software + URL:=http://mumudvb.braice.net/ +endef + +define Package/mumudvb/description + MuMuDVB streaming software +endef + +define Build/Configure + autoreconf $(PKG_BUILD_DIR) -i -f + $(call Build/Configure/Default, LIBS=-liconv) +endef + +define Package/mumudvb/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/mumudvb $(1)/usr/bin/mumudvb +endef + +$(eval $(call BuildPackage,mumudvb)) diff --git a/scripts/android_build.sh b/scripts/android_build.sh new file mode 100755 index 00000000..0131b525 --- /dev/null +++ b/scripts/android_build.sh @@ -0,0 +1,32 @@ +#!/bin/sh +# Build script to android. Change the variables on "Path block" to the correct path. + +API=8 + +# Path block +ANDROID_NDK=/home/ounao/android-ndk-r9c # Android NDK path +SRC_DIR=/home/ounao/source/MuMuDVB # Path to MuMuDVB source +INSTALL_DIR=/home/ounao/source/out # Path to android MuMuDVB install +INCLUDE_DIR=/home/ounao/source/out/include # Path to linux/dvb headers (obrigatory) and iconv.h (optional) +LIB_DIR=/home/ounao/source/out/lib # Path to libiconv.a (optional) +# Path block + +cd $SRC_DIR + +export PATH="$ANDROID_NDK/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/:$PATH" +export SYS_ROOT="$ANDROID_NDK/platforms/android-$API/arch-arm/" +export CC="arm-linux-androideabi-gcc --sysroot=$SYS_ROOT" +export CXX="arm-linux-androideabi-g++ --sysroot=$SYS_ROOT" +export CPP="arm-linux-androideabi-cpp --sysroot=$SYS_ROOT" +export LD="arm-linux-androideabi-ld" +export AR="arm-linux-androideabi-ar" +export RANLIB="arm-linux-androideabi-ranlib" +export STRIP="arm-linux-androideabi-strip" +export LDFLAGS="-L$LIB_DIR" +export CFLAGS="-I$INCLUDE_DIR" +export LIBS="-lc -lgcc -liconv" + +./configure --host=arm-eabi --enable-android --prefix=$INSTALL_DIR + +make +make install diff --git a/src/Makefile.am b/src/Makefile.am index 64d66439..dcceab74 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -38,6 +38,13 @@ SOURCES_scamsupport = \ scam_common.h \ scam_getcw.c \ scam_getcw.h \ + $(NULL) + +if BUILD_SCAMDESCRAMBLERSUPPORT +mumudvb_SOURCES += $(SOURCES_scamdescramblersupport) +endif + +SOURCES_scamdescramblersupport = \ scam_decsa.c \ scam_decsa.h \ scam_send.c \ diff --git a/src/autoconf.c b/src/autoconf.c index 2d98f325..c1122569 100644 --- a/src/autoconf.c +++ b/src/autoconf.c @@ -77,10 +77,7 @@ #include "rtp.h" #include "log.h" #ifdef ENABLE_SCAM_SUPPORT -#include "scam_capmt.h" #include "scam_common.h" -#include "scam_getcw.h" -#include "scam_decsa.h" #endif static char *log_module="Autoconf: "; @@ -658,7 +655,8 @@ int autoconf_services_to_channels(const auto_p_t *parameters, mumudvb_channel_t if((service->type==0x01|| service->type==0x11|| service->type==0x16|| - service->type==0x19)|| + service->type==0x19|| + service->type==0xc0)|| ((service->type==0x02|| service->type==0x0a)&¶meters->autoconf_radios)) { @@ -834,9 +832,11 @@ int autoconf_services_to_channels(const auto_p_t *parameters, mumudvb_channel_t if (service->free_ca_mode && scam_vars->scam_support) { channels[iChan].scam_support=1; channels[iChan].need_scam_ask=CAM_NEED_ASK; +#ifdef ENABLE_SCAM_DESCRAMBLER_SUPPORT channels[iChan].ring_buffer_size=scam_vars->ring_buffer_default_size; channels[iChan].decsa_delay=scam_vars->decsa_default_delay; channels[iChan].send_delay=scam_vars->send_default_delay; +#endif } #endif iChan++; diff --git a/src/autoconf_pmt.c b/src/autoconf_pmt.c index a76faf5d..107f0bc3 100644 --- a/src/autoconf_pmt.c +++ b/src/autoconf_pmt.c @@ -596,6 +596,8 @@ int pmt_need_update(mumudvb_channel_t *channel, unsigned char *packet) if(pmt->table_id==0x02) if(pmt->version_number!=channel->pmt_version) { + if(channel->service_id && (channel->service_id != HILO(pmt->program_number)) ) + return 0; log_message( log_module, MSG_DEBUG,"PMT version changed, channel %s . stored version : %d, new: %d.\n",channel->name,channel->pmt_version,pmt->version_number); return 1; } diff --git a/src/log.c b/src/log.c index 2e1d5e89..622d5595 100644 --- a/src/log.c +++ b/src/log.c @@ -1071,6 +1071,14 @@ int convert_en300468_string(char *string, int max_len) iconv_t cd; //we open the conversion table cd = iconv_open( "UTF8", encodings_en300468[encoding_control_char] ); + if (cd == (iconv_t) -1) { + log_message( log_module, MSG_DETAIL, "\t\t UTF8 encoding not supported by iconv. Trying UTF-8.\n"); + cd = iconv_open( "UTF-8", encodings_en300468[8]); + if (cd == (iconv_t) -1) { + log_message( log_module, MSG_DETAIL, "\t\t Neither UTF8 or UTF-8 encoding supported by iconv. No name encoding conversion.\n"); + goto exit_iconv; + } + } size_t inSize, outSize=max_len; inSize=len; @@ -1086,6 +1094,7 @@ int convert_en300468_string(char *string, int max_len) log_message( log_module, MSG_DETAIL, "Iconv not present, no name encoding conversion \n"); #endif +exit_iconv: log_message( log_module, MSG_FLOOD, "Converted text : \"%s\" (text encoding : %s)\n", string,encodings_en300468[encoding_control_char]); return encoding_control_char; diff --git a/src/mumudvb.c b/src/mumudvb.c index 8d1284e2..a933122e 100644 --- a/src/mumudvb.c +++ b/src/mumudvb.c @@ -99,7 +99,11 @@ #include #include #include +#ifdef ANDROID +#include +#else #include +#endif #include #include #include @@ -120,7 +124,6 @@ #include "scam_capmt.h" #include "scam_common.h" #include "scam_getcw.h" -#include "scam_decsa.h" #endif #include "ts.h" #include "errors.h" @@ -131,7 +134,7 @@ #include "rtp.h" #include "log.h" -#ifdef __UCLIBC__ +#if defined __UCLIBC__ || defined ANDROID #define program_invocation_short_name "mumudvb" #else extern char *program_invocation_short_name; @@ -444,13 +447,16 @@ main (int argc, char **argv) //paranoya we clear all the content of all the channels memset (&chan_p.channels, 0, sizeof (mumudvb_channel_t)*MAX_CHANNELS); -#ifdef ENABLE_SCAM_SUPPORT for (int i = 0; i < MAX_CHANNELS; ++i) { pthread_mutex_init(&chan_p.channels[i].stats_lock, NULL); +#ifdef ENABLE_SCAM_SUPPORT +#ifdef ENABLE_SCAM_DESCRAMBLER_SUPPORT pthread_mutex_init(&chan_p.channels[i].cw_lock, NULL); +#endif chan_p.channels[i].camd_socket = -1; - } #endif + } + /******************************************************/ @@ -1469,7 +1475,9 @@ main (int argc, char **argv) free(dump_filename); } } +#ifndef ANDROID mlockall(MCL_CURRENT | MCL_FUTURE); +#endif /******************************************************/ //Main loop where we get the packets and send them /******************************************************/ @@ -1865,7 +1873,7 @@ int mumudvb_close(int no_daemon, { log_message(log_module,MSG_DEBUG,"Signal/power Thread closing\n"); *strengththreadshutdown=1; -#ifndef __UCLIBC__ +#if !defined __UCLIBC__ && !defined ANDROID clock_gettime(CLOCK_REALTIME, &ts); ts.tv_sec += 5; iRet=pthread_timedjoin_np(signalpowerthread, NULL, &ts); @@ -1888,7 +1896,7 @@ int mumudvb_close(int no_daemon, { log_message(log_module,MSG_DEBUG,"Monitor Thread closing\n"); monitor_thread_params->threadshutdown=1; -#ifndef __UCLIBC__ +#if !defined __UCLIBC__ && !defined ANDROID clock_gettime(CLOCK_REALTIME, &ts); ts.tv_sec += 5; iRet=pthread_timedjoin_np(monitorthread, NULL, &ts); @@ -2028,8 +2036,9 @@ int mumudvb_close(int no_daemon, } if(log_params.log_header!=NULL) free(log_params.log_header); +#ifndef ANDROID munlockall(); - +#endif // End return(ExitCode); @@ -2400,6 +2409,7 @@ void *monitor_func(void* arg) pthread_mutex_unlock(&channel->scam_pmt_packet->packetmutex); } } +#ifdef ENABLE_SCAM_DESCRAMBLER_SUPPORT unsigned int ring_buffer_num_packets = 0; unsigned int to_descramble = 0; unsigned int to_send = 0; @@ -2415,6 +2425,7 @@ void *monitor_func(void* arg) log_message( log_module, MSG_ERROR, "%s: ring buffer overflow, packets in ring buffer %u, ring buffer size %llu\n",channel->name, ring_buffer_num_packets, (long long unsigned int)channel->ring_buffer_size); else log_message( log_module, MSG_DEBUG, "%s: packets in ring buffer %u, ring buffer size %llu, to descramble %u, to send %u\n",channel->name, ring_buffer_num_packets, (long long unsigned int)channel->ring_buffer_size, to_descramble, to_send); +#endif } } } diff --git a/src/mumudvb.h b/src/mumudvb.h index c0e42d96..59ed99c1 100644 --- a/src/mumudvb.h +++ b/src/mumudvb.h @@ -184,7 +184,7 @@ typedef struct { int pfdsnum; }fds_t; -#ifdef ENABLE_SCAM_SUPPORT +#ifdef ENABLE_SCAM_DESCRAMBLER_SUPPORT /**@brief Structure containing ring buffer*/ typedef struct { /** A mutex protecting all the other members. */ @@ -312,12 +312,13 @@ typedef struct mumudvb_channel_t{ #ifdef ENABLE_SCAM_SUPPORT /** The PMT packet for SCAM purposes*/ mumudvb_ts_packet_t *scam_pmt_packet; - /** The camd socket for SCAM*/ - int camd_socket; /** Say if we need to ask this channel to the oscam*/ int need_scam_ask; /** Say if this channel should be descrambled using scam*/ int scam_support; + /** The camd socket for SCAM*/ + int camd_socket; +#ifdef ENABLE_SCAM_DESCRAMBLER_SUPPORT /** Mutex for odd_cw and even_cw. */ pthread_mutex_t cw_lock; /** Odd control word for descrambling */ @@ -353,6 +354,7 @@ typedef struct mumudvb_channel_t{ uint64_t decsa_delay; /** Delay of sending in us*/ uint64_t send_delay; +#endif /** Says if we need to get pmt for this channel on scam own*/ int need_pmt_get; /** Says if we've got first cw for channel. diff --git a/src/mumudvb_common.c b/src/mumudvb_common.c index f7d6e123..608ca63f 100644 --- a/src/mumudvb_common.c +++ b/src/mumudvb_common.c @@ -309,13 +309,13 @@ void buffer_func (mumudvb_channel_t *channel, unsigned char *ts_packet, struct u int send_packet = 0; extern int dont_send_scrambled; -#ifndef ENABLE_SCAM_SUPPORT +#ifndef ENABLE_SCAM_DESCRAMBLER_SUPPORT (void) scam_vars_v; //to make compiler happy #else scam_parameters_t *scam_vars=(scam_parameters_t *)scam_vars_v; #endif uint64_t now_time; -#ifdef ENABLE_SCAM_SUPPORT +#ifdef ENABLE_SCAM_DESCRAMBLER_SUPPORT if (channel->scam_support && scam_vars->scam_support) { pthread_mutex_lock(&channel->ring_buf->lock); memcpy(channel->ring_buf->data+TS_PACKET_SIZE*channel->ring_buf->write_idx, ts_packet, TS_PACKET_SIZE); diff --git a/src/rewrite_eit.c b/src/rewrite_eit.c index b4cb0756..3fbc3a11 100644 --- a/src/rewrite_eit.c +++ b/src/rewrite_eit.c @@ -389,7 +389,7 @@ void eit_rewrite_new_channel_packet(unsigned char *ts_packet, rewrite_parameters unsigned char send_buf[TS_PACKET_SIZE]; ts_header=(ts_header_t *)send_buf; pkt_to_send=eit_pkt->full_eit_sections[channel->eit_section_to_send]; - data_left_to_send=pkt_to_send->full_buffer_len; + data_left_to_send=pkt_to_send->len_full; sent=0; //log_message(log_module,MSG_FLOOD,"Sending EIT to channel %s (sid %d) section %d table_id 0x%02x data_len %d", // channel->name, diff --git a/src/scam_common.c b/src/scam_common.c index d472de9d..4a704ab7 100644 --- a/src/scam_common.c +++ b/src/scam_common.c @@ -50,9 +50,10 @@ #include "log.h" #include "unicast_http.h" #include "rtp.h" +#ifdef ENABLE_SCAM_DESCRAMBLER_SUPPORT #include "scam_decsa.h" #include "scam_send.h" - +#endif /**@file * @brief scam support * @@ -92,10 +93,13 @@ int read_scam_configuration(scam_parameters_t *scam_vars, mumudvb_channel_t *cur log_message( log_module, MSG_WARN, "You have enabled the support for software descrambling (scrambled channels). Please report any bug/comment\n"); } - scam_vars->ring_buffer_default_size=RING_BUFFER_DEFAULT_SIZE; - scam_vars->decsa_default_delay=DECSA_DEFAULT_DELAY; - scam_vars->send_default_delay=SEND_DEFAULT_DELAY; +#ifdef ENABLE_SCAM_DESCRAMBLER_SUPPORT + scam_vars->ring_buffer_default_size=RING_BUFFER_DEFAULT_SIZE; + scam_vars->decsa_default_delay=DECSA_DEFAULT_DELAY; + scam_vars->send_default_delay=SEND_DEFAULT_DELAY; +#endif } +#ifdef ENABLE_SCAM_DESCRAMBLER_SUPPORT else if (!strcmp (substring, "ring_buffer_default_size")) { substring = strtok (NULL, delimiteurs); @@ -115,8 +119,7 @@ int read_scam_configuration(scam_parameters_t *scam_vars, mumudvb_channel_t *cur substring = strtok (NULL, delimiteurs); scam_vars->send_default_delay = atoi (substring); } - - else if (!strcmp (substring, "oscam")) + else if (!strcmp (substring, "ring_buffer_size")) { if ( ip_ok == 0) { @@ -125,15 +128,9 @@ int read_scam_configuration(scam_parameters_t *scam_vars, mumudvb_channel_t *cur return -1; } substring = strtok (NULL, delimiteurs); - current_channel->scam_support = atoi (substring); - if (current_channel->scam_support) { - current_channel->need_scam_ask=CAM_NEED_ASK; - current_channel->ring_buffer_size=scam_vars->ring_buffer_default_size; - current_channel->decsa_delay=scam_vars->decsa_default_delay; - current_channel->send_delay=scam_vars->send_default_delay; - } + current_channel->ring_buffer_size = round_up(atoi (substring)); } - else if (!strcmp (substring, "ring_buffer_size")) + else if (!strcmp (substring, "decsa_delay")) { if ( ip_ok == 0) { @@ -142,9 +139,11 @@ int read_scam_configuration(scam_parameters_t *scam_vars, mumudvb_channel_t *cur return -1; } substring = strtok (NULL, delimiteurs); - current_channel->ring_buffer_size = round_up(atoi (substring)); + current_channel->decsa_delay = atoi (substring); + if (current_channel->decsa_delay > 10000000) + current_channel->decsa_delay = 10000000; } - else if (!strcmp (substring, "decsa_delay")) + else if (!strcmp (substring, "send_delay")) { if ( ip_ok == 0) { @@ -153,11 +152,10 @@ int read_scam_configuration(scam_parameters_t *scam_vars, mumudvb_channel_t *cur return -1; } substring = strtok (NULL, delimiteurs); - current_channel->decsa_delay = atoi (substring); - if (current_channel->decsa_delay > 10000000) - current_channel->decsa_delay = 10000000; + current_channel->send_delay = atoi (substring); } - else if (!strcmp (substring, "send_delay")) +#endif + else if (!strcmp (substring, "oscam")) { if ( ip_ok == 0) { @@ -166,12 +164,20 @@ int read_scam_configuration(scam_parameters_t *scam_vars, mumudvb_channel_t *cur return -1; } substring = strtok (NULL, delimiteurs); - current_channel->send_delay = atoi (substring); + current_channel->scam_support = atoi (substring); + if (current_channel->scam_support) { + current_channel->need_scam_ask=CAM_NEED_ASK; +#ifdef ENABLE_SCAM_DESCRAMBLER_SUPPORT + current_channel->ring_buffer_size=scam_vars->ring_buffer_default_size; + current_channel->decsa_delay=scam_vars->decsa_default_delay; + current_channel->send_delay=scam_vars->send_default_delay; +#endif + } } else - return 0; //Nothing concerning cam, we return 0 to explore the other possibilities + return 0; //Nothing concerning scam, we return 0 to explore the other possibilities - return 1;//We found something for cam, we tell main to go for the next line + return 1;//We found something for scam, we tell main to go for the next line } @@ -241,8 +247,7 @@ int scam_new_packet(int pid, unsigned char *ts_packet, scam_parameters_t *scam_v */ int scam_channel_start(mumudvb_channel_t *channel) { - unsigned int i; - +#ifdef ENABLE_SCAM_DESCRAMBLER_SUPPORT channel->ring_buf=malloc(sizeof(ring_buffer_t)); if (channel->ring_buf == NULL) { log_message( log_module, MSG_ERROR,"Problem with malloc : %s file : %s line %d\n",strerror(errno),__FILE__,__LINE__); @@ -271,12 +276,13 @@ int scam_channel_start(mumudvb_channel_t *channel) pthread_mutex_init(&channel->ring_buf->lock, NULL); scam_send_start(channel); scam_decsa_start(channel); +#endif return 0; } void scam_channel_stop(mumudvb_channel_t *channel) { - uint64_t i; +#ifdef ENABLE_SCAM_DESCRAMBLER_SUPPORT scam_send_stop(channel); scam_decsa_stop(channel); free(channel->ring_buf->data); @@ -285,6 +291,7 @@ void scam_channel_stop(mumudvb_channel_t *channel) pthread_mutex_destroy(&channel->ring_buf->lock); free(channel->ring_buf); +#endif } diff --git a/src/scam_common.h b/src/scam_common.h index ec55ac7e..3a404201 100644 --- a/src/scam_common.h +++ b/src/scam_common.h @@ -67,9 +67,11 @@ typedef struct scam_parameters_t{ int need_pmt_get; pthread_t getcwthread; int getcwthread_shutdown; +#ifdef ENABLE_SCAM_DESCRAMBLER_SUPPORT ca_descr_t ca_descr; ca_pid_t ca_pid; uint64_t ring_buffer_default_size,decsa_default_delay,send_default_delay; +#endif int epfd; }scam_parameters_t; diff --git a/src/scam_getcw.c b/src/scam_getcw.c index 1d7ff99e..9bde19ec 100644 --- a/src/scam_getcw.c +++ b/src/scam_getcw.c @@ -45,8 +45,6 @@ #include "log.h" #include "scam_common.h" -#include - /**@file * @brief scam support * @@ -95,8 +93,12 @@ static void *getcwthread_func(void* arg) scam_params=getcw_params->scam_params; chan_p=getcw_params->chan_p; int curr_channel = 0; + unsigned char buff[1 + sizeof(int) + sizeof(ca_descr_t)]; - int cRead, *request; + int cRead; +#ifdef ENABLE_SCAM_DESCRAMBLER_SUPPORT + int *request; +#endif struct epoll_event events[MAX_CHANNELS]; int num_of_events; int i; @@ -108,8 +110,8 @@ static void *getcwthread_func(void* arg) set_interrupted(ERROR_NETWORK<<8); break; } + pthread_mutex_lock(&chan_p->lock); for (i = 0; i < num_of_events; i++) { - pthread_mutex_lock(&chan_p->lock); for (curr_channel = 0; curr_channel < chan_p->number_of_channels; curr_channel++) { mumudvb_channel_t *channel = &chan_p->channels[curr_channel]; if (events[i].data.fd == channel->camd_socket) { @@ -121,23 +123,29 @@ static void *getcwthread_func(void* arg) log_message(log_module, MSG_ERROR,"channel %s: unsuccessful epoll_ctl EPOLL_CTL_DEL", channel->name); set_interrupted(ERROR_NETWORK<<8); free(getcw_params); + pthread_mutex_unlock(&chan_p->lock); return 0; } close(channel->camd_socket); channel->camd_socket=-1; channel->need_scam_ask=CAM_NEED_ASK; +#ifdef ENABLE_SCAM_DESCRAMBLER_SUPPORT pthread_mutex_lock(&channel->cw_lock); channel->ca_idx_refcnt = 0; channel->ca_idx = 0; pthread_mutex_unlock(&channel->cw_lock); +#endif } else { + cRead = recv(channel->camd_socket, &buff, sizeof(buff), 0); if (cRead <= 0) { log_message(log_module, MSG_ERROR,"channel: %s recv", channel->name); set_interrupted(ERROR_NETWORK<<8); free(getcw_params); + pthread_mutex_unlock(&chan_p->lock); return 0; } +#ifdef ENABLE_SCAM_DESCRAMBLER_SUPPORT request = (int *) (buff + 1); if (*request == CA_SET_DESCR) { memcpy((&(scam_params->ca_descr)), buff + 1 + sizeof(int), sizeof(ca_descr_t)); @@ -162,7 +170,7 @@ static void *getcwthread_func(void* arg) memcpy((&(scam_params->ca_pid)), buff + 1 + sizeof(int), sizeof(ca_pid_t)); log_message( log_module, MSG_DEBUG, "Got CA_SET_PID request channel: %s, index: %d pid: %d\n", channel->name, scam_params->ca_pid.index, scam_params->ca_pid.pid); if(scam_params->ca_pid.index == -1) { - pthread_mutex_lock(&chan_p->lock); + pthread_mutex_lock(&channel->cw_lock); --channel->ca_idx_refcnt; if (!channel->ca_idx_refcnt) { channel->ca_idx = 0; @@ -179,12 +187,15 @@ static void *getcwthread_func(void* arg) pthread_mutex_unlock(&channel->cw_lock); } } +#else + log_message( log_module, MSG_INFO, "Got unhandled event on channel %s\n", channel->name); +#endif } break; } } - pthread_mutex_unlock(&chan_p->lock); } + pthread_mutex_unlock(&chan_p->lock); } free(getcw_params); return 0; diff --git a/src/ts.h b/src/ts.h index e48945d0..63f55d21 100644 --- a/src/ts.h +++ b/src/ts.h @@ -32,6 +32,8 @@ #include #include +#include +#include #include "config.h" diff --git a/src/tune.c b/src/tune.c index a4ffedfb..6b61f433 100644 --- a/src/tune.c +++ b/src/tune.c @@ -37,7 +37,12 @@ #include #include #include +#include "config.h" +#ifdef ANDROID +#include +#else #include +#endif #include #include @@ -74,6 +79,7 @@ void init_tune_v(tune_p_t *tune_p) .lnb_lof_high=DEFAULT_LOF2_UNIVERSAL, .sat_number = 0, .switch_type = 'C', + .diseqc_repeat = 0, .modulation_set = 0, .display_strenght = 0, .check_status = 1, @@ -517,6 +523,11 @@ int read_tuning_configuration(tune_p_t *tuneparams, char *substring) return -1; } } + else if (!strcmp (substring, "diseqc_repeat")) + { + substring = strtok (NULL, delimiteurs); + tuneparams->diseqc_repeat = atoi (substring); + } else if (!strcmp (substring, "stream_id")) { #ifdef STREAM_ID @@ -583,7 +594,7 @@ static inline void msleep(uint32_t msec) * As defined in the DiseqC norm, we stop the 22kHz tone, we set the voltage. Wait. send the command. Wait. put back the 22kHz tone * */ -static int diseqc_send_msg(int fd, fe_sec_voltage_t v, struct diseqc_cmd **cmd, fe_sec_tone_mode_t t, fe_sec_mini_cmd_t b) +static int diseqc_send_msg(int fd, fe_sec_voltage_t v, struct diseqc_cmd **cmd, fe_sec_tone_mode_t t, fe_sec_mini_cmd_t b, int diseqc_repeat) { int err; if((err = ioctl(fd, FE_SET_TONE, SEC_TONE_OFF))) @@ -608,19 +619,25 @@ static int diseqc_send_msg(int fd, fe_sec_voltage_t v, struct diseqc_cmd **cmd, log_message( log_module, MSG_WARN, "problem sending the DiseqC message\n"); return -1; } + msleep((*cmd)->wait); msleep(15); - //Framing byte : Command from master, no reply required, repeated transmission : 0xe1 - cmd[0]->cmd.msg[0] = 0xe1; - //cmd.msg[0] = 0xe1; /* framing: master, no reply, repeated TX */ - log_message( log_module, MSG_DETAIL ,"Sending repeated Diseqc message %02x %02x %02x %02x %02x %02x len %d\n", - (*cmd)->cmd.msg[0],(*cmd)->cmd.msg[1],(*cmd)->cmd.msg[2],(*cmd)->cmd.msg[3],(*cmd)->cmd.msg[4],(*cmd)->cmd.msg[5], - (*cmd)->cmd.msg_len); - if((err = ioctl(fd, FE_DISEQC_SEND_MASTER_CMD, &(*cmd)->cmd))) + + if(diseqc_repeat) { - log_message( log_module, MSG_WARN, "problem sending the repeated DiseqC message\n"); - return -1; + msleep(100); + //Framing byte : Command from master, no reply required, repeated transmission : 0xe1 + cmd[0]->cmd.msg[0] = 0xe1; + //cmd.msg[0] = 0xe1; /* framing: master, no reply, repeated TX */ + log_message( log_module, MSG_DETAIL ,"Sending repeated Diseqc message %02x %02x %02x %02x %02x %02x len %d\n", + (*cmd)->cmd.msg[0],(*cmd)->cmd.msg[1],(*cmd)->cmd.msg[2],(*cmd)->cmd.msg[3],(*cmd)->cmd.msg[4],(*cmd)->cmd.msg[5], + (*cmd)->cmd.msg_len); + if((err = ioctl(fd, FE_DISEQC_SEND_MASTER_CMD, &(*cmd)->cmd))) + { + log_message( log_module, MSG_WARN, "problem sending the repeated DiseqC message\n"); + return -1; + } + msleep((*cmd)->wait); } - msleep((*cmd)->wait); cmd++; } @@ -654,7 +671,7 @@ static int diseqc_send_msg(int fd, fe_sec_voltage_t v, struct diseqc_cmd **cmd, * @param hi_lo : the band for a dual band lnb * @param lnb_voltage_off : if one, force the 13/18V voltage to be 0 independantly of polarization */ -static int do_diseqc(int fd, unsigned char sat_no, unsigned char switch_no, char switch_type, int pol_v_r, int hi_lo, int lnb_voltage_off) +static int do_diseqc(int fd, unsigned char sat_no, unsigned char switch_no, char switch_type, int pol_v_r, int hi_lo, int lnb_voltage_off, int diseqc_repeat) { fe_sec_voltage_t lnb_voltage; @@ -721,7 +738,7 @@ static int do_diseqc(int fd, unsigned char sat_no, unsigned char switch_no, cha lnb_voltage, cmd, hi_lo ? SEC_TONE_ON : SEC_TONE_OFF, - (sat_no) % 2 ? SEC_MINI_B : SEC_MINI_A); + (sat_no) % 2 ? SEC_MINI_B : SEC_MINI_A, diseqc_repeat); if(ret) { log_message( log_module, MSG_WARN, "problem sending the DiseqC message or setting tone/voltage\n"); @@ -1043,7 +1060,8 @@ case FE_ATSC: //ATSC tuneparams->switch_type, (tuneparams->pol == 'V' ? 1 : 0) + (tuneparams->pol == 'R' ? 1 : 0), hi_lo, - tuneparams->lnb_voltage_off) == 0) + tuneparams->lnb_voltage_off, + tuneparams->diseqc_repeat) == 0) log_message( log_module, MSG_INFO, "DISEQC SETTING SUCCEDED\n"); else { log_message( log_module, MSG_WARN, "DISEQC SETTING FAILED\n"); diff --git a/src/tune.h b/src/tune.h index 678c4789..2bd2895c 100644 --- a/src/tune.h +++ b/src/tune.h @@ -122,6 +122,8 @@ typedef struct tune_p_t{ unsigned char switch_no; /**The type of switch U uncommitted C committed*/ char switch_type; + /** Do we repeat DiseQC messages ? */ + int diseqc_repeat; /** The kind of modulation */ fe_modulation_t modulation; int modulation_set; diff --git a/src/unicast_http.c b/src/unicast_http.c index 2ba86962..624f2060 100644 --- a/src/unicast_http.c +++ b/src/unicast_http.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -47,6 +48,7 @@ #include #include #include +#include #include "unicast_http.h" #include "unicast_queue.h" @@ -60,10 +62,7 @@ #include "cam.h" #endif #ifdef ENABLE_SCAM_SUPPORT -#include "scam_capmt.h" #include "scam_common.h" -#include "scam_getcw.h" -#include "scam_decsa.h" #endif static char *log_module="Unicast : "; @@ -88,7 +87,7 @@ unicast_send_signal_power_js (int Socket, strength_parameters_t *strengthparams) int unicast_send_channel_traffic_js (int number_of_channels, mumudvb_channel_t *channels, int Socket); int -unicast_send_xml_state (int number_of_channels, mumudvb_channel_t* channels, int Socket, strength_parameters_t* strengthparams, auto_p_t* auto_p, void* cam_p_v, void* scam_vars_v); +unicast_send_xml_state (unicast_parameters_t* unicast_vars, int number_of_channels, mumudvb_channel_t* channels, int Socket, strength_parameters_t* strengthparams, auto_p_t* auto_p, void* cam_p_v, void* scam_vars_v); int unicast_send_cam_menu (int Socket, void *cam_p); int @@ -633,16 +632,43 @@ int unicast_handle_message(unicast_parameters_t *unicast_vars, unicast_client_t return -2; //to delete the client } pos+=strlen("/byname/"); - log_message( log_module, MSG_DEBUG,"Channel by number\n"); - substring = strtok (client->buffer+pos, " "); - if(substring == NULL) + log_message( log_module, MSG_DEBUG,"Channel by name\n"); + + char *substring = client->buffer+pos; + char *end = strstr(substring, " HTTP"); // find end of channel name (this way channel name can contain spaces) + + if(substring == NULL) { err404=1; + } + else if(end == NULL) { + err404=1; + log_message( log_module, MSG_DEBUG,"Channel name was not found in the URL `%s`\n", substring); + } else { - log_message( log_module, MSG_DEBUG,"Channel by name, name %s\n",substring); - //search the channel - err404=1;//Temporary - /** @todo implement the search without the spaces*/ + end[0] = '\0'; // add string terminator to be able to get channel name + + char requested_channel_name[MAX_NAME_LEN]; + char current_channel_name[MAX_NAME_LEN]; + strcpy(requested_channel_name, substring); + process_channel_name(requested_channel_name); + + for(int current_channel=0; current_channelbuffer +pos ,"/monitor/state.xml ")==(client->buffer +pos)) { log_message( log_module, MSG_DETAIL,"HTTP request for XML State\n"); - unicast_send_xml_state(number_of_channels, channels, client->Socket, strengthparams, auto_p, cam_p, scam_vars); + unicast_send_xml_state(unicast_vars, number_of_channels, channels, client->Socket, strengthparams, auto_p, cam_p, scam_vars); return -2; //We close the connection afterwards } else if(strstr(client->buffer +pos ,"/cam/menu.xml ")==(client->buffer +pos)) @@ -1105,12 +1131,28 @@ unicast_send_play_list_multicast (int number_of_channels, mumudvb_channel_t *cha return 0; } - - - - - - - - - +/** @brief Trims name of a channel to remove leading and trailing spaces, and replaces all spaces by '-' character. + * Note that the string will be modified so do a copy prior to running this function if modifications to the original shall be prevented. + * + * @param str Channel name to process + */ +void process_channel_name(char *str) { + int i; + int begin = 0; + int end = strlen(str) - 1; + + while (isspace(str[begin])) + begin++; + while ((end >= begin) && isspace(str[end])) + end--; + + // shift all characters back to the start of the string array + for (i = begin; i <= end; i++) { + if (isspace(str[i])) + str[i - begin] = '-'; // replace spaces by '-' + else + str[i - begin] = str[i]; + } + + str[i - begin] = '\0'; +} diff --git a/src/unicast_http.h b/src/unicast_http.h index 1a247bf4..ca0d8f9e 100644 --- a/src/unicast_http.h +++ b/src/unicast_http.h @@ -207,7 +207,7 @@ int read_unicast_configuration(unicast_parameters_t *unicast_vars, mumudvb_chann void unicast_data_send(mumudvb_channel_t *actual_channel, fds_t *fds, unicast_parameters_t *unicast_vars); - +void process_channel_name(char *str); #endif diff --git a/src/unicast_monit.c b/src/unicast_monit.c index 2e81ec00..7d3e12ca 100644 --- a/src/unicast_monit.c +++ b/src/unicast_monit.c @@ -41,10 +41,7 @@ #include "cam.h" #endif #ifdef ENABLE_SCAM_SUPPORT -#include "scam_capmt.h" #include "scam_common.h" -#include "scam_getcw.h" -#include "scam_decsa.h" #endif static char *log_module="Unicast : "; @@ -192,7 +189,7 @@ unicast_send_channel_traffic_js (int number_of_channels, mumudvb_channel_t *chan * @param fds the frontend device structure */ int -unicast_send_xml_state (int number_of_channels, mumudvb_channel_t *channels, int Socket, strength_parameters_t *strengthparams, auto_p_t *auto_p, void *cam_p_v, void *scam_vars_v) +unicast_send_xml_state (unicast_parameters_t* unicast_vars, int number_of_channels, mumudvb_channel_t* channels, int Socket, strength_parameters_t* strengthparams, auto_p_t* auto_p, void* cam_p_v, void* scam_vars_v) { #ifndef ENABLE_CAM_SUPPORT (void) cam_p_v; //to make compiler happy @@ -320,6 +317,10 @@ unicast_send_xml_state (int number_of_channels, mumudvb_channel_t *channels, int // SCAM information #ifdef ENABLE_SCAM_SUPPORT unicast_reply_write(reply, "\t%d\n",scam_vars->scam_support); +#else + unicast_reply_write(reply, "\t%d\n",0); +#endif +#ifdef ENABLE_SCAM_DESCRAMBLER_SUPPORT if (scam_vars->scam_support) { unicast_reply_write(reply, "\t%u\n",scam_vars->ring_buffer_default_size); unicast_reply_write(reply, "\t%u\n",scam_vars->decsa_default_delay); @@ -331,7 +332,6 @@ unicast_send_xml_state (int number_of_channels, mumudvb_channel_t *channels, int unicast_reply_write(reply, "\t%u\n",0); } #else - unicast_reply_write(reply, "\t%d\n",0); unicast_reply_write(reply, "\t%u\n",0); unicast_reply_write(reply, "\t%u\n",0); unicast_reply_write(reply, "\t%u\n",0); @@ -361,6 +361,7 @@ unicast_send_xml_state (int number_of_channels, mumudvb_channel_t *channels, int #ifdef ENABLE_SCAM_SUPPORT if (scam_vars->scam_support) { unicast_reply_write(reply, "\t\t\n",channels[curr_channel].scam_support); +#ifdef ENABLE_SCAM_DESCRAMBLER_SUPPORT if (channels[curr_channel].scam_support) { unsigned int ring_buffer_num_packets = 0; @@ -375,6 +376,7 @@ unicast_send_xml_state (int number_of_channels, mumudvb_channel_t *channels, int unicast_reply_write(reply, "\t\t\t%u\n",channels[curr_channel].send_delay); unicast_reply_write(reply, "\t\t\t%u\n",ring_buffer_num_packets); } +#endif unicast_reply_write(reply, "\t\t\n"); } #endif @@ -390,6 +392,16 @@ unicast_send_xml_state (int number_of_channels, mumudvb_channel_t *channels, int unicast_reply_write(reply, "\t\n"); } + + unicast_reply_write(reply, "\t\n", (unicast_vars?unicast_vars->client_number:0)); + unicast_client_t *client=unicast_vars->clients; + while(client!=NULL) { + unicast_reply_write(reply, "\t\n", client->Socket, inet_ntoa(client->SocketAddr.sin_addr), client->SocketAddr.sin_port, client->askedChannel, (client->chan_ptr?client->chan_ptr->service_id:-1), (client->chan_ptr?client->chan_ptr->name:"NA")); + unicast_reply_write(reply, "\t\n"); + client=client->next; + } + unicast_reply_write(reply, "\t\n"); + // Ending XML content unicast_reply_write(reply, "\n");