Use new SR_DF_META packet.
Since input modules determine a samplerate by reading from their file format (or having it overridden with an option), they need to pass this up to the frontend.
This commit is contained in:
parent
d8e3685c47
commit
2df1e81970
|
@ -100,8 +100,9 @@ static int loadfile(struct sr_input *in, const char *filename)
|
||||||
{
|
{
|
||||||
struct sr_datafeed_header header;
|
struct sr_datafeed_header header;
|
||||||
struct sr_datafeed_packet packet;
|
struct sr_datafeed_packet packet;
|
||||||
struct sr_datafeed_meta_logic meta;
|
struct sr_datafeed_meta meta;
|
||||||
struct sr_datafeed_logic logic;
|
struct sr_datafeed_logic logic;
|
||||||
|
struct sr_config *src;
|
||||||
unsigned char buffer[CHUNKSIZE];
|
unsigned char buffer[CHUNKSIZE];
|
||||||
int fd, size, num_probes;
|
int fd, size, num_probes;
|
||||||
struct context *ctx;
|
struct context *ctx;
|
||||||
|
@ -120,12 +121,13 @@ static int loadfile(struct sr_input *in, const char *filename)
|
||||||
packet.payload = &header;
|
packet.payload = &header;
|
||||||
sr_session_send(in->sdi, &packet);
|
sr_session_send(in->sdi, &packet);
|
||||||
|
|
||||||
/* Send metadata about the SR_DF_LOGIC packets to come. */
|
if (ctx->samplerate) {
|
||||||
packet.type = SR_DF_META_LOGIC;
|
packet.type = SR_DF_META;
|
||||||
packet.payload = &meta;
|
packet.payload = &meta;
|
||||||
meta.samplerate = ctx->samplerate;
|
src = sr_config_make(SR_HWCAP_SAMPLERATE, (const void *)&ctx->samplerate);
|
||||||
meta.num_probes = num_probes;
|
meta.config = g_slist_append(NULL, src);
|
||||||
sr_session_send(in->sdi, &packet);
|
sr_session_send(in->sdi, &packet);
|
||||||
|
}
|
||||||
|
|
||||||
/* Chop up the input file into chunks & send it to the session bus. */
|
/* Chop up the input file into chunks & send it to the session bus. */
|
||||||
packet.type = SR_DF_LOGIC;
|
packet.type = SR_DF_LOGIC;
|
||||||
|
|
|
@ -139,8 +139,9 @@ static int loadfile(struct sr_input *in, const char *filename)
|
||||||
{
|
{
|
||||||
struct sr_datafeed_header header;
|
struct sr_datafeed_header header;
|
||||||
struct sr_datafeed_packet packet;
|
struct sr_datafeed_packet packet;
|
||||||
struct sr_datafeed_meta_logic meta;
|
struct sr_datafeed_meta meta;
|
||||||
struct sr_datafeed_logic logic;
|
struct sr_datafeed_logic logic;
|
||||||
|
struct sr_config *src;
|
||||||
uint8_t buf[PACKET_SIZE], divcount;
|
uint8_t buf[PACKET_SIZE], divcount;
|
||||||
int i, fd, size, num_probes;
|
int i, fd, size, num_probes;
|
||||||
uint64_t samplerate;
|
uint64_t samplerate;
|
||||||
|
@ -173,10 +174,10 @@ static int loadfile(struct sr_input *in, const char *filename)
|
||||||
sr_session_send(in->sdi, &packet);
|
sr_session_send(in->sdi, &packet);
|
||||||
|
|
||||||
/* Send metadata about the SR_DF_LOGIC packets to come. */
|
/* Send metadata about the SR_DF_LOGIC packets to come. */
|
||||||
packet.type = SR_DF_META_LOGIC;
|
packet.type = SR_DF_META;
|
||||||
packet.payload = &meta;
|
packet.payload = &meta;
|
||||||
meta.samplerate = samplerate;
|
src = sr_config_make(SR_HWCAP_SAMPLERATE, (const void *)&samplerate);
|
||||||
meta.num_probes = num_probes;
|
meta.config = g_slist_append(NULL, src);
|
||||||
sr_session_send(in->sdi, &packet);
|
sr_session_send(in->sdi, &packet);
|
||||||
|
|
||||||
/* TODO: Handle trigger point. */
|
/* TODO: Handle trigger point. */
|
||||||
|
|
11
input/vcd.c
11
input/vcd.c
|
@ -545,9 +545,11 @@ static int loadfile(struct sr_input *in, const char *filename)
|
||||||
{
|
{
|
||||||
struct sr_datafeed_header header;
|
struct sr_datafeed_header header;
|
||||||
struct sr_datafeed_packet packet;
|
struct sr_datafeed_packet packet;
|
||||||
struct sr_datafeed_meta_logic meta;
|
struct sr_datafeed_meta meta;
|
||||||
|
struct sr_config *src;
|
||||||
FILE *file;
|
FILE *file;
|
||||||
struct context *ctx;
|
struct context *ctx;
|
||||||
|
uint64_t samplerate;
|
||||||
|
|
||||||
ctx = in->internal;
|
ctx = in->internal;
|
||||||
|
|
||||||
|
@ -569,10 +571,11 @@ static int loadfile(struct sr_input *in, const char *filename)
|
||||||
sr_session_send(in->sdi, &packet);
|
sr_session_send(in->sdi, &packet);
|
||||||
|
|
||||||
/* Send metadata about the SR_DF_LOGIC packets to come. */
|
/* Send metadata about the SR_DF_LOGIC packets to come. */
|
||||||
packet.type = SR_DF_META_LOGIC;
|
packet.type = SR_DF_META;
|
||||||
packet.payload = &meta;
|
packet.payload = &meta;
|
||||||
meta.samplerate = ctx->samplerate / ctx->downsample;
|
samplerate = ctx->samplerate / ctx->downsample;
|
||||||
meta.num_probes = ctx->probecount;
|
src = sr_config_make(SR_HWCAP_SAMPLERATE, (const void *)&samplerate);
|
||||||
|
meta.config = g_slist_append(NULL, src);
|
||||||
sr_session_send(in->sdi, &packet);
|
sr_session_send(in->sdi, &packet);
|
||||||
|
|
||||||
/* Parse the contents of the VCD file */
|
/* Parse the contents of the VCD file */
|
||||||
|
|
Loading…
Reference in New Issue