[英]Get caps from pipeline
I am new to GStreamer and I try to get Caps property from pipeline in Java. 我是GStreamer的新手,我尝试从Java的管道中获取Caps属性。 If i try in command line this pipeline
如果我在命令行中尝试此管道
gst-launch-0.10 -v --gst-debug-level=2 filesrc location="C:/Dokumenty/Eclipse/rtsp_test/trailer.mp4" ! decodebin2 ! queue ! jpegenc ! rtpjpegpay ! udpsink host=::1 port=5000 sync=true
it works fine and return this caps, which I needed 它工作正常,并返回此上限,这是我需要的
/GstPipeline:pipeline0/GstUDPSink:udpsink0.GstPad:sink: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)JPEG, payload=(int)96, ssrc=(uint)3175930633, clock-base=(uint)3850186239, seqnum-base=(uint)8531
But I dont know, how to get this caps in Java from pipeline 但我不知道,如何从管道中获得Java的上限
pipe = Pipeline.launch("filesrc location="C:/Dokumenty/Eclipse/rtsp_test/trailer.mp4" ! decodebin2 ! queue ! jpegenc ! rtpjpegpay ! udpsink host=::1 port=5000 sync=true");
Are there any methods how to get udpsink0 from pipeline? 有什么方法可以从管道中获取udpsink0吗?
Thank you 谢谢
If you look at the documentation for Bin
(the parent class of Pipeline
), you'll see there are a few ways to get individual elements. 如果查看
Bin
的文档( Pipeline
的父类),则会发现有几种获取单个元素的方法。 The most simple way is to use: Bin.getElementByName("udpsink0")
. 最简单的方法是使用:
Bin.getElementByName("udpsink0")
。
A more generic way would be to call Bin.getSinks()
and then grab the first result from the list. 一种更通用的方法是调用
Bin.getSinks()
,然后从列表中获取第一个结果。 This way the code will still work even if you use a different type of sink. 这样,即使您使用其他类型的接收器,代码仍然可以正常工作。
Once you have the Element
object you can get the pad using Element.getStaticPad("sink")
and then finally you can get the Caps
object with Pad.getNegotiatedCaps()
. 一旦有了
Element
对象,就可以使用Element.getStaticPad("sink")
获取填充,然后最终可以通过Pad.getNegotiatedCaps()
获取Caps
对象。
For more information check out the javadocs, which can be found at: https://code.google.com/p/gstreamer-java/downloads/list 有关更多信息,请查看javadocs,该文档可在以下网址找到: https : //code.google.com/p/gstreamer-java/downloads/list
In short: 简而言之:
Element sink = pipe.getElementByName("udpsink0");
Pad pad = sink.getStaticPad("sink");
Caps caps = pad.getNegotiatedCaps();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.