本文整理汇总了Java中org.gstreamer.State类的典型用法代码示例。如果您正苦于以下问题:Java State类的具体用法?Java State怎么用?Java State使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
State类属于org.gstreamer包,在下文中一共展示了State类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: stateChanged
import org.gstreamer.State; //导入依赖的package包/类
public void stateChanged(GstObject source, State old, State newState, State pending) {
if (!source.equals(getPipeline()))
return;
final ClockTime position = getPipeline().queryPosition();
if (newState.equals(State.PLAYING) && old.equals(State.PAUSED)) {
fireStartEvent(new StartEvent(PipelineMediaPlayer.this, old, newState, State.VOID_PENDING, position));
} else if (newState.equals(State.PAUSED) && pending.equals(State.VOID_PENDING)) {
firePauseEvent(new PauseEvent(PipelineMediaPlayer.this, old, newState, State.VOID_PENDING, position));
} else if (newState.equals(State.READY) && pending.equals(State.NULL)) {
fireStopEvent(new StopEvent(PipelineMediaPlayer.this, old, newState, pending, position));
}
// Anything else means we are transitioning!
if (!pending.equals(State.VOID_PENDING) && !pending.equals(State.NULL)) {
// TODO: Maybe a new callback method on MediaListener with TransitionEvent?
}
}
示例2: endOfStream
import org.gstreamer.State; //导入依赖的package包/类
public void endOfStream(GstObject source) {
URI next = playList.poll();
if (next != null) {
setURI(next);
} else {
final EndOfMediaEvent evt = new EndOfMediaEvent(PipelineMediaPlayer.this,
State.PLAYING, State.NULL, State.VOID_PENDING);
// Notify any listeners that the last media file is finished
fireEndOfMediaEvent(evt);
}
}
示例3: TransitionEvent
import org.gstreamer.State; //导入依赖的package包/类
public TransitionEvent(MediaPlayer player, State previousState, State currentState,
State pendingState) {
super(player);
this.previousState = previousState;
this.currentState = currentState;
this.pendingState = pendingState;
}
示例4: setURI
import org.gstreamer.State; //导入依赖的package包/类
/**
* Sets the media file to play.
*
* @param uri The URI that describes the location of the media file.
*/
public void setURI(URI uri) {
State old = playbin.getState();
playbin.ready();
playbin.setURI(uri);
playbin.setState(old);
}
示例5: widgetDisposed
import org.gstreamer.State; //导入依赖的package包/类
/**
* Dispose this Widget
*/
public void widgetDisposed(DisposeEvent arg0) {
if (sinkListener != null)
autosink.disconnect(sinkListener);
removeDisposeListener(this);
if (x11Events)
watcherRunning = false;
if (videosink != null && !videosink.getState().equals(State.NULL))
throw new IllegalStateException("Wrong state on dispose: " + videosink.getState() + " -> " + videosink.getName());
}
示例6: close
import org.gstreamer.State; //导入依赖的package包/类
public void close() {
Parent.WriteLogtoConsole("Stopping Gstreamer Video Player");
pipe.setState(State.NULL);
Gst.deinit(); // more trouble
//State test = pipe.getState();
pipe = null; //do we really need this?
}
示例7: RePlayVideoStream
import org.gstreamer.State; //导入依赖的package包/类
public void RePlayVideoStream() {
Parent.WriteLogtoConsole("Trying to restart Gstreamer Video Player");
Playbin.setState(State.PLAYING);
/*
String rtspsource = "";
if (Parent.Camera.GetColorMode() == ColorMode.RGB) {
rtspsource = "rtspsrc location=rtsp://" + Parent.Camera.GetIP()[0] + ":554 protocols=0x00000001 latency=50 ! rtpjpegdepay ! jpegdec name=elphelstream";
} else if (Parent.Camera.GetColorMode() == ColorMode.JP46) {
// rtspsrc location=rtsp://" + Parent.Camera.GetIP() + ":554 protocols=0x00000001 latency=50 ! rtpjpegdepay ! jpegdec ! queue ! jp462bayer ! queue ! bayer2rgb2 ! ffmpegcolorspace ! videorate ! "video/x-raw-yuv, format=(fourcc)I420, width=(int)1920, height=(int)1088, framerate=(fraction)25/1" ! xvimagesink sync=false max-lateness=-1
rtspsource = "rtspsrc location=rtsp://" + Parent.Camera.GetIP()[0] + ":554 protocols=0x00000001 latency=50 ! rtpjpegdepay ! jpegdec ! queue ! jp462bayer ! queue ! bayer2rgb2 method=0 ! ffmpegcolorspace name=elphelstream";
} else {
//TODO in this mode we dont see anything from the non-jpeg compliant stream so the jp46 filter wont help, but what else should we show?
rtspsource = "rtspsrc location=rtsp://" + Parent.Camera.GetIP()[0] + ":554 protocols=0x00000001 latency=50 ! rtpjpegdepay ! jpegdec ! queue ! jp462bayer ! queue ! bayer2rgb2 method=0 name=elphelstream";
}
//pipe = null;
pipe = Pipeline.launch(rtspsource);
videoComponent.setKeepAspect(true);
Element videosink = videoComponent.getElement();
pipe.add(videosink);
pipe.getElementByName("elphelstream").link(videosink);
//List<Element> sinks = pipe.getSinks();
//pipe.setClock(null);
//pipe.play();
//pipe.setState(State.PLAYING);
//pipe.play();*/
}
示例8: StreamingEncodingH263WebCam
import org.gstreamer.State; //导入依赖的package包/类
/**
* Emitirá el vide proveniente de la webcam codificandolo en H264
*/
private void StreamingEncodingH263WebCam() {
Gst.init("GStreamer", new String[0]);
final Pipeline pipe = Pipeline.launch("v4l2src name=v4l2src ! textoverlay name=textoverlay ! ffenc_h263 name=ffenc_h263 ! rtph263ppay name=rtph263ppay ! udpsink name=udpsinkVideo");
ref_pipeline = pipe;
pipe.getElementByName("v4l2src").set("device","/dev/video0");
pipe.getElementByName("textoverlay").set("text","EMISIÓN DESDE KMC SERVER");
pipe.getElementByName("ffenc_h263").set("gop-size","0");
pipe.getElementByName("udpsinkVideo").set("host", getIpMC());
pipe.getElementByName("udpsinkVideo").set("port", getPortVideo());
pipe.getElementByName("udpsinkVideo").set("sync", "false");
pipe.getElementByName("udpsinkVideo").set("async", "false");
final Thread t = new Thread(
new Runnable()
{
public void run()
{
pipe.setState(State.PLAYING);
Gst.main();
pipe.setState(State.NULL);
}
});
t.start();
ref_thread=t;
}
示例9: StreamingEncodingH263Screenshot
import org.gstreamer.State; //导入依赖的package包/类
private void StreamingEncodingH263Screenshot() {
Gst.init("GStreamer", new String[0]);
final Pipeline pipe = Pipeline.launch("ximagesrc name=ximagesrc ! autovideoconvert ! ffenc_h263 name=ffenc_h263 ! video/x-h263, width=704, height=576, framerate=25/1 ! rtph263ppay name=rtph263ppay ! udpsink name=udpsinkVideo");
ref_pipeline = pipe;
pipe.getElementByName("ximagesrc").set("show-pointer",false);
pipe.getElementByName("ffenc_h263").set("gop-size",0);
pipe.getElementByName("udpsinkVideo").set("host", getIpMC());
pipe.getElementByName("udpsinkVideo").set("port", getPortVideo());
pipe.getElementByName("udpsinkVideo").set("sync", "false");
pipe.getElementByName("udpsinkVideo").set("async", "false");
final Thread t = new Thread(
new Runnable()
{
public void run()
{
pipe.setState(State.PLAYING);
Gst.main();
pipe.setState(State.NULL);
}
});
t.start();
ref_thread=t;
}
示例10: StopStreaming
import org.gstreamer.State; //导入依赖的package包/类
/**
* Para el streaming
*/
public void StopStreaming() {
try {
sendTeardown();
ref_pipeline.setState(State.NULL);
ref_thread.interrupt();
}catch(Exception e){}
}
示例11: PlaySdp
import org.gstreamer.State; //导入依赖的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);
}
示例12: StopVideoStream
import org.gstreamer.State; //导入依赖的package包/类
public void StopVideoStream() {
Parent.WriteLogtoConsole("Stopping Gstreamer Video Player");
pipe.setState(State.READY);
//debugGST();
Element videosink = videoComponent.getElement();
videoComponent.repaint();
pipe.getElementByName("elphelstream").unlink(videosink);
pipe.remove(videosink);
//debugGST();
pipe.setState(State.NULL);
//debugGST();
List<Element> elements = pipe.getElementsRecursive();
for (int i = 0; i < elements.size(); i++) {
pipe.unlink(elements.get(i));
pipe.remove(elements.get(i));
elements.get(i).dispose();
}
List<Element> sources = pipe.getSources();
for (int i = 0; i < sources.size(); i++) {
pipe.unlink(sources.get(i));
pipe.remove(sources.get(i));
sources.get(i).dispose();
}
//debugGST();
pipe = null;
//debugGST();
}
示例13: getOldState
import org.gstreamer.State; //导入依赖的package包/类
/**
* Gets the previous state.
*
* @return the previous state.
*/
public State getOldState() {
State[] state = new State[1];
gst.gst_message_parse_state_changed(this, state, null, null);
return state[0];
}
示例14: getNewState
import org.gstreamer.State; //导入依赖的package包/类
/**
* Gets the new (current) state.
*
* @return the new state.
*/
public State getNewState() {
State[] state = new State[1];
gst.gst_message_parse_state_changed(this, null, state, null);
return state[0];
}
示例15: getPendingState
import org.gstreamer.State; //导入依赖的package包/类
/**
* Gets the pending (target) state.
*
* @return the pending state.
*/
public State getPendingState() {
State[] state = new State[1];
gst.gst_message_parse_state_changed(this, null, null, state);
return state[0];
}