我正在尝试将命令行脚本实现到 Gstreamer c# windows 窗体应用程序。我将调试设置为“3 > Errorlog.txt”,但文件始终为空。我无法理解我做错了什么。命令行完美运行,但在 winforms 应用程序中没有任何反应。
这是命令行脚本:
gst-launch udpsrc port=1234 multicast-group="127.0.0.1" ! mpegtsdemux name=demuxer ! queue2 ! mpeg2dec ! ffmpegcolorspace ! videoscale ! directdrawsink
和我的实现:
private void Start(){
Gst.Application.Init();
pipeline = new Gst.Pipeline();
udpsrc = Gst.ElementFactory.Make("udpsrc", "source");
udpsrc["port"] = 1234;
udpsrc["multicast-group"] = "127.0.0.1";
demux = ElementFactory.Make("mpegtsdemux", "demuxer");
demux["name"] = "demuxer";
queue = ElementFactory.Make("queue2", "videoq");
decode = ElementFactory.Make("mpeg2dec", "decode");
space = ElementFactory.Make("ffmpegcolorspace", "space");
scale = ElementFactory.Make("videoscale", "scale");
MyDrawSink = ElementFactory.Make("directdrawsink", "directdrawsink");
pipeline.Add(udpsrc, demux, queue, decode, space, scale, MyDrawSink);
MySinkAdapter = new XOverlayAdapter(MyDrawSink.Handle);
MySinkAdapter.XwindowId = (ulong)this.Handle;
udpsrc.Link(demux);
demux.Link(queue);
queue.Link(decode);
decode.Link(space);
space.Link(scale);
scale.Link(MyDrawSink);
pipeline.SetState(State.Playing);
}
谢谢你的时间。