X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fsession.cpp;h=4aba385b687d22ac8764da163b3f552792580682;hb=014293fc0c203bf0ecae1a18350d09a6501538dc;hp=50e89e567041c2ec186e47e0d387457808f452a3;hpb=d7168e582c71ebcc359b12efed83daa2a6b6f28e;p=pulseview.git diff --git a/pv/session.cpp b/pv/session.cpp index 50e89e5..4aba385 100644 --- a/pv/session.cpp +++ b/pv/session.cpp @@ -483,7 +483,6 @@ void Session::load_init_file(const string &file_name, const string &format) map input_opts; if (!format.empty()) { - // Got a user provided input format spec. const map > formats = device_manager_.context()->input_formats(); auto user_opts = pv::util::split_string(format, ":"); @@ -500,11 +499,6 @@ void Session::load_init_file(const string &file_name, const string &format) input_format = (*iter).second; input_opts = input_format_options(user_opts, input_format->options()); - } else { - // (Try to) auto detect the input format. Lookup failure - // is not fatal, when no input module claimed responsibility, - // then a session file gets loaded. - input_format = device_manager_.context()->input_format_match(file_name); } load_file(QString::fromStdString(file_name), input_format, input_opts); @@ -517,6 +511,10 @@ void Session::load_file(QString file_name, const QString errorMessage( QString("Failed to load file %1").arg(file_name)); + // In the absence of a caller's format spec, try to auto detect. + // Assume "sigrok session file" upon lookup miss. + if (!format) + format = device_manager_.context()->input_format_match(file_name.toStdString()); try { if (format) set_device(shared_ptr( @@ -1050,15 +1048,10 @@ void Session::feed_in_meta(shared_ptr meta) for (auto entry : meta->config()) { switch (entry.first->id()) { case SR_CONF_SAMPLERATE: - // We can't rely on the header to always contain the sample rate, - // so in case it's supplied via a meta packet, we use it. - if (!cur_samplerate_) - cur_samplerate_ = g_variant_get_uint64(entry.second.gobj()); - - /// @todo handle samplerate changes + cur_samplerate_ = g_variant_get_uint64(entry.second.gobj()); break; default: - // Unknown metadata is not an error. + qDebug() << "Received meta data key" << entry.first->id() << ", ignoring."; break; } }