[frogr] Check for the value of HAVE_GSTREAMER, not just its definition
- From: Mario Sanchez Prada <msanchez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [frogr] Check for the value of HAVE_GSTREAMER, not just its definition
- Date: Tue, 23 May 2017 21:06:34 +0000 (UTC)
commit 6c7fa88314af46b3c50bf48bdd70e790422ab659
Author: Mario Sanchez Prada <msanchez gnome org>
Date: Tue May 23 12:58:37 2017 +0100
Check for the value of HAVE_GSTREAMER, not just its definition
This will be useful when migrating to meson, where we will always
define this, with different values depending on the situation.
src/frogr-main-view.c | 8 ++++----
src/frogr-util.c | 20 ++++++++++----------
src/main.c | 4 ++--
3 files changed, 16 insertions(+), 16 deletions(-)
---
diff --git a/src/frogr-main-view.c b/src/frogr-main-view.c
index 7ed9be1..3db6d94 100644
--- a/src/frogr-main-view.c
+++ b/src/frogr-main-view.c
@@ -1618,7 +1618,7 @@ _load_pictures_dialog (FrogrMainView *self)
GtkWidget *dialog;
GtkFileFilter *all_filter;
GtkFileFilter *image_filter;
-#ifdef HAVE_GSTREAMER
+#if HAVE_GSTREAMER
GtkFileFilter *video_filter;
#endif
gint i;
@@ -1635,7 +1635,7 @@ _load_pictures_dialog (FrogrMainView *self)
/* Set images filter */
all_filter = gtk_file_filter_new ();
image_filter = gtk_file_filter_new ();
-#ifdef HAVE_GSTREAMER
+#if HAVE_GSTREAMER
video_filter = gtk_file_filter_new ();
#endif
@@ -1644,7 +1644,7 @@ _load_pictures_dialog (FrogrMainView *self)
{
if (g_str_has_prefix (supported_mimetypes[i], "image"))
gtk_file_filter_add_mime_type (image_filter, supported_mimetypes[i]);
-#ifdef HAVE_GSTREAMER
+#if HAVE_GSTREAMER
else
gtk_file_filter_add_mime_type (video_filter, supported_mimetypes[i]);
#endif
@@ -1658,7 +1658,7 @@ _load_pictures_dialog (FrogrMainView *self)
gtk_file_filter_set_name (image_filter, _("Image Files"));
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), image_filter);
-#ifdef HAVE_GSTREAMER
+#if HAVE_GSTREAMER
gtk_file_filter_set_name (video_filter, _("Video Files"));
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), video_filter);
#endif
diff --git a/src/frogr-util.c b/src/frogr-util.c
index d011f4d..6a3dabc 100644
--- a/src/frogr-util.c
+++ b/src/frogr-util.c
@@ -27,9 +27,9 @@
#include <config.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
-#ifdef HAVE_GSTREAMER
+#if HAVE_GSTREAMER
#include <gst/gst.h>
-#ifdef HAVE_GSTREAMER_1_0
+#if HAVE_GSTREAMER_1_0
#include <gst/base/gstbasesink.h>
#endif
#endif
@@ -40,8 +40,8 @@
#include <libexif/exif-loader.h>
#include <libexif/exif-tag.h>
-#ifdef HAVE_GSTREAMER
-#ifdef HAVE_GSTREAMER_1_0
+#if HAVE_GSTREAMER
+#if HAVE_GSTREAMER_1_0
#define CAPS "video/x-raw,format=RGB,width=160,pixel-aspect-ratio=1/1"
#define PREROLL_TIMEOUT (5*GST_SECOND)
#else
@@ -336,11 +336,11 @@ _get_pixbuf_from_image_contents (const guchar *contents, gsize length, GError **
static GdkPixbuf *
_get_pixbuf_from_video_file (GFile *file, GError **out_error)
{
-#ifdef HAVE_GSTREAMER
+#if HAVE_GSTREAMER
GdkPixbuf *pixbuf = NULL;
GstElement *pipeline, *sink;
GstStateChangeReturn ret;
-#ifdef HAVE_GSTREAMER_1_0
+#if HAVE_GSTREAMER_1_0
GstStateChangeReturn sret;
#else
GstBuffer *buffer;
@@ -355,7 +355,7 @@ _get_pixbuf_from_video_file (GFile *file, GError **out_error)
/* create a new pipeline */
file_uri = g_file_get_uri (file);
-#ifdef HAVE_GSTREAMER_1_0
+#if HAVE_GSTREAMER_1_0
descr = g_strdup_printf ("uridecodebin uri=%s ! videoconvert ! videoscale "
" ! " CAPS " ! gdkpixbufsink name=sink", file_uri);
#else
@@ -402,7 +402,7 @@ _get_pixbuf_from_video_file (GFile *file, GError **out_error)
}
/* get the duration */
-#ifdef HAVE_GSTREAMER_1_0
+#if HAVE_GSTREAMER_1_0
gst_element_query_duration (pipeline, GST_FORMAT_TIME, &duration);
#else
format = GST_FORMAT_TIME;
@@ -422,7 +422,7 @@ _get_pixbuf_from_video_file (GFile *file, GError **out_error)
gst_element_seek_simple (pipeline, GST_FORMAT_TIME,
GST_SEEK_FLAG_KEY_UNIT | GST_SEEK_FLAG_FLUSH, position);
-#ifdef HAVE_GSTREAMER_1_0
+#if HAVE_GSTREAMER_1_0
sret = gst_element_get_state (pipeline, NULL, NULL, PREROLL_TIMEOUT);
if (sret == GST_STATE_CHANGE_SUCCESS)
g_object_get (sink, "last-pixbuf", &pixbuf, NULL);
@@ -564,7 +564,7 @@ frogr_util_get_supported_mimetypes (void)
"image/png",
"image/bmp",
"image/gif",
-#ifdef HAVE_GSTREAMER
+#if HAVE_GSTREAMER
"video/mpeg",
"video/mp4",
"video/quicktime",
diff --git a/src/main.c b/src/main.c
index b600c57..461f548 100644
--- a/src/main.c
+++ b/src/main.c
@@ -25,7 +25,7 @@
#include <config.h>
#include <glib/gi18n.h>
-#ifdef HAVE_GSTREAMER
+#if HAVE_GSTREAMER
#include <gst/gst.h>
#endif
#include <libxml/parser.h>
@@ -42,7 +42,7 @@ main (int argc, char **argv)
{
FrogrController *controller = NULL;
int status;
-#ifdef HAVE_GSTREAMER
+#if HAVE_GSTREAMER
GError *error = NULL;
/* Initialize gstreamer before using any other GLib function */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]