+ return inputs[i];
+}
+
+sr_input* SigSession::load_input_file_format(const string &filename,
+ function<void (const QString)> error_handler,
+ sr_input_format *format)
+{
+ struct stat st;
+ sr_input *in;
+
+ if (!format && !(format =
+ determine_input_file_format(filename.c_str()))) {
+ /* The exact cause was already logged. */
+ return NULL;
+ }
+
+ 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;