pipeline = new Pipeline("pipeline");
System.out.println("Pipeline created");
System.out.flush();
System.out.println("Creating videotestsrc");
final Element fakesrc = ElementFactory.make("videotestsrc", "source");
System.out.println("Creating capsfilter");
final Element flt = ElementFactory.make("capsfilter", "flt");
System.out.println("Creating caps");
Caps fltcaps = new Caps("video/x-raw-yuv, width=" + width + ", height=" + height +
", bpp=32, depth=24, framerate=30/1");
System.out.println("Setting caps");
flt.setCaps(fltcaps);
final Element navtest = ElementFactory.make("navigationtest", "navtest");
SwingUtilities.invokeLater(new Runnable() {
public void run() {
System.out.println("Creating GstVideoComponent");
final VideoComponent videoComponent = new VideoComponent();
videoComponent.setPreferredSize(new Dimension(width, height));
JFrame frame = new JFrame("Swing Video Test");
frame.add(videoComponent, BorderLayout.CENTER);
//
// Propagate key events. This could be done with focus, but this
// test uses the same code as used in VideoPlayer.
//
frame.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent evt) {
for (KeyListener l : videoComponent.getKeyListeners()) {
l.keyPressed(evt);
}
}
@Override
public void keyReleased(KeyEvent evt) {
for (KeyListener l : videoComponent.getKeyListeners()) {
l.keyReleased(evt);
}
}
});
Element videosink = videoComponent.getElement();
System.out.println("Adding elements to pipeline");
pipeline.addMany(fakesrc, flt, navtest, videosink);
Element.linkMany(fakesrc, flt, navtest, videosink);
pipeline.play();