From 530d56fac3ef32a1272a5b72cde1f5f19ca1851e Mon Sep 17 00:00:00 2001 From: "Reynaldo H. Verdejo Pinochet" Date: Fri, 29 Apr 2016 14:45:22 -0700 Subject: [PATCH] dvbsrc: always output known frontend status params The only mandatory frontend information for our use case is its status. Make sure we output what we know instead of choking at the first error getting SNR, BER or any of the other informational parameters. --- sys/dvb/gstdvbsrc.c | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/sys/dvb/gstdvbsrc.c b/sys/dvb/gstdvbsrc.c index 5a2d5cb252..ca124bf8a4 100644 --- a/sys/dvb/gstdvbsrc.c +++ b/sys/dvb/gstdvbsrc.c @@ -2074,36 +2074,40 @@ gst_dvbsrc_output_frontend_stats (GstDvbSrc * src) gint err; LOOP_WHILE_EINTR (err, ioctl (fe_fd, FE_READ_STATUS, &status)); - if (err) - goto error_out; + if (!err) { + structure = gst_structure_new ("dvb-frontend-stats", + "status", G_TYPE_INT, status, + "lock", G_TYPE_BOOLEAN, status & FE_HAS_LOCK, NULL); + } else { + GST_ERROR_OBJECT (src, "Error getting frontend status: '%s'", + g_strerror (errno)); + return; + } LOOP_WHILE_EINTR (err, ioctl (fe_fd, FE_READ_SIGNAL_STRENGTH, &_signal)); - if (err) - goto error_out; + if (!err) + gst_structure_set (structure, "signal", G_TYPE_INT, _signal, NULL); LOOP_WHILE_EINTR (err, ioctl (fe_fd, FE_READ_SNR, &snr)); - if (err) - goto error_out; + if (!err) + gst_structure_set (structure, "snr", G_TYPE_INT, snr, NULL); LOOP_WHILE_EINTR (err, ioctl (fe_fd, FE_READ_BER, &ber)); - if (err) - goto error_out; + if (!err) + gst_structure_set (structure, "ber", G_TYPE_INT, ber, NULL); LOOP_WHILE_EINTR (err, ioctl (fe_fd, FE_READ_UNCORRECTED_BLOCKS, &bad_blks)); - if (err) - goto error_out; + if (!err) + gst_structure_set (structure, "unc", G_TYPE_INT, bad_blks, NULL); + + if (err) + GST_WARNING_OBJECT (src, + "There were errors getting frontend status information: '%s'", + g_strerror (errno)); - structure = gst_structure_new ("dvb-frontend-stats", "status", G_TYPE_INT, - status, "signal", G_TYPE_INT, _signal, "snr", G_TYPE_INT, snr, - "ber", G_TYPE_INT, ber, "unc", G_TYPE_INT, bad_blks, - "lock", G_TYPE_BOOLEAN, status & FE_HAS_LOCK, NULL); message = gst_message_new_element (GST_OBJECT (src), structure); gst_element_post_message (GST_ELEMENT (src), message); - return; - -error_out: - GST_WARNING_OBJECT (src, "Failed to get statistics from the device: %s", - g_strerror (errno)); + GST_INFO_OBJECT (src, "Frontend stats: %" GST_PTR_FORMAT, structure); } struct diseqc_cmd