From gitlab at videolan.org Fri Oct 11 10:28:37 2024 From: gitlab at videolan.org (Christophe Massiot (@cmassiot)) Date: Fri, 11 Oct 2024 12:28:37 +0200 Subject: [dvblast-devel] [Git][videolan/dvblast][master] 2 commits: Get signal stats in decibel using newer DVB API Message-ID: <6708fdd53dd6c_30eee44f6b6a85570d9@gitlab.mail> Christophe Massiot pushed to branch master at VideoLAN / dvblast Commits: 1b55871e by Cl?ment Vasseur at 2024-10-09T14:46:44+02:00 Get signal stats in decibel using newer DVB API - - - - - bca0be67 by Christophe Massiot at 2024-10-11T12:28:21+02:00 Merge branch 'nto-signal-stats' - - - - - 1 changed file: - dvb.c Changes: ===================================== dvb.c ===================================== @@ -290,16 +290,37 @@ static void PrintCb( struct ev_loop *loop, struct ev_timer *w, int revents ) ioctl(i_frontend, FE_READ_SNR, &i_snr); ioctl(i_frontend, FE_READ_UNCORRECTED_BLOCKS, &i_uncorrected); + int64_t i_strength_dbm = i_strength; + int64_t i_snr_db = i_snr; + +#ifdef DTV_STAT_SIGNAL_STRENGTH + struct dtv_property prop[] = { + { .cmd = DTV_STAT_SIGNAL_STRENGTH }, + { .cmd = DTV_STAT_CNR }, + }; + + struct dtv_properties props = { .num = 2, .props = prop }; + if (ioctl(i_frontend, FE_GET_PROPERTY, &props) != -1) + { + if (prop[0].u.st.len > 0 && + prop[0].u.st.stat[0].scale == FE_SCALE_DECIBEL) + i_strength_dbm = prop[0].u.st.stat[0].svalue; + if (prop[1].u.st.len > 0 && + prop[1].u.st.stat[0].scale == FE_SCALE_DECIBEL) + i_snr_db = prop[1].u.st.stat[0].svalue; + } +#endif + switch (i_print_type) { case PRINT_XML: fprintf(print_fh, - "\n", - i_ber, i_strength, i_snr, i_uncorrected); + "\n", + i_ber, i_strength_dbm, i_snr_db, i_uncorrected); break; case PRINT_TEXT: - fprintf(print_fh, "frontend ber: %"PRIu32" strength: %"PRIu16" snr: %"PRIu16" uncorrected: %"PRIu32"\n", - i_ber, i_strength, i_snr, i_uncorrected); + fprintf(print_fh, "frontend ber: %"PRIu32" strength: %"PRId64" snr: %"PRId64" uncorrected: %"PRIu32"\n", + i_ber, i_strength_dbm, i_snr_db, i_uncorrected); break; default: break; View it on GitLab: https://code.videolan.org/videolan/dvblast/-/compare/4e18d80c2474093925248b01c70c4ead35051e30...bca0be676f33889e38a9a63a0b7b498663e1bdc0 -- View it on GitLab: https://code.videolan.org/videolan/dvblast/-/compare/4e18d80c2474093925248b01c70c4ead35051e30...bca0be676f33889e38a9a63a0b7b498663e1bdc0 You're receiving this email because of your account on code.videolan.org. VideoLAN code repository instance