diff options
-rw-r--r-- | videoprovider.cpp | 37 | ||||
-rw-r--r-- | videoprovider.h | 19 |
2 files changed, 56 insertions, 0 deletions
diff --git a/videoprovider.cpp b/videoprovider.cpp new file mode 100644 index 0000000..6aae2d6 --- /dev/null +++ b/videoprovider.cpp @@ -0,0 +1,37 @@ +#include "videoprovider.h" + +#include <stdexcept> +#include <AR/video.h> + +VideoProvider::VideoProvider() { + // Open video device. + if(arVideoOpen(NULL) < 0) { + throw(std::runtime_error("arVideoOpen() failed.")); + } + + // Find the size of the window. + if(arVideoInqSize(&xsize, &ysize) < 0) { + throw(std::runtime_error("arVideoInqSize() failed.")); + } +} + +VideoProvider::~VideoProvider() { + stop(); + arVideoClose(); +} + +void VideoProvider::start() { + arVideoCapStart(); +} + +void VideoProvider::stop() { + arVideoCapStop(); +} + +uint8_t* VideoProvider::get() { + return arVideoGetImage(); +} + +void VideoProvider::next() { + arVideoCapNext(); +} diff --git a/videoprovider.h b/videoprovider.h new file mode 100644 index 0000000..d9d3bc7 --- /dev/null +++ b/videoprovider.h @@ -0,0 +1,19 @@ +#ifndef VIDEOPROVIDER_H +#define VIDEOPROVIDER_H + +#include <stdint.h> + +class VideoProvider { + public: + int xsize, ysize; + + VideoProvider(); + ~VideoProvider(); + + void start(); + void stop(); + uint8_t* get(); + void next(); +}; + +#endif |