[sushi] Port to GStreamer 1.0
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sushi] Port to GStreamer 1.0
- Date: Fri, 10 Aug 2012 13:38:48 +0000 (UTC)
commit d30eac46ffc9eb8b4db7306e92d0576de2d1b3cb
Author: Tim-Philipp MÃller <tim centricular net>
Date: Mon Jul 30 19:03:38 2012 +0100
Port to GStreamer 1.0
https://bugzilla.gnome.org/show_bug.cgi?id=680425
configure.ac | 8 +++---
src/Makefile-sushi.am | 18 +++++++++++-
src/Makefile.am | 1 +
src/js/viewers/gst.js | 2 +-
src/libsushi/sushi-cover-art.c | 53 ++++++++++++++++++++----------------
src/libsushi/sushi-sound-player.c | 6 +---
6 files changed, 52 insertions(+), 36 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 55044b3..baa2883 100644
--- a/configure.ac
+++ b/configure.ac
@@ -68,10 +68,10 @@ PKG_CHECK_MODULES(SUSHI,
clutter-x11-1.0 >= $CLUTTER_MIN_VERSION
gtk+-3.0 >= $GTK_MIN_VERSION
clutter-gtk-1.0 >= $CLUTTER_GTK_MIN_VERSION
- clutter-gst-1.0
- gstreamer-0.10
- gstreamer-pbutils-0.10
- gstreamer-tag-0.10
+ clutter-gst-2.0
+ gstreamer-1.0
+ gstreamer-pbutils-1.0
+ gstreamer-tag-1.0
libmusicbrainz4
evince-document-3.0
evince-view-3.0
diff --git a/src/Makefile-sushi.am b/src/Makefile-sushi.am
index bb311a5..95e3c3f 100644
--- a/src/Makefile-sushi.am
+++ b/src/Makefile-sushi.am
@@ -4,6 +4,7 @@ sushi_cflags = \
-DLIBDIR=\"$(libdir)\" \
-DG_LOG_DOMAIN=\"Sushi\" \
-DG_DISABLE_DEPRECATED \
+ -DGST_USE_UNSTABLE_API \
$(SUSHI_CFLAGS)
sushi_built_sources = \
@@ -77,6 +78,19 @@ EXTRA_DIST += \
INTROSPECTION_GIRS += Sushi-1.0.gir
+# These find the gir and typelib files in an uninstalled GStreamer setup
+# or if GStreamer is installed in a different prefix than most other things
+INTROSPECTION_SCANNER_ARGS = \
+ --add-include-path=`$(PKG_CONFIG) --variable=girdir gstreamer-1.0` \
+ --add-include-path=`$(PKG_CONFIG) --variable=girdir gstreamer-base-1.0` \
+ --add-include-path=`$(PKG_CONFIG) --variable=girdir gstreamer-pbutils-1.0` \
+ --add-include-path=`$(PKG_CONFIG) --variable=girdir gstreamer-tag-1.0`
+INTROSPECTION_COMPILER_ARGS = \
+ --includedir=`$(PKG_CONFIG) --variable=girdir gstreamer-1.0` \
+ --includedir=`$(PKG_CONFIG) --variable=girdir gstreamer-base-1.0` \
+ --includedir=`$(PKG_CONFIG) --variable=girdir gstreamer-pbutils-1.0` \
+ --includedir=`$(PKG_CONFIG) --variable=girdir gstreamer-tag-1.0`
+
Sushi-1.0.gir: libsushi-1.0.la Makefile
Sushi_1_0_gir_NAMESPACE = Sushi
Sushi_1_0_gir_VERSION = 1.0
@@ -85,8 +99,8 @@ Sushi_1_0_gir_CFLAGS = $(AM_CPPFLAGS) $(sushi_cflags)
Sushi_1_0_gir_SCANNERFLAGS = --warn-all --symbol-prefix=sushi --identifier-prefix=Sushi
Sushi_1_0_gir_INCLUDES = \
Clutter-1.0 \
- GstPbutils-0.10 \
- GstTag-0.10 \
+ GstPbutils-1.0 \
+ GstTag-1.0 \
GdkPixbuf-2.0 \
Gtk-3.0 \
EvinceDocument-3.0 \
diff --git a/src/Makefile.am b/src/Makefile.am
index 3188a60..3ae6396 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -49,6 +49,7 @@ sushi_start_LDADD = \
libsushi-1.0.la \
$(SUSHI_LIBS)
sushi_start_CPPFLAGS = \
+ -DGST_USE_UNSTABLE_API \
$(SUSHI_CFLAGS) \
$(AM_CPPFLAGS) \
-DLOCALEDIR=\"$(datadir)/locale\"
diff --git a/src/js/viewers/gst.js b/src/js/viewers/gst.js
index 00f7659..528785a 100644
--- a/src/js/viewers/gst.js
+++ b/src/js/viewers/gst.js
@@ -25,7 +25,7 @@
*
*/
-imports.gi.versions.ClutterGst = '1.0';
+imports.gi.versions.ClutterGst = '2.0';
let ClutterGst = imports.gi.ClutterGst;
let MimeHandler = imports.ui.mimeHandler;
diff --git a/src/libsushi/sushi-cover-art.c b/src/libsushi/sushi-cover-art.c
index 32279d3..cd5922e 100644
--- a/src/libsushi/sushi-cover-art.c
+++ b/src/libsushi/sushi-cover-art.c
@@ -586,12 +586,16 @@ static GdkPixbuf *
totem_gst_buffer_to_pixbuf (GstBuffer *buffer)
{
GdkPixbufLoader *loader;
+ GstMapInfo map_info;
GdkPixbuf *pixbuf = NULL;
GError *err = NULL;
loader = gdk_pixbuf_loader_new ();
- if (gdk_pixbuf_loader_write (loader, buffer->data, buffer->size, &err) &&
+ if (!gst_buffer_map (buffer, &map_info, GST_MAP_READ))
+ return NULL;
+
+ if (gdk_pixbuf_loader_write (loader, map_info.data, map_info.size, &err) &&
gdk_pixbuf_loader_close (loader, &err)) {
pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
if (pixbuf)
@@ -600,69 +604,70 @@ totem_gst_buffer_to_pixbuf (GstBuffer *buffer)
g_warning ("could not convert tag image to pixbuf: %s", err->message);
g_error_free (err);
}
-
+ gst_buffer_unmap (buffer, &map_info);
g_object_unref (loader);
return pixbuf;
}
-static const GValue *
+static GstSample *
totem_gst_tag_list_get_cover_real (GstTagList *tag_list)
{
- const GValue *cover_value = NULL;
+ GstSample *cover_sample = NULL;
guint i;
for (i = 0; ; i++) {
- const GValue *value;
GstBuffer *buffer;
+ GstSample *sample;
+ GstCaps *caps;
GstStructure *caps_struct;
int type;
- value = gst_tag_list_get_value_index (tag_list,
- GST_TAG_IMAGE,
- i);
- if (value == NULL)
+ if (!gst_tag_list_get_sample_index (tag_list, GST_TAG_IMAGE, i, &sample))
break;
- buffer = gst_value_get_buffer (value);
-
- caps_struct = gst_caps_get_structure (buffer->caps, 0);
+ buffer = gst_sample_get_buffer (sample);
+ caps = gst_sample_get_caps (sample);
+ caps_struct = gst_caps_get_structure (caps, 0);
gst_structure_get_enum (caps_struct,
"image-type",
GST_TYPE_TAG_IMAGE_TYPE,
&type);
if (type == GST_TAG_IMAGE_TYPE_UNDEFINED) {
- if (cover_value == NULL)
- cover_value = value;
+ if (cover_sample == NULL) {
+ /* take a ref here since we will continue and unref below */
+ cover_sample = gst_sample_ref (sample);
+ }
} else if (type == GST_TAG_IMAGE_TYPE_FRONT_COVER) {
- cover_value = value;
+ cover_sample = sample;
break;
}
+ gst_sample_unref (sample);
}
- return cover_value;
+ return cover_sample;
}
GdkPixbuf *
totem_gst_tag_list_get_cover (GstTagList *tag_list)
{
- const GValue *cover_value;
+ GstSample *cover_sample;
g_return_val_if_fail (tag_list != NULL, FALSE);
- cover_value = totem_gst_tag_list_get_cover_real (tag_list);
+ cover_sample = totem_gst_tag_list_get_cover_real (tag_list);
/* Fallback to preview */
- if (!cover_value) {
- cover_value = gst_tag_list_get_value_index (tag_list,
- GST_TAG_PREVIEW_IMAGE,
- 0);
+ if (!cover_sample) {
+ gst_tag_list_get_sample_index (tag_list, GST_TAG_PREVIEW_IMAGE, 0,
+ &cover_sample);
}
- if (cover_value) {
+ if (cover_sample) {
GstBuffer *buffer;
GdkPixbuf *pixbuf;
- buffer = gst_value_get_buffer (cover_value);
+ buffer = gst_sample_get_buffer (cover_sample);
pixbuf = totem_gst_buffer_to_pixbuf (buffer);
+ gst_sample_unref (cover_sample);
return pixbuf;
}
diff --git a/src/libsushi/sushi-sound-player.c b/src/libsushi/sushi-sound-player.c
index dd5f6d1..9d8c8e1 100644
--- a/src/libsushi/sushi-sound-player.c
+++ b/src/libsushi/sushi-sound-player.c
@@ -285,16 +285,12 @@ static void
sushi_sound_player_query_duration (SushiSoundPlayer *player)
{
SushiSoundPlayerPrivate *priv;
- GstFormat format = GST_FORMAT_TIME;
gdouble new_duration, difference;
- gboolean success;
gint64 duration;
priv = SUSHI_SOUND_PLAYER_GET_PRIVATE (player);
- success = gst_element_query_duration (priv->pipeline, &format, &duration);
-
- if (G_UNLIKELY (success != TRUE))
+ if (!gst_element_query_duration (priv->pipeline, GST_FORMAT_TIME, &duration))
return;
new_duration = (gdouble) duration / GST_SECOND;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]