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.
72 lines
2.2 KiB
72 lines
2.2 KiB
#ifndef __LA_SERVA_MEDIA_ENCODER_HEADER__
|
|
#define __LA_SERVA_MEDIA_ENCODER_HEADER__
|
|
|
|
#define STEPHANE_OPENCV_ENCODE
|
|
|
|
#include "../common/serverMySQL_dataBinder.h"
|
|
#include "../../components/base/basicThread.h"
|
|
#include "../../components/base/basicMutex.h"
|
|
#include "../../components/base/basicLIBAV.h"
|
|
#include "../../components/base/basicLogCollection.h"
|
|
#include <vector>
|
|
|
|
|
|
#ifdef STEPHANE_OPENCV_ENCODE
|
|
|
|
typedef struct S_LIBAV_VS{
|
|
char m_pFileName[MAX_PATH_LEN];
|
|
MediaStateStatus m_bStatus;
|
|
} LIBAV_VS;
|
|
|
|
#else //!STEPHANE_OPENCV_ENCODE
|
|
|
|
typedef struct S_LIBAV_VS{
|
|
int m_iVideoStreamID;
|
|
AVStream *m_pVideoStr;
|
|
AVFormatContext *m_pFormatCtx;
|
|
AVDictionary *m_pFormatOpts;
|
|
AVCodecContext *m_pCodecCtx;
|
|
AVCodec *m_pVideoCodec;
|
|
SwsContext *m_pSwsCtx;
|
|
char m_pFileName[MAX_PATH_LEN];
|
|
MediaStateStatus m_bStatus;
|
|
} LIBAV_VS;
|
|
|
|
#endif //!STEPHANE_OPENCV_ENCODE
|
|
|
|
class servaKernel;
|
|
|
|
class servaMediaEncoder: public basicThread{
|
|
private:
|
|
basicLogCollection * m_pLog;
|
|
DBC_SERVA_MEDIA_ENCODER_SETTINGS m_sEncoderSettings;
|
|
uint64_t m_nInFileSize;
|
|
uint64_t m_nReadSize;
|
|
uint64_t m_nOutFileSize;
|
|
uint64_t m_nRefID;
|
|
servaKernel * m_pMaster;
|
|
basicMutex m_mFlagProtector;
|
|
#ifndef STEPHANE_OPENCV_ENCODE
|
|
bool m_bFrameIsEncoded;
|
|
//basicMutex m_mFrameProtector;
|
|
AVFrame * m_pFrame;
|
|
#endif //!STEPHANE_OPENCV_ENCODE
|
|
LIBAV_VS m_sEncoderVS;
|
|
LIBAV_VS m_sDecoderVS;
|
|
uint8_t m_bStatus;
|
|
protected:
|
|
virtual void m_fThreadProc( void );
|
|
//virtual void m_fThreadBProc( void );
|
|
public:
|
|
explicit servaMediaEncoder( uint64_t Ref = 0 );
|
|
~servaMediaEncoder();
|
|
bool create( CSTR src, CSTR dst, uint8_t fps = 15, int width = -1, int height = -1, CSTR custom = NULL );
|
|
uint8_t getStatus();
|
|
uint64_t getDBID(){ return m_nRefID;};
|
|
CSTR getDstFormat();
|
|
};
|
|
|
|
|
|
typedef std::vector<servaMediaEncoder*> V_MEDIA_ENCODERS;
|
|
|
|
#endif
|