gboolean uri_clip_set_max_duration (GESTimelineElement * element, GstClockTime maxduration) { if (_DURATION (element) == GST_CLOCK_TIME_NONE || _DURATION (element) == 0) /* If we don't have a valid duration, use the max duration */ _set_duration0 (element, maxduration - _INPOINT (element)); return GES_TIMELINE_ELEMENT_CLASS (parent_class)->set_max_duration (element, maxduration); }
static inline void update_gaps (GESTrack * track) { Gap *gap; GList *gaps; GSequenceIter *it; GESTrackElement *trackelement; GstClockTime start, end, duration = 0, timeline_duration; GESTrackPrivate *priv = track->priv; if (priv->create_element_for_gaps == NULL) { GST_INFO ("Not filling the gaps as no create_element_for_gaps vmethod" " provided"); return; } gaps = priv->gaps; priv->gaps = NULL; /* 1- And recalculate gaps */ for (it = g_sequence_get_begin_iter (priv->trackelements_by_start); g_sequence_iter_is_end (it) == FALSE; it = g_sequence_iter_next (it)) { trackelement = g_sequence_get (it); start = _START (trackelement); end = start + _DURATION (trackelement); if (start > duration) { /* 2- Fill gap */ gap = gap_new (track, duration, start - duration); if (G_LIKELY (gap != NULL)) priv->gaps = g_list_prepend (priv->gaps, gap); } duration = MAX (duration, end); } /* 4- Add a gap at the end of the timeline if needed */ if (priv->timeline) { g_object_get (priv->timeline, "duration", &timeline_duration, NULL); if (duration < timeline_duration) { gap = gap_new (track, duration, timeline_duration - duration); if (G_LIKELY (gap != NULL)) { priv->gaps = g_list_prepend (priv->gaps, gap); } priv->duration = timeline_duration; } } /* 4- Remove old gaps */ g_list_free_full (gaps, (GDestroyNotify) free_gap); }
static gboolean _set_duration (GESTimelineElement * element, GstClockTime duration) { GList *tmp; GESContainer *container = GES_CONTAINER (element); GESContainerPrivate *priv = container->priv; for (tmp = container->children; tmp; tmp = g_list_next (tmp)) { GESTimelineElement *child = (GESTimelineElement *) tmp->data; ChildMapping *map = g_hash_table_lookup (priv->mappings, child); map->duration_offset = duration - _DURATION (child); } return TRUE; }
static void asset_created_cb (GObject * source, GAsyncResult * res, gpointer udata) { GList *tracks, *tmp; GESAsset *asset; GESLayer *layer; GESUriClip *tlfs; GError *error = NULL; asset = ges_asset_request_finish (res, &error); ASSERT_OBJECT_REFCOUNT (asset, "1 for us + for the cache + 1 taken " "by g_simple_async_result_complete_in_idle", 3); fail_unless (error == NULL); fail_if (asset == NULL); fail_if (g_strcmp0 (ges_asset_get_id (asset), av_uri)); layer = GES_LAYER (g_async_result_get_user_data (res)); tlfs = GES_URI_CLIP (ges_layer_add_asset (layer, asset, 0, 0, GST_CLOCK_TIME_NONE, GES_TRACK_TYPE_UNKNOWN)); fail_unless (GES_IS_URI_CLIP (tlfs)); fail_if (g_strcmp0 (ges_uri_clip_get_uri (tlfs), av_uri)); assert_equals_uint64 (_DURATION (tlfs), GST_SECOND); fail_unless (ges_clip_get_supported_formats (GES_CLIP (tlfs)) & GES_TRACK_TYPE_VIDEO); fail_unless (ges_clip_get_supported_formats (GES_CLIP (tlfs)) & GES_TRACK_TYPE_AUDIO); tracks = ges_timeline_get_tracks (ges_layer_get_timeline (layer)); for (tmp = tracks; tmp; tmp = tmp->next) { GList *trackelements = ges_track_get_elements (GES_TRACK (tmp->data)); assert_equals_int (g_list_length (trackelements), 1); fail_unless (GES_IS_VIDEO_URI_SOURCE (trackelements->data) || GES_IS_AUDIO_URI_SOURCE (trackelements->data)); g_list_free_full (trackelements, gst_object_unref); } g_list_free_full (tracks, gst_object_unref); gst_object_unref (asset); g_main_loop_quit (mainloop); }
static gboolean _set_duration (GESTimelineElement * element, GstClockTime duration) { GESTrackElement *object = GES_TRACK_ELEMENT (element); GESTrackElementPrivate *priv = object->priv; if (GST_CLOCK_TIME_IS_VALID (_MAXDURATION (element)) && duration > _INPOINT (object) + _MAXDURATION (element)) duration = _MAXDURATION (element) - _INPOINT (object); if (priv->gnlobject != NULL) { if (G_UNLIKELY (duration == _DURATION (object))) return FALSE; g_object_set (priv->gnlobject, "duration", duration, NULL); } else priv->pending_duration = duration; _update_control_bindings (element, ges_timeline_element_get_inpoint (element), duration); return TRUE; }