diff --git a/Makefile b/Makefile
index 6ec18b03..609a5a0b 100644
--- a/Makefile
+++ b/Makefile
@@ -117,6 +117,7 @@ SRCS = src/version.c \
src/rtsp.c \
src/fsmonitor.c \
src/cron.c \
+ src/esfilter.c
SRCS-${CONFIG_UPNP} += \
src/upnp.c
@@ -131,7 +132,8 @@ SRCS += \
src/api/api_mpegts.c \
src/api/api_epg.c \
src/api/api_epggrab.c \
- src/api/api_imagecache.c
+ src/api/api_imagecache.c \
+ src/api/api_esfilter.c
SRCS += \
src/parsers/parsers.c \
diff --git a/docs/html/config_esfilter.html b/docs/html/config_esfilter.html
new file mode 100644
index 00000000..75a03de4
--- /dev/null
+++ b/docs/html/config_esfilter.html
@@ -0,0 +1,109 @@
+
+
+This table defines rules to filter and order the elementary streams
+like video or audio from the input feed.
+
+
+The execution order of commands is granted. It means that first rule
+is executed for all available streams then second and so on.
+
+
+If any elementary stream is not marked as ignored or exclusive, it is
+used. If you like to ignore unknown elementary streams, add a rule
+to the end of grid with the any (not defined) comparisons and
+with the action ignore.
+
+
+The rules for different elementary stream groups (video, audio,
+teletext, subtitle, CA, other) are executed separately (as visually edited).
+
+
+For the visual verification of the filtering, there is a service info
+dialog in the Configuration / DVB Inputs / Services window . This dialog
+shows the received PIDs and filtered PIDs in one window.
+
+
+The rules are listed / edited in a grid.
+
+
+ - To edit a cell, double click on it. After a cell is changed it
+ will flags one of its corner to red to indicated that it has been
+ changed. To commit these changes back to Tvheadend press the
+ 'Save changes' button. In order to change a Checkbox cell you only
+ have to click once in it.
+
+
- To add a new entry, press the 'Add entry' button. The new (empty) entry
+ will be created on the server but will not be in its enabled state.
+ You can now change all the cells to the desired values, check the
+ 'enable' box and then press 'Save changes' to activate the new entry.
+
+
- To delete one or more entries, select the lines (by clicking once on
+ them), and press the 'Delete selected' button. A pop up
+ will ask you to confirm your request.
+
+
- To move up or down one or more entries, select the lines (by clicking
+ once on them), and press the 'Move up' or 'Move down' button.
+
+
+
+The columns have the following functions:
+
+
+ - Enabled
+
- If selected, the rule will be enabled.
+
+
- Stream Type
+
- Select the elementary stream type to compare. Empty field means any.
+
+
- Language
+
- Select the language to compare. Empty field means any.
+
+
- Service
+
- The service to compare. Empty field means any.
+
+
- CA Identification
+
- The CAID to compare. Empty field means any.
+
+
- CA Provider
+
- The CA provider to compare. Empty field means any.
+
+
- PID
+
- Program identification (PID) number to compare. Zero means any.
+ This comparison is processed only when service comparison is active.
+
+
- Action
+
- The rule action defines the operation when all comparisons succeeds.
+
+
+
+ - NONE
+
- No action, may be used for the logging and a comparison verification.
+
+
- USE
+
- Use this elementary stream.
+
+
- ONCE
+
- Use this elementary stream only once per selected language.
+ The first successfully compared rule wins.
+
+
- EXCLUSIVE
+
- Use only this elementary stream. No other elementary streams
+ will be used.
+
+
- EMPTY
+
- Add this elementary stream only when no elementary streams are
+ used from previous rules.
+
+
- IGNORE
+
- Ignore this elementary stream. This stream is not used. Another
+ successfully compared rule with different action may override it.
+
+
+
+ - Log
+
- Write a short message to log identifying the matched parameters.
+ It is useful for debugging your setup or structure of incoming
+ streams.
+
+
+
diff --git a/src/api.c b/src/api.c
index 97546982..83392622 100644
--- a/src/api.c
+++ b/src/api.c
@@ -125,6 +125,7 @@ void api_init ( void )
api_epggrab_init();
api_status_init();
api_imagecache_init();
+ api_esfilter_init();
}
void api_done ( void )
diff --git a/src/api.h b/src/api.h
index 6a275732..f51f7ebe 100644
--- a/src/api.h
+++ b/src/api.h
@@ -67,12 +67,14 @@ void api_epg_init ( void );
void api_epggrab_init ( void );
void api_status_init ( void );
void api_imagecache_init ( void );
+void api_esfilter_init ( void );
/*
* IDnode
*/
typedef struct api_idnode_grid_conf
{
+ int tindex;
int start;
int limit;
idnode_filter_t filter;
diff --git a/src/api/api_esfilter.c b/src/api/api_esfilter.c
new file mode 100644
index 00000000..2769f8c3
--- /dev/null
+++ b/src/api/api_esfilter.c
@@ -0,0 +1,101 @@
+/*
+ * API - elementary stream filter related calls
+ *
+ * Copyright (C) 2014 Jaroslav Kysela
+ *
+ * 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 3 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, see