2015-01-13 28 views
0

I 成功安裝了ossbuild GStreamer以享受C#的Gstreamer。在Gstreamer中創建Null實例0.10

的步驟總結如下:

  1. 下載的GStreamer-WinBuilds-GPL 86 Beta04-0.10.7.msi的GStreamer-WinBuilds-SDK-GPL 86 Beta04-0.10 .7.msi from https://code.google.com/p/ossbuild/downloads/list(或者你可以下載支持少插件的LGPL許可證對)
  2. 然後安裝前者然後後者。
  3. 然後你可以找到的GStreamer銳.NET引用文件,設在這裏的GStreamer-sharp.dll

    C:\ Program Files文件(x86)的\ OSSBuild \的GStreamer \ version_variable \ SDK \綁定\ DOTNET \的GStreamer-sharp.dll

  4. 另一個膠文件,gstreamersharpglue-0.10.dll,到項目裏面添加和設置爲始終複製或複製如果較新作的GStreamer銳的作品在Windows需要。

但是,當我試圖運行示例代碼(使用Gst;)時,它有例外。

var pipeline = new Gst.Pipeline(); 
//always have null instance here 
var elementA = Gst.ElementFactory.Make("videotestsrc"); 
//exceptions happens 
elementA["pattern"] = 18; 

回答

0
//must have 
Gst.Application.Init(); 
var pipeline = new Gst.Pipeline(); 
//if don't have Gst.Application.Init(), it will always have null instance here 
var elementA = Gst.ElementFactory.Make("videotestsrc"); 
//if no exceptions happens here then everything should be fine 
elementA["pattern"] = 18; 

如果Gst.Application.Init();觸發錯誤無法找到python26.dll,要解決安裝python 2.6,並添加項目也在裏面python26.dll。

記得用Gst.Application.Init();進行初始化,它耗費了我2天的時間來解決null實例。最後,因爲GStreamer及其綁定是爲x86架構編譯的,所以強制.NET組件構建爲x86