12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- /**
- * Ò¶º£»Ô
- * QQȺ121376426
- * http://blog.yundiantech.com/
- */
- #ifndef GetVideoThread_H
- #define GetVideoThread_H
- #include <QThread>
- extern "C"
- {
- #include "libavcodec/avcodec.h"
- #include "libavformat/avformat.h"
- #include "libswscale/swscale.h"
- #include "libavdevice/avdevice.h"
- }
- #include "savevideofile.h"
- enum ErroCode
- {
- AudioOpenFailed = 0,
- VideoOpenFailed,
- AudioDecoderOpenFailed,
- VideoDecoderOpenFailed,
- SUCCEED
- };
- class GetVideoThread : public QThread
- {
- Q_OBJECT
- public:
- explicit GetVideoThread();
- ~GetVideoThread();
- ErroCode init(QString videoDevName,bool useVideo,QString audioDevName,bool useAudio);
- void deInit();
- void startRecord();
- void pauseRecord();
- void restoreRecord();
- void stopRecord();
- void setPicRange(int x,int y,int w,int h);
- void setSaveVideoFileThread(SaveVideoFileThread * p);
- protected:
- void run();
- private:
- AVFormatContext *pFormatCtx;
- int i, videoindex ,audioindex;
- AVCodecContext *pCodecCtx,*aCodecCtx;
- AVFrame *pFrame,*aFrame,*pFrameYUV;
- uint8_t *out_buffer;
- int pic_x;
- int pic_y;
- int pic_w;
- int pic_h;
- bool m_isRun;
- bool m_pause;
- SaveVideoFileThread * m_saveVideoFileThread;
- };
- #endif // GetVideoThread_H
|