dvbsrc: make slof/lof1/lof2 settable properties

Allows proper tuning around high/low band boundaries when using
non "standard" LNBs.

Not all LNBs (Low noise block down converters) are made equal.
This is particularly true for universal LNBFs, where, even though
there are seemingly standard values for the local oscillator
frequencies, these can vary from manufacturer to manufacturer
and LNB model. Change also proxies the new LNB properties in
dvbbasebin.

https://bugzilla.gnome.org/show_bug.cgi?id=732818
This commit is contained in:
Reynaldo H. Verdejo Pinochet 2014-07-05 03:08:00 -04:00
parent 13c63154b0
commit 8391112af5
3 changed files with 73 additions and 15 deletions

View file

@ -79,8 +79,10 @@ enum
PROP_PILOT,
PROP_ROLLOFF,
PROP_STREAM_ID,
PROP_BANDWIDTH_HZ
/* FILL ME */
PROP_BANDWIDTH_HZ,
PROP_LNB_SLOF,
PROP_LNB_LOF1,
PROP_LNB_LOF2
};
typedef struct
@ -267,6 +269,9 @@ dvb_base_bin_class_init (DvbBaseBinClass * klass)
{PROP_ROLLOFF, "rolloff"},
{PROP_STREAM_ID, "stream-id"},
{PROP_BANDWIDTH_HZ, "bandwidth-hz"},
{PROP_LNB_SLOF, "lnb-slof"},
{PROP_LNB_LOF1, "lnb-lof1"},
{PROP_LNB_LOF2, "lnb-lof2"},
{0, NULL}
};
@ -561,6 +566,9 @@ dvb_base_bin_set_property (GObject * object, guint prop_id,
case PROP_ROLLOFF:
case PROP_STREAM_ID:
case PROP_BANDWIDTH_HZ:
case PROP_LNB_SLOF:
case PROP_LNB_LOF1:
case PROP_LNB_LOF2:
/* FIXME: check if we can tune (state < PLAYING || program-numbers == "") */
g_object_set_property (G_OBJECT (dvbbasebin->dvbsrc), pspec->name, value);
break;
@ -600,6 +608,9 @@ dvb_base_bin_get_property (GObject * object, guint prop_id,
case PROP_ROLLOFF:
case PROP_STREAM_ID:
case PROP_BANDWIDTH_HZ:
case PROP_LNB_SLOF:
case PROP_LNB_LOF1:
case PROP_LNB_LOF2:
g_object_get_property (G_OBJECT (dvbbasebin->dvbsrc), pspec->name, value);
break;
case PROP_PROGRAM_NUMBERS:

View file

@ -143,10 +143,6 @@
GST_DEBUG_CATEGORY_STATIC (gstdvbsrc_debug);
#define GST_CAT_DEFAULT (gstdvbsrc_debug)
#define SLOF (11700*1000UL)
#define LOF1 (9750*1000UL)
#define LOF2 (10600*1000UL)
#define NUM_DTV_PROPS 16
/* Signals */
@ -186,7 +182,10 @@ enum
ARG_DVBSRC_PILOT,
ARG_DVBSRC_ROLLOFF,
ARG_DVBSRC_STREAM_ID,
ARG_DVBSRC_BANDWIDTH_HZ
ARG_DVBSRC_BANDWIDTH_HZ,
ARG_DVBSRC_LNB_SLOF,
ARG_DVBSRC_LNB_LOF1,
ARG_DVBSRC_LNB_LOF2
};
#define DEFAULT_ADAPTER 0
@ -214,6 +213,9 @@ enum
#define DEFAULT_PILOT PILOT_AUTO
#define DEFAULT_ROLLOFF ROLLOFF_AUTO
#define DEFAULT_STREAM_ID NO_STREAM_ID_FILTER
#define DEFAULT_LNB_SLOF (11700*1000UL)
#define DEFAULT_LNB_LOF1 (9750*1000UL)
#define DEFAULT_LNB_LOF2 (10600*1000UL)
static void gst_dvbsrc_output_frontend_stats (GstDvbSrc * src);
@ -671,6 +673,23 @@ gst_dvbsrc_class_init (GstDvbSrcClass * klass)
"(DVB-T2 and DVB-S2 max 255, ISDB max 65535) Stream ID "
"(-1 = disabled)", -1, 65535, DEFAULT_STREAM_ID, G_PARAM_READWRITE));
/* LNB properties (Satellite distribution standards) */
g_object_class_install_property (gobject_class, ARG_DVBSRC_LNB_SLOF,
g_param_spec_uint ("lnb-slof", "Tuning Timeout",
"LNB's Upper bound for low band reception (kHz)",
0, G_MAXUINT, DEFAULT_LNB_SLOF, G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, ARG_DVBSRC_LNB_LOF1,
g_param_spec_uint ("lnb-lof1", "Low band local oscillator frequency",
"LNB's Local oscillator frequency used for low band reception (kHz)",
0, G_MAXUINT, DEFAULT_LNB_LOF1, G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, ARG_DVBSRC_LNB_LOF2,
g_param_spec_uint ("lnb-lof2", "High band local oscillator frequency",
"LNB's Local oscillator frequency used for high band reception (kHz)",
0, G_MAXUINT, DEFAULT_LNB_LOF2, G_PARAM_READWRITE));
/**
* GstDvbSrc::tuning-start:
* @gstdvbsrc: the element on which the signal is emitted
@ -753,6 +772,9 @@ gst_dvbsrc_init (GstDvbSrc * object)
object->pilot = DEFAULT_PILOT;
object->rolloff = DEFAULT_ROLLOFF;
object->stream_id = DEFAULT_STREAM_ID;
object->lnb_slof = DEFAULT_LNB_SLOF;
object->lnb_lof1 = DEFAULT_LNB_LOF1;
object->lnb_lof2 = DEFAULT_LNB_LOF2;
g_mutex_init (&object->tune_mutex);
object->timeout = DEFAULT_TIMEOUT;
@ -964,6 +986,21 @@ gst_dvbsrc_set_property (GObject * _object, guint prop_id,
case ARG_DVBSRC_STREAM_ID:
object->stream_id = g_value_get_int (value);
break;
case ARG_DVBSRC_LNB_SLOF:
g_mutex_lock (&object->tune_mutex);
object->lnb_slof = g_value_get_uint (value);
g_mutex_unlock (&object->tune_mutex);
break;
case ARG_DVBSRC_LNB_LOF1:
g_mutex_lock (&object->tune_mutex);
object->lnb_lof1 = g_value_get_uint (value);
g_mutex_unlock (&object->tune_mutex);
break;
case ARG_DVBSRC_LNB_LOF2:
g_mutex_lock (&object->tune_mutex);
object->lnb_lof2 = g_value_get_uint (value);
g_mutex_unlock (&object->tune_mutex);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@ -1064,6 +1101,15 @@ gst_dvbsrc_get_property (GObject * _object, guint prop_id,
case ARG_DVBSRC_STREAM_ID:
g_value_set_int (value, object->stream_id);
break;
case ARG_DVBSRC_LNB_SLOF:
g_value_set_uint (value, object->lnb_slof);
break;
case ARG_DVBSRC_LNB_LOF1:
g_value_set_uint (value, object->lnb_lof1);
break;
case ARG_DVBSRC_LNB_LOF2:
g_value_set_uint (value, object->lnb_lof2);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@ -1822,16 +1868,12 @@ gst_dvbsrc_set_fe_params (GstDvbSrc * object, struct dtv_properties *props)
case SYS_DVBS2:
case SYS_TURBO:
if (freq > 2200000) {
/* FIXME: Make SLOF/LOF1/LOF2 seteable props with a sane default.
* These values shouldn't be fixed because not all universal LNBs
* share the same parameters.
*
* this must be an absolute frequency */
if (freq < SLOF) {
freq -= LOF1;
/* this must be an absolute frequency */
if (freq < object->lnb_slof) {
freq -= object->lnb_lof1;
object->tone = SEC_TONE_OFF;
} else {
freq -= LOF2;
freq -= object->lnb_lof2;
object->tone = SEC_TONE_ON;
}
}

View file

@ -104,6 +104,11 @@ struct _GstDvbSrc
gboolean need_unlock;
guint dvb_buffer_size;
/* LNB properties */
unsigned int lnb_slof;
unsigned int lnb_lof1;
unsigned int lnb_lof2;
};
struct _GstDvbSrcClass