![](/img/trans.png)
[英]Calculate amount needed to increment to get target value between certain caps
[英]Get caps from pipeline
我是GStreamer的新手,我嘗試從Java的管道中獲取Caps屬性。 如果我在命令行中嘗試此管道
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
它工作正常,並返回此上限,這是我需要的
/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
但我不知道,如何從管道中獲得Java的上限
pipe = Pipeline.launch("filesrc location="C:/Dokumenty/Eclipse/rtsp_test/trailer.mp4" ! decodebin2 ! queue ! jpegenc ! rtpjpegpay ! udpsink host=::1 port=5000 sync=true");
有什么方法可以從管道中獲取udpsink0嗎?
謝謝
如果查看Bin
的文檔( Pipeline
的父類),則會發現有幾種獲取單個元素的方法。 最簡單的方法是使用: Bin.getElementByName("udpsink0")
。
一種更通用的方法是調用Bin.getSinks()
,然后從列表中獲取第一個結果。 這樣,即使您使用其他類型的接收器,代碼仍然可以正常工作。
一旦有了Element
對象,就可以使用Element.getStaticPad("sink")
獲取填充,然后最終可以通過Pad.getNegotiatedCaps()
獲取Caps
對象。
有關更多信息,請查看javadocs,該文檔可在以下網址找到: https : //code.google.com/p/gstreamer-java/downloads/list
簡而言之:
Element sink = pipe.getElementByName("udpsink0");
Pad pad = sink.getStaticPad("sink");
Caps caps = pad.getNegotiatedCaps();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.