]> sigrok.org Git - sigrok-cli.git/commitdiff
decode: start collecting internal state (samplerate)
authorGerhard Sittig <redacted>
Sat, 25 Jul 2020 07:25:51 +0000 (09:25 +0200)
committerGerhard Sittig <redacted>
Sat, 25 Jul 2020 10:23:42 +0000 (12:23 +0200)
Introduce variables which hold the internal state during decoder
operation so far. Start by adding a "samplerate used by protocol
decoders". This is motivated by the pending Google Trace Event
feature addition.

decode.c
session.c
sigrok-cli.h

index 0bf1d250bacb2063f5d28738a72083fd5db13b5c..d27703929fe7d34a7e972627b87a5e0fd7d723e9 100644 (file)
--- a/decode.c
+++ b/decode.c
@@ -29,6 +29,8 @@ static GHashTable *pd_meta_visible = NULL;
 static GHashTable *pd_binary_visible = NULL;
 static GHashTable *pd_channel_maps = NULL;
 
+uint64_t pd_samplerate = 0;
+
 extern struct srd_session *srd_sess;
 
 static int opts_to_gvar(struct srd_decoder *dec, GHashTable *hash,
index f1542357ffc6a22605669cf5e1674bf3a3baf7c5..e8ec5a28ce3fc3bea3af7277dedc7727686bb006 100644 (file)
--- a/session.c
+++ b/session.c
@@ -324,6 +324,7 @@ void datafeed_in(const struct sr_dev_inst *sdi,
                                        g_critical("Failed to configure decode session.");
                                        break;
                                }
+                               pd_samplerate = samplerate;
                        }
                        if (srd_session_start(srd_sess) != SRD_OK) {
                                g_critical("Failed to start decode session.");
@@ -352,6 +353,7 @@ void datafeed_in(const struct sr_dev_inst *sdi,
                                                        g_variant_new_uint64(samplerate)) != SRD_OK) {
                                                g_critical("Failed to pass samplerate to decoder.");
                                        }
+                                       pd_samplerate = samplerate;
                                }
 #endif
                                break;
index 8d2669967e3d9ff2af56b6fbe75ddbbeed9ea924..10e74deafc8224f826c65bf3d62bc8c8456e2791 100644 (file)
@@ -87,6 +87,7 @@ int setup_binary_stdout(void);
 
 /* decode.c */
 #ifdef HAVE_SRD
+extern uint64_t pd_samplerate;
 int register_pds(gchar **all_pds, char *opt_pd_annotations);
 int setup_pd_annotations(char *opt_pd_annotations);
 int setup_pd_meta(char *opt_pd_meta);