Exemplo n.º 1
0
 def values(self):
     item = self.val["fields"].cast(
         gdb.lookup_type("GstStructureField").pointer())
     for i in range(self.size()):
         f = item[i]
         key = g_quark_to_string(f["name"])
         value = GdbGValue(f["value"])
         yield (key, value)
Exemplo n.º 2
0
 def __str__(self):
     if long(self.val) == 0:
         return ""
     count = self.size()
     if int(self.val["is_any"]) == 1 and count == 0:
         return "(ANY)"
     if count == 0:
         return ""
     s = ""
     for f in self.items():
         ss = g_quark_to_string(f)
         if ss != "memory:SystemMemory" or count > 1:
             s += ", " if s else ""
             s += ss
     return s
Exemplo n.º 3
0
def _g_value_get_value(val):
    typenode = g_type_to_typenode(val["g_type"])
    if not typenode:
        return None
    tname = g_quark_to_string(typenode["qname"])
    fname = g_type_to_name(typenode["supers"][int(typenode["n_supers"])])
    if fname in ("gchar", "guchar", "gboolean", "gint", "guint", "glong",
                 "gulong", "gint64", "guint64", "gfloat", "gdouble",
                 "gpointer", "GFlags"):
        try:
            t = gdb.lookup_type(tname).pointer()
        except RuntimeError:
            t = gdb.lookup_type(fname).pointer()
    elif fname == "gchararray":
        t = gdb.lookup_type("char").pointer().pointer()
    elif fname == "GstBitmask":
        t = gdb.lookup_type("guint64").pointer()
    elif fname == "GstFlagSet":
        t = gdb.lookup_type("guint").pointer().pointer()
        return val["data"].cast(t)
    elif fname == "GstFraction":
        t = gdb.lookup_type("gint").pointer().pointer()
        return val["data"].cast(t)
    elif fname == "GstFractionRange":
        t = gdb.lookup_type("GValue").pointer().pointer()
    elif fname == "GstValueList":
        t = gdb.lookup_type("GArray").pointer().pointer()
    elif fname in ("GBoxed", "GObject"):
        try:
            t = gdb.lookup_type(tname).pointer().pointer()
        except RuntimeError:
            t = gdb.lookup_type(tname).pointer().pointer()
    else:
        return val["data"]

    return val["data"].cast(t).dereference()
Exemplo n.º 4
0
 def values(self):
     for f in _g_array_iter(self.val["fields"],
                            gdb.lookup_type("GstStructureField")):
         key = g_quark_to_string(f["name"])
         value = GdbGValue(f["value"])
         yield (key, value)
Exemplo n.º 5
0
 def name(self):
     return g_quark_to_string(self.val["s"]["name"])