all: Changes for discoverer being merged upstream

Along with a whole bunch of Makefile fixups
This commit is contained in:
Edward Hervey 2010-09-23 18:33:27 +02:00
parent ffc5502d1a
commit 6364e8ec2c
10 changed files with 84 additions and 63 deletions

View file

@ -50,8 +50,8 @@ AC_LIBTOOL_WIN32_DLL
AM_PROG_LIBTOOL AM_PROG_LIBTOOL
dnl *** required versions of GStreamer stuff *** dnl *** required versions of GStreamer stuff ***
GST_REQ=0.10.29.3 GST_REQ=0.10.30.1
GSTPB_REQ=0.10.29.1 GSTPB_REQ=0.10.30.1
dnl *** autotools stuff **** dnl *** autotools stuff ****
@ -164,21 +164,21 @@ fi
AC_SUBST(GST_PROFILE_LIBS) AC_SUBST(GST_PROFILE_LIBS)
AC_SUBST(GST_PROFILE_CFLAGS) AC_SUBST(GST_PROFILE_CFLAGS)
dnl check for gstreamer-discoverer dnl check for gstreamer-pbutils
PKG_CHECK_MODULES(GST_DISCOVERER, gstreamer-discoverer-$GST_MAJORMINOR, HAVE_GST_DISCOVERER="yes", HAVE_GST_DISCOVERER="no") PKG_CHECK_MODULES(GST_PBUTILS, gstreamer-pbutils-$GST_MAJORMINOR, HAVE_GST_PBUTILS="yes", HAVE_GST_PBUTILS="no")
if test "x$HAVE_GST_DISCOVERER" != "xyes"; then if test "x$HAVE_GST_PBUTILS" != "xyes"; then
AC_ERROR([gst-discoverer is required for rendering support]) AC_ERROR([gst-pbutils is required for rendering support])
fi fi
AC_SUBST(GST_DISCOVERER_LIBS) AC_SUBST(GST_PBUTILS_LIBS)
AC_SUBST(GST_DISCOVERER_CFLAGS) AC_SUBST(GST_PBUTILS_CFLAGS)
dnl check for gst-controller dnl check for gst-controller
PKG_CHECK_MODULES(GST_CONTROLLER, gstreamer-controller-$GST_MAJORMINOR, HAVE_GST_CONTROLLER="yes", HAVE_GST_CONROLLER="no") 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 if test "x$HAVE_GST_CONTROLLER" != "xyes"; then
AC_ERROR([gst-controller is required for transition support]) AC_ERROR([gst-controller is required for transition support])
fi fi
AC_SUBST(GST_DISCOVERER_LIBS) AC_SUBST(GST_CONTROLLER_LIBS)
AC_SUBST(GST_DISCOVERER_CFLAGS) AC_SUBST(GST_CONTROLLER_CFLAGS)
dnl Check for documentation xrefs dnl Check for documentation xrefs
GLIB_PREFIX="`$PKG_CONFIG --variable=prefix glib-2.0`" GLIB_PREFIX="`$PKG_CONFIG --variable=prefix glib-2.0`"

View file

@ -92,7 +92,7 @@ extra_files =
# CFLAGS and LDFLAGS for compiling scan program. Only needed if your app/lib # CFLAGS and LDFLAGS for compiling scan program. Only needed if your app/lib
# contains GtkObjects/GObjects and you want to document signals and properties. # 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_LIBS = $(SCANOBJ_DEPS) $(GST_BASE_LIBS) $(GST_LIBS)
GTKDOC_CC=$(LIBTOOL) --tag=CC --mode=compile $(CC) GTKDOC_CC=$(LIBTOOL) --tag=CC --mode=compile $(CC)

View file

@ -76,9 +76,9 @@ libges_@GST_MAJORMINOR@include_HEADERS = \
ges-screenshot.h \ ges-screenshot.h \
ges-utils.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_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_DISCOVERER_LIBS) $(GST_CONTROLLER_LIBS) $(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) $(GST_LIBS) 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 = -lgstprofile-@GST_MAJORMINOR@ $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS) libges_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)
DISTCLEANFILE = $(CLEANFILES) DISTCLEANFILE = $(CLEANFILES)

View file

@ -19,8 +19,6 @@
*/ */
#include <gst/gst.h> #include <gst/gst.h>
#include <glib-object.h>
#include <string.h>
#include <gst/video/video.h> #include <gst/video/video.h>
#include "ges-screenshot.h" #include "ges-screenshot.h"
#include "ges-internal.h" #include "ges-internal.h"
@ -28,7 +26,7 @@
GstBuffer * GstBuffer *
ges_play_sink_convert_frame (GstElement * playsink, GstCaps * caps) ges_play_sink_convert_frame (GstElement * playsink, GstCaps * caps)
{ {
GstBuffer *result = NULL; GstBuffer *result;
g_object_get (G_OBJECT (playsink), "frame", (GstMiniObject *) & result, NULL); 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) { if (result != NULL && caps != NULL) {
GstBuffer *temp; 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); 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; result = temp;
} }
return result; return result;

View file

@ -68,10 +68,10 @@ gint custom_find_track (TrackPrivate * priv, GESTrack * track);
static GstStateChangeReturn static GstStateChangeReturn
ges_timeline_change_state (GstElement * element, GstStateChange transition); ges_timeline_change_state (GstElement * element, GstStateChange transition);
static void static void
discoverer_ready_cb (GstDiscoverer * discoverer, GESTimeline * timeline); discoverer_finished_cb (GstDiscoverer * discoverer, GESTimeline * timeline);
static void static void
discoverer_discovered_cb (GstDiscoverer * discoverer, discoverer_discovered_cb (GstDiscoverer * discoverer,
GstDiscovererInformation * info, GError * err, GESTimeline * timeline); GstDiscovererInfo * info, GError * err, GESTimeline * timeline);
static void static void
ges_timeline_get_property (GObject * object, guint property_id, ges_timeline_get_property (GObject * object, guint property_id,
@ -195,9 +195,9 @@ ges_timeline_init (GESTimeline * self)
self->tracks = NULL; self->tracks = NULL;
/* New discoverer with a 15s timeout */ /* New discoverer with a 15s timeout */
self->discoverer = gst_discoverer_new (15 * GST_SECOND); self->discoverer = gst_discoverer_new (15 * GST_SECOND, NULL);
g_signal_connect (self->discoverer, "ready", G_CALLBACK (discoverer_ready_cb), g_signal_connect (self->discoverer, "finished",
self); G_CALLBACK (discoverer_finished_cb), self);
g_signal_connect (self->discoverer, "discovered", g_signal_connect (self->discoverer, "discovered",
G_CALLBACK (discoverer_discovered_cb), self); G_CALLBACK (discoverer_discovered_cb), self);
gst_discoverer_start (self->discoverer); gst_discoverer_start (self->discoverer);
@ -312,60 +312,69 @@ do_async_done (GESTimeline * timeline)
} }
static void static void
discoverer_ready_cb (GstDiscoverer * discoverer, GESTimeline * timeline) discoverer_finished_cb (GstDiscoverer * discoverer, GESTimeline * timeline)
{ {
do_async_done (timeline); do_async_done (timeline);
} }
static void static void
discoverer_discovered_cb (GstDiscoverer * discoverer, discoverer_discovered_cb (GstDiscoverer * discoverer,
GstDiscovererInformation * info, GError * err, GESTimeline * timeline) GstDiscovererInfo * info, GError * err, GESTimeline * timeline)
{ {
GList *tmp; GList *tmp;
gboolean found = FALSE; gboolean found = FALSE;
gboolean is_image = FALSE; gboolean is_image = FALSE;
GESTimelineFileSource *tfs = NULL; 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 */ /* Find corresponding TimelineFileSource in the sources */
for (tmp = timeline->pendingobjects; tmp; tmp = tmp->next) { for (tmp = timeline->pendingobjects; tmp; tmp = tmp->next) {
tfs = (GESTimelineFileSource *) tmp->data; tfs = (GESTimelineFileSource *) tmp->data;
if (!g_strcmp0 (tfs->uri, info->uri)) { if (!g_strcmp0 (tfs->uri, uri)) {
found = TRUE; found = TRUE;
break; break;
} }
} }
if (found) { if (found) {
GList *stream_list;
/* Remove object from list */ /* Remove object from list */
timeline->pendingobjects = timeline->pendingobjects =
g_list_delete_link (timeline->pendingobjects, tmp); g_list_delete_link (timeline->pendingobjects, tmp);
/* FIXME : Handle errors in discovery */ /* FIXME : Handle errors in discovery */
stream_list = gst_discoverer_info_get_stream_list (info);
/* Update timelinefilesource properties based on info */ /* Update timelinefilesource properties based on info */
for (tmp = info->stream_list; tmp; tmp = tmp->next) { for (tmp = stream_list; tmp; tmp = tmp->next) {
GstStreamInformation *sinf = (GstStreamInformation *) tmp->data; GstDiscovererStreamInfo *sinf = (GstDiscovererStreamInfo *) tmp->data;
if (sinf->streamtype == GST_STREAM_AUDIO) if (GST_IS_DISCOVERER_AUDIO_INFO (sinf))
tfs->supportedformats |= GES_TRACK_TYPE_AUDIO; 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; tfs->supportedformats |= GES_TRACK_TYPE_VIDEO;
else if (sinf->streamtype == GST_STREAM_IMAGE) { if (gst_discoverer_video_info_get_is_image (sinf)) {
tfs->supportedformats |= GES_TRACK_TYPE_VIDEO | GES_TRACK_TYPE_AUDIO; tfs->supportedformats |= GES_TRACK_TYPE_AUDIO;
is_image = TRUE; is_image = TRUE;
}
} }
} }
if (stream_list)
gst_discoverer_stream_info_list_free (stream_list);
if (is_image) { if (is_image) {
/* don't set max-duration on still images */ /* don't set max-duration on still images */
g_object_set (tfs, "is_image", (gboolean) TRUE, NULL); g_object_set (tfs, "is_image", (gboolean) TRUE, NULL);
} }
else { 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 */ /* Continue the processing on tfs */
@ -431,7 +440,7 @@ layer_object_added_cb (GESTimelineLayer * layer, GESTimelineObject * object,
GST_LOG ("Incomplete TimelineFileSource, discovering it"); GST_LOG ("Incomplete TimelineFileSource, discovering it");
timeline->pendingobjects = timeline->pendingobjects =
g_list_append (timeline->pendingobjects, object); 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); GES_TIMELINE_FILE_SOURCE (object)->uri);
} else } else
add_object_to_tracks (timeline, object); add_object_to_tracks (timeline, object);

View file

@ -23,7 +23,7 @@
#include <glib-object.h> #include <glib-object.h>
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/discoverer/gstdiscoverer.h> #include <gst/pbutils/gstdiscoverer.h>
#include <ges/ges-types.h> #include <ges/ges-types.h>
G_BEGIN_DECLS G_BEGIN_DECLS

View file

@ -31,6 +31,6 @@ noinst_HEADERS =
TESTS = $(check_PROGRAMS) TESTS = $(check_PROGRAMS)
AM_CFLAGS = -I$(top_srcdir) $(GST_CFLAGS) $(GST_OBJ_CFLAGS) $(GST_CHECK_CFLAGS) $(CHECK_CFLAGS) $(GST_OPTION_CFLAGS) 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 EXTRA_DIST = #gst-plugins-bad.supp

View file

@ -17,5 +17,5 @@ noinst_PROGRAMS = \
text_properties \ text_properties \
$(graphical) $(graphical)
AM_CFLAGS = -I$(top_srcdir) $(GST_PROFILE_CFLAGS) $(GST_DISCOVERER_CFLAGS) $(GST_CFLAGS) $(GTK_CFLAGS) -export-dynamic 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 -lges-@GST_MAJORMINOR@ -lgstdiscoverer-@GST_MAJORMINOR@ $(GST_DISCOVERER_LIBS) $(GST_LIBS) $(GTK_LIBS) LDADD = $(top_builddir)/ges/libges-@GST_MAJORMINOR@.la $(GST_PBUTILS_LIBS) $(GST_LIBS) $(GTK_LIBS)

View file

@ -19,12 +19,11 @@
#include <ges/ges.h> #include <ges/ges.h>
#include <gst/profile/gstprofile.h> #include <gst/profile/gstprofile.h>
#include <gst/discoverer/gstdiscoverer.h> #include <gst/pbutils/gstdiscoverer.h>
GstDiscovererInformation *get_info_for_file (GstDiscoverer * disco, GstDiscovererInfo *get_info_for_file (GstDiscoverer * disco, gchar * filename);
gchar * filename);
GstDiscovererInformation * GstDiscovererInfo *
get_info_for_file (GstDiscoverer * disco, gchar * filename) get_info_for_file (GstDiscoverer * disco, gchar * filename)
{ {
GError *err; GError *err;
@ -50,34 +49,40 @@ get_info_for_file (GstDiscoverer * disco, gchar * filename)
} }
static GstEncodingProfile * static GstEncodingProfile *
make_profile_from_info (GstDiscovererInformation * info) make_profile_from_info (GstDiscovererInfo * info)
{ {
GstEncodingProfile *profile = NULL; GstEncodingProfile *profile = NULL;
GstDiscovererStreamInfo *sinfo = gst_discoverer_info_get_stream_info (info);
/* Get the container format */ /* Get the container format */
if (info->stream_info->streamtype == GST_STREAM_CONTAINER) { if (GST_IS_DISCOVERER_CONTAINER_INFO (sinfo)) {
GstStreamContainerInformation *container = GList *tmp, *substreams;
GST_STREAM_CONTAINER_INFORMATION (info->stream_info);
GList *tmp;
profile = gst_encoding_profile_new ((gchar *) "concatenate", 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 each on the formats add stream profiles */
for (tmp = container->streams; tmp; tmp = tmp->next) { for (tmp = substreams; tmp; tmp = tmp->next) {
GstStreamInformation *stream = GST_STREAM_INFORMATION (tmp->data); GstDiscovererStreamInfo *stream = GST_DISCOVERER_STREAM_INFO (tmp->data);
GstStreamEncodingProfile *sprof; GstStreamEncodingProfile *sprof;
sprof = sprof =
gst_stream_encoding_profile_new (stream->streamtype == gst_stream_encoding_profile_new (GST_IS_DISCOVERER_VIDEO_INFO (stream)
GST_STREAM_VIDEO ? GST_ENCODING_PROFILE_VIDEO : ? GST_ENCODING_PROFILE_VIDEO : GST_ENCODING_PROFILE_AUDIO,
GST_ENCODING_PROFILE_AUDIO, gst_caps_copy (stream->caps), NULL, gst_discoverer_stream_info_get_caps (stream), NULL, NULL, 1);
NULL, 1);
gst_encoding_profile_add_stream (profile, sprof); gst_encoding_profile_add_stream (profile, sprof);
} }
if (substreams)
gst_discoverer_stream_info_list_free (substreams);
} else { } else {
GST_ERROR ("No container format !!!"); GST_ERROR ("No container format !!!");
} }
if (sinfo)
gst_discoverer_stream_info_unref (sinfo);
return profile; return profile;
} }
@ -127,10 +132,10 @@ main (int argc, gchar ** argv)
if (!ges_timeline_add_layer (timeline, layer)) if (!ges_timeline_add_layer (timeline, layer))
return -1; return -1;
disco = gst_discoverer_new (10 * GST_SECOND); disco = gst_discoverer_new (10 * GST_SECOND, NULL);
for (i = 2; i < argc; i++) { for (i = 2; i < argc; i++) {
GstDiscovererInformation *info; GstDiscovererInfo *info;
GESTimelineFileSource *src; GESTimelineFileSource *src;
info = get_info_for_file (disco, argv[i]); info = get_info_for_file (disco, argv[i]);
@ -140,13 +145,15 @@ main (int argc, gchar ** argv)
gotprofile = TRUE; gotprofile = TRUE;
} }
src = ges_timeline_filesource_new (info->uri); src = ges_timeline_filesource_new ((gchar *)
g_object_set (src, (gchar *) "duration", info->duration, NULL); 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 /* Since we're using a GESSimpleTimelineLayer, objects will be automatically
* appended to the end of the layer */ * appended to the end of the layer */
ges_timeline_layer_add_object (layer, (GESTimelineObject *) src); ges_timeline_layer_add_object (layer, (GESTimelineObject *) src);
gst_discoverer_information_free (info); gst_discoverer_info_unref (info);
sources = g_list_append (sources, src); sources = g_list_append (sources, src);
} }

View file

@ -1,3 +1,3 @@
bin_PROGRAMS = ges-launch bin_PROGRAMS = ges-launch
AM_CFLAGS = -I$(top_srcdir) $(GST_PROFILE_CFLAGS) $(GST_DISCOVERER_CFLAGS) $(GST_CFLAGS) AM_CFLAGS = -I$(top_srcdir) $(GST_PROFILE_CFLAGS) $(GST_PBUTILS_CFLAGS) $(GST_CFLAGS)
LDADD = $(top_builddir)/ges/libges-@GST_MAJORMINOR@.la -lges-@GST_MAJORMINOR@ -lgstdiscoverer-@GST_MAJORMINOR@ $(GST_DISCOVERER_LIBS) $(GST_LIBS) LDADD = $(top_builddir)/ges/libges-@GST_MAJORMINOR@.la $(GST_PBUTILS_LIBS) $(GST_LIBS)