[gst-debugger] common: support unknown property types



commit e14c461cdd941cfc250fbb4f52e4e6cd0e2d14b6
Author: Marcin Kolny <marcin kolny gmail com>
Date:   Mon Sep 21 23:53:18 2015 +0200

    common: support unknown property types

 src/common/common.h       |    1 +
 src/common/deserializer.c |    1 +
 src/common/serializer.c   |    7 +++++++
 3 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/src/common/common.h b/src/common/common.h
index 7976656..b96cdfe 100644
--- a/src/common/common.h
+++ b/src/common/common.h
@@ -19,6 +19,7 @@ typedef enum _InternalGType
   INTERNAL_GTYPE_FLAGS = 2,
   INTERNAL_GTYPE_CAPS = 3,
   INTERNAL_GTYPE_GST_OBJECT = 4,
+  INTERNAL_GTYPE_UNKNOWN = 5,
 } InternalGType;
 
 G_END_DECLS
diff --git a/src/common/deserializer.c b/src/common/deserializer.c
index ca79b6f..14a4477 100644
--- a/src/common/deserializer.c
+++ b/src/common/deserializer.c
@@ -113,6 +113,7 @@ void g_value_deserialize (GValue * value, GType type, InternalGType internal_typ
   }
   case INTERNAL_GTYPE_GST_OBJECT: // and with pointers
   case INTERNAL_GTYPE_FUNDAMENTAL:
+  case INTERNAL_GTYPE_UNKNOWN:
     g_value_init (value, type);
     gst_value_deserialize (value, data);
     break;
diff --git a/src/common/serializer.c b/src/common/serializer.c
index 0cc4d6c..52beffa 100644
--- a/src/common/serializer.c
+++ b/src/common/serializer.c
@@ -144,6 +144,13 @@ gchar * g_value_serialize (GValue * value, GType * type, InternalGType * interna
     *type = G_TYPE_STRING;
     g_value_set_string (&tmp, g_strdup (buffer));
     *internal_type = INTERNAL_GTYPE_GST_OBJECT;
+  } else {
+    g_value_init(&tmp, G_TYPE_STRING);
+    gchar buffer[128];
+    snprintf (buffer, 128, "<unknown type '%s', can not read value>", g_type_name (value->g_type));
+    *type = G_TYPE_STRING;
+    *internal_type = INTERNAL_GTYPE_UNKNOWN;
+    g_value_set_string (&tmp, g_strdup (buffer));
   }
 
   return gst_value_serialize (&tmp);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]