[gupnp-dlna/wip/new-api: 42/46] Add a GStreamer specific utility library.



commit 3dc6b890552e8309e3bce79811905eb2cd1daa9c
Author: Krzesimir Nowak <krnowak openismus com>
Date:   Fri Jan 4 15:38:43 2013 +0100

    Add a GStreamer specific utility library.

 .gitignore                                         |    2 +
 Makefile.am                                        |    4 ++
 configure.ac                                       |    1 +
 gupnp-dlna-2.0.pc.in                               |    2 +-
 gupnp-dlna-gst-2.0.pc.in                           |    9 +++
 libgupnp-dlna/Makefile.am                          |   56 ++++++++++++++------
 .../metadata-backends/gstreamer/gstreamer.am       |   28 ++++++++--
 .../gstreamer/gupnp-dlna-gst-metadata-extractor.c  |    7 +--
 .../gstreamer/gupnp-dlna-gst-utils.c               |   47 ++++++++++++++++
 .../gstreamer/gupnp-dlna-gst-utils.h               |   35 ++++++++++++
 vala/GUPnPDLNAGst-2.0.metadata                     |    1 +
 vala/Makefile.am                                   |   42 ++++++++++++++-
 vala/gupnp-dlna-gst-2.0-custom.vala                |    2 +
 vala/gupnp-dlna-gst-2.0.deps                       |    3 +
 14 files changed, 209 insertions(+), 30 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index eccbd02..f197af0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -49,6 +49,7 @@ m4/ltsugar.m4
 m4/ltversion.m4
 m4/lt~obsolete.m4
 vala/gupnp-dlna-2.0.vapi
+vala/gupnp-dlna-gst-2.0.vapi
 *.gir
 *.typelib
 tests/dlna-encoding
@@ -69,6 +70,7 @@ depcomp
 gtk-doc.make
 gupnp-dlna-2.0.pc
 gupnp-dlna-metadata-2.0.pc
+gupnp-dlna-gst-2.0.pc
 gupnp-dlna-2.0-uninstalled.pc
 gupnp-dlna-*.tar.xz
 install-sh
diff --git a/Makefile.am b/Makefile.am
index cf8a22b..800f031 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -5,6 +5,10 @@ SUBDIRS = libgupnp-dlna tools tests data doc vala
 pkgconfig_DATA = gupnp-dlna-2.0.pc gupnp-dlna-metadata-2.0.pc
 pkgconfigdir = $(libdir)/pkgconfig
 
+if GSTREAMER_METADATA_BACKEND_ENABLED
+pkgconfig_DATA += gupnp-dlna-gst-2.0.pc
+endif
+
 DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc --enable-introspection
 
 # Extra clean files so that maintainer-clean removes *everything*
diff --git a/configure.ac b/configure.ac
index ba5e51e..ef6a3d3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -200,6 +200,7 @@ tests/Makefile
 data/Makefile
 gupnp-dlna-2.0.pc
 gupnp-dlna-metadata-2.0.pc
+gupnp-dlna-gst-2.0.pc
 doc/Makefile
 doc/version.xml
 doc/gupnp-dlna/Makefile
diff --git a/gupnp-dlna-2.0.pc.in b/gupnp-dlna-2.0.pc.in
index 3744d16..f6d3002 100644
--- a/gupnp-dlna-2.0.pc.in
+++ b/gupnp-dlna-2.0.pc.in
@@ -9,4 +9,4 @@ Version: @VERSION@
 Libs: -L${libdir} -lgupnp-dlna-2.0
 Cflags: -I${includedir}/gupnp-dlna-2.0
 Requires: glib-2.0 gobject-2.0
-Requires.private: gmodule-2.0
\ No newline at end of file
+Requires.private: gmodule-2.0
diff --git a/gupnp-dlna-gst-2.0.pc.in b/gupnp-dlna-gst-2.0.pc.in
new file mode 100644
index 0000000..0d6c56d
--- /dev/null
+++ b/gupnp-dlna-gst-2.0.pc.in
@@ -0,0 +1,9 @@
+prefix= prefix@
+exec_prefix= exec_prefix@
+libdir= libdir@
+includedir= includedir@
+
+Name: gupnp-dlna-gst-2.0
+Description: GStreamer specific utils using GUPnP-DLNA
+Version: @VERSION@
+Requires: glib-2.0 gobject-2.0 gupnp-dlna-2.0 gstreamer- GST_MAJORMINOR@ gstreamer-pbutils- GST_MAJORMINOR@
diff --git a/libgupnp-dlna/Makefile.am b/libgupnp-dlna/Makefile.am
index 64b3c81..580c4fa 100644
--- a/libgupnp-dlna/Makefile.am
+++ b/libgupnp-dlna/Makefile.am
@@ -13,6 +13,9 @@ LTVERSION = $(GUPNP_DLNA_VERSION_INFO)
 
 include $(top_srcdir)/common.am
 
+libgupnp_dlna_incdir = \
+	$(includedir)/gupnp-dlna-2.0/libgupnp-dlna
+libgupnp_dlna_inc_HEADERS =
 noinst_LTLIBRARIES =
 pkglib_LTLIBRARIES =
 lib_LTLIBRARIES =
@@ -34,8 +37,7 @@ metadata_log_cflags = \
 
 common_cflags = \
 	$(GLIB_CFLAGS) \
-	$(GOBJECT_CFLAGS) \
-	-I$(top_srcdir)/libgupnp-dlna/profile-backends/native/sets
+	$(GOBJECT_CFLAGS)
 
 metadata_cflags = \
 	-I$(top_srcdir)/libgupnp-dlna/metadata
@@ -44,7 +46,6 @@ common_libadd = \
 	$(GLIB_LIBS) \
 	$(GOBJECT_LIBS)
 
-# "Profile backend" might add some stuff to variables below.
 gupnp_ldflags = \
 	-version-info $(LTVERSION) \
 	-no-undefined
@@ -79,8 +80,7 @@ libloader_la_CFLAGS = \
 	$(metadata_cflags) \
 	$(common_cflags) \
 	$(LIBXML_CFLAGS) \
-	-DDATA_DIR='"$(shareddir)"' \
-	-I$(top_srcdir)/libgupnp-dlna/profile-backends/native
+	-DDATA_DIR='"$(shareddir)"'
 
 libguesser_la_SOURCES = \
 	gupnp-dlna-profile-guesser.c \
@@ -90,8 +90,7 @@ libguesser_la_LIBADD = \
 libguesser_la_CFLAGS = \
 	$(guesser_log_cflags) \
 	$(metadata_cflags) \
-	$(common_cflags) \
-	-I$(top_srcdir)/libgupnp-dlna/profile-backends/native
+	$(common_cflags)
 
 libmetadata_la_SOURCES = \
 	gupnp-dlna-metadata-backend.c \
@@ -134,9 +133,7 @@ libgupnp_dlna_2_0_la_CFLAGS = \
 	$(metadata_cflags) \
 	$(gupnp_cflags)
 
-libgupnp_dlna_incdir = \
-	$(includedir)/gupnp-dlna-2.0/libgupnp-dlna
-libgupnp_dlna_inc_HEADERS = \
+libgupnp_dlna_inc_HEADERS += \
 	gupnp-dlna-profile-guesser.h \
 	gupnp-dlna-profile.h \
 	gupnp-dlna-restriction.h \
@@ -173,17 +170,27 @@ dist_noinst_HEADERS += \
 # INTROSPECTION
 -include $(INTROSPECTION_MAKEFILE)
 INTROSPECTION_GIRS =
-INTROSPECTION_SCANNER_ARGS =
+INTROSPECTION_SCANNER_ARGS = \
+	--warn-all
 INTROSPECTION_COMPILER_ARGS = \
-	--includedir=$(top_srcdir) \
-	--includedir=$(top_srcdir)/libgupnp-dlna/profile-backends/native/sets
+	--includedir=$(top_srcdir)
 
 if HAVE_INTROSPECTION
 
 girs = GUPnPDLNA-2.0.gir
 
 introspection_sources = \
-	$(libgupnp_dlna_inc_HEADERS) \
+	gupnp-dlna-profile-guesser.h \
+	gupnp-dlna-profile.h \
+	gupnp-dlna-restriction.h \
+	gupnp-dlna-value-list.h \
+	gupnp-dlna-g-values.h \
+	gupnp-dlna-audio-information.h \
+	gupnp-dlna-container-information.h \
+	gupnp-dlna-image-information.h \
+	gupnp-dlna-video-information.h \
+	gupnp-dlna-information.h \
+	gupnp-dlna-values.h \
 	gupnp-dlna-profile-guesser.c \
 	gupnp-dlna-profile.c \
 	gupnp-dlna-restriction.c \
@@ -200,10 +207,25 @@ GUPnPDLNA_2_0_gir_FILES = $(introspection_sources)
 GUPnPDLNA_2_0_gir_LIBS = libgupnp-dlna-2.0.la
 GUPnPDLNA_2_0_gir_INCLUDES = GObject-2.0
 GUPnPDLNA_2_0_gir_SCANNERFLAGS = \
-	--warn-all \
 	--symbol-prefix=gupnp_dlna \
-	--identifier-prefix=GUPnPDLNA \
-	-I$(top_srcdir)/libgupnp-dlna/profile-backends/native/sets
+	--identifier-prefix=GUPnPDLNA
+
+if GSTREAMER_METADATA_BACKEND_ENABLED
+girs += GUPnPDLNAGst-2.0.gir
+
+gst_introspection_sources = \
+	metadata-backends/gstreamer/gupnp-dlna-gst-utils.h \
+	metadata-backends/gstreamer/gupnp-dlna-gst-utils.c
+
+GUPnPDLNAGst-2.0.gir: $(gstreamer_utils_lib) GUPnPDLNA-2.0.gir
+GUPnPDLNAGst_2_0_gir_FILES = $(gst_introspection_sources)
+GUPnPDLNAGst_2_0_gir_LIBS = $(gstreamer_utils_lib)
+GUPnPDLNAGst_2_0_gir_INCLUDES = GObject-2.0 GUPnPDLNA-2.0 Gst-1.0 GstPbutils-1.0
+GUPnPDLNAGst_2_0_gir_SCANNERFLAGS = \
+	--symbol-prefix=gupnp_dlna_gst \
+	--identifier-prefix=GUPnPDLNAGst \
+	--add-include-path=.
+endif
 
 INTROSPECTION_GIRS += $(girs)
 
diff --git a/libgupnp-dlna/metadata-backends/gstreamer/gstreamer.am b/libgupnp-dlna/metadata-backends/gstreamer/gstreamer.am
index 361b039..f520537 100644
--- a/libgupnp-dlna/metadata-backends/gstreamer/gstreamer.am
+++ b/libgupnp-dlna/metadata-backends/gstreamer/gstreamer.am
@@ -12,25 +12,40 @@ gst_metadata_backend_cflags = \
 
 gstreamer_metadata_backend = \
 	metadata-backends/gstreamer/libgstreamer.la
+gstreamer_utils_lib = \
+	metadata-backends/gstreamer/libgupnp-dlna-gst-2.0.la
 metadata_LTLIBRARIES += \
 	$(gstreamer_metadata_backend)
+lib_LTLIBRARIES += \
+	$(gstreamer_utils_lib)
 
 metadata_backends_gstreamer_libgstreamer_la_LDFLAGS = \
-	$(convenience_ldflags) \
+	-no-undefined \
 	-shared -fPIC -module -avoid-version -Wl,-z,defs
 metadata_backends_gstreamer_libgstreamer_la_SOURCES = \
+	metadata-backends/gstreamer/gupnp-dlna-gst-metadata-backend.c \
+	metadata-backends/gstreamer/gupnp-dlna-gst-metadata-extractor.c
+metadata_backends_gstreamer_libgstreamer_la_LIBADD = \
+	$(gst_metadata_backend_libadd) \
+	$(gstreamer_utils_lib)
+metadata_backends_gstreamer_libgstreamer_la_CFLAGS = \
+	$(gst_metadata_backend_cflags)
+
+metadata_backends_gstreamer_libgupnp_dlna_gst_2_0_la_LDFLAGS = \
+	$(gupnp_ldflags)
+metadata_backends_gstreamer_libgupnp_dlna_gst_2_0_la_SOURCES = \
 	metadata-backends/gstreamer/gupnp-dlna-gst-audio-information.c \
 	metadata-backends/gstreamer/gupnp-dlna-gst-container-information.c \
 	metadata-backends/gstreamer/gupnp-dlna-gst-image-information.c \
 	metadata-backends/gstreamer/gupnp-dlna-gst-information.c \
 	metadata-backends/gstreamer/gupnp-dlna-gst-info-utils.c \
-	metadata-backends/gstreamer/gupnp-dlna-gst-metadata-backend.c \
-	metadata-backends/gstreamer/gupnp-dlna-gst-metadata-extractor.c \
+	metadata-backends/gstreamer/gupnp-dlna-gst-utils.c \
 	metadata-backends/gstreamer/gupnp-dlna-gst-video-information.c
-metadata_backends_gstreamer_libgstreamer_la_LIBADD = \
+metadata_backends_gstreamer_libgupnp_dlna_gst_2_0_la_LIBADD = \
 	$(gst_metadata_backend_libadd)
-metadata_backends_gstreamer_libgstreamer_la_CFLAGS = \
+metadata_backends_gstreamer_libgupnp_dlna_gst_2_0_la_CFLAGS = \
 	$(gst_metadata_backend_cflags)
+
 dist_noinst_HEADERS += \
 	metadata-backends/gstreamer/gupnp-dlna-gst-audio-information.h \
 	metadata-backends/gstreamer/gupnp-dlna-gst-container-information.h \
@@ -39,3 +54,6 @@ dist_noinst_HEADERS += \
 	metadata-backends/gstreamer/gupnp-dlna-gst-info-utils.h \
 	metadata-backends/gstreamer/gupnp-dlna-gst-metadata-extractor.h \
 	metadata-backends/gstreamer/gupnp-dlna-gst-video-information.h
+
+libgupnp_dlna_inc_HEADERS += \
+	metadata-backends/gstreamer/gupnp-dlna-gst-utils.h
diff --git a/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-metadata-extractor.c b/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-metadata-extractor.c
index 7ad924c..7f9496b 100644
--- a/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-metadata-extractor.c
+++ b/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-metadata-extractor.c
@@ -24,6 +24,7 @@
 #include <gst/pbutils/pbutils.h>
 #include "gupnp-dlna-gst-metadata-extractor.h"
 #include "gupnp-dlna-gst-information.h"
+#include "gupnp-dlna-gst-utils.h"
 
 /**
  * SECTION:gupnp-dlna-gst-metadata-extractor
@@ -76,10 +77,8 @@ gupnp_dlna_discovered_cb (GUPnPDLNAMetadataExtractor *self,
                                   (gupnp_dlna_gst_information_new_empty_with_uri
                                         (gst_discoverer_info_get_uri (info)));
         else
-                gupnp_info = GUPNP_DLNA_INFORMATION
-                            (gupnp_dlna_gst_information_new_from_discoverer_info
-                                        (gst_discoverer_info_get_uri (info),
-                                         info));
+                gupnp_info = gupnp_dlna_gst_utils_information_from_discoverer_info
+                                        (info);
         gupnp_dlna_metadata_extractor_emit_done (self,
                                                  gupnp_info,
                                                  error);
diff --git a/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-utils.c b/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-utils.c
new file mode 100644
index 0000000..8f783dd
--- /dev/null
+++ b/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-utils.c
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2013 Intel Corporation.
+ *
+ * Authors: Krzesimir Nowak <krnowak openismus com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "gupnp-dlna-gst-utils.h"
+#include "gupnp-dlna-gst-information.h"
+
+/**
+ * gupnp_dlna_gst_utils_information_from_discoverer_info:
+ * @info: A #GstDiscovererInfo object.
+ *
+ * This utility function creates a #GUPnPDLNAInformation from
+ * #GstDiscovererInfo. Its purpose is mainly to pass its result to
+ * gupnp_dlna_profile_guesser_guess_profile_from_info() to avoid
+ * rediscovering of a URI. Created #GUPnPDLNAInformation takes a
+ * reference on @info.
+ *
+ * Returns: (transfer full): A #GUPnPDLNAInformation. Unref it when
+ * done with it.
+ */
+GUPnPDLNAInformation *
+gupnp_dlna_gst_utils_information_from_discoverer_info (GstDiscovererInfo *info)
+{
+        g_return_val_if_fail (GST_IS_DISCOVERER_INFO (info), NULL);
+
+        return GUPNP_DLNA_INFORMATION
+                            (gupnp_dlna_gst_information_new_from_discoverer_info
+                                        (gst_discoverer_info_get_uri (info),
+                                         info));
+}
diff --git a/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-utils.h b/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-utils.h
new file mode 100644
index 0000000..49988af
--- /dev/null
+++ b/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-utils.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2013 Intel Corporation.
+ *
+ * Authors: Krzesimir Nowak <krnowak openismus com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GUPNP_DLNA_GST_UTILS_H__
+#define __GUPNP_DLNA_GST_UTILS_H__
+
+#include <gst/pbutils/pbutils.h>
+#include "gupnp-dlna-information.h"
+
+G_BEGIN_DECLS
+
+GUPnPDLNAInformation *
+gupnp_dlna_gst_utils_information_from_discoverer_info (GstDiscovererInfo *info);
+
+G_END_DECLS
+
+#endif /* __GUPNP_DLNA_GST_UTILS_H__ */
diff --git a/vala/GUPnPDLNAGst-2.0.metadata b/vala/GUPnPDLNAGst-2.0.metadata
new file mode 100644
index 0000000..bab0e14
--- /dev/null
+++ b/vala/GUPnPDLNAGst-2.0.metadata
@@ -0,0 +1 @@
+utils_information_from_discoverer_info cheader_filename="libgupnp-dlna/gupnp-dlna-gst-utils.h"
diff --git a/vala/Makefile.am b/vala/Makefile.am
index f6ee1b5..3fcb8dd 100644
--- a/vala/Makefile.am
+++ b/vala/Makefile.am
@@ -13,8 +13,44 @@ gupnp-dlna-2.0.stamp: $(builddir)/../libgupnp-dlna/GUPnPDLNA-2.0.gir \
 	echo timestamp > $(@F)
 
 vapidir = $(datadir)/vala/vapi
-vapi_DATA = gupnp-dlna-2.0.vapi $(srcdir)/gupnp-dlna-2.0.deps
-CLEANFILES = gupnp-dlna-2.0.vapi gupnp-dlna-2.0.stamp
-EXTRA_DIST = gupnp-dlna-2.0.deps GUPnPDLNA-2.0.metadata gupnp-dlna-2.0-custom.vala
+vapi_DATA = \
+	gupnp-dlna-2.0.vapi \
+	$(srcdir)/gupnp-dlna-2.0.deps
+CLEANFILES = \
+	gupnp-dlna-2.0.vapi \
+	gupnp-dlna-2.0.stamp
+EXTRA_DIST = \
+	gupnp-dlna-2.0.deps \
+	GUPnPDLNA-2.0.metadata \
+	gupnp-dlna-2.0-custom.vala
+
+if GSTREAMER_METADATA_BACKEND_ENABLED
+gupnp-dlna-gst-2.0.vapi: gupnp-dlna-gst-2.0.stamp
+	@true
+
+gupnp-dlna-gst-2.0.stamp: $(builddir)/../libgupnp-dlna/GUPnPDLNAGst-2.0.gir \
+		$(srcdir)/GUPnPDLNAGst-2.0.metadata \
+		$(srcdir)/gupnp-dlna-gst-2.0-custom.vala \
+		gupnp-dlna-2.0.vapi
+	$(AM_V_GEN)$(VAPIGEN) --metadatadir=$(srcdir) \
+			      --library=gupnp-dlna-gst-2.0 \
+			      --vapidir=$(builddir) \
+			      --girdir=$(builddir)/../libgupnp-dlna \
+			      $(builddir)/../libgupnp-dlna/GUPnPDLNAGst-2.0.gir \
+			      $(srcdir)/gupnp-dlna-gst-2.0-custom.vala && \
+	echo timestamp > $(@F)
+
+
+vapi_DATA += \
+	gupnp-dlna-gst-2.0.vapi \
+	$(srcdir)/gupnp-dlna-gst-2.0.deps
+CLEANFILES += \
+	gupnp-dlna-gst-2.0.vapi \
+	gupnp-dlna-gst-2.0.stamp
+EXTRA_DIST += \
+	gupnp-dlna-gst-2.0.deps \
+	GUPnPDLNAGst-2.0.metadata \
+	gupnp-dlna-gst-2.0-custom.vala
+endif
 endif
 endif
diff --git a/vala/gupnp-dlna-gst-2.0-custom.vala b/vala/gupnp-dlna-gst-2.0-custom.vala
new file mode 100644
index 0000000..1ff1a6e
--- /dev/null
+++ b/vala/gupnp-dlna-gst-2.0-custom.vala
@@ -0,0 +1,2 @@
+namespace GUPnP.DLNA.Gst {
+}
diff --git a/vala/gupnp-dlna-gst-2.0.deps b/vala/gupnp-dlna-gst-2.0.deps
new file mode 100644
index 0000000..3ed2cd4
--- /dev/null
+++ b/vala/gupnp-dlna-gst-2.0.deps
@@ -0,0 +1,3 @@
+gupnp-dlna-2.0
+gstreamer-1.0
+gstreamer-pbutils-1.0



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]