From 0d450f4f85638d2a9ade0bce4546b46d0957fcba Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 7 Jan 2021 09:41:02 -0500 Subject: [PATCH] add missing and mix order of Packet initializers --- src/zm_packet.cpp | 46 ++++++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/src/zm_packet.cpp b/src/zm_packet.cpp index e6984126d..a9f3b39b8 100644 --- a/src/zm_packet.cpp +++ b/src/zm_packet.cpp @@ -24,38 +24,44 @@ using namespace std; -ZMPacket::ZMPacket() { - keyframe = 0; +ZMPacket::ZMPacket() : + keyframe(0), // frame from decoded packet, to be used in generating image - in_frame = nullptr; - out_frame = nullptr; - image = nullptr; - buffer = nullptr; + in_frame(nullptr), + out_frame(nullptr), + timestamp(nullptr), + buffer(nullptr), + image(nullptr), + analysis_image(nullptr), + score(-1), + codec_type(AVMEDIA_TYPE_UNKNOWN), + image_index(-1), + codec_imgsize(0) +{ av_init_packet(&packet); packet.size = 0; // So we can detect whether it has been filled. - timestamp = nullptr; - analysis_image = nullptr; - image_index = -1; - score = -1; - codec_imgsize = 0; } -ZMPacket::ZMPacket(ZMPacket &p) { - keyframe = 0; +ZMPacket::ZMPacket(ZMPacket &p) : + keyframe(0), // frame from decoded packet, to be used in generating image - in_frame = nullptr; - out_frame = nullptr; - image = nullptr; - buffer = nullptr; + in_frame(nullptr), + out_frame(nullptr), + timestamp(nullptr), + buffer(nullptr), + image(nullptr), + analysis_image(nullptr), + score(-1), + codec_type(AVMEDIA_TYPE_UNKNOWN), + image_index(-1), + codec_imgsize(0) +{ av_init_packet(&packet); if ( zm_av_packet_ref(&packet, &p.packet) < 0 ) { Error("error refing packet"); } timestamp = new struct timeval; *timestamp = *p.timestamp; - analysis_image = nullptr; - image_index = -1; - score = -1; } ZMPacket::~ZMPacket() {