MCPcopy Create free account
hub / github.com/DreamSourceLab/DSView / srd_inst_send_meta

Function srd_inst_send_meta

libsigrokdecode4DSL/session.c:124–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122}
123
124static int srd_inst_send_meta(struct srd_decoder_inst *di, int key,
125 GVariant *data)
126{
127 PyObject *py_ret;
128 GSList *l;
129 struct srd_decoder_inst *next_di;
130 int ret;
131 PyGILState_STATE gstate;
132
133 if (key != SRD_CONF_SAMPLERATE)
134 /* This is the only key we pass on to the decoder for now. */
135 return SRD_OK;
136
137 gstate = PyGILState_Ensure();
138
139 if (PyObject_HasAttrString(di->py_inst, "metadata")) {
140 py_ret = PyObject_CallMethod(di->py_inst, "metadata", "lK",
141 (long)SRD_CONF_SAMPLERATE,
142 (unsigned long long)g_variant_get_uint64(data));
143 Py_XDECREF(py_ret);
144 }
145
146 PyGILState_Release(gstate);
147
148 /* Push metadata to all the PDs stacked on top of this one. */
149 for (l = di->next_di; l; l = l->next) {
150 next_di = l->data;
151 if ((ret = srd_inst_send_meta(next_di, key, data)) != SRD_OK)
152 return ret;
153 }
154
155 return SRD_OK;
156}
157
158/**
159 * Set a metadata configuration key in a session.

Callers 1

srd_session_metadata_setFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected