@@ -7,6 +7,7 @@
#ifndef __LIBCAMERA_BUFFER_H__
#define __LIBCAMERA_BUFFER_H__
+#include <sys/time.h>
#include <vector>
namespace libcamera {
@@ -46,8 +47,19 @@ public:
unsigned int index() const { return index_; };
const std::vector<Plane *> &planes() { return planes_; };
+ unsigned int bytesused() const { return bytesused_; };
+ unsigned int flags() const { return flags_; };
+ unsigned int field() const { return field_; };
+ struct timeval timestamp() const { return timestamp_; };
+ unsigned int sequence() const { return sequence_; };
+
protected:
unsigned int index_;
+ unsigned int bytesused_;
+ unsigned int flags_;
+ unsigned int field_;
+ struct timeval timestamp_;
+ unsigned int sequence_;
unsigned int format_;
unsigned int width_;
@@ -61,6 +61,8 @@ class V4L2Buffer : public Buffer
{
public:
V4L2Buffer(struct v4l2_buffer &vb);
+
+ void update(struct v4l2_buffer &vb);
};
class V4L2DeviceFormat
@@ -9,6 +9,7 @@
#include <string.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
+#include <sys/time.h>
#include <unistd.h>
#include <vector>
@@ -111,6 +112,16 @@ V4L2Buffer::V4L2Buffer(struct v4l2_buffer &vb)
}
}
+void V4L2Buffer::update(struct v4l2_buffer &vb)
+{
+ /* Update buffer information */
+ bytesused_ = vb.bytesused;
+ flags_ = vb.flags;
+ field_ = vb.field;
+ timestamp_ = vb.timestamp;
+ sequence_ = vb.sequence;
+}
+
/**
* \class V4L2DeviceFormat
* \brief The V4L2 device image format and sizes
@@ -673,7 +684,11 @@ Buffer *V4L2Device::dequeueBuffer()
return nullptr;
}
- return bufferPool_->buffers()[buf.index];
+ V4L2Buffer *b;
+ b = reinterpret_cast<V4L2Buffer *>(bufferPool_->buffers()[buf.index]);
+ b->update(buf);
+
+ return b;
}
/**