首页 > 解决方案 > GStreamer-sharp 在使用 SeekFlags.Flush 搜索时冻结

问题描述

作为一种实践,我正在尝试将 GStreamer 示例从 c 转换为 c#,并且我坚持使用基本教程 4(https://gstreamer.freedesktop.org/documentation/tutorials/basic/time-management.html)。在示例中,搜索执行如下

gst_element_seek_simple (data.playbin, GST_FORMAT_TIME,
          GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT, 30 * GST_SECOND);

我翻译成C#:

playbin.SeekSimple(Format.Time, SeekFlags.Flush | SeekFlags.KeyUnit, 30L * Constants.SECOND);

但是,在寻找之后,只播放了一帧,然后播放就卡住了。

这里有一个 C# 教程:(https://github.com/GStreamer/gstreamer-sharp/blob/master/samples/BasicTutorial4.cs)。但是,在本教程中,搜索是在没有SeekFlags.Flush(第 73 行)的情况下执行的。示例中的搜索有效,但执行时会延迟几秒钟。

那么,是SeekFlags.FlushC# GStreamer 绑定中的工作还是我在这里遗漏了什么?

我已经安装了最新的 GStreamer 和 GstSharp(版本 1.14.0)。

谢谢,汤姆

标签: c#gstreamergstreamer-sharp

解决方案


我通过从 gstreamer-sharp 源 ( https://github.com/GStreamer/gstreamer-sharp )重建使它工作。

我转换为 .netstandard 2.0 并添加了 Nuget 包 GioSharp ( https://www.nuget.org/packages/GioSharp/3.22.24.36 )

或者,我重建原始 gstreamer-sharp 项目和 GtkSharp.Win32 Nuget 包(https://www.nuget.org/packages/GtkSharp.Win32/3.1.2

希望它在官方 GstSharp Nuget 包中找到它的方式。


推荐阅读