Commit 7d4ed892 authored by Alessio Treglia's avatar Alessio Treglia

Imported Upstream version 2.0.0

parent 8a7cd71e
# Contributors to DVBlast
# $Id: AUTHORS 94 2010-01-04 20:15:43Z gatty $
#
# The format of this file was inspired by the Linux kernel CREDITS file.
# Authors are listed alphabetically.
......@@ -7,6 +6,10 @@
# The fields are: name (N), email (E), web-address (W), CVS account login (C),
# PGP key ID and fingerprint (P), description (D), and snail-mail address (S).
N: Georgi Chorbadzhiyski
E: gf AT unixsol.org
D: numerous bug fixes and enhancements
N: Marian Ďurkovič
E: md AT bts DOT sk
C: md
......@@ -17,7 +20,16 @@ E: a DOT j DOT gatward AT reading DOT ac DOT uk
C: gatty
D: EIT pass-through, IPv6 support, various bug fixes
N: Peter Partin
E: peter DOT martin AT tripleplay DASH servies DOT com
D: ATSC, MRTG, PID remap
N: Christophe Massiot
E: massiot AT via DOT ecp DOT fr
C: massiot
D: Most of the code
N: Jean-Paul Saman
E: jpsaman AT videolan DOT org
C: jpsaman
D: DVB-S2 bug fixes, syslog support
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
This diff is collapsed.
$Id: INSTALL 118 2010-02-28 23:52:48Z massiot $
Getting DVBlast
===============
Offically released DVBlast versions can be downloaded at:
ftp://ftp.videolan.org/pub/videolan/dvblast/
DVBlast is developed using git. To get the latest version clone
the repository at: git://git.videolan.org/dvblast.git
To see the latest developments visit the following url:
http://git.videolan.org/?p=dvblast.git
Installing DVBlast
==================
No autotools yet... You have to tweak the Makefile by hand, especially
if your kernel is S2API-enabled but not your distribution (indicate the
path of your kernel where appropriate). Compile the program with `make`
and install with `make install`. It requires the installation of libdvbpsi
0.1.6 or later and libdvbpsi-devel (depending on your distribution).
Compile the program with `make` and install with `make install`. Your
kernel must support DVB S2API which was merged in Linux 2.6.28 and released
on 24 Dec 2008.
DVBlast 2.0 no longer requires libdvbpsi runtime and libdvbpsi-devel for
compilation. Instead you must install biTStream on your build machine (no
runtime library is needed).
To install biTStream, clone git repository and run `make install`.
git clone git://git.videolan.org/bitstream.git
cd bitstream
make install
# DVBlast Makefile
# Customise the path of your kernel
CFLAGS += -Wall -O3 -fomit-frame-pointer
VERSION = 2.0.0
TOPDIR = `basename ${PWD}`
GIT_VER = $(shell git describe --tags --dirty --always 2>/dev/null)
CFLAGS += -Wall -Wformat-security -O3 -fomit-frame-pointer
CFLAGS += -g
CFLAGS += -I/usr/src/kernel/linux-2.6.29.1/include
ifneq "$(GIT_VER)" ""
CFLAGS += -DVERSION_EXTRA=\"git-$(GIT_VER)\"
else
CFLAGS += -DVERSION_EXTRA=\"release\"
endif
LDLIBS += -lrt
LDLIBS_DVBLAST += -ldvbpsi -lpthread
LDLIBS_DVBLAST += -lpthread
OBJ_DVBLAST = dvblast.o util.o dvb.o udp.o asi.o demux.o output.o en50221.o comm.o
OBJ_DVBLAST = dvblast.o util.o dvb.o udp.o asi.o demux.o output.o en50221.o comm.o mrtg-cnt.o
OBJ_DVBLASTCTL = util.o dvblastctl.o
ifndef V
Q = @
endif
CLEAN_OBJS = dvblast dvblastctl $(OBJ_DVBLAST) $(OBJ_DVBLASTCTL)
INSTALL_BIN = dvblast dvblastctl dvblast_mmi.sh
INSTALL_MAN = dvblast.1
PREFIX ?= /usr/local
BIN = $(DESTDIR)/$(PREFIX)/bin
MAN = $(DESTDIR)/$(PREFIX)/share/man/man1
BIN = $(subst //,/,$(DESTDIR)/$(PREFIX)/bin)
MAN = $(subst //,/,$(DESTDIR)/$(PREFIX)/share/man/man1)
all: dvblast dvblastctl
$(OBJ_DVBLAST) $(OBJ_DVBLASTCTL): Makefile dvblast.h en50221.h comm.h version.h asi.h
.PHONY: clean install uninstall dist
%.o: %.c Makefile dvblast.h en50221.h comm.h version.h asi.h mrtg-cnt.h
@echo "CC $<"
$(Q)$(CC) $(CFLAGS) -c $<
dvblast: $(OBJ_DVBLAST)
$(CC) -o $@ $(OBJ_DVBLAST) $(LDLIBS_DVBLAST) $(LDLIBS)
@echo "LINK $@"
$(Q)$(CC) -o $@ $(OBJ_DVBLAST) $(LDLIBS_DVBLAST) $(LDLIBS)
dvblastctl: $(OBJ_DVBLASTCTL)
@echo "LINK $@"
$(Q)$(CC) -o $@ $(OBJ_DVBLASTCTL) $(LDLIBS_DVBLAST) $(LDLIBS)
clean:
@rm -f dvblast dvblastctl $(OBJ_DVBLAST) $(OBJ_DVBLASTCTL)
@echo "CLEAN $(CLEAN_OBJS)"
$(Q)rm -f $(CLEAN_OBJS)
install: all
@install -d $(BIN)
@install -d $(MAN)
@install dvblast dvblastctl dvblast_mmi.sh $(BIN)
@install -m 644 dvblast.1 $(MAN)
@install -d "$(BIN)"
@install -d "$(MAN)"
@echo "INSTALL $(INSTALL_MAN) -> $(MAN)"
$(Q)install -m 644 dvblast.1 "$(MAN)"
@echo "INSTALL $(INSTALL_BIN) -> $(BIN)"
$(Q)install dvblast dvblastctl dvblast_mmi.sh "$(BIN)"
uninstall:
@rm $(BIN)/dvblast $(BIN)/dvblastctl $(BIN)/dvblast_mmi.sh $(MAN)/dvblast.1
@-for FILE in $(INSTALL_BIN); do \
echo "RM $(BIN)/$$FILE"; \
rm "$(BIN)/$$FILE"; \
done
@-for FILE in $(INSTALL_MAN); do \
echo "RM $(MAN)/$$FILE"; \
rm "$(MAN)/$$FILE"; \
done
dist: clean
@echo "ARCHIVE dvblast-$(VERSION).tar.bz2"
$(Q)git archive --format=tar --prefix=dvblast-$(VERSION)/ master | bzip2 -9 > dvblast-$(VERSION).tar.bz2
$(Q)ls -l dvblast-$(VERSION).tar.bz2
$Id: NEWS 106 2010-02-27 14:14:39Z massiot $
Changes between 1.2 and 2.0:
----------------------------
* Fix latency and potential packet loss during CAM communication
* Add optional kernel patches for lower latency
* Smooth packet output with an extra buffer
* libdvbpsi runtime is no longer needed; biTStream development library
is used instead
* Add the ability to bind to a specific network interface
* Add a configurable MTU
* Add support for NIT in DVB compliance mode
* Syslog support with -l option
* Override tuning parameters with new options
* Output all PMTs with -w, all ESs (even unknown) for a program with -z
* Add support for ECM and EMM packets pass-through
* Fix diseqc command with high-band tranponders
* Add basic support for ATSC
* Add support for MRTG statistics
* Add detailed information for TS errors
* Add support for getting PAT/CAT/NIT/SDT tables in dvblastctl
* Add support for getting PMT table for chosen service in dvblastctl
* Add support for getting PID information (bps, error counters and more)
* Add support for setting service name and provider name per output
* Command socket is usable with any input (ASI, DVB, UDP), previously
only DVB input worked
Changes between 1.1 and 1.2:
----------------------------
......@@ -6,6 +30,7 @@ Changes between 1.1 and 1.2:
* Support input from Computer Modules ASI card
* Support input from (IPv4) RTP / UDP stream
* Miscellaneous CAM and demux fixes
* Miscellaneous DVB-S2 fixes
Changes between 1.0 and 1.1:
----------------------------
......
$Id: README 116 2010-02-28 22:21:33Z massiot $
Welcome to DVBlast!
===================
......@@ -13,7 +12,7 @@ It outputs one or several RTP streams carrying transport streams with:
- hardware or software PID filtering
- PID-based or service-based demultiplexing
- optional descrambling via CAM device
- EIT, SDT and TDT pass-through for EPG information<
- optional DVB tables
DVBlast is written to be the core of a custom IRD, CID,or ASI gateway,
based on a PC with a Linux-supported card. It is very lightweight and
......@@ -24,9 +23,10 @@ Current features
================
- Lightweight program designed for extreme memory and CPU conditions
- Only one dependancy: libdvbpsi
- No runtime dependancy; one build dependancy (biTStream)
- CAM menus (MMI) support via an external application
- The configuration file describing outputs can be reloaded without losing a single packet
- The configuration file describing outputs can be reloaded without losing
a single packet
- Support for the new S2API of linux-dvb
- IPv6 network support
- UDP rather than RTP output for IPTV STBs which don't support RTP
......@@ -48,6 +48,15 @@ Please note that frequencies are in kHz for DVB-S/S2/C, but Hz for DVB-T.
Symbol rates are in symbols/s, and bandwidths in MHz. If you have several
linux-dvb cards in the machine, specify which one to use with -a.
You generally want to run DVBlast in DVB compliance mode with option -C.
This option will pass through or generate mandatory DVB tables (NIT, SDT,
EITp/f, TOT, TDT). If you also want to pass-through the EIT schedule tables,
use the -e switch. It is considered a good practice to configure the name
of the network (for the NIT) with the -M option.
If you don't want to set these options on a general basis, you can set them
per output - see below.
Other rarely used options are available - run dvblast -h for more
information.
......@@ -55,6 +64,11 @@ information.
Alternative inputs
==================
DVBlast may handle several DVB adapters in the same machine with the -a switch:
-a 3 will use /dev/dvb/adapter3. Additionally, selecting between frontends on
a single card is supported with the -n switch. This is useful for hybrid
DVB/S + DVB/T cards.
If you own a Computer Modules DVB-ASI input card, you can have DVBlast
filter and demultiplex the inputs. You just need to specify the slot number
with -A.
......@@ -65,13 +79,26 @@ instance a multi-program transport stream. The address is specified with
such a stream for instance to cross network boundaries between the
receivers and the target network.
The syntax of the -D option is:
[<src host>[:<src port>]@]<src mcast>[:<port>][/<opts>]*
where <src mcast> is the multicast address carrying the stream, and <src
host> is optionally the address of the source, for source-specific multicast.
Options include:
/udp (for streams without an RTP header)
/mtu=XXXX (sets the maximum UDP packet size)
/ifindex=X (binds to a specific network interface, by link number)
/ifaddr=XXX.XXX.XXX.XXX (binds to a specific network interface, by address)
For example:
-D 239.255.0.2:1234/udp/ifindex=1
Configuring outputs
===================
DVBlast reads a configuration file containing one or several lines in the
format :
<IP>[:<port>][/udp] <always on> <SID> [<PID>,]*
<IP>[:<port>][@<IP>[:<port>]][/<option>]* <always on> <SID> [<PID>,]*
For instance :
239.255.0.1:1234 1 10750 1234,1235,1236
......@@ -90,12 +117,45 @@ For example :
[ff12::1%eth0]:1234 1 10750
[ff15::abcd]:1234 1 10750
An optional bind address can be specified after an '@' sign. The typical
usage of this is to allow binding to a specific interface in a system which
has several. For instance:
239.255.0.1:1234@192.168.42.1 1 10750
For IPv6 the bind address is not relevant; binding to an interface is achieved
via the option "/ifindex=X" where X is the number of the link, as given by
the command `ip link`.
The "always on" flag tells DVBlast whether the channel is expected to
be on at all times or if it may break. If set to "1", then DVBlast will
regularly reset the CAM module if it fails to descramble the service,
assuming the module is dead. Every time it is reset a few TS packets
will be lost, that is why this feature is optional.
Other options can be set by appending / to the multicast address definition.
Available options include :
/udp (turns on -U for a specific output)
/dvb (turns on -C for a specific output)
/epg (turns on -C -e for a specific output)
/tsid=XXX (sets the transport stream ID)
/ssrc=XXX.XXX.XXX.XXX (sets the RTP synchronization source IPv4)
/retention=XXX (see -E)
/latency=XXX (see -L)
/ttl=XX (see -t)
/tos=XX (sets the IPv4 Type Of Service option)
/mtu=XXXX (sets the maximum UDP packet size)
/ecm or /noecm (pass-through ECM packets or not)
/emm or /noemm (pass-through EMM packets or not)
/srvname=Some_Channel (set service name in SDT)
/srvprovider=Some_Provider (set provider name in SDT)
When setting text options like /srvname or /srvprovider, remember
that the underscore character (_) will be replaced by space ( ).
Several options can be appended, for instance:
239.255.0.1:1234/udp/epg/tsid=42/ssrc=192.168.0.1
The optional "/udp" parameter can be used to force DVBlast to output
raw UDP stream. This functionality is provided for backwards compatibility
with IPTV set top boxes that don't support RTP and should only be used
......@@ -140,6 +200,52 @@ from the command-line :
dvblast -c /tmp/dvblast.conf
Buffering
=========
DVB cards usually output packets in big chunks. This can be problematic
with low bitrate multiplexes. By default, DVBlast bufferizes 200 ms
and tries to smooth the output. It may be desired to change this value
with the -L option. The appropriate value for the output latency should be :
chunk_size / multiplex_bitrate
The chunk size for saa7146-based cards is 512000 bits ; for
cx23885-based cards is 192512 bits. The chunk size can be modified with
an appropriate kernel patch (see extra/). The multiplex_bitrate depends
on the symbol rate and many other factors such as the modulation.
The current default value allows for multiplex_rates as low as 2.56 Mbi/s.
Smaller multiplexes are rare but exist, so in that case you may want to
increase the buffer size. A typical DVB multiplex is 30 or 40 Mbi/s, so
the default introduces a superfluous latency ; the buffer can be lowered
to 50 ms if latency is an issue.
DVBlast also has another parameter called "max retention time" (-E).
This controls how TS packets are grouped together in IP datagrams : the
difference between the theorical output times of the first and the last
TS packets cannot exceed the maximal retention time.
IP datagrams are normally output at the output time of the earliest TS
packet ; it implies that the next TS packets are sent too soon and must
be buffered at the receiver level. ISO/IEC 13818-1 makes no provision for
this, since IP wasn't in mind when designing TS, so in theory we risk a
buffer overflow.
However normal IP receivers feature a jitter buffer which can absorb the
overflow ; DVB recommends a 50 ms buffer. DVBlast's default maximal
retention time is just below, at 40 ms, which should be fine in most
situations.
If some anal set-top-box complains about buffer overflows or clock issues,
you may try to lower the value ; the drawback is that on low bitrate
streams it will introduce padding. People with low bitrate streams and
nice receivers with big buffers can raise this value to avoid superfluous
padding and lower the total bitrate.
Please bear in mind though that setting a value for max retention time
greater than the output latency has no effect.
Monitoring
==========
......@@ -163,11 +269,6 @@ dvblast_mmi.sh -r /tmp/dvblast.sock
Advanced features
=================
DVBlast may handle several DVB adapters in the same machine with the -a switch:
-a 3 will use /dev/dvb/adapter3. Additionally, selecting between frontends on
a single card is supported with the -n switch. This is useful for hybrid
DVB/S + DVB/T cards.
For better latency, run DVBlast in real-time priority: -i 1 (requires root
privileges).
......@@ -179,7 +280,7 @@ Note that IPv6 addresses specified on command line may need to have the square
brackets escaped (\[ and \]), depending on your shell.
The -u switch disables the PID filters, so that all PIDs, even the
unused ones, can be output. With -e, dvblast also streams EIT and SDT packets
for the related services.
unused ones, can be output.
Other options are self-understandable, and are listed in dvblast -h.
- Test and enhance the API for DVB-C, H, and ATSC support
- Win32 support
- Improve build system (autostuff)
- Rework the EN 50 221 machinery to avoid blocking TPDU_Recv and Send
......@@ -2,7 +2,6 @@
* asi.c: support for Computer Modules ASI cards
*****************************************************************************
* Copyright (C) 2004, 2009 VideoLAN
* $Id: asi.c 9 2007-03-15 16:58:05Z cmassiot $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -18,13 +17,14 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
......@@ -37,6 +37,8 @@
#include <arpa/inet.h>
#include <errno.h>
#include <bitstream/common.h>
#include "asi.h"
#include "dvblast.h"
......@@ -55,10 +57,12 @@
#define ASI_DEVICE "/dev/asirx%u"
#define ASI_TIMESTAMPS_FILE "/sys/class/asi/asirx%u/timestamps"
#define ASI_BUFSIZE_FILE "/sys/class/asi/asirx%u/bufsize"
#define ASI_LOCK_TIMEOUT 5000000 /* 5 s */
static int i_handle;
static int i_bufsize;
static uint8_t p_pid_filter[8192 / 8];
static mtime_t i_last_packet = 0;
/*****************************************************************************
* Local helpers
......@@ -167,82 +171,119 @@ void asi_Open( void )
/*****************************************************************************
* asi_Read : read packets from the device
*****************************************************************************/
block_t *asi_Read( void )
block_t *asi_Read( mtime_t i_poll_timeout )
{
int i, i_len;
struct iovec p_iov[i_bufsize / TS_SIZE];
block_t *p_ts, **pp_current = &p_ts;
struct pollfd pfd[2];
int i_ret, i_nb_fd = 1;
for ( ; ; )
pfd[0].fd = i_handle;
pfd[0].events = POLLIN;
if ( i_comm_fd != -1 )
{
struct pollfd pfd;
pfd[1].fd = i_comm_fd;
pfd[1].events = POLLIN;
i_nb_fd++;
}
pfd.fd = i_handle;
pfd.events = POLLIN | POLLPRI;
i_ret = poll( pfd, i_nb_fd, (i_poll_timeout + 999) / 1000 );
if ( poll(&pfd, 1, -1) < 0 )
{
i_wallclock = mdate();
if ( i_ret < 0 )
{
if( errno != EINTR )
msg_Err( NULL, "couldn't poll from device " ASI_DEVICE " (%s)",
i_asi_adapter, strerror(errno) );
continue;
return NULL;
}
if ( (pfd[0].revents & POLLPRI) )
{
unsigned int i_val;
if ( ioctl(i_handle, ASI_IOC_RXGETEVENTS, &i_val) < 0 )
msg_Err( NULL, "couldn't RXGETEVENTS (%s)", strerror(errno) );
else
{
if ( i_val & ASI_EVENT_RX_BUFFER )
msg_Warn( NULL, "driver receive buffer queue overrun" );
if ( i_val & ASI_EVENT_RX_FIFO )
msg_Warn( NULL, "onboard receive FIFO overrun" );
if ( i_val & ASI_EVENT_RX_CARRIER )
msg_Warn( NULL, "carrier status change" );
if ( i_val & ASI_EVENT_RX_LOS )
msg_Warn( NULL, "loss of packet synchronization" );
if ( i_val & ASI_EVENT_RX_AOS )
msg_Warn( NULL, "acquisition of packet synchronization" );
if ( i_val & ASI_EVENT_RX_DATA )
msg_Warn( NULL, "receive data status change" );
}
}
if ( (pfd.revents & POLLPRI) )
if ( (pfd[0].revents & POLLIN) )
{
struct iovec p_iov[i_bufsize / TS_SIZE];
block_t *p_ts, **pp_current = &p_ts;
int i, i_len;
if ( !i_last_packet )
{
unsigned int i_val;
if ( ioctl(i_handle, ASI_IOC_RXGETEVENTS, &i_val) < 0 )
msg_Err( NULL, "couldn't RXGETEVENTS (%s)", strerror(errno) );
else
{
if ( i_val & ASI_EVENT_RX_BUFFER )
msg_Warn( NULL, "driver receive buffer queue overrun" );
if ( i_val & ASI_EVENT_RX_FIFO )
msg_Warn( NULL, "onboard receive FIFO overrun" );
if ( i_val & ASI_EVENT_RX_CARRIER )
msg_Warn( NULL, "carrier status change" );
if ( i_val & ASI_EVENT_RX_LOS )
msg_Warn( NULL, "loss of packet synchronization" );
if ( i_val & ASI_EVENT_RX_AOS )
msg_Warn( NULL, "acquisition of packet synchronization" );
if ( i_val & ASI_EVENT_RX_DATA )
msg_Warn( NULL, "receive data status change" );
switch (i_print_type) {
case PRINT_XML:
printf("<STATUS type=\"lock\" status=\"1\"/>\n");
break;
default:
printf("frontend has acquired lock\n" );
}
}
i_last_packet = i_wallclock;
if ( (pfd.revents & POLLIN) )
break;
}
for ( i = 0; i < i_bufsize / TS_SIZE; i++ )
{
*pp_current = block_New();
p_iov[i].iov_base = (*pp_current)->p_ts;
p_iov[i].iov_len = TS_SIZE;
pp_current = &(*pp_current)->p_next;
}
for ( i = 0; i < i_bufsize / TS_SIZE; i++ )
{
*pp_current = block_New();
p_iov[i].iov_base = (*pp_current)->p_ts;
p_iov[i].iov_len = TS_SIZE;
pp_current = &(*pp_current)->p_next;
}
if ( (i_len = readv(i_handle, p_iov, i_bufsize / TS_SIZE)) < 0 )
{
msg_Err( NULL, "couldn't read from device " ASI_DEVICE " (%s)",
i_asi_adapter, strerror(errno) );
i_len = 0;
}
i_len /= TS_SIZE;
if ( (i_len = readv(i_handle, p_iov, i_bufsize / TS_SIZE)) < 0 )
{
msg_Err( NULL, "couldn't read from device " ASI_DEVICE " (%s)",
i_asi_adapter, strerror(errno) );
i_len = 0;
}
i_len /= TS_SIZE;
pp_current = &p_ts;
while ( i_len && *pp_current )
{
pp_current = &(*pp_current)->p_next;
i_len--;
}
if ( *pp_current )
msg_Dbg( NULL, "partial buffer received" );
block_DeleteChain( *pp_current );
*pp_current = NULL;
pp_current = &p_ts;
while ( i_len && *pp_current )
return p_ts;
}
else if ( i_last_packet && i_last_packet + ASI_LOCK_TIMEOUT < i_wallclock )
{
pp_current = &(*pp_current)->p_next;
i_len--;
switch (i_print_type) {
case PRINT_XML:
printf("<STATUS type=\"lock\" status=\"0\"/>\n");
break;
default:
printf("frontend has lost lock\n" );
}
i_last_packet = 0;
}
if ( *pp_current )
msg_Dbg( NULL, "partial buffer received" );
block_DeleteChain( *pp_current );
*pp_current = NULL;
if ( i_comm_fd != -1 && pfd[1].revents )
comm_Read();
return p_ts;
return NULL;
}
/*****************************************************************************
......@@ -251,7 +292,7 @@ block_t *asi_Read( void )
int asi_SetFilter( uint16_t i_pid )
{
#ifdef USE_HARDWARE_FILTERING
p_pid_filter[ i_pid / 8 ] |= (0x01 << (i_pid % 8));
p_pid_filter[ i_pid / 8 ] |= (0x01 << (i_pid % 8));
if ( ioctl( i_handle, ASI_IOC_RXSETPF, p_pid_filter ) < 0 )
msg_Warn( NULL, "couldn't add filter on PID %u", i_pid );
......@@ -267,8 +308,17 @@ int asi_SetFilter( uint16_t i_pid )
void asi_UnsetFilter( int i_fd, uint16_t i_pid )
{
#ifdef USE_HARDWARE_FILTERING
p_pid_filter[ i_pid / 8 ] &= ~(0x01 << (i_pid % 8));
p_pid_filter[ i_pid / 8 ] &= ~(0x01 << (i_pid % 8));
if ( ioctl( i_handle, ASI_IOC_RXSETPF, p_pid_filter ) < 0 )
msg_Warn( NULL, "couldn't remove filter on PID %u", i_pid );
#endif
}
/*****************************************************************************
* asi_Reset
*****************************************************************************/
void asi_Reset( void )
{
msg_Warn( NULL, "asi_Reset() do nothing" );
}
......@@ -2,29 +2,21 @@
* comm.c: Handles the communication socket (linux-dvb only)
*****************************************************************************
* Copyright (C) 2008 VideoLAN
* $Id: comm.c 82 2009-12-21 17:30:01Z massiot $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* This program is free software. It comes without any warranty, to
* the extent permitted by applicable law. You can redistribute it
* and/or modify it under the terms of the Do What The Fuck You Want
* To Public License, Version 2, as published by Sam Hocevar. See
* http://sam.zoy.org/wtfpl/COPYING for more details.
*****************************************************************************/
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
......@@ -48,8 +40,7 @@ int i_comm_fd = -1;
*****************************************************************************/
void comm_Open( void )
{
int i_mask;
int i_size = 65535;
int i_size = COMM_MAX_MSG_CHUNK;
struct sockaddr_un sun_server;
if ( (i_comm_fd = socket( AF_UNIX, SOCK_DGRAM, 0 )) == -1 )
......@@ -64,18 +55,15 @@ void comm_Open( void )
sun_server.sun_family = AF_UNIX;
strncpy( sun_server.sun_path, psz_srv_socket, sizeof(sun_server.sun_path) );
sun_server.sun_path[sizeof(sun_server.sun_path) - 1] = '\0';
i_mask = umask(077);
if ( bind( i_comm_fd, (struct sockaddr *)&sun_server,
SUN_LEN(&sun_server) ) < 0 )
{
msg_Err( NULL, "cannot bind comm socket (%s)", strerror(errno) );
umask( i_mask );
close( i_comm_fd );
i_comm_fd = -1;
return;
}
umask( i_mask );
}
/*****************************************************************************
......@@ -88,12 +76,16 @@ void comm_Read( void )
ssize_t i_size, i_answer_size = 0;
uint8_t p_buffer[COMM_BUFFER_SIZE], p_answer[COMM_BUFFER_SIZE];
uint8_t i_command, i_answer;
uint8_t *p_packed_section;
unsigned int i_packed_section_size;
uint8_t *p_input = p_buffer + COMM_HEADER_SIZE;
uint8_t *p_output = p_answer + COMM_HEADER_SIZE;
i_size = recvfrom( i_comm_fd, p_buffer, COMM_BUFFER_SIZE, 0,
(struct sockaddr *)&sun_client, &sun_length );
if ( i_size < COMM_HEADER_SIZE )
{
msg_Err( NULL, "cannot read comm socket (%d:%s)\n", i_size,
msg_Err( NULL, "cannot read comm socket (%zd:%s)\n", i_size,
strerror(errno) );
return;
}
......@@ -111,10 +103,29 @@ void comm_Read( void )
i_command = p_buffer[1];
if ( i_frequency == 0 ) /* ASI or UDP, disable DVB only commands */
{
switch ( i_command )
{
case CMD_FRONTEND_STATUS:
case CMD_MMI_STATUS:
case CMD_MMI_SLOT_STATUS:
case CMD_MMI_OPEN:
case CMD_MMI_CLOSE:
case CMD_MMI_RECV:
case CMD_MMI_SEND:
case CMD_MMI_SEND_TEXT:
case CMD_MMI_SEND_CHOICE:
i_answer = RET_NODATA;
i_answer_size = 0;
goto return_answer;
}
}
switch ( i_command )