You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.3 KiB
47 lines
1.3 KiB
#ifndef __VIDEO_INPUT_V4L2_HEADER__
|
|
#define __VIDEO_INPUT_V4L2_HEADER__
|
|
|
|
#include "video_in.h"
|
|
|
|
#include <fcntl.h>
|
|
#include <sys/ioctl.h>
|
|
#include <linux/ioctl.h>
|
|
#include <linux/videodev2.h>
|
|
|
|
#include <vector>
|
|
|
|
class _V4L2_VideoInput: public _VideoInput {
|
|
private:
|
|
/* Vars */
|
|
int m_nFileDescriptor;
|
|
int m_nBufferCounts;
|
|
char m_pDevicePath[1024];
|
|
struct v4l2_capability m_sDeviceCaps;
|
|
struct v4l2_format m_sVideoFormat;
|
|
struct v4l2_requestbuffers m_sBufRequest;
|
|
struct v4l2_buffer m_sBufferInfo;
|
|
void* m_pBufferStart;
|
|
/* Methods */
|
|
bool openDevice( void );
|
|
bool openDevice( unsigned char *DevicePath );
|
|
bool readDevCaps( void );
|
|
bool setVideoFormat( void );
|
|
bool assignBuffers( int BuffersCount );
|
|
bool allocateBuffers( void );
|
|
bool enqueueBuffer( int BufferID );
|
|
bool dequeueBuffer( void );
|
|
bool activateStreaming( void );
|
|
bool deactivateStreaming( void );
|
|
bool closeDevice( void );
|
|
|
|
protected:
|
|
void m_fInputProc( void );
|
|
public:
|
|
_V4L2_VideoInput();
|
|
_V4L2_VideoInput( char *DevicePath );
|
|
~_V4L2_VideoInput();
|
|
void make10th( char *FileName );
|
|
};
|
|
//Based on https://jwhsmith.net/2014/12/capturing-a-webcam-stream-using-v4l2/
|
|
#endif
|
|
|