From b5c52a17ec9eb2a86ffd03ee6ace6d6e9173a1ec Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Tue, 23 Apr 2013 19:57:44 -0300 Subject: [PATCH] layer: Remove the "rate" property of ges_timeline_layer_add_asset API: - ges_timeline_layer_add_asset (layer, asset, start, inpoint, duration, rate, track_types); + ges_timeline_layer_add_asset (layer, asset, start, inpoint, duration, track_types); --- ges/ges-base-xml-formatter.c | 17 +++++++---------- ges/ges-internal.h | 1 - ges/ges-timeline-layer.c | 7 +++---- ges/ges-timeline-layer.h | 1 - ges/ges-timeline.c | 2 +- ges/ges-xml-formatter.c | 9 +-------- tests/benchmarks/timeline.c | 4 ++-- tests/check/ges/clip.c | 2 +- tests/check/ges/layer.c | 24 ++++++++++++------------ tests/check/ges/timelineedition.c | 8 ++++---- tests/check/ges/uriclip.c | 4 ++-- tests/examples/test1.c | 6 +++--- 12 files changed, 36 insertions(+), 49 deletions(-) diff --git a/ges/ges-base-xml-formatter.c b/ges/ges-base-xml-formatter.c index 23eda59..68df54f 100644 --- a/ges/ges-base-xml-formatter.c +++ b/ges/ges-base-xml-formatter.c @@ -43,7 +43,6 @@ typedef struct PendingEffects typedef struct PendingClip { gchar *id; - gdouble rate; guint layer_prio; GstClockTime start; GstClockTime inpoint; @@ -408,12 +407,12 @@ set_property_foreach (GQuark field_id, const GValue * value, GObject * object) static inline GESClip * _add_object_to_layer (GESBaseXmlFormatterPrivate * priv, const gchar * id, GESTimelineLayer * layer, GESAsset * asset, GstClockTime start, - GstClockTime inpoint, GstClockTime duration, gdouble rate, + GstClockTime inpoint, GstClockTime duration, GESTrackType track_types, const gchar * metadatas, GstStructure * properties) { GESClip *clip = ges_timeline_layer_add_asset (layer, - asset, start, inpoint, duration, rate, track_types); + asset, start, inpoint, duration, track_types); if (clip == NULL) { GST_WARNING_OBJECT (clip, "Could not add object from asset: %s", @@ -562,8 +561,8 @@ new_asset_cb (GESAsset * source, GAsyncResult * res, PendingAsset * passet) clip = _add_object_to_layer (priv, pend->id, pend->layer, asset, - pend->start, pend->inpoint, pend->duration, pend->rate, - pend->track_types, pend->metadatas, pend->properties); + pend->start, pend->inpoint, pend->duration, pend->track_types, + pend->metadatas, pend->properties); if (clip == NULL) continue; @@ -674,7 +673,7 @@ ges_base_xml_formatter_add_asset (GESBaseXmlFormatter * self, void ges_base_xml_formatter_add_clip (GESBaseXmlFormatter * self, const gchar * id, const char *asset_id, GType type, GstClockTime start, - GstClockTime inpoint, GstClockTime duration, gdouble rate, + GstClockTime inpoint, GstClockTime duration, guint layer_prio, GESTrackType track_types, GstStructure * properties, const gchar * metadatas, GError ** error) { @@ -696,7 +695,7 @@ ges_base_xml_formatter_add_clip (GESBaseXmlFormatter * self, /* We do not want the properties that are passed to layer-add_asset to be reset */ if (properties) - gst_structure_remove_fields (properties, "supported-formats", "rate", + gst_structure_remove_fields (properties, "supported-formats", "inpoint", "start", "ducation", NULL); asset = ges_asset_request (type, asset_id, NULL); @@ -723,7 +722,6 @@ ges_base_xml_formatter_add_clip (GESBaseXmlFormatter * self, pclip, asset_id, g_list_length (pendings)); pclip->id = g_strdup (id); - pclip->rate = rate; pclip->track_types = track_types; pclip->duration = duration; pclip->inpoint = inpoint; @@ -742,8 +740,7 @@ ges_base_xml_formatter_add_clip (GESBaseXmlFormatter * self, } nclip = _add_object_to_layer (priv, id, entry->layer, - asset, start, inpoint, duration, rate, track_types, metadatas, - properties); + asset, start, inpoint, duration, track_types, metadatas, properties); if (!nclip) return; diff --git a/ges/ges-internal.h b/ges/ges-internal.h index 9df37a7..ad986a6 100644 --- a/ges/ges-internal.h +++ b/ges/ges-internal.h @@ -168,7 +168,6 @@ G_GNUC_INTERNAL void ges_base_xml_formatter_add_clip (GESBaseXmlFormatter * self GstClockTime start, GstClockTime inpoint, GstClockTime duration, - gdouble rate, guint layer_prio, GESTrackType track_types, GstStructure *properties, diff --git a/ges/ges-timeline-layer.c b/ges/ges-timeline-layer.c index 8a41a1c..2de4cb6 100644 --- a/ges/ges-timeline-layer.c +++ b/ges/ges-timeline-layer.c @@ -570,7 +570,6 @@ ges_timeline_layer_add_clip (GESTimelineLayer * layer, GESClip * clip) * @start: The start value to set on the new #GESClip * @inpoint: The inpoint value to set on the new #GESClip * @duration: The duration value to set on the new #GESClip - * @rate: The rate value to set on the new #GESClip * @track_types: The #GESTrackType to set on the the new #GESClip * * Creates Clip from asset, adds it to layer and @@ -581,7 +580,7 @@ ges_timeline_layer_add_clip (GESTimelineLayer * layer, GESClip * clip) GESClip * ges_timeline_layer_add_asset (GESTimelineLayer * layer, GESAsset * asset, GstClockTime start, GstClockTime inpoint, - GstClockTime duration, gdouble rate, GESTrackType track_types) + GstClockTime duration, GESTrackType track_types) { GESClip *clip; @@ -591,9 +590,9 @@ ges_timeline_layer_add_asset (GESTimelineLayer * layer, (asset), GES_TYPE_CLIP), NULL); GST_DEBUG_OBJECT (layer, "Adding asset %s with: start: %" GST_TIME_FORMAT - " inpoint: %" GST_TIME_FORMAT " duration: %" GST_TIME_FORMAT " rate %f" + " inpoint: %" GST_TIME_FORMAT " duration: %" GST_TIME_FORMAT " track types: %d (%s)", ges_asset_get_id (asset), GST_TIME_ARGS (start), - GST_TIME_ARGS (inpoint), GST_TIME_ARGS (duration), rate, track_types, + GST_TIME_ARGS (inpoint), GST_TIME_ARGS (duration), track_types, ges_track_type_name (track_types)); clip = GES_CLIP (ges_asset_extract (asset, NULL)); diff --git a/ges/ges-timeline-layer.h b/ges/ges-timeline-layer.h index 93c0289..4148f7c 100644 --- a/ges/ges-timeline-layer.h +++ b/ges/ges-timeline-layer.h @@ -106,7 +106,6 @@ GESClip * ges_timeline_layer_add_asset (GESTimelineLayer *layer, GstClockTime start, GstClockTime inpoint, GstClockTime duration, - gdouble rate, GESTrackType track_types); gboolean ges_timeline_layer_remove_clip (GESTimelineLayer * layer, diff --git a/ges/ges-timeline.c b/ges/ges-timeline.c index 3394e41..310fda9 100644 --- a/ges/ges-timeline.c +++ b/ges/ges-timeline.c @@ -682,7 +682,7 @@ create_transition (GESTimeline * timeline, GESTrackElement * previous, /* TODO make it possible to specify a Transition asset in the API */ asset = ges_asset_request (GES_TYPE_TRANSITION_CLIP, "crossfade", NULL); transition = - ges_timeline_layer_add_asset (layer, asset, start, 0, duration, 1, + ges_timeline_layer_add_asset (layer, asset, start, 0, duration, ges_track_element_get_track_type (next)); } else { GST_DEBUG_OBJECT (timeline, diff --git a/ges/ges-xml-formatter.c b/ges/ges-xml-formatter.c index 1a2c193..d30779a 100644 --- a/ges/ges-xml-formatter.c +++ b/ges/ges-xml-formatter.c @@ -424,7 +424,6 @@ _parse_clip (GMarkupParseContext * context, const gchar ** attribute_values, GESXmlFormatter * self, GError ** error) { GType type; - gdouble rate = 0; GstStructure *props = NULL; GESTrackType track_types; GstClockTime start, inpoint = 0, duration, layer_prio; @@ -460,12 +459,6 @@ _parse_clip (GMarkupParseContext * context, if (errno) goto convertion_failed; - if (strrate) { - rate = g_ascii_strtod (strrate, NULL); - if (errno) - goto convertion_failed; - } - if (strin) { inpoint = g_ascii_strtoull (strin, NULL, 10); if (errno) @@ -487,7 +480,7 @@ _parse_clip (GMarkupParseContext * context, } ges_base_xml_formatter_add_clip (GES_BASE_XML_FORMATTER (self), - strid, asset_id, type, start, inpoint, duration, rate, layer_prio, + strid, asset_id, type, start, inpoint, duration, layer_prio, track_types, props, metadatas, error); if (props) gst_structure_free (props); diff --git a/tests/benchmarks/timeline.c b/tests/benchmarks/timeline.c index 2010a78..a3181c8 100644 --- a/tests/benchmarks/timeline.c +++ b/tests/benchmarks/timeline.c @@ -44,11 +44,11 @@ main (gint argc, gchar * argv[]) start = gst_util_get_timestamp (); clip = GES_CLIP (ges_timeline_layer_add_asset (layer, asset, 0, - 0, 1000, 1, GES_TRACK_TYPE_UNKNOWN)); + 0, 1000, GES_TRACK_TYPE_UNKNOWN)); for (i = 1; i < NUM_OBJECTS; i++) ges_timeline_layer_add_asset (layer, asset, i * 1000, 0, - 1000, 1, GES_TRACK_TYPE_UNKNOWN); + 1000, GES_TRACK_TYPE_UNKNOWN); end = gst_util_get_timestamp (); g_print ("%" GST_TIME_FORMAT " - adding %d clip to the timeline\n", GST_TIME_ARGS (end - start), i); diff --git a/tests/check/ges/clip.c b/tests/check/ges/clip.c index 64f522c..a398723 100644 --- a/tests/check/ges/clip.c +++ b/tests/check/ges/clip.c @@ -231,7 +231,7 @@ GST_START_TEST (test_clip_group_ungroup) asset = ges_asset_request (GES_TYPE_TEST_CLIP, NULL, NULL); assert_is_type (asset, GES_TYPE_ASSET); - clip = ges_timeline_layer_add_asset (layer, asset, 0, 0, 10, 1, + clip = ges_timeline_layer_add_asset (layer, asset, 0, 0, 10, GES_TRACK_TYPE_UNKNOWN); ASSERT_OBJECT_REFCOUNT (clip, "1 layer", 1); assert_equals_uint64 (_START (clip), 0); diff --git a/tests/check/ges/layer.c b/tests/check/ges/layer.c index 1e87a2e..6878a33 100644 --- a/tests/check/ges/layer.c +++ b/tests/check/ges/layer.c @@ -307,12 +307,12 @@ GST_START_TEST (test_single_layer_automatic_transition) GST_DEBUG ("Adding assets to first layer"); GST_DEBUG ("Adding clip from 0 -- 1000 to first layer"); src = GES_TIMELINE_ELEMENT (ges_timeline_layer_add_asset (layer, asset, 0, 0, - 1000, 1, GES_TRACK_TYPE_UNKNOWN)); + 1000, GES_TRACK_TYPE_UNKNOWN)); fail_unless (GES_IS_CLIP (src)); GST_DEBUG ("Adding clip from 500 -- 1000 to first layer"); src1 = GES_TIMELINE_ELEMENT (ges_timeline_layer_add_asset (layer, asset, 500, - 0, 1000, 1, GES_TRACK_TYPE_UNKNOWN)); + 0, 1000, GES_TRACK_TYPE_UNKNOWN)); fail_unless (GES_IS_CLIP (src1)); /* @@ -482,7 +482,7 @@ GST_START_TEST (test_single_layer_automatic_transition) GST_DEBUG ("Adding clip from 1250 -- 1000 to first layer"); src2 = GES_TIMELINE_ELEMENT (ges_timeline_layer_add_asset (layer, asset, 1250, 0, - 1000, 1, GES_TRACK_TYPE_UNKNOWN)); + 1000, GES_TRACK_TYPE_UNKNOWN)); assert_is_type (src2, GES_TYPE_TEST_CLIP); /* 600____src___1100 @@ -711,12 +711,12 @@ GST_START_TEST (test_multi_layer_automatic_transition) GST_DEBUG ("Adding assets to first layer"); GST_DEBUG ("Adding clip from 0 -- 1000 to first layer"); src = GES_TIMELINE_ELEMENT (ges_timeline_layer_add_asset (layer, asset, 0, 0, - 1000, 1, GES_TRACK_TYPE_UNKNOWN)); + 1000, GES_TRACK_TYPE_UNKNOWN)); fail_unless (GES_IS_CLIP (src)); GST_DEBUG ("Adding clip from 500 -- 1000 to first layer"); src1 = GES_TIMELINE_ELEMENT (ges_timeline_layer_add_asset (layer, asset, 500, - 0, 1000, 1, GES_TRACK_TYPE_UNKNOWN)); + 0, 1000, GES_TRACK_TYPE_UNKNOWN)); fail_unless (GES_IS_CLIP (src1)); /* @@ -751,10 +751,10 @@ GST_START_TEST (test_multi_layer_automatic_transition) GST_DEBUG ("Adding clip 2 from 500 -- 1000 to second layer"); src2 = GES_TIMELINE_ELEMENT (ges_timeline_layer_add_asset (layer1, asset, 0, - 0, 1000, 1, GES_TRACK_TYPE_UNKNOWN)); + 0, 1000, GES_TRACK_TYPE_UNKNOWN)); GST_DEBUG ("Adding clip 3 from 500 -- 1000 to second layer"); src3 = GES_TIMELINE_ELEMENT (ges_timeline_layer_add_asset (layer1, asset, 500, - 0, 1000, 1, GES_TRACK_TYPE_UNKNOWN)); + 0, 1000, GES_TRACK_TYPE_UNKNOWN)); assert_is_type (src3, GES_TYPE_TEST_CLIP); /* 500__transition__1000 @@ -1185,22 +1185,22 @@ GST_START_TEST (test_layer_activate_automatic_transition) GST_DEBUG ("Adding clip from 0 -- 1000 to layer"); src = GES_TIMELINE_ELEMENT (ges_timeline_layer_add_asset (layer, asset, 0, 0, - 1000, 1, GES_TRACK_TYPE_UNKNOWN)); + 1000, GES_TRACK_TYPE_UNKNOWN)); fail_unless (GES_IS_CLIP (src)); GST_DEBUG ("Adding clip from 500 -- 1000 to first layer"); src1 = GES_TIMELINE_ELEMENT (ges_timeline_layer_add_asset (layer, asset, 500, - 0, 1000, 1, GES_TRACK_TYPE_UNKNOWN)); + 0, 1000, GES_TRACK_TYPE_UNKNOWN)); fail_unless (GES_IS_CLIP (src1)); GST_DEBUG ("Adding clip from 1000 -- 2000 to layer"); src2 = GES_TIMELINE_ELEMENT (ges_timeline_layer_add_asset (layer, asset, 1000, - 0, 1000, 1, GES_TRACK_TYPE_UNKNOWN)); + 0, 1000, GES_TRACK_TYPE_UNKNOWN)); fail_unless (GES_IS_CLIP (src2)); GST_DEBUG ("Adding clip from 2000 -- 2500 to layer"); src3 = GES_TIMELINE_ELEMENT (ges_timeline_layer_add_asset (layer, asset, 2000, - 0, 500, 1, GES_TRACK_TYPE_UNKNOWN)); + 0, 500, GES_TRACK_TYPE_UNKNOWN)); fail_unless (GES_IS_CLIP (src3)); /* @@ -1228,7 +1228,7 @@ GST_START_TEST (test_layer_activate_automatic_transition) GST_DEBUG ("Adding transition from 1000 -- 1500 to layer"); transition = GES_CLIP (ges_timeline_layer_add_asset (layer, - transition_asset, 1000, 0, 500, 1, GES_TRACK_TYPE_VIDEO)); + transition_asset, 1000, 0, 500, GES_TRACK_TYPE_VIDEO)); fail_unless (GES_IS_TRANSITION_CLIP (transition)); objects = GES_CONTAINER_CHILDREN (transition); assert_equals_int (g_list_length (objects), 1); diff --git a/tests/check/ges/timelineedition.c b/tests/check/ges/timelineedition.c index c48e317..10030f8 100644 --- a/tests/check/ges/timelineedition.c +++ b/tests/check/ges/timelineedition.c @@ -84,17 +84,17 @@ GST_START_TEST (test_basic_timeline_edition) * | clip | | clip1 | | clip2 | * time 0------- 10 --------20 50---------60 */ - clip = ges_timeline_layer_add_asset (layer, asset, 0, 0, 10, 1, + clip = ges_timeline_layer_add_asset (layer, asset, 0, 0, 10, GES_TRACK_TYPE_UNKNOWN); trackelement = GES_CONTAINER_CHILDREN (clip)->data; fail_unless (GES_IS_TRACK_ELEMENT (trackelement)); - clip1 = ges_timeline_layer_add_asset (layer, asset, 10, 0, 10, 1, + clip1 = ges_timeline_layer_add_asset (layer, asset, 10, 0, 10, GES_TRACK_TYPE_UNKNOWN); trackelement1 = GES_CONTAINER_CHILDREN (clip1)->data; fail_unless (GES_IS_TRACK_ELEMENT (trackelement1)); - clip2 = ges_timeline_layer_add_asset (layer, asset, 50, 0, 60, 1, + clip2 = ges_timeline_layer_add_asset (layer, asset, 50, 0, 60, GES_TRACK_TYPE_UNKNOWN); trackelement2 = GES_CONTAINER_CHILDREN (clip2)->data; fail_unless (GES_IS_TRACK_ELEMENT (trackelement2)); @@ -560,7 +560,7 @@ GST_START_TEST (test_simple_triming) layer = ges_timeline_layer_new (); ges_timeline_add_layer (timeline, layer); - ges_timeline_layer_add_asset (layer, GES_ASSET (asset), 0, 0, 10, 1.0, + ges_timeline_layer_add_asset (layer, GES_ASSET (asset), 0, 0, 10, ges_clip_asset_get_supported_formats (asset)); element = ges_timeline_layer_get_clips (layer)->data; diff --git a/tests/check/ges/uriclip.c b/tests/check/ges/uriclip.c index c2cbf05..6ecc88f 100644 --- a/tests/check/ges/uriclip.c +++ b/tests/check/ges/uriclip.c @@ -53,7 +53,7 @@ asset_created_cb (GObject * source, GAsyncResult * res, gpointer udata) layer = GES_TIMELINE_LAYER (g_async_result_get_user_data (res)); tlfs = GES_URI_CLIP (ges_timeline_layer_add_asset (layer, - asset, 0, 0, GST_CLOCK_TIME_NONE, 1, GES_TRACK_TYPE_UNKNOWN)); + 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); @@ -145,7 +145,7 @@ GST_START_TEST (test_filesource_properties) asset = GES_URI_CLIP_ASSET (asset_uri.asset); fail_unless (GES_IS_ASSET (asset)); clip = ges_timeline_layer_add_asset (layer, GES_ASSET (asset), - 42, 12, 51, 1, GES_TRACK_TYPE_AUDIO); + 42, 12, 51, GES_TRACK_TYPE_AUDIO); assert_is_type (clip, GES_TYPE_URI_CLIP); assert_equals_uint64 (_START (clip), 42); assert_equals_uint64 (_DURATION (clip), 51); diff --git a/tests/examples/test1.c b/tests/examples/test1.c index e14adb4..c5f1872 100644 --- a/tests/examples/test1.c +++ b/tests/examples/test1.c @@ -53,13 +53,13 @@ main (int argc, gchar ** argv) src_asset = ges_asset_request (GES_TYPE_TEST_CLIP, NULL, NULL); /* Add sources to our layer */ - ges_timeline_layer_add_asset (layer, src_asset, 0, 0, GST_SECOND, 1, + ges_timeline_layer_add_asset (layer, src_asset, 0, 0, GST_SECOND, GES_TRACK_TYPE_UNKNOWN); source = ges_timeline_layer_add_asset (layer, src_asset, GST_SECOND, 0, - GST_SECOND, 1, GES_TRACK_TYPE_UNKNOWN); + GST_SECOND, GES_TRACK_TYPE_UNKNOWN); g_object_set (source, "freq", 480.0, "vpattern", 2, NULL); ges_timeline_layer_add_asset (layer, src_asset, 2 * GST_SECOND, 0, - GST_SECOND, 1, GES_TRACK_TYPE_UNKNOWN); + GST_SECOND, GES_TRACK_TYPE_UNKNOWN); /* In order to view our timeline, let's grab a convenience pipeline to put -- 2.7.4