相关连接:https://blog.csdn.net/knowledgebao/article/details/84621238


GstStructure — Generic structure containing fields of names and values。类似于map的一个结构。key的类型是:GQuary,value的类型是GValue,详见参考资料6.

关于GQuery的详细描述,详见参考资料的1,2,3.

关于GValue的详细描述,详见参考资料4。

关于GstValue的详细描述,详见参考资料5.

//功能:tries to transform the given value into a string representation that allows getting back this string later on using gst_value_deserialize().
//value:a GValue to serialize
//Returns:the serialization for value or NULL if none exists.
//必须调用g_free释放。
gchar *gst_value_serialize (
const GValue *value
):

 


gst_structure_foreach:
功能:遍历structure,通过回调的方式列举,举例如下: 

gboolean gst_structure_foreach (const GstStructure *structure,
                       GstStructureForeachFunc func,
                       gpointer user_data);
static gboolean print_field(GQuark field, const GValue * value, gpointer pfx) {
    gchar *str = gst_value_serialize(value);
    g_print("%s  %15s: %s\n", (gchar *)pfx, g_quark_to_string(field), str);
    g_free(str);
    return TRUE;
}
void print_caps(const GstCaps * caps, const gchar * pfx) {
    guint i;
    for (i = 0; i < gst_caps_get_size(caps); i++) {
        GstStructure *structure = gst_caps_get_structure(caps, i);
        gst_structure_foreach(structure, print_field, (gpointer)pfx); 
    }
}

gst_structure_id_get_value ():

功能:通过GQark获取GValue。

const GValue * gst_structure_id_get_value (const GstStructure *structure,
                            GQuark field);

 

参考资料:

  1. Glib中Gquark浅析
  2. Glib中Gquark浅析
  3. glib库中的GQuark介绍
  4. GObject笔记-通用类型
  5. GstValue
  6. GstStructure

有任何问题,请联系:knowledgebao@163.com

Logo

GitCode 天启AI是一款由 GitCode 团队打造的智能助手,基于先进的LLM(大语言模型)与多智能体 Agent 技术构建,致力于为用户提供高效、智能、多模态的创作与开发支持。它不仅支持自然语言对话,还具备处理文件、生成 PPT、撰写分析报告、开发 Web 应用等多项能力,真正做到“一句话,让 Al帮你完成复杂任务”。

更多推荐