1、添加配置文件控制推流参数;
2、解决遥控器解码时帧序混乱的问题(gop_size = 1); 3、完善代码;
This commit is contained in:
@ -42,6 +42,8 @@ public:
|
||||
bool getBufferPolicy(int &bufferPolicy);
|
||||
bool getAcqBufferSize(int &acqBufferSize);
|
||||
|
||||
bool getPushFlowParam(int &flowSwitch, int &rgbHeight, int &framerateVideo);
|
||||
|
||||
bool createConfigFile();
|
||||
bool updateConfigFile();
|
||||
|
||||
|
@ -24,28 +24,6 @@ extern "C"
|
||||
#include "libavdevice/avdevice.h"
|
||||
}
|
||||
|
||||
class Encode
|
||||
{
|
||||
public:
|
||||
Encode();
|
||||
void initffmpeg(int width, int height);
|
||||
|
||||
FILE *fp;
|
||||
AVCodecContext *avcodeccontext;
|
||||
void savedata(AVFrame *frame);
|
||||
void encode(AVCodecContext *enc_ctx, AVFrame *frame, AVPacket *pkt, FILE *outfile);
|
||||
AVPacket m_avpacket;
|
||||
AVFrame *inpic;
|
||||
AVFrame *outpic;
|
||||
|
||||
bool isinit;
|
||||
int index1;
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
|
||||
|
||||
using namespace cv;
|
||||
class rgbImage :public QObject
|
||||
{
|
||||
@ -55,7 +33,8 @@ public:
|
||||
rgbImage(QWidget* pParent = NULL);
|
||||
~rgbImage();
|
||||
|
||||
void SetRgbImageWidthAndHeight(int BandCount, int Sample, int FrameNumber);
|
||||
void SetRgbImageWidthAndHeight(int BandCount, int Width, int height);
|
||||
void SetRgbBandNumber(int redBandNumber, int greenBandNumber, int blueBandNumber);
|
||||
void FillRgbImage(unsigned short *datacube);
|
||||
void FillFocusGrayImage(unsigned short *datacube);
|
||||
void FillFocusGrayQImage(unsigned short * datacube);
|
||||
@ -71,24 +50,16 @@ public:
|
||||
cv::Mat *m_matFocusGrayImage;//用于调焦时,显示一帧的灰度图
|
||||
//cv::Mat m_matFocusGrayImage;//用于调焦时,显示一帧的灰度图
|
||||
|
||||
|
||||
CvVideoWriter *m_frame_writer;
|
||||
VideoWriter m_VideoWriter;
|
||||
// VideoWriter m_video("appsrc ! autovideoconvert ! filesink location=/media/nvme/delete/live.avi", CV_FOURCC('M', 'J', 'P', 'G'), 25.0, Size(640, 480));
|
||||
// VideoWriter video("test.avi", CV_FOURCC('M', 'J', 'P', 'G'), 25.0, Size(640, 480));//
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//控制该填充rgb图像第几帧(行)数据
|
||||
//以下两种情况需要重置为0:1)调用函数SetRgbImageWidthAndHeight;2)每次开始填充数据前
|
||||
int m_iFrameCounter;
|
||||
|
||||
|
||||
int m_iFramerate;//
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
@ -99,15 +70,15 @@ private:
|
||||
|
||||
void initffmpeg();
|
||||
|
||||
int m_iRedBandNumber;
|
||||
int m_iGreenBandNumber;
|
||||
int m_iBlueBandNumber;
|
||||
|
||||
public slots:
|
||||
|
||||
signals :
|
||||
void sendstr(QString str);
|
||||
void sendstr1(QString str);
|
||||
void refreslabelimg(QImage* img1);
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif //XIMEAAIRBORNESYSTEM_RGBIMAGE_H
|
||||
|
@ -27,6 +27,8 @@
|
||||
#include <exception>
|
||||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
#include <cmath>
|
||||
#include <vector>
|
||||
|
||||
#include <QObject>
|
||||
#include <QDateTime>
|
||||
@ -125,6 +127,32 @@ public slots:
|
||||
signals:
|
||||
};
|
||||
|
||||
class PushFlow : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PushFlow();
|
||||
void setParm(rgbImage * img, int width, int height, int framerateVideo);
|
||||
void exitPushFlow();
|
||||
void setVedioFilePath(QString path);
|
||||
|
||||
private:
|
||||
QString m_QVedioFilePath;
|
||||
bool isExitPushFlow;
|
||||
|
||||
rgbImage * m_rgbImage;
|
||||
|
||||
int m_iWidth;
|
||||
int m_iHeight;
|
||||
int m_iFramerateVideo;
|
||||
|
||||
public slots:
|
||||
void encodePushFlow();
|
||||
|
||||
signals:
|
||||
};
|
||||
|
||||
class XimeaImager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -148,6 +176,9 @@ public:
|
||||
int getWindowEndBand();
|
||||
double geWavelengthAtBand(int x);
|
||||
|
||||
static int findClosestIndex(const std::vector<double>& numbers, double target);
|
||||
void getRgbBandNumber(int &redBandNumber, int &greenBandNumber, int &blueBandNumber);
|
||||
|
||||
void stopRecord();
|
||||
int getFrameCounter();
|
||||
void writeXiApiErrorCodes(QString filePath, int xiApiErrorCodes);
|
||||
@ -155,8 +186,6 @@ public:
|
||||
int getMaxValueOfOneFrame(unsigned short * data, int numberOfPixel);
|
||||
|
||||
int getImagerState() const;
|
||||
|
||||
Encode ffmpegEncode;
|
||||
private:
|
||||
//0-61:ximea官方错误代码;99:发生的ximea官方错误代码,没有处理;100:未打开;101:打开;102:设置帧率;103:自动曝光;104:正在采集;
|
||||
int m_iImagerState;
|
||||
@ -174,6 +203,10 @@ private:
|
||||
queue<int> * m_qFrameCounter;
|
||||
MemoryPool<DataBuffer> * m_pool;
|
||||
|
||||
QThread * m_pushFlowThread;
|
||||
PushFlow * m_pushFlow;
|
||||
int m_iFlowSwitch;
|
||||
|
||||
QString m_baseFileName;
|
||||
QString m_ximeaTemperatureCSVPath;
|
||||
|
||||
@ -212,6 +245,7 @@ signals:
|
||||
|
||||
void recordXimeaTemperatureSignal(QString);
|
||||
void startWriteDiskSignal();
|
||||
void startPushFlowSignal();
|
||||
|
||||
void autoExposeMaxValueOfOneFrame(int, double);
|
||||
void frameRateSignal(double);
|
||||
|
Reference in New Issue
Block a user