From: <mar...@gm...> - 2007-10-01 15:57:11
|
I tried with your option but I didn't get anything, I also tried with the runThreaded but is always the same, there is no data ready. I don't know wh= y with the camera device (no compress) works fine if I'm using the same routine but the camera compress just read once. Thanks Marcela ---------- Forwarded message ---------- From: John Oliver <joh...@gm...> Date: 01/10/2007 08:19 Subject: Re: [Java-player-users] Camera compress data never ready To: jav...@li... I think the problem is that you set PlayerClient to run not threaded, then after the initial client.readAll(); you then enter the infinate loop: while (!cami.isDataReady ()); and since there is no reading inside the loop to check for new data from player once this loop starts it will never end. I think something like: while (!cami.isDataReady ())client.readAll(); may work. thanks John Marcela G=F3mez wrote: > > Hello, > I'm having a strange problem with the data from the camera compress devic= e > (device index =3D 1), it is not ready, except for the first time it runs,= so > I > can only see one image in the application and after that the while loop > goes > forever. When I use the camera device it works fine, there is always data > ready, but I don't know how to show that kind of data as an image. > Sometimes when the program is in the while loop I get this message: > > 28/09/2007 01:15:41 PM javaclient2.PlayerClient read > WARNING: [PlayerClient]: Unknown message subtype received in read () > > I also know Player is working fine, I have probed it with playercam. So > here > is my code: > > import java.awt.*; > import java.awt.image.*; > import javax.swing.*; > import java.awt.Graphics; > import java.io.*; > import javax.imageio.*; > import javaclient2.CameraInterface; > import javaclient2.structures.camera.PlayerCameraData; > import javaclient2.PlayerClient; > import javaclient2.PlayerException; > import javaclient2.structures.PlayerConstants; > > > public class CameraJPEG extends JFrame{ > > PlayerClient client =3D null; > CameraInterface cami =3D null; > PlayerCameraData camera =3D null; > > BufferedImage image =3D null; > static byte[] img; > InputStream stream; > > > public CameraJPEG() { > > super("CameraJPEG"); > > Container container =3D getContentPane(); > container.setLayout(null); > container.setBackground (new Color(201, 199, 192)); > > setBounds(0,0,500,400); > setVisible(true); > > try{ > client =3D new PlayerClient("192.168.1.101 ", 6665); > cami =3D client.requestInterfaceCamera(1, > PlayerConstants.PLAYER_OPEN_MODE); > } > catch(PlayerException e) > { > e.printStackTrace(); > } > > client.setNotThreaded(); > camera =3D new PlayerCameraData(); > > try { > Thread.sleep (1000); > } > catch (Exception e) {} > > while (true) > { > repaint(); > client.requestDataDeliveryMode( > PlayerConstants.PLAYER_DATAMODE_PULL); > client.readAll(); > client.requestAddReplaceRule (-1, -1, > PlayerConstants.PLAYER_MSGTYPE_DATA, -1, 1); > client.readAll(); > while (!cami.isDataReady ()); > camera =3D cami.getData(); > img =3D camera.getImage(); > stream =3D new ByteArrayInputStream(img,0, camera.getImage_co= unt > ()); > > try{ > image =3D ImageIO.read(stream); > } > catch(Exception e) > { > e.printStackTrace(); > } > > try{ > stream.close(); > } > catch(IOException e) > { > e.printStackTrace(); > } > } > > } > > public void paint(Graphics g) > { > if (image !=3D null) > { > g.drawImage(image, 0, 0, null); > } > else > { > g.clearRect(0, 0, getWidth(), getHeight()); > g.drawString("Please Wait", 50, 100); > } > } > > public static void main(String[] args) > { > CameraJPEG aplication =3D new CameraJPEG(); > aplication.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); > > } > > } > > So, if anyone can help me i would really appreciate it. > Thanks. > Marcela > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Java-player-users mailing list > Jav...@li... > https://lists.sourceforge.net/lists/listinfo/java-player-users > > -- View this message in context: http://www.nabble.com/Camera-compress-data-never-ready-tf4536101.html#a1297= 8954 Sent from the java-player-users mailing list archive at Nabble.com. ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Java-player-users mailing list Jav...@li... https://lists.sourceforge.net/lists/listinfo/java-player-users --=20 +++++++++++++++++++++++++++++++++++++++ David Leonardo Acosta Molano M=F3vil 300 620 56 08 Cali - Colombia +++++++++++++++++++++++++++++++++++++++ |