1

假设我们有一个如下所示的GStreamer命令,并且它在控制台上运行得很好。我如何在特定的 上运行它JFrame?当我在终端上运行这个命令时,它会打开一个新的视频场景。但我需要在 Netbeans 上特定大小的 JFrame 表单上运行此视频。

gst-launch-1.0 udpsrc port=5004 buffer-size=622080 ! avdec_h264 ! videoconvert ! fpsdisplaysink
4

1 回答 1

1

这是下面的解决方案;(Çözümüm aşağıdadır。)

// Gstreamer init - İlklendir
Gst.init(Version.BASELINE, "BasicPipeline");

// Create a named pipeline - sink isimli bir pipeline yarat.
pipeline = (Pipeline) Gst.parseLaunch("videotestsrc ! appsink name=sink");

// Create am appsink that refers to pipeline - sink'ten bir appSink nesnesi yarat
AppSink sink = (AppSink) pipeline.getElementByName("sink");

// Create GstVideoComponent object - gstVc objesi yarat.
GstVideoComponent vc = new GstVideoComponent(sink);
vc.setSize(600, 560);
vc.setVisible(true);

// main screen is a form screen that is public static and has a jform named panel_video  - vc'yi form'a ekle
mainScreen.panel_video.add(vc);

// play video - video'yu koştur.
pipeline.play();

谢谢,

于 2021-09-02T07:05:00.467 回答