38 #include "captureinterface.h"
97 {
return source ==
nullptr ? 0.0 : source->getBarrelCorrection(); }
105 static std::string
getCodec() {
return recorder_codec; }
126 {
return source ==
nullptr ?
"" : source->getDescription(); }
133 {
return source ==
nullptr ?
UNKNOWN_DEVICE : source->getDeviceID(); }
150 {
return source ==
nullptr ? cv::Size(0, 0) : source->getResolution(); }
168 bool open(
int index);
175 bool open(
const std::string& url);
182 {
return source ==
nullptr ?
false : source->isOpen(); }
190 bool record(
const std::string& filename,
191 const std::string& codec =
"")
override;
204 static bool setCodec(
const std::string &codec);
222 void stop()
override;
230 {
return static_cast<FrameTime>(1000.0 / frames_per_second); }
242 inline void pushToRecorder(
const FrameCapture& capture,
bool repush =
false);
244 static std::string recorder_codec;
245 static double frames_per_second;
247 int record_timer = 0;
248 std::unique_ptr<Recorder> recorder =
nullptr;
249 std::vector<std::string> recorded_files;
250 std::unique_ptr<CaptureInterface> source =
nullptr;
double getFramerate() const override
Retrieves the framerate.
Definition: camera.cpp:106
void stop() override
Stops the camera from recording.
Definition: camera.cpp:259
DISALLOW_COPY_AND_ASSIGN(Camera)
Copy and assign of the class is not allowed.
bool record(const std::string &filename, const std::string &codec="") override
Starts the recording of the source to the file.
Definition: camera.cpp:202
std::vector< std::string > getRecordings() const
Returns the names of the video files that were recorded.
Definition: camera.cpp:119
unsigned int SourceID
Used to indicate unique source ID-numbers.
Definition: common.h:229
SourceType getSourceType() const override
Returns the type of the source.
Definition: camera.cpp:134
const SourceID UNDEFINED_SOURCE
Used to indicate unknown sources.
Definition: common.h:234
bool canRecord() const override
Returns information on the source recording abilities.
Definition: camera.h:84
bool isPlaying() const override
Checks whether the source is playing or not.
Definition: camera.h:188
std::string getDescription() const override
Retrieves the description of the source.
Definition: camera.h:125
The structure to hold statistics about the source performance.
Definition: common.h:327
Camera(SourceID desired_id=UNDEFINED_SOURCE)
Creates a new source.
Definition: camera.h:75
static void setDefaultFPS(double fps)
Sets the cameras default framerate.
Definition: camera.h:213
cv::Size getResolution() const override
Retrieves the resolution of the source.
Definition: camera.h:149
bool setResolution(const cv::Size &new_size) override
Sets the source resolution.
Definition: camera.cpp:252
The camera and video file source base class.
Definition: source.h:51
int getDeviceID() const
Retrieves the device number used to initialize the device.
Definition: camera.h:132
SourceType
Available source types are the following ones: CAMERA = hardware or network camera, NOTHING = not a working source, STREAM = network stream, VIDEO = video file and VIDEOSET = set of multiple files.
Definition: common.h:68
FrameTime getPosition() const overridefinal
Retrieves the current time position of the source.
Definition: camera.h:141
std::uint64_t FrameTime
Used to store milliseconds interval in frame times.
Definition: common.h:138
The structure is used for storing a single source frame.
Definition: common.h:241
bool isOpen() const override
Checks if the source has been initialized.
Definition: camera.h:181
double getBarrelCorrection() override
Returns the barrel correction applied to the source frames.
Definition: camera.h:96
SourceStats getStats() override
Retrieves the source statistical information.
Definition: camera.cpp:145
static std::string getCodec()
Retrieves the current codec used.
Definition: camera.h:105
bool hasNew() override
Checks whether the device has a new image to be retrieved or not.
Definition: camera.h:161
bool open(int index)
Opens a new camera object.
Definition: camera.cpp:158
const int UNKNOWN_DEVICE
Used to indicate unknown hardware device.
Definition: common.h:224
void setBarrelCorrection(double amount) override
Sets the new barrel correction value.
Definition: camera.cpp:234
static bool setCodec(const std::string &codec)
Sets recorders codec for new videos.
Definition: camera.cpp:241
The class for a camera source.
Definition: camera.h:64
static double getDefaultFPS()
Retrieves the default framerate that has been set.
Definition: camera.h:114