From 6364e8ec2c8a5fe3b17d1d73976462254986dd1b Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Thu, 23 Sep 2010 18:33:27 +0200 Subject: [PATCH] all: Changes for discoverer being merged upstream Along with a whole bunch of Makefile fixups --- configure.ac | 20 +++++++-------- docs/libs/Makefile.am | 2 +- ges/Makefile.am | 6 ++--- ges/ges-screenshot.c | 13 +++++++--- ges/ges-timeline.c | 45 ++++++++++++++++++++------------- ges/ges-timeline.h | 2 +- tests/check/Makefile.am | 2 +- tests/examples/Makefile.am | 4 +-- tests/examples/concatenate.c | 49 ++++++++++++++++++++---------------- tools/Makefile.am | 4 +-- 10 files changed, 84 insertions(+), 63 deletions(-) diff --git a/configure.ac b/configure.ac index ae90b49f5b..1c3a82ad50 100644 --- a/configure.ac +++ b/configure.ac @@ -50,8 +50,8 @@ AC_LIBTOOL_WIN32_DLL AM_PROG_LIBTOOL dnl *** required versions of GStreamer stuff *** -GST_REQ=0.10.29.3 -GSTPB_REQ=0.10.29.1 +GST_REQ=0.10.30.1 +GSTPB_REQ=0.10.30.1 dnl *** autotools stuff **** @@ -164,21 +164,21 @@ fi AC_SUBST(GST_PROFILE_LIBS) AC_SUBST(GST_PROFILE_CFLAGS) -dnl check for gstreamer-discoverer -PKG_CHECK_MODULES(GST_DISCOVERER, gstreamer-discoverer-$GST_MAJORMINOR, HAVE_GST_DISCOVERER="yes", HAVE_GST_DISCOVERER="no") -if test "x$HAVE_GST_DISCOVERER" != "xyes"; then - AC_ERROR([gst-discoverer is required for rendering support]) +dnl check for gstreamer-pbutils +PKG_CHECK_MODULES(GST_PBUTILS, gstreamer-pbutils-$GST_MAJORMINOR, HAVE_GST_PBUTILS="yes", HAVE_GST_PBUTILS="no") +if test "x$HAVE_GST_PBUTILS" != "xyes"; then + AC_ERROR([gst-pbutils is required for rendering support]) fi -AC_SUBST(GST_DISCOVERER_LIBS) -AC_SUBST(GST_DISCOVERER_CFLAGS) +AC_SUBST(GST_PBUTILS_LIBS) +AC_SUBST(GST_PBUTILS_CFLAGS) dnl check for gst-controller PKG_CHECK_MODULES(GST_CONTROLLER, gstreamer-controller-$GST_MAJORMINOR, HAVE_GST_CONTROLLER="yes", HAVE_GST_CONROLLER="no") if test "x$HAVE_GST_CONTROLLER" != "xyes"; then AC_ERROR([gst-controller is required for transition support]) fi -AC_SUBST(GST_DISCOVERER_LIBS) -AC_SUBST(GST_DISCOVERER_CFLAGS) +AC_SUBST(GST_CONTROLLER_LIBS) +AC_SUBST(GST_CONTROLLER_CFLAGS) dnl Check for documentation xrefs GLIB_PREFIX="`$PKG_CONFIG --variable=prefix glib-2.0`" diff --git a/docs/libs/Makefile.am b/docs/libs/Makefile.am index a79423d8a9..30d6dda6e7 100644 --- a/docs/libs/Makefile.am +++ b/docs/libs/Makefile.am @@ -92,7 +92,7 @@ extra_files = # CFLAGS and LDFLAGS for compiling scan program. Only needed if your app/lib # contains GtkObjects/GObjects and you want to document signals and properties. -GTKDOC_CFLAGS = -I$(top_srcdir) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(GST_DISCOVERER_CFLAGS) +GTKDOC_CFLAGS = -I$(top_srcdir) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(GST_PBUTILS_CFLAGS) GTKDOC_LIBS = $(SCANOBJ_DEPS) $(GST_BASE_LIBS) $(GST_LIBS) GTKDOC_CC=$(LIBTOOL) --tag=CC --mode=compile $(CC) diff --git a/ges/Makefile.am b/ges/Makefile.am index b117f3a964..da24307911 100644 --- a/ges/Makefile.am +++ b/ges/Makefile.am @@ -76,9 +76,9 @@ libges_@GST_MAJORMINOR@include_HEADERS = \ ges-screenshot.h \ ges-utils.h -libges_@GST_MAJORMINOR@_la_CFLAGS = -I$(top_srcdir) $(GST_PROFILE_CFLAGS) $(GST_DISCOVERER_CFLAGS) $(GST_CONTROLLER_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) -libges_@GST_MAJORMINOR@_la_LIBADD = $(GST_PROFILE_LIBS) $(GST_DISCOVERER_LIBS) $(GST_CONTROLLER_LIBS) $(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) $(GST_LIBS) -libges_@GST_MAJORMINOR@_la_LDFLAGS = -lgstprofile-@GST_MAJORMINOR@ $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS) +libges_@GST_MAJORMINOR@_la_CFLAGS = -I$(top_srcdir) $(GST_PROFILE_CFLAGS) $(GST_PBUTILS_CFLAGS) $(GST_CONTROLLER_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) +libges_@GST_MAJORMINOR@_la_LIBADD = $(GST_PROFILE_LIBS) $(GST_PBUTILS_LIBS) $(GST_CONTROLLER_LIBS) $(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) $(GST_LIBS) +libges_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS) DISTCLEANFILE = $(CLEANFILES) diff --git a/ges/ges-screenshot.c b/ges/ges-screenshot.c index 55546c86f1..9d13af9026 100644 --- a/ges/ges-screenshot.c +++ b/ges/ges-screenshot.c @@ -19,8 +19,6 @@ */ #include -#include -#include #include #include "ges-screenshot.h" #include "ges-internal.h" @@ -28,7 +26,7 @@ GstBuffer * ges_play_sink_convert_frame (GstElement * playsink, GstCaps * caps) { - GstBuffer *result = NULL; + GstBuffer *result; g_object_get (G_OBJECT (playsink), "frame", (GstMiniObject *) & result, NULL); @@ -36,9 +34,16 @@ ges_play_sink_convert_frame (GstElement * playsink, GstCaps * caps) if (result != NULL && caps != NULL) { GstBuffer *temp; + GError *err = NULL; - temp = gst_video_convert_frame (result, caps, 25 * GST_SECOND, NULL); + temp = gst_video_convert_frame (result, caps, 25 * GST_SECOND, &err); gst_buffer_unref (result); + if (temp == NULL && err) { + /* I'm really uncertain whether we should make playsink post an error + * on the bus or not. It's not like it's a critical issue regarding + * playsink behaviour. */ + GST_ERROR ("Error converting frame: %s", err->message); + } result = temp; } return result; diff --git a/ges/ges-timeline.c b/ges/ges-timeline.c index e2c42db500..6bc8407d6a 100644 --- a/ges/ges-timeline.c +++ b/ges/ges-timeline.c @@ -68,10 +68,10 @@ gint custom_find_track (TrackPrivate * priv, GESTrack * track); static GstStateChangeReturn ges_timeline_change_state (GstElement * element, GstStateChange transition); static void -discoverer_ready_cb (GstDiscoverer * discoverer, GESTimeline * timeline); +discoverer_finished_cb (GstDiscoverer * discoverer, GESTimeline * timeline); static void discoverer_discovered_cb (GstDiscoverer * discoverer, - GstDiscovererInformation * info, GError * err, GESTimeline * timeline); + GstDiscovererInfo * info, GError * err, GESTimeline * timeline); static void ges_timeline_get_property (GObject * object, guint property_id, @@ -195,9 +195,9 @@ ges_timeline_init (GESTimeline * self) self->tracks = NULL; /* New discoverer with a 15s timeout */ - self->discoverer = gst_discoverer_new (15 * GST_SECOND); - g_signal_connect (self->discoverer, "ready", G_CALLBACK (discoverer_ready_cb), - self); + self->discoverer = gst_discoverer_new (15 * GST_SECOND, NULL); + g_signal_connect (self->discoverer, "finished", + G_CALLBACK (discoverer_finished_cb), self); g_signal_connect (self->discoverer, "discovered", G_CALLBACK (discoverer_discovered_cb), self); gst_discoverer_start (self->discoverer); @@ -312,60 +312,69 @@ do_async_done (GESTimeline * timeline) } static void -discoverer_ready_cb (GstDiscoverer * discoverer, GESTimeline * timeline) +discoverer_finished_cb (GstDiscoverer * discoverer, GESTimeline * timeline) { do_async_done (timeline); } static void discoverer_discovered_cb (GstDiscoverer * discoverer, - GstDiscovererInformation * info, GError * err, GESTimeline * timeline) + GstDiscovererInfo * info, GError * err, GESTimeline * timeline) { GList *tmp; gboolean found = FALSE; gboolean is_image = FALSE; GESTimelineFileSource *tfs = NULL; + const gchar *uri = gst_discoverer_info_get_uri (info); - GST_DEBUG ("Discovered uri %s", info->uri); + GST_DEBUG ("Discovered uri %s", uri); /* Find corresponding TimelineFileSource in the sources */ for (tmp = timeline->pendingobjects; tmp; tmp = tmp->next) { tfs = (GESTimelineFileSource *) tmp->data; - if (!g_strcmp0 (tfs->uri, info->uri)) { + if (!g_strcmp0 (tfs->uri, uri)) { found = TRUE; break; } } if (found) { + GList *stream_list; + /* Remove object from list */ timeline->pendingobjects = g_list_delete_link (timeline->pendingobjects, tmp); /* FIXME : Handle errors in discovery */ + stream_list = gst_discoverer_info_get_stream_list (info); /* Update timelinefilesource properties based on info */ - for (tmp = info->stream_list; tmp; tmp = tmp->next) { - GstStreamInformation *sinf = (GstStreamInformation *) tmp->data; + for (tmp = stream_list; tmp; tmp = tmp->next) { + GstDiscovererStreamInfo *sinf = (GstDiscovererStreamInfo *) tmp->data; - if (sinf->streamtype == GST_STREAM_AUDIO) + if (GST_IS_DISCOVERER_AUDIO_INFO (sinf)) tfs->supportedformats |= GES_TRACK_TYPE_AUDIO; - else if (sinf->streamtype == GST_STREAM_VIDEO) + else if (GST_IS_DISCOVERER_VIDEO_INFO (sinf)) { tfs->supportedformats |= GES_TRACK_TYPE_VIDEO; - else if (sinf->streamtype == GST_STREAM_IMAGE) { - tfs->supportedformats |= GES_TRACK_TYPE_VIDEO | GES_TRACK_TYPE_AUDIO; - is_image = TRUE; + if (gst_discoverer_video_info_get_is_image (sinf)) { + tfs->supportedformats |= GES_TRACK_TYPE_AUDIO; + is_image = TRUE; + } } } + if (stream_list) + gst_discoverer_stream_info_list_free (stream_list); + if (is_image) { /* don't set max-duration on still images */ g_object_set (tfs, "is_image", (gboolean) TRUE, NULL); } else { - g_object_set (tfs, "max-duration", (guint64) info->duration, NULL); + g_object_set (tfs, "max-duration", + gst_discoverer_info_get_duration (info), NULL); } /* Continue the processing on tfs */ @@ -431,7 +440,7 @@ layer_object_added_cb (GESTimelineLayer * layer, GESTimelineObject * object, GST_LOG ("Incomplete TimelineFileSource, discovering it"); timeline->pendingobjects = g_list_append (timeline->pendingobjects, object); - gst_discoverer_append_uri (timeline->discoverer, + gst_discoverer_discover_uri_async (timeline->discoverer, GES_TIMELINE_FILE_SOURCE (object)->uri); } else add_object_to_tracks (timeline, object); diff --git a/ges/ges-timeline.h b/ges/ges-timeline.h index b8c4b4050e..a3e0eb0c8c 100644 --- a/ges/ges-timeline.h +++ b/ges/ges-timeline.h @@ -23,7 +23,7 @@ #include #include -#include +#include #include G_BEGIN_DECLS diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am index 15f0aab984..573c090620 100644 --- a/tests/check/Makefile.am +++ b/tests/check/Makefile.am @@ -31,6 +31,6 @@ noinst_HEADERS = TESTS = $(check_PROGRAMS) AM_CFLAGS = -I$(top_srcdir) $(GST_CFLAGS) $(GST_OBJ_CFLAGS) $(GST_CHECK_CFLAGS) $(CHECK_CFLAGS) $(GST_OPTION_CFLAGS) -LDADD = $(top_builddir)/ges/libges-@GST_MAJORMINOR@.la -lges-@GST_MAJORMINOR@ $(GST_OBJ_LIBS) $(GST_CHECK_LIBS) $(CHECK_LIBS) +LDADD = $(top_builddir)/ges/libges-@GST_MAJORMINOR@.la $(GST_OBJ_LIBS) $(GST_CHECK_LIBS) $(CHECK_LIBS) EXTRA_DIST = #gst-plugins-bad.supp diff --git a/tests/examples/Makefile.am b/tests/examples/Makefile.am index 19f55e1a98..7c17b14659 100644 --- a/tests/examples/Makefile.am +++ b/tests/examples/Makefile.am @@ -17,5 +17,5 @@ noinst_PROGRAMS = \ text_properties \ $(graphical) -AM_CFLAGS = -I$(top_srcdir) $(GST_PROFILE_CFLAGS) $(GST_DISCOVERER_CFLAGS) $(GST_CFLAGS) $(GTK_CFLAGS) -export-dynamic -LDADD = $(top_builddir)/ges/libges-@GST_MAJORMINOR@.la -lges-@GST_MAJORMINOR@ -lgstdiscoverer-@GST_MAJORMINOR@ $(GST_DISCOVERER_LIBS) $(GST_LIBS) $(GTK_LIBS) +AM_CFLAGS = -I$(top_srcdir) $(GST_PROFILE_CFLAGS) $(GST_PBUTILS_CFLAGS) $(GST_CFLAGS) $(GTK_CFLAGS) -export-dynamic +LDADD = $(top_builddir)/ges/libges-@GST_MAJORMINOR@.la $(GST_PBUTILS_LIBS) $(GST_LIBS) $(GTK_LIBS) diff --git a/tests/examples/concatenate.c b/tests/examples/concatenate.c index f2fc1ce7a0..6fe8e31990 100644 --- a/tests/examples/concatenate.c +++ b/tests/examples/concatenate.c @@ -19,12 +19,11 @@ #include #include -#include +#include -GstDiscovererInformation *get_info_for_file (GstDiscoverer * disco, - gchar * filename); +GstDiscovererInfo *get_info_for_file (GstDiscoverer * disco, gchar * filename); -GstDiscovererInformation * +GstDiscovererInfo * get_info_for_file (GstDiscoverer * disco, gchar * filename) { GError *err; @@ -50,34 +49,40 @@ get_info_for_file (GstDiscoverer * disco, gchar * filename) } static GstEncodingProfile * -make_profile_from_info (GstDiscovererInformation * info) +make_profile_from_info (GstDiscovererInfo * info) { GstEncodingProfile *profile = NULL; + GstDiscovererStreamInfo *sinfo = gst_discoverer_info_get_stream_info (info); /* Get the container format */ - if (info->stream_info->streamtype == GST_STREAM_CONTAINER) { - GstStreamContainerInformation *container = - GST_STREAM_CONTAINER_INFORMATION (info->stream_info); - GList *tmp; + if (GST_IS_DISCOVERER_CONTAINER_INFO (sinfo)) { + GList *tmp, *substreams; profile = gst_encoding_profile_new ((gchar *) "concatenate", - gst_caps_copy (info->stream_info->caps), NULL, FALSE); + gst_discoverer_stream_info_get_caps (sinfo), NULL, FALSE); + + substreams = gst_discoverer_container_info_get_streams (sinfo); + /* For each on the formats add stream profiles */ - for (tmp = container->streams; tmp; tmp = tmp->next) { - GstStreamInformation *stream = GST_STREAM_INFORMATION (tmp->data); + for (tmp = substreams; tmp; tmp = tmp->next) { + GstDiscovererStreamInfo *stream = GST_DISCOVERER_STREAM_INFO (tmp->data); GstStreamEncodingProfile *sprof; sprof = - gst_stream_encoding_profile_new (stream->streamtype == - GST_STREAM_VIDEO ? GST_ENCODING_PROFILE_VIDEO : - GST_ENCODING_PROFILE_AUDIO, gst_caps_copy (stream->caps), NULL, - NULL, 1); + gst_stream_encoding_profile_new (GST_IS_DISCOVERER_VIDEO_INFO (stream) + ? GST_ENCODING_PROFILE_VIDEO : GST_ENCODING_PROFILE_AUDIO, + gst_discoverer_stream_info_get_caps (stream), NULL, NULL, 1); gst_encoding_profile_add_stream (profile, sprof); } + if (substreams) + gst_discoverer_stream_info_list_free (substreams); } else { GST_ERROR ("No container format !!!"); } + if (sinfo) + gst_discoverer_stream_info_unref (sinfo); + return profile; } @@ -127,10 +132,10 @@ main (int argc, gchar ** argv) if (!ges_timeline_add_layer (timeline, layer)) return -1; - disco = gst_discoverer_new (10 * GST_SECOND); + disco = gst_discoverer_new (10 * GST_SECOND, NULL); for (i = 2; i < argc; i++) { - GstDiscovererInformation *info; + GstDiscovererInfo *info; GESTimelineFileSource *src; info = get_info_for_file (disco, argv[i]); @@ -140,13 +145,15 @@ main (int argc, gchar ** argv) gotprofile = TRUE; } - src = ges_timeline_filesource_new (info->uri); - g_object_set (src, (gchar *) "duration", info->duration, NULL); + src = ges_timeline_filesource_new ((gchar *) + gst_discoverer_info_get_uri (info)); + g_object_set (src, (gchar *) "duration", + gst_discoverer_info_get_duration (info), NULL); /* Since we're using a GESSimpleTimelineLayer, objects will be automatically * appended to the end of the layer */ ges_timeline_layer_add_object (layer, (GESTimelineObject *) src); - gst_discoverer_information_free (info); + gst_discoverer_info_unref (info); sources = g_list_append (sources, src); } diff --git a/tools/Makefile.am b/tools/Makefile.am index 0bf0ae3908..c1791fdb32 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -1,3 +1,3 @@ bin_PROGRAMS = ges-launch -AM_CFLAGS = -I$(top_srcdir) $(GST_PROFILE_CFLAGS) $(GST_DISCOVERER_CFLAGS) $(GST_CFLAGS) -LDADD = $(top_builddir)/ges/libges-@GST_MAJORMINOR@.la -lges-@GST_MAJORMINOR@ -lgstdiscoverer-@GST_MAJORMINOR@ $(GST_DISCOVERER_LIBS) $(GST_LIBS) +AM_CFLAGS = -I$(top_srcdir) $(GST_PROFILE_CFLAGS) $(GST_PBUTILS_CFLAGS) $(GST_CFLAGS) +LDADD = $(top_builddir)/ges/libges-@GST_MAJORMINOR@.la $(GST_PBUTILS_LIBS) $(GST_LIBS)