diff --git a/FrameGrabber.cpp b/FrameGrabber.cpp index 69fcae7..15f836c 100644 --- a/FrameGrabber.cpp +++ b/FrameGrabber.cpp @@ -16,7 +16,7 @@ -FrameGrabbing::FrameGrabbing(): pbo_index_(0), pbo_next_index_(0), size_(0), width_(0), height_(0), use_alpha_(0), caps_(nullptr) +FrameGrabbing::FrameGrabbing(): pbo_index_(0), pbo_next_index_(0), size_(0), width_(0), height_(0), use_alpha_(0), caps_(NULL) { pbo_[0] = 0; pbo_[1] = 0; @@ -28,7 +28,7 @@ FrameGrabbing::~FrameGrabbing() clearAll(); // cleanup - if (caps_!=nullptr) + if (caps_) gst_caps_unref (caps_); if (pbo_[0]) glDeleteBuffers(2, pbo_); @@ -73,7 +73,7 @@ FrameGrabber *FrameGrabbing::get(uint64_t id) void FrameGrabbing::stopAll() { std::list::iterator iter; - for (iter=grabbers_.begin(); iter != grabbers_.end(); iter++ ) + for (iter=grabbers_.begin(); iter != grabbers_.end(); ++iter ) (*iter)->stop(); } @@ -121,7 +121,7 @@ void FrameGrabbing::grabFrame(FrameBuffer *frame_buffer, float dt) pbo_next_index_ = 0; // new caps - if (caps_!=nullptr) + if (caps_) gst_caps_unref (caps_); caps_ = gst_caps_new_simple ("video/x-raw", "format", G_TYPE_STRING, use_alpha_ ? "RGBA" : "RGB", @@ -193,7 +193,7 @@ void FrameGrabbing::grabFrame(FrameBuffer *frame_buffer, float dt) delete rec; } else - iter++; + ++iter; } // unref / free the frame diff --git a/GstToolkit.cpp b/GstToolkit.cpp index d6cf528..611ae5e 100644 --- a/GstToolkit.cpp +++ b/GstToolkit.cpp @@ -142,13 +142,8 @@ string GstToolkit::gst_version() }; const int N = 10; #elif GST_GL_HAVE_PLATFORM_CGL -<<<<<<< HEAD - const char *plugins[1] = { "vtdec_hw" }; - const int N = 1; -======= const char *plugins[2] = { "vtdec_hw", "vtdechw" }; const int N = 2; ->>>>>>> 7344258b2f761d53d617e272473381625652d30a #else const char *plugins[0] = { }; const int N = 0; @@ -184,7 +179,7 @@ std::string GstToolkit::used_gpu_decoding_plugins(GstElement *gstbin) { std::string found = ""; - auto it = gst_bin_iterate_recurse(GST_BIN(gstbin)); + GstIterator* it = gst_bin_iterate_recurse(GST_BIN(gstbin)); GValue value = G_VALUE_INIT; for(GstIteratorResult r = gst_iterator_next(it, &value); r != GST_ITERATOR_DONE; r = gst_iterator_next(it, &value)) { @@ -192,7 +187,9 @@ std::string GstToolkit::used_gpu_decoding_plugins(GstElement *gstbin) { GstElement *e = static_cast(g_value_peek_pointer(&value)); if (e) { - std::string e_name = gst_element_get_name(e); + gchar *name = gst_element_get_name(e); + std::string e_name(name); + g_free(name); // g_print(" - %s", e_name.c_str()); for (int i = 0; i < N; i++) { if (e_name.find(plugins[i]) != std::string::npos) { @@ -203,6 +200,7 @@ std::string GstToolkit::used_gpu_decoding_plugins(GstElement *gstbin) } } } + gst_iterator_free(it); return found; } diff --git a/Timeline.cpp b/Timeline.cpp index 88900c7..77ed801 100644 --- a/Timeline.cpp +++ b/Timeline.cpp @@ -26,6 +26,7 @@ Timeline::Timeline() Timeline::~Timeline() { + reset(); } Timeline& Timeline::operator = (const Timeline& b) @@ -176,8 +177,7 @@ TimeIntervalSet Timeline::sections() const ++it; } - for (; it != gaps_.end(); ++it) - { + for (; it != gaps_.end(); ++it) { sec.insert( TimeInterval(begin_sec, (*it).begin) ); begin_sec = (*it).end; } diff --git a/tinyxml2Toolkit.cpp b/tinyxml2Toolkit.cpp index 0bab3ea..9c92026 100644 --- a/tinyxml2Toolkit.cpp +++ b/tinyxml2Toolkit.cpp @@ -129,7 +129,7 @@ XMLElement *tinyxml2::XMLElementEncodeArray(XMLDocument *doc, const void *array, gchar *compressed_array = g_new(gchar, compressed_size); // encoded string will hold the base64 encoding of the array - const gchar *encoded_array = nullptr; + gchar *encoded_array = nullptr; // zlib compress ((Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)); if ( Z_OK == compress((Bytef *)compressed_array, &compressed_size, @@ -153,6 +153,7 @@ XMLElement *tinyxml2::XMLElementEncodeArray(XMLDocument *doc, const void *array, // free temporary array g_free(compressed_array); + g_free(encoded_array); return newelement; }