gstvalue: Fix segment (de)serialization

By using the proper quarks (stored in the indirection table) and not the *enums*
of those entry in the quark table.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/473>
This commit is contained in:
Edward Hervey 2020-05-08 17:21:20 +02:00 committed by Edward Hervey
parent 67df099241
commit 2536cf7c57

View file

@ -2765,15 +2765,19 @@ gst_value_serialize_segment_internal (const GValue * value, gboolean escape)
gchar *t, *res; gchar *t, *res;
GstStructure *s; GstStructure *s;
s = gst_structure_new_id (GST_QUARK_SEGMENT, GST_QUARK_FLAGS, s = gst_structure_new_id (GST_QUARK (SEGMENT),
GST_TYPE_SEGMENT_FLAGS, seg->flags, GST_QUARK_RATE, G_TYPE_DOUBLE, GST_QUARK (FLAGS), GST_TYPE_SEGMENT_FLAGS, seg->flags,
seg->rate, GST_QUARK_APPLIED_RATE, G_TYPE_DOUBLE, seg->applied_rate, GST_QUARK (RATE), G_TYPE_DOUBLE, seg->rate,
GST_QUARK_FORMAT, GST_TYPE_FORMAT, seg->format, GST_QUARK_BASE, GST_QUARK (APPLIED_RATE), G_TYPE_DOUBLE, seg->applied_rate,
G_TYPE_UINT64, seg->base, GST_QUARK_OFFSET, G_TYPE_UINT64, seg->offset, GST_QUARK (FORMAT), GST_TYPE_FORMAT, seg->format,
GST_QUARK_START, G_TYPE_UINT64, seg->start, GST_QUARK_STOP, G_TYPE_UINT64, GST_QUARK (BASE), G_TYPE_UINT64, seg->base,
seg->stop, GST_QUARK_TIME, G_TYPE_UINT64, seg->time, GST_QUARK_POSITION, GST_QUARK (OFFSET), G_TYPE_UINT64, seg->offset,
G_TYPE_UINT64, seg->position, GST_QUARK_DURATION, G_TYPE_UINT64, GST_QUARK (START), G_TYPE_UINT64, seg->start,
seg->duration, NULL); GST_QUARK (STOP), G_TYPE_UINT64, seg->stop,
GST_QUARK (TIME), G_TYPE_UINT64, seg->time,
GST_QUARK (POSITION), G_TYPE_UINT64, seg->position,
GST_QUARK (DURATION), G_TYPE_UINT64, seg->duration, NULL);
t = gst_structure_to_string (s); t = gst_structure_to_string (s);
if (escape) { if (escape) {
res = g_strdup_printf ("\"%s\"", t); res = g_strdup_printf ("\"%s\"", t);
@ -2804,17 +2808,17 @@ gst_value_deserialize_segment (GValue * dest, const gchar * s)
return FALSE; return FALSE;
res = gst_structure_id_get (str, res = gst_structure_id_get (str,
GST_QUARK_FLAGS, GST_TYPE_SEGMENT_FLAGS, &seg.flags, GST_QUARK (FLAGS), GST_TYPE_SEGMENT_FLAGS, &seg.flags,
GST_QUARK_RATE, G_TYPE_DOUBLE, &seg.rate, GST_QUARK (RATE), G_TYPE_DOUBLE, &seg.rate,
GST_QUARK_APPLIED_RATE, G_TYPE_DOUBLE, &seg.applied_rate, GST_QUARK (APPLIED_RATE), G_TYPE_DOUBLE, &seg.applied_rate,
GST_QUARK_FORMAT, GST_TYPE_FORMAT, &seg.format, GST_QUARK (FORMAT), GST_TYPE_FORMAT, &seg.format,
GST_QUARK_BASE, G_TYPE_UINT64, &seg.base, GST_QUARK (BASE), G_TYPE_UINT64, &seg.base,
GST_QUARK_OFFSET, G_TYPE_UINT64, &seg.offset, GST_QUARK (OFFSET), G_TYPE_UINT64, &seg.offset,
GST_QUARK_START, G_TYPE_UINT64, &seg.start, GST_QUARK (START), G_TYPE_UINT64, &seg.start,
GST_QUARK_STOP, G_TYPE_UINT64, &seg.stop, GST_QUARK (STOP), G_TYPE_UINT64, &seg.stop,
GST_QUARK_TIME, G_TYPE_UINT64, &seg.time, GST_QUARK (TIME), G_TYPE_UINT64, &seg.time,
GST_QUARK_POSITION, G_TYPE_UINT64, &seg.position, GST_QUARK (POSITION), G_TYPE_UINT64, &seg.position,
GST_QUARK_DURATION, G_TYPE_UINT64, &seg.duration, NULL); GST_QUARK (DURATION), G_TYPE_UINT64, &seg.duration, NULL);
gst_structure_free (str); gst_structure_free (str);
if (res) if (res)