+ if (stat(filename.c_str(), &st) == -1) {
+ error_handler(tr("Failed to load file"));
+ return NULL;
+ }
+
+ /* Initialize the input module. */
+ if (!(in = new sr_input)) {
+ qDebug("Failed to allocate input module.\n");
+ return NULL;
+ }
+
+ in->format = format;
+ in->param = NULL;
+ if (in->format->init &&
+ in->format->init(in, filename.c_str()) != SR_OK) {
+ qDebug("Input format init failed.\n");
+ return NULL;
+ }
+
+ sr_session_new();
+
+ if (sr_session_dev_add(in->sdi) != SR_OK) {
+ qDebug("Failed to use device.\n");
+ sr_session_destroy();
+ return NULL;
+ }
+
+ return in;
+}
+
+void SigSession::load_thread_proc(const string name,
+ function<void (const QString)> error_handler)
+{
+ sr_input *in = NULL;
+
+ if (sr_session_load(name.c_str()) == SR_OK) {
+ if (sr_session_start() != SR_OK) {
+ error_handler(tr("Failed to start session."));
+ return;
+ }
+ }
+ else if(!(in = load_input_file_format(name.c_str(), error_handler)))
+ return;
+
+ sr_session_datafeed_callback_add(data_feed_in_proc, NULL);
+