Implementing vlcj into a Java-aplication

This forum is about all development around libVLC.
ShiftCrew
New Cone
New Cone
Posts: 1
Joined: 14 Dec 2010 12:28

Implementing vlcj into a Java-aplication

Postby ShiftCrew » 14 Dec 2010 13:53

Hi Guys,

I study Computer Science and developed a Java-aplication to control a robot, additionally there is an radiocamera. The stream of the radiocamera should be shown as background. For this i had implement the vlc player by using vlcj libraries. It works with all webcams and the Webcam Simulator 6.3, but not with the tuner of the radiocam.
Maybe there is something wrong with the code of the tuner.
I post the complete code below.

Code: Select all

import javax.swing.UIManager; import java.awt.*; import java.awt.BorderLayout; import java.awt.Canvas; import java.awt.Frame; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import uk.co.caprica.vlcj.player.MediaPlayerFactory; import uk.co.caprica.vlcj.player.embedded.EmbeddedMediaPlayer; public class RoboControlStart { boolean packFrame = false; //construct the aplication public RoboControlStart() { RoboGUI frame = new RoboGUI(); frame.setSize(900, 800); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); frame.setLayout(new BorderLayout()); Canvas vs = new Canvas(); frame.add(vs, BorderLayout.CENTER); frame.setVisible(true); MediaPlayerFactory factory = new MediaPlayerFactory(new String[] {}); EmbeddedMediaPlayer mediaPlayer = factory.newMediaPlayer(null); mediaPlayer.setVideoSurface(vs); // String[] options = {":dshow-vdev=TridVid Capture :dshow-adev=none :dshow-size= :dshow-aspect-ratio=4\:3 :dshow-chroma= :dshow-fps=0 :no-dshow-config :no-dshow-tuner :dshow-tuner-channel=0 :dshow-tuner-country=0 :dshow-tuner-input=0 :dshow-video-input=1 :dshow-video-output=-1 :dshow-audio-input=-1 :dshow-audio-output=-1 :dshow-amtuner-mode=1 :dshow-audio-channels=0 :dshow-audio-samplerate=0 :dshow-audio-bitspersample=0 :dshow-caching=200"}; mediaPlayer.playMedia("dshow://", options); //Frames überprüfen, die voreingestellte Größe haben //Frames packen, die nutzbare bevorzugte Größeninformationen enthalten, z.B. aus ihrem Layout if (packFrame) { frame.pack(); } else { frame.validate(); } //Das Fenster zentrieren Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = frame.getSize(); if (frameSize.height > screenSize.height) { frameSize.height = screenSize.height; } if (frameSize.width > screenSize.width) { frameSize.width = screenSize.width; } frame.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); frame.setVisible(true); } //Main-Method public static void main(String[] args) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch(Exception e) { e.printStackTrace(); } new RoboControlStart(); } }
May you tell whats wrong.

Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 7 guests