Merge branch 'zma_to_thread' of github.com:/ConnorTechnology/ZoneMinder into zma_to_thread
This commit is contained in:
commit
6fc684a018
|
@ -36,6 +36,7 @@ Camera::Camera( unsigned int p_monitor_id, SourceType p_type, unsigned int p_wid
|
|||
mVideoStreamId(-1),
|
||||
mAudioStreamId(-1),
|
||||
mVideoCodecContext(NULL),
|
||||
mAudioCodecContext(NULL),
|
||||
video_stream(NULL)
|
||||
{
|
||||
pixels = width * height;
|
||||
|
@ -56,8 +57,10 @@ Camera::~Camera() {
|
|||
}
|
||||
|
||||
Monitor *Camera::getMonitor() {
|
||||
if ( ! monitor )
|
||||
if ( ! monitor ) {
|
||||
Warning("Loading monitor");
|
||||
monitor = Monitor::Load( monitor_id, false, Monitor::QUERY );
|
||||
}
|
||||
return monitor;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,11 +25,12 @@
|
|||
|
||||
MYSQL dbconn;
|
||||
|
||||
int zmDbConnected = false;
|
||||
bool zmDbConnected = false;
|
||||
|
||||
void zmDbConnect() {
|
||||
if ( zmDbConnected )
|
||||
return;
|
||||
// If these lines are uncommented, we get memory corruption and crashes
|
||||
//if ( zmDbConnected )
|
||||
//return;
|
||||
|
||||
if ( !mysql_init( &dbconn ) ) {
|
||||
Error( "Can't initialise database connection: %s", mysql_error( &dbconn ) );
|
||||
|
|
|
@ -37,21 +37,12 @@ class zmDbRow {
|
|||
}
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
extern MYSQL dbconn;
|
||||
|
||||
extern int zmDbConnected;
|
||||
|
||||
void zmDbConnect();
|
||||
void zmDbClose();
|
||||
|
||||
MYSQL_RES * zmDbFetch( const char *query );
|
||||
zmDbRow *zmDbFetchOne( const char *query );
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif // ZM_DB_H
|
||||
|
|
|
@ -26,9 +26,13 @@
|
|||
void FFMPEGInit() {
|
||||
static bool bInit = false;
|
||||
|
||||
if(!bInit) {
|
||||
if ( !bInit ) {
|
||||
if ( logDebugging() )
|
||||
av_log_set_level( AV_LOG_DEBUG );
|
||||
else
|
||||
av_log_set_level( AV_LOG_QUIET );
|
||||
av_register_all();
|
||||
av_log_set_level(AV_LOG_DEBUG);
|
||||
avformat_network_init();
|
||||
bInit = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ FfmpegCamera::FfmpegCamera( int p_id, const std::string &p_path, const std::stri
|
|||
mOptions( p_options )
|
||||
{
|
||||
if ( capture ) {
|
||||
Initialise();
|
||||
FFMPEGInit();
|
||||
}
|
||||
|
||||
hwaccel = false;
|
||||
|
@ -118,25 +118,9 @@ FfmpegCamera::~FfmpegCamera() {
|
|||
|
||||
CloseFfmpeg();
|
||||
|
||||
if ( capture ) {
|
||||
Terminate();
|
||||
}
|
||||
avformat_network_deinit();
|
||||
}
|
||||
|
||||
void FfmpegCamera::Initialise() {
|
||||
if ( logDebugging() )
|
||||
av_log_set_level( AV_LOG_DEBUG );
|
||||
else
|
||||
av_log_set_level( AV_LOG_QUIET );
|
||||
|
||||
av_register_all();
|
||||
avformat_network_init();
|
||||
}
|
||||
|
||||
void FfmpegCamera::Terminate() {
|
||||
}
|
||||
|
||||
int FfmpegCamera::PrimeCapture() {
|
||||
mVideoStreamId = -1;
|
||||
mAudioStreamId = -1;
|
||||
|
|
|
@ -100,9 +100,6 @@ class FfmpegCamera : public Camera {
|
|||
const std::string &Options() const { return( mOptions ); }
|
||||
const std::string &Method() const { return( mMethod ); }
|
||||
|
||||
void Initialise();
|
||||
void Terminate();
|
||||
|
||||
int PrimeCapture();
|
||||
int PreCapture();
|
||||
int Capture(ZMPacket &p);
|
||||
|
|
Loading…
Reference in New Issue