Browse Source

itermediate checkpoint

pull/7/head
Evgeny Gagua 8 months ago
parent
commit
a96523e071
  1. 16
      lib/App/common/serverDataBinder.h
  2. 66
      lib/App/serva/servaVideoComposer.cpp
  3. 11
      lib/App/serva/servaVideoComposer.h

16
lib/App/common/serverDataBinder.h

@ -167,6 +167,22 @@ typedef struct S_DBC_IS_MODULE_DATA
char ip4[16];
} DBC_IS_MODULE_DATA; // Infrostructure Module Data
typedef struct S_DBC_SESSION_DATA{
uint64_t id;
uint64_t track_id;
uint32_t sts;
uint32_t lts;
uint32_t evt_cnt;
uint32_t vid_cnt;
char final;
}DBC_SESSION_DATA;
typedef struct S_DBC_MEDIA_COMPOSER_DATA{
uint16_t out_width;
uint16_t out_height;
uint8_t out_fps;
}DBC_MEDIA_COMPOSER_DATA;
class serverDataBinder
{
public:

66
lib/App/serva/servaVideoComposer.cpp

@ -1,9 +1,71 @@
#include "servaVideoComposer.h"
servaVideoComposer::servaVideoComposer( uint64_t session_id ){
#define LOG( X ) m_pLog->Log( "MVC", this, X )
#ifdef DEBUG
#define LOG_ERROR( X ) {\
char _tBfrErrMSG234[256];\
sprintf( _tBfrErrMSG234, "In file %s[%d] in func:%s %s",__FILE__, __LINE__, __func__, X );\
m_pLog->Log( "MVC", this, _LOG_ERROR, _tBfrErrMSG234 );\
}
#else
#define LOG_ERROR( X ) m_pLog->Log( "MVC", this, _LOG_ERROR, X );
#endif
servaVideoComposer::servaVideoComposer( uint64_t session_id ){
m_pLog = basicLogCollection::getInstance();
//Load Module Data
if ( tData ) {
memcpy(m_sComposerSettings, tData, sizeof(DBC_MEDIA_COMPOSER_DATA));
free( tData );
} else {
LOG_ERROR("Settings Load Failure!");
memset(m_sComposerSettings, 0, sizeof(DBC_MEDIA_COMPOSER_DATA));
};
//Load Session Data
// create supplimentary data
m_oNoVideoMat =
};
virtual void servaVideoComposer::m_fThreadProc(void){
uint8_t operc = 0;
#ifdef DEBUG_EXTRA
char tB[1024];
sprintf( tB, "Converting %s to %s", m_sDecoderVS.m_pFileName, m_sEncoderVS.m_pFileName );
LOG( tB );
#endif
cv::VideoCapture cap( m_sDecoderVS.m_pFileName );
if( cap.isOpened() ) {
cv::Mat mat;
cap >> mat;
if( !mat.empty() ){
cap.set( cv::VideoCaptureProperties::CAP_PROP_POS_FRAMES, 0.0 );
cv::VideoWriter out( m_sEncoderVS.m_pFileName, cv::VideoWriter::fourcc('a', 'v', 'c', '1'), 15.0, mat.size() );
size_t number_of_frames = 0;
m_bStatus = THREAD_INIT;
m_bThreadStatus = TH_WORKING;
while( cap.isOpened() && out.isOpened() && m_bThreadStatus < TH_ENDED ){
cap >> mat;
m_bStatus = ENCODER_ENCODING;
if( mat.empty() ){
m_bThreadStatus = TH_ENDED;
} else {
number_of_frames ++;
out.write(mat);
};
uint8_t perc = ( 100 * number_of_frames ) / 900;
if ( operc!= perc ) {
if ( perc > 100 ) perc = 100;
operc = perc;
m_pMaster->updateEncodeStatus(m_nRefID, MEDIA_ENCODE_PROGRESS, perc);
};
};
cap.release();
// Does it look reasonable?  If so, then we can go ahead and delete the original file.
if( number_of_frames > 100 ){
unlink( m_sDecoderVS.m_pFileName );
};
};
};
};

11
lib/App/serva/servaVideoComposer.h

@ -5,12 +5,17 @@
class servaVideoComposer: public basicThread {
private:
uint8_t m_bStatus;
basicLogCollection * m_pLog;
DBC_MEDIA_COMPOSER_DATA m_sComposerSettings;
uint8_t m_bStatus;
cv::Mat m_oNoVideoMat;
m_vLVideoQueue;
m_vRVideoQueue;
protected:
virtual void m_fThreadProc(void);
public:
explicit servaMediaEncoder( uint64_t session_id );
~servaMediaEncoder();
explicit servaVideoComposer( uint64_t session_id );
~servaVideoComposer();
uint8_t getStatus();
}
Loading…
Cancel
Save