mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 07:58:51 +00:00
dvbsrc: improve delivery system autodetection
This commit is contained in:
parent
793c1a2423
commit
15e21fee71
1 changed files with 37 additions and 16 deletions
|
@ -2339,26 +2339,47 @@ fail:
|
||||||
static void
|
static void
|
||||||
gst_dvbsrc_guess_delsys (GstDvbSrc * object)
|
gst_dvbsrc_guess_delsys (GstDvbSrc * object)
|
||||||
{
|
{
|
||||||
GList *delsys;
|
GList *valid, *candidate;
|
||||||
|
guint alternatives;
|
||||||
|
|
||||||
/* If adapter only supports one delivery system, there's no real choice */
|
if (g_list_length (object->supported_delsys) == 1) {
|
||||||
if (g_list_length (object->supported_delsys) == 1)
|
object->delsys = GPOINTER_TO_INT (object->supported_delsys->data);
|
||||||
goto go_with_default;
|
GST_DEBUG_OBJECT (object, "Adapter supports a single delsys: '%u'",
|
||||||
|
object->delsys);
|
||||||
/* Add delivery system specific rules here */
|
|
||||||
|
|
||||||
/* DVB-T/T2 on QAM_256 channel? has to be DVB-T2 */
|
|
||||||
if (object->modulation == QAM_256 &&
|
|
||||||
g_list_find (object->supported_delsys, GINT_TO_POINTER (SYS_DVBT2))) {
|
|
||||||
object->delsys = SYS_DVBT2;
|
|
||||||
goto autoselection_done;
|
goto autoselection_done;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No rule provided a match so we default to the last device-reported
|
/* Automatic delivery system selection based on known-correct
|
||||||
* supported delivery system */
|
* parameter combinations */
|
||||||
go_with_default:
|
|
||||||
delsys = g_list_last (object->supported_delsys);
|
valid = g_list_copy (object->supported_delsys);
|
||||||
object->delsys = GPOINTER_TO_INT (delsys->data);
|
|
||||||
|
candidate = valid;
|
||||||
|
while (candidate) {
|
||||||
|
GList *next = candidate->next;
|
||||||
|
if (!gst_dvbsrc_is_valid_modulation (GPOINTER_TO_INT (candidate->data),
|
||||||
|
object->modulation)) {
|
||||||
|
valid = g_list_delete_link (valid, candidate);
|
||||||
|
}
|
||||||
|
candidate = next;
|
||||||
|
}
|
||||||
|
|
||||||
|
alternatives = g_list_length (valid);
|
||||||
|
|
||||||
|
if (!alternatives) {
|
||||||
|
GST_WARNING_OBJECT (object, "Delivery system autodetection provided no "
|
||||||
|
"valid alternative");
|
||||||
|
candidate = g_list_last (object->supported_delsys);
|
||||||
|
} else {
|
||||||
|
if (alternatives > 1) {
|
||||||
|
GST_WARNING_OBJECT (object, "Delivery system autodetection provided more "
|
||||||
|
"than one valid alternative");
|
||||||
|
}
|
||||||
|
candidate = g_list_last (valid);
|
||||||
|
}
|
||||||
|
|
||||||
|
object->delsys = GPOINTER_TO_INT (candidate->data);
|
||||||
|
g_list_free (valid);
|
||||||
|
|
||||||
autoselection_done:
|
autoselection_done:
|
||||||
GST_INFO_OBJECT (object, "Automatically selecting delivery system '%u'",
|
GST_INFO_OBJECT (object, "Automatically selecting delivery system '%u'",
|
||||||
|
|
Loading…
Reference in a new issue