examples: overlaycomposition: Fix implicit declaration warning
authorSeungha Yang <seungha.yang@navercorp.com>
Sun, 8 Dec 2019 09:13:55 +0000 (18:13 +0900)
committerSeungha Yang <seungha.yang@navercorp.com>
Sun, 8 Dec 2019 09:57:26 +0000 (18:57 +0900)
overlaycomposition.c:276:5: warning: implicit declaration of function 'exit' [-Wimplicit-function-declaration]
overlaycomposition.c(263): warning C4090: 'initializing': different 'const' qualifiers

tests/examples/overlaycomposition/overlaycomposition.c

index bf96ebf..0586bab 100644 (file)
@@ -27,6 +27,7 @@
 #include <math.h>
 
 #include <gio/gio.h>
+#include <stdlib.h>
 
 #define VIDEO_WIDTH 720
 #define VIDEO_HEIGHT 480
@@ -256,7 +257,7 @@ main (int argc, char **argv)
   OverlayState overlay_state = { 0, };
   GOptionContext *option_ctx;
   GError *error = NULL;
-  const gchar *video_sink = "autovideosink";
+  gchar *video_sink = NULL;
   gboolean ret;
   GOptionEntry options[] = {
     {"videosink", 0, 0, G_OPTION_ARG_STRING, &video_sink,
@@ -281,7 +282,12 @@ main (int argc, char **argv)
   capsfilter = gst_element_factory_make ("capsfilter", NULL);
   overlay = gst_element_factory_make ("overlaycomposition", NULL);
   conv = gst_element_factory_make ("videoconvert", NULL);
+
+  if (!video_sink)
+    video_sink = g_strdup ("autovideosink");
+
   sink = gst_element_factory_make (video_sink, NULL);
+  g_free (video_sink);
 
   if (!pipeline || !src || !capsfilter || !overlay || !conv || !sink) {
     g_error ("Failed to create elements");