gboolean ret = FALSE;
GstCaps *caps = NULL;
GESMarkerList *list = ges_marker_list_new ();
- guint i, l;
- gsize len;
+ guint caps_len, i = 0;
+ gsize string_len;
gchar *escaped, *caps_str;
+ GstStructure *data_s;
+ gint flags;
- len = strlen (s);
- if (G_UNLIKELY (*s != '"' || len < 2 || s[len - 1] != '"')) {
+ string_len = strlen (s);
+ if (G_UNLIKELY (*s != '"' || string_len < 2 || s[string_len - 1] != '"')) {
/* "\"" is not an accepted string, so len must be at least 2 */
GST_ERROR ("Failed deserializing marker list: expected string to start "
"and end with '\"'");
goto done;
}
escaped = g_strdup (s + 1);
- escaped[len - 2] = '\0';
+ escaped[string_len - 2] = '\0';
/* removed trailing '"' */
caps_str = g_strcompress (escaped);
g_free (escaped);
goto done;
}
- l = gst_caps_get_size (caps);
- if (l == 0) {
+ caps_len = gst_caps_get_size (caps);
+ if (G_UNLIKELY (caps_len == 0)) {
GST_DEBUG ("Got empty caps: %s", s);
-
goto done;
}
- if (G_UNLIKELY (l % 2)) {
- GST_ERROR ("Failed deserializing marker list: expected evenly-sized caps");
- goto done;
+ data_s = gst_caps_get_structure (caps, i);
+ if (gst_structure_has_name (data_s, "marker-list-flags")) {
+ if (!gst_structure_get_int (data_s, "flags", &flags)) {
+ GST_ERROR_OBJECT (dest,
+ "Failed deserializing marker list: unexpected structure %"
+ GST_PTR_FORMAT, data_s);
+ goto done;
+ }
+
+ list->flags = flags;
+ i += 1;
+ }
+
+ if (G_UNLIKELY ((caps_len - i) % 2)) {
+ GST_ERROR ("Failed deserializing marker list: incomplete marker caps");
}
- for (i = 0; i < l - 1; i += 2) {
+ for (; i < caps_len - 1; i += 2) {
const GstStructure *pos_s = gst_caps_get_structure (caps, i);
const GstStructure *meta_s = gst_caps_get_structure (caps, i + 1);
GstClockTime position;
ges_meta_container_add_metas_from_string (GES_META_CONTAINER (marker),
metas);
g_free (metas);
-
}
ret = TRUE;
GSequenceIter *iter;
GstCaps *caps = gst_caps_new_empty ();
gchar *caps_str, *escaped, *res;
+ GstStructure *s;
+
+ s = gst_structure_new ("marker-list-flags", "flags", G_TYPE_INT,
+ list->flags, NULL);
+ gst_caps_append_structure (caps, s);
iter = g_sequence_get_begin_iter (list->markers);
while (!g_sequence_iter_is_end (iter)) {
GESMarker *marker = (GESMarker *) g_sequence_get (iter);
- GstStructure *s;
gchar *metas;
metas = ges_meta_container_metas_to_string (GES_META_CONTAINER (marker));
GList *markers;
guint64 position;
GValue val1 = G_VALUE_INIT, val2 = G_VALUE_INIT;
+ GESMarkerFlags flags;
ges_init ();
g_value_init (&val2, GES_TYPE_MARKER_LIST);
markerlist1 = ges_marker_list_new ();
+ g_object_set (markerlist1, "flags", GES_MARKER_FLAG_SNAPPABLE, NULL);
marker = ges_marker_list_add (markerlist1, 0);
fail_unless (ges_meta_container_set_string (GES_META_CONTAINER (marker),
"str-val", test_string));
markerlist2 = GES_MARKER_LIST (g_value_get_object (&val2));
ASSERT_OBJECT_REFCOUNT (markerlist2, "GValue", 1);
+ g_object_get (markerlist2, "flags", &flags, NULL);
+ fail_unless (flags == GES_MARKER_FLAG_SNAPPABLE);
+
fail_unless_equals_int (ges_marker_list_size (markerlist2), 2);
markers = ges_marker_list_get_markers (markerlist2);
marker = GES_MARKER (markers->data);