X-Git-Url: http://git.code-monkey.de/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fdevices%2Finputfile.cpp;h=3ddc8ae00db06042b97f5e10f599560b3d69b22b;hp=411877473b9bf30e235b990243c574f7418c1a61;hb=2ad82c2e40b6865481733913a2c32735602f63c4;hpb=5237f0c50352b523c6a0c3d7f931081ecdbdecaa diff --git a/pv/devices/inputfile.cpp b/pv/devices/inputfile.cpp index 4118774..3ddc8ae 100644 --- a/pv/devices/inputfile.cpp +++ b/pv/devices/inputfile.cpp @@ -34,22 +34,35 @@ InputFile::InputFile(const std::shared_ptr &context, const std::string &file_name, std::shared_ptr format, const std::map &options) : + File(file_name), context_(context), input_(format->create_input(options)), - file_name_(file_name), - interrupt_(false) { + interrupt_(false) +{ if (!input_) throw QString("Failed to create input"); } -void InputFile::create() { +void InputFile::open() +{ + if (session_) + close(); + session_ = context_->create_session(); } -void InputFile::start() { +void InputFile::close() +{ + if (session_) + session_->remove_devices(); +} + +void InputFile::start() +{ } -void InputFile::run() { +void InputFile::run() +{ char buffer[BufferSize]; bool need_device = true; @@ -84,7 +97,8 @@ void InputFile::run() { input_->end(); } -void InputFile::stop() { +void InputFile::stop() +{ interrupt_ = true; }