Commit 0eefcb23 authored by Tim-Philipp Müller's avatar Tim-Philipp Müller 🐠
Browse files

gl: examples: fix c++ code for -Wreturn-aggregate

.. and use #ifdef instead of #if
parent 26b3955a
...@@ -73,10 +73,9 @@ static void identityCallback (GstElement *src, GstBuffer *buffer, GstElement* t ...@@ -73,10 +73,9 @@ static void identityCallback (GstElement *src, GstBuffer *buffer, GstElement* t
nbFrames++ ; nbFrames++ ;
if (GST_BUFFER_TIMESTAMP(buffer) - last_timestamp >= 1000000000) if (GST_BUFFER_TIMESTAMP(buffer) - last_timestamp >= 1000000000)
{ {
std::ostringstream oss ; gchar *s = g_strdup_printf ("video framerate = %d", nbFrames);
oss << "video framerate = " << nbFrames ; g_object_set(G_OBJECT(textoverlay), "text", s, NULL);
std::string s(oss.str()) ; g_free (s);
g_object_set(G_OBJECT(textoverlay), "text", s.c_str(), NULL);
last_timestamp = GST_BUFFER_TIMESTAMP(buffer) ; last_timestamp = GST_BUFFER_TIMESTAMP(buffer) ;
nbFrames = 0 ; nbFrames = 0 ;
} }
......
...@@ -73,10 +73,9 @@ static GstPadProbeReturn textoverlay_sink_pad_probe_cb (GstPad *pad, GstPadProbe ...@@ -73,10 +73,9 @@ static GstPadProbeReturn textoverlay_sink_pad_probe_cb (GstPad *pad, GstPadProbe
nbFrames++ ; nbFrames++ ;
if (GST_BUFFER_TIMESTAMP(info->data) - last_timestamp >= 1000000000) if (GST_BUFFER_TIMESTAMP(info->data) - last_timestamp >= 1000000000)
{ {
std::ostringstream oss; gchar *s = g_strdup_printf ("video framerate = %d", nbFrames);
oss << "video framerate = " << nbFrames ; g_object_set(G_OBJECT(textoverlay), "text", s, NULL);
std::string s(oss.str()); g_free (s);
g_object_set(G_OBJECT(textoverlay), "text", s.c_str(), NULL);
last_timestamp = GST_BUFFER_TIMESTAMP(info->data) ; last_timestamp = GST_BUFFER_TIMESTAMP(info->data) ;
nbFrames = 0; nbFrames = 0;
} }
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
*/ */
#include <GL/gl.h> #include <GL/gl.h>
#if __WIN32__ || _WIN32 #if defined(__WIN32__) || defined(_WIN32)
# include <GL/glext.h> # include <GL/glext.h>
#endif #endif
#include <gst/gst.h> #include <gst/gst.h>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment