Core Library-GstObject
admin
2024-05-05 08:50:24
0

GInitiallyUnowned

我查了GInitiallyUnowned的相关资料,在gobject.h文件中

typedef struct _GObject                  GObject;
typedef struct _GObjectClass             GObjectClass;
typedef struct _GObject                  GInitiallyUnowned;
typedef struct _GObjectClass             GInitiallyUnownedClass;

从语法角度理解,GObject和GInitiallyUnowned指向的结构体是相同的,也就是两者并无区别。但是从GObject Reference Manual中了解到:

GInitiallyUnowned is derived from GObject. The only difference between the two is that the initial reference of a GInitiallyUnowned is flagged as a floating reference. This means that it is not specifically claimed to be “owned” by any code portion. The main motivation for providing floating references is C convenience. In particular, it allows code to be written as:

GInitiallyUnowned源自GObject。两者之间唯一的区别是GInitiallyUnowned的初始引用被标记为floating引用。这意味着它不被任何代码部分明确声明为“拥有”。提供floating引用的主要动机是C语言的便利性。特别是,它允许代码写成:

关于floating引用我不明白作用是什么

GstObject

GstObject为GStreamer库提供了一个根基。它目前是GInitiallyUnowned之上的一个薄包装。它是一个抽象类,单独使用不是很方便。

GstObject为我们提供了基本的引用计数、父类方法和锁。大多数函数只是为特定的GStreamer需求而扩展,可以在GstObject的基类GObject下找到相同的名称(例如g_object_ref成为gst_object_ref)。

由于GstObject继承于 GInitiallyUnowned,因此它也继承了浮动引用(我的理解:浮动引用传入指针的时候,不会refcount,比如gst_bin_addd)。请注意,gst_bin_add和gst_element_add_pad等函数拥有浮动引用。

与GObject实例不同,GstObject添加了name属性。函数gst_object_set_namegst_object_get_name用于设置/获取对象的名称。

controlled properties

不理解这部分的作用
controlled properties

Controlled properties offers a lightweight way to adjust gobject properties over stream-time. It works by using time-stamped value pairs that are queued for element-properties. At run-time the elements continuously pull value changes for the current stream-time.

What needs to be changed in a GstElement? Very little - it is just two steps to make a plugin controllable!

  • mark gobject-properties paramspecs that make sense to be controlled, by GST_PARAM_CONTROLLABLE.

  • when processing data (get, chain, loop function) at the beginning call gst_object_sync_values(element,timestamp). This will make the controller update all GObject properties that are under its control with the current values based on the timestamp.

What needs to be done in applications? Again it’s not a lot to change.

  • create a GstControlSource. csource = gst_interpolation_control_source_new (); g_object_set (csource, “mode”, GST_INTERPOLATION_MODE_LINEAR, NULL);

  • Attach the GstControlSource on the controller to a property. gst_object_add_control_binding (object, gst_direct_control_binding_new (object, “prop1”, csource));

  • Set the control values gst_timed_value_control_source_set ((GstTimedValueControlSource *)csource,0 * GST_SECOND, value1); gst_timed_value_control_source_set ((GstTimedValueControlSource *)csource,1 * GST_SECOND, value2);

  • start your pipeline

GstObject

GObject╰──GInitiallyUnowned╰──GstObject╰──GstAllocator╰──GstBufferPool╰──GstBus╰──GstClock╰──GstControlBinding╰──GstControlSource╰──GstDevice╰──GstDeviceMonitor╰──GstDeviceProvider╰──GstElement╰──GstPad╰──GstPadTemplate╰──GstPlugin╰──GstPluginFeature╰──GstRegistry╰──GstStream╰──GstStreamCollection╰──GstTask╰──GstTaskPool╰──GstTracer╰──GstTracerRecord
typedef struct _GstObject GstObject;
struct _GstObject {GInitiallyUnowned object;/*< public >*/ /* with LOCK */GMutex         lock;        /* object LOCK */gchar         *name;        /* object name */GstObject     *parent;      /* this object's parent, weak ref */guint32        flags;/*< private >*/GList         *control_bindings;  /* List of GstControlBinding */guint64        control_rate;guint64        last_sync;gpointer _gst_reserved;
};

属性

name

“name” gchar *

parent

“parent” GstObject * /*这个对象的父类*/

参考:GstObject

相关内容

热门资讯

中方话音刚落,美众议院投430... 编辑:伍月 最近,我外交部表示“中加新型战略伙伴关系不针对任何第三方”,中方这句话是说给谁听的?我们...
原创 黄... 黄金牛市继续演绎,白银牛市路在何方!原油化工农产品今年重点! 国内金银产品较多,报价不一,且溢价不稳...
远景能源携手招商局资本共同设立... 本报讯 (记者桂小笋)2月12日,远景能源有限公司(以下简称“远景能源”)与招商局资本携手招商基金、...
春节周重磅前瞻:美联储最爱通胀... 02月16日 - 02月22日当周重磅财经事件一览,以下均为北京时间: 本周核心主线如下: 首先是...
马斯克和OpenClaw之父的... “80%的APP将会消失。”开源AI智能体OpenClaw的创始人斯坦伯格(Peter Steinb...
脂鲤技术财报预计2026年初发... 来源:经济观察网 经济观察网 脂鲤技术(TTI.us)下一份财报(2025年第四季度及全年业绩)预计...
新产业首股即将上市,新赛道又要... 前几天和老朋友喝茶,他说最近在留意一只即将在上交所上市的新股——林平发展,专门做瓦楞纸和箱板纸的研发...
年俗遇浪漫,花卉消费喜迎“黄金... 马年春节前夕,鞍山花卉消费迎来“黄金档期”。中国商报记者近日走访鞍山味邦花卉城了解到,蝴蝶兰、君子兰...
【深圳特区报】“来深过大年”带... 今日起,春节9天长假开启,探亲、旅游的出行需求较往年更为旺盛。据预测,今年春运全社会跨区域人员流动量...
xAI安全体系已“名存实亡”?... 来源:环球网 【环球网科技综合报道】据外媒TechCrunch报道,近日,特斯拉CEO埃隆·马斯克...
比赛日:两回合“互捅”12球 ... 继首回合打出“4-3”这样的高比分后,次回合的意大利国家德比,国米和尤文再次联手奉献出一场“互捅局”...
逛庙会、快闪店……多元化场景激... 临近春节,各地消费活力高涨。不少商圈正在通过多元化的消费场景,叠加消费券、补贴、红包等优惠形式,吸引...
【首都除夕护卫健康】小针刀术后... 小针刀作为微创技术,通过松解粘连组织治疗颈肩腰腿痛等疾病,术后护理直接影响疗效恢复。科学护理能减少感...
有奖发票来了!单张最高奖800... 春节消费旺季来临,为进一步激发消费需求、释放消费活力,近日,商务部、 财政部、税务总局确定在50个城...
14户中央企业11名领导人员职... 中国铁道建筑集团有限公司、中国交通建设集团有限公司 裴岷山任中国铁道建筑集团有限公司党委副书记、董事...
现在手握6吨黄金,却还不起2.... 在黄金价格一路上行的背景下,一家拥有130年历史、曾被认定为“中华老字号”的黄金珠宝企业,在账面握有...
年货包裹,映照消费活力(大数据... 数据来源 国家邮政局 商务部 1月中下旬起,快递进入“年货时间”。随着年味渐浓,买年货、寄年礼,红火...
影石创新2025营收近100亿... 新京报贝壳财经讯(记者陈维城)2月13日,影石创新(688775.SH)发布2025年度业绩快报,公...
男子1500米决赛 孙龙刘少昂... 北京时间2月15日凌晨,2026年米兰-科尔蒂纳冬奥会短道速滑男子1500米决赛在米兰短道速滑馆结束...