X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=session.c;h=e8ec5a28ce3fc3bea3af7277dedc7727686bb006;hb=69110b5cbe99a54937f108d239592e5afb55d008;hp=65352bbd841481b31219c0d20111f65d3fb9d3b6;hpb=1c9506337ddea5526802971d06c9caf84a29f953;p=sigrok-cli.git diff --git a/session.c b/session.c index 65352bb..e8ec5a2 100644 --- a/session.c +++ b/session.c @@ -107,11 +107,17 @@ const struct sr_output *setup_output_format(const struct sr_dev_inst *sdi, FILE o = sr_output_new(omod, fmtopts, sdi, opt_output_file); if (opt_output_file) { - if (!sr_output_test_flag(omod, SR_OUTPUT_INTERNAL_IO_HANDLING)) + if (!sr_output_test_flag(omod, SR_OUTPUT_INTERNAL_IO_HANDLING)) { *outfile = g_fopen(opt_output_file, "wb"); - else + if (!*outfile) { + g_critical("Cannot write to output file '%s'.", + opt_output_file); + } + } else { *outfile = NULL; + } } else { + setup_binary_stdout(); *outfile = stdout; } @@ -318,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."); @@ -346,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;