Skip to content

Commit

Permalink
Merge pull request #21 from zshahaf/master
Browse files Browse the repository at this point in the history
Stability, Bug fixes and code cleanup
  • Loading branch information
dorodnic authored and GitHub Enterprise committed Aug 3, 2017
2 parents dba15ca + 57d109b commit 54cdaef
Show file tree
Hide file tree
Showing 23 changed files with 545 additions and 2,078 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ librealsense.xc/build

local_ignore/

#Visual Studio Project
.vs/*

#Clion Project
.idea/*

# QTCreator Project
/.qmake.cache
/.qmake.stash
Expand Down Expand Up @@ -74,6 +80,7 @@ librealsense-log.txt
*.dll
*.list
*.txt
!CMakeLists.txt
*.cmake
!config.cmake
*.json
Expand Down
66 changes: 36 additions & 30 deletions common/model-views.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1122,36 +1122,42 @@ namespace rs2
auto seek_time = std::chrono::duration<double, std::nano>(seek_pos * single_percent);
p.seek(std::chrono::duration_cast<std::chrono::nanoseconds>(seek_time));
}
// if (ImGui::CollapsingHeader("Playback Options"))
// {
// static bool is_paused = false;
// if (!is_paused && ImGui::Button("Pause"))
// {
// p.pause();
// for (auto&& sub : model.subdevices)
// {
// if (sub->streaming) sub->pause();
// }
// is_paused = !is_paused;
// }
// if (ImGui::IsItemHovered())
// {
// ImGui::SetTooltip("Pause playback");
// }
// if (is_paused && ImGui::Button("Resume"))
// {
// p.resume();
// for (auto&& sub : model.subdevices)
// {
// if (sub->streaming) sub->resume();
// }
// is_paused = !is_paused;
// }
// if (ImGui::IsItemHovered())
// {
// ImGui::SetTooltip("Continue playback");
// }
// }
if (ImGui::CollapsingHeader("Playback Options"))
{
static bool is_paused = p.current_status() == RS2_PLAYBACK_STATUS_PAUSED;
if (!is_paused)
{
if(ImGui::Button("Pause"))
{
p.pause();
for (auto&& sub : subdevices)
{
if (sub->streaming) sub->pause();
}
is_paused = !is_paused;
}
if (ImGui::IsItemHovered())
{
ImGui::SetTooltip("Pause playback");
}
}
if (is_paused )
{
if(ImGui::Button("Resume"))
{
p.resume();
for (auto&& sub : subdevices)
{
if (sub->streaming) sub->resume();
}
is_paused = !is_paused;
}
if (ImGui::IsItemHovered())
{
ImGui::SetTooltip("Continue playback");
}
}
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/concurrency.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ class dispatcher
_thread.join();
}

void flush()
bool flush()
{
std::mutex m;
std::condition_variable cv;
Expand All @@ -228,7 +228,7 @@ class dispatcher
cv.notify_one();
});
std::unique_lock<std::mutex> locker(m);
cv.wait(locker, [&]() { return invoked; });
return cv.wait_for(locker, std::chrono::seconds(10), [&]() { return invoked || _was_stopped; });
}
private:
friend cancellable_timer;
Expand Down
16 changes: 9 additions & 7 deletions src/core/extension.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
#include <memory>
#include <functional>

//Preprocessor Macro to define mapping between rs2_extension and their respective interface (and vice versa)
#define MAP_EXTENSION(E, T) \
template<> struct ExtensionsToTypes<E> { \
using type = T; \
}; \
template<> struct TypeToExtensionn<T> { \
static constexpr rs2_extension value = E; \
/*! Preprocessor Macro to define mapping between rs2_extension and their respective interface (and vice versa) */
#define MAP_EXTENSION(E, T) \
template<> struct ExtensionsToTypes<E> { \
using type = T; \
static constexpr const char* to_string() { return #T; }; \
}; \
template<> struct TypeToExtensionn<T> { \
static constexpr rs2_extension value = E; \
static constexpr const char* to_string() { return #T; }; \
}

namespace librealsense
Expand Down
3 changes: 2 additions & 1 deletion src/core/serialization.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ namespace librealsense
struct snapshot_box
{
std::chrono::nanoseconds timestamp;
uint32_t sensor_index;
std::string sensor_index;
rs2_extension extension_type;
std::shared_ptr<extension_snapshot> snapshot;
};

Expand Down
Loading

0 comments on commit 54cdaef

Please sign in to comment.