Logo
ApraPipes 1.0
Loading...
Searching...
No Matches
NvV4L2CameraHelper.h
1#pragma once
2
3#include <memory>
4#include <thread>
5#include "ExtFrame.h"
6#include <map>
7#include <mutex>
8
10{
11public:
12 typedef std::function<void (frame_sp&)> SendFrame;
13
14public:
15 NvV4L2CameraHelper(SendFrame sendFrame,std::function<frame_sp()> _makeFrame);
17 static std::shared_ptr<NvV4L2CameraHelper> create(SendFrame sendFrame, std::function<frame_sp()> _makeFrame);
18
19 bool start(uint32_t width, uint32_t height, uint32_t maxConcurrentFrames, bool isMirror);
20 bool stop();
21 void operator()();
23
24private:
25 std::thread mThread;
26 std::mutex mBufferFDMutex;
27 std::function<frame_sp()> mMakeFrame;
28
29 /* Camera v4l2 context */
30 const char * mCamDevname;
31 int mCamFD;
32 unsigned int mCamPixFmt;
33 unsigned int mCamWidth;
34 unsigned int mCamHeight;
36
39 std::map<int, frame_sp> mBufferFD;
40
41 bool cameraInitialize(bool isMirror);
43 bool startStream();
44 bool requestCameraBuff();
45 bool stopStream();
46};
Definition NvV4L2CameraHelper.h:10
unsigned int mCamHeight
Definition NvV4L2CameraHelper.h:34
unsigned int mCamPixFmt
Definition NvV4L2CameraHelper.h:32
bool requestCameraBuff()
Definition NvV4L2CameraHelper.cpp:192
std::function< void(frame_sp &)> SendFrame
Definition NvV4L2CameraHelper.h:12
bool stopStream()
Definition NvV4L2CameraHelper.cpp:100
bool cameraInitialize(bool isMirror)
Definition NvV4L2CameraHelper.cpp:27
std::thread mThread
Definition NvV4L2CameraHelper.h:25
const char * mCamDevname
Definition NvV4L2CameraHelper.h:30
bool mRunning
Definition NvV4L2CameraHelper.h:37
uint32_t mMaxConcurrentFrames
Definition NvV4L2CameraHelper.h:35
std::map< int, frame_sp > mBufferFD
Definition NvV4L2CameraHelper.h:39
SendFrame mSendFrame
Definition NvV4L2CameraHelper.h:38
std::mutex mBufferFDMutex
Definition NvV4L2CameraHelper.h:26
unsigned int mCamWidth
Definition NvV4L2CameraHelper.h:33
bool queueBufferToCamera()
Definition NvV4L2CameraHelper.cpp:154
std::function< frame_sp()> mMakeFrame
Definition NvV4L2CameraHelper.h:27
NvV4L2CameraHelper(SendFrame sendFrame, std::function< frame_sp()> _makeFrame)
Definition NvV4L2CameraHelper.cpp:8
bool startStream()
Definition NvV4L2CameraHelper.cpp:86
void operator()()
Definition NvV4L2CameraHelper.cpp:114
int mCamFD
Definition NvV4L2CameraHelper.h:31
bool stop()
Definition NvV4L2CameraHelper.cpp:249
static std::shared_ptr< NvV4L2CameraHelper > create(SendFrame sendFrame, std::function< frame_sp()> _makeFrame)
~NvV4L2CameraHelper()
Definition NvV4L2CameraHelper.cpp:20
bool start(uint32_t width, uint32_t height, uint32_t maxConcurrentFrames, bool isMirror)
Definition NvV4L2CameraHelper.cpp:220