ges: Add a "discovery-error" signal to GESTimeline

API: GESTimeline::discovery-error signal
This commit is contained in:
Thibault Saunier 2012-01-04 14:46:54 -03:00
parent 3ca5e7bcaa
commit b844ff04de

View file

@ -98,6 +98,7 @@ enum
TRACK_REMOVED,
LAYER_ADDED,
LAYER_REMOVED,
DISCOVERY_ERROR,
LAST_SIGNAL
};
@ -262,6 +263,18 @@ ges_timeline_class_init (GESTimelineClass * klass)
G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GESTimelineClass, layer_removed),
NULL, NULL, ges_marshal_VOID__OBJECT, G_TYPE_NONE, 1,
GES_TYPE_TIMELINE_LAYER);
/**
* GESTimeline::discovery-error:
* @formatter: the #GESFormatter
* @source: The #GESTimelineFileSource that could not be discovered properly
* @error: (type GLib.Error): #GError, which will be non-NULL if an error
* occurred during discovery
*/
ges_timeline_signals[DISCOVERY_ERROR] =
g_signal_new ("discovery-error", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST, 0, NULL, NULL, gst_marshal_VOID__OBJECT_BOXED,
G_TYPE_NONE, 2, GES_TYPE_TIMELINE_FILE_SOURCE, GST_TYPE_G_ERROR);
}
static void
@ -508,19 +521,15 @@ discoverer_discovered_cb (GstDiscoverer * discoverer,
GstDiscovererInfo * info, GError * err, GESTimeline * timeline)
{
GList *tmp;
GList *stream_list;
GESTrackType tfs_supportedformats;
gboolean found = FALSE;
gboolean is_image = FALSE;
GESTimelineFileSource *tfs = NULL;
GESTimelinePrivate *priv = timeline->priv;
const gchar *uri = gst_discoverer_info_get_uri (info);
if (err) {
GST_WARNING ("Error while discovering %s: %s", uri, err->message);
return;
} else
GST_DEBUG ("Discovered uri %s", uri);
GES_TIMELINE_PENDINGOBJS_LOCK (timeline);
/* Find corresponding TimelineFileSource in the sources */
@ -533,9 +542,29 @@ discoverer_discovered_cb (GstDiscoverer * discoverer,
}
}
if (found) {
GList *stream_list;
GESTrackType tfs_supportedformats;
if (!found) {
GST_WARNING ("Discovered %s, that seems not to be in the list of sources"
"to discover", uri);
GES_TIMELINE_PENDINGOBJS_UNLOCK (timeline);
return;
}
if (err) {
GError *propagate_error = NULL;
priv->pendingobjects = g_list_delete_link (priv->pendingobjects, tmp);
GES_TIMELINE_PENDINGOBJS_UNLOCK (timeline);
GST_WARNING ("Error while discovering %s: %s", uri, err->message);
g_propagate_error (&propagate_error, err);
g_signal_emit (timeline, ges_timeline_signals[DISCOVERY_ERROR], 0, tfs,
propagate_error);
return;
}
/* Everything went fine... let's do our job! */
GST_DEBUG ("Discovered uri %s", uri);
/* The timeline file source will be updated with discovered information
* so it needs to not be finalized during this process */
@ -558,12 +587,10 @@ discoverer_discovered_cb (GstDiscoverer * discoverer,
if (GST_IS_DISCOVERER_AUDIO_INFO (sinf)) {
tfs_supportedformats |= GES_TRACK_TYPE_AUDIO;
ges_timeline_filesource_set_supported_formats (tfs,
tfs_supportedformats);
ges_timeline_filesource_set_supported_formats (tfs, tfs_supportedformats);
} else if (GST_IS_DISCOVERER_VIDEO_INFO (sinf)) {
tfs_supportedformats |= GES_TRACK_TYPE_VIDEO;
ges_timeline_filesource_set_supported_formats (tfs,
tfs_supportedformats);
ges_timeline_filesource_set_supported_formats (tfs, tfs_supportedformats);
if (gst_discoverer_video_info_is_image ((GstDiscovererVideoInfo *)
sinf)) {
tfs_supportedformats |= GES_TRACK_TYPE_AUDIO;
@ -577,7 +604,7 @@ discoverer_discovered_cb (GstDiscoverer * discoverer,
if (stream_list)
gst_discoverer_stream_info_list_free (stream_list);
check_image:
check_image:
if (is_image) {
/* don't set max-duration on still images */
@ -592,14 +619,8 @@ discoverer_discovered_cb (GstDiscoverer * discoverer,
gst_discoverer_info_get_duration (info), NULL);
}
/* Continue the processing on tfs */
add_object_to_tracks (timeline, GES_TIMELINE_OBJECT (tfs));
/* Remove the ref as the timeline file source is no longer needed here */
g_object_unref (tfs);
} else {
GES_TIMELINE_PENDINGOBJS_UNLOCK (timeline);
}
}
static GstStateChangeReturn