Commit e4658464 authored by Johan Bilien's avatar Johan Bilien

* fixed a few bugs in satellite input (device was not closed in every

failure case, symbol rate limits in gnome interface were wrong)

* added FEC choice in command line, gtk and gnome interfaces. Command
line is now
satellite:<frequency(Hz)>,<polarization(0=V,1=H)>,<fec(1=1/2,2=2/3...)>,
<symbol rate(kbyte/s)>
parent 3632d39c
......@@ -3767,7 +3767,7 @@ http://www.videolan.org/
<class>GtkTable</class>
<name>table5</name>
<border_width>5</border_width>
<rows>4</rows>
<rows>5</rows>
<columns>2</columns>
<homogeneous>False</homogeneous>
<row_spacing>5</row_spacing>
......@@ -3809,9 +3809,9 @@ http://www.videolan.org/
<update_policy>GTK_UPDATE_ALWAYS</update_policy>
<snap>False</snap>
<wrap>False</wrap>
<value>12553</value>
<lower>1</lower>
<upper>65536</upper>
<value>11954</value>
<lower>10000</lower>
<upper>12999</upper>
<step>1</step>
<page>10</page>
<page_size>10</page_size>
......@@ -3864,6 +3864,7 @@ http://www.videolan.org/
<label>Horizontal</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<group>pol</group>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
......@@ -3887,6 +3888,7 @@ http://www.videolan.org/
<label>Vertical</label>
<active>True</active>
<draw_indicator>True</draw_indicator>
<group>pol</group>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
......@@ -3940,8 +3942,8 @@ http://www.videolan.org/
<snap>False</snap>
<wrap>False</wrap>
<value>27500</value>
<lower>0</lower>
<upper>100</upper>
<lower>1000</lower>
<upper>30000</upper>
<step>1</step>
<page>10</page>
<page_size>10</page_size>
......@@ -3960,6 +3962,75 @@ http://www.videolan.org/
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label35</name>
<label>FEC</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>4</top_attach>
<bottom_attach>5</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkCombo</class>
<name>sat_fec</name>
<value_in_list>False</value_in_list>
<ok_if_empty>True</ok_if_empty>
<case_sensitive>False</case_sensitive>
<use_arrows>True</use_arrows>
<use_arrows_always>False</use_arrows_always>
<items>1/2
2/3
3/4
4/5
5/6
6/7
7/8
</items>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>4</top_attach>
<bottom_attach>5</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
<widget>
<class>GtkEntry</class>
<child_name>GtkCombo:entry</child_name>
<name>combo-entry4</name>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text>3/4</text>
</widget>
</widget>
</widget>
</widget>
</widget>
......
......@@ -2621,12 +2621,16 @@ create_intf_sat (void)
GtkObject *sat_freq_adj;
GtkWidget *sat_freq;
GtkWidget *label31;
GSList *table5_group = NULL;
GSList *pol_group = NULL;
GtkWidget *sat_pol_hor;
GtkWidget *sat_pol_vert;
GtkWidget *label33;
GtkObject *sat_srate_adj;
GtkWidget *sat_srate;
GtkWidget *label35;
GtkWidget *sat_fec;
GList *sat_fec_items = NULL;
GtkWidget *combo_entry4;
GtkWidget *hbuttonbox2;
GtkWidget *sat_ok;
GtkWidget *sat_cancel;
......@@ -2654,7 +2658,7 @@ create_intf_sat (void)
gtk_widget_show (frame13);
gtk_box_pack_start (GTK_BOX (hbox10), frame13, TRUE, TRUE, 0);
table5 = gtk_table_new (4, 2, FALSE);
table5 = gtk_table_new (5, 2, FALSE);
gtk_widget_ref (table5);
gtk_object_set_data_full (GTK_OBJECT (intf_sat), "table5", table5,
(GtkDestroyNotify) gtk_widget_unref);
......@@ -2674,7 +2678,7 @@ create_intf_sat (void)
(GtkAttachOptions) (0), 0, 0);
gtk_misc_set_alignment (GTK_MISC (label30), 0, 0.5);
sat_freq_adj = gtk_adjustment_new (12553, 1, 65536, 1, 10, 10);
sat_freq_adj = gtk_adjustment_new (11954, 10000, 12999, 1, 10, 10);
sat_freq = gtk_spin_button_new (GTK_ADJUSTMENT (sat_freq_adj), 1, 0);
gtk_widget_ref (sat_freq);
gtk_object_set_data_full (GTK_OBJECT (intf_sat), "sat_freq", sat_freq,
......@@ -2694,8 +2698,8 @@ create_intf_sat (void)
(GtkAttachOptions) (0), 0, 0);
gtk_misc_set_alignment (GTK_MISC (label31), 0, 0.5);
sat_pol_hor = gtk_radio_button_new_with_label (table5_group, _("Horizontal"));
table5_group = gtk_radio_button_group (GTK_RADIO_BUTTON (sat_pol_hor));
sat_pol_hor = gtk_radio_button_new_with_label (pol_group, _("Horizontal"));
pol_group = gtk_radio_button_group (GTK_RADIO_BUTTON (sat_pol_hor));
gtk_widget_ref (sat_pol_hor);
gtk_object_set_data_full (GTK_OBJECT (intf_sat), "sat_pol_hor", sat_pol_hor,
(GtkDestroyNotify) gtk_widget_unref);
......@@ -2704,8 +2708,8 @@ create_intf_sat (void)
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
sat_pol_vert = gtk_radio_button_new_with_label (table5_group, _("Vertical"));
table5_group = gtk_radio_button_group (GTK_RADIO_BUTTON (sat_pol_vert));
sat_pol_vert = gtk_radio_button_new_with_label (pol_group, _("Vertical"));
pol_group = gtk_radio_button_group (GTK_RADIO_BUTTON (sat_pol_vert));
gtk_widget_ref (sat_pol_vert);
gtk_object_set_data_full (GTK_OBJECT (intf_sat), "sat_pol_vert", sat_pol_vert,
(GtkDestroyNotify) gtk_widget_unref);
......@@ -2725,7 +2729,7 @@ create_intf_sat (void)
(GtkAttachOptions) (0), 0, 0);
gtk_misc_set_alignment (GTK_MISC (label33), 0, 0.5);
sat_srate_adj = gtk_adjustment_new (27500, 0, 100, 1, 10, 10);
sat_srate_adj = gtk_adjustment_new (27500, 1000, 30000, 1, 10, 10);
sat_srate = gtk_spin_button_new (GTK_ADJUSTMENT (sat_srate_adj), 1, 0);
gtk_widget_ref (sat_srate);
gtk_object_set_data_full (GTK_OBJECT (intf_sat), "sat_srate", sat_srate,
......@@ -2735,6 +2739,41 @@ create_intf_sat (void)
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
label35 = gtk_label_new (_("FEC"));
gtk_widget_ref (label35);
gtk_object_set_data_full (GTK_OBJECT (intf_sat), "label35", label35,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label35);
gtk_table_attach (GTK_TABLE (table5), label35, 0, 1, 4, 5,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
gtk_misc_set_alignment (GTK_MISC (label35), 0, 0.5);
sat_fec = gtk_combo_new ();
gtk_widget_ref (sat_fec);
gtk_object_set_data_full (GTK_OBJECT (intf_sat), "sat_fec", sat_fec,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (sat_fec);
gtk_table_attach (GTK_TABLE (table5), sat_fec, 1, 2, 4, 5,
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
sat_fec_items = g_list_append (sat_fec_items, (gpointer) _("1/2"));
sat_fec_items = g_list_append (sat_fec_items, (gpointer) _("2/3"));
sat_fec_items = g_list_append (sat_fec_items, (gpointer) _("3/4"));
sat_fec_items = g_list_append (sat_fec_items, (gpointer) _("4/5"));
sat_fec_items = g_list_append (sat_fec_items, (gpointer) _("5/6"));
sat_fec_items = g_list_append (sat_fec_items, (gpointer) _("6/7"));
sat_fec_items = g_list_append (sat_fec_items, (gpointer) _("7/8"));
gtk_combo_set_popdown_strings (GTK_COMBO (sat_fec), sat_fec_items);
g_list_free (sat_fec_items);
combo_entry4 = GTK_COMBO (sat_fec)->entry;
gtk_widget_ref (combo_entry4);
gtk_object_set_data_full (GTK_OBJECT (intf_sat), "combo_entry4", combo_entry4,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (combo_entry4);
gtk_entry_set_text (GTK_ENTRY (combo_entry4), _("3/4"));
hbuttonbox2 = GNOME_DIALOG (intf_sat)->action_area;
gtk_object_set_data (GTK_OBJECT (intf_sat), "hbuttonbox2", hbuttonbox2);
gtk_widget_show (hbuttonbox2);
......
......@@ -3127,7 +3127,7 @@ http://www.videolan.org/</label>
<class>GtkTable</class>
<name>table3</name>
<border_width>5</border_width>
<rows>4</rows>
<rows>5</rows>
<columns>2</columns>
<homogeneous>False</homogeneous>
<row_spacing>5</row_spacing>
......@@ -3143,9 +3143,9 @@ http://www.videolan.org/</label>
<update_policy>GTK_UPDATE_ALWAYS</update_policy>
<snap>False</snap>
<wrap>False</wrap>
<value>12553</value>
<lower>1</lower>
<upper>65536</upper>
<value>11954</value>
<lower>10000</lower>
<upper>12999</upper>
<step>1</step>
<page>10</page>
<page_size>10</page_size>
......@@ -3176,8 +3176,8 @@ http://www.videolan.org/</label>
<snap>False</snap>
<wrap>False</wrap>
<value>27500</value>
<lower>1</lower>
<upper>65536</upper>
<lower>1000</lower>
<upper>30000</upper>
<step>1</step>
<page>10</page>
<page_size>10</page_size>
......@@ -3282,6 +3282,7 @@ http://www.videolan.org/</label>
<label>Vertical</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<group>pol</group>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
......@@ -3305,6 +3306,7 @@ http://www.videolan.org/</label>
<label>Horizontal</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<group>pol</group>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
......@@ -3320,6 +3322,74 @@ http://www.videolan.org/</label>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label27</name>
<label>FEC</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>4</top_attach>
<bottom_attach>5</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkCombo</class>
<name>sat_fec</name>
<value_in_list>False</value_in_list>
<ok_if_empty>True</ok_if_empty>
<case_sensitive>False</case_sensitive>
<use_arrows>True</use_arrows>
<use_arrows_always>False</use_arrows_always>
<items>1/2
2/3
3/4
4/5
5/6
7/8
</items>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>4</top_attach>
<bottom_attach>5</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
<widget>
<class>GtkEntry</class>
<child_name>GtkCombo:entry</child_name>
<name>combo-entry1</name>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text>3/4</text>
</widget>
</widget>
</widget>
</widget>
</widget>
......
......@@ -2394,9 +2394,13 @@ create_intf_sat (void)
GtkWidget *label24;
GtkWidget *label25;
GtkWidget *label26;
GSList *table3_group = NULL;
GSList *pol_group = NULL;
GtkWidget *sat_pol_vert;
GtkWidget *sat_pol_hor;
GtkWidget *label27;
GtkWidget *sat_fec;
GList *sat_fec_items = NULL;
GtkWidget *combo_entry1;
GtkWidget *hbox15;
GtkWidget *hbox16;
GtkWidget *sat_ok;
......@@ -2435,7 +2439,7 @@ create_intf_sat (void)
gtk_widget_show (frame8);
gtk_box_pack_start (GTK_BOX (hbox17), frame8, TRUE, TRUE, 0);
table3 = gtk_table_new (4, 2, FALSE);
table3 = gtk_table_new (5, 2, FALSE);
gtk_widget_ref (table3);
gtk_object_set_data_full (GTK_OBJECT (intf_sat), "table3", table3,
(GtkDestroyNotify) gtk_widget_unref);
......@@ -2445,7 +2449,7 @@ create_intf_sat (void)
gtk_table_set_row_spacings (GTK_TABLE (table3), 5);
gtk_table_set_col_spacings (GTK_TABLE (table3), 5);
sat_freq_adj = gtk_adjustment_new (12553, 1, 65536, 1, 10, 10);
sat_freq_adj = gtk_adjustment_new (11954, 10000, 12999, 1, 10, 10);
sat_freq = gtk_spin_button_new (GTK_ADJUSTMENT (sat_freq_adj), 1, 0);
gtk_widget_ref (sat_freq);
gtk_object_set_data_full (GTK_OBJECT (intf_sat), "sat_freq", sat_freq,
......@@ -2455,7 +2459,7 @@ create_intf_sat (void)
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
sat_srate_adj = gtk_adjustment_new (27500, 1, 65536, 1, 10, 10);
sat_srate_adj = gtk_adjustment_new (27500, 1000, 30000, 1, 10, 10);
sat_srate = gtk_spin_button_new (GTK_ADJUSTMENT (sat_srate_adj), 1, 0);
gtk_widget_ref (sat_srate);
gtk_object_set_data_full (GTK_OBJECT (intf_sat), "sat_srate", sat_srate,
......@@ -2495,8 +2499,8 @@ create_intf_sat (void)
(GtkAttachOptions) (0), 0, 0);
gtk_misc_set_alignment (GTK_MISC (label26), 0, 0.5);
sat_pol_vert = gtk_radio_button_new_with_label (table3_group, _("Vertical"));
table3_group = gtk_radio_button_group (GTK_RADIO_BUTTON (sat_pol_vert));
sat_pol_vert = gtk_radio_button_new_with_label (pol_group, _("Vertical"));
pol_group = gtk_radio_button_group (GTK_RADIO_BUTTON (sat_pol_vert));
gtk_widget_ref (sat_pol_vert);
gtk_object_set_data_full (GTK_OBJECT (intf_sat), "sat_pol_vert", sat_pol_vert,
(GtkDestroyNotify) gtk_widget_unref);
......@@ -2505,8 +2509,8 @@ create_intf_sat (void)
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
sat_pol_hor = gtk_radio_button_new_with_label (table3_group, _("Horizontal"));
table3_group = gtk_radio_button_group (GTK_RADIO_BUTTON (sat_pol_hor));
sat_pol_hor = gtk_radio_button_new_with_label (pol_group, _("Horizontal"));
pol_group = gtk_radio_button_group (GTK_RADIO_BUTTON (sat_pol_hor));
gtk_widget_ref (sat_pol_hor);
gtk_object_set_data_full (GTK_OBJECT (intf_sat), "sat_pol_hor", sat_pol_hor,
(GtkDestroyNotify) gtk_widget_unref);
......@@ -2515,6 +2519,40 @@ create_intf_sat (void)
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
label27 = gtk_label_new (_("FEC"));
gtk_widget_ref (label27);
gtk_object_set_data_full (GTK_OBJECT (intf_sat), "label27", label27,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label27);
gtk_table_attach (GTK_TABLE (table3), label27, 0, 1, 4, 5,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
gtk_misc_set_alignment (GTK_MISC (label27), 0, 0.5);
sat_fec = gtk_combo_new ();
gtk_widget_ref (sat_fec);
gtk_object_set_data_full (GTK_OBJECT (intf_sat), "sat_fec", sat_fec,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (sat_fec);
gtk_table_attach (GTK_TABLE (table3), sat_fec, 1, 2, 4, 5,
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
sat_fec_items = g_list_append (sat_fec_items, (gpointer) _("1/2"));
sat_fec_items = g_list_append (sat_fec_items, (gpointer) _("2/3"));
sat_fec_items = g_list_append (sat_fec_items, (gpointer) _("3/4"));
sat_fec_items = g_list_append (sat_fec_items, (gpointer) _("4/5"));
sat_fec_items = g_list_append (sat_fec_items, (gpointer) _("5/6"));
sat_fec_items = g_list_append (sat_fec_items, (gpointer) _("7/8"));
gtk_combo_set_popdown_strings (GTK_COMBO (sat_fec), sat_fec_items);
g_list_free (sat_fec_items);
combo_entry1 = GTK_COMBO (sat_fec)->entry;
gtk_widget_ref (combo_entry1);
gtk_object_set_data_full (GTK_OBJECT (intf_sat), "combo_entry1", combo_entry1,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (combo_entry1);
gtk_entry_set_text (GTK_ENTRY (combo_entry1), _("3/4"));
hbox15 = GTK_DIALOG (intf_sat)->action_area;
gtk_object_set_data (GTK_OBJECT (intf_sat), "hbox15", hbox15);
gtk_widget_show (hbox15);
......
......@@ -2,7 +2,7 @@
* gtk_open.c : functions to handle file/disc/network open widgets.
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: gtk_open.c,v 1.20 2002/03/25 02:06:24 jobi Exp $
* $Id: gtk_open.c,v 1.21 2002/04/15 04:28:26 jobi Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Stphane Borel <stef@via.ecp.fr>
......@@ -530,13 +530,14 @@ void GtkSatOpenOk( GtkButton * button, gpointer user_data )
char * psz_source;
int i_end = p_main->p_playlist->i_size;
int i_freq, i_srate;
int i_fec;
boolean_t b_pol;
gtk_widget_hide( p_intf->p_sys->p_sat );
/* Check which polarization was activated */
if( GTK_TOGGLE_BUTTON( lookup_widget( GTK_WIDGET(button),
"sat_pol_vert" ) )->active )
if( GTK_TOGGLE_BUTTON( lookup_widget( GTK_WIDGET( button ),
"sat_pol_vert" ) )->active )
{
b_pol = 0;
}
......@@ -544,7 +545,36 @@ void GtkSatOpenOk( GtkButton * button, gpointer user_data )
{
b_pol = 1;
}
switch( strtol( gtk_entry_get_text( GTK_ENTRY( GTK_COMBO(
lookup_widget( GTK_WIDGET( button ), "sat_fec" )
)->entry ) ), NULL, 10 ) )
{
case 1:
i_fec = 1;
break;
case 2:
i_fec = 2;
break;
case 3:
i_fec = 3;
break;
case 4:
i_fec = 4;
break;
case 5:
i_fec = 5;
break;
case 6:
i_fec = 6;
break;
case 7:
i_fec = 7;
break;
default:
i_fec = 8; /* this should not happen */
}
/* Select frequency and symbol rate */
i_freq = gtk_spin_button_get_value_as_int(
GTK_SPIN_BUTTON( lookup_widget(
......@@ -561,8 +591,8 @@ void GtkSatOpenOk( GtkButton * button, gpointer user_data )
}
/* Build source name and add it to playlist */
sprintf( psz_source, "%s:%d,%d,%d",
"satellite", i_freq, b_pol, i_srate );
sprintf( psz_source, "%s:%d,%d,%d,%d",
"satellite", i_freq, b_pol, i_fec, i_srate );
intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END, psz_source );
free( psz_source );
......
......@@ -52,7 +52,6 @@
#include "satellite_tools.h"
#define DISEQC 0 /* Wether you should use Diseqc*/
#define FEC 2 /* FEC */
#define LNB_LOF_1 9750000
#define LNB_LOF_2 10600000
#define LNB_SLOF 11700000
......@@ -108,13 +107,15 @@ void _M( demux_getfunctions )( function_list_t * p_function_list )
*****************************************************************************/
static int SatelliteOpen( input_thread_t * p_input )
{
input_socket_t * p_satellite;
char * psz_parser;
char * psz_next;
int i_fd = 0;
int i_freq = 0;
int i_srate = 0;
boolean_t b_pol = 0;
input_socket_t * p_satellite;
char * psz_parser;
char * psz_next;
int i_fd = 0;
int i_freq = 0;
int i_srate = 0;
boolean_t b_pol = 0;
int i_fec = 1;
float f_fec;
/* parse the options passed in command line : */
......@@ -127,22 +128,76 @@ static int SatelliteOpen( input_thread_t * p_input )
i_freq = (int)strtol( psz_parser, &psz_next, 10 );
if ( *psz_next )
if( *psz_next )
{
psz_parser = psz_next + 1;
b_pol = (boolean_t)strtol( psz_parser, &psz_next, 10 );
if ( *psz_next )
if( *psz_next )
{
psz_parser = psz_next + 1;
i_srate = (boolean_t)strtol( psz_parser, &psz_next, 10 );
i_fec = (int)strtol( psz_parser, &psz_next, 10 );
if( *psz_next )
{
psz_parser = psz_next + 1;
i_srate = (int)strtol( psz_parser, &psz_next, 10 );
}
}
}
i_freq = i_freq ? i_freq : config_GetIntVariable( "sat_frequency" );
i_srate = i_srate ? i_srate : config_GetIntVariable( "sat_symbol_rate" );
if ( !b_pol && b_pol != 1 )
if( i_freq > 12999 || i_freq < 10000 )
{
intf_WarnMsg( 1, "input: satellite: invalid frequency, using"\
"default one" );
i_srate = config_GetIntVariable( "sat_frequency" );
}
if( i_srate > 30000 || i_srate < 1000 )
{
intf_WarnMsg( 1, "input: satellite: invalid symbol rate, using"\
"default one" );
i_srate = config_GetIntVariable( "sat_symbol_rate" );
}
if( !b_pol && b_pol != 1 )
{
intf_WarnMsg( 1, "input: satellite: invalid polarization, using"\
"default one" );
b_pol = config_GetIntVariable( "sat_polarization" );
}
if( i_fec > 7 || i_fec < 1 )
{
intf_WarnMsg( 1, "input: satellite: invalid FEC, using default one" );
i_fec = config_GetIntVariable( "sat_fec" );
}
switch( i_fec )
{
case 1:
f_fec = 1./2;
break;
case 2:
f_fec = 2./3;
break;
case 3:
f_fec = 3./4;
break;
case 4:
f_fec = 4./5;
break;
case 5:
f_fec = 5./6;
break;
case 6:
f_fec = 6./7;
break;
case 7:
f_fec = 7./8;
break;
default:
/* cannot happen */
}
/* Initialise structure */
......@@ -164,28 +219,32 @@ static int SatelliteOpen( input_thread_t * p_input )
/*O_NONBLOCK | O_LARGEFILE*/0 )) == (-1) )
{
intf_ErrMsg( "input error: cannot open file (%s)", strerror(errno) );
free( p_satellite );
return -1;
}
/* Initialize the Satellite Card */
intf_WarnMsg( 2, "Initializing Sat Card with Freq: %d, Pol: %d, Srate: %d",
i_freq, b_pol, i_srate );
intf_WarnMsg( 2, "Initializing Sat Card with Freq: %d, Pol: %d, "\
"FEC: %03f, Srate: %d",
i_freq, b_pol, f_fec, i_srate );
if ( ioctl_SECControl( i_freq * 1000, b_pol, LNB_SLOF, DISEQC ) < 0 )
{
intf_ErrMsg("input: satellite: An error occured when controling SEC");
close( p_satellite->i_handle );
free( p_satellite );
return -1;
}
intf_WarnMsg( 3, "Initializing Frontend device" );
switch (ioctl_SetQPSKFrontend ( i_freq * 1000, i_srate* 1000, FEC,
switch (ioctl_SetQPSKFrontend ( i_freq * 1000, i_srate* 1000, f_fec,
LNB_LOF_1, LNB_LOF_2, LNB_SLOF))
{
case -2:
intf_ErrMsg( "input: satellite: Frontend returned\
an unexpected event" );
intf_ErrMsg( "input: satellite: Frontend returned"\
"an unexpected event" );
close( p_satellite->i_handle );
free( p_satellite );
return -1;
......@@ -228,6 +287,8 @@ static int SatelliteOpen( input_thread_t * p_input )
{
intf_ErrMsg( "input: satellite: An error occured when setting\
filter on PAT" );
close( p_satellite->i_handle );
free( p_satellite );
return -1;
}
......@@ -235,6 +296,8 @@ static int SatelliteOpen( input_thread_t * p_input )
{
intf_ErrMsg( "input: satellite: Not enough memory to allow stream\
structure" );
close( p_satellite );
free( p_satellite );
return( -1 );
}
......@@ -251,8 +314,7 @@ static int SatelliteOpen( input_thread_t * p_input )
p_input->psz_demux = "satellite";
return 0;
}
}
/*****************************************************************************
* SatelliteClose : Closes the device
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment