/* test_sections.c - Test for section filters. * usage: DEMUX=/dev/dvb/adapterX/demuxX test_sections [PID [TID]] * * Copyright (C) 2002 convergence GmbH * Johannes Stezenbach * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2.1 * 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 Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include #include #include #include #include #include #include #include #include #include "hex_dump.h" #define MAX_SECTION_SIZE 8192 #if !defined(DMX_FILTER_SIZE) #define DMX_FILTER_SIZE 16 #endif static void parse_filter(unsigned char* filter, const char* filter_desc) { int filter_idx; char* end_ptr; memset(filter, '\0', DMX_FILTER_SIZE); for (filter_idx = 1; /* Leave first byte for tid */ filter_idx < DMX_FILTER_SIZE-1; ++filter_idx) { filter[filter_idx] = strtoul(filter_desc, &end_ptr, 0); if (*end_ptr == '\0' || end_ptr == filter_desc) break; filter_desc = end_ptr; } } void usage(void) { fprintf(stderr, "usage: test_sections PID [TID] [FILTER] [MASK]\n"); fprintf(stderr, " The default demux device used can be changed\n"); fprintf(stderr, " using the DEMUX environment variable;\n"); fprintf(stderr, " set env BUFFER to play with DMX_SET_BUFFER_SIZE\n"); fprintf(stderr, "\n"); fprintf(stderr, " The optional filter and mask may be used to filter on\n"); fprintf(stderr, " additional bytes. These bytes may be given in hex or dec\n"); fprintf(stderr, " separated by spaces (hint: you may have to use quotes around\n"); fprintf(stderr, " FILTER and MASK). TID is always the first byte of the filter,\n"); fprintf(stderr, " and the first byte from FILTER applies to byte 3 of the section\n"); fprintf(stderr, " data (i.e. the first byte after the section length)\n"); exit(1); } void process_section(int fd) { uint8_t buf[MAX_SECTION_SIZE]; int bytes; bytes = read(fd, buf, sizeof(buf)); if (bytes < 0) { perror("read"); if (errno != EOVERFLOW) exit(1); } hex_dump(buf, bytes); printf("\n"); } int set_filter(int fd, unsigned int pid, const unsigned char* filter, const unsigned char* mask) { struct dmx_sct_filter_params f; unsigned long bufsz; if (getenv("BUFFER")) { bufsz=strtoul(getenv("BUFFER"), NULL, 0); if (bufsz > 0 && bufsz <= MAX_SECTION_SIZE) { fprintf(stderr, "DMX_SET_BUFFER_SIZE %lu\n", bufsz); if (ioctl(fd, DMX_SET_BUFFER_SIZE, bufsz) == -1) { perror("DMX_SET_BUFFER_SIZE"); return 1; } } } memset(&f.filter, 0, sizeof(struct dmx_filter)); f.pid = (uint16_t) pid; memcpy(f.filter.filter, filter, DMX_FILTER_SIZE); memcpy(f.filter.mask, mask, DMX_FILTER_SIZE); f.timeout = 0; f.flags = DMX_IMMEDIATE_START | DMX_CHECK_CRC; if (ioctl(fd, DMX_SET_FILTER, &f) == -1) { perror("DMX_SET_FILTER"); return 1; } return 0; } int main(int argc, char *argv[]) { int dmxfd; unsigned long pid, tid; char * dmxdev = "/dev/dvb/adapter0/demux0"; unsigned char filter[DMX_FILTER_SIZE]; unsigned char mask[DMX_FILTER_SIZE]; int filter_idx; if (argc < 2 || argc > 5) usage(); pid = strtoul(argv[1], NULL, 0); if (pid > 0x1fff) usage(); if (argc > 2) { tid = strtoul(argv[2], NULL, 0); if (tid > 0xff) usage(); } else tid = 0x100; if (argc > 3) parse_filter(filter, argv[3]); else memset(filter, '\0', sizeof(filter)); if (argc > 4) parse_filter(mask, argv[4]); else memset(mask, '\0', sizeof(mask)); if (tid < 0x100) { filter[0] = tid; mask[0] = 0xff; } if (getenv("DEMUX")) dmxdev = getenv("DEMUX"); fprintf(stderr, "test_sections: using '%s'\n", dmxdev); fprintf(stderr, " PID 0x%04lx\n", pid); if (tid < 0x100) fprintf(stderr, " TID 0x%02lx\n", tid); fprintf(stderr, " Filter "); for (filter_idx = 0; filter_idx < DMX_FILTER_SIZE; ++filter_idx) fprintf(stderr, "0x%.2x ", filter[filter_idx]); fprintf(stderr, "\n"); fprintf(stderr, " Mask "); for (filter_idx = 0; filter_idx < DMX_FILTER_SIZE; ++filter_idx) fprintf(stderr, "0x%.2x ", mask[filter_idx]); fprintf(stderr, "\n"); if ((dmxfd = open(dmxdev, O_RDWR)) < 0){ perror("open"); return 1; } if (set_filter(dmxfd, pid, filter, mask) != 0) return 1; for (;;) { process_section(dmxfd); } close(dmxfd); return 0; } font-weight: bold } /* Keyword */ .highlight .ch { color: #888888 } /* Comment.Hashbang */ .highlight .cm { color: #888888 } /* Comment.Multiline */ .highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ .highlight .cpf { color: #888888 } /* Comment.PreprocFile */ .highlight .c1 { color: #888888 } /* Comment.Single */ .highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
#----------------------------------------------------------------------------------------------
# Auto-generated from:
# <http://www.digitaluk.co.uk/coveragechecker/main/tradeexport/SA17+5UR/NA/0/>
#----------------------------------------------------------------------------------------------
# location and provider: UK, Ferryside
# date (yyyy-mm-dd)    : 2014-03-25
#
#----------------------------------------------------------------------------------------------
[C21+ BBC A]
	DELIVERY_SYSTEM = DVBT
	FREQUENCY = 474167000
	BANDWIDTH_HZ = 8000000
	CODE_RATE_HP = 2/3
	CODE_RATE_LP = NONE
	MODULATION = QAM/64
	TRANSMISSION_MODE = 8K
	GUARD_INTERVAL = 1/32
	HIERARCHY = NONE
	INVERSION = AUTO

[C30- D3&4]
	DELIVERY_SYSTEM = DVBT
	FREQUENCY = 545833000
	BANDWIDTH_HZ = 8000000
	CODE_RATE_HP = 2/3
	CODE_RATE_LP = NONE
	MODULATION = QAM/64
	TRANSMISSION_MODE = 8K
	GUARD_INTERVAL = 1/32
	HIERARCHY = NONE
	INVERSION = AUTO

[C27 SDN]
	DELIVERY_SYSTEM = DVBT
	FREQUENCY = 522000000
	BANDWIDTH_HZ = 8000000
	CODE_RATE_HP = 3/4
	CODE_RATE_LP = NONE
	MODULATION = QAM/64
	TRANSMISSION_MODE = 8K
	GUARD_INTERVAL = 1/32
	HIERARCHY = NONE
	INVERSION = AUTO

[C24 BBC B HD]
	DELIVERY_SYSTEM = DVBT2
	FREQUENCY = 498000000
	BANDWIDTH_HZ = 8000000
	CODE_RATE_HP = 2/3
	CODE_RATE_LP = NONE
	MODULATION = QAM/256
	TRANSMISSION_MODE = 32K
	GUARD_INTERVAL = 1/128
	HIERARCHY = NONE
	STREAM_ID = 0
	INVERSION = AUTO