mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
dvb: Detect more issues with configuration file
Report useful errors when: * file is present but empty * requested channel is not present
This commit is contained in:
parent
068598e237
commit
d7ad4ce890
1 changed files with 233 additions and 205 deletions
|
@ -29,7 +29,12 @@
|
|||
|
||||
#include "parsechannels.h"
|
||||
|
||||
/* this will do zap style channels.conf only for the moment*/
|
||||
/* TODO:
|
||||
* Store the channels hash table around instead of constantly parsing it
|
||||
* Detect when the file changed on disk
|
||||
*/
|
||||
|
||||
/* this will do zap style channels.conf only for the moment */
|
||||
static GHashTable *
|
||||
parse_channels_conf_from_file (GstElement * dvbbasebin, const gchar * filename)
|
||||
{
|
||||
|
@ -47,7 +52,7 @@ parse_channels_conf_from_file (GstElement * dvbbasebin, const gchar * filename)
|
|||
const gchar *cable[] = { "inversion", "symbol-rate", "code-rate-hp",
|
||||
"modulation"
|
||||
};
|
||||
int i;
|
||||
int i, parsedchannels = 0;
|
||||
GHashTable *res;
|
||||
GError *err = NULL;
|
||||
|
||||
|
@ -119,6 +124,7 @@ parse_channels_conf_from_file (GstElement * dvbbasebin, const gchar * filename)
|
|||
g_hash_table_insert (params, g_strdup ("sid"),
|
||||
g_strdup (fields[numfields - 1]));
|
||||
g_hash_table_insert (res, g_strdup (fields[0]), params);
|
||||
parsedchannels++;
|
||||
}
|
||||
g_strfreev (fields);
|
||||
}
|
||||
|
@ -127,6 +133,9 @@ parse_channels_conf_from_file (GstElement * dvbbasebin, const gchar * filename)
|
|||
g_strfreev (lines);
|
||||
g_free (contents);
|
||||
|
||||
if (parsedchannels == 0)
|
||||
goto no_channels;
|
||||
|
||||
return res;
|
||||
|
||||
open_fail:
|
||||
|
@ -137,6 +146,14 @@ open_fail:
|
|||
g_clear_error (&err);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
no_channels:
|
||||
{
|
||||
GST_ELEMENT_ERROR (dvbbasebin, RESOURCE, READ, (NULL),
|
||||
("Channels configuration file doesn't contain any channels"));
|
||||
g_hash_table_unref (res);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -159,8 +176,10 @@ gboolean
|
|||
set_properties_for_channel (GstElement * dvbbasebin, const gchar * channel_name)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GHashTable *channels;
|
||||
GHashTable *channels, *params;
|
||||
gchar *filename;
|
||||
gchar *type;
|
||||
const gchar *adapter;
|
||||
|
||||
filename = g_strdup (g_getenv ("GST_DVB_CHANNELS_CONF"));
|
||||
if (filename == NULL) {
|
||||
|
@ -173,227 +192,236 @@ set_properties_for_channel (GstElement * dvbbasebin, const gchar * channel_name)
|
|||
channels = parse_channels_conf_from_file (dvbbasebin, filename);
|
||||
g_free (filename);
|
||||
|
||||
if (channels) {
|
||||
GHashTable *params = g_hash_table_lookup (channels,
|
||||
channel_name);
|
||||
if (!channels)
|
||||
goto beach;
|
||||
|
||||
if (params) {
|
||||
gchar *type;
|
||||
const gchar *adapter;
|
||||
params = g_hash_table_lookup (channels, channel_name);
|
||||
|
||||
g_object_set (dvbbasebin, "program-numbers",
|
||||
g_hash_table_lookup (params, "sid"), NULL);
|
||||
/* check if it is terrestrial or satellite */
|
||||
adapter = g_getenv ("GST_DVB_ADAPTER");
|
||||
if (adapter)
|
||||
g_object_set (dvbbasebin, "adapter", atoi (adapter), NULL);
|
||||
g_object_set (dvbbasebin, "frequency",
|
||||
atoi (g_hash_table_lookup (params, "frequency")), NULL);
|
||||
type = g_hash_table_lookup (params, "type");
|
||||
if (strcmp (type, "terrestrial") == 0) {
|
||||
gchar *val;
|
||||
if (!params)
|
||||
goto unknown_channel;
|
||||
|
||||
val = g_hash_table_lookup (params, "inversion");
|
||||
if (strcmp (val, "INVERSION_OFF") == 0)
|
||||
g_object_set (dvbbasebin, "inversion", 0, NULL);
|
||||
else if (strcmp (val, "INVERSION_ON") == 0)
|
||||
g_object_set (dvbbasebin, "inversion", 1, NULL);
|
||||
else
|
||||
g_object_set (dvbbasebin, "inversion", 2, NULL);
|
||||
g_object_set (dvbbasebin, "program-numbers",
|
||||
g_hash_table_lookup (params, "sid"), NULL);
|
||||
/* check if it is terrestrial or satellite */
|
||||
adapter = g_getenv ("GST_DVB_ADAPTER");
|
||||
if (adapter)
|
||||
g_object_set (dvbbasebin, "adapter", atoi (adapter), NULL);
|
||||
g_object_set (dvbbasebin, "frequency",
|
||||
atoi (g_hash_table_lookup (params, "frequency")), NULL);
|
||||
type = g_hash_table_lookup (params, "type");
|
||||
if (strcmp (type, "terrestrial") == 0) {
|
||||
gchar *val;
|
||||
|
||||
val = g_hash_table_lookup (params, "bandwidth");
|
||||
if (strcmp (val, "BANDWIDTH_8_MHZ") == 0)
|
||||
g_object_set (dvbbasebin, "bandwidth", 0, NULL);
|
||||
else if (strcmp (val, "BANDWIDTH_7_MHZ") == 0)
|
||||
g_object_set (dvbbasebin, "bandwidth", 1, NULL);
|
||||
else if (strcmp (val, "BANDWIDTH_6_MHZ") == 0)
|
||||
g_object_set (dvbbasebin, "bandwidth", 2, NULL);
|
||||
else
|
||||
g_object_set (dvbbasebin, "bandwidth", 3, NULL);
|
||||
val = g_hash_table_lookup (params, "inversion");
|
||||
if (strcmp (val, "INVERSION_OFF") == 0)
|
||||
g_object_set (dvbbasebin, "inversion", 0, NULL);
|
||||
else if (strcmp (val, "INVERSION_ON") == 0)
|
||||
g_object_set (dvbbasebin, "inversion", 1, NULL);
|
||||
else
|
||||
g_object_set (dvbbasebin, "inversion", 2, NULL);
|
||||
|
||||
val = g_hash_table_lookup (params, "code-rate-hp");
|
||||
if (strcmp (val, "FEC_NONE") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-hp", 0, NULL);
|
||||
else if (strcmp (val, "FEC_1_2") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-hp", 1, NULL);
|
||||
else if (strcmp (val, "FEC_2_3") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-hp", 2, NULL);
|
||||
else if (strcmp (val, "FEC_3_4") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-hp", 3, NULL);
|
||||
else if (strcmp (val, "FEC_4_5") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-hp", 4, NULL);
|
||||
else if (strcmp (val, "FEC_5_6") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-hp", 5, NULL);
|
||||
else if (strcmp (val, "FEC_6_7") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-hp", 6, NULL);
|
||||
else if (strcmp (val, "FEC_7_8") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-hp", 7, NULL);
|
||||
else if (strcmp (val, "FEC_8_9") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-hp", 8, NULL);
|
||||
else
|
||||
g_object_set (dvbbasebin, "code-rate-hp", 9, NULL);
|
||||
val = g_hash_table_lookup (params, "bandwidth");
|
||||
if (strcmp (val, "BANDWIDTH_8_MHZ") == 0)
|
||||
g_object_set (dvbbasebin, "bandwidth", 0, NULL);
|
||||
else if (strcmp (val, "BANDWIDTH_7_MHZ") == 0)
|
||||
g_object_set (dvbbasebin, "bandwidth", 1, NULL);
|
||||
else if (strcmp (val, "BANDWIDTH_6_MHZ") == 0)
|
||||
g_object_set (dvbbasebin, "bandwidth", 2, NULL);
|
||||
else
|
||||
g_object_set (dvbbasebin, "bandwidth", 3, NULL);
|
||||
|
||||
val = g_hash_table_lookup (params, "code-rate-lp");
|
||||
if (strcmp (val, "FEC_NONE") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-lp", 0, NULL);
|
||||
else if (strcmp (val, "FEC_1_2") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-lp", 1, NULL);
|
||||
else if (strcmp (val, "FEC_2_3") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-lp", 2, NULL);
|
||||
else if (strcmp (val, "FEC_3_4") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-lp", 3, NULL);
|
||||
else if (strcmp (val, "FEC_4_5") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-lp", 4, NULL);
|
||||
else if (strcmp (val, "FEC_5_6") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-lp", 5, NULL);
|
||||
else if (strcmp (val, "FEC_6_7") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-lp", 6, NULL);
|
||||
else if (strcmp (val, "FEC_7_8") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-lp", 7, NULL);
|
||||
else if (strcmp (val, "FEC_8_9") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-lp", 8, NULL);
|
||||
else
|
||||
g_object_set (dvbbasebin, "code-rate-lp", 9, NULL);
|
||||
val = g_hash_table_lookup (params, "code-rate-hp");
|
||||
if (strcmp (val, "FEC_NONE") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-hp", 0, NULL);
|
||||
else if (strcmp (val, "FEC_1_2") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-hp", 1, NULL);
|
||||
else if (strcmp (val, "FEC_2_3") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-hp", 2, NULL);
|
||||
else if (strcmp (val, "FEC_3_4") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-hp", 3, NULL);
|
||||
else if (strcmp (val, "FEC_4_5") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-hp", 4, NULL);
|
||||
else if (strcmp (val, "FEC_5_6") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-hp", 5, NULL);
|
||||
else if (strcmp (val, "FEC_6_7") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-hp", 6, NULL);
|
||||
else if (strcmp (val, "FEC_7_8") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-hp", 7, NULL);
|
||||
else if (strcmp (val, "FEC_8_9") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-hp", 8, NULL);
|
||||
else
|
||||
g_object_set (dvbbasebin, "code-rate-hp", 9, NULL);
|
||||
|
||||
val = g_hash_table_lookup (params, "modulation");
|
||||
if (strcmp (val, "QPSK") == 0)
|
||||
g_object_set (dvbbasebin, "modulation", 0, NULL);
|
||||
else if (strcmp (val, "QAM_16") == 0)
|
||||
g_object_set (dvbbasebin, "modulation", 1, NULL);
|
||||
else if (strcmp (val, "QAM_32") == 0)
|
||||
g_object_set (dvbbasebin, "modulation", 2, NULL);
|
||||
else if (strcmp (val, "QAM_64") == 0)
|
||||
g_object_set (dvbbasebin, "modulation", 3, NULL);
|
||||
else if (strcmp (val, "QAM_128") == 0)
|
||||
g_object_set (dvbbasebin, "modulation", 4, NULL);
|
||||
else if (strcmp (val, "QAM_256") == 0)
|
||||
g_object_set (dvbbasebin, "modulation", 5, NULL);
|
||||
else
|
||||
g_object_set (dvbbasebin, "modulation", 6, NULL);
|
||||
val = g_hash_table_lookup (params, "code-rate-lp");
|
||||
if (strcmp (val, "FEC_NONE") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-lp", 0, NULL);
|
||||
else if (strcmp (val, "FEC_1_2") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-lp", 1, NULL);
|
||||
else if (strcmp (val, "FEC_2_3") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-lp", 2, NULL);
|
||||
else if (strcmp (val, "FEC_3_4") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-lp", 3, NULL);
|
||||
else if (strcmp (val, "FEC_4_5") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-lp", 4, NULL);
|
||||
else if (strcmp (val, "FEC_5_6") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-lp", 5, NULL);
|
||||
else if (strcmp (val, "FEC_6_7") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-lp", 6, NULL);
|
||||
else if (strcmp (val, "FEC_7_8") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-lp", 7, NULL);
|
||||
else if (strcmp (val, "FEC_8_9") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-lp", 8, NULL);
|
||||
else
|
||||
g_object_set (dvbbasebin, "code-rate-lp", 9, NULL);
|
||||
|
||||
val = g_hash_table_lookup (params, "transmission-mode");
|
||||
if (strcmp (val, "TRANSMISSION_MODE_2K") == 0)
|
||||
g_object_set (dvbbasebin, "trans-mode", 0, NULL);
|
||||
else if (strcmp (val, "TRANSMISSION_MODE_8K") == 0)
|
||||
g_object_set (dvbbasebin, "trans-mode", 1, NULL);
|
||||
else
|
||||
g_object_set (dvbbasebin, "trans-mode", 2, NULL);
|
||||
val = g_hash_table_lookup (params, "modulation");
|
||||
if (strcmp (val, "QPSK") == 0)
|
||||
g_object_set (dvbbasebin, "modulation", 0, NULL);
|
||||
else if (strcmp (val, "QAM_16") == 0)
|
||||
g_object_set (dvbbasebin, "modulation", 1, NULL);
|
||||
else if (strcmp (val, "QAM_32") == 0)
|
||||
g_object_set (dvbbasebin, "modulation", 2, NULL);
|
||||
else if (strcmp (val, "QAM_64") == 0)
|
||||
g_object_set (dvbbasebin, "modulation", 3, NULL);
|
||||
else if (strcmp (val, "QAM_128") == 0)
|
||||
g_object_set (dvbbasebin, "modulation", 4, NULL);
|
||||
else if (strcmp (val, "QAM_256") == 0)
|
||||
g_object_set (dvbbasebin, "modulation", 5, NULL);
|
||||
else
|
||||
g_object_set (dvbbasebin, "modulation", 6, NULL);
|
||||
|
||||
val = g_hash_table_lookup (params, "guard");
|
||||
if (strcmp (val, "GUARD_INTERVAL_1_32") == 0)
|
||||
g_object_set (dvbbasebin, "guard", 0, NULL);
|
||||
else if (strcmp (val, "GUARD_INTERVAL_1_16") == 0)
|
||||
g_object_set (dvbbasebin, "guard", 1, NULL);
|
||||
else if (strcmp (val, "GUARD_INTERVAL_1_8") == 0)
|
||||
g_object_set (dvbbasebin, "guard", 2, NULL);
|
||||
else if (strcmp (val, "GUARD_INTERVAL_1_4") == 0)
|
||||
g_object_set (dvbbasebin, "guard", 3, NULL);
|
||||
else
|
||||
g_object_set (dvbbasebin, "guard", 4, NULL);
|
||||
val = g_hash_table_lookup (params, "transmission-mode");
|
||||
if (strcmp (val, "TRANSMISSION_MODE_2K") == 0)
|
||||
g_object_set (dvbbasebin, "trans-mode", 0, NULL);
|
||||
else if (strcmp (val, "TRANSMISSION_MODE_8K") == 0)
|
||||
g_object_set (dvbbasebin, "trans-mode", 1, NULL);
|
||||
else
|
||||
g_object_set (dvbbasebin, "trans-mode", 2, NULL);
|
||||
|
||||
val = g_hash_table_lookup (params, "hierarchy");
|
||||
if (strcmp (val, "HIERARCHY_NONE") == 0)
|
||||
g_object_set (dvbbasebin, "hierarchy", 0, NULL);
|
||||
else if (strcmp (val, "HIERARCHY_1") == 0)
|
||||
g_object_set (dvbbasebin, "hierarchy", 1, NULL);
|
||||
else if (strcmp (val, "HIERARCHY_2") == 0)
|
||||
g_object_set (dvbbasebin, "hierarchy", 2, NULL);
|
||||
else if (strcmp (val, "HIERARCHY_4") == 0)
|
||||
g_object_set (dvbbasebin, "hierarchy", 3, NULL);
|
||||
else
|
||||
g_object_set (dvbbasebin, "hierarchy", 4, NULL);
|
||||
val = g_hash_table_lookup (params, "guard");
|
||||
if (strcmp (val, "GUARD_INTERVAL_1_32") == 0)
|
||||
g_object_set (dvbbasebin, "guard", 0, NULL);
|
||||
else if (strcmp (val, "GUARD_INTERVAL_1_16") == 0)
|
||||
g_object_set (dvbbasebin, "guard", 1, NULL);
|
||||
else if (strcmp (val, "GUARD_INTERVAL_1_8") == 0)
|
||||
g_object_set (dvbbasebin, "guard", 2, NULL);
|
||||
else if (strcmp (val, "GUARD_INTERVAL_1_4") == 0)
|
||||
g_object_set (dvbbasebin, "guard", 3, NULL);
|
||||
else
|
||||
g_object_set (dvbbasebin, "guard", 4, NULL);
|
||||
|
||||
ret = TRUE;
|
||||
} else if (strcmp (type, "satellite") == 0) {
|
||||
gchar *val;
|
||||
val = g_hash_table_lookup (params, "hierarchy");
|
||||
if (strcmp (val, "HIERARCHY_NONE") == 0)
|
||||
g_object_set (dvbbasebin, "hierarchy", 0, NULL);
|
||||
else if (strcmp (val, "HIERARCHY_1") == 0)
|
||||
g_object_set (dvbbasebin, "hierarchy", 1, NULL);
|
||||
else if (strcmp (val, "HIERARCHY_2") == 0)
|
||||
g_object_set (dvbbasebin, "hierarchy", 2, NULL);
|
||||
else if (strcmp (val, "HIERARCHY_4") == 0)
|
||||
g_object_set (dvbbasebin, "hierarchy", 3, NULL);
|
||||
else
|
||||
g_object_set (dvbbasebin, "hierarchy", 4, NULL);
|
||||
|
||||
ret = TRUE;
|
||||
ret = TRUE;
|
||||
} else if (strcmp (type, "satellite") == 0) {
|
||||
gchar *val;
|
||||
|
||||
val = g_hash_table_lookup (params, "polarity");
|
||||
if (val)
|
||||
g_object_set (dvbbasebin, "polarity", val, NULL);
|
||||
else
|
||||
ret = FALSE;
|
||||
ret = TRUE;
|
||||
|
||||
val = g_hash_table_lookup (params, "diseqc-source");
|
||||
if (val)
|
||||
g_object_set (dvbbasebin, "diseqc-source", atoi (val), NULL);
|
||||
val = g_hash_table_lookup (params, "polarity");
|
||||
if (val)
|
||||
g_object_set (dvbbasebin, "polarity", val, NULL);
|
||||
else
|
||||
ret = FALSE;
|
||||
|
||||
val = g_hash_table_lookup (params, "symbol-rate");
|
||||
if (val)
|
||||
g_object_set (dvbbasebin, "symbol-rate", atoi (val), NULL);
|
||||
else
|
||||
ret = FALSE;
|
||||
} else if (strcmp (type, "cable") == 0) {
|
||||
gchar *val;
|
||||
val = g_hash_table_lookup (params, "diseqc-source");
|
||||
if (val)
|
||||
g_object_set (dvbbasebin, "diseqc-source", atoi (val), NULL);
|
||||
|
||||
ret = TRUE;
|
||||
val = g_hash_table_lookup (params, "symbol-rate");
|
||||
if (val)
|
||||
g_object_set (dvbbasebin, "symbol-rate", atoi (val) / 1000, NULL);
|
||||
val = g_hash_table_lookup (params, "modulation");
|
||||
if (strcmp (val, "QPSK") == 0)
|
||||
g_object_set (dvbbasebin, "modulation", 0, NULL);
|
||||
else if (strcmp (val, "QAM_16") == 0)
|
||||
g_object_set (dvbbasebin, "modulation", 1, NULL);
|
||||
else if (strcmp (val, "QAM_32") == 0)
|
||||
g_object_set (dvbbasebin, "modulation", 2, NULL);
|
||||
else if (strcmp (val, "QAM_64") == 0)
|
||||
g_object_set (dvbbasebin, "modulation", 3, NULL);
|
||||
else if (strcmp (val, "QAM_128") == 0)
|
||||
g_object_set (dvbbasebin, "modulation", 4, NULL);
|
||||
else if (strcmp (val, "QAM_256") == 0)
|
||||
g_object_set (dvbbasebin, "modulation", 5, NULL);
|
||||
else
|
||||
g_object_set (dvbbasebin, "modulation", 6, NULL);
|
||||
val = g_hash_table_lookup (params, "code-rate-hp");
|
||||
if (strcmp (val, "FEC_NONE") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-hp", 0, NULL);
|
||||
else if (strcmp (val, "FEC_1_2") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-hp", 1, NULL);
|
||||
else if (strcmp (val, "FEC_2_3") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-hp", 2, NULL);
|
||||
else if (strcmp (val, "FEC_3_4") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-hp", 3, NULL);
|
||||
else if (strcmp (val, "FEC_4_5") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-hp", 4, NULL);
|
||||
else if (strcmp (val, "FEC_5_6") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-hp", 5, NULL);
|
||||
else if (strcmp (val, "FEC_6_7") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-hp", 6, NULL);
|
||||
else if (strcmp (val, "FEC_7_8") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-hp", 7, NULL);
|
||||
else if (strcmp (val, "FEC_8_9") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-hp", 8, NULL);
|
||||
else
|
||||
g_object_set (dvbbasebin, "code-rate-hp", 9, NULL);
|
||||
val = g_hash_table_lookup (params, "inversion");
|
||||
if (strcmp (val, "INVERSION_OFF") == 0)
|
||||
g_object_set (dvbbasebin, "inversion", 0, NULL);
|
||||
else if (strcmp (val, "INVERSION_ON") == 0)
|
||||
g_object_set (dvbbasebin, "inversion", 1, NULL);
|
||||
else
|
||||
g_object_set (dvbbasebin, "inversion", 2, NULL);
|
||||
} else if (strcmp (type, "atsc") == 0) {
|
||||
gchar *val;
|
||||
val = g_hash_table_lookup (params, "symbol-rate");
|
||||
if (val)
|
||||
g_object_set (dvbbasebin, "symbol-rate", atoi (val), NULL);
|
||||
else
|
||||
ret = FALSE;
|
||||
} else if (strcmp (type, "cable") == 0) {
|
||||
gchar *val;
|
||||
|
||||
ret = TRUE;
|
||||
ret = TRUE;
|
||||
val = g_hash_table_lookup (params, "symbol-rate");
|
||||
if (val)
|
||||
g_object_set (dvbbasebin, "symbol-rate", atoi (val) / 1000, NULL);
|
||||
val = g_hash_table_lookup (params, "modulation");
|
||||
if (strcmp (val, "QPSK") == 0)
|
||||
g_object_set (dvbbasebin, "modulation", 0, NULL);
|
||||
else if (strcmp (val, "QAM_16") == 0)
|
||||
g_object_set (dvbbasebin, "modulation", 1, NULL);
|
||||
else if (strcmp (val, "QAM_32") == 0)
|
||||
g_object_set (dvbbasebin, "modulation", 2, NULL);
|
||||
else if (strcmp (val, "QAM_64") == 0)
|
||||
g_object_set (dvbbasebin, "modulation", 3, NULL);
|
||||
else if (strcmp (val, "QAM_128") == 0)
|
||||
g_object_set (dvbbasebin, "modulation", 4, NULL);
|
||||
else if (strcmp (val, "QAM_256") == 0)
|
||||
g_object_set (dvbbasebin, "modulation", 5, NULL);
|
||||
else
|
||||
g_object_set (dvbbasebin, "modulation", 6, NULL);
|
||||
val = g_hash_table_lookup (params, "code-rate-hp");
|
||||
if (strcmp (val, "FEC_NONE") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-hp", 0, NULL);
|
||||
else if (strcmp (val, "FEC_1_2") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-hp", 1, NULL);
|
||||
else if (strcmp (val, "FEC_2_3") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-hp", 2, NULL);
|
||||
else if (strcmp (val, "FEC_3_4") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-hp", 3, NULL);
|
||||
else if (strcmp (val, "FEC_4_5") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-hp", 4, NULL);
|
||||
else if (strcmp (val, "FEC_5_6") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-hp", 5, NULL);
|
||||
else if (strcmp (val, "FEC_6_7") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-hp", 6, NULL);
|
||||
else if (strcmp (val, "FEC_7_8") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-hp", 7, NULL);
|
||||
else if (strcmp (val, "FEC_8_9") == 0)
|
||||
g_object_set (dvbbasebin, "code-rate-hp", 8, NULL);
|
||||
else
|
||||
g_object_set (dvbbasebin, "code-rate-hp", 9, NULL);
|
||||
val = g_hash_table_lookup (params, "inversion");
|
||||
if (strcmp (val, "INVERSION_OFF") == 0)
|
||||
g_object_set (dvbbasebin, "inversion", 0, NULL);
|
||||
else if (strcmp (val, "INVERSION_ON") == 0)
|
||||
g_object_set (dvbbasebin, "inversion", 1, NULL);
|
||||
else
|
||||
g_object_set (dvbbasebin, "inversion", 2, NULL);
|
||||
} else if (strcmp (type, "atsc") == 0) {
|
||||
gchar *val;
|
||||
|
||||
val = g_hash_table_lookup (params, "modulation");
|
||||
if (strcmp (val, "QAM_64") == 0)
|
||||
g_object_set (dvbbasebin, "modulation", 3, NULL);
|
||||
else if (strcmp (val, "QAM_256") == 0)
|
||||
g_object_set (dvbbasebin, "modulation", 5, NULL);
|
||||
else if (strcmp (val, "8VSB") == 0)
|
||||
g_object_set (dvbbasebin, "modulation", 7, NULL);
|
||||
else if (strcmp (val, "16VSB") == 0)
|
||||
g_object_set (dvbbasebin, "modulation", 8, NULL);
|
||||
else
|
||||
ret = FALSE;
|
||||
}
|
||||
}
|
||||
destroy_channels_hash (channels);
|
||||
ret = TRUE;
|
||||
|
||||
val = g_hash_table_lookup (params, "modulation");
|
||||
if (strcmp (val, "QAM_64") == 0)
|
||||
g_object_set (dvbbasebin, "modulation", 3, NULL);
|
||||
else if (strcmp (val, "QAM_256") == 0)
|
||||
g_object_set (dvbbasebin, "modulation", 5, NULL);
|
||||
else if (strcmp (val, "8VSB") == 0)
|
||||
g_object_set (dvbbasebin, "modulation", 7, NULL);
|
||||
else if (strcmp (val, "16VSB") == 0)
|
||||
g_object_set (dvbbasebin, "modulation", 8, NULL);
|
||||
else
|
||||
ret = FALSE;
|
||||
}
|
||||
|
||||
destroy_channels_hash (channels);
|
||||
|
||||
beach:
|
||||
return ret;
|
||||
|
||||
unknown_channel:
|
||||
{
|
||||
GST_ELEMENT_ERROR (dvbbasebin, RESOURCE, READ, (NULL),
|
||||
("Couldn't find configuration properties for channel \"%s\"",
|
||||
channel_name));
|
||||
destroy_channels_hash (channels);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue