无法获取pygs中GstXvImageSink上GstBaseSink的属性

2024-06-28 15:40:37 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图从GstXvImageSink访问“last sample”属性,它是从gstbaseink派生的。 我得到了:

TypeError: object of type 'GstXvImageSink' does not have property 'last-sample'

在pygtk中有没有一种特殊的方法可以从基类中获取属性,或者这个属性是否被隐藏了?在

代码:

def take_snapshoot(self):
    sample = self.__snapshot_source_video_sink.get_property("last-sample")

Tags: ofsampleself属性objecthavetypenot
1条回答
网友
1楼 · 发布于 2024-06-28 15:40:37

我的错。我正在使用gstreamer0.1,我正在阅读gstreamer1.0的文档 所有引用到GstBuffer的东西现在都是GstSample了。 在http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/chapter-porting-1.0.html之后

GST_TAG_IMAGE, GST_TAG_PREVIEW_IMAGE, GST_TAG_ATTACHMENT: many tags that used to be of type GstBuffer are now of type GstSample (which is basically a struct containing a buffer alongside caps and some other info).

所以在我的例子中,答案是使用:

def take_snapshoot(self):
sample = self.__snapshot_source_video_sink.get_property("last-buffer")

相关问题 更多 >