mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
formatter: Try to figure out new paths when media files have moved
Introduces a dependency to GIO
This commit is contained in:
parent
148e7ef411
commit
7282ee2ff4
6 changed files with 71 additions and 14 deletions
|
@ -19,10 +19,10 @@ INCLUDES = -I$(top_srcdir) -I$(srcdir) $(PYTHON_INCLUDES)
|
|||
ges_la_CFLAGS = -I$(top_srcdir)\
|
||||
$(PYGST_CFLAGS) $(PYGOBJECT_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) -Wno-write-strings
|
||||
ges_la_LDFLAGS = -export-symbols-regex "^(initges|_PyGObject_API).*" \
|
||||
-module -avoid-version $(GST_PLUGIN_LDFLAGS)
|
||||
-module -avoid-version $(GST_PLUGIN_LDFLAGS) $(GIO_LDFLAGS)
|
||||
ges_la_LIBADD = $(top_builddir)/ges/libges-@GST_MAJORMINOR@.la \
|
||||
$(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) \
|
||||
$(GST_LIBS) $(PYGST_LIBS) $(LIBM)
|
||||
$(GST_LIBS) $(PYGST_LIBS) $(LIBM) $(GIO_LIBS)
|
||||
ges_la_SOURCES = gesmodule.c
|
||||
nodist_ges_la_SOURCES = ges.c
|
||||
|
||||
|
|
|
@ -197,6 +197,10 @@ dnl *** checks for dependency libraries ***
|
|||
dnl GLib is required
|
||||
AG_GST_GLIB_CHECK([2.22])
|
||||
|
||||
PKG_CHECK_MODULES(GIO, gio-2.0 >= 2.16, HAVE_GIO=yes, HAVE_GIO=no)
|
||||
AC_SUBST(GIO_CFLAGS)
|
||||
AC_SUBST(GIO_LIBS)
|
||||
|
||||
dnl checks for gstreamer
|
||||
dnl uninstalled is selected preferentially -- see pkg-config(1)
|
||||
AG_GST_CHECK_GST($GST_MAJORMINOR, [$GST_REQ], yes)
|
||||
|
|
|
@ -63,10 +63,11 @@ 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_PBUTILS_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS)
|
||||
GTKDOC_CFLAGS = -I$(top_srcdir) $(GST_PBUTILS_CFLAGS) $(GST_BASE_CFLAGS) \
|
||||
$(GST_CFLAGS) $(GIO_CFLAGS)
|
||||
GTKDOC_LIBS = \
|
||||
$(top_builddir)/ges/libges-@GST_MAJORMINOR@.la \
|
||||
$(GST_BASE_LIBS) $(GST_LIBS)
|
||||
$(GST_BASE_LIBS) $(GST_LIBS) $(GIO_LIBS)
|
||||
|
||||
GTKDOC_CC=$(LIBTOOL) --tag=CC --mode=compile $(CC)
|
||||
GTKDOC_LD=$(LIBTOOL) --tag=CC --mode=link $(CC)
|
||||
|
|
|
@ -3,7 +3,7 @@ built_source_make = gesmarshal.c
|
|||
|
||||
lib_LTLIBRARIES = libges-@GST_MAJORMINOR@.la
|
||||
|
||||
EXTRA_libges_@GST_MAJORMINOR@_la_SOURCES = gesmarshal.list
|
||||
EXTRA_libges_@GST_MAJORMINOR@_la_SOURCES = gesmarshal.list
|
||||
|
||||
CLEANFILES = $(BUILT_SOURCES) $(built_header_make) $(built_source_make)
|
||||
|
||||
|
@ -96,9 +96,14 @@ libges_@GST_MAJORMINOR@include_HEADERS = \
|
|||
noinst_HEADERS = \
|
||||
ges-internal.h
|
||||
|
||||
libges_@GST_MAJORMINOR@_la_CFLAGS = -I$(top_srcdir) $(GST_PBUTILS_CFLAGS) $(GST_VIDEO_CFLAGS) $(GST_CONTROLLER_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) $(XML_CFLAGS)
|
||||
libges_@GST_MAJORMINOR@_la_LIBADD = $(GST_PBUTILS_LIBS) $(GST_VIDEO_LIBS) $(GST_CONTROLLER_LIBS) $(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) $(GST_LIBS) $(XML_LIBS)
|
||||
libges_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS) -export-symbols-regex \^_*\(ges_\|GES_\).*
|
||||
libges_@GST_MAJORMINOR@_la_CFLAGS = -I$(top_srcdir) $(GST_PBUTILS_CFLAGS) \
|
||||
$(GST_VIDEO_CFLAGS) $(GST_CONTROLLER_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) \
|
||||
$(GST_CFLAGS) $(XML_CFLAGS) $(GIO_CFLAGS)
|
||||
libges_@GST_MAJORMINOR@_la_LIBADD = $(GST_PBUTILS_LIBS) \
|
||||
$(GST_VIDEO_LIBS) $(GST_CONTROLLER_LIBS) $(GST_PLUGINS_BASE_LIBS) \
|
||||
$(GST_BASE_LIBS) $(GST_LIBS) $(XML_LIBS) $(GIO_LIBS)
|
||||
libges_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) \
|
||||
$(GST_LT_LDFLAGS) $(GIO_CFLAGS) -export-symbols-regex \^_*\(ges_\|GES_\).*
|
||||
|
||||
DISTCLEANFILE = $(CLEANFILES)
|
||||
|
||||
|
@ -140,12 +145,14 @@ GES-@GST_MAJORMINOR@.gir: $(INTROSPECTION_SCANNER) libges-@GST_MAJORMINOR@.la
|
|||
-I$(top_builddir) \
|
||||
--add-include-path=`$(PKG_CONFIG) --variable=girdir gstreamer-0.10` \
|
||||
--add-include-path=`$(PKG_CONFIG) --variable=girdir gstreamer-pbutils-0.10` \
|
||||
--add-include-path=`$(PKG_CONFIG) --variable=girdir gio-2.0` \
|
||||
--library=libges-@GST_MAJORMINOR@.la \
|
||||
--include=Gst-@GST_MAJORMINOR@ \
|
||||
--include=GstPbutils-@GST_MAJORMINOR@ \
|
||||
--libtool="$(top_builddir)/libtool" \
|
||||
--pkg gstreamer-@GST_MAJORMINOR@ \
|
||||
--pkg gstreamer-pbutils-@GST_MAJORMINOR@ \
|
||||
--pkg gio-2.0 \
|
||||
--pkg-export ges-@GST_MAJORMINOR@ \
|
||||
--add-init-section="ges_init(NULL, NULL);" \
|
||||
--output $@ \
|
||||
|
@ -169,6 +176,7 @@ typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib)
|
|||
--includedir=$(builddir) \
|
||||
--includedir=`$(PKG_CONFIG) --variable=girdir gstreamer-0.10` \
|
||||
--includedir=`$(PKG_CONFIG) --variable=girdir gstreamer-pbutils-0.10` \
|
||||
--includedir=`$(PKG_CONFIG) --variable=girdir gio-2.0` \
|
||||
$(INTROSPECTION_COMPILER_OPTS) $< -o $(@F)
|
||||
|
||||
CLEANFILES += $(BUILT_GIRSOURCES) $(typelibs_DATA)
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
**/
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <gio/gio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "gesmarshal.h"
|
||||
|
@ -62,6 +63,7 @@ struct _GESFormatterPrivate
|
|||
/* Make sure not to emit several times "moved-source" when the user already
|
||||
* provided the new source URI. */
|
||||
GHashTable *uri_newuri_table;
|
||||
GHashTable *parent_newparent_table;
|
||||
};
|
||||
|
||||
static void ges_formatter_dispose (GObject * object);
|
||||
|
@ -132,6 +134,8 @@ ges_formatter_init (GESFormatter * object)
|
|||
|
||||
object->priv->uri_newuri_table = g_hash_table_new_full (g_str_hash,
|
||||
g_str_equal, g_free, g_free);
|
||||
object->priv->parent_newparent_table = g_hash_table_new_full (g_file_hash,
|
||||
(GEqualFunc) g_file_equal, g_object_unref, g_object_unref);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -143,6 +147,7 @@ ges_formatter_dispose (GObject * object)
|
|||
g_free (priv->data);
|
||||
}
|
||||
g_hash_table_destroy (priv->uri_newuri_table);
|
||||
g_hash_table_destroy (priv->parent_newparent_table);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -520,10 +525,21 @@ ges_formatter_update_source_uri (GESFormatter * formatter,
|
|||
g_hash_table_lookup (formatter->priv->uri_newuri_table, uri);
|
||||
|
||||
if (!cached_uri) {
|
||||
GFile *parent, *new_parent, *new_file = g_file_new_for_uri (new_uri),
|
||||
*file = g_file_new_for_uri (uri);
|
||||
|
||||
parent = g_file_get_parent (file);
|
||||
new_parent = g_file_get_parent (new_file);
|
||||
g_hash_table_insert (formatter->priv->uri_newuri_table, g_strdup (uri),
|
||||
g_strdup (new_uri));
|
||||
|
||||
GST_DEBUG ("Adding %s to the new uri cache", new_uri);
|
||||
g_hash_table_insert (formatter->priv->parent_newparent_table,
|
||||
parent, new_parent);
|
||||
|
||||
GST_DEBUG ("Adding %s and its parent to the new uri cache", new_uri);
|
||||
|
||||
g_object_unref (file);
|
||||
g_object_unref (new_file);
|
||||
}
|
||||
|
||||
return klass->update_source_uri (formatter, source, new_uri);
|
||||
|
@ -541,15 +557,43 @@ discovery_error_cb (GESTimeline * timeline,
|
|||
if (error->domain == GST_RESOURCE_ERROR &&
|
||||
error->code == GST_RESOURCE_ERROR_NOT_FOUND) {
|
||||
const gchar *uri = ges_timeline_filesource_get_uri (tfs);
|
||||
gchar *new_uri =
|
||||
g_hash_table_lookup (formatter->priv->uri_newuri_table, uri);
|
||||
gchar *new_uri = g_hash_table_lookup (formatter->priv->uri_newuri_table,
|
||||
uri);
|
||||
|
||||
/* We didn't find this exact URI, trying to find its parent new directory */
|
||||
if (!new_uri) {
|
||||
GFile *parent, *file = g_file_new_for_uri (uri);
|
||||
|
||||
/* Check if we have the new parent in cache */
|
||||
parent = g_file_get_parent (file);
|
||||
if (parent) {
|
||||
GFile *new_parent =
|
||||
g_hash_table_lookup (formatter->priv->parent_newparent_table,
|
||||
parent);
|
||||
|
||||
if (new_parent) {
|
||||
gchar *basename = g_file_get_basename (file);
|
||||
GFile *new_file = g_file_get_child (new_parent, basename);
|
||||
|
||||
new_uri = g_file_get_uri (new_file);
|
||||
|
||||
g_object_unref (new_file);
|
||||
g_object_unref (parent);
|
||||
g_free (basename);
|
||||
}
|
||||
}
|
||||
|
||||
g_object_unref (file);
|
||||
}
|
||||
|
||||
if (new_uri) {
|
||||
ges_formatter_update_source_uri (formatter, tfs, new_uri);
|
||||
GST_DEBUG ("%s found in the cache, new uri: %s", uri, new_uri);
|
||||
} else
|
||||
|
||||
} else {
|
||||
g_signal_emit (formatter, ges_formatter_signals[SOURCE_MOVED_SIGNAL], 0,
|
||||
tfs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
bin_PROGRAMS = ges-launch-@GST_MAJORMINOR@
|
||||
AM_CFLAGS = -I$(top_srcdir) $(GST_PBUTILS_CFLAGS) $(GST_CFLAGS)
|
||||
LDADD = $(top_builddir)/ges/libges-@GST_MAJORMINOR@.la $(GST_PBUTILS_LIBS) $(GST_LIBS)
|
||||
AM_CFLAGS = -I$(top_srcdir) $(GST_PBUTILS_CFLAGS) $(GST_CFLAGS) $(GIO_CFLAGS)
|
||||
LDADD = $(top_builddir)/ges/libges-@GST_MAJORMINOR@.la $(GST_PBUTILS_LIBS) $(GST_LIBS) $(GIO_LIBS)
|
||||
|
||||
ges_launch_@GST_MAJORMINOR@_SOURCES = ges-launch.c
|
||||
|
||||
|
|
Loading…
Reference in a new issue