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.
91 lines
1.5 KiB
91 lines
1.5 KiB
|
|
#ifndef _VIDEO_H_
|
|
#define _VIDEO_H_
|
|
|
|
#include <stdint.h>
|
|
#include <setjmp.h>
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <unistd.h>
|
|
#include <fcntl.h>
|
|
#include <errno.h>
|
|
#include <getopt.h>
|
|
#include <sys/ioctl.h>
|
|
#include <sys/time.h>
|
|
#include <sys/stat.h>
|
|
#include <sys/types.h>
|
|
#include <sys/time.h>
|
|
#include <sys/mman.h>
|
|
#include <linux/videodev2.h>
|
|
|
|
#include <list>
|
|
#include <string>
|
|
|
|
#include <jpeglib.h>
|
|
|
|
enum {
|
|
IOMODE_READ,
|
|
IOMODE_MMAP
|
|
};
|
|
|
|
//
|
|
// jpeg error handling
|
|
//
|
|
struct jpg_error_mgr {
|
|
struct jpeg_error_mgr pub; /* "public" fields */
|
|
|
|
jmp_buf setjmp_buffer; /* for return to caller */
|
|
};
|
|
typedef struct jpg_error_mgr *jpg_error_ptr;
|
|
|
|
|
|
//
|
|
// only contain 24bit each color 8Bit
|
|
class VideoFrame {
|
|
private:
|
|
virtual void AllocateFrame();
|
|
protected:
|
|
void FreeFrame();
|
|
int mem_allocated;
|
|
unsigned char *mem;
|
|
int height;
|
|
int width;
|
|
public:
|
|
VideoFrame();
|
|
~VideoFrame();
|
|
|
|
int GetHeight() { return height; };
|
|
int GetWidth() { return width; };
|
|
unsigned char *GetPixBuf() { return mem; };
|
|
|
|
int SetSize(int w, int h);
|
|
};
|
|
|
|
|
|
class VideoFrameFloat : public VideoFrame {
|
|
private:
|
|
void AllocateFrame();
|
|
protected:
|
|
public:
|
|
};
|
|
|
|
|
|
class VideoDevice {
|
|
private:
|
|
int videofd;
|
|
protected:
|
|
public:
|
|
VideoDevice();
|
|
~VideoDevice();
|
|
|
|
int SetDevice();
|
|
int Start(int w, int h);
|
|
int Stop();
|
|
int GetFrame(VideoFrame *destframe);
|
|
};
|
|
|
|
|
|
#endif
|