Merge branch 'zma_to_thread' of github.com:/ConnorTechnology/ZoneMinder into zma_to_thread

This commit is contained in:
Isaac Connor 2017-12-03 11:09:17 -05:00
commit 6fc684a018
6 changed files with 27 additions and 47 deletions

View File

@ -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;
@ -49,15 +50,17 @@ Camera::Camera( unsigned int p_monitor_id, SourceType p_type, unsigned int p_wid
} else if(colours == ZM_COLOUR_RGB24 && ((imagesize % 64) != 0 || (imagesize % 12) != 0)) {
Fatal("Image size is not multiples of 12 and 64");
}
monitor = NULL;
monitor = NULL;
}
Camera::~Camera() {
}
Monitor *Camera::getMonitor() {
if ( ! monitor )
if ( ! monitor ) {
Warning("Loading monitor");
monitor = Monitor::Load( monitor_id, false, Monitor::QUERY );
}
return monitor;
}

View File

@ -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 ) );

View File

@ -23,35 +23,26 @@
#include <mysql/mysql.h>
class zmDbRow {
private:
MYSQL_RES *result_set;
MYSQL_ROW row;
public:
zmDbRow() { result_set = NULL; row = NULL; };
MYSQL_RES *fetch( const char *query );
zmDbRow( MYSQL_RES *, MYSQL_ROW *row );
~zmDbRow();
private:
MYSQL_RES *result_set;
MYSQL_ROW row;
public:
zmDbRow() { result_set = NULL; row = NULL; };
MYSQL_RES *fetch( const char *query );
zmDbRow( MYSQL_RES *, MYSQL_ROW *row );
~zmDbRow();
char *operator[](unsigned int index) const {
return row[index];
}
char *operator[](unsigned int index) const {
return row[index];
}
};
#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

View File

@ -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;
}
}

View File

@ -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;

View File

@ -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);