aboutsummaryrefslogtreecommitdiff
path: root/src/playback.cc
diff options
context:
space:
mode:
authorYour Name <you@example.com>2021-08-17 08:56:51 -0400
committerYour Name <you@example.com>2021-08-17 08:56:51 -0400
commit2a4ca022ad37ff2452ec3addb8c760a93bb616c6 (patch)
treedd66554b8e7e568a410974df71a95d37f5433d18 /src/playback.cc
parent8a6b5564c0fc37e6e556d04e17ddba86d4bd3dc1 (diff)
parent5e4240ea795c992635a3cfc464d760205e07bf05 (diff)
downloadannotator-2a4ca022ad37ff2452ec3addb8c760a93bb616c6.tar.gz
annotator-2a4ca022ad37ff2452ec3addb8c760a93bb616c6.tar.bz2
annotator-2a4ca022ad37ff2452ec3addb8c760a93bb616c6.zip
Merge branch 'master' of https://vance.fish/git/annotator
Diffstat (limited to 'src/playback.cc')
-rw-r--r--src/playback.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/playback.cc b/src/playback.cc
index 045abb6..8839528 100644
--- a/src/playback.cc
+++ b/src/playback.cc
@@ -13,14 +13,14 @@ namespace frontend {
std::size_t frameNum = 0;
};
- playback::playback(const std::filesystem::path& video) {
+ playback::playback(const std::filesystem::path& video, std::size_t frameCap) {
data = std::shared_ptr<playback_impl>(new playback_impl);
cv::VideoCapture cap(video);
if(!cap.isOpened()) {
throw std::runtime_error("Error loading video " + video.string());
}
data->fps = cap.get(cv::CAP_PROP_FPS);
- while(true) {
+ while(frameCap == 0 or data->images.size() < frameCap) {
cv::Mat frame;
cap >> frame;
if(frame.empty()) break;