]> git.sesse.net Git - vlc/blob - modules/access/dvb/access.c
* dvn: first pass to port dvb to new api. (it doesn't even yet compile,
[vlc] / modules / access / dvb / access.c
1 /*****************************************************************************
2  * access.c: DVB card input v4l2 only
3  *****************************************************************************
4  * Copyright (C) 1998-2004 VideoLAN
5  *
6  * Authors: Johan Bilien <jobi@via.ecp.fr>
7  *          Jean-Paul Saman <jpsaman@wxs.nl>
8  *          Christophe Massiot <massiot@via.ecp.fr>
9  *          Laurent Aimar <fenrir@via.ecp.fr>
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
24  *****************************************************************************/
25
26
27 /*****************************************************************************
28  * Preamble
29  *****************************************************************************/
30 #include <vlc/vlc.h>
31 #include <vlc/input.h>
32
33 #ifdef HAVE_UNISTD_H
34 #   include <unistd.h>
35 #endif
36
37 #include <fcntl.h>
38 #include <sys/types.h>
39
40 #include <errno.h>
41
42 #include "dvb.h"
43
44 /*****************************************************************************
45  * Module descriptor
46  *****************************************************************************/
47 static int  Open( vlc_object_t *p_this );
48 static void Close( vlc_object_t *p_this );
49
50 #define CACHING_TEXT N_("Caching value in ms")
51 #define CACHING_LONGTEXT N_( \
52     "Allows you to modify the default caching value for dvb streams. This " \
53     "value should be set in millisecond units." )
54
55 #define PROGRAM_TEXT N_("Program to decode")
56 #define PROGRAM_LONGTEXT N_("This is a workaround for a bug in the input")
57
58 #define ADAPTER_TEXT N_("Adapter card to tune")
59 #define ADAPTER_LONGTEXT N_("Adapter cards have a device file in directory named /dev/dvb/adapter[n] with n>=0.")
60
61 #define DEVICE_TEXT N_("Device number to use on adapter")
62 #define DEVICE_LONGTEXT ""
63
64 #define FREQ_TEXT N_("Transponder/multiplex frequency")
65 #define FREQ_LONGTEXT N_("In kHz for DVB-S or Hz for DVB-C/T")
66
67 #define INVERSION_TEXT N_("Inversion mode")
68 #define INVERSION_LONGTEXT N_("Inversion mode [0=off, 1=on, 2=auto]")
69
70 #define PROBE_TEXT N_("Probe DVB card for capabilities")
71 #define PROBE_LONGTEXT N_("Some DVB cards do not like to be probed for their capabilities.")
72
73 #define LNB_LOF1_TEXT N_("Antenna lnb_lof1 (kHz)")
74 #define LNB_LOF1_LONGTEXT ""
75
76 #define LNB_LOF2_TEXT N_("Antenna lnb_lof2 (kHz)")
77 #define LNB_LOF2_LONGTEXT ""
78
79 #define LNB_SLOF_TEXT N_("Antenna lnb_slof (kHz)")
80 #define LNB_SLOF_LONGTEXT ""
81
82 /* Satellite */
83 #define BUDGET_TEXT N_("Budget mode")
84 #define BUDGET_LONGTEXT N_("This allows you to stream an entire transponder with a budget card.")
85
86 #define SATNO_TEXT N_("Satellite number in the Diseqc system")
87 #define SATNO_LONGTEXT N_("[0=no diseqc, 1-4=normal diseqc, -1=A, -2=B simple diseqc]")
88
89 #define VOLTAGE_TEXT N_("LNB voltage")
90 #define VOLTAGE_LONGTEXT N_("In Volts [0, 13=vertical, 18=horizontal]")
91
92 #define TONE_TEXT N_("22 kHz tone")
93 #define TONE_LONGTEXT N_("[0=off, 1=on, -1=auto]")
94
95 #define FEC_TEXT N_("Transponder FEC")
96 #define FEC_LONGTEXT N_("FEC=Forward Error Correction mode [9=auto]")
97
98 #define SRATE_TEXT N_("Transponder symbol rate in kHz")
99 #define SRATE_LONGTEXT ""
100
101 /* Cable */
102 #define MODULATION_TEXT N_("Modulation type")
103 #define MODULATION_LONGTEXT N_("Modulation type for front-end device.")
104
105 /* Terrestrial */
106 #define CODE_RATE_HP_TEXT N_("Terrestrial high priority stream code rate (FEC)")
107 #define CODE_RATE_HP_LONGTEXT ""
108
109 #define CODE_RATE_LP_TEXT N_("Terrestrial low priority stream code rate (FEC)")
110 #define CODE_RATE_LP_LONGTEXT ""
111
112 #define BANDWIDTH_TEXT N_("Terrestrial bandwidth")
113 #define BANDWIDTH_LONGTEXT N_("Terrestrial bandwidth [0=auto,6,7,8 in MHz]")
114
115 #define GUARD_TEXT N_("Terrestrial guard interval")
116 #define GUARD_LONGTEXT ""
117
118 #define TRANSMISSION_TEXT N_("Terrestrial transmission mode")
119 #define TRANSMISSION_LONGTEXT ""
120
121 #define HIERARCHY_TEXT N_("Terrestrial hierarchy mode")
122 #define HIERARCHY_LONGTEXT ""
123
124 vlc_module_begin();
125     set_shortname( _("DVB") );
126     set_description( N_("DVB input with v4l2 support") );
127
128     add_integer( "dvb-caching", DEFAULT_PTS_DELAY / 1000, NULL, CACHING_TEXT,
129                  CACHING_LONGTEXT, VLC_TRUE );
130     add_integer( "dvb-adapter", 0, NULL, ADAPTER_TEXT, ADAPTER_LONGTEXT,
131                  VLC_FALSE );
132     add_integer( "dvb-device", 0, NULL, DEVICE_TEXT, DEVICE_LONGTEXT,
133                  VLC_TRUE );
134     add_integer( "dvb-frequency", 11954000, NULL, FREQ_TEXT, FREQ_LONGTEXT,
135                  VLC_FALSE );
136     add_integer( "dvb-inversion", 2, NULL, INVERSION_TEXT, INVERSION_LONGTEXT,
137                  VLC_TRUE );
138     add_bool( "dvb-probe", 1, NULL, PROBE_TEXT, PROBE_LONGTEXT, VLC_TRUE );
139     add_integer( "dvb-lnb-lof1", 9750000, NULL, LNB_LOF1_TEXT,
140                  LNB_LOF1_LONGTEXT, VLC_TRUE );
141     add_integer( "dvb-lnb-lof2", 10600000, NULL, LNB_LOF2_TEXT,
142                  LNB_LOF2_LONGTEXT, VLC_TRUE );
143     add_integer( "dvb-lnb-slof", 11700000, NULL, LNB_SLOF_TEXT,
144                  LNB_SLOF_LONGTEXT, VLC_TRUE );
145     /* DVB-S (satellite) */
146     add_bool( "dvb-budget-mode", 0, NULL, BUDGET_TEXT, BUDGET_LONGTEXT,
147               VLC_TRUE );
148     add_integer( "dvb-satno", 0, NULL, SATNO_TEXT, SATNO_LONGTEXT,
149                  VLC_TRUE );
150     add_integer( "dvb-voltage", 13, NULL, VOLTAGE_TEXT, VOLTAGE_LONGTEXT,
151                  VLC_TRUE );
152     add_integer( "dvb-tone", -1, NULL, TONE_TEXT, TONE_LONGTEXT,
153                  VLC_TRUE );
154     add_integer( "dvb-fec", 9, NULL, FEC_TEXT, FEC_LONGTEXT, VLC_TRUE );
155     add_integer( "dvb-srate", 27500000, NULL, SRATE_TEXT, SRATE_LONGTEXT,
156                  VLC_FALSE );
157     /* DVB-T (terrestrial) */
158     add_integer( "dvb-modulation", 0, NULL, MODULATION_TEXT,
159                  MODULATION_LONGTEXT, VLC_TRUE );
160     /* DVB-T (terrestrial) */
161     add_integer( "dvb-code-rate-hp", 9, NULL, CODE_RATE_HP_TEXT,
162                  CODE_RATE_HP_LONGTEXT, VLC_TRUE );
163     add_integer( "dvb-code-rate-lp", 9, NULL, CODE_RATE_LP_TEXT,
164                  CODE_RATE_LP_LONGTEXT, VLC_TRUE );
165     add_integer( "dvb-bandwidth", 0, NULL, BANDWIDTH_TEXT, BANDWIDTH_LONGTEXT,
166                  VLC_TRUE );
167     add_integer( "dvb-guard", 0, NULL, GUARD_TEXT, GUARD_LONGTEXT, VLC_TRUE );
168     add_integer( "dvb-transmission", 0, NULL, TRANSMISSION_TEXT,
169                  TRANSMISSION_LONGTEXT, VLC_TRUE );
170     add_integer( "dvb-hierarchy", 0, NULL, HIERARCHY_TEXT, HIERARCHY_LONGTEXT,
171                  VLC_TRUE );
172
173     set_capability( "access", 0 );
174     add_shortcut( "dvb" );
175     add_shortcut( "dvb-s" );
176     add_shortcut( "qpsk" );
177     add_shortcut( "dvb-c" );
178     add_shortcut( "cable" );
179     add_shortcut( "dvb-t" );
180     add_shortcut( "terrestrial" );
181     add_shortcut( "satellite" );    /* compatibility with the interface. */
182     set_callbacks( Open, Close );
183 vlc_module_end();
184
185
186 /*****************************************************************************
187  * Local prototypes
188  *****************************************************************************/
189 static block_t *Block( access_t * );
190 static int Control( access_t *, int, va_list );
191
192 #define SATELLITE_READ_ONCE 3
193 #if 0
194 static ssize_t Read( input_thread_t * p_input, byte_t * p_buffer,
195                               size_t i_len);
196 static int     SetArea    ( input_thread_t *, input_area_t * );
197 static int     SetProgram ( input_thread_t *, pgrm_descriptor_t * );
198 static void    Seek       ( input_thread_t *, off_t );
199 static void    AllocateDemux( input_thread_t * p_input, int i_pid,
200                               int i_type );
201 static void    CloseProgram( input_thread_t * p_input );
202 #endif
203
204 static void FilterUnset( access_t *, int i_start, int i_max );
205 static void FilterSet( access_t *, int i_pid, int i_type );
206
207 static void VarInit( access_t * );
208 static int  ParseMRL( access_t * );
209
210
211 /*****************************************************************************
212  * Open: open the frontend device
213  *****************************************************************************/
214 static int Open( vlc_object_t *p_this )
215 {
216     access_t     *p_access = (access_t*)p_this;
217     access_sys_t *p_sys;
218
219     /* Only if selected */
220     if( *p_access->psz_acces == '\0' )
221         return VLC_EGENERIC;
222
223     /* Set up access */
224     p_access->pf_read = NULL;
225     p_access->pf_block = Block;
226     p_access->pf_control = Control;
227     p_access->pf_seek = NULL;
228     p_access->info.i_update = 0;
229     p_access->info.i_size = 0;
230     p_access->info.i_pos = 0;
231     p_access->info.b_eof = VLC_FALSE;
232     p_access->info.i_title = 0;
233     p_access->info.i_seekpoint = 0;
234
235     p_access->p_sys = p_sys = malloc( sizeof( access_sys_t ) );
236     memset( p_sys, 0, sizeof( access_sys_t ) );
237
238     /* Create all variables */
239     VarInit( p_access );
240
241     /* Parse the command line */
242     if( ParseMRL( p_access ) )
243     {
244         free( p_sys );
245         return VLC_EGENERIC;
246     }
247
248     /* Getting frontend info */
249     if( E_(FrontendOpen)( p_access) )
250     {
251         free( p_sys );
252         return VLC_EGENERIC;
253     }
254
255     /* Setting frontend parameters for tuning the hardware */
256     msg_Dbg( p_access, "trying to tune the frontend...");
257     if( E_(FrontendSet)( p_access ) < 0 )
258     {
259         E_(FrontendClose)( p_access );
260         free( p_sys );
261         return VLC_EGENERIC;
262     }
263
264     /* Opening DVR device */
265     if( E_(DVROpen)( p_access ) < 0 )
266     {
267         E_(FrontendClose)( p_access );
268         free( p_sys );
269         return VLC_EGENERIC;
270     }
271
272     p_sys->b_budget_mode = var_GetBool( p_access, "dvb-budget-mode" );
273     if( p_sys->b_budget_mode )
274     {
275         msg_Dbg( p_access, "setting filter on all PIDs" );
276         AllocateDemux( p_access, 0x2000, OTHER_TYPE );
277     }
278     else
279     {
280         msg_Dbg( p_access, "setting filter on PAT" );
281         AllocateDemux( p_access, 0x0, OTHER_TYPE );
282     }
283
284     return VLC_SUCCESS;
285 }
286
287 /*****************************************************************************
288  * Close : Close the device
289  *****************************************************************************/
290 static void Close( vlc_object_t *p_this )
291 {
292     access_t     *p_access = (access_t*)p_this;
293     access_sys_t *p_sys = p_access->p_sys;
294
295     FilterUnset( p_access, 0, p_sys->b_budget_mode ? 1 : MAX_DEMUX );
296
297     E_(DVRClose)( p_access );
298     E_(FrontendClose)( p_access );
299     free( p_sys );
300 }
301
302 /*****************************************************************************
303  * Block:
304  *****************************************************************************/
305 static block_t *Block( access_t *p_access )
306 {
307     access_t     *p_access = (access_t*)p_this;
308     access_sys_t *p_sys = p_access->p_sys;
309     struct timeval timeout;
310     fd_set fds;
311     int i_ret;
312     block_t *p_block;
313
314     /* Initialize file descriptor set */
315     FD_ZERO( &fds );
316     FD_SET( p_sys->i_handle, &fds );
317
318     /* We'll wait 0.5 second if nothing happens */
319     timeout.tv_sec = 0;
320     timeout.tv_usec = 500000;
321
322     /* Find if some data is available */
323     while( (i_ret = select( p_sys->i_handle + 1, &fds, NULL, NULL, &timeout )) == 0 ||
324            (i_ret < 0 && errno == EINTR) )
325     {
326         FD_ZERO( &fds );
327         FD_SET( p_sys->i_handle, &fds );
328         timeout.tv_sec = 0;
329         timeout.tv_usec = 500000;
330
331         if( p_access->b_die )
332             return NULL;
333     }
334
335     if ( i_ret < 0 )
336     {
337         msg_Err( p_input, "select error (%s)", strerror(errno) );
338         return NULL;
339     }
340
341     p_block = block_New( p_access, p_sys->i_mtu );
342     if( ( p_block->i_buffer = read( p_sys->i_handle, p_block->p_buffer, SATELLITE_READ_ONCE * TS_PACKET_SIZE ) ) <= 0 )
343     {
344         msg_Err( p_input, "read failed (%s)", strerror(errno) );
345         block_Release( p_block );
346         return NULL;
347     }
348
349     return p_block;
350 }
351
352 /*****************************************************************************
353  * Control:
354  *****************************************************************************/
355 static int Control( access_t *p_access, int i_query, va_list args )
356 {
357     access_sys_t *p_sys = p_access->p_sys;
358     vlc_bool_t   *pb_bool, b_bool;
359     int          *pi_int, i_int;
360     int64_t      *pi_64;
361     vlc_value_t  val;
362
363     switch( i_query )
364     {
365         /* */
366         case ACCESS_CAN_SEEK:
367         case ACCESS_CAN_FASTSEEK:
368         case ACCESS_CAN_PAUSE:
369         case ACCESS_CAN_CONTROL_PACE:
370             pb_bool = (vlc_bool_t*)va_arg( args, vlc_bool_t* );
371             *pb_bool = VLC_FALSE;
372             break;
373         /* */
374         case ACCESS_GET_MTU:
375             pi_int = (int*)va_arg( args, int * );
376             *pi_int = SATELLITE_READ_ONCE * TS_PACKET_SIZE;
377             break;
378
379         case ACCESS_GET_PTS_DELAY:
380             pi_64 = (int64_t*)va_arg( args, int64_t * );
381             *pi_64 = var_GetInteger( p_access, "dvb-caching" ) * 1000;
382             break;
383
384         /* */
385         case ACCESS_SET_PAUSE_STATE:
386         case ACCESS_GET_TITLE_INFO:
387         case ACCESS_SET_TITLE:
388         case ACCESS_SET_SEEKPOINT:
389             return VLC_EGENERIC;
390
391         case ACCESS_SET_PRIVATE_ID_STATE:
392             b_bool = (vlc_bool_t)va_arg( args, vlc_bool_t ); /* b_selected */
393             i_int  = (int)va_arg( args, int );               /* Private data (pid for now)*/
394             if( !p_sys->b_budget_mode )
395             {
396                 /* FIXME we may want to give the real type (me ?, I don't ;) */
397                 if( b_bool )
398                     FilterSet( p_access, i_int, OTHER_TYPE );
399                 else
400                     FilterUnset( p_access, i_int, i_int+1 );
401             }
402             break;
403
404         default:
405             msg_Err( p_access, "unimplemented query in control" );
406             return VLC_EGENERIC;
407
408     }
409     return VLC_SUCCESS;
410 }
411
412 /*****************************************************************************
413  * FilterSet/FilterUnset:
414  *****************************************************************************/
415 static void FilterSet( access_t *p_access, int i_pid, int i_type );
416 {
417     access_sys_t *p_sys = p_access->p_sys;
418     int i;
419
420     /* Find first free slot */
421     for( i = 0; i < MAX_DEMUX; i++ )
422     {
423         if( !p_sys->p_demux_handles[i].i_type )
424             break;
425     }
426
427     if( i >= MAX_DEMUX )
428     {
429         msg_Err( p_access, "no free p_demux_handles !" );
430         return;
431     }
432
433     if( E_(DMXSetFilter)( p_access, i_pid,
434                            &p_sys->p_demux_handles[i].i_handle, i_type ) )
435     {
436         msg_Err( p_access, "DMXSetFilter failed" );
437         return;
438     }
439     p_sys->p_demux_handles[i].i_type = i_type;
440     p_sys->p_demux_handles[i].i_pid = i_pid;
441 }
442
443 static void FilterUnset( access_t *p_access, int i_start, int i_max )
444 {
445     access_sys_t *p_sys = p_access->p_sys;
446     int i;
447
448     for( i = i_start; i < i_max; i++ )
449     {
450         if( p_sys->p_demux_handles[i].i_type )
451         {
452             E_(DMXUnsetFilter)( p_access, p_sys->p_demux_handles[i].i_handle );
453             p_sys->p_demux_handles[i].i_type = 0;
454         }
455     }
456 }
457
458 /*****************************************************************************
459  * VarInit/ParseMRL:
460  *****************************************************************************/
461 static void VarInit( access_t *p_access )
462 {
463     /* */
464     var_Create( p_input, "dvb-caching", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
465
466     /* */
467     var_Create( p_input, "dvb-adapter", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
468     var_Create( p_input, "dvb-device", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
469     var_Create( p_input, "dvb-frequency", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
470     var_Create( p_input, "dvb-inversion", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
471     var_Create( p_input, "dvb-probe", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
472     var_Create( p_input, "dvb-lnb-lof1", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
473     var_Create( p_input, "dvb-lnb-lof2", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
474     var_Create( p_input, "dvb-lnb-slof", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
475
476     /* */
477     var_Create( p_input, "dvb-budget-mode", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
478     var_Create( p_input, "dvb-satno", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
479     var_Create( p_input, "dvb-voltage", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
480     var_Create( p_input, "dvb-tone", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
481     var_Create( p_input, "dvb-fec", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
482     var_Create( p_input, "dvb-srate", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
483
484     /* */
485     var_Create( p_input, "dvb-modulation", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
486
487     /* */
488     var_Create( p_input, "dvb-code-rate-hp", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
489     var_Create( p_input, "dvb-code-rate-lp", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
490     var_Create( p_input, "dvb-bandwidth", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
491     var_Create( p_input, "dvb-transmission", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
492     var_Create( p_input, "dvb-guard", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
493     var_Create( p_input, "dvb-hierarchy", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
494 }
495
496 /* */
497 static int ParseMRL( access_t *p_access )
498 {
499     char *psz_dup = strdup( p_input->psz_path );
500     char *psz_parser = psz_dup;
501     char *psz_next;
502     vlc_value_t         val;
503
504 #define GET_OPTION_INT( option )                                            \
505     if ( !strncmp( psz_parser, option "=", strlen(option "=") ) )           \
506     {                                                                       \
507         val.i_int = strtol( psz_parser+strlen(option "="), &psz_parser, 0 );\
508         var_Set( p_access, "dvb-" option, val );                             \
509     }
510
511 #define GET_OPTION_BOOL( option )                                           \
512     if ( !strncmp( psz_parser, option "=", strlen(option "=") ) )           \
513     {                                                                       \
514         val.b_bool = strtol( psz_parser + strlen(option "="), &psz_parser,  \
515                              0 );                                           \
516         var_Set( p_access, "dvb-" option, val );                             \
517     }
518
519     /* Test for old syntax */
520     strtol( psz_parser, &psz_next, 10 );
521     if( psz_next != psz_parser )
522     {
523         msg_Err( p_access, "the DVB input old syntax is deprecated, use vlc "
524                           "-p dvb to see an explanation of the new syntax" );
525         free( psz_dup );
526         return VLC_EGENERIC;
527     }
528
529     while( *psz_parser )
530     {
531         GET_OPTION_INT("adapter")
532         else GET_OPTION_INT("device")
533         else GET_OPTION_INT("frequency")
534         else GET_OPTION_INT("inversion")
535         else GET_OPTION_BOOL("probe")
536         else GET_OPTION_INT("lnb-lof1")
537         else GET_OPTION_INT("lnb-lof2")
538         else GET_OPTION_INT("lnb-slof")
539
540         else GET_OPTION_BOOL("budget-mode")
541         else GET_OPTION_INT("voltage")
542         else GET_OPTION_INT("tone")
543         else GET_OPTION_INT("fec")
544         else GET_OPTION_INT("srate")
545
546         else GET_OPTION_INT("modulation")
547
548         else GET_OPTION_INT("code-rate-hp")
549         else GET_OPTION_INT("code-rate-lp")
550         else GET_OPTION_INT("bandwidth")
551         else GET_OPTION_INT("transmission")
552         else GET_OPTION_INT("guard")
553         else GET_OPTION_INT("hierarchy")
554
555         else if( !strncmp( psz_parser, "satno=",
556                            strlen( "satno=" ) ) )
557         {
558             psz_parser += strlen( "satno=" );
559             if ( *psz_parser == 'A' || *psz_parser == 'a' )
560                 val.i_int = -1;
561             else if ( *psz_parser == 'B' || *psz_parser == 'b' )
562                 val.i_int = -2;
563             else
564                 val.i_int = strtol( psz_parser, &psz_parser, 0 );
565             var_Set( p_access, "dvb-satno", val );
566         }
567         /* Redundant with voltage but much easier to use */
568         else if( !strncmp( psz_parser, "polarization=",
569                            strlen( "polarization=" ) ) )
570         {
571             psz_parser += strlen( "polarization=" );
572             if ( *psz_parser == 'V' || *psz_parser == 'v' )
573                 val.i_int = 13;
574             else if ( *psz_parser == 'H' || *psz_parser == 'h' )
575                 val.i_int = 18;
576             else
577             {
578                 msg_Err( p_access, "illegal polarization %c", *psz_parser );
579                 free( psz_dup );
580                 return VLC_EGENERIC;
581             }
582             var_Set( p_access, "dvb-voltage", val );
583         }
584         else
585         {
586             msg_Err( p_access, "unknown option (%d)", psz_parser );
587             free( psz_dup );
588             return VLC_EGENERIC;
589         }
590
591         psz_parser++;
592     }
593 #undef GET_OPTION_INT
594 #undef GET_OPTION_BOOL
595
596     free( psz_dup );
597     return VLC_SUCCESS;
598 }
599