GSTREAMER:GSTREAM如何删除其对象
我对上述主题及其问题感到非常困惑。从教程和网页API中,我了解要删除对象,
- 您应该使用gst_object_unref(obj),将参考值计数减少一个。
- 当对象的参考计数达到零时,将自动删除对象
,但是似乎有函数会增加对象的内部参考计数,
例如, 如果我错了,请纠正我新近加入的元素通过管道。参考计数从1开始增加到4
//// record -> mfsink is the splitmux
g_print("ref count (1) splitmuxsink is %d \n", GST_OBJECT_REFCOUNT(record->mfsink));
/// set to playing
if (!gst_element_sync_state_with_parent (GST_ELEMENT (record->mfsink)))
{
g_error ("Failed to go into PLAYING state");
return -4;
}
else
{
g_print("Splitmux set to playing \n);
}
g_print("thread Live: ref count (2) of splitmuxsink is %d \n", GST_OBJECT_REFCOUNT(record->mfsink));
:
ref count of (1) splitmuxsink is 1
Splitmux set to playing.
ref count of (2) splitmuxsink is 4
在其他地方,如果我们调用gst_object_unref()函数,则只能将oeference计数器取消1。
与其他一些函数GST_ELEMENT_SET_STATE和GST_ELEMENT_REMENT_REMENT_REMENT_REMENT_PAD相似,将分别增加3和2。
我正在尝试在动态管道中“重新创建/刷新”一个对象,以便每次启动/停止的迭代都会创建/更新一个对象(可以创建开销的对象),但是似乎不可能删除对象。
还是可能?感谢您的
帮助
I am quite confused about the above topic and its question. I understand from the tutorial and webpage API that to delete an object,
- you should use gst_object_unref(obj) which would decrement the reference value count by one.
- When the reference count of object reaches zero, the object will be automatically deleted
However there seem to be functions that will increase the internal reference count of object, correct me if i am wrong
For example, I write a snippet of the function to sync a newly joined element with a pipeline. The reference count increase to 4 from 1
//// record -> mfsink is the splitmux
g_print("ref count (1) splitmuxsink is %d \n", GST_OBJECT_REFCOUNT(record->mfsink));
/// set to playing
if (!gst_element_sync_state_with_parent (GST_ELEMENT (record->mfsink)))
{
g_error ("Failed to go into PLAYING state");
return -4;
}
else
{
g_print("Splitmux set to playing \n);
}
g_print("thread Live: ref count (2) of splitmuxsink is %d \n", GST_OBJECT_REFCOUNT(record->mfsink));
The result:
ref count of (1) splitmuxsink is 1
Splitmux set to playing.
ref count of (2) splitmuxsink is 4
Where else, if we call gst_object_unref() function, it will only unreference the oreference counter by 1.
Similar with some other functions gst_element_set_state and gst_element_request_pad will increase reference count by 3 and 2 respectively.
I am trying to "recreate/refresh" an object in dynamic pipeline, so that each iteration of start/stop will create/renew an object (ok that would create overhead) but it seems that to delete an object is impossible.
Or it is possible? Thanks for your help
Regards
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为这不是解决这个问题的适当方法。
您可以使用
gst_object_refcount_value
“循环”上的迭代宏。I think it will not be appropriate approach to that problem.
You can use
GST_OBJECT_REFCOUNT_VALUE
macro for iteration over "while loop".