ges: Fix compilation with clang

This commit is contained in:
Thibault Saunier 2013-04-21 21:11:52 -03:00
parent 723fee10b6
commit 5ab40ce5cb
2 changed files with 81 additions and 72 deletions

View file

@ -2247,9 +2247,10 @@ gboolean
ges_timeline_save_to_uri (GESTimeline * timeline, const gchar * uri, ges_timeline_save_to_uri (GESTimeline * timeline, const gchar * uri,
GESAsset * formatter_asset, gboolean overwrite, GError ** error) GESAsset * formatter_asset, gboolean overwrite, GError ** error)
{ {
gboolean ret, created_proj;
GESProject *project; GESProject *project;
gboolean ret, created_proj = FALSE;
g_return_val_if_fail (GES_IS_TIMELINE (timeline), FALSE); g_return_val_if_fail (GES_IS_TIMELINE (timeline), FALSE);
project = project =
GES_PROJECT (ges_extractable_get_asset (GES_EXTRACTABLE (timeline))); GES_PROJECT (ges_extractable_get_asset (GES_EXTRACTABLE (timeline)));

View file

@ -701,17 +701,10 @@ _error_parsing (GMarkupParseContext * context, GError * error,
/* XML writting utils */ /* XML writting utils */
static inline void static inline void
append_printf_escaped (GString * str, const gchar * format, ...) append_escaped (GString * str, gchar * tmpstr)
{ {
gchar *tmp; g_string_append (str, tmpstr);
va_list args; g_free (tmpstr);
va_start (args, format);
tmp = g_markup_vprintf_escaped (format, args);
va_end (args);
g_string_append (str, tmp);
g_free (tmp);
} }
static inline gboolean static inline gboolean
@ -785,11 +778,12 @@ _save_assets (GString * str, GESProject * project)
asset = GES_ASSET (tmp->data); asset = GES_ASSET (tmp->data);
properties = _serialize_properties (G_OBJECT (asset), NULL); properties = _serialize_properties (G_OBJECT (asset), NULL);
metas = ges_meta_container_metas_to_string (GES_META_CONTAINER (asset)); metas = ges_meta_container_metas_to_string (GES_META_CONTAINER (asset));
append_printf_escaped (str, append_escaped (str,
"<asset id='%s' extractable-type-name='%s' properties='%s' metadatas='%s' />\n", g_markup_printf_escaped
ges_asset_get_id (asset), ("<asset id='%s' extractable-type-name='%s' properties='%s' metadatas='%s' />\n",
g_type_name (ges_asset_get_extractable_type (asset)), properties, ges_asset_get_id (asset),
metas); g_type_name (ges_asset_get_extractable_type (asset)), properties,
metas));
g_free (properties); g_free (properties);
g_free (metas); g_free (metas);
} }
@ -810,9 +804,10 @@ _save_tracks (GString * str, GESTimeline * timeline)
track = GES_TRACK (tmp->data); track = GES_TRACK (tmp->data);
strtmp = gst_caps_to_string (ges_track_get_caps (track)); strtmp = gst_caps_to_string (ges_track_get_caps (track));
metas = ges_meta_container_metas_to_string (GES_META_CONTAINER (track)); metas = ges_meta_container_metas_to_string (GES_META_CONTAINER (track));
append_printf_escaped (str, append_escaped (str,
"<track caps='%s' track-type='%i' track-id='%i' metadatas='%s'/>\n", g_markup_printf_escaped
strtmp, track->type, nb_tracks++, metas); ("<track caps='%s' track-type='%i' track-id='%i' metadatas='%s'/>\n",
strtmp, track->type, nb_tracks++, metas));
g_free (strtmp); g_free (strtmp);
g_free (metas); g_free (metas);
} }
@ -845,12 +840,13 @@ _save_keyframes (GString * str, GESTrackElement * trackelement)
GList *timed_values, *tmp; GList *timed_values, *tmp;
GstInterpolationMode mode; GstInterpolationMode mode;
append_printf_escaped (str, append_escaped (str,
"<binding type='direct' source_type='interpolation' property='%s'", g_markup_printf_escaped
(gchar *) key); ("<binding type='direct' source_type='interpolation' property='%s'",
(gchar *) key));
g_object_get (source, "mode", &mode, NULL); g_object_get (source, "mode", &mode, NULL);
append_printf_escaped (str, " mode='%d'", mode); append_escaped (str, g_markup_printf_escaped (" mode='%d'", mode));
append_printf_escaped (str, " values ='"); append_escaped (str, g_markup_printf_escaped (" values ='"));
timed_values = timed_values =
gst_timed_value_control_source_get_all gst_timed_value_control_source_get_all
(GST_TIMED_VALUE_CONTROL_SOURCE (source)); (GST_TIMED_VALUE_CONTROL_SOURCE (source));
@ -858,10 +854,10 @@ _save_keyframes (GString * str, GESTrackElement * trackelement)
GstTimedValue *value; GstTimedValue *value;
value = (GstTimedValue *) tmp->data; value = (GstTimedValue *) tmp->data;
append_printf_escaped (str, " %lld:%f ", append_escaped (str, g_markup_printf_escaped (" %lld:%f ",
(long long int) value->timestamp, value->value); (long long int) value->timestamp, value->value));
} }
append_printf_escaped (str, "'/>\n"); append_escaped (str, g_markup_printf_escaped ("'/>\n"));
} else } else
GST_DEBUG ("control source not in [interpolation]"); GST_DEBUG ("control source not in [interpolation]");
} else } else
@ -899,12 +895,12 @@ _save_effect (GString * str, guint clip_id, GESTrackElement * trackelement,
"in-point", "duration", "locked", "max-duration", "name", NULL); "in-point", "duration", "locked", "max-duration", "name", NULL);
metas = metas =
ges_meta_container_metas_to_string (GES_META_CONTAINER (trackelement)); ges_meta_container_metas_to_string (GES_META_CONTAINER (trackelement));
append_printf_escaped (str, append_escaped (str,
"<effect asset-id='%s' clip-id='%u'" g_markup_printf_escaped ("<effect asset-id='%s' clip-id='%u'"
" type-name='%s' track-type='%i' track-id='%i' properties='%s' metadatas='%s'", " type-name='%s' track-type='%i' track-id='%i' properties='%s' metadatas='%s'",
ges_extractable_get_id (GES_EXTRACTABLE (trackelement)), clip_id, ges_extractable_get_id (GES_EXTRACTABLE (trackelement)), clip_id,
g_type_name (G_OBJECT_TYPE (trackelement)), tck->type, track_id, g_type_name (G_OBJECT_TYPE (trackelement)), tck->type, track_id,
properties, metas); properties, metas));
g_free (properties); g_free (properties);
g_free (metas); g_free (metas);
@ -924,12 +920,13 @@ _save_effect (GString * str, guint clip_id, GESTrackElement * trackelement,
} }
g_free (pspecs); g_free (pspecs);
append_printf_escaped (str, " children-properties='%s'>\n", append_escaped (str,
gst_structure_to_string (structure)); g_markup_printf_escaped (" children-properties='%s'>\n",
gst_structure_to_string (structure)));
_save_keyframes (str, trackelement); _save_keyframes (str, trackelement);
append_printf_escaped (str, "</effect>\n"); append_escaped (str, g_markup_printf_escaped ("</effect>\n"));
gst_structure_free (structure); gst_structure_free (structure);
} }
@ -950,9 +947,10 @@ _save_layers (GString * str, GESTimeline * timeline)
priority = ges_timeline_layer_get_priority (layer); priority = ges_timeline_layer_get_priority (layer);
properties = _serialize_properties (G_OBJECT (layer), "priority", NULL); properties = _serialize_properties (G_OBJECT (layer), "priority", NULL);
metas = ges_meta_container_metas_to_string (GES_META_CONTAINER (layer)); metas = ges_meta_container_metas_to_string (GES_META_CONTAINER (layer));
append_printf_escaped (str, append_escaped (str,
"<layer priority='%i' properties='%s' metadatas='%s'>\n", priority, g_markup_printf_escaped
properties, metas); ("<layer priority='%i' properties='%s' metadatas='%s'>\n", priority,
properties, metas));
g_free (properties); g_free (properties);
g_free (metas); g_free (metas);
@ -968,15 +966,15 @@ _save_layers (GString * str, GESTimeline * timeline)
properties = _serialize_properties (G_OBJECT (clip), properties = _serialize_properties (G_OBJECT (clip),
"supported-formats", "rate", "in-point", "start", "duration", "supported-formats", "rate", "in-point", "start", "duration",
"max-duration", "priority", "vtype", "uri", NULL); "max-duration", "priority", "vtype", "uri", NULL);
append_printf_escaped (str, append_escaped (str,
"<clip id='%i' asset-id='%s'" g_markup_printf_escaped ("<clip id='%i' asset-id='%s'"
" type-name='%s' layer-priority='%i' track-types='%i' start='%" " type-name='%s' layer-priority='%i' track-types='%i' start='%"
G_GUINT64_FORMAT "' duration='%" G_GUINT64_FORMAT "' inpoint='%" G_GUINT64_FORMAT "' duration='%" G_GUINT64_FORMAT "' inpoint='%"
G_GUINT64_FORMAT "' rate='%d' properties='%s' >\n", nbclips, G_GUINT64_FORMAT "' rate='%d' properties='%s' >\n", nbclips,
ges_extractable_get_id (GES_EXTRACTABLE (clip)), ges_extractable_get_id (GES_EXTRACTABLE (clip)),
g_type_name (G_OBJECT_TYPE (clip)), priority, g_type_name (G_OBJECT_TYPE (clip)), priority,
ges_clip_get_supported_formats (clip), _START (clip), ges_clip_get_supported_formats (clip), _START (clip),
_DURATION (clip), _INPOINT (clip), 0, properties); _DURATION (clip), _INPOINT (clip), 0, properties));
g_free (properties); g_free (properties);
for (tmpeffect = effects; tmpeffect; tmpeffect = tmpeffect->next) for (tmpeffect = effects; tmpeffect; tmpeffect = tmpeffect->next)
@ -999,8 +997,9 @@ _save_timeline (GString * str, GESTimeline * timeline)
"async-handling", "message-forward", NULL); "async-handling", "message-forward", NULL);
metas = ges_meta_container_metas_to_string (GES_META_CONTAINER (timeline)); metas = ges_meta_container_metas_to_string (GES_META_CONTAINER (timeline));
append_printf_escaped (str, "<timeline properties='%s' metadatas='%s'>\n", append_escaped (str,
properties, metas); g_markup_printf_escaped ("<timeline properties='%s' metadatas='%s'>\n",
properties, metas));
_save_tracks (str, timeline); _save_tracks (str, timeline);
_save_layers (str, timeline); _save_layers (str, timeline);
@ -1019,39 +1018,42 @@ _save_stream_profiles (GString * str, GstEncodingProfile * sprof,
GstCaps *tmpcaps; GstCaps *tmpcaps;
const gchar *preset, *preset_name, *name, *description; const gchar *preset, *preset_name, *name, *description;
append_printf_escaped (str, "<stream-profile parent='%s' id='%d' type='%s' " append_escaped (str,
"presence='%d' ", profilename, id, g_markup_printf_escaped ("<stream-profile parent='%s' id='%d' type='%s' "
gst_encoding_profile_get_type_nick (sprof), "presence='%d' ", profilename, id,
gst_encoding_profile_get_presence (sprof)); gst_encoding_profile_get_type_nick (sprof),
gst_encoding_profile_get_presence (sprof)));
tmpcaps = gst_encoding_profile_get_format (sprof); tmpcaps = gst_encoding_profile_get_format (sprof);
if (tmpcaps) { if (tmpcaps) {
tmpc = gst_caps_to_string (tmpcaps); tmpc = gst_caps_to_string (tmpcaps);
append_printf_escaped (str, "format='%s' ", tmpc); append_escaped (str, g_markup_printf_escaped ("format='%s' ", tmpc));
gst_caps_unref (tmpcaps); gst_caps_unref (tmpcaps);
g_free (tmpc); g_free (tmpc);
} }
name = gst_encoding_profile_get_name (sprof); name = gst_encoding_profile_get_name (sprof);
if (name) if (name)
append_printf_escaped (str, "name='%s' ", name); append_escaped (str, g_markup_printf_escaped ("name='%s' ", name));
description = gst_encoding_profile_get_description (sprof); description = gst_encoding_profile_get_description (sprof);
if (description) if (description)
append_printf_escaped (str, "description='%s' ", description); append_escaped (str, g_markup_printf_escaped ("description='%s' ",
description));
preset = gst_encoding_profile_get_preset (sprof); preset = gst_encoding_profile_get_preset (sprof);
if (preset) if (preset)
append_printf_escaped (str, "preset='%s' ", preset); append_escaped (str, g_markup_printf_escaped ("preset='%s' ", preset));
preset_name = gst_encoding_profile_get_preset_name (sprof); preset_name = gst_encoding_profile_get_preset_name (sprof);
if (preset_name) if (preset_name)
append_printf_escaped (str, "preset-name='%s' ", preset_name); append_escaped (str, g_markup_printf_escaped ("preset-name='%s' ",
preset_name));
tmpcaps = gst_encoding_profile_get_restriction (sprof); tmpcaps = gst_encoding_profile_get_restriction (sprof);
if (tmpcaps) { if (tmpcaps) {
tmpc = gst_caps_to_string (tmpcaps); tmpc = gst_caps_to_string (tmpcaps);
append_printf_escaped (str, "restriction='%s' ", tmpc); append_escaped (str, g_markup_printf_escaped ("restriction='%s' ", tmpc));
gst_caps_unref (tmpcaps); gst_caps_unref (tmpcaps);
g_free (tmpc); g_free (tmpc);
} }
@ -1059,9 +1061,10 @@ _save_stream_profiles (GString * str, GstEncodingProfile * sprof,
if (GST_IS_ENCODING_VIDEO_PROFILE (sprof)) { if (GST_IS_ENCODING_VIDEO_PROFILE (sprof)) {
GstEncodingVideoProfile *vp = (GstEncodingVideoProfile *) sprof; GstEncodingVideoProfile *vp = (GstEncodingVideoProfile *) sprof;
append_printf_escaped (str, "pass='%d' variableframerate='%i' ", append_escaped (str,
gst_encoding_video_profile_get_pass (vp), g_markup_printf_escaped ("pass='%d' variableframerate='%i' ",
gst_encoding_video_profile_get_variableframerate (vp)); gst_encoding_video_profile_get_pass (vp),
gst_encoding_video_profile_get_variableframerate (vp)));
} }
g_string_append (str, "/>\n"); g_string_append (str, "/>\n");
@ -1084,20 +1087,23 @@ _save_encoding_profiles (GString * str, GESProject * project)
profpresetname = gst_encoding_profile_get_preset_name (prof); profpresetname = gst_encoding_profile_get_preset_name (prof);
proftype = gst_encoding_profile_get_type_nick (prof); proftype = gst_encoding_profile_get_type_nick (prof);
append_printf_escaped (str, append_escaped (str,
"<encoding-profile name='%s' description='%s' type='%s' ", profname, g_markup_printf_escaped
profdesc, proftype); ("<encoding-profile name='%s' description='%s' type='%s' ", profname,
profdesc, proftype));
if (profpreset) if (profpreset)
append_printf_escaped (str, "preset='%s' ", profpreset); append_escaped (str, g_markup_printf_escaped ("preset='%s' ",
profpreset));
if (profpresetname) if (profpresetname)
append_printf_escaped (str, "preset-name='%s' ", profpresetname); append_escaped (str, g_markup_printf_escaped ("preset-name='%s' ",
profpresetname));
profformat = gst_encoding_profile_get_format (prof); profformat = gst_encoding_profile_get_format (prof);
if (profformat) { if (profformat) {
gchar *format = gst_caps_to_string (profformat); gchar *format = gst_caps_to_string (profformat);
append_printf_escaped (str, "format='%s' ", format); append_escaped (str, g_markup_printf_escaped ("format='%s' ", format));
g_free (format); g_free (format);
gst_caps_unref (profformat); gst_caps_unref (profformat);
} }
@ -1116,7 +1122,8 @@ _save_encoding_profiles (GString * str, GESProject * project)
_save_stream_profiles (str, sprof, profname, i); _save_stream_profiles (str, sprof, profname, i);
} }
} }
append_printf_escaped (str, "</encoding-profile>\n", NULL); append_escaped (str,
g_markup_printf_escaped ("</encoding-profile>\n", NULL));
} }
} }
@ -1138,8 +1145,9 @@ _save (GESFormatter * formatter, GESTimeline * timeline, GError ** error)
MINOR_VERSION); MINOR_VERSION);
properties = _serialize_properties (G_OBJECT (project), NULL); properties = _serialize_properties (G_OBJECT (project), NULL);
metas = ges_meta_container_metas_to_string (GES_META_CONTAINER (project)); metas = ges_meta_container_metas_to_string (GES_META_CONTAINER (project));
append_printf_escaped (str, "<project properties='%s' metadatas='%s'>\n", append_escaped (str,
properties, metas); g_markup_printf_escaped ("<project properties='%s' metadatas='%s'>\n",
properties, metas));
g_free (properties); g_free (properties);
g_free (metas); g_free (metas);