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;
GstStructure *s;
s = gst_structure_new_id (GST_QUARK_SEGMENT, GST_QUARK_FLAGS,
GST_TYPE_SEGMENT_FLAGS, seg->flags, GST_QUARK_RATE, G_TYPE_DOUBLE,
seg->rate, GST_QUARK_APPLIED_RATE, G_TYPE_DOUBLE, seg->applied_rate,
GST_QUARK_FORMAT, GST_TYPE_FORMAT, seg->format, GST_QUARK_BASE,
G_TYPE_UINT64, seg->base, GST_QUARK_OFFSET, G_TYPE_UINT64, seg->offset,
GST_QUARK_START, G_TYPE_UINT64, seg->start, 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);
s = gst_structure_new_id (GST_QUARK (SEGMENT),
GST_QUARK (FLAGS), GST_TYPE_SEGMENT_FLAGS, seg->flags,
GST_QUARK (RATE), G_TYPE_DOUBLE, seg->rate,
GST_QUARK (APPLIED_RATE), G_TYPE_DOUBLE, seg->applied_rate,
GST_QUARK (FORMAT), GST_TYPE_FORMAT, seg->format,
GST_QUARK (BASE), G_TYPE_UINT64, seg->base,
GST_QUARK (OFFSET), G_TYPE_UINT64, seg->offset,
GST_QUARK (START), G_TYPE_UINT64, seg->start,
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);
if (escape) {
res = g_strdup_printf ("\"%s\"", t);
@ -2804,17 +2808,17 @@ gst_value_deserialize_segment (GValue * dest, const gchar * s)
return FALSE;
res = gst_structure_id_get (str,
GST_QUARK_FLAGS, GST_TYPE_SEGMENT_FLAGS, &seg.flags,
GST_QUARK_RATE, G_TYPE_DOUBLE, &seg.rate,
GST_QUARK_APPLIED_RATE, G_TYPE_DOUBLE, &seg.applied_rate,
GST_QUARK_FORMAT, GST_TYPE_FORMAT, &seg.format,
GST_QUARK_BASE, G_TYPE_UINT64, &seg.base,
GST_QUARK_OFFSET, G_TYPE_UINT64, &seg.offset,
GST_QUARK_START, G_TYPE_UINT64, &seg.start,
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);
GST_QUARK (FLAGS), GST_TYPE_SEGMENT_FLAGS, &seg.flags,
GST_QUARK (RATE), G_TYPE_DOUBLE, &seg.rate,
GST_QUARK (APPLIED_RATE), G_TYPE_DOUBLE, &seg.applied_rate,
GST_QUARK (FORMAT), GST_TYPE_FORMAT, &seg.format,
GST_QUARK (BASE), G_TYPE_UINT64, &seg.base,
GST_QUARK (OFFSET), G_TYPE_UINT64, &seg.offset,
GST_QUARK (START), G_TYPE_UINT64, &seg.start,
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);
gst_structure_free (str);
if (res)