本文整理汇总了Java中org.gstreamer.elements.PlayBin2类的典型用法代码示例。如果您正苦于以下问题:Java PlayBin2类的具体用法?Java PlayBin2怎么用?Java PlayBin2使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PlayBin2类属于org.gstreamer.elements包,在下文中一共展示了PlayBin2类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: GstreamerPlayer
import org.gstreamer.elements.PlayBin2; //导入依赖的package包/类
GstreamerPlayer(ElphelVision parent) {
this.Parent = parent;
args = new String[2];
args[1] = "";
args[0] = "";
try {
args = Gst.init("ElphelVision", args);
} catch (GstException e) {
Parent.WriteErrortoConsole("Gst.init error: " + e);
}
Playbin = new PlayBin2("VideoPlayer");
// rtspsource = "rtspsrc location=rtsp://" + Parent.Camera.GetIP()[0] + ":554 protocols=0x00000001 latency=50 ! rtpjpegdepay ! jpegdec ! queue ! jp462bayer ! queue ! bayer2rgb2 method=0 ! ffmpegcolorspace name=elphelstream";
//Playbin.setInputFile(new File("test.avi"));
/*java.net.URI uri = null;
try {
uri = new URI("rtsp://" + Parent.Camera.GetIP()[0] + ":554");
} catch (URISyntaxException ex) {
Logger.getLogger(GstreamerPlayer.class.getName()).log(Level.SEVERE, null, ex);
}
Playbin.setURI(uri);*/
videoComponent = new VideoComponent();
videoComponent.setPreferredSize(new Dimension(850, 480));
Playbin.setVideoSink(videoComponent.getElement());
}
示例2: PlaySdp
import org.gstreamer.elements.PlayBin2; //导入依赖的package包/类
/**
* Toma como argumento una URI que indica el path del SessionDescription que se quiere reproducir.
* Ejemplo: URI uriSDP = new URI("file:///home/laggc/Escritorio/borrar.sdp");
* Se creará un JFrame en el cual se reproducirá el medio.
* @return
* @partam uriSDP
* URI del SDP que se quiere reproducir.
*/
public static void PlaySdp(URI uriSDP)
{
Gst.init("PLAY SDP", new String[0]);
final PlayBin2 playbin = new PlayBin2("PlaySDP");
playbin.setURI(uriSDP);
SwingUtilities.invokeLater(new Runnable() {
public void run() {
VideoComponent videoComponent = new VideoComponent();
playbin.setVideoSink(videoComponent.getElement());
JFrame frame = new JFrame("Player");
frame.getContentPane().add(videoComponent, BorderLayout.CENTER);
frame.setPreferredSize(new Dimension(640, 480));
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
frame.setLocationRelativeTo(null);
playbin.setState(State.PLAYING);
}
});
Gst.main();
playbin.setState(State.NULL);
}