33 #include <condition_variable>
39 #include <curl/curl.h>
41 #include "captureinterface.h"
91 std::string
getPath()
const override {
return url; }
110 bool isOpen()
const override {
return image_size_known && curl_open; }
112 bool open(
const std::string& path)
override;
123 { Q_UNUSED(new_size);
return false; }
138 inline bool retrieve_next(std::unique_lock<std::mutex>& guard);
148 static size_t writeCallback(
char* buf,
size_t size,
size_t nmemb,
void* up);
151 std::condition_variable capture_next;
152 bool curl_open =
false;
153 bool image_size_known =
false;
156 int missed_frames = 0;
157 int retrieved_frames = 0;
158 std::unique_ptr<std::thread> retriever =
nullptr;
159 std::string url =
"";
163 bool capture =
false;
164 CURL* curl =
nullptr;
165 bool first_capture =
true;
166 bool read_error =
false;
167 std::vector<char> temp_buffer;
168 bool terminate =
false;
172 #endif // HTTPCAPTURE_H
void setBarrelCorrection(double amount) override
Sets the amount of the barrel correction to be applied.
Definition: httpcapture.h:116
cv::Size getResolution() const override
Retrieves the capture device resolution.
Definition: httpcapture.cpp:117
double getFramerate() const override
Retrieves the capture device framerate.
Definition: httpcapture.h:85
int getMissedFrames() const override
Retrieves the logged frame misses.
Definition: httpcapture.h:87
void resetStats() override
Resets the statistical counters.
Definition: httpcapture.cpp:168
bool isOpen() const override
Checks whether the capturing device is open or not.
Definition: httpcapture.h:110
double getBarrelCorrection() override
Retrieves the barrel correction applied to the source.
Definition: httpcapture.h:69
std::string getDescription() const override
Retrieves the description of the device.
Definition: httpcapture.h:73
Interface for the capture devices.
Definition: captureinterface.h:47
bool open(const std::string &path) override
Opens the video file or the stream.
Definition: httpcapture.cpp:122
DISALLOW_COPY_AND_ASSIGN(HTTPCapture)
Copy and assign of the class is not allowed.
int getRetrievedFrames() const override
Retrieves the total logged frames.
Definition: httpcapture.h:100
FrameCapture getBuffered() override
Retrieves the currently buffered frame.
Definition: httpcapture.cpp:64
bool hasNew() override
Checks whether the device has a new image to retrieve or not.
Definition: httpcapture.h:108
INTERFACE_TYPE getType() const override
Retrieves the type of the device.
Definition: httpcapture.h:102
The structure is used for storing a single source frame.
Definition: common.h:241
int getDeviceID() const override
Returns the ID number the device was initialized with.
Definition: httpcapture.h:79
bool setResolution(const cv::Size &new_size) override
Sets the capturing device resolution.
Definition: httpcapture.h:122
The Capture device for HTTP images.
Definition: httpcapture.h:58
std::string getPath() const override
Retrieves the path given during the initialization.
Definition: httpcapture.h:91
const int UNKNOWN_DEVICE
Used to indicate unknown hardware device.
Definition: common.h:224
FrameCapture getNext(bool skip, bool *error) override
Retrieves the next frame.
Definition: httpcapture.cpp:73
INTERFACE_TYPE
Used to define the type of source interface.
Definition: captureinterface.h:140