From afcc2d6596a393bf3066fcbd766d616b84fa200d Mon Sep 17 00:00:00 2001 From: Nicolas Pope <nwpope@utu.fi> Date: Sat, 14 Mar 2020 18:24:27 +0200 Subject: [PATCH] Small fixes to C wrapper and URI parse --- SDK/C/src/streams.cpp | 1 + components/common/cpp/src/uri.cpp | 2 ++ components/streams/src/filestream.cpp | 4 ++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/SDK/C/src/streams.cpp b/SDK/C/src/streams.cpp index e9dc6ff07..ea112ad5c 100644 --- a/SDK/C/src/streams.cpp +++ b/SDK/C/src/streams.cpp @@ -59,6 +59,7 @@ ftlStream_t ftlCreateWriteStream(const char *uri) { s->interval = 40; s->video_fs.frames.reserve(32); s->video_states.resize(32); + s->has_fresh_data = false; switch (u.getScheme()) { case ftl::URI::SCHEME_FILE : createFileWriteStream(s, u); break; diff --git a/components/common/cpp/src/uri.cpp b/components/common/cpp/src/uri.cpp index 39ddb47e1..6884720d1 100644 --- a/components/common/cpp/src/uri.cpp +++ b/components/common/cpp/src/uri.cpp @@ -45,6 +45,8 @@ void URI::_parse(uri_t puri) { if (getcwd(cwdbuf, 1024)) { suri = string("file://") + string(cwdbuf) + suri.substr(1); } + } else if (suri[0] == '/') { + suri = std::string("file://") + suri; } else if (suri[0] == '~') { #ifdef WIN32 suri = string("file://") + string(std::getenv("HOMEDRIVE")) + string(std::getenv("HOMEPATH")) + suri.substr(1); diff --git a/components/streams/src/filestream.cpp b/components/streams/src/filestream.cpp index 412594814..b25c0248e 100644 --- a/components/streams/src/filestream.cpp +++ b/components/streams/src/filestream.cpp @@ -91,7 +91,7 @@ bool File::post(const ftl::codecs::StreamPacket &s, const ftl::codecs::Packet &p return false; } - LOG(INFO) << "WRITE: " << s.timestamp << " " << (int)s.channel << " " << p.data.size(); + //LOG(INFO) << "WRITE: " << s.timestamp << " " << (int)s.channel << " " << p.data.size(); // Don't write dummy packets to files. if (p.data.size() == 0) return true; @@ -319,7 +319,7 @@ bool File::begin(bool dorun) { ostream_->open(*get<std::string>("filename"), std::ifstream::out | std::ifstream::binary); if (!ostream_->good()) { - LOG(ERROR) << "Could not open file: " << *get<std::string>("filename"); + LOG(ERROR) << "Could not open file: '" << *get<std::string>("filename") << "'"; return false; } -- GitLab