aboutsummaryrefslogtreecommitdiffstats
path: root/util/scan/dvb-s/BrasilSat-B3-84.0W
blob: 5ad005e1f1e2dc78294fb169f8916f7eed3765d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# Brasilsat B3 @ 84.0W
# freq pol sr fec

S 3728000 H 04340000 AUTO
S 3698000 V 03333000 AUTO
S 4054000 V 01287000 AUTO
S 3745000 H 04300000 AUTO
S 3738000 V 04708000 AUTO
S 3923000 V 01808000 AUTO
S 3768000 V 08000000 AUTO
S 3955000 V 04340000 AUTO
S 4167000 H 03255000 AUTO
S 3791000 V 03330000 AUTO
S 3866000 H 04425000 AUTO
S 3932000 V 03255000 AUTO
S 4132000 V 02532000 AUTO
S 3906000 H 03928000 AUTO
S 3858000 V 04288000 AUTO
S 3665000 V 03177000 AUTO
S 3732000 V 03214000 AUTO
S 3774000 H 03330000 AUTO
S 3927000 V 03255000 AUTO
S 3710000 H 03261000 AUTO
S 3883000 H 04278000 AUTO
S 3770000 H 03333000 AUTO
S 3754000 V 05000000 AUTO
S 3764000 H 04285000 AUTO
S 3910000 H 03616000 AUTO
S 3705000 H 04280000 AUTO
S 3852000 V 03806000 AUTO
S 3845000 H 10127000 AUTO
S 3936000 V 03255000 AUTO
S 3653000 V 03807000 AUTO
S 3751000 H 03565000 AUTO
S 3871000 H 04435000 AUTO
S 3895000 H 04430000 AUTO
S 3936000 H 03255000 AUTO
S 3800000 H 03255000 AUTO
S 3855000 H 04000000 AUTO
S 4171000 H 02170000 AUTO
S 3716000 H 04800000 AUTO
S 4068000 H 02600000 AUTO
S 4070000 V 02964000 AUTO
S 3949000 V 04340000 AUTO
S 3684000 V 03200000 AUTO
S 4169000 V 08140000 AUTO
S 4144000 H 02734000 AUTO
S 3736000 H 04285000 AUTO
S 3790000 H 10444000 AUTO
S 3724000 V 02075000 AUTO
S 4121000 H 02500000 AUTO
S 3629000 H 06666000 AUTO
S 3970000 V 04445000 AUTO
S 3985000 V 03300000 AUTO
S 3916000 H 03255000 AUTO
S 4155000 V 03255000 AUTO
S 3692000 V 03330000 AUTO
S 3644000 V 04687000 AUTO
S 4087000 H 17200000 AUTO
S 3889000 H 04440000 AUTO
S 4176000 V 03515000 AUTO
S 3829000 V 04340000 AUTO
S 3805000 V 02662000 AUTO
S 3943000 V 02460000 AUTO
S 3757000 H 03565000 AUTO
S 3696000 H 01808000 AUTO
S 3989000 V 02666000 AUTO
S 3690000 V 03200000 AUTO
S 3657000 V 03600000 AUTO
S 3996000 V 02300000 AUTO
S 3926000 H 04000000 AUTO
S 4126000 H 04000000 AUTO
S 4136000 H 02142000 AUTO
S 3675000 V 04285000 AUTO
S 3931000 H 04000000 AUTO
S 3786000 V 04286000 AUTO
S 3688000 V 02308000 AUTO
S 4075000 V 04444000 AUTO
S 3911000 V 03255000 AUTO
S 3824000 H 03002000 AUTO
S 3778000 V 06850000 AUTO
S 3710000 V 12960000 AUTO
S 3877000 H 04450000 AUTO
S 3940000 V 03255000 AUTO
S 4064000 H 03300000 AUTO
ring.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 */
/*
 * dvbnet.c
 *
 * Copyright (C) 2003 TV Files S.p.A
 *                    L.Y.Mesentsev <lymes@tiscalinet.it>
 *
 * Ported to use new DVB libraries:
 * Copyright (C) 2006 Andrew de Quincey <adq_dvb@lidskialf.net>
 *
 * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 * Or, point your browser to http://www.gnu.org/copyleft/gpl.html
 *
 */

#include <stdio.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>

#include <sys/stat.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <libdvbapi/dvbnet.h>

#define OK    0
#define FAIL -1


enum Mode {
	UNKNOWN,
	LST_INTERFACE,
	ADD_INTERFACE,
	DEL_INTERFACE
} op_mode;

static int adapter = 0;
static int netdev = 0;

static void hello(void);
static void usage(char *);
static void parse_args(int, char **);
static void queryInterface(int);

int ifnum;
int pid;
int encapsulation;

int main(int argc, char **argv)
{
	int fd_net;

	hello();

	parse_args(argc, argv);

	if ((fd_net = dvbnet_open(adapter, netdev)) < 0) {
		fprintf(stderr, "Error: couldn't open device %d: %d %m\n",
			netdev, errno);
		return FAIL;
	}

	switch (op_mode) {
	case DEL_INTERFACE:
		if (dvbnet_remove_interface(fd_net, ifnum))
			fprintf(stderr,
				"Error: couldn't remove interface %d: %d %m.\n",
				ifnum, errno);
		else
			printf("Status: device %d removed successfully.\n",
			       ifnum);
		break;

	case ADD_INTERFACE:
		if ((ifnum = dvbnet_add_interface(fd_net, pid, encapsulation)) < 0)
			fprintf(stderr,
				"Error: couldn't add interface for pid %d: %d %m.\n",
				pid, errno);
		else
			printf
			    ("Status: device dvb%d_%d for pid %d created successfully.\n",
			     adapter, ifnum, pid);
		break;

	case LST_INTERFACE:
		queryInterface(fd_net);
		break;

	default:
		usage(argv[0]);
		return FAIL;
	}

	close(fd_net);
	return OK;
}


void queryInterface(int fd_net)
{
	int IF, nIFaces = 0;
	char *encap;

	printf("Query DVB network interfaces:\n");
	printf("-----------------------------\n");
	for (IF = 0; IF < DVBNET_MAX_INTERFACES; IF++) {
		uint16_t _pid;
		enum dvbnet_encap _encapsulation;
		if (dvbnet_get_interface(fd_net, IF, &_pid, &_encapsulation))
			continue;

		encap = "???";
		switch(_encapsulation) {
		case DVBNET_ENCAP_MPE:
			encap = "MPE";
			break;
		case DVBNET_ENCAP_ULE:
			encap = "ULE";
			break;
		}

		printf("Found device %d: interface dvb%d_%d, "
		       "listening on PID %d, encapsulation %s\n",
		       IF, adapter, IF, _pid, encap);

		nIFaces++;
	}

	printf("-----------------------------\n");
	printf("Found %d interface(s).\n\n", nIFaces);
}


void parse_args(int argc, char **argv)
{
	int c;
	char *s;
	op_mode = UNKNOWN;
	encapsulation = DVBNET_ENCAP_MPE;
	while ((c = getopt(argc, argv, "a:n:p:d:lUvh")) != EOF) {
		switch (c) {
		case 'a':
			adapter = strtol(optarg, NULL, 0);
			break;
		case 'n':
			netdev = strtol(optarg, NULL, 0);
			break;
		case 'p':
			pid = strtol(optarg, NULL, 0);
			op_mode = ADD_INTERFACE;
			break;
		case 'd':
			ifnum = strtol(optarg, NULL, 0);
			op_mode = DEL_INTERFACE;
			break;
		case 'l':
			op_mode = LST_INTERFACE;
			break;
		case 'U':
			encapsulation = DVBNET_ENCAP_ULE;
			break;
		case 'v':
			exit(OK);
		case 'h':
		default:
			s = strrchr(argv[0], '/') + 1;
			usage((s) ? s : argv[0]);
			exit(FAIL);
		}
	}
}


void usage(char *prog_name)
{
	fprintf(stderr, "Usage: %s [options]\n", prog_name);
	fprintf(stderr, "Where options are:\n");
	fprintf(stderr, "\t-a AD  : Adapter card (default 0)\n");
	fprintf(stderr, "\t-n DD  : Demux (default 0)\n");
	fprintf(stderr, "\t-p PID : Add interface listening on PID\n");
	fprintf(stderr, "\t-d NUM : Remove interface NUM\n");
	fprintf(stderr,	"\t-l     : List currently available interfaces\n");
	fprintf(stderr, "\t-U     : use ULE framing (default: MPE)\n" );
	fprintf(stderr, "\t-v     : Print current version\n\n");
}


void hello(void)
{
	printf("\nDVB Network Interface Manager\n");
	printf("Copyright (C) 2003, TV Files S.p.A\n\n");
}