[gupnp-dlna] Add a GStreamer 0.10 back-end.
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gupnp-dlna] Add a GStreamer 0.10 back-end.
- Date: Tue, 12 Feb 2013 15:35:42 +0000 (UTC)
commit fede5cf56c6c885c071d91a9b8f62f6fb053d2ef
Author: Jens Georg <mail jensge org>
Date: Wed Jan 30 15:37:23 2013 +0100
Add a GStreamer 0.10 back-end.
Makefile.am | 4 +
README.gstreamer-legacy | 13 +
configure.ac | 42 ++
gupnp-dlna-gst-legacy-2.0.pc.in | 10 +
libgupnp-dlna/Makefile.am | 4 +
.../gstreamer-legacy/gstreamer.am | 59 +++
.../gupnp-dlna-gst-audio-information.c | 392 ++++++++++++++++++
.../gupnp-dlna-gst-audio-information.h | 79 ++++
.../gupnp-dlna-gst-container-information.c | 296 ++++++++++++++
.../gupnp-dlna-gst-container-information.h | 80 ++++
.../gupnp-dlna-gst-image-information.c | 286 +++++++++++++
.../gupnp-dlna-gst-image-information.h | 79 ++++
.../gstreamer-legacy/gupnp-dlna-gst-info-utils.c | 430 ++++++++++++++++++++
.../gstreamer-legacy/gupnp-dlna-gst-info-utils.h | 68 +++
.../gstreamer-legacy/gupnp-dlna-gst-information.c | 212 ++++++++++
.../gstreamer-legacy/gupnp-dlna-gst-information.h | 82 ++++
.../gstreamer-legacy/gupnp-dlna-gst-legacy-utils.h | 35 ++
.../gupnp-dlna-gst-metadata-backend.c | 41 ++
.../gupnp-dlna-gst-metadata-extractor.c | 163 ++++++++
.../gupnp-dlna-gst-metadata-extractor.h | 85 ++++
.../gstreamer-legacy/gupnp-dlna-gst-utils.c | 47 +++
.../gupnp-dlna-gst-video-information.c | 418 +++++++++++++++++++
.../gupnp-dlna-gst-video-information.h | 73 ++++
vala/Makefile.am | 6 +
vala/gupnp-dlna-gst-legacy-2.0.deps | 3 +
vala/gupnp-dlna-gst-legacy-2.0.vapi | 5 +
26 files changed, 3012 insertions(+), 0 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 17b6d6a..50dbc53 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -9,6 +9,10 @@ if GSTREAMER_METADATA_BACKEND_ENABLED
pkgconfig_DATA += gupnp-dlna-gst-2.0.pc
endif
+if GSTREAMER_LEGACY_METADATA_BACKEND_ENABLED
+pkgconfig_DATA += gupnp-dlna-gst-legacy-2.0.pc
+endif
+
DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc --enable-introspection
# Extra clean files so that maintainer-clean removes *everything*
diff --git a/README.gstreamer-legacy b/README.gstreamer-legacy
new file mode 100644
index 0000000..9d66758
--- /dev/null
+++ b/README.gstreamer-legacy
@@ -0,0 +1,13 @@
+If you only want to compile gupnp-dlna with a gstreamer-0.10 back-end, you have to
+do the following:
+
+./configure --disable-gstreamer-metadata-backend \
+ --enable-legacy-gstreamer-metadata-backend \
+ --with-default-metadata-backend=gstreamer-legacy
+
+This disables the GStreamer 1.0 back-end, enables the 0.10 back-end and makes
+it the default one.
+
+If you omit the last configure option, the default will be the "normal"
+GStreamer back-end and you need to explicitly set the back-end in your code or
+environment.
diff --git a/configure.ac b/configure.ac
index 6927816..4e5858a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -102,6 +102,47 @@ else
AM_CONDITIONAL(GSTREAMER_METADATA_BACKEND_ENABLED, false)
fi
+AC_ARG_ENABLE([legacy-gstreamer-metadata-backend],
+ [AS_HELP_STRING([--enable-legacy-gstreamer-metadata-backend],
+ [build a GStreamer 0.10 metadata backend @<:@default=no@:>@])],
+ ,
+ [enable_legacy_gstreamer_metadata_backend=no])
+
+if test "x$enable_legacy_gstreamer_metadata_backend" != 'xno'
+then
+ gstreamer_found='yes'
+ GST_LEGACY_MAJORMINOR=0.10
+ GST_LEGACY_REQ=0.10.36
+ GSTPBU_LEGACY_REQ=0.10.36
+
+ PKG_CHECK_MODULES([GST_LEGACY],
+ [gstreamer-$GST_LEGACY_MAJORMINOR >= $GST_LEGACY_REQ],
+ ,
+ [gstreamer_found='no'])
+ PKG_CHECK_MODULES([GST_PBU_LEGACY],
+ [gstreamer-pbutils-$GST_LEGACY_MAJORMINOR >= $GSTPBU_LEGACY_REQ],
+ ,
+ [gstreamer_found='no'])
+
+ if test "x$gstreamer_found" = 'xyes'
+ then
+ AC_SUBST(GST_LEGACY_MAJORMINOR)
+ enable_legacy_gstreamer_metadata_backend='yes'
+ elif test "x$enable_legacy_gstreamer_metadata_backend" = 'xyes'
+ then
+ AC_MSG_ERROR([GStreamer $GST_LEGACY_MAJORMINOR not found.])
+ else
+ enable_legacy_gstreamer_metadata_backend='no'
+ fi
+fi
+
+if test "x$enable_legacy_gstreamer_metadata_backend" = 'xyes'
+then
+ AM_CONDITIONAL(GSTREAMER_LEGACY_METADATA_BACKEND_ENABLED, true)
+else
+ AM_CONDITIONAL(GSTREAMER_LEGACY_METADATA_BACKEND_ENABLED, false)
+fi
+
AC_ARG_WITH([default-metadata-backend-dir],
[AS_HELP_STRING([--with-default-metadata-backend-dir=your_directory],
[set a default metadata backend directory @<:@default=$libdir/$PACKAGE_NAME@:>@])])
@@ -202,6 +243,7 @@ data/Makefile
gupnp-dlna-2.0.pc
gupnp-dlna-metadata-2.0.pc
gupnp-dlna-gst-2.0.pc
+gupnp-dlna-gst-legacy-2.0.pc
doc/Makefile
doc/version.xml
doc/gupnp-dlna/Makefile
diff --git a/gupnp-dlna-gst-legacy-2.0.pc.in b/gupnp-dlna-gst-legacy-2.0.pc.in
new file mode 100644
index 0000000..0e3e2ce
--- /dev/null
+++ b/gupnp-dlna-gst-legacy-2.0.pc.in
@@ -0,0 +1,10 @@
+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@
+Libs: -L${libdir} -lgupnp-dlna-gst-2.0
+Requires: glib-2.0 gobject-2.0 gupnp-dlna-2.0 gstreamer- GST_MAJORMINOR_LEGACY@ gstreamer-pbutils- GST_MAJORMINOR_LEGACY@
diff --git a/libgupnp-dlna/Makefile.am b/libgupnp-dlna/Makefile.am
index ccf2b5c..7b34825 100644
--- a/libgupnp-dlna/Makefile.am
+++ b/libgupnp-dlna/Makefile.am
@@ -66,6 +66,10 @@ if GSTREAMER_METADATA_BACKEND_ENABLED
include $(top_srcdir)/libgupnp-dlna/metadata-backends/gstreamer/gstreamer.am
endif
+if GSTREAMER_LEGACY_METADATA_BACKEND_ENABLED
+include $(top_srcdir)/libgupnp-dlna/metadata-backends/gstreamer-legacy/gstreamer.am
+endif
+
noinst_LTLIBRARIES += \
libloader.la \
libguesser.la \
diff --git a/libgupnp-dlna/metadata-backends/gstreamer-legacy/gstreamer.am b/libgupnp-dlna/metadata-backends/gstreamer-legacy/gstreamer.am
new file mode 100644
index 0000000..c7b4c54
--- /dev/null
+++ b/libgupnp-dlna/metadata-backends/gstreamer-legacy/gstreamer.am
@@ -0,0 +1,59 @@
+gst_legacy_metadata_backend_libadd = \
+ $(common_libadd) \
+ $(GST_LEGACY_LIBS) \
+ $(GST_PBU_LEGACY_LIBS) \
+ libgupnp-dlna-2.0.la
+gst_legacy_metadata_backend_cflags = \
+ $(common_cflags) \
+ $(GST_LEGACY_CFLAGS) \
+ $(GST_PBU_LEGACY_CFLAGS) \
+ $(metadata_log_cflags) \
+ $(metadata_cflags)
+
+gstreamer_legacy_metadata_backend = \
+ metadata-backends/gstreamer-legacy/libgstreamer-legacy.la
+gstreamer_legacy_utils_lib = \
+ metadata-backends/gstreamer-legacy/libgupnp-dlna-gst-legacy-2.0.la
+metadata_LTLIBRARIES += \
+ $(gstreamer_legacy_metadata_backend)
+lib_LTLIBRARIES += \
+ $(gstreamer_legacy_utils_lib)
+
+metadata_backends_gstreamer_legacy_libgstreamer_legacy_la_LDFLAGS = \
+ -no-undefined \
+ -shared -fPIC -module -avoid-version -Wl,-z,defs
+metadata_backends_gstreamer_legacy_libgstreamer_legacy_la_SOURCES = \
+ metadata-backends/gstreamer-legacy/gupnp-dlna-gst-metadata-backend.c \
+ metadata-backends/gstreamer-legacy/gupnp-dlna-gst-metadata-extractor.c
+metadata_backends_gstreamer_legacy_libgstreamer_legacy_la_LIBADD = \
+ $(gst_legacy_metadata_backend_libadd) \
+ $(gstreamer_legacy_utils_lib)
+metadata_backends_gstreamer_legacy_libgstreamer_legacy_la_CFLAGS = \
+ $(gst_legacy_metadata_backend_cflags)
+
+metadata_backends_gstreamer_legacy_libgupnp_dlna_gst_legacy_2_0_la_LDFLAGS = \
+ $(gupnp_ldflags)
+metadata_backends_gstreamer_legacy_libgupnp_dlna_gst_legacy_2_0_la_SOURCES = \
+ metadata-backends/gstreamer-legacy/gupnp-dlna-gst-audio-information.c \
+ metadata-backends/gstreamer-legacy/gupnp-dlna-gst-container-information.c \
+ metadata-backends/gstreamer-legacy/gupnp-dlna-gst-image-information.c \
+ metadata-backends/gstreamer-legacy/gupnp-dlna-gst-information.c \
+ metadata-backends/gstreamer-legacy/gupnp-dlna-gst-info-utils.c \
+ metadata-backends/gstreamer-legacy/gupnp-dlna-gst-utils.c \
+ metadata-backends/gstreamer-legacy/gupnp-dlna-gst-video-information.c
+metadata_backends_gstreamer_legacy_libgupnp_dlna_gst_legacy_2_0_la_LIBADD = \
+ $(gst_legacy_metadata_backend_libadd)
+metadata_backends_gstreamer_legacy_libgupnp_dlna_gst_legacy_2_0_la_CFLAGS = \
+ $(gst_legacy_metadata_backend_cflags)
+
+dist_noinst_HEADERS += \
+ metadata-backends/gstreamer-legacy/gupnp-dlna-gst-audio-information.h \
+ metadata-backends/gstreamer-legacy/gupnp-dlna-gst-container-information.h \
+ metadata-backends/gstreamer-legacy/gupnp-dlna-gst-image-information.h \
+ metadata-backends/gstreamer-legacy/gupnp-dlna-gst-information.h \
+ metadata-backends/gstreamer-legacy/gupnp-dlna-gst-info-utils.h \
+ metadata-backends/gstreamer-legacy/gupnp-dlna-gst-metadata-extractor.h \
+ metadata-backends/gstreamer-legacy/gupnp-dlna-gst-video-information.h
+
+libgupnp_dlna_inc_HEADERS += \
+ metadata-backends/gstreamer-legacy/gupnp-dlna-gst-legacy-utils.h
diff --git a/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-audio-information.c b/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-audio-information.c
new file mode 100644
index 0000000..097cad5
--- /dev/null
+++ b/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-audio-information.c
@@ -0,0 +1,392 @@
+/*
+ * Copyright (C) 2012,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H_ */
+#include "gupnp-dlna-gst-audio-information.h"
+#include "gupnp-dlna-gst-info-utils.h"
+
+G_DEFINE_TYPE (GUPnPDLNAGstAudioInformation,
+ gupnp_dlna_gst_audio_information,
+ GUPNP_TYPE_DLNA_AUDIO_INFORMATION)
+
+struct _GUPnPDLNAGstAudioInformationPrivate {
+ GstDiscovererInfo *info;
+ GList *stream_list;
+ GstDiscovererAudioInfo *audio_info;
+ GstCaps *caps;
+};
+
+enum
+{
+ PROP_0,
+
+ PROP_INFO
+};
+
+static GstDiscovererAudioInfo *
+get_audio_info (GUPnPDLNAGstAudioInformation *gst_info)
+{
+ GUPnPDLNAGstAudioInformationPrivate *priv = gst_info->priv;
+
+ if (!priv->audio_info) {
+ GList *iter;
+
+ if (!priv->stream_list) {
+ priv->stream_list =
+ gst_discoverer_info_get_stream_list (priv->info);
+ if (!priv->stream_list)
+ return NULL;
+ }
+
+ for (iter = priv->stream_list; iter; iter = iter->next) {
+ GstDiscovererStreamInfo *stream =
+ GST_DISCOVERER_STREAM_INFO (iter->data);
+ GType stream_type = G_TYPE_FROM_INSTANCE (stream);
+
+ if (stream_type == GST_TYPE_DISCOVERER_AUDIO_INFO) {
+ priv->audio_info =
+ GST_DISCOVERER_AUDIO_INFO (stream);
+
+ break;
+ }
+ }
+ }
+
+ return priv->audio_info;
+}
+
+static GstCaps *
+get_caps (GUPnPDLNAGstAudioInformation *gst_info)
+{
+ GUPnPDLNAGstAudioInformationPrivate *priv = gst_info->priv;
+
+ if (!priv->caps)
+ priv->caps = gst_discoverer_stream_info_get_caps
+ (GST_DISCOVERER_STREAM_INFO (get_audio_info (gst_info)));
+
+ return priv->caps;
+}
+
+static GUPnPDLNAIntValue
+get_int_value (GUPnPDLNAGstAudioInformation *gst_info,
+ const gchar *name)
+{
+ GstCaps *caps = get_caps (gst_info);
+ GstDiscovererStreamInfo *stream =
+ GST_DISCOVERER_STREAM_INFO (get_audio_info (gst_info));
+ GstDiscovererInfo *info = gst_info->priv->info;
+
+ return gupnp_dlna_gst_get_int_value (caps, stream, info, name);
+}
+
+static GUPnPDLNAStringValue
+get_string_value (GUPnPDLNAGstAudioInformation *gst_info,
+ const gchar *name)
+{
+ GstCaps *caps = get_caps (gst_info);
+ GstDiscovererStreamInfo *stream =
+ GST_DISCOVERER_STREAM_INFO (get_audio_info (gst_info));
+ GstDiscovererInfo *info = gst_info->priv->info;
+
+ return gupnp_dlna_gst_get_string_value (caps, stream, info, name);
+}
+
+static GUPnPDLNAIntValue
+backend_get_bitrate (GUPnPDLNAAudioInformation *self)
+{
+ GUPnPDLNAGstAudioInformation* gst_info =
+ GUPNP_DLNA_GST_AUDIO_INFORMATION (self);
+ GstDiscovererAudioInfo *audio_info = get_audio_info (gst_info);
+ guint data = gst_discoverer_audio_info_get_bitrate (audio_info);
+ GUPnPDLNAIntValue value = GUPNP_DLNA_INT_VALUE_UNSET;
+
+ if (data > 0 && data <= G_MAXINT) {
+ value.state = GUPNP_DLNA_VALUE_STATE_SET;
+ value.value = (gint) data;
+ }
+
+ return value;
+}
+
+static GUPnPDLNAIntValue
+backend_get_channels (GUPnPDLNAAudioInformation *self)
+{
+ GUPnPDLNAGstAudioInformation* gst_info =
+ GUPNP_DLNA_GST_AUDIO_INFORMATION (self);
+ GstDiscovererAudioInfo *audio_info = get_audio_info (gst_info);
+ guint data = gst_discoverer_audio_info_get_channels (audio_info);
+ GUPnPDLNAIntValue value = GUPNP_DLNA_INT_VALUE_UNSET;
+
+ if (data > 0 && data <= G_MAXINT) {
+ value.state = GUPNP_DLNA_VALUE_STATE_SET;
+ value.value = (gint) data;
+ }
+
+ return value;
+}
+
+static GUPnPDLNAIntValue
+backend_get_depth (GUPnPDLNAAudioInformation *self)
+{
+ GUPnPDLNAGstAudioInformation* gst_info =
+ GUPNP_DLNA_GST_AUDIO_INFORMATION (self);
+ GstDiscovererAudioInfo *audio_info = get_audio_info (gst_info);
+ guint data = gst_discoverer_audio_info_get_depth (audio_info);
+ GUPnPDLNAIntValue value = GUPNP_DLNA_INT_VALUE_UNSET;
+
+ if (data > 0 && data <= G_MAXINT) {
+ value.state = GUPNP_DLNA_VALUE_STATE_SET;
+ value.value = (gint) data;
+ }
+
+ return value;
+}
+
+static GUPnPDLNAIntValue
+backend_get_layer (GUPnPDLNAAudioInformation *self)
+{
+ GUPnPDLNAGstAudioInformation* gst_info =
+ GUPNP_DLNA_GST_AUDIO_INFORMATION (self);
+
+ return get_int_value (gst_info, "layer");
+}
+
+static GUPnPDLNAStringValue
+backend_get_level (GUPnPDLNAAudioInformation *self)
+{
+ GUPnPDLNAGstAudioInformation* gst_info =
+ GUPNP_DLNA_GST_AUDIO_INFORMATION (self);
+ return get_string_value (gst_info, "level");
+}
+
+static GUPnPDLNAIntValue
+backend_get_mpeg_audio_version (GUPnPDLNAAudioInformation *self)
+{
+ GUPnPDLNAGstAudioInformation* gst_info =
+ GUPNP_DLNA_GST_AUDIO_INFORMATION (self);
+
+ return get_int_value (gst_info, "mpegaudioversion");
+}
+
+static GUPnPDLNAIntValue
+backend_get_mpeg_version (GUPnPDLNAAudioInformation *self)
+{
+ GUPnPDLNAGstAudioInformation* gst_info =
+ GUPNP_DLNA_GST_AUDIO_INFORMATION (self);
+
+ return get_int_value (gst_info, "mpegversion");
+}
+
+static GUPnPDLNAStringValue
+backend_get_profile (GUPnPDLNAAudioInformation *self)
+{
+ GUPnPDLNAGstAudioInformation* gst_info =
+ GUPNP_DLNA_GST_AUDIO_INFORMATION (self);
+
+ return get_string_value (gst_info, "profile");
+}
+
+static GUPnPDLNAIntValue
+backend_get_rate (GUPnPDLNAAudioInformation *self)
+{
+ GUPnPDLNAGstAudioInformation* gst_info =
+ GUPNP_DLNA_GST_AUDIO_INFORMATION (self);
+ GstDiscovererAudioInfo *audio_info = get_audio_info (gst_info);
+ guint data = gst_discoverer_audio_info_get_sample_rate (audio_info);
+ GUPnPDLNAIntValue value = GUPNP_DLNA_INT_VALUE_UNSET;
+
+ if (data > 0 && data <= G_MAXINT) {
+ value.state = GUPNP_DLNA_VALUE_STATE_SET;
+ value.value = (gint) data;
+ }
+
+ return value;
+}
+
+static GUPnPDLNAStringValue
+backend_get_stream_format (GUPnPDLNAAudioInformation *self)
+{
+ GUPnPDLNAGstAudioInformation* gst_info =
+ GUPNP_DLNA_GST_AUDIO_INFORMATION (self);
+
+ return get_string_value (gst_info, "stream-format");
+}
+
+static GUPnPDLNAIntValue
+backend_get_wma_version (GUPnPDLNAAudioInformation *self)
+{
+ GUPnPDLNAGstAudioInformation* gst_info =
+ GUPNP_DLNA_GST_AUDIO_INFORMATION (self);
+
+ return get_int_value (gst_info, "wmaversion");
+}
+
+static GUPnPDLNAStringValue
+backend_get_mime (GUPnPDLNAAudioInformation *self)
+{
+ GUPnPDLNAGstAudioInformation* gst_info =
+ GUPNP_DLNA_GST_AUDIO_INFORMATION (self);
+
+ return gupnp_dlna_gst_get_mime (get_caps (gst_info));
+}
+
+static void
+gupnp_dlna_gst_audio_information_dispose (GObject *object)
+{
+ GUPnPDLNAGstAudioInformation *info =
+ GUPNP_DLNA_GST_AUDIO_INFORMATION (object);
+ GUPnPDLNAGstAudioInformationPrivate *priv = info->priv;
+ GObjectClass *parent_class =
+ G_OBJECT_CLASS (gupnp_dlna_gst_audio_information_parent_class);
+
+ g_clear_pointer (&priv->info, gupnp_dlna_gst_discoverer_info_unref);
+ g_clear_pointer (&priv->stream_list,
+ gst_discoverer_stream_info_list_free);
+ /* priv->audio_info is freed with stream list above */
+ priv->audio_info = NULL;
+ g_clear_pointer (&priv->caps, gst_caps_unref);
+ parent_class->dispose (object);
+}
+
+static void
+gupnp_dlna_gst_audio_information_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GUPnPDLNAGstAudioInformation *info =
+ GUPNP_DLNA_GST_AUDIO_INFORMATION (object);
+ GUPnPDLNAGstAudioInformationPrivate *priv = info->priv;
+
+ switch (property_id) {
+ case PROP_INFO:
+ g_clear_pointer (&priv->info,
+ gupnp_dlna_gst_discoverer_info_unref);
+ priv->info =
+ GST_DISCOVERER_INFO (gst_value_dup_mini_object (value));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gupnp_dlna_gst_audio_information_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GUPnPDLNAGstAudioInformation *info =
+ GUPNP_DLNA_GST_AUDIO_INFORMATION (object);
+ GUPnPDLNAGstAudioInformationPrivate *priv = info->priv;
+
+ switch (property_id) {
+ case PROP_INFO:
+ gst_value_set_mini_object (value, GST_MINI_OBJECT (priv->info));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gupnp_dlna_gst_audio_information_class_init
+ (GUPnPDLNAGstAudioInformationClass *gst_info_class)
+{
+ GUPnPDLNAAudioInformationClass *info_class =
+ GUPNP_DLNA_AUDIO_INFORMATION_CLASS (gst_info_class);
+ GObjectClass *object_class = G_OBJECT_CLASS (gst_info_class);
+ GParamSpec *pspec;
+
+ object_class->get_property =
+ gupnp_dlna_gst_audio_information_get_property;
+ object_class->set_property =
+ gupnp_dlna_gst_audio_information_set_property;
+ object_class->dispose = gupnp_dlna_gst_audio_information_dispose;
+
+ info_class->get_bitrate = backend_get_bitrate;
+ info_class->get_channels = backend_get_channels;
+ info_class->get_depth = backend_get_depth;
+ info_class->get_layer = backend_get_layer;
+ info_class->get_level = backend_get_level;
+ info_class->get_mpeg_audio_version = backend_get_mpeg_audio_version;
+ info_class->get_mpeg_version = backend_get_mpeg_version;
+ info_class->get_profile = backend_get_profile;
+ info_class->get_rate = backend_get_rate;
+ info_class->get_stream_format = backend_get_stream_format;
+ info_class->get_wma_version = backend_get_wma_version;
+ info_class->get_mime = backend_get_mime;
+
+ pspec = gst_param_spec_mini_object ("info",
+ "info",
+ "discoverer info",
+ GST_TYPE_DISCOVERER_INFO,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT);
+ g_object_class_install_property (object_class,
+ PROP_INFO,
+ pspec);
+
+ g_type_class_add_private (gst_info_class,
+ sizeof (GUPnPDLNAGstAudioInformationPrivate));
+}
+
+static void
+gupnp_dlna_gst_audio_information_init (GUPnPDLNAGstAudioInformation *self)
+{
+ GUPnPDLNAGstAudioInformationPrivate *priv = G_TYPE_INSTANCE_GET_PRIVATE
+ (self,
+ GUPNP_TYPE_DLNA_GST_AUDIO_INFORMATION,
+ GUPnPDLNAGstAudioInformationPrivate);
+
+ priv->info = NULL;
+ priv->stream_list = NULL;
+ priv->audio_info = NULL;
+ priv->caps = NULL;
+ self->priv = priv;
+}
+
+GUPnPDLNAGstAudioInformation *
+gupnp_dlna_gst_audio_information_new_from_discoverer_info (GstDiscovererInfo *info)
+{
+ GList* audio_list;
+ GUPnPDLNAGstAudioInformation *audio_info = NULL;
+
+ g_return_val_if_fail (GST_IS_DISCOVERER_INFO (info), NULL);
+
+ audio_list = gst_discoverer_info_get_audio_streams (info);
+
+ if (audio_list) {
+ audio_info = GUPNP_DLNA_GST_AUDIO_INFORMATION (g_object_new
+ (GUPNP_TYPE_DLNA_GST_AUDIO_INFORMATION,
+ "info", info,
+ NULL));
+ gst_discoverer_stream_info_list_free (audio_list);
+ }
+
+ return audio_info;
+}
diff --git a/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-audio-information.h b/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-audio-information.h
new file mode 100644
index 0000000..612cdb5
--- /dev/null
+++ b/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-audio-information.h
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2012,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_AUDIO_INFORMATION_H__
+#define __GUPNP_DLNA_GST_AUDIO_INFORMATION_H__
+
+#include <glib-object.h>
+#include <gst/pbutils/pbutils.h>
+#include "gupnp-dlna-audio-information.h"
+
+G_BEGIN_DECLS
+
+#define GUPNP_TYPE_DLNA_GST_AUDIO_INFORMATION \
+ (gupnp_dlna_gst_audio_information_get_type())
+
+#define GUPNP_DLNA_GST_AUDIO_INFORMATION(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ GUPNP_TYPE_DLNA_GST_AUDIO_INFORMATION, \
+ GUPnPDLNAGstAudioInformation))
+
+#define GUPNP_DLNA_GST_AUDIO_INFORMATION_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ GUPNP_TYPE_DLNA_GST_AUDIO_INFORMATION, \
+ GUPnPDLNAGstAudioInformationClass))
+
+#define GUPNP_IS_DLNA_GST_AUDIO_INFORMATION(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ GUPNP_TYPE_DLNA_GST_AUDIO_INFORMATION))
+
+#define GUPNP_IS_DLNA_GST_AUDIO_INFORMATION_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ GUPNP_TYPE_DLNA_GST_AUDIO_INFORMATION))
+
+#define GUPNP_DLNA_GST_AUDIO_INFORMATION_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ GUPNP_TYPE_DLNA_GST_AUDIO_INFORMATION, \
+ GUPnPDLNAGstAudioInformationClass))
+
+typedef struct _GUPnPDLNAGstAudioInformationPrivate
+ GUPnPDLNAGstAudioInformationPrivate;
+
+typedef struct {
+ GUPnPDLNAAudioInformation parent;
+
+ GUPnPDLNAGstAudioInformationPrivate *priv;
+} GUPnPDLNAGstAudioInformation;
+
+typedef struct {
+ GUPnPDLNAAudioInformationClass parent_class;
+} GUPnPDLNAGstAudioInformationClass;
+
+GType
+gupnp_dlna_gst_audio_information_get_type (void);
+
+GUPnPDLNAGstAudioInformation *
+gupnp_dlna_gst_audio_information_new_from_discoverer_info
+ (GstDiscovererInfo *info);
+
+G_END_DECLS
+
+#endif /* __GUPNP_DLNA_GST_AUDIO_INFORMATION_H__ */
diff --git a/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-container-information.c b/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-container-information.c
new file mode 100644
index 0000000..ca983ec
--- /dev/null
+++ b/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-container-information.c
@@ -0,0 +1,296 @@
+/*
+ * Copyright (C) 2012,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H_ */
+#include "gupnp-dlna-gst-container-information.h"
+#include "gupnp-dlna-gst-info-utils.h"
+
+G_DEFINE_TYPE (GUPnPDLNAGstContainerInformation,
+ gupnp_dlna_gst_container_information,
+ GUPNP_TYPE_DLNA_CONTAINER_INFORMATION)
+
+struct _GUPnPDLNAGstContainerInformationPrivate {
+ GstDiscovererInfo *info;
+ GstDiscovererStreamInfo *container_info;
+ GstCaps *caps;
+};
+
+enum
+{
+ PROP_0,
+
+ PROP_INFO
+};
+
+static GstDiscovererStreamInfo *
+get_container_info (GUPnPDLNAGstContainerInformation *gst_info)
+{
+ GUPnPDLNAGstContainerInformationPrivate *priv = gst_info->priv;
+
+ if (!priv->container_info) {
+ priv->container_info =
+ gst_discoverer_info_get_stream_info (priv->info);
+ }
+
+ return priv->container_info;
+}
+
+static GstCaps *
+get_caps (GUPnPDLNAGstContainerInformation *gst_info)
+{
+ GUPnPDLNAGstContainerInformationPrivate *priv = gst_info->priv;
+
+ if (!priv->caps) {
+ priv->caps = gst_discoverer_stream_info_get_caps
+ (get_container_info (gst_info));
+ }
+
+ return priv->caps;
+}
+
+static GUPnPDLNAIntValue
+get_int_value (GUPnPDLNAGstContainerInformation *gst_info,
+ const gchar *name)
+{
+ GstCaps *caps = get_caps (gst_info);
+ GstDiscovererStreamInfo *stream = get_container_info (gst_info);
+ GstDiscovererInfo *info = gst_info->priv->info;
+
+ return gupnp_dlna_gst_get_int_value (caps, stream, info, name);
+}
+
+static GUPnPDLNAStringValue
+get_string_value (GUPnPDLNAGstContainerInformation *gst_info,
+ const gchar *name)
+{
+ GstCaps *caps = get_caps (gst_info);
+ GstDiscovererStreamInfo *stream = get_container_info (gst_info);
+ GstDiscovererInfo *info = gst_info->priv->info;
+
+ return gupnp_dlna_gst_get_string_value (caps, stream, info, name);
+}
+
+static GUPnPDLNABoolValue
+get_bool_value (GUPnPDLNAGstContainerInformation *gst_info,
+ const gchar *name)
+{
+ GstCaps *caps = get_caps (gst_info);
+ GstDiscovererStreamInfo *stream = get_container_info (gst_info);
+ GstDiscovererInfo *info = gst_info->priv->info;
+
+ return gupnp_dlna_gst_get_bool_value (caps, stream, info, name);
+}
+
+static GUPnPDLNAIntValue
+backend_get_mpeg_version (GUPnPDLNAContainerInformation *self)
+{
+ GUPnPDLNAGstContainerInformation* gst_info =
+ GUPNP_DLNA_GST_CONTAINER_INFORMATION (self);
+
+ return get_int_value (gst_info, "mpegversion");
+}
+
+static GUPnPDLNAIntValue
+backend_get_packet_size (GUPnPDLNAContainerInformation *self)
+{
+ GUPnPDLNAGstContainerInformation* gst_info =
+ GUPNP_DLNA_GST_CONTAINER_INFORMATION (self);
+
+ return get_int_value (gst_info, "packetsize");
+}
+
+static GUPnPDLNAStringValue
+backend_get_profile (GUPnPDLNAContainerInformation *self)
+{
+ GUPnPDLNAGstContainerInformation* gst_info =
+ GUPNP_DLNA_GST_CONTAINER_INFORMATION (self);
+
+ return get_string_value (gst_info, "profile");
+}
+
+static GUPnPDLNABoolValue
+backend_is_system_stream (GUPnPDLNAContainerInformation *self)
+{
+ GUPnPDLNAGstContainerInformation* gst_info =
+ GUPNP_DLNA_GST_CONTAINER_INFORMATION (self);
+
+ return get_bool_value (gst_info, "systemstream");
+}
+
+static GUPnPDLNAStringValue
+backend_get_variant (GUPnPDLNAContainerInformation *self)
+{
+ GUPnPDLNAGstContainerInformation* gst_info =
+ GUPNP_DLNA_GST_CONTAINER_INFORMATION (self);
+
+ return get_string_value (gst_info, "variant");
+}
+
+static GUPnPDLNAStringValue
+backend_get_mime (GUPnPDLNAContainerInformation *self)
+{
+ GUPnPDLNAGstContainerInformation* gst_info =
+ GUPNP_DLNA_GST_CONTAINER_INFORMATION (self);
+
+ return gupnp_dlna_gst_get_mime (get_caps (gst_info));
+}
+
+static void
+gupnp_dlna_gst_container_information_dispose (GObject *object)
+{
+ GUPnPDLNAGstContainerInformation *info =
+ GUPNP_DLNA_GST_CONTAINER_INFORMATION (object);
+ GUPnPDLNAGstContainerInformationPrivate *priv = info->priv;
+ GObjectClass *parent_class =
+ G_OBJECT_CLASS (gupnp_dlna_gst_container_information_parent_class);
+
+ g_clear_pointer (&priv->info, gupnp_dlna_gst_discoverer_info_unref);
+ g_clear_pointer (&priv->container_info,
+ gupnp_dlna_gst_discoverer_stream_info_unref);
+ g_clear_pointer (&priv->caps, gst_caps_unref);
+ parent_class->dispose (object);
+}
+
+static void
+gupnp_dlna_gst_container_information_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GUPnPDLNAGstContainerInformation *info =
+ GUPNP_DLNA_GST_CONTAINER_INFORMATION (object);
+ GUPnPDLNAGstContainerInformationPrivate *priv = info->priv;
+
+ switch (property_id) {
+ case PROP_INFO:
+ g_clear_pointer (&priv->info,
+ gupnp_dlna_gst_discoverer_info_unref);
+ priv->info =
+ GST_DISCOVERER_INFO (gst_value_dup_mini_object (value));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gupnp_dlna_gst_container_information_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GUPnPDLNAGstContainerInformation *info =
+ GUPNP_DLNA_GST_CONTAINER_INFORMATION (object);
+ GUPnPDLNAGstContainerInformationPrivate *priv = info->priv;
+
+ switch (property_id) {
+ case PROP_INFO:
+ gst_value_set_mini_object (value, GST_MINI_OBJECT (priv->info));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gupnp_dlna_gst_container_information_class_init
+ (GUPnPDLNAGstContainerInformationClass *gst_info_class)
+{
+ GUPnPDLNAContainerInformationClass *info_class =
+ GUPNP_DLNA_CONTAINER_INFORMATION_CLASS (gst_info_class);
+ GObjectClass *object_class = G_OBJECT_CLASS (gst_info_class);
+ GParamSpec *pspec;
+
+ object_class->get_property =
+ gupnp_dlna_gst_container_information_get_property;
+ object_class->set_property =
+ gupnp_dlna_gst_container_information_set_property;
+ object_class->dispose = gupnp_dlna_gst_container_information_dispose;
+
+ info_class->get_mpeg_version = backend_get_mpeg_version;
+ info_class->get_packet_size = backend_get_packet_size;
+ info_class->get_profile = backend_get_profile;
+ info_class->is_system_stream = backend_is_system_stream;
+ info_class->get_variant = backend_get_variant;
+ info_class->get_mime = backend_get_mime;
+
+ pspec = gst_param_spec_mini_object ("info",
+ "info",
+ "discoverer info",
+ GST_TYPE_DISCOVERER_INFO,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT);
+ g_object_class_install_property (object_class,
+ PROP_INFO,
+ pspec);
+
+ g_type_class_add_private
+ (gst_info_class,
+ sizeof (GUPnPDLNAGstContainerInformationPrivate));
+}
+
+static void
+gupnp_dlna_gst_container_information_init
+ (GUPnPDLNAGstContainerInformation *self)
+{
+ GUPnPDLNAGstContainerInformationPrivate *priv =
+ G_TYPE_INSTANCE_GET_PRIVATE
+ (self,
+ GUPNP_TYPE_DLNA_GST_CONTAINER_INFORMATION,
+ GUPnPDLNAGstContainerInformationPrivate);
+
+ priv->info = NULL;
+ priv->container_info = NULL;
+ priv->caps = NULL;
+ self->priv = priv;
+}
+
+GUPnPDLNAGstContainerInformation *
+gupnp_dlna_gst_container_information_new_from_discoverer_info
+ (GstDiscovererInfo *info)
+{
+ GUPnPDLNAGstContainerInformation *container_info = NULL;
+ GstDiscovererStreamInfo *stream_info;
+
+ g_return_val_if_fail (GST_IS_DISCOVERER_INFO (info), NULL);
+
+ stream_info = gst_discoverer_info_get_stream_info (info);
+
+ if (stream_info) {
+ GType type = G_TYPE_FROM_INSTANCE (stream_info);
+
+ if (type == GST_TYPE_DISCOVERER_CONTAINER_INFO)
+ container_info = GUPNP_DLNA_GST_CONTAINER_INFORMATION
+ (g_object_new
+ (GUPNP_TYPE_DLNA_GST_CONTAINER_INFORMATION,
+ "info", info,
+ NULL));
+ gst_discoverer_stream_info_unref (stream_info);
+ }
+
+ return container_info;
+}
diff --git a/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-container-information.h b/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-container-information.h
new file mode 100644
index 0000000..775253d
--- /dev/null
+++ b/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-container-information.h
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2012,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_CONTAINER_INFORMATION_H__
+#define __GUPNP_DLNA_GST_CONTAINER_INFORMATION_H__
+
+#include <glib-object.h>
+#include <gst/pbutils/pbutils.h>
+#include "gupnp-dlna-container-information.h"
+
+G_BEGIN_DECLS
+
+#define GUPNP_TYPE_DLNA_GST_CONTAINER_INFORMATION \
+ (gupnp_dlna_gst_container_information_get_type())
+
+#define GUPNP_DLNA_GST_CONTAINER_INFORMATION(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), \
+ GUPNP_TYPE_DLNA_GST_CONTAINER_INFORMATION, \
+ GUPnPDLNAGstContainerInformation))
+
+#define GUPNP_DLNA_GST_CONTAINER_INFORMATION_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ GUPNP_TYPE_DLNA_GST_CONTAINER_INFORMATION, \
+ GUPnPDLNAGstContainerInformationClass))
+
+#define GUPNP_IS_DLNA_GST_CONTAINER_INFORMATION(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ GUPNP_TYPE_DLNA_GST_CONTAINER_INFORMATION))
+
+#define GUPNP_IS_DLNA_GST_CONTAINER_INFORMATION_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ GUPNP_TYPE_DLNA_GST_CONTAINER_INFORMATION))
+
+#define GUPNP_DLNA_GST_CONTAINER_INFORMATION_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ GUPNP_TYPE_DLNA_GST_CONTAINER_INFORMATION, \
+ GUPnPDLNAGstContainerInformationClass))
+
+typedef struct _GUPnPDLNAGstContainerInformationPrivate
+ GUPnPDLNAGstContainerInformationPrivate;
+
+typedef struct {
+ GUPnPDLNAContainerInformation parent;
+
+ GUPnPDLNAGstContainerInformationPrivate *priv;
+} GUPnPDLNAGstContainerInformation;
+
+typedef struct {
+ GUPnPDLNAContainerInformationClass parent_class;
+} GUPnPDLNAGstContainerInformationClass;
+
+GType
+gupnp_dlna_gst_container_information_get_type (void);
+
+GUPnPDLNAGstContainerInformation *
+gupnp_dlna_gst_container_information_new_from_discoverer_info
+ (GstDiscovererInfo *info);
+
+G_END_DECLS
+
+#endif /* __GUPNP_DLNA_GST_CONTAINER_INFORMATION_H__ */
diff --git a/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-image-information.c b/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-image-information.c
new file mode 100644
index 0000000..d5d72f5
--- /dev/null
+++ b/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-image-information.c
@@ -0,0 +1,286 @@
+/*
+ * Copyright (C) 2012,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H_ */
+#include "gupnp-dlna-gst-image-information.h"
+#include "gupnp-dlna-gst-info-utils.h"
+
+G_DEFINE_TYPE (GUPnPDLNAGstImageInformation,
+ gupnp_dlna_gst_image_information,
+ GUPNP_TYPE_DLNA_IMAGE_INFORMATION)
+
+struct _GUPnPDLNAGstImageInformationPrivate {
+ GstDiscovererInfo *info;
+ GList *stream_list;
+ GstDiscovererVideoInfo *image_info;
+ GstCaps *caps;
+};
+
+enum
+{
+ PROP_0,
+
+ PROP_INFO
+};
+
+static GstDiscovererVideoInfo *
+get_image_info (GUPnPDLNAGstImageInformation *gst_info)
+{
+ GUPnPDLNAGstImageInformationPrivate *priv = gst_info->priv;
+
+ if (!priv->image_info) {
+ GList *iter;
+
+ if (!priv->stream_list) {
+ priv->stream_list =
+ gst_discoverer_info_get_stream_list (priv->info);
+ if (!priv->stream_list)
+ return NULL;
+ }
+
+ for (iter = priv->stream_list; iter; iter = iter->next) {
+ GstDiscovererStreamInfo *stream =
+ GST_DISCOVERER_STREAM_INFO (iter->data);
+ GType stream_type = G_TYPE_FROM_INSTANCE (stream);
+
+ if (stream_type == GST_TYPE_DISCOVERER_VIDEO_INFO) {
+ priv->image_info =
+ GST_DISCOVERER_VIDEO_INFO (stream);
+
+ break;
+ }
+ }
+ }
+
+ return priv->image_info;
+}
+
+static GstCaps *
+get_caps (GUPnPDLNAGstImageInformation *gst_info)
+{
+ GUPnPDLNAGstImageInformationPrivate *priv = gst_info->priv;
+
+ if (!priv->caps)
+ priv->caps = gst_discoverer_stream_info_get_caps
+ (GST_DISCOVERER_STREAM_INFO
+ (get_image_info (gst_info)));
+
+ return priv->caps;
+}
+
+static GUPnPDLNAIntValue
+backend_get_depth (GUPnPDLNAImageInformation *self)
+{
+ GUPnPDLNAGstImageInformation *gst_info =
+ GUPNP_DLNA_GST_IMAGE_INFORMATION (self);
+ GstDiscovererVideoInfo *image_info = get_image_info (gst_info);
+ guint data = gst_discoverer_video_info_get_depth (image_info);
+ GUPnPDLNAIntValue value = GUPNP_DLNA_INT_VALUE_UNSET;
+
+ if (data > 0 && data <= G_MAXINT) {
+ value.state = GUPNP_DLNA_VALUE_STATE_SET;
+ value.value = (gint) data;
+ }
+
+ return value;
+}
+
+static GUPnPDLNAIntValue
+backend_get_height (GUPnPDLNAImageInformation *self)
+{
+ GUPnPDLNAGstImageInformation* gst_info =
+ GUPNP_DLNA_GST_IMAGE_INFORMATION (self);
+ GstDiscovererVideoInfo *image_info = get_image_info (gst_info);
+ guint data = gst_discoverer_video_info_get_height (image_info);
+ GUPnPDLNAIntValue value = GUPNP_DLNA_INT_VALUE_UNSET;
+
+ if (data > 0 && data <= G_MAXINT) {
+ value.state = GUPNP_DLNA_VALUE_STATE_SET;
+ value.value = (gint) data;
+ }
+
+ return value;
+}
+
+static GUPnPDLNAIntValue
+backend_get_width (GUPnPDLNAImageInformation *self)
+{
+ GUPnPDLNAGstImageInformation* gst_info =
+ GUPNP_DLNA_GST_IMAGE_INFORMATION (self);
+ GstDiscovererVideoInfo *image_info = get_image_info (gst_info);
+ guint data = gst_discoverer_video_info_get_width (image_info);
+ GUPnPDLNAIntValue value = GUPNP_DLNA_INT_VALUE_UNSET;
+
+ if (data > 0 && data <= G_MAXINT) {
+ value.state = GUPNP_DLNA_VALUE_STATE_SET;
+ value.value = (gint) data;
+ }
+
+ return value;
+}
+
+static GUPnPDLNAStringValue
+backend_get_mime (GUPnPDLNAImageInformation *self)
+{
+ GUPnPDLNAGstImageInformation* gst_info =
+ GUPNP_DLNA_GST_IMAGE_INFORMATION (self);
+
+ return gupnp_dlna_gst_get_mime (get_caps (gst_info));
+}
+
+static void
+gupnp_dlna_gst_image_information_dispose (GObject *object)
+{
+ GUPnPDLNAGstImageInformation *info =
+ GUPNP_DLNA_GST_IMAGE_INFORMATION (object);
+ GUPnPDLNAGstImageInformationPrivate *priv = info->priv;
+ GObjectClass *parent_class =
+ G_OBJECT_CLASS (gupnp_dlna_gst_image_information_parent_class);
+ g_clear_pointer (&priv->info, gupnp_dlna_gst_discoverer_info_unref);
+ g_clear_pointer (&priv->stream_list,
+ gst_discoverer_stream_info_list_free);
+ /* priv->image_info is freed with stream list above */
+ priv->image_info = NULL;
+ g_clear_pointer (&priv->caps, gst_caps_unref);
+ parent_class->dispose (object);
+}
+
+static void
+gupnp_dlna_gst_image_information_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GUPnPDLNAGstImageInformation *info =
+ GUPNP_DLNA_GST_IMAGE_INFORMATION (object);
+ GUPnPDLNAGstImageInformationPrivate *priv = info->priv;
+
+ switch (property_id) {
+ case PROP_INFO:
+ g_clear_pointer (&priv->info,
+ gupnp_dlna_gst_discoverer_info_unref);
+ priv->info =
+ GST_DISCOVERER_INFO (gst_value_dup_mini_object (value));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gupnp_dlna_gst_image_information_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GUPnPDLNAGstImageInformation *info =
+ GUPNP_DLNA_GST_IMAGE_INFORMATION (object);
+ GUPnPDLNAGstImageInformationPrivate *priv = info->priv;
+
+ switch (property_id) {
+ case PROP_INFO:
+ gst_value_set_mini_object (value, GST_MINI_OBJECT (priv->info));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gupnp_dlna_gst_image_information_class_init
+ (GUPnPDLNAGstImageInformationClass *gst_info_class)
+{
+ GUPnPDLNAImageInformationClass *info_class =
+ GUPNP_DLNA_IMAGE_INFORMATION_CLASS (gst_info_class);
+ GObjectClass *object_class = G_OBJECT_CLASS (gst_info_class);
+ GParamSpec *pspec;
+
+ object_class->get_property =
+ gupnp_dlna_gst_image_information_get_property;
+ object_class->set_property =
+ gupnp_dlna_gst_image_information_set_property;
+ object_class->dispose = gupnp_dlna_gst_image_information_dispose;
+
+ info_class->get_depth = backend_get_depth;
+ info_class->get_height = backend_get_height;
+ info_class->get_width = backend_get_width;
+ info_class->get_mime = backend_get_mime;
+
+ pspec = gst_param_spec_mini_object ("info",
+ "info",
+ "discoverer info",
+ GST_TYPE_DISCOVERER_INFO,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT);
+ g_object_class_install_property (object_class,
+ PROP_INFO,
+ pspec);
+
+ g_type_class_add_private (gst_info_class,
+ sizeof (GUPnPDLNAGstImageInformationPrivate));
+}
+
+static void
+gupnp_dlna_gst_image_information_init (GUPnPDLNAGstImageInformation *self)
+{
+ GUPnPDLNAGstImageInformationPrivate *priv = G_TYPE_INSTANCE_GET_PRIVATE
+ (self,
+ GUPNP_TYPE_DLNA_GST_IMAGE_INFORMATION,
+ GUPnPDLNAGstImageInformationPrivate);
+
+ priv->info = NULL;
+ priv->stream_list = NULL;
+ priv->image_info = NULL;
+ priv->caps = NULL;
+ self->priv = priv;
+}
+
+GUPnPDLNAGstImageInformation *
+gupnp_dlna_gst_image_information_new_from_discoverer_info
+ (GstDiscovererInfo *info)
+{
+ GList* image_list;
+ GUPnPDLNAGstImageInformation *image_info = NULL;
+
+ g_return_val_if_fail (GST_IS_DISCOVERER_INFO (info), NULL);
+
+ image_list = gst_discoverer_info_get_video_streams (info);
+
+ if (image_list) {
+ if ((image_list->next == NULL) &&
+ gst_discoverer_video_info_is_image
+ (GST_DISCOVERER_VIDEO_INFO (image_list->data)))
+ image_info = GUPNP_DLNA_GST_IMAGE_INFORMATION
+ (g_object_new
+ (GUPNP_TYPE_DLNA_GST_IMAGE_INFORMATION,
+ "info", info,
+ NULL));
+ gst_discoverer_stream_info_list_free (image_list);
+ }
+
+ return image_info;
+}
diff --git a/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-image-information.h b/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-image-information.h
new file mode 100644
index 0000000..b6dcfc3
--- /dev/null
+++ b/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-image-information.h
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2012,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_IMAGE_INFORMATION_H__
+#define __GUPNP_DLNA_GST_IMAGE_INFORMATION_H__
+
+#include <glib-object.h>
+#include <gst/pbutils/pbutils.h>
+#include "gupnp-dlna-image-information.h"
+
+G_BEGIN_DECLS
+
+#define GUPNP_TYPE_DLNA_GST_IMAGE_INFORMATION \
+ (gupnp_dlna_gst_image_information_get_type())
+
+#define GUPNP_DLNA_GST_IMAGE_INFORMATION(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ GUPNP_TYPE_DLNA_GST_IMAGE_INFORMATION, \
+ GUPnPDLNAGstImageInformation))
+
+#define GUPNP_DLNA_GST_IMAGE_INFORMATION_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ GUPNP_TYPE_DLNA_GST_IMAGE_INFORMATION, \
+ GUPnPDLNAGstImageInformationClass))
+
+#define GUPNP_IS_DLNA_GST_IMAGE_INFORMATION(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ GUPNP_TYPE_DLNA_GST_IMAGE_INFORMATION))
+
+#define GUPNP_IS_DLNA_GST_IMAGE_INFORMATION_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ GUPNP_TYPE_DLNA_GST_IMAGE_INFORMATION))
+
+#define GUPNP_DLNA_GST_IMAGE_INFORMATION_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ GUPNP_TYPE_DLNA_GST_IMAGE_INFORMATION, \
+ GUPnPDLNAGstImageInformationClass))
+
+typedef struct _GUPnPDLNAGstImageInformationPrivate
+ GUPnPDLNAGstImageInformationPrivate;
+
+typedef struct {
+ GUPnPDLNAImageInformation parent;
+
+ GUPnPDLNAGstImageInformationPrivate *priv;
+} GUPnPDLNAGstImageInformation;
+
+typedef struct {
+ GUPnPDLNAImageInformationClass parent_class;
+} GUPnPDLNAGstImageInformationClass;
+
+GType
+gupnp_dlna_gst_image_information_get_type (void);
+
+GUPnPDLNAGstImageInformation *
+gupnp_dlna_gst_image_information_new_from_discoverer_info
+ (GstDiscovererInfo *info);
+
+G_END_DECLS
+
+#endif /* __GUPNP_DLNA_GST_IMAGE_INFORMATION_H__ */
diff --git a/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-info-utils.c b/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-info-utils.c
new file mode 100644
index 0000000..b4498e3
--- /dev/null
+++ b/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-info-utils.c
@@ -0,0 +1,430 @@
+/*
+ * Copyright (C) 2012,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-info-utils.h"
+
+void
+gupnp_dlna_gst_discoverer_info_unref (gpointer info)
+{
+ gst_discoverer_info_unref (info);
+}
+
+void
+gupnp_dlna_gst_discoverer_stream_info_unref (gpointer stream)
+{
+ gst_discoverer_stream_info_unref (stream);
+}
+
+static GUPnPDLNAStringValue
+get_string_value_from_structure (const GstStructure *st,
+ const gchar *name)
+{
+ GUPnPDLNAStringValue value = GUPNP_DLNA_STRING_VALUE_UNSET;
+
+ if (st != NULL) {
+ const gchar* data = gst_structure_get_string (st, name);
+
+ if (data != NULL) {
+ value.state = GUPNP_DLNA_VALUE_STATE_SET;
+ value.value = g_strdup (data);
+ }
+ }
+
+ return value;
+}
+
+static GUPnPDLNAStringValue
+get_string_value_from_tag_list (const GstTagList *tags,
+ const gchar *name)
+{
+ GUPnPDLNAStringValue value = GUPNP_DLNA_STRING_VALUE_UNSET;
+
+ if (tags != NULL) {
+ const GValue *g_value = gst_tag_list_get_value_index (tags,
+ name,
+ 0);
+
+ if (g_value != NULL && G_VALUE_HOLDS_STRING (g_value)) {
+ value.state = GUPNP_DLNA_VALUE_STATE_SET;
+ value.value = g_value_dup_string (g_value);
+ }
+ }
+
+ return value;
+}
+
+static GUPnPDLNAIntValue
+get_int_value_from_structure (const GstStructure *st,
+ const gchar *name)
+{
+ GUPnPDLNAIntValue value = GUPNP_DLNA_INT_VALUE_UNSET;
+
+ if (st != NULL) {
+ gint idata;
+ guint udata;
+
+ if (gst_structure_get_int (st, name, &idata)) {
+ value.state = GUPNP_DLNA_VALUE_STATE_SET;
+ value.value = idata;
+ } else if (gst_structure_get_uint (st, name, &udata)) {
+ value.state = GUPNP_DLNA_VALUE_STATE_SET;
+ value.value = (gint) udata;
+ }
+ }
+
+ return value;
+}
+
+static GUPnPDLNAIntValue
+get_int_value_from_tag_list (const GstTagList *tags,
+ const gchar *name)
+{
+ GUPnPDLNAIntValue value = GUPNP_DLNA_INT_VALUE_UNSET;
+
+ if (tags != NULL) {
+ const GValue *g_value = gst_tag_list_get_value_index (tags,
+ name,
+ 0);
+
+ if (g_value != NULL) {
+ if (G_VALUE_HOLDS_INT (g_value)) {
+ value.state = GUPNP_DLNA_VALUE_STATE_SET;
+ value.value = g_value_get_int (g_value);
+ } else if (G_VALUE_HOLDS_UINT (g_value)) {
+ value.state = GUPNP_DLNA_VALUE_STATE_SET;
+ value.value = g_value_get_uint (g_value);
+ }
+ }
+ }
+
+ return value;
+}
+
+static GUPnPDLNABoolValue
+get_bool_value_from_structure (const GstStructure *st,
+ const gchar *name)
+{
+ GUPnPDLNABoolValue value = GUPNP_DLNA_BOOL_VALUE_UNSET;
+
+ if (st != NULL) {
+ gboolean data;
+
+ if (gst_structure_get_boolean (st, name, &data)) {
+ value.state = GUPNP_DLNA_VALUE_STATE_SET;
+ value.value = data;
+ }
+ }
+
+ return value;
+}
+
+static GUPnPDLNABoolValue
+get_bool_value_from_tag_list (const GstTagList *tags,
+ const gchar *name)
+{
+ GUPnPDLNABoolValue value = GUPNP_DLNA_BOOL_VALUE_UNSET;
+
+ if (tags != NULL) {
+ const GValue *g_value = gst_tag_list_get_value_index (tags,
+ name,
+ 0);
+
+ if (g_value != NULL && G_VALUE_HOLDS_BOOLEAN (g_value)) {
+ value.state = GUPNP_DLNA_VALUE_STATE_SET;
+ value.value = g_value_get_boolean (g_value);
+ }
+ }
+
+ return value;
+}
+
+static GUPnPDLNAFractionValue
+get_fraction_value_from_structure (const GstStructure *st,
+ const gchar *name)
+{
+ GUPnPDLNAFractionValue value = GUPNP_DLNA_FRACTION_VALUE_UNSET;
+
+ if (st != NULL) {
+ gint ndata;
+ gint ddata;
+
+ if (gst_structure_get_fraction (st, name, &ndata, &ddata)) {
+ value.state = GUPNP_DLNA_VALUE_STATE_SET;
+ value.numerator = ndata;
+ value.denominator = ddata;
+ }
+ }
+
+ return value;
+}
+
+static GUPnPDLNAFractionValue
+get_fraction_value_from_tag_list (const GstTagList *tags,
+ const gchar *name)
+{
+ GUPnPDLNAFractionValue value = GUPNP_DLNA_FRACTION_VALUE_UNSET;
+
+ if (tags != NULL) {
+ const GValue *g_value = gst_tag_list_get_value_index (tags,
+ name,
+ 0);
+
+ if (g_value != NULL && GST_VALUE_HOLDS_FRACTION (g_value)) {
+ value.state = GUPNP_DLNA_VALUE_STATE_SET;
+ value.numerator =
+ gst_value_get_fraction_numerator (g_value);
+ value.denominator =
+ gst_value_get_fraction_denominator (g_value);
+ }
+ }
+
+ return value;
+}
+
+GUPnPDLNAIntValue
+gupnp_dlna_gst_get_int_value (GstCaps* caps,
+ GstDiscovererStreamInfo *stream,
+ GstDiscovererInfo *info,
+ const gchar *name)
+{
+ GUPnPDLNAIntValue value = GUPNP_DLNA_INT_VALUE_UNSET;
+
+ if (caps != NULL) {
+ guint caps_size = gst_caps_get_size (caps);
+ guint iter;
+
+ for (iter = 0; iter < caps_size; ++iter) {
+ const GstStructure *st = gst_caps_get_structure (caps,
+ iter);
+
+ value = get_int_value_from_structure (st, name);
+ if (value.state == GUPNP_DLNA_VALUE_STATE_SET)
+ return value;
+ }
+ }
+
+ if (stream != NULL) {
+ const GstStructure *st =
+ gst_discoverer_stream_info_get_misc (stream);
+
+ value = get_int_value_from_structure (st, name);
+ if (value.state == GUPNP_DLNA_VALUE_STATE_SET)
+ return value;
+ }
+
+ if (info != NULL) {
+ const GstStructure *st = gst_discoverer_info_get_misc (info);
+
+ value = get_int_value_from_structure (st, name);
+ if (value.state == GUPNP_DLNA_VALUE_STATE_SET)
+ return value;
+ }
+
+ if (stream != NULL) {
+ const GstTagList *tags =
+ gst_discoverer_stream_info_get_tags (stream);
+
+ value = get_int_value_from_tag_list (tags, name);
+ if (value.state == GUPNP_DLNA_VALUE_STATE_SET)
+ return value;
+ }
+
+ return value;
+}
+
+GUPnPDLNAStringValue
+gupnp_dlna_gst_get_string_value (GstCaps* caps,
+ GstDiscovererStreamInfo *stream,
+ GstDiscovererInfo *info,
+ const gchar *name)
+{
+ GUPnPDLNAStringValue value = GUPNP_DLNA_STRING_VALUE_UNSET;
+
+ if (caps != NULL) {
+ guint caps_size = gst_caps_get_size (caps);
+ guint iter;
+
+ for (iter = 0; iter < caps_size; ++iter) {
+ const GstStructure *st = gst_caps_get_structure (caps,
+ iter);
+
+ value = get_string_value_from_structure (st, name);
+ if (value.state == GUPNP_DLNA_VALUE_STATE_SET)
+ return value;
+ }
+ }
+
+ if (stream != NULL) {
+ const GstStructure *st =
+ gst_discoverer_stream_info_get_misc (stream);
+
+ value = get_string_value_from_structure (st, name);
+ if (value.state == GUPNP_DLNA_VALUE_STATE_SET)
+ return value;
+ }
+
+ if (info != NULL) {
+ const GstStructure *st = gst_discoverer_info_get_misc (info);
+
+ value = get_string_value_from_structure (st, name);
+ if (value.state == GUPNP_DLNA_VALUE_STATE_SET)
+ return value;
+ }
+
+ if (stream != NULL) {
+ const GstTagList *tags =
+ gst_discoverer_stream_info_get_tags (stream);
+
+ value = get_string_value_from_tag_list (tags, name);
+ if (value.state == GUPNP_DLNA_VALUE_STATE_SET)
+ return value;
+ }
+
+ return value;
+}
+
+GUPnPDLNABoolValue
+gupnp_dlna_gst_get_bool_value (GstCaps* caps,
+ GstDiscovererStreamInfo *stream,
+ GstDiscovererInfo *info,
+ const gchar *name)
+{
+ GUPnPDLNABoolValue value = GUPNP_DLNA_BOOL_VALUE_UNSET;
+
+ if (caps != NULL) {
+ guint caps_size = gst_caps_get_size (caps);
+ guint iter;
+
+ for (iter = 0; iter < caps_size; ++iter) {
+ const GstStructure *st = gst_caps_get_structure (caps,
+ iter);
+
+ value = get_bool_value_from_structure (st, name);
+ if (value.state == GUPNP_DLNA_VALUE_STATE_SET)
+ return value;
+ }
+ }
+
+ if (stream != NULL) {
+ const GstStructure *st =
+ gst_discoverer_stream_info_get_misc (stream);
+
+ value = get_bool_value_from_structure (st, name);
+ if (value.state == GUPNP_DLNA_VALUE_STATE_SET)
+ return value;
+ }
+
+ if (info != NULL) {
+ const GstStructure *st = gst_discoverer_info_get_misc (info);
+
+ value = get_bool_value_from_structure (st, name);
+ if (value.state == GUPNP_DLNA_VALUE_STATE_SET)
+ return value;
+ }
+
+ if (stream != NULL) {
+ const GstTagList *tags =
+ gst_discoverer_stream_info_get_tags (stream);
+
+ value = get_bool_value_from_tag_list (tags, name);
+ if (value.state == GUPNP_DLNA_VALUE_STATE_SET)
+ return value;
+ }
+
+ return value;
+}
+
+GUPnPDLNAFractionValue
+gupnp_dlna_gst_get_fraction_value (GstCaps* caps,
+ GstDiscovererStreamInfo *stream,
+ GstDiscovererInfo *info,
+ const gchar *name)
+{
+ GUPnPDLNAFractionValue value = GUPNP_DLNA_FRACTION_VALUE_UNSET;
+
+ if (caps != NULL) {
+ guint caps_size = gst_caps_get_size (caps);
+ guint iter;
+
+ for (iter = 0; iter < caps_size; ++iter) {
+ const GstStructure *st = gst_caps_get_structure (caps,
+ iter);
+
+ value = get_fraction_value_from_structure (st, name);
+ if (value.state == GUPNP_DLNA_VALUE_STATE_SET)
+ return value;
+ }
+ }
+
+ if (stream != NULL) {
+ const GstStructure *st =
+ gst_discoverer_stream_info_get_misc (stream);
+
+ value = get_fraction_value_from_structure (st, name);
+ if (value.state == GUPNP_DLNA_VALUE_STATE_SET)
+ return value;
+ }
+
+ if (info != NULL) {
+ const GstStructure *st = gst_discoverer_info_get_misc (info);
+
+ value = get_fraction_value_from_structure (st, name);
+ if (value.state == GUPNP_DLNA_VALUE_STATE_SET)
+ return value;
+ }
+
+ if (stream != NULL) {
+ const GstTagList *tags =
+ gst_discoverer_stream_info_get_tags (stream);
+
+ value = get_fraction_value_from_tag_list (tags, name);
+ if (value.state == GUPNP_DLNA_VALUE_STATE_SET)
+ return value;
+ }
+
+ return value;
+}
+
+GUPnPDLNAStringValue
+gupnp_dlna_gst_get_mime (GstCaps* caps)
+{
+ GUPnPDLNAStringValue value = GUPNP_DLNA_STRING_VALUE_UNSET;
+ guint count = gst_caps_get_size (caps);
+ guint iter;
+
+ for (iter = 0; iter < count; ++iter) {
+ const GstStructure *st = gst_caps_get_structure (caps, iter);
+
+ if (st != NULL) {
+ const gchar *name = gst_structure_get_name (st);
+
+ /* just in case */
+ if (name != NULL && name[0] != '\0') {
+ value.state = GUPNP_DLNA_VALUE_STATE_SET;
+ value.value = g_strdup (name);
+
+ break;
+ }
+ }
+ }
+
+ return value;
+}
diff --git a/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-info-utils.h b/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-info-utils.h
new file mode 100644
index 0000000..ec5265b
--- /dev/null
+++ b/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-info-utils.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2012,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_INFO_UTILS_H__
+#define __GUPNP_DLNA_GST_INFO_UTILS_H__
+
+#include <glib.h>
+#include <gst/pbutils/pbutils.h>
+#include "gupnp-dlna-values.h"
+
+G_BEGIN_DECLS
+
+/* some unref functions are macros, so we wrap them into functions,
+ because we want to pass them to g_clear_pointer. */
+void
+gupnp_dlna_gst_discoverer_info_unref (gpointer info);
+
+void
+gupnp_dlna_gst_discoverer_stream_info_unref (gpointer stream);
+
+GUPnPDLNAIntValue
+gupnp_dlna_gst_get_int_value (GstCaps* caps,
+ GstDiscovererStreamInfo *stream,
+ GstDiscovererInfo *info,
+ const gchar *name);
+
+GUPnPDLNAStringValue
+gupnp_dlna_gst_get_string_value (GstCaps* caps,
+ GstDiscovererStreamInfo *stream,
+ GstDiscovererInfo *info,
+ const gchar *name);
+
+GUPnPDLNABoolValue
+gupnp_dlna_gst_get_bool_value (GstCaps* caps,
+ GstDiscovererStreamInfo *stream,
+ GstDiscovererInfo *info,
+ const gchar *name);
+
+GUPnPDLNAFractionValue
+gupnp_dlna_gst_get_fraction_value (GstCaps* caps,
+ GstDiscovererStreamInfo *stream,
+ GstDiscovererInfo *info,
+ const gchar *name);
+
+GUPnPDLNAStringValue
+gupnp_dlna_gst_get_mime (GstCaps* caps);
+
+G_END_DECLS
+
+#endif /* __GUPNP_DLNA_GST_INFO_UTILS_H__ */
diff --git a/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-information.c b/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-information.c
new file mode 100644
index 0000000..5014ffe
--- /dev/null
+++ b/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-information.c
@@ -0,0 +1,212 @@
+/*
+ * Copyright (C) 2012,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H_ */
+#include "gupnp-dlna-gst-information.h"
+#include "gupnp-dlna-gst-info-utils.h"
+#include "gupnp-dlna-gst-audio-information.h"
+#include "gupnp-dlna-gst-container-information.h"
+#include "gupnp-dlna-gst-image-information.h"
+#include "gupnp-dlna-gst-video-information.h"
+
+G_DEFINE_TYPE (GUPnPDLNAGstInformation,
+ gupnp_dlna_gst_information,
+ GUPNP_TYPE_DLNA_INFORMATION)
+
+struct _GUPnPDLNAGstInformationPrivate {
+ GstDiscovererInfo* info;
+};
+
+enum {
+ PROP_0,
+
+ PROP_INFO
+};
+
+static void
+gupnp_dlna_gst_information_dispose (GObject *object)
+{
+ GUPnPDLNAGstInformation *info = GUPNP_DLNA_GST_INFORMATION (object);
+ GUPnPDLNAGstInformationPrivate *priv = info->priv;
+
+ g_clear_pointer (&priv->info, gupnp_dlna_gst_discoverer_info_unref);
+ G_OBJECT_CLASS
+ (gupnp_dlna_gst_information_parent_class)->dispose (object);
+}
+
+static void
+gupnp_dlna_gst_information_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GUPnPDLNAGstInformation *info = GUPNP_DLNA_GST_INFORMATION (object);
+ GUPnPDLNAGstInformationPrivate *priv = info->priv;
+
+ switch (property_id) {
+ case PROP_INFO:
+ g_clear_pointer (&priv->info,
+ gupnp_dlna_gst_discoverer_info_unref);
+ priv->info =
+ GST_DISCOVERER_INFO (gst_value_dup_mini_object (value));
+
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+
+ break;
+ }
+}
+
+static void
+gupnp_dlna_gst_information_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GUPnPDLNAGstInformation *info = GUPNP_DLNA_GST_INFORMATION (object);
+ GUPnPDLNAGstInformationPrivate *priv = info->priv;
+
+ switch (property_id) {
+ case PROP_INFO:
+ gst_value_set_mini_object (value, GST_MINI_OBJECT (priv->info));
+
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+
+ break;
+ }
+}
+
+GUPnPDLNAAudioInformation *
+backend_get_audio_information (GUPnPDLNAInformation *self)
+{
+ GUPnPDLNAGstInformation *gst_info = GUPNP_DLNA_GST_INFORMATION (self);
+
+ if (gst_info == NULL)
+ return NULL;
+
+ return GUPNP_DLNA_AUDIO_INFORMATION
+ (gupnp_dlna_gst_audio_information_new_from_discoverer_info
+ (gst_info->priv->info));
+}
+
+GUPnPDLNAContainerInformation *
+backend_get_container_information (GUPnPDLNAInformation *self)
+{
+ GUPnPDLNAGstInformation *gst_info = GUPNP_DLNA_GST_INFORMATION (self);
+
+ if (gst_info == NULL)
+ return NULL;
+
+ return GUPNP_DLNA_CONTAINER_INFORMATION
+ (gupnp_dlna_gst_container_information_new_from_discoverer_info
+ (gst_info->priv->info));
+}
+
+GUPnPDLNAImageInformation *
+backend_get_image_information (GUPnPDLNAInformation *self)
+{
+ GUPnPDLNAGstInformation *gst_info = GUPNP_DLNA_GST_INFORMATION (self);
+
+ return GUPNP_DLNA_IMAGE_INFORMATION
+ (gupnp_dlna_gst_image_information_new_from_discoverer_info
+ (gst_info->priv->info));
+}
+
+GUPnPDLNAVideoInformation *
+backend_get_video_information (GUPnPDLNAInformation *self)
+{
+ GUPnPDLNAGstInformation *gst_info = GUPNP_DLNA_GST_INFORMATION (self);
+
+ return GUPNP_DLNA_VIDEO_INFORMATION
+ (gupnp_dlna_gst_video_information_new_from_discoverer_info
+ (gst_info->priv->info));
+}
+
+static void
+gupnp_dlna_gst_information_class_init
+ (GUPnPDLNAGstInformationClass *gst_info_class)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (gst_info_class);
+ GUPnPDLNAInformationClass *info_class =
+ GUPNP_DLNA_INFORMATION_CLASS (gst_info_class);
+ GParamSpec *pspec;
+
+ object_class->dispose = gupnp_dlna_gst_information_dispose;
+ object_class->set_property = gupnp_dlna_gst_information_set_property;
+ object_class->get_property = gupnp_dlna_gst_information_get_property;
+ info_class->get_audio_information = backend_get_audio_information;
+ info_class->get_container_information =
+ backend_get_container_information;
+ info_class->get_image_information = backend_get_image_information;
+ info_class->get_video_information = backend_get_video_information;
+
+ pspec = gst_param_spec_mini_object ("info",
+ "info",
+ "discoverer info",
+ GST_TYPE_DISCOVERER_INFO,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT);
+ g_object_class_install_property (object_class,
+ PROP_INFO,
+ pspec);
+
+ g_type_class_add_private (gst_info_class,
+ sizeof (GUPnPDLNAGstInformationPrivate));
+}
+
+static void
+gupnp_dlna_gst_information_init (GUPnPDLNAGstInformation *self)
+{
+ GUPnPDLNAGstInformationPrivate *priv = G_TYPE_INSTANCE_GET_PRIVATE
+ (self,
+ GUPNP_TYPE_DLNA_GST_INFORMATION,
+ GUPnPDLNAGstInformationPrivate);
+
+ priv->info = NULL;
+ self->priv = priv;
+}
+
+GUPnPDLNAGstInformation *
+gupnp_dlna_gst_information_new_from_discoverer_info (const gchar *uri,
+ GstDiscovererInfo *info)
+{
+ return GUPNP_DLNA_GST_INFORMATION
+ (g_object_new (GUPNP_TYPE_DLNA_GST_INFORMATION,
+ "uri", uri,
+ "info", info,
+ NULL));
+}
+
+GUPnPDLNAGstInformation *
+gupnp_dlna_gst_information_new_empty_with_uri (const gchar *uri)
+{
+ return GUPNP_DLNA_GST_INFORMATION
+ (g_object_new (GUPNP_TYPE_DLNA_GST_INFORMATION,
+ "uri", uri,
+ NULL));
+}
diff --git a/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-information.h b/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-information.h
new file mode 100644
index 0000000..0db2d37
--- /dev/null
+++ b/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-information.h
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2010 Nokia Corporation.
+ * Copyright (C) 2012,2013 Intel Corporation.
+ *
+ * Authors: Arun Raghavan <arun raghavan collabora co uk>
+ * 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_INFORMATION_H__
+#define __GUPNP_DLNA_GST_INFORMATION_H__
+
+#include <glib-object.h>
+#include <gst/pbutils/pbutils.h>
+#include "gupnp-dlna-information.h"
+
+G_BEGIN_DECLS
+
+#define GUPNP_TYPE_DLNA_GST_INFORMATION (gupnp_dlna_gst_information_get_type())
+
+#define GUPNP_DLNA_GST_INFORMATION(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ GUPNP_TYPE_DLNA_GST_INFORMATION, \
+ GUPnPDLNAGstInformation))
+
+#define GUPNP_DLNA_GST_INFORMATION_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ GUPNP_TYPE_DLNA_GST_INFORMATION, \
+ GUPnPDLNAGstInformationClass))
+
+#define GUPNP_IS_DLNA_GST_INFORMATION(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ GUPNP_TYPE_DLNA_GST_INFORMATION))
+
+#define GUPNP_IS_DLNA_GST_INFORMATION_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ GUPNP_TYPE_DLNA_GST_INFORMATION))
+
+#define GUPNP_DLNA_GST_INFORMATION_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ GUPNP_TYPE_DLNA_GST_INFORMATION, \
+ GUPnPDLNAGstInformationClass))
+
+typedef struct _GUPnPDLNAGstInformationPrivate GUPnPDLNAGstInformationPrivate;
+
+typedef struct {
+ GUPnPDLNAInformation parent;
+
+ GUPnPDLNAGstInformationPrivate *priv;
+} GUPnPDLNAGstInformation;
+
+typedef struct {
+ GUPnPDLNAInformationClass parent_class;
+} GUPnPDLNAGstInformationClass;
+
+GType
+gupnp_dlna_gst_information_get_type (void);
+
+GUPnPDLNAGstInformation *
+gupnp_dlna_gst_information_new_from_discoverer_info (const gchar *uri,
+ GstDiscovererInfo *info);
+
+GUPnPDLNAGstInformation *
+gupnp_dlna_gst_information_new_empty_with_uri (const gchar *uri);
+
+G_END_DECLS
+
+#endif /* __GUPNP_DLNA_GST_INFORMATION_H__ */
diff --git a/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-legacy-utils.h b/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-legacy-utils.h
new file mode 100644
index 0000000..731272f
--- /dev/null
+++ b/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-legacy-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 <libgupnp-dlna/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/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-metadata-backend.c b/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-metadata-backend.c
new file mode 100644
index 0000000..d31dd5d
--- /dev/null
+++ b/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-metadata-backend.c
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2012,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 <glib.h>
+#include <gmodule.h>
+#include <gst/gst.h>
+#include "gupnp-dlna-gst-metadata-extractor.h"
+
+G_MODULE_EXPORT GUPnPDLNAMetadataExtractor *
+gupnp_dlna_get_default_extractor (void)
+{
+ return GUPNP_DLNA_METADATA_EXTRACTOR
+ (gupnp_dlna_gst_metadata_extractor_new ());
+}
+
+G_MODULE_EXPORT const gchar *
+g_module_check_init (GModule *module G_GNUC_UNUSED)
+{
+ if (!gst_is_initialized ())
+ gst_init (NULL, NULL);
+
+ return NULL;
+}
diff --git a/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-metadata-extractor.c b/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-metadata-extractor.c
new file mode 100644
index 0000000..436e608
--- /dev/null
+++ b/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-metadata-extractor.c
@@ -0,0 +1,163 @@
+/*
+ * Copyright (C) 2010 Nokia Corporation.
+ * Copyright (C) 2012, 2013 Intel Corporation.
+ *
+ * Authors: Arun Raghavan <arun raghavan collabora co uk>
+ * 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 <gst/pbutils/pbutils.h>
+#include "gupnp-dlna-gst-metadata-extractor.h"
+#include "gupnp-dlna-gst-information.h"
+#include "gupnp-dlna-gst-legacy-utils.h"
+
+G_DEFINE_TYPE (GUPnPDLNAGstMetadataExtractor,
+ gupnp_dlna_gst_metadata_extractor,
+ GUPNP_TYPE_DLNA_METADATA_EXTRACTOR)
+
+struct _GUPnPDLNAGstMetadataExtractorPrivate {
+ gpointer placeholder;
+};
+
+static gboolean
+unref_discoverer_in_idle (GstDiscoverer *discoverer)
+{
+ if (discoverer)
+ g_object_unref (discoverer);
+
+ return FALSE;
+}
+
+static void
+gupnp_dlna_discovered_cb (GUPnPDLNAMetadataExtractor *self,
+ GstDiscovererInfo *info,
+ GError *error,
+ gpointer user_data)
+{
+ GstDiscoverer *discoverer = GST_DISCOVERER (user_data);
+ GUPnPDLNAInformation *gupnp_info = NULL;
+
+ if (error)
+ gupnp_info = GUPNP_DLNA_INFORMATION
+ (gupnp_dlna_gst_information_new_empty_with_uri
+ (gst_discoverer_info_get_uri (info)));
+ else
+ gupnp_info = gupnp_dlna_gst_utils_information_from_discoverer_info
+ (info);
+ gupnp_dlna_metadata_extractor_emit_done (self,
+ gupnp_info,
+ error);
+ g_object_unref (gupnp_info);
+ g_idle_add ((GSourceFunc) unref_discoverer_in_idle, discoverer);
+}
+
+static gboolean
+backend_extract_async (GUPnPDLNAMetadataExtractor *extractor,
+ const gchar *uri,
+ guint timeout,
+ GError **error)
+{
+ GError *gst_error = NULL;
+ GstClockTime clock_time = GST_MSECOND * timeout;
+ GstDiscoverer *discoverer = gst_discoverer_new (clock_time, &gst_error);
+
+ if (gst_error) {
+ g_propagate_error (error, gst_error);
+
+ return FALSE;
+ }
+
+ g_signal_connect_swapped (discoverer,
+ "discovered",
+ G_CALLBACK (gupnp_dlna_discovered_cb),
+ extractor);
+ gst_discoverer_start (discoverer);
+
+ return gst_discoverer_discover_uri_async (discoverer,
+ uri);
+}
+
+static GUPnPDLNAInformation *
+backend_extract_sync (GUPnPDLNAMetadataExtractor *extractor G_GNUC_UNUSED,
+ const gchar *uri,
+ guint timeout_in_ms,
+ GError **error)
+{
+ GError *gst_error = NULL;
+ GstClockTime clock_time = GST_MSECOND * timeout_in_ms;
+ GstDiscoverer *discoverer = gst_discoverer_new (clock_time, &gst_error);
+ GstDiscovererInfo* info;
+ GUPnPDLNAInformation *gupnp_info;
+
+ if (gst_error) {
+ g_propagate_error (error, gst_error);
+
+ return NULL;
+ }
+
+ info = gst_discoverer_discover_uri (discoverer,
+ uri,
+ &gst_error);
+
+ g_object_unref (discoverer);
+ if (gst_error) {
+ g_propagate_error (error, gst_error);
+
+ return NULL;
+ }
+
+ gupnp_info = GUPNP_DLNA_INFORMATION
+ (gupnp_dlna_gst_information_new_from_discoverer_info (uri, info));
+ gst_discoverer_info_unref (info);
+
+ return gupnp_info;
+}
+
+static void
+gupnp_dlna_gst_metadata_extractor_class_init
+ (GUPnPDLNAGstMetadataExtractorClass *gst_extractor_class)
+{
+ GUPnPDLNAMetadataExtractorClass *extractor_class =
+ GUPNP_DLNA_METADATA_EXTRACTOR_CLASS (gst_extractor_class);
+
+ extractor_class->extract_async = backend_extract_async;
+ extractor_class->extract_sync = backend_extract_sync;
+
+ g_type_class_add_private
+ (gst_extractor_class,
+ sizeof (GUPnPDLNAGstMetadataExtractorPrivate));
+}
+
+static void
+gupnp_dlna_gst_metadata_extractor_init (GUPnPDLNAGstMetadataExtractor *self)
+{
+ GUPnPDLNAGstMetadataExtractorPrivate *priv =
+ G_TYPE_INSTANCE_GET_PRIVATE (self,
+ GUPNP_TYPE_DLNA_GST_METADATA_EXTRACTOR,
+ GUPnPDLNAGstMetadataExtractorPrivate);
+
+ self->priv = priv;
+}
+
+GUPnPDLNAGstMetadataExtractor *
+gupnp_dlna_gst_metadata_extractor_new (void)
+{
+ return GUPNP_DLNA_GST_METADATA_EXTRACTOR
+ (g_object_new (GUPNP_TYPE_DLNA_GST_METADATA_EXTRACTOR,
+ NULL));
+}
diff --git a/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-metadata-extractor.h b/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-metadata-extractor.h
new file mode 100644
index 0000000..3a76df6
--- /dev/null
+++ b/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-metadata-extractor.h
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2010 Nokia Corporation.
+ * Copyright (C) 2012,2013 Intel Corporation.
+ *
+ * Authors: Arun Raghavan <arun raghavan collabora co uk>
+ * 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_METADATA_EXTRACTOR
+#define _GUPNP_DLNA_GST_METADATA_EXTRACTOR
+
+#include <glib-object.h>
+#include "gupnp-dlna-metadata-extractor.h"
+#include "gupnp-dlna-information.h"
+
+G_BEGIN_DECLS
+
+#define GUPNP_TYPE_DLNA_GST_METADATA_EXTRACTOR \
+ (gupnp_dlna_gst_metadata_extractor_get_type())
+
+#define GUPNP_DLNA_GST_METADATA_EXTRACTOR(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ GUPNP_TYPE_DLNA_GST_METADATA_EXTRACTOR, \
+ GUPnPDLNAGstMetadataExtractor))
+
+#define GUPNP_DLNA_GST_METADATA_EXTRACTOR_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ GUPNP_TYPE_DLNA_GST_METADATA_EXTRACTOR, \
+ GUPnPDLNAGstMetadataExtractorClass))
+
+#define GUPNP_IS_DLNA_GST_METADATA_EXTRACTOR(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ GUPNP_TYPE_DLNA_GST_METADATA_EXTRACTOR))
+
+#define GUPNP_IS_DLNA_GST_METADATA_EXTRACTOR_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ GUPNP_TYPE_DLNA_GST_METADATA_EXTRACTOR))
+
+#define GUPNP_DLNA_GST_METADATA_EXTRACTOR_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ GUPNP_TYPE_DLNA_GST_METADATA_EXTRACTOR, \
+ GUPnPDLNAGstMetadataExtractorClass))
+
+typedef struct _GUPnPDLNAGstMetadataExtractorPrivate
+ GUPnPDLNAGstMetadataExtractorPrivate;
+
+/**
+ * GUPnPDLNAGstMetadataExtractor:
+ *
+ * The top-level object used to for metadata extraction.
+ */
+typedef struct {
+ GUPnPDLNAMetadataExtractor parent;
+
+ GUPnPDLNAGstMetadataExtractorPrivate *priv;
+} GUPnPDLNAGstMetadataExtractor;
+
+typedef struct {
+ GUPnPDLNAMetadataExtractorClass parent_class;
+} GUPnPDLNAGstMetadataExtractorClass;
+
+GType
+gupnp_dlna_gst_metadata_extractor_get_type (void);
+
+GUPnPDLNAGstMetadataExtractor *
+gupnp_dlna_gst_metadata_extractor_new (void);
+
+G_END_DECLS
+
+#endif /* _GUPNP_DLNA_GST_METADATA_EXTRACTOR */
diff --git a/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-utils.c b/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-utils.c
new file mode 100644
index 0000000..7f365ff
--- /dev/null
+++ b/libgupnp-dlna/metadata-backends/gstreamer-legacy/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-legacy-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-legacy/gupnp-dlna-gst-video-information.c b/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-video-information.c
new file mode 100644
index 0000000..42bc0e3
--- /dev/null
+++ b/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-video-information.c
@@ -0,0 +1,418 @@
+/*
+ * Copyright (C) 2012,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H_ */
+#include "gupnp-dlna-gst-video-information.h"
+#include "gupnp-dlna-gst-info-utils.h"
+
+G_DEFINE_TYPE (GUPnPDLNAGstVideoInformation,
+ gupnp_dlna_gst_video_information,
+ GUPNP_TYPE_DLNA_VIDEO_INFORMATION)
+
+struct _GUPnPDLNAGstVideoInformationPrivate {
+ GstDiscovererInfo *info;
+ GList *stream_list;
+ GstDiscovererVideoInfo *video_info;
+ GstCaps *caps;
+};
+
+enum
+{
+ PROP_0,
+
+ PROP_INFO
+};
+
+static GstDiscovererVideoInfo *
+get_video_info (GUPnPDLNAGstVideoInformation *gst_info)
+{
+ GUPnPDLNAGstVideoInformationPrivate *priv = gst_info->priv;
+
+ if (!priv->video_info) {
+ GList *iter;
+
+ if (!priv->stream_list) {
+ priv->stream_list =
+ gst_discoverer_info_get_stream_list (priv->info);
+ if (!priv->stream_list)
+ return NULL;
+ }
+
+ for (iter = priv->stream_list; iter; iter = iter->next) {
+ GstDiscovererStreamInfo *stream =
+ GST_DISCOVERER_STREAM_INFO (iter->data);
+ GType stream_type = G_TYPE_FROM_INSTANCE (stream);
+
+ if (stream_type == GST_TYPE_DISCOVERER_VIDEO_INFO) {
+ priv->video_info =
+ GST_DISCOVERER_VIDEO_INFO (stream);
+
+ break;
+ }
+ }
+ }
+
+ return priv->video_info;
+}
+
+static GstCaps *
+get_caps (GUPnPDLNAGstVideoInformation *gst_info)
+{
+ GUPnPDLNAGstVideoInformationPrivate *priv = gst_info->priv;
+
+ if (!priv->caps)
+ priv->caps = gst_discoverer_stream_info_get_caps
+ (GST_DISCOVERER_STREAM_INFO
+ (get_video_info (gst_info)));
+
+ return priv->caps;
+}
+
+static GUPnPDLNAIntValue
+get_int_value (GUPnPDLNAGstVideoInformation *gst_info,
+ const gchar *name)
+{
+ GstCaps *caps = get_caps (gst_info);
+ GstDiscovererStreamInfo *stream =
+ GST_DISCOVERER_STREAM_INFO (get_video_info (gst_info));
+ GstDiscovererInfo *info = gst_info->priv->info;
+
+ return gupnp_dlna_gst_get_int_value (caps, stream, info, name);
+}
+
+static GUPnPDLNAStringValue
+get_string_value (GUPnPDLNAGstVideoInformation *gst_info,
+ const gchar *name)
+{
+ GstCaps *caps = get_caps (gst_info);
+ GstDiscovererStreamInfo *stream =
+ GST_DISCOVERER_STREAM_INFO (get_video_info (gst_info));
+ GstDiscovererInfo *info = gst_info->priv->info;
+
+ return gupnp_dlna_gst_get_string_value (caps, stream, info, name);
+}
+
+static GUPnPDLNABoolValue
+get_bool_value (GUPnPDLNAGstVideoInformation *gst_info,
+ const gchar *name)
+{
+ GstCaps *caps = get_caps (gst_info);
+ GstDiscovererStreamInfo *stream =
+ GST_DISCOVERER_STREAM_INFO (get_video_info (gst_info));
+ GstDiscovererInfo *info = gst_info->priv->info;
+
+ return gupnp_dlna_gst_get_bool_value (caps, stream, info, name);
+}
+
+static GUPnPDLNAIntValue
+backend_get_bitrate (GUPnPDLNAVideoInformation *self)
+{
+ GUPnPDLNAGstVideoInformation* gst_info =
+ GUPNP_DLNA_GST_VIDEO_INFORMATION (self);
+ GstDiscovererVideoInfo *video_info = get_video_info (gst_info);
+ guint data = gst_discoverer_video_info_get_bitrate (video_info);
+ GUPnPDLNAIntValue value = GUPNP_DLNA_INT_VALUE_UNSET;
+
+ if (data > 0 && data <= G_MAXINT) {
+ value.state = GUPNP_DLNA_VALUE_STATE_SET;
+ value.value = (gint) data;
+ }
+
+ return value;
+}
+
+static GUPnPDLNAFractionValue
+backend_get_framerate (GUPnPDLNAVideoInformation *self)
+{
+ GUPnPDLNAGstVideoInformation* gst_info =
+ GUPNP_DLNA_GST_VIDEO_INFORMATION (self);
+ GstDiscovererVideoInfo *video_info = get_video_info (gst_info);
+ guint ndata = gst_discoverer_video_info_get_framerate_num (video_info);
+ guint ddata = gst_discoverer_video_info_get_framerate_denom
+ (video_info);
+ GUPnPDLNAFractionValue value = GUPNP_DLNA_FRACTION_VALUE_UNSET;
+
+ if (ndata > 0 && ndata <= G_MAXINT && ddata > 0 && ddata <= G_MAXINT) {
+ value.state = GUPNP_DLNA_VALUE_STATE_SET;
+ value.numerator = (gint) ndata;
+ value.denominator = (gint) ddata;
+ }
+
+ return value;
+}
+
+static GUPnPDLNAIntValue
+backend_get_height (GUPnPDLNAVideoInformation *self)
+{
+ GUPnPDLNAGstVideoInformation* gst_info =
+ GUPNP_DLNA_GST_VIDEO_INFORMATION (self);
+ GstDiscovererVideoInfo *video_info = get_video_info (gst_info);
+ guint data = gst_discoverer_video_info_get_height (video_info);
+ GUPnPDLNAIntValue value = GUPNP_DLNA_INT_VALUE_UNSET;
+
+ if (data > 0 && data <= G_MAXINT) {
+ value.state = GUPNP_DLNA_VALUE_STATE_SET;
+ value.value = (gint) data;
+ }
+
+ return value;
+}
+
+static GUPnPDLNABoolValue
+backend_is_interlaced (GUPnPDLNAVideoInformation *self)
+{
+ GUPnPDLNAGstVideoInformation* gst_info =
+ GUPNP_DLNA_GST_VIDEO_INFORMATION (self);
+ GstDiscovererVideoInfo *video_info = get_video_info (gst_info);
+ gboolean data = gst_discoverer_video_info_get_height (video_info);
+ GUPnPDLNABoolValue value;
+
+ value.state = GUPNP_DLNA_VALUE_STATE_SET;
+ value.value = data;
+
+ return value;
+}
+
+static GUPnPDLNAStringValue
+backend_get_level (GUPnPDLNAVideoInformation *self)
+{
+ GUPnPDLNAGstVideoInformation* gst_info =
+ GUPNP_DLNA_GST_VIDEO_INFORMATION (self);
+
+ return get_string_value (gst_info, "level");
+}
+
+static GUPnPDLNAIntValue
+backend_get_mpeg_version (GUPnPDLNAVideoInformation *self)
+{
+ GUPnPDLNAGstVideoInformation* gst_info =
+ GUPNP_DLNA_GST_VIDEO_INFORMATION (self);
+
+ return get_int_value (gst_info, "mpegversion");
+}
+
+static GUPnPDLNAFractionValue
+backend_get_pixel_aspect_ratio (GUPnPDLNAVideoInformation *self)
+{
+ GUPnPDLNAGstVideoInformation* gst_info =
+ GUPNP_DLNA_GST_VIDEO_INFORMATION (self);
+ GstDiscovererVideoInfo *video_info = get_video_info (gst_info);
+ guint ndata = gst_discoverer_video_info_get_par_num (video_info);
+ guint ddata = gst_discoverer_video_info_get_par_denom (video_info);
+ GUPnPDLNAFractionValue value = GUPNP_DLNA_FRACTION_VALUE_UNSET;
+
+ if (ndata > 0 && ndata <= G_MAXINT && ddata > 0 && ddata <= G_MAXINT) {
+ value.state = GUPNP_DLNA_VALUE_STATE_SET;
+ value.numerator = (gint) ndata;
+ value.denominator = (gint) ddata;
+ }
+
+ return value;
+}
+
+static GUPnPDLNAStringValue
+backend_get_profile (GUPnPDLNAVideoInformation *self)
+{
+ GUPnPDLNAGstVideoInformation* gst_info =
+ GUPNP_DLNA_GST_VIDEO_INFORMATION (self);
+
+ return get_string_value (gst_info, "profile");
+}
+
+static GUPnPDLNABoolValue
+backend_is_system_stream (GUPnPDLNAVideoInformation *self)
+{
+ GUPnPDLNAGstVideoInformation* gst_info =
+ GUPNP_DLNA_GST_VIDEO_INFORMATION (self);
+
+ return get_bool_value (gst_info, "systemstream");
+}
+
+static GUPnPDLNAIntValue
+backend_get_width (GUPnPDLNAVideoInformation *self)
+{
+ GUPnPDLNAGstVideoInformation* gst_info =
+ GUPNP_DLNA_GST_VIDEO_INFORMATION (self);
+ GstDiscovererVideoInfo *video_info = get_video_info (gst_info);
+ guint data = gst_discoverer_video_info_get_width (video_info);
+ GUPnPDLNAIntValue value = GUPNP_DLNA_INT_VALUE_UNSET;
+
+ if (data > 0 && data <= G_MAXINT) {
+ value.state = GUPNP_DLNA_VALUE_STATE_SET;
+ value.value = (gint) data;
+ }
+
+ return value;
+}
+
+static GUPnPDLNAStringValue
+backend_get_mime (GUPnPDLNAVideoInformation *self)
+{
+ GUPnPDLNAGstVideoInformation* gst_info =
+ GUPNP_DLNA_GST_VIDEO_INFORMATION (self);
+
+ return gupnp_dlna_gst_get_mime (get_caps (gst_info));
+}
+
+static void
+gupnp_dlna_gst_video_information_dispose (GObject *object)
+{
+ GUPnPDLNAGstVideoInformation *info =
+ GUPNP_DLNA_GST_VIDEO_INFORMATION (object);
+ GUPnPDLNAGstVideoInformationPrivate *priv = info->priv;
+
+ g_clear_pointer (&priv->info, gupnp_dlna_gst_discoverer_info_unref);
+ g_clear_pointer (&priv->stream_list,
+ gst_discoverer_stream_info_list_free);
+ /* priv->video_info is freed with stream list above */
+ priv->video_info = NULL;
+ g_clear_pointer (&priv->caps, gst_caps_unref);
+ G_OBJECT_CLASS
+ (gupnp_dlna_gst_video_information_parent_class)->dispose (object);
+}
+
+static void
+gupnp_dlna_gst_video_information_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GUPnPDLNAGstVideoInformation *info =
+ GUPNP_DLNA_GST_VIDEO_INFORMATION (object);
+ GUPnPDLNAGstVideoInformationPrivate *priv = info->priv;
+
+ switch (property_id) {
+ case PROP_INFO:
+ g_clear_pointer (&priv->info,
+ gupnp_dlna_gst_discoverer_info_unref);
+ priv->info =
+ GST_DISCOVERER_INFO (gst_value_dup_mini_object (value));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gupnp_dlna_gst_video_information_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GUPnPDLNAGstVideoInformation *info =
+ GUPNP_DLNA_GST_VIDEO_INFORMATION (object);
+ GUPnPDLNAGstVideoInformationPrivate *priv = info->priv;
+
+ switch (property_id) {
+ case PROP_INFO:
+ gst_value_set_mini_object (value, GST_MINI_OBJECT (priv->info));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gupnp_dlna_gst_video_information_class_init
+ (GUPnPDLNAGstVideoInformationClass *gst_info_class)
+{
+ GUPnPDLNAVideoInformationClass *info_class =
+ GUPNP_DLNA_VIDEO_INFORMATION_CLASS (gst_info_class);
+ GObjectClass *object_class = G_OBJECT_CLASS (gst_info_class);
+ GParamSpec *pspec;
+
+ object_class->get_property =
+ gupnp_dlna_gst_video_information_get_property;
+ object_class->set_property =
+ gupnp_dlna_gst_video_information_set_property;
+ object_class->dispose = gupnp_dlna_gst_video_information_dispose;
+
+ info_class->get_bitrate = backend_get_bitrate;
+ info_class->get_framerate = backend_get_framerate;
+ info_class->get_height = backend_get_height;
+ info_class->is_interlaced = backend_is_interlaced;
+ info_class->get_level = backend_get_level;
+ info_class->get_mpeg_version = backend_get_mpeg_version;
+ info_class->get_pixel_aspect_ratio = backend_get_pixel_aspect_ratio;
+ info_class->get_profile = backend_get_profile;
+ info_class->is_system_stream = backend_is_system_stream;
+ info_class->get_width = backend_get_width;
+ info_class->get_mime = backend_get_mime;
+
+ pspec = gst_param_spec_mini_object ("info",
+ "info",
+ "discoverer info",
+ GST_TYPE_DISCOVERER_INFO,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT);
+ g_object_class_install_property (object_class,
+ PROP_INFO,
+ pspec);
+
+ g_type_class_add_private (gst_info_class,
+ sizeof (GUPnPDLNAGstVideoInformationPrivate));
+}
+
+static void
+gupnp_dlna_gst_video_information_init (GUPnPDLNAGstVideoInformation *self)
+{
+ GUPnPDLNAGstVideoInformationPrivate *priv = G_TYPE_INSTANCE_GET_PRIVATE
+ (self,
+ GUPNP_TYPE_DLNA_GST_VIDEO_INFORMATION,
+ GUPnPDLNAGstVideoInformationPrivate);
+
+ priv->info = NULL;
+ priv->stream_list = NULL;
+ priv->video_info = NULL;
+ priv->caps = NULL;
+ self->priv = priv;
+}
+
+GUPnPDLNAGstVideoInformation *
+gupnp_dlna_gst_video_information_new_from_discoverer_info
+ (GstDiscovererInfo *info)
+{
+ GList* video_list;
+ GUPnPDLNAGstVideoInformation *video_info = NULL;
+
+ g_return_val_if_fail (GST_IS_DISCOVERER_INFO (info), NULL);
+
+ video_list = gst_discoverer_info_get_video_streams (info);
+
+ if (video_list) {
+ if (!gst_discoverer_video_info_is_image
+ (GST_DISCOVERER_VIDEO_INFO (video_list->data)))
+ video_info = GUPNP_DLNA_GST_VIDEO_INFORMATION
+ (g_object_new
+ (GUPNP_TYPE_DLNA_GST_VIDEO_INFORMATION,
+ "info", info,
+ NULL));
+ gst_discoverer_stream_info_list_free (video_list);
+ }
+
+ return video_info;
+}
diff --git a/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-video-information.h b/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-video-information.h
new file mode 100644
index 0000000..23618a3
--- /dev/null
+++ b/libgupnp-dlna/metadata-backends/gstreamer-legacy/gupnp-dlna-gst-video-information.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2012,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_VIDEO_INFORMATION_H__
+#define __GUPNP_DLNA_GST_VIDEO_INFORMATION_H__
+
+#include <glib-object.h>
+#include <gst/pbutils/pbutils.h>
+#include "gupnp-dlna-video-information.h"
+
+G_BEGIN_DECLS
+
+#define GUPNP_TYPE_DLNA_GST_VIDEO_INFORMATION gupnp_dlna_gst_video_information_get_type()
+
+#define GUPNP_DLNA_GST_VIDEO_INFORMATION(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ GUPNP_TYPE_DLNA_GST_VIDEO_INFORMATION, \
+ GUPnPDLNAGstVideoInformation))
+
+#define GUPNP_DLNA_GST_VIDEO_INFORMATION_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ GUPNP_TYPE_DLNA_GST_VIDEO_INFORMATION, \
+ GUPnPDLNAGstVideoInformationClass))
+
+#define GUPNP_IS_DLNA_GST_VIDEO_INFORMATION(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GUPNP_TYPE_DLNA_GST_VIDEO_INFORMATION))
+
+#define GUPNP_IS_DLNA_GST_VIDEO_INFORMATION_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), GUPNP_TYPE_DLNA_GST_VIDEO_INFORMATION))
+
+#define GUPNP_DLNA_GST_VIDEO_INFORMATION_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ GUPNP_TYPE_DLNA_GST_VIDEO_INFORMATION, \
+ GUPnPDLNAGstVideoInformationClass))
+
+typedef struct _GUPnPDLNAGstVideoInformationPrivate GUPnPDLNAGstVideoInformationPrivate;
+
+typedef struct {
+ GUPnPDLNAVideoInformation parent;
+
+ GUPnPDLNAGstVideoInformationPrivate *priv;
+} GUPnPDLNAGstVideoInformation;
+
+typedef struct {
+ GUPnPDLNAVideoInformationClass parent_class;
+} GUPnPDLNAGstVideoInformationClass;
+
+GType gupnp_dlna_gst_video_information_get_type (void);
+
+GUPnPDLNAGstVideoInformation *
+gupnp_dlna_gst_video_information_new_from_discoverer_info (GstDiscovererInfo *info);
+
+G_END_DECLS
+
+#endif /* __GUPNP_DLNA_GST_VIDEO_INFORMATION_H__ */
diff --git a/vala/Makefile.am b/vala/Makefile.am
index 38f6adf..d3e148b 100644
--- a/vala/Makefile.am
+++ b/vala/Makefile.am
@@ -57,5 +57,11 @@ EXTRA_DIST += \
GUPnPDLNAGst-2.0.metadata \
gupnp-dlna-gst-2.0-custom.vala
endif
+
+if GSTREAMER_LEGACY_METADATA_BACKEND_ENABLED
+vapi_DATA += \
+ gupnp-dlna-gst-legacy-2.0.vapi \
+ $(srcdir)/gupnp-dlna-gst-legacy-2.0.deps
+endif
endif
endif
diff --git a/vala/gupnp-dlna-gst-legacy-2.0.deps b/vala/gupnp-dlna-gst-legacy-2.0.deps
new file mode 100644
index 0000000..2b7fe8a
--- /dev/null
+++ b/vala/gupnp-dlna-gst-legacy-2.0.deps
@@ -0,0 +1,3 @@
+gupnp-dlna-2.0
+gstreamer-0.10
+gstreamer-pbutils-0.10
diff --git a/vala/gupnp-dlna-gst-legacy-2.0.vapi b/vala/gupnp-dlna-gst-legacy-2.0.vapi
new file mode 100644
index 0000000..27180db
--- /dev/null
+++ b/vala/gupnp-dlna-gst-legacy-2.0.vapi
@@ -0,0 +1,5 @@
+[CCode (cprefix = "GUPnPDLNAGst", gir_namespace = "GUPnPDLNAGst", gir_version = "2.0", lower_case_cprefix = "gupnp_dlna_gst_")]
+namespace GUPnPDLNAGst {
+ [CCode (cheader_filename = "libgupnp-dlna/gupnp-dlna-gst-legacy-utils.h")]
+ public static GUPnPDLNA.Information utils_information_from_discoverer_info (Gst.DiscovererInfo info);
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]