[tracker/gstreamer-with-dlna-0.10: 9/12] build: treat GUPnP-DLNA as another GStreamer backend
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/gstreamer-with-dlna-0.10: 9/12] build: treat GUPnP-DLNA as another GStreamer backend
- Date: Wed, 31 Aug 2011 11:36:39 +0000 (UTC)
commit 389d6fc4f0b95ef9cd9627455c84d53838d5c0ee
Author: Aleksander Morgado <aleksander lanedo com>
Date: Wed Jul 13 11:53:08 2011 +0200
build: treat GUPnP-DLNA as another GStreamer backend
configure.ac | 101 +++++++++--------------
src/tracker-extract/tracker-extract-gstreamer.c | 85 ++++++++++----------
2 files changed, 82 insertions(+), 104 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 1a1853f..64e48bd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1539,17 +1539,9 @@ AM_CONDITIONAL(HAVE_GDKPIXBUF, test "x$have_gdkpixbuf" = "xyes")
AC_ARG_ENABLE(generic-media-extractor,
AS_HELP_STRING([--enable-generic-media-extractor=ARG],
- [enables one of the (gupnp-dlna, gstreamer, xine, external, auto) generic media extractor backends [[default=auto]]]),,
+ [enables one of the (gstreamer, xine, external, auto) generic media extractor backends [[default=auto]]]),,
[enable_generic_media_extractor=auto])
-PKG_CHECK_MODULES(GUPNP_DLNA,
- [gupnp-dlna-1.0 >= $GUPNP_DLNA_REQUIRED],
- [have_gupnp_dlna=yes],
- [have_gupnp_dlna=no])
-
-AC_SUBST(GUPNP_DLNA_CFLAGS)
-AC_SUBST(GUPNP_DLNA_LIBS)
-
PKG_CHECK_MODULES(GSTREAMER,
[gstreamer-0.10 >= $GSTREAMER_REQUIRED
gstreamer-tag-0.10 >= $GSTREAMER_REQUIRED],
@@ -1570,11 +1562,7 @@ AC_SUBST(XINE_LIBS)
if test "x$enable_generic_media_extractor" = "xauto"; then
if test "$have_libgstreamer" = "yes"; then
have_generic_media_handler="yes"
- if test "$have_gupnp_dlna" = "yes"; then
- have_generic_media_handler_app="GStreamer GUPnP-DLNA"
- else
- have_generic_media_handler_app="GStreamer"
- fi
+ have_generic_media_handler_app="GStreamer"
elif test "$have_libxine" = "yes"; then
have_generic_media_handler_app="Xine"
have_generic_media_handler="yes"
@@ -1582,17 +1570,6 @@ if test "x$enable_generic_media_extractor" = "xauto"; then
have_generic_media_handler="?"
have_generic_media_handler_app="An external generic_media player will be called"
fi
-elif test "x$enable_generic_media_extractor" = "xgupnp-dlna"; then
- if test "$have_gupnp_dlna" = "yes"; then
- if test "$have_libgstreamer" = "yes"; then
- have_generic_media_handler_app="GStreamer GUPnP-DLNA"
- have_generic_media_handler="yes"
- else
- AC_MSG_ERROR([Couldn't find GStreamer >= $GSTREAMER_REQUIRED])
- fi
- else
- AC_MSG_ERROR([Couldn't find GUPnP-DLNA >= $GUPNP_DLNA_REQUIRED])
- fi
elif test "x$enable_generic_media_extractor" = "xgstreamer"; then
if test "$have_libgstreamer" = "yes"; then
have_generic_media_handler_app="GStreamer"
@@ -1612,70 +1589,70 @@ else
have_generic_media_handler_app="An external generic media player will be called"
fi
-if test "$have_generic_media_handler_app" = "GStreamer GUPnP-DLNA"; then
- AC_DEFINE(HAVE_GUPNP_DLNA, [], [Define if we have GUPnP-DLNA])
- AC_DEFINE(HAVE_GSTREAMER, [], [Define if we have GStreamer])
- AM_CONDITIONAL(HAVE_GUPNP_DLNA, true)
- AM_CONDITIONAL(HAVE_GSTREAMER, true)
- AM_CONDITIONAL(HAVE_LIBXINE, false)
- AM_CONDITIONAL(USING_EXTERNAL_GENERIC_MEDIA_PLAYER, false)
-elif test "$have_generic_media_handler_app" = "GStreamer"; then
+if test "$have_generic_media_handler_app" = "GStreamer"; then
AC_DEFINE(HAVE_GSTREAMER, [], [Define if we have GStreamer])
AM_CONDITIONAL(HAVE_GSTREAMER, true)
- AM_CONDITIONAL(HAVE_GUPNP_DLNA, false)
AM_CONDITIONAL(HAVE_LIBXINE, false)
AM_CONDITIONAL(USING_EXTERNAL_GENERIC_MEDIA_PLAYER, false)
elif test "$have_generic_media_handler_app" = "Xine"; then
AC_DEFINE(HAVE_LIBXINE, [], [Define if we have Libxine])
AM_CONDITIONAL(HAVE_LIBXINE, true)
- AM_CONDITIONAL(HAVE_GUPNP_DLNA, false)
AM_CONDITIONAL(HAVE_GSTREAMER, false)
AM_CONDITIONAL(USING_EXTERNAL_GENERIC_MEDIA_PLAYER, false)
else
AC_DEFINE(USING_EXTERNAL_GENERIC_MEDIA_PLAYER, [], [Define that Tracker will try to use external generic media players])
AM_CONDITIONAL(USING_EXTERNAL_GENERIC_MEDIA_PLAYER, true)
- AM_CONDITIONAL(HAVE_GUPNP_DLNA, false)
AM_CONDITIONAL(HAVE_GSTREAMER, false)
AM_CONDITIONAL(HAVE_LIBXINE, false)
fi
-####################################################################
-# Check for tracker-extract: tagreadbin/decodebin2/discoverer
-# for gstreamer extractor
-####################################################################
+###########################################################################
+# Check for gstreamer backend: tagreadbin/decodebin2/discoverer/gupnp-dlna
+###########################################################################
AC_ARG_WITH([gstreamer-backend],
AS_HELP_STRING([--with-gstreamer-backend],
- [enables one of the (discoverer, decodebin2, tagreadbin) GStreamer backends [[default=discoverer]]]),,
+ [enables one of the (gupnp-dlna, discoverer, decodebin2, tagreadbin) GStreamer backends [[default=discoverer]]]),,
[with_gstreamer_backend=discoverer])
-gstreamer_backend="N/A"
-case "x$with_gstreamer_backend" in
- "xdecodebin2")
- if test "$have_generic_media_handler_app" = "GStreamer GUPnP-DLNA"; then
- AC_MSG_ERROR([Cannot use decodebin2 backend in GStreamer when requesting GUPnP-DLNA support])
- elif test "$have_generic_media_handler_app" = "GStreamer"; then
+if test "$have_generic_media_handler_app" != "GStreamer"; then
+ AC_MSG_WARN([No need to specify a GStreamer backend if not using GStreamer])
+ gstreamer_backend="N/A"
+else
+ case "x$with_gstreamer_backend" in
+ "xdecodebin2")
gstreamer_backend="Decodebin2"
AC_DEFINE(GSTREAMER_BACKEND_DECODEBIN2, [], [Define that GStreamer Decodebin2 should be used])
- fi
- ;;
- "xtagreadbin")
- if test "$have_generic_media_handler_app" = "GStreamer GUPnP-DLNA"; then
- AC_MSG_ERROR([Cannot use tagreadbin backend in GStreamer when requesting GUPnP-DLNA support])
- elif test "$have_generic_media_handler_app" = "GStreamer"; then
+ ;;
+ "xtagreadbin")
gstreamer_backend="Tagreadbin"
AC_DEFINE(GSTREAMER_BACKEND_TAGREADBIN, [], [Define that GStreamer Tagreadbin should be used])
- fi
- ;;
- "xdiscoverer")
- if test "$have_generic_media_handler_app" = "GStreamer GUPnP-DLNA" || test "$have_generic_media_handler_app" = "GStreamer"; then
+ ;;
+ "xdiscoverer")
gstreamer_backend="Discoverer"
AC_DEFINE(GSTREAMER_BACKEND_DISCOVERER, [], [Define that GStreamer Discoverer should be used])
- fi
- ;;
- # Invalid option value
- *) AC_MSG_ERROR([Wrong value for --with-gstreamer-backend: $with_gstreamer_backend]) ;;
-esac
+ ;;
+ "xgupnp-dlna")
+ PKG_CHECK_MODULES(GUPNP_DLNA,
+ [gupnp-dlna-1.0 >= $GUPNP_DLNA_REQUIRED],
+ [have_gupnp_dlna=yes],
+ [have_gupnp_dlna=no])
+ AC_SUBST(GUPNP_DLNA_CFLAGS)
+ AC_SUBST(GUPNP_DLNA_LIBS)
+
+ if test "x$have_gupnp_dlna" = "xyes"; then
+ gstreamer_backend="GUPnP-DLNA"
+ AC_DEFINE(GSTREAMER_BACKEND_GUPNP_DLNA, [], [Define that GUPnP-DLNA should be used])
+ else
+ AC_MSG_ERROR([Couldn't find GUPnP-DLNA >= $GUPNP_DLNA_REQUIRED])
+ fi
+ ;;
+ # Invalid option value
+ *) AC_MSG_ERROR([Wrong value for --with-gstreamer-backend: $with_gstreamer_backend]) ;;
+ esac
+fi
+
+AM_CONDITIONAL(HAVE_GUPNP_DLNA, test "x$gstreamer_backend" = "xGUPnP-DLNA")
####################################################################
# Check for tracker-extract: support .ps.gz files
diff --git a/src/tracker-extract/tracker-extract-gstreamer.c b/src/tracker-extract/tracker-extract-gstreamer.c
index a4377ea..a007a43 100644
--- a/src/tracker-extract/tracker-extract-gstreamer.c
+++ b/src/tracker-extract/tracker-extract-gstreamer.c
@@ -21,6 +21,14 @@
#include "config.h"
+/* Ensure we have a valid backend enabled */
+#if !defined(GSTREAMER_BACKEND_TAGREADBIN) && \
+ !defined(GSTREAMER_BACKEND_DECODEBIN2) && \
+ !defined(GSTREAMER_BACKEND_DISCOVERER) && \
+ !defined(GSTREAMER_BACKEND_GUPNP_DLNA)
+#error Not a valid GStreamer backend defined
+#endif
+
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
@@ -29,12 +37,13 @@
#include <glib.h>
#include <glib/gstdio.h>
-#if defined(GSTREAMER_BACKEND_DISCOVERER)
+#if defined(GSTREAMER_BACKEND_DISCOVERER) || \
+ defined(GSTREAMER_BACKEND_GUPNP_DLNA)
#define GST_USE_UNSTABLE_API
#include <gst/pbutils/pbutils.h>
#endif
-#ifdef HAVE_GUPNP_DLNA
+#if defined(GSTREAMER_BACKEND_GUPNP_DLNA)
#include <libgupnp-dlna/gupnp-dlna-discoverer.h>
#endif
@@ -46,13 +55,6 @@
#include "tracker-albumart.h"
-/* Ensure we have a valid backend enabled */
-#if !defined(GSTREAMER_BACKEND_TAGREADBIN) && \
- !defined(GSTREAMER_BACKEND_DECODEBIN2) && \
- !defined(GSTREAMER_BACKEND_DISCOVERER)
-#error Not a valid GStreamer backend defined
-#endif
-
/* We wait this long (seconds) for NULL state before freeing */
#define TRACKER_EXTRACT_GUARD_TIMEOUT 3
@@ -100,37 +102,44 @@ typedef enum {
typedef struct {
ExtractMime mime;
+ GstTagList *tagcache;
+ gboolean is_content_encrypted;
+ unsigned char *album_art_data;
+ guint album_art_size;
+ const gchar *album_art_mime;
#if defined(GSTREAMER_BACKEND_TAGREADBIN) || \
defined(GSTREAMER_BACKEND_DECODEBIN2)
- /* Common pipeline elements */
GstElement *pipeline;
GstBus *bus;
#endif
#if defined(GSTREAMER_BACKEND_DECODEBIN2)
- /* Decodebin elements and properties*/
GstElement *bin;
GList *fsinks;
#endif
-#if defined(GSTREAMER_BACKEND_DISCOVERER)
+#if defined(GSTREAMER_BACKEND_DISCOVERER) || \
+ defined(GSTREAMER_BACKEND_GUPNP_DLNA)
gboolean has_image;
gboolean has_audio;
gboolean has_video;
GList *streams;
+#endif
-#if !defined(HAVE_GUPNP_DLNA)
- GstDiscoverer *discoverer;
-#else
+#if defined(GSTREAMER_BACKEND_DISCOVERER)
+ GstDiscoverer *discoverer;
+#endif
+
+#if defined(GSTREAMER_BACKEND_GUPNP_DLNA)
GUPnPDLNADiscoverer *discoverer;
GUPnPDLNAInformation *dlna_info;
const gchar *dlna_profile;
#endif
-#endif
#if defined(GSTREAMER_BACKEND_DISCOVERER) || \
- defined(GSTREAMER_BACKEND_DECODEBIN2)
+ defined(GSTREAMER_BACKEND_DECODEBIN2) || \
+ defined(GSTREAMER_BACKEND_GUPNP_DLNA)
gint64 duration;
gint audio_channels;
gint audio_samplerate;
@@ -139,16 +148,6 @@ typedef struct {
gfloat aspect_ratio;
gfloat video_fps;
#endif
-
- /* Tags and data */
- GstTagList *tagcache;
-
- gboolean is_content_encrypted;
-
- unsigned char *album_art_data;
- guint album_art_size;
- const gchar *album_art_mime;
-
} MetadataExtractor;
static void extract_gstreamer_audio (const gchar *uri,
@@ -175,7 +174,8 @@ static void tagreadbin_extract_stream_metadata (MetadataExtractor *extractor,
static void decodebin2_extract_stream_metadata (MetadataExtractor *extractor,
const gchar *uri,
TrackerSparqlBuilder *metadata);
-#elif defined(GSTREAMER_BACKEND_DISCOVERER)
+#elif defined(GSTREAMER_BACKEND_DISCOVERER) || \
+ defined(GSTREAMER_BACKEND_GUPNP_DLNA)
static void discoverer_extract_stream_metadata (MetadataExtractor *extractor,
const gchar *uri,
TrackerSparqlBuilder *metadata);
@@ -482,7 +482,7 @@ extract_metadata (MetadataExtractor *extractor,
g_free (video_codec);
g_free (audio_codec);
-#else /* DISCOVERER... */
+#else /* DISCOVERER/GUPNP-DLNA... */
if (extractor->has_video) {
extractor->mime = EXTRACT_MIME_VIDEO;
} else if (extractor->has_audio) {
@@ -493,7 +493,7 @@ extract_metadata (MetadataExtractor *extractor,
/* default to video */
extractor->mime = EXTRACT_MIME_VIDEO;
}
-#endif /* defined(GSTREAMER_BACKEND_TAGREADBIN) || defined(GSTREAMER_BACKEND_DECODEBIN2) */
+#endif
}
/* General */
@@ -823,14 +823,14 @@ extract_metadata (MetadataExtractor *extractor,
tracker_sparql_builder_object_boolean (metadata, TRUE);
}
#else
-#warning TODO: handle encrypted content with the Discoverer API
-#endif /* defined(GSTREAMER_BACKEND_TAGREADBIN) || defined(GSTREAMER_BACKEND_DECODEBIN2) */
+#warning TODO: handle encrypted content with the Discoverer/GUPnP-DLNA backends
+#endif
#if defined(GSTREAMER_BACKEND_TAGREADBIN)
tagreadbin_extract_stream_metadata (extractor, uri, metadata);
#elif defined(GSTREAMER_BACKEND_DECODEBIN2)
decodebin2_extract_stream_metadata (extractor, uri, metadata);
-#else /* defined(GSTREAMER_BACKEND_DISCOVERER) */
+#else /* DISCOVERER/GUPnP-DLNA */
discoverer_extract_stream_metadata (extractor, uri, metadata);
#endif
@@ -839,9 +839,10 @@ extract_metadata (MetadataExtractor *extractor,
}
}
-/* ----------------------- Discoverer specific implementation --------------- */
+/* ----------------------- Discoverer/GUPnP-DLNA specific implementation --------------- */
-#if defined(GSTREAMER_BACKEND_DISCOVERER)
+#if defined(GSTREAMER_BACKEND_DISCOVERER) || \
+ defined(GSTREAMER_BACKEND_GUPNP_DLNA)
static void
discoverer_shutdown (MetadataExtractor *extractor)
@@ -850,7 +851,7 @@ discoverer_shutdown (MetadataExtractor *extractor)
gst_discoverer_stream_info_list_free (extractor->streams);
if (extractor->discoverer)
g_object_unref (extractor->discoverer);
-#ifdef HAVE_GUPNP_DLNA
+#if defined(GSTREAMER_BACKEND_GUPNP_DLNA)
if (extractor->dlna_info)
g_object_unref (extractor->dlna_info);
#endif
@@ -876,7 +877,7 @@ discoverer_init_and_run (MetadataExtractor *extractor,
extractor->has_video = FALSE;
extractor->has_audio = FALSE;
-#ifdef HAVE_GUPNP_DLNA
+#if defined(GSTREAMER_BACKEND_GUPNP_DLNA)
extractor->discoverer = gupnp_dlna_discoverer_new (5 * GST_SECOND, TRUE, FALSE);
/* Uri is const, the API should be const, but it isn't and it
@@ -901,7 +902,7 @@ discoverer_init_and_run (MetadataExtractor *extractor,
extractor->dlna_profile = gupnp_dlna_information_get_name (extractor->dlna_info);
info = (GstDiscovererInfo *) gupnp_dlna_information_get_info (extractor->dlna_info);
-#else
+#else /* DISCOVERER */
extractor->discoverer = gst_discoverer_new (5 * GST_SECOND, &error);
if (!extractor->discoverer) {
g_warning ("Couldn't create discoverer: %s",
@@ -1020,7 +1021,7 @@ discoverer_extract_stream_metadata (MetadataExtractor *extractor,
}
}
-#if defined(HAVE_GUPNP_DLNA)
+#if defined(GSTREAMER_BACKEND_GUPNP_DLNA)
if (extractor->dlna_profile) {
tracker_sparql_builder_predicate (metadata, "nmm:dlnaProfile");
tracker_sparql_builder_object_string (metadata, extractor->dlna_profile);
@@ -1028,7 +1029,7 @@ discoverer_extract_stream_metadata (MetadataExtractor *extractor,
#endif
}
-#endif /* defined(GSTREAMER_BACKEND_DISCOVERER) */
+#endif /* defined(GSTREAMER_BACKEND_DISCOVERER) || defined(GSTREAMER_BACKEND_GUPNP_DLNA) */
/* --------------- Common Tagreadbin and Decodebin2 implementation ---------- */
@@ -1656,7 +1657,7 @@ tracker_extract_gstreamer (const gchar *uri,
#elif defined(GSTREAMER_BACKEND_DECODEBIN2)
if (!decodebin2_init_and_run (extractor, uri))
return;
-#else /* defined(GSTREAMER_BACKEND_DISCOVERER) */
+#else /* DISCOVERER/GUPnP-DLNA */
if (!discoverer_init_and_run (extractor, uri))
return;
#endif
@@ -1686,7 +1687,7 @@ tracker_extract_gstreamer (const gchar *uri,
tagreadbin_shutdown (extractor);
#elif defined(GSTREAMER_BACKEND_DECODEBIN2)
decodebin2_shutdown (extractor);
-#else /* defined(GSTREAMER_BACKEND_DISCOVERER) */
+#else /* DISCOVERER/GUPnP-DLNA */
discoverer_shutdown (extractor);
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]