From 000edd268e2428eeff7b8a0d27a6ff15df896938 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Tue, 20 Aug 2019 17:46:09 -0400 Subject: [PATCH] ges: Use G_DEPRECATE to mark deprecated methods Cleanup a few things on the way. And move ges-track-element deprecations to a dedicated header file --- ges/ges-container.h | 2 +- ges/ges-formatter.c | 6 ++- ges/ges-formatter.h | 8 +--- ges/ges-layer.h | 2 +- ges/ges-prelude.h | 8 ++++ ges/ges-screenshot.h | 2 +- ges/ges-timeline-element.c | 2 +- ges/ges-timeline-element.h | 2 +- ges/ges-title-clip.c | 54 ++++++++++---------------- ges/ges-title-clip.h | 56 ++++++++++++--------------- ges/ges-track-element-deprecated.h | 61 ++++++++++++++++++++++++++++++ ges/ges-track-element.h | 55 ++------------------------- ges/meson.build | 1 + 13 files changed, 129 insertions(+), 130 deletions(-) create mode 100644 ges/ges-track-element-deprecated.h diff --git a/ges/ges-container.h b/ges/ges-container.h index 5f40e20ec8..6c6a56a1e3 100644 --- a/ges/ges-container.h +++ b/ges/ges-container.h @@ -151,7 +151,7 @@ GList * ges_container_ungroup (GESContainer * container, gboolean recursive) GES_API GESContainer *ges_container_group (GList *containers); -GES_API +GES_DEPRECATED_FOR(ges_timeline_element_edit) gboolean ges_container_edit (GESContainer * container, GList * layers, gint new_layer_priority, GESEditMode mode, diff --git a/ges/ges-formatter.c b/ges/ges-formatter.c index 3f992ae145..5f8b16a4f5 100644 --- a/ges/ges-formatter.c +++ b/ges/ges-formatter.c @@ -315,7 +315,7 @@ ges_formatter_can_save_uri (const gchar * uri, GError ** error) if (!(gst_uri_has_protocol (uri, "file"))) { gchar *proto = gst_uri_get_protocol (uri); - GST_ERROR ("Unspported protocol '%s'", proto); + GST_ERROR ("Unsupported protocol '%s'", proto); g_free (proto); return FALSE; } @@ -379,6 +379,8 @@ error: * * Returns: TRUE if the timeline data was successfully loaded from the URI, * else FALSE. + * + * Deprecated: 1.18: Use @ges_timeline_load_from_uri */ gboolean @@ -411,6 +413,8 @@ ges_formatter_load_from_uri (GESFormatter * formatter, * * Returns: TRUE if the timeline data was successfully saved to the URI * else FALSE. + * + * Deprecated: 1.18: Use @ges_timeline_save_to_uri */ gboolean diff --git a/ges/ges-formatter.h b/ges/ges-formatter.h index e2beec3d76..e6b9d636d7 100644 --- a/ges/ges-formatter.h +++ b/ges/ges-formatter.h @@ -80,8 +80,6 @@ typedef gboolean (*GESFormatterCanLoadURIMethod) (GESFormatter *dummy_instance, * * Returns: TRUE if the @timeline was properly loaded from the given @uri, * else FALSE. - * - * Deprecated: 1.16: Use @ges_timeline_load_from_uri **/ typedef gboolean (*GESFormatterLoadFromURIMethod) (GESFormatter *formatter, GESTimeline *timeline, @@ -102,8 +100,6 @@ typedef gboolean (*GESFormatterLoadFromURIMethod) (GESFormatter *formatter, * * Returns: TRUE if the @timeline was properly stored to the given @uri, * else FALSE. - * - * Deprecated: 1.16: Use @ges_timeline_save_to_uri */ typedef gboolean (*GESFormatterSaveToURIMethod) (GESFormatter *formatter, GESTimeline *timeline, const gchar * uri, gboolean overwrite, @@ -159,13 +155,13 @@ gboolean ges_formatter_can_load_uri (const gchar * uri, GError **error); GES_API gboolean ges_formatter_can_save_uri (const gchar * uri, GError **error); -GES_API +GES_DEPRECATED_FOR(ges_timeline_load_from_uri) gboolean ges_formatter_load_from_uri (GESFormatter * formatter, GESTimeline *timeline, const gchar *uri, GError **error); -GES_API +GES_DEPRECATED_FOR(ges_timeline_save_to_uri) gboolean ges_formatter_save_to_uri (GESFormatter * formatter, GESTimeline *timeline, const gchar *uri, diff --git a/ges/ges-layer.h b/ges/ges-layer.h index 5c6bd17213..fd97c7dac4 100644 --- a/ges/ges-layer.h +++ b/ges/ges-layer.h @@ -117,7 +117,7 @@ GES_API gboolean ges_layer_remove_clip (GESLayer * layer, GESClip * clip); -GES_API +GES_DEPRECATED_FOR(ges_timeline_move_layer) void ges_layer_set_priority (GESLayer * layer, guint priority); diff --git a/ges/ges-prelude.h b/ges/ges-prelude.h index ccfff57eb4..c89e11499e 100644 --- a/ges/ges-prelude.h +++ b/ges/ges-prelude.h @@ -32,4 +32,12 @@ # endif #endif +#ifndef GST_DISABLE_DEPRECATED +#define GES_DEPRECATED GES_API +#define GES_DEPRECATED_FOR(f) GES_API +#else +#define GES_DEPRECATED G_DEPRECATED GES_API +#define GES_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) GES_API +#endif + #endif /* __GST_GES_PRELUDE_H__ */ diff --git a/ges/ges-screenshot.h b/ges/ges-screenshot.h index f49209ad27..4b42f4e78b 100644 --- a/ges/ges-screenshot.h +++ b/ges/ges-screenshot.h @@ -26,7 +26,7 @@ G_BEGIN_DECLS -GES_API GstSample * +GES_DEPRECATED GstSample * ges_play_sink_convert_frame (GstElement * playsink, GstCaps * caps); G_END_DECLS diff --git a/ges/ges-timeline-element.c b/ges/ges-timeline-element.c index 26c087399d..8dedee7d3b 100644 --- a/ges/ges-timeline-element.c +++ b/ges/ges-timeline-element.c @@ -1005,7 +1005,7 @@ ges_timeline_element_get_priority (GESTimelineElement * self) * * Sets the priority of the object within the containing layer * - * Deprecated: All priority management is done by GES itself now. + * Deprecated:1.10: All priority management is done by GES itself now. * To set #GESEffect priorities #ges_clip_set_top_effect_index should * be used. * diff --git a/ges/ges-timeline-element.h b/ges/ges-timeline-element.h index 78237f1b12..66c1b4c952 100644 --- a/ges/ges-timeline-element.h +++ b/ges/ges-timeline-element.h @@ -251,7 +251,7 @@ gboolean ges_timeline_element_set_duration (GESTimeli GES_API gboolean ges_timeline_element_set_max_duration (GESTimelineElement *self, GstClockTime maxduration); -GES_API +GES_DEPRECATED gboolean ges_timeline_element_set_priority (GESTimelineElement *self, guint32 priority); GES_API diff --git a/ges/ges-title-clip.c b/ges/ges-title-clip.c index d292b48260..6d72288c23 100644 --- a/ges/ges-title-clip.c +++ b/ges/ges-title-clip.c @@ -106,32 +106,17 @@ static void ges_title_clip_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { - GESTitleClip *uriclip = GES_TITLE_CLIP (object); - switch (property_id) { case PROP_TEXT: - ges_title_clip_set_text (uriclip, g_value_get_string (value)); - break; case PROP_FONT_DESC: - ges_title_clip_set_font_desc (uriclip, g_value_get_string (value)); - break; case PROP_HALIGNMENT: - ges_title_clip_set_halignment (uriclip, g_value_get_enum (value)); - break; case PROP_VALIGNMENT: - ges_title_clip_set_valignment (uriclip, g_value_get_enum (value)); - break; case PROP_COLOR: - ges_title_clip_set_color (uriclip, g_value_get_uint (value)); - break; case PROP_BACKGROUND: - ges_title_clip_set_background (uriclip, g_value_get_uint (value)); - break; case PROP_XPOS: - ges_title_clip_set_xpos (uriclip, g_value_get_double (value)); - break; case PROP_YPOS: - ges_title_clip_set_ypos (uriclip, g_value_get_double (value)); + ges_timeline_element_set_child_property (GES_TIMELINE_ELEMENT (object), + pspec->name, value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -314,7 +299,7 @@ ges_title_clip_set_text (GESTitleClip * self, const gchar * text) GST_DEBUG_OBJECT (self, "text:%s", text); for (tmp = self->priv->track_titles; tmp; tmp = tmp->next) { - ges_track_element_set_child_properties (tmp->data, "text", text, NULL); + ges_timeline_element_set_child_properties (tmp->data, "text", text, NULL); } } @@ -336,7 +321,7 @@ ges_title_clip_set_font_desc (GESTitleClip * self, const gchar * font_desc) GST_DEBUG_OBJECT (self, "font_desc:%s", font_desc); for (tmp = self->priv->track_titles; tmp; tmp = tmp->next) { - ges_track_element_set_child_properties (tmp->data, + ges_timeline_element_set_child_properties (tmp->data, "font-desc", font_desc, NULL); } } @@ -359,7 +344,7 @@ ges_title_clip_set_halignment (GESTitleClip * self, GESTextHAlign halign) GST_DEBUG_OBJECT (self, "halign:%d", halign); for (tmp = self->priv->track_titles; tmp; tmp = tmp->next) { - ges_track_element_set_child_properties (tmp->data, + ges_timeline_element_set_child_properties (tmp->data, "halignment", halign, NULL); } } @@ -382,7 +367,7 @@ ges_title_clip_set_valignment (GESTitleClip * self, GESTextVAlign valign) GST_DEBUG_OBJECT (self, "valign:%d", valign); for (tmp = self->priv->track_titles; tmp; tmp = tmp->next) { - ges_track_element_set_child_properties (tmp->data, + ges_timeline_element_set_child_properties (tmp->data, "valignment", valign, NULL); } } @@ -405,7 +390,7 @@ ges_title_clip_set_color (GESTitleClip * self, guint32 color) GST_DEBUG_OBJECT (self, "color:%d", color); for (tmp = self->priv->track_titles; tmp; tmp = tmp->next) { - ges_track_element_set_child_properties (tmp->data, "color", color, NULL); + ges_timeline_element_set_child_properties (tmp->data, "color", color, NULL); } } @@ -427,12 +412,11 @@ ges_title_clip_set_background (GESTitleClip * self, guint32 background) GST_DEBUG_OBJECT (self, "background:%d", background); for (tmp = self->priv->track_titles; tmp; tmp = tmp->next) { - ges_track_element_set_child_properties (tmp->data, + ges_timeline_element_set_child_properties (tmp->data, "foreground-color", background, NULL); } } - /** * ges_title_clip_set_xpos: * @self: the #GESTitleClip* to set @@ -451,7 +435,8 @@ ges_title_clip_set_xpos (GESTitleClip * self, gdouble position) GST_DEBUG_OBJECT (self, "xpos:%f", position); for (tmp = self->priv->track_titles; tmp; tmp = tmp->next) { - ges_track_element_set_child_properties (tmp->data, "xpos", position, NULL); + ges_timeline_element_set_child_properties (tmp->data, "xpos", position, + NULL); } } @@ -473,7 +458,8 @@ ges_title_clip_set_ypos (GESTitleClip * self, gdouble position) GST_DEBUG_OBJECT (self, "ypos:%f", position); for (tmp = self->priv->track_titles; tmp; tmp = tmp->next) { - ges_track_element_set_child_properties (tmp->data, "ypos", position, NULL); + ges_timeline_element_set_child_properties (tmp->data, "ypos", position, + NULL); } } @@ -493,7 +479,7 @@ ges_title_clip_get_text (GESTitleClip * self) { gchar *text; - ges_track_element_get_child_properties (self->priv->track_titles->data, + ges_timeline_element_get_child_properties (self->priv->track_titles->data, "text", &text, NULL); return text; @@ -515,7 +501,7 @@ ges_title_clip_get_font_desc (GESTitleClip * self) { gchar *font_desc; - ges_track_element_get_child_properties (self->priv->track_titles->data, + ges_timeline_element_get_child_properties (self->priv->track_titles->data, "font-desc", &font_desc, NULL); return font_desc; @@ -537,7 +523,7 @@ ges_title_clip_get_halignment (GESTitleClip * self) { GESTextHAlign halign; - ges_track_element_get_child_properties (self->priv->track_titles->data, + ges_timeline_element_get_child_properties (self->priv->track_titles->data, "halignment", &halign, NULL); return halign; @@ -559,7 +545,7 @@ ges_title_clip_get_valignment (GESTitleClip * self) { GESTextVAlign valign; - ges_track_element_get_child_properties (self->priv->track_titles->data, + ges_timeline_element_get_child_properties (self->priv->track_titles->data, "valignment", &valign, NULL); return valign; @@ -581,7 +567,7 @@ ges_title_clip_get_text_color (GESTitleClip * self) { guint32 color; - ges_track_element_get_child_properties (self->priv->track_titles->data, + ges_timeline_element_get_child_properties (self->priv->track_titles->data, "color", &color, NULL); return color; @@ -603,7 +589,7 @@ ges_title_clip_get_background_color (GESTitleClip * self) { guint32 color; - ges_track_element_get_child_properties (self->priv->track_titles->data, + ges_timeline_element_get_child_properties (self->priv->track_titles->data, "foreground-color", &color, NULL); return color; @@ -625,7 +611,7 @@ ges_title_clip_get_xpos (GESTitleClip * self) { gdouble xpos; - ges_track_element_get_child_properties (self->priv->track_titles->data, + ges_timeline_element_get_child_properties (self->priv->track_titles->data, "xpos", &xpos, NULL); return xpos; @@ -646,7 +632,7 @@ ges_title_clip_get_ypos (GESTitleClip * self) { gdouble ypos; - ges_track_element_get_child_properties (self->priv->track_titles->data, + ges_timeline_element_get_child_properties (self->priv->track_titles->data, "ypos", &ypos, NULL); return ypos; diff --git a/ges/ges-title-clip.h b/ges/ges-title-clip.h index e337830ccd..6ac5bba241 100644 --- a/ges/ges-title-clip.h +++ b/ges/ges-title-clip.h @@ -74,60 +74,52 @@ struct _GESTitleClipClass { GES_API GType ges_title_clip_get_type (void); -GES_API void -ges_title_clip_set_text( GESTitleClip * self, - const gchar * text); +G_DEPRECATED_FOR(ges_timeline_element_set_children_properties) void +ges_title_clip_set_text( GESTitleClip * self, const gchar * text); -GES_API void -ges_title_clip_set_font_desc (GESTitleClip * self, - const gchar * font_desc); +G_DEPRECATED_FOR(ges_timeline_element_set_children_properties) void +ges_title_clip_set_font_desc (GESTitleClip * self, const gchar * font_desc); -GES_API void -ges_title_clip_set_valignment (GESTitleClip * self, - GESTextVAlign valign); +G_DEPRECATED_FOR(ges_timeline_element_set_children_properties) void +ges_title_clip_set_valignment (GESTitleClip * self, GESTextVAlign valign); -GES_API void -ges_title_clip_set_halignment (GESTitleClip * self, - GESTextHAlign halign); +G_DEPRECATED_FOR(ges_timeline_element_set_children_properties) void +ges_title_clip_set_halignment (GESTitleClip * self, GESTextHAlign halign); -GES_API void -ges_title_clip_set_color (GESTitleClip * self, - guint32 color); +G_DEPRECATED_FOR(ges_timeline_element_set_children_properties) void +ges_title_clip_set_color (GESTitleClip * self, guint32 color); -GES_API void -ges_title_clip_set_background (GESTitleClip * self, - guint32 background); +G_DEPRECATED_FOR(ges_timeline_element_set_children_properties) void +ges_title_clip_set_background (GESTitleClip * self, guint32 background); -GES_API void -ges_title_clip_set_xpos (GESTitleClip * self, - gdouble position); +G_DEPRECATED_FOR(ges_timeline_element_set_children_properties) void +ges_title_clip_set_xpos (GESTitleClip * self, gdouble position); -GES_API void -ges_title_clip_set_ypos (GESTitleClip * self, - gdouble position); +G_DEPRECATED_FOR(ges_timeline_element_set_children_properties) void +ges_title_clip_set_ypos (GESTitleClip * self, gdouble position); -GES_API const gchar* +G_DEPRECATED_FOR(ges_timeline_element_get_children_properties) const gchar* ges_title_clip_get_font_desc (GESTitleClip * self); -GES_API GESTextVAlign +G_DEPRECATED_FOR(ges_timeline_element_get_children_properties) GESTextVAlign ges_title_clip_get_valignment (GESTitleClip * self); -GES_API GESTextHAlign +G_DEPRECATED_FOR(ges_timeline_element_get_children_properties) GESTextHAlign ges_title_clip_get_halignment (GESTitleClip * self); -GES_API const guint32 +G_DEPRECATED_FOR(ges_timeline_element_get_children_properties) const guint32 ges_title_clip_get_text_color (GESTitleClip * self); -GES_API const guint32 +G_DEPRECATED_FOR(ges_timeline_element_get_children_properties) const guint32 ges_title_clip_get_background_color (GESTitleClip * self); -GES_API const gdouble +G_DEPRECATED_FOR(ges_timeline_element_get_children_properties) const gdouble ges_title_clip_get_xpos (GESTitleClip * self); -GES_API const gdouble +G_DEPRECATED_FOR(ges_timeline_element_get_children_properties) const gdouble ges_title_clip_get_ypos (GESTitleClip * self); -GES_API +G_DEPRECATED_FOR(ges_timeline_element_get_children_properties) const gchar* ges_title_clip_get_text (GESTitleClip * self); GES_API diff --git a/ges/ges-track-element-deprecated.h b/ges/ges-track-element-deprecated.h new file mode 100644 index 0000000000..6132fcfdf9 --- /dev/null +++ b/ges/ges-track-element-deprecated.h @@ -0,0 +1,61 @@ +#pragma once + +GES_DEPRECATED_FOR(ges_track_element_get_nleobject) +GstElement * ges_track_element_get_gnlobject (GESTrackElement * object); + + +GES_DEPRECATED_FOR(ges_timeline_element_list_children_properties) +GParamSpec ** +ges_track_element_list_children_properties (GESTrackElement *object, + guint *n_properties); + +GES_DEPRECATED_FOR(ges_timeline_element_lookup_child) +gboolean ges_track_element_lookup_child (GESTrackElement *object, + const gchar *prop_name, + GstElement **element, + GParamSpec **pspec); + +GES_DEPRECATED_FOR(ges_timeline_element_get_child_property_valist) +void +ges_track_element_get_child_property_valist (GESTrackElement * object, + const gchar * first_property_name, + va_list var_args); + +GES_DEPRECATED_FOR(ges_timeline_element_get_child_properties) +void ges_track_element_get_child_properties (GESTrackElement *object, + const gchar * first_property_name, + ...) G_GNUC_NULL_TERMINATED; + +GES_DEPRECATED_FOR(ges_timeline_element_set_child_property_valist) +void +ges_track_element_set_child_property_valist (GESTrackElement * object, + const gchar * first_property_name, + va_list var_args); + +GES_DEPRECATED_FOR(ges_timeline_element_set_child_property_by_spec) +void +ges_track_element_set_child_property_by_pspec (GESTrackElement * object, + GParamSpec * pspec, + GValue * value); + +GES_DEPRECATED_FOR(ges_timeline_element_set_child_properties) +void +ges_track_element_set_child_properties (GESTrackElement * object, + const gchar * first_property_name, + ...) G_GNUC_NULL_TERMINATED; + +GES_DEPRECATED_FOR(ges_timeline_element_set_child_property) +gboolean ges_track_element_set_child_property (GESTrackElement *object, + const gchar *property_name, + GValue * value); + +GES_DEPRECATED_FOR(ges_timeline_element_get_child_property) +gboolean ges_track_element_get_child_property (GESTrackElement *object, + const gchar *property_name, + GValue * value); + +GES_DEPRECATED_FOR(ges_timeline_element_edit) +gboolean +ges_track_element_edit (GESTrackElement * object, + GList *layers, GESEditMode mode, + GESEdge edge, guint64 position); diff --git a/ges/ges-track-element.h b/ges/ges-track-element.h index 7d341e8fe3..a743525b14 100644 --- a/ges/ges-track-element.h +++ b/ges/ges-track-element.h @@ -139,8 +139,6 @@ void ges_track_element_set_track_type (GESTrackElement * object, GES_API GstElement * ges_track_element_get_nleobject (GESTrackElement * object); -GES_API -GstElement * ges_track_element_get_gnlobject (GESTrackElement * object); GES_API GstElement * ges_track_element_get_element (GESTrackElement * object); @@ -152,61 +150,11 @@ gboolean ges_track_element_set_active (GESTrackElement * object, GES_API gboolean ges_track_element_is_active (GESTrackElement * object); -GES_API GParamSpec ** -ges_track_element_list_children_properties (GESTrackElement *object, - guint *n_properties); - -GES_API -gboolean ges_track_element_lookup_child (GESTrackElement *object, - const gchar *prop_name, - GstElement **element, - GParamSpec **pspec); - GES_API void ges_track_element_get_child_property_by_pspec (GESTrackElement * object, GParamSpec * pspec, GValue * value); -GES_API void -ges_track_element_get_child_property_valist (GESTrackElement * object, - const gchar * first_property_name, - va_list var_args); - -GES_API -void ges_track_element_get_child_properties (GESTrackElement *object, - const gchar * first_property_name, - ...) G_GNUC_NULL_TERMINATED; - -GES_API void -ges_track_element_set_child_property_valist (GESTrackElement * object, - const gchar * first_property_name, - va_list var_args); - -GES_API void -ges_track_element_set_child_property_by_pspec (GESTrackElement * object, - GParamSpec * pspec, - GValue * value); - -GES_API -void ges_track_element_set_child_properties (GESTrackElement * object, - const gchar * first_property_name, - ...) G_GNUC_NULL_TERMINATED; - -GES_API -gboolean ges_track_element_set_child_property (GESTrackElement *object, - const gchar *property_name, - GValue * value); - -GES_API -gboolean ges_track_element_get_child_property (GESTrackElement *object, - const gchar *property_name, - GValue * value); - -GES_API gboolean -ges_track_element_edit (GESTrackElement * object, - GList *layers, GESEditMode mode, - GESEdge edge, guint64 position); - GES_API gboolean ges_track_element_set_control_source (GESTrackElement *object, GstControlSource *source, @@ -227,5 +175,8 @@ ges_track_element_get_all_control_bindings (GESTrackElement * trackelement); GES_API gboolean ges_track_element_remove_control_binding (GESTrackElement * object, const gchar * property_name); + +#include "ges-track-element-deprecated.h" + G_END_DECLS #endif /* _GES_TRACK_ELEMENT */ diff --git a/ges/meson.build b/ges/meson.build index bb76018157..d7edd8256e 100644 --- a/ges/meson.build +++ b/ges/meson.build @@ -93,6 +93,7 @@ ges_headers = files([ 'ges-audio-track.h', 'ges-video-track.h', 'ges-track-element.h', + 'ges-track-element-deprecated.h', 'ges-source.h', 'ges-operation.h', 'ges-video-source.h', -- 2.34.1