clean up Stream and EventStream Object initializers

pull/2922/head
Isaac Connor 2020-04-21 08:28:44 -04:00
parent 8d7b79bd03
commit 76d88621ac
2 changed files with 38 additions and 39 deletions

View File

@ -80,7 +80,7 @@ class EventStream : public StreamBase {
struct timeval start; // clock time when started the event
EventData *event_data;
FFmpeg_Input *ffmpeg_input;
protected:
bool loadEventData( uint64_t event_id );
@ -92,24 +92,19 @@ class EventStream : public StreamBase {
bool sendFrame( int delta_us );
public:
EventStream() {
mode = DEFAULT_MODE;
replay_rate = DEFAULT_RATE;
forceEventChange = false;
curr_frame_id = 0;
curr_stream_time = 0.0;
send_frame = false;
event_data = 0;
EventStream() :
mode(DEFAULT_MODE),
forceEventChange(false),
curr_frame_id(0),
curr_stream_time(0.0),
send_frame(false),
event_data(0),
ffmpeg_input(NULL),
// Used when loading frames from an mp4
input_codec_context = 0;
input_codec = 0;
ffmpeg_input = NULL;
}
input_codec_context(0),
input_codec(0)
{}
void setStreamStart( uint64_t init_event_id, unsigned int init_frame_id );
void setStreamStart( int monitor_id, time_t event_time );
void setStreamMode( StreamMode p_mode ) {
@ -118,6 +113,7 @@ class EventStream : public StreamBase {
void runStream();
Image *getImage();
private:
FFmpeg_Input *ffmpeg_input;
AVCodecContext *input_codec_context;
AVCodec *input_codec;
};

View File

@ -74,8 +74,8 @@ protected:
int bitrate;
unsigned short last_x, last_y;
unsigned short x, y;
protected:
bool send_analysis;
bool send_objdetect;
int connkey;
int sd;
char loc_sock_path[PATH_MAX];
@ -84,8 +84,6 @@ protected:
struct sockaddr_un rem_addr;
char sock_path_lock[PATH_MAX];
int lock_fd;
protected:
bool paused;
int step;
@ -115,25 +113,30 @@ protected:
virtual void processCommand( const CmdMsg *msg )=0;
public:
StreamBase() {
monitor = 0;
StreamBase():
monitor(0),
type(DEFAULT_TYPE),
format(""),
replay_rate(DEFAULT_RATE),
scale(DEFAULT_SCALE),
last_scale(DEFAULT_SCALE),
zoom(DEFAULT_ZOOM),
last_zoom(DEFAULT_ZOOM),
maxfps(DEFAULT_MAXFPS),
bitrate(DEFAULT_BITRATE),
last_x(0),
last_y(0),
x(0),
y(0),
send_analysis(false),
send_objdetect(false),
connkey(0),
sd(-1),
lock_fd(0),
paused(false),
step(0)
type = DEFAULT_TYPE;
format = "";
replay_rate = DEFAULT_RATE;
last_scale = scale = DEFAULT_SCALE;
last_zoom = zoom = DEFAULT_ZOOM;
maxfps = DEFAULT_MAXFPS;
bitrate = DEFAULT_BITRATE;
paused = false;
step = 0;
last_x = x = 0;
last_y = y = 0;
connkey = 0;
sd = -1;
lock_fd = 0;
{
memset( &loc_sock_path, 0, sizeof(loc_sock_path) );
memset( &loc_addr, 0, sizeof(loc_addr) );
memset( &rem_sock_path, 0, sizeof(rem_sock_path) );