annotate libmpdemux/dvbin.c @ 10300:134e4332f550

solaris fix by Gtz Waschk <waschk@informatik.uni-rostock.de>
author alex
date Tue, 17 Jun 2003 22:28:29 +0000
parents 76c6d8f1ebf5
children 11826d9f90c7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
1 /*
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
2
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
3 dvbstream
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
4 (C) Dave Chapman <dave@dchapman.com> 2001, 2002.
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
5
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
6 The latest version can be found at http://www.linuxstb.org/dvbstream
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
7
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
8 Copyright notice:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
9
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
10 This program is free software; you can redistribute it and/or modify
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
11 it under the terms of the GNU General Public License as published by
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
12 the Free Software Foundation; either version 2 of the License, or
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
13 (at your option) any later version.
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
14
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
15 This program is distributed in the hope that it will be useful,
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
18 GNU General Public License for more details.
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
19
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
20 You should have received a copy of the GNU General Public License
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
21 along with this program; if not, write to the Free Software
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
22 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
23
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
24 */
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
25
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
26 // Linux includes:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
27 #include <stdio.h>
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
28 #include <stdlib.h>
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
29 #include <string.h>
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
30 #include <ctype.h>
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
31 #include <sys/ioctl.h>
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
32 #include <sys/time.h>
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
33 #include <sys/poll.h>
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
34 #include <sys/stat.h>
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
35 #include <resolv.h>
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
36 #include <fcntl.h>
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
37 #include <unistd.h>
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
38 #include <signal.h>
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
39 #include <values.h>
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
40 #include <string.h>
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
41 #include <sys/socket.h>
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
42 #include <netinet/in.h>
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
43 #include <netdb.h>
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
44 #include <errno.h>
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
45 #include <fcntl.h>
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
46 #include <unistd.h>
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
47 #include "config.h"
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
48
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
49 // DVB includes:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
50
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
51 #include "stream.h"
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
52 #include "demuxer.h"
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
53
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
54 #include "../cfgparser.h"
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
55
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
56 #include "dvbin.h"
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
57 #include "dvb_defaults.h"
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
58
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
59 extern int video_id, audio_id, demuxer_type;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
60
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
61
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
62 #define MAX_CHANNELS 8
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
63
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
64
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
65 #define min(a, b) ((a) <= (b) ? (a) : (b))
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
66
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
67 int dvbin_param_card, dvbin_param_freq, dvbin_param_srate, dvbin_param_diseqc = 0,
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
68 dvbin_param_tone = -1, dvbin_param_vid, dvbin_param_aid, dvbin_is_active = 0;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
69 int dvbin_param_mod, dvbin_param_gi, dvbin_param_tm, dvbin_param_bw, dvbin_param_cr;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
70 char *dvbin_param_pol = "", *dvbin_param_inv="INVERSION_AUTO",
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
71 *dvbin_param_type="SAT ",
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
72 *dvbin_param_prog = " ";
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
73 dvb_history_t dvb_prev_next;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
74
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
75 struct config dvbin_opts_conf[] = {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
76 {"on", &dvbin_param_on, CONF_TYPE_INT, 0, 0, 1, NULL},
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
77 {"type", &dvbin_param_type, CONF_TYPE_STRING, 0, 0, 1, NULL},
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
78 {"card", &dvbin_param_card, CONF_TYPE_INT, CONF_RANGE, 1, 4, NULL},
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
79 {"freq", &dvbin_param_freq, CONF_TYPE_INT, 0, 0, 1, NULL},
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
80 {"pol", &dvbin_param_pol, CONF_TYPE_STRING, 0, 0, 0, NULL},
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
81 {"srate", &dvbin_param_srate, CONF_TYPE_INT, 0, 0, 1, NULL},
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
82 {"diseqc", &dvbin_param_diseqc, CONF_TYPE_INT, CONF_RANGE, 1, 4, NULL},
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
83 {"tone", &dvbin_param_tone, CONF_TYPE_INT, 0, 0, 1, NULL},
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
84 {"vid", &dvbin_param_vid, CONF_TYPE_INT, 0, 0, 1, NULL},
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
85 {"aid", &dvbin_param_aid, CONF_TYPE_INT, 0, 0, 1, NULL},
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
86 {"prog", &dvbin_param_prog, CONF_TYPE_STRING, 0, 0, 0, NULL},
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
87 {"inv", &dvbin_param_inv, CONF_TYPE_STRING, 0, 0, 0, NULL},
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
88 {"mod", &dvbin_param_mod, CONF_TYPE_INT, 0, 0, 1, NULL},
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
89 {"gi", &dvbin_param_gi, CONF_TYPE_INT, 0, 0, 1, NULL},
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
90 {"tm", &dvbin_param_tm, CONF_TYPE_INT, 0, 0, 1, NULL},
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
91 {"bw", &dvbin_param_bw, CONF_TYPE_INT, 0, 0, 1, NULL},
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
92 {"cr", &dvbin_param_cr, CONF_TYPE_INT, 0, 0, 1, NULL},
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
93 {NULL, NULL, 0, 0, 0, 0, NULL}
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
94 };
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
95
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
96
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
97 int card=0;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
98
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
99 extern int open_fe(int* fd_frontend, int* fd_sec);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
100 extern int set_ts_filt(int fd, uint16_t pid, dmx_pes_type_t pestype);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
101 extern int demux_stop(int fd);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
102 extern void make_nonblock(int f);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
103 extern int dvb_tune(dvb_priv_t *priv, int freq, char pol, int srate, int diseqc, int tone,
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
104 fe_spectral_inversion_t specInv, fe_modulation_t modulation, fe_guard_interval_t guardInterval,
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
105 fe_transmit_mode_t TransmissionMode, fe_bandwidth_t bandWidth, fe_code_rate_t HP_CodeRate);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
106 extern char *frontenddev[4], *dvrdev[4], *secdev[4], *demuxdev[4];
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
107
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
108
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
109 dvb_channels_list *dvb_get_channels(char *filename, const char *type)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
110 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
111 dvb_channels_list *list;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
112 FILE *f;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
113 uint8_t line[128];
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
114 int fields, row_count;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
115 dvb_channel_t *ptr;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
116 char *tmp_lcr, *tmp_hier, *inv, *bw, *cr, *mod, *transm, *gi;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
117 //const char *cbl_conf = "%a[^:]:%d:%c:%d:%a[^:]:%a[^:]:%d:%d\n";
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
118 const char *sat_conf = "%a[^:]:%d:%c:%d:%d:%d:%d:%d:%d:%d\n";
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
119 const char *ter_conf = "%a[^:]:%d:%a[^:]:%a[^:]:%a[^:]:%a[^:]:%a[^:]:%a[^:]:%a[^:]:%a[^:]:%d:%d\n";
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
120
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
121 list = malloc(sizeof(dvb_channels_list));
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
122 if(list == NULL)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
123 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
124 mp_msg(MSGT_DEMUX, MSGL_V, "DVB_GET_CHANNELS: couldn't malloc enough memory\n");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
125 return NULL;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
126 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
127
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
128 mp_msg(MSGT_DEMUX, MSGL_V, "CONFIG_READ FILE: %s, type: %s\n", filename, type);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
129 if((f=fopen(filename, "r"))==NULL)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
130 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
131 mp_msg(MSGT_DEMUX, MSGL_FATAL, "CAN'T READ CONFIG FILE %s\n", filename);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
132 return NULL;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
133 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
134
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
135 list->NUM_CHANNELS = 0;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
136 row_count = 0;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
137 while(! feof(f) && row_count < 512)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
138 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
139 if( fgets(line, 128, f) == NULL ) continue;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
140
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
141 if(line[0] == '#')
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
142 continue; //comment line
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
143
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
144 ptr = &(list->channels[ list->NUM_CHANNELS ]);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
145
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
146 if(! strcmp(type, "TER"))
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
147 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
148 fields = sscanf(line, ter_conf,
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
149 &ptr->name, &ptr->freq, &inv, &bw, &cr, tmp_lcr, &mod,
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
150 &transm, &gi, &tmp_hier, &ptr->vpid, &ptr->apid1);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
151
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
152 if(! strcmp(inv, "INVERSION_ON"))
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
153 ptr->inv = INVERSION_ON;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
154 else if(! strcmp(inv, "INVERSION_OFF"))
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
155 ptr->inv = INVERSION_OFF;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
156 else
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
157 ptr->inv = INVERSION_AUTO;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
158
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
159 if(! strcmp(bw, "BANDWIDTH_6_MHZ"))
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
160 ptr->bw = BANDWIDTH_6_MHZ;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
161 else if(! strcmp(bw, "BANDWIDTH_7_MHZ"))
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
162 ptr->bw = BANDWIDTH_7_MHZ;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
163 else if(! strcmp(bw, "BANDWIDTH_8_MHZ"))
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
164 ptr->bw = BANDWIDTH_8_MHZ;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
165
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
166
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
167 if(! strcmp(cr, "FEC_1_2"))
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
168 ptr->cr =FEC_1_2;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
169 else if(! strcmp(cr, "FEC_2_3"))
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
170 ptr->cr =FEC_2_3;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
171 else if(! strcmp(cr, "FEC_3_4"))
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
172 ptr->cr =FEC_3_4;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
173 #ifdef HAVE_DVB_HEAD
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
174 else if(! strcmp(cr, "FEC_4_5"))
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
175 ptr->cr =FEC_4_5;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
176 else if(! strcmp(cr, "FEC_6_7"))
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
177 ptr->cr =FEC_6_7;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
178 else if(! strcmp(cr, "FEC_8_9"))
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
179 ptr->cr =FEC_8_9;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
180 #endif
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
181 else if(! strcmp(cr, "FEC_5_6"))
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
182 ptr->cr =FEC_5_6;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
183 else if(! strcmp(cr, "FEC_7_8"))
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
184 ptr->cr =FEC_7_8;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
185 else if(! strcmp(cr, "FEC_NONE"))
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
186 ptr->cr =FEC_NONE;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
187 else ptr->cr =FEC_AUTO;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
188
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
189 if(! strcmp(mod, "QAM_128"))
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
190 ptr->mod = QAM_128;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
191 else if(! strcmp(mod, "QAM_256"))
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
192 ptr->mod = QAM_256;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
193 else if(! strcmp(mod, "QAM_64"))
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
194 ptr->mod = QAM_64;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
195 else if(! strcmp(mod, "QAM_32"))
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
196 ptr->mod = QAM_32;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
197 else if(! strcmp(mod, "QAM_16"))
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
198 ptr->mod = QAM_16;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
199 else ptr->mod = QPSK;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
200
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
201
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
202 if(! strcmp(transm, "TRANSMISSION_MODE_2K"))
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
203 ptr->trans = TRANSMISSION_MODE_2K;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
204 else if(! strcmp(transm, "TRANSMISSION_MODE_8K"))
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
205 ptr->trans = TRANSMISSION_MODE_8K;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
206
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
207 if(! strcmp(gi, "GUARD_INTERVAL_1_32"))
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
208 ptr->gi = GUARD_INTERVAL_1_32;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
209 else if(! strcmp(gi, "GUARD_INTERVAL_1_16"))
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
210 ptr->gi = GUARD_INTERVAL_1_16;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
211 else if(! strcmp(gi, "GUARD_INTERVAL_1_8"))
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
212 ptr->gi = GUARD_INTERVAL_1_8;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
213 else ptr->gi = GUARD_INTERVAL_1_4;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
214
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
215
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
216 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
217 /*
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
218 else if(! strcmp(type, "CBL"))
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
219 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
220 fields = sscanf(line, cbl_conf,
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
221 &ptr->name, &ptr->freq, &ptr->inv, &ptr->qam,
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
222 &ptr->fec, &ptr->mod, &ptr->vpid, &ptr->apid1);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
223
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
224
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
225 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
226 */
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
227 else //SATELLITE
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
228 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
229 fields = sscanf(line, sat_conf,
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
230 &ptr->name, &ptr->freq, &ptr->pol, &ptr->diseqc, &ptr->srate, &ptr->vpid, &ptr->apid1,
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
231 &ptr->tpid, &ptr->ca, &ptr->progid);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
232 ptr->pol = toupper(ptr->pol);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
233 ptr->freq *= 1000UL;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
234 ptr->srate *= 1000UL;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
235 ptr->tone = -1;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
236 mp_msg(MSGT_DEMUX, MSGL_V,
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
237 "NUM_FIELDS: %d, NAME: %s, FREQ: %d, SRATE: %d, POL: %c, DISEQC: %d, TONE: %d, VPID: %d, APID1: %d, APID2: %d, TPID: %d, PROGID: %d, NUM: %d\n",
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
238 fields, ptr->name, ptr->freq, ptr->srate, ptr->pol, ptr->diseqc, ptr->tone, ptr->vpid, ptr->apid1, ptr->apid2, ptr->tpid, ptr->progid, list->NUM_CHANNELS);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
239 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
240
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
241 list->NUM_CHANNELS++;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
242 row_count++;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
243 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
244
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
245 fclose(f);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
246 return list;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
247 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
248
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
249
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
250 static long getmsec()
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
251 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
252 struct timeval tv;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
253 gettimeofday(&tv, (struct timezone*) NULL);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
254 return(tv.tv_sec%1000000)*1000 + tv.tv_usec/1000;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
255 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
256
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
257
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
258
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
259 int dvb_streaming_read(int fd, char *buffer, unsigned int size, dvb_priv_t *priv)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
260 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
261 struct pollfd pfds[1];
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
262 uint32_t ok = 0, pos = 0, tot = 0, rk, d, r, m;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
263
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
264 mp_msg(MSGT_DEMUX, MSGL_DBG2, "dvb_streaming_read(%u)\n", fd);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
265
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
266 while(pos < size)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
267 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
268 ok = 0;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
269 tot = 0;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
270 //int m = min((size-pos), 188);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
271 m = size - pos;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
272 d = (int) (m / 188);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
273 r = m % 188;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
274
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
275 m = d * 188;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
276 m = (m ? m : r);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
277
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
278 pfds[0].fd = fd;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
279 pfds[0].events = POLLIN | POLLPRI;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
280
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
281 mp_msg(MSGT_DEMUX, MSGL_DBG2, "DEVICE: %d, DVR: %d, PIPE: %d <-> %d\n", fd, priv->dvr_fd, priv->input, priv->output);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
282
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
283 poll(pfds, 1, 500);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
284 if((rk = read(fd, &buffer[pos], m)) > 0)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
285 pos += rk;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
286 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
287
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
288 return pos;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
289 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
290
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
291
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
292
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
293 dvb_history_t *dvb_step_channel(dvb_priv_t *priv, int dir, dvb_history_t *h)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
294 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
295 //int new_freq, new_srate, new_diseqc, new_tone, new_vpid, new_apid;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
296 //char new_pol;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
297 int new_current;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
298 dvb_channel_t *next;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
299 dvb_channels_list *list;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
300
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
301 if(priv == NULL)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
302 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
303 mp_msg(MSGT_DEMUX, MSGL_ERR, "dvb_step_channel: PRIV NULL PTR, quit\n");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
304 return 0;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
305 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
306
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
307 list = priv->list;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
308 if(list == NULL)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
309 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
310 mp_msg(MSGT_DEMUX, MSGL_ERR, "dvb_step_channel: LIST NULL PTR, quit\n");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
311 return 0;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
312 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
313
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
314 mp_msg(MSGT_DEMUX, MSGL_V, "DVB_STEP_CHANNEL dir %d\n", dir);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
315
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
316 if(dir == DVB_CHANNEL_HIGHER)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
317 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
318 if(list->current == list->NUM_CHANNELS)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
319 return 0;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
320
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
321 new_current = list->current + 1;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
322 next = &(list->channels[new_current]);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
323 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
324 else
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
325 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
326 if(list->current == 0)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
327 return 0;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
328
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
329 new_current = list->current - 1;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
330 next = &(list->channels[new_current]);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
331
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
332 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
333
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
334 demux_stop(priv->demux_fd[0]);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
335 demux_stop(priv->demux_fd[1]);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
336
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
337 h->prev = list->current;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
338 h->next = new_current;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
339
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
340 list->current = new_current;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
341
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
342 return h;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
343 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
344
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
345
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
346 extern char *get_path(char *);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
347
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
348 dvb_channels_list *list_ptr = NULL;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
349
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
350 int dvb_streaming_start(stream_t *stream)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
351 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
352 int pids[MAX_CHANNELS];
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
353 int pestypes[MAX_CHANNELS];
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
354 int npids, i;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
355 char *filename, type[80];
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
356 unsigned long freq = 0;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
357 char pol = 0;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
358 unsigned long srate = 0;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
359 int diseqc = 0, old_diseqc = 0;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
360 int tone = -1;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
361
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
362 dvb_priv_t *priv;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
363 dvb_channel_t *channel = NULL;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
364 fe_spectral_inversion_t specInv = INVERSION_AUTO;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
365 fe_modulation_t modulation = CONSTELLATION_DEFAULT;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
366 fe_transmit_mode_t TransmissionMode = TRANSMISSION_MODE_DEFAULT;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
367 fe_bandwidth_t bandWidth = BANDWIDTH_DEFAULT;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
368 fe_guard_interval_t guardInterval = GUARD_INTERVAL_DEFAULT;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
369 fe_code_rate_t HP_CodeRate = HP_CODERATE_DEFAULT;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
370
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
371
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
372 stream->priv = (dvb_priv_t*) malloc(sizeof(dvb_priv_t));
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
373 if(stream->priv == NULL)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
374 return 0;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
375 priv = (dvb_priv_t*) stream->priv;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
376
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
377 if(!strncmp(dvbin_param_type, "CBL", 3))
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
378 strncpy(type, "CBL", 3);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
379 else if(!strncmp(dvbin_param_type, "TER", 3))
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
380 strncpy(type, "TER", 3);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
381 else
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
382 strncpy(type, "SAT", 3);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
383
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
384
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
385 filename = get_path("channels.conf");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
386
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
387 if(list_ptr == NULL)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
388 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
389 if(filename)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
390 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
391 if((list_ptr = dvb_get_channels(filename, type)) == NULL)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
392 mp_msg(MSGT_DEMUX, MSGL_WARN, "EMPTY CHANNELS LIST!\n");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
393 else
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
394 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
395 priv->list = list_ptr;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
396 priv->list->current = 0;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
397 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
398 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
399 else
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
400 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
401 list_ptr = NULL;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
402 mp_msg(MSGT_DEMUX, MSGL_WARN, "NO CHANNELS FILE FOUND!\n");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
403 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
404 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
405
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
406
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
407 mp_msg(MSGT_DEMUX, MSGL_INFO, "code taken from dvbstream for mplayer v0.4pre1 - (C) Dave Chapman 2001\n");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
408 mp_msg(MSGT_DEMUX, MSGL_INFO, "Released under the GPL.\n");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
409 mp_msg(MSGT_DEMUX, MSGL_INFO, "Latest version available from http://www.linuxstb.org/\n");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
410 mp_msg(MSGT_DEMUX, MSGL_V, "ON: %d, CARD: %d, FREQ: %d, SRATE: %d, POL: %s, VID: %d, AID: %d\n", dvbin_param_on,
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
411 dvbin_param_card, dvbin_param_freq, dvbin_param_srate, dvbin_param_pol, dvbin_param_vid, dvbin_param_aid);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
412
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
413 npids = 0;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
414
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
415 if((dvb_prev_next.next > -1) && (dvb_prev_next.prev > -1) && (list_ptr != NULL)) //We are after a channel stepping
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
416 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
417 list_ptr->current = dvb_prev_next.next;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
418 channel = &(list_ptr->channels[dvb_prev_next.next]);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
419 mp_msg(MSGT_DEMUX, MSGL_V, "PROGRAM NUMBER %d: name=%s, vid=%d, aid=%d, freq=%lu, srate=%lu, pol=%c, diseqc: %d, tone: %d\n", dvb_prev_next.next,
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
420 channel->name, channel->vpid, channel->apid1,
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
421 channel->freq, channel->srate, channel->pol, channel->diseqc, channel->tone);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
422
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
423
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
424 if((dvb_prev_next.prev >= 0) && (dvb_prev_next.prev < list_ptr->NUM_CHANNELS))
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
425 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
426 dvb_channel_t *tmp = &(list_ptr->channels[dvb_prev_next.prev]);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
427 old_diseqc = tmp->diseqc;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
428 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
429 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
430 else if(list_ptr != NULL && strlen(dvbin_param_prog))
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
431 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
432 i = 0;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
433 while((channel == NULL) && i < list_ptr->NUM_CHANNELS)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
434 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
435 if(! strcmp(list_ptr->channels[i].name, dvbin_param_prog))
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
436 channel = &(list_ptr->channels[i]);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
437
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
438 i++;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
439 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
440 if(channel != NULL)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
441 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
442 list_ptr->current = i-1;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
443 mp_msg(MSGT_DEMUX, MSGL_V, "PROGRAM NUMBER %d: name=%s, vid=%d, aid=%d, freq=%lu, srate=%lu, pol=%c, diseqc: %d, tone: %d\n", i-1,
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
444 channel->name, channel->vpid, channel->apid1,
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
445 channel->freq, channel->srate, channel->pol, channel->diseqc, channel->tone);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
446
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
447 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
448 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
449
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
450
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
451 if(dvbin_param_vid > 0)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
452 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
453 pids[npids] = priv->channel.vpid = dvbin_param_vid;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
454 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
455 else if(channel != NULL)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
456 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
457 pids[npids] = priv->channel.vpid = channel->vpid;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
458 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
459 pestypes[npids] = DMX_PES_VIDEO;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
460 npids++;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
461
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
462 if(dvbin_param_aid > 0)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
463 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
464 pids[npids] = priv->channel.apid1 = dvbin_param_aid;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
465 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
466 else if(channel != NULL)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
467 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
468 pids[npids] = priv->channel.vpid = channel->apid1;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
469 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
470 pestypes[npids] = DMX_PES_AUDIO;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
471 npids++;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
472
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
473
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
474
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
475 if(dvbin_param_freq)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
476 freq = dvbin_param_freq * 1000UL;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
477 else if(channel != NULL)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
478 freq = channel->freq;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
479
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
480
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
481 if(dvbin_param_srate)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
482 srate = dvbin_param_srate * 1000UL;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
483 else if(channel != NULL)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
484 srate = channel->srate;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
485
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
486 if((1<= dvbin_param_diseqc) && (dvbin_param_diseqc <= 4))
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
487 diseqc = dvbin_param_diseqc;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
488 else
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
489 if(channel != NULL)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
490 if(channel->diseqc != old_diseqc)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
491 diseqc = channel->diseqc;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
492 else
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
493 diseqc = 0;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
494 else
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
495 diseqc = 0;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
496 mp_msg(MSGT_DEMUX, MSGL_INFO, "DISEQC: %d\n", diseqc);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
497
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
498 if((dvbin_param_tone == 0) || (dvbin_param_tone == 1))
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
499 tone = dvbin_param_tone;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
500 else
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
501 if(channel != NULL)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
502 tone = channel->tone;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
503 else
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
504 tone = -1;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
505
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
506 if(! strcmp(dvbin_param_pol, "V")) pol = 'V';
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
507 else if(! strcmp(dvbin_param_pol, "H")) pol = 'H';
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
508 else if(channel != NULL) pol = channel->pol;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
509 else pol='V';
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
510 pol = toupper(pol);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
511
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
512
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
513 if(!strcmp(dvbin_param_inv, "INVERSION_ON"))
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
514 specInv = INVERSION_ON;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
515 else if(!strcmp(dvbin_param_inv, "INVERSION_OFF"))
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
516 specInv = INVERSION_OFF;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
517 else if(!strcmp(dvbin_param_inv, "INVERSION_AUTO"))
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
518 specInv = INVERSION_AUTO;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
519 else if(channel != NULL)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
520 specInv = channel->inv;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
521 else
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
522 specInv = INVERSION_AUTO;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
523
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
524
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
525 if(dvbin_param_mod)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
526 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
527 switch(dvbin_param_mod)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
528 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
529 case 16: modulation=QAM_16; break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
530 case 32: modulation=QAM_32; break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
531 case 64: modulation=QAM_64; break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
532 case 128: modulation=QAM_128; break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
533 case 256: modulation=QAM_256; break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
534 default:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
535 mp_msg(MSGT_DEMUX, MSGL_ERR, "Invalid QAM rate: %s\n", dvbin_param_mod);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
536 modulation=CONSTELLATION_DEFAULT;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
537 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
538 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
539 else if(channel != NULL)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
540 modulation = channel->mod;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
541 else
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
542 modulation=CONSTELLATION_DEFAULT;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
543
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
544
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
545 if(dvbin_param_gi)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
546 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
547 switch(dvbin_param_gi)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
548 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
549 case 32: guardInterval=GUARD_INTERVAL_1_32; break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
550 case 16: guardInterval=GUARD_INTERVAL_1_16; break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
551 case 8: guardInterval=GUARD_INTERVAL_1_8; break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
552 case 4: guardInterval=GUARD_INTERVAL_1_4; break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
553 default:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
554 mp_msg(MSGT_DEMUX, MSGL_ERR, "Invalid Guard Interval: %s\n", dvbin_param_gi);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
555 guardInterval=GUARD_INTERVAL_DEFAULT;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
556 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
557 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
558 else if(channel != NULL)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
559 guardInterval = channel->gi;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
560 else
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
561 guardInterval=GUARD_INTERVAL_DEFAULT;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
562
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
563 if(dvbin_param_tm)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
564 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
565 switch(dvbin_param_tm)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
566 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
567 case 8: TransmissionMode=TRANSMISSION_MODE_8K; break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
568 case 2: TransmissionMode=TRANSMISSION_MODE_2K; break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
569 default:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
570 TransmissionMode=TRANSMISSION_MODE_DEFAULT;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
571 mp_msg(MSGT_DEMUX, MSGL_ERR, "Invalid Transmission Mode: %s\n", dvbin_param_tm);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
572 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
573 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
574 else if(channel != NULL)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
575 TransmissionMode = channel->trans;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
576 else
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
577 TransmissionMode=TRANSMISSION_MODE_DEFAULT;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
578
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
579
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
580 if(dvbin_param_bw)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
581 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
582 switch(dvbin_param_bw)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
583 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
584 case 8: bandWidth=BANDWIDTH_8_MHZ; break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
585 case 7: bandWidth=BANDWIDTH_7_MHZ; break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
586 case 6: bandWidth=BANDWIDTH_6_MHZ; break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
587 default:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
588 mp_msg(MSGT_DEMUX, MSGL_ERR, "Invalid DVB-T bandwidth: %s\n", dvbin_param_bw);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
589 bandWidth=BANDWIDTH_DEFAULT;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
590 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
591 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
592 else if(channel != NULL)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
593 bandWidth = channel->bw;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
594 else
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
595 bandWidth=BANDWIDTH_DEFAULT;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
596
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
597
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
598 if(dvbin_param_cr)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
599 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
600 switch(dvbin_param_cr)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
601 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
602 case -1: HP_CodeRate=FEC_AUTO; break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
603 case 12: HP_CodeRate=FEC_1_2; break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
604 case 23: HP_CodeRate=FEC_2_3; break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
605 case 34: HP_CodeRate=FEC_3_4; break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
606 case 56: HP_CodeRate=FEC_5_6; break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
607 case 78: HP_CodeRate=FEC_7_8; break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
608 default:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
609 mp_msg(MSGT_DEMUX, MSGL_ERR, "Invalid Code Rate: %s\n", dvbin_param_cr);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
610 HP_CodeRate=HP_CODERATE_DEFAULT;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
611 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
612 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
613 else if(channel != NULL)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
614 HP_CodeRate = channel->cr;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
615 else
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
616 HP_CodeRate=HP_CODERATE_DEFAULT;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
617
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
618
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
619
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
620 card = dvbin_param_card - 1;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
621 if((card < 0) || (card > 4))
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
622 card = 0;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
623
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
624
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
625 dvbin_param_on = 1;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
626
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
627 mp_msg(MSGT_DEMUX, MSGL_V, "CARD: %d, FREQ: %d, POL: %c, SRATE: %d, DISEQC: %d, TONE: %d, VPID: %d, APID: %d\n", card, freq, pol, srate, diseqc, tone, pids[0], pids[1]);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
628
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
629 priv->channel.freq = freq;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
630 priv->channel.srate = srate;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
631 priv->channel.diseqc = diseqc;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
632 priv->channel.pol = pol;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
633 priv->channel.tone = tone;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
634 priv->channel.inv = specInv;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
635 priv->channel.mod = modulation;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
636 priv->channel.gi = guardInterval;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
637 priv->channel.trans = TransmissionMode;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
638 priv->channel.bw = bandWidth;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
639 priv->channel.cr = HP_CodeRate;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
640
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
641 if(freq && pol && srate)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
642 if (! dvb_tune(priv, freq, pol, srate, diseqc, tone, specInv, modulation, guardInterval, TransmissionMode, bandWidth, HP_CodeRate))
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
643 return 0;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
644
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
645 for (i=0; i < npids; i++)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
646 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
647 if((priv->demux_fd[i] = open(demuxdev[card], O_RDWR)) < 0)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
648 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
649 mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR OPENING DEMUX %i: ", i);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
650 return -1;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
651 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
652 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
653
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
654 if((priv->dvr_fd = open(dvrdev[card], O_RDONLY| O_NONBLOCK)) < 0)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
655 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
656 mp_msg(MSGT_DEMUX, MSGL_ERR, "DVR DEVICE: ");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
657 return -1;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
658 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
659
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
660
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
661 /* Now we set the filters */
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
662 for (i=0; i< npids; i++)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
663 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
664 set_ts_filt(priv->demux_fd[i], pids[i], pestypes[i]);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
665 //make_nonblock(fd[i]);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
666 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
667
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
668
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
669 stream->fd = priv->dvr_fd;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
670
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
671 dvbin_is_active = 1;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
672
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
673 mp_msg(MSGT_DEMUX, MSGL_DBG2, "ESCO da dvb_streaming_start(s)\n");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
674
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
675 return 1;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
676 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
677
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
678
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
679 int dvbin_close(dvb_priv_t *priv)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
680 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
681 //close(priv->dvr_fd);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
682 close(priv->demux_fd[0]);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
683 close(priv->demux_fd[1]);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
684 }