Vous ne trouvez pas de réponse à votre problème ? Alors posez la question dans le forum. Souvenez-vous qu'il n'y a jamais de question bête, mais rester dans l'ignorance parce que l'on n'ose pas poser une question, ça c'est une erreur !

WEBCAM HTTP SERVEUR LIVE SANS JMF


Information sur la source



Description

Serveur HTTP pour window capturant à interval régulier les frames provenant d'une webcam via la librairie webcamlib.

Pour accéder à la page web votre webcam il vous suffit de double cliquer sur le jar et de taper dans votre navigateur "http://localhost/".

La page index.html permet de recharger à interval régulier la source de l'image(/webcam) en javascript ( testé sous IE/Firefox/Opéra).

Si l'url de la ressource demandée est "/webcam" le serveur retourne une image au format jpeg, sinon recherche des fichiers dans le répertoire "public_html".

NB: Pour accéder à la webcam depuis internet il vous suffit de remplacer localhost par l'adresse IP du serveur à condition que vous ayez bien redirigé le port 80 vers votre serveur sur votre box adsl.

Have fun,
Pierrick
 

Source

  • /**
  • * HTTP Webcam Server Version 1.0
  • * (c) 2008 Pierrick HYMBERT <pierrick.hymbert@gmail.com>
  • * This library is "PROVIDED AS IS" without guaranty of any kinds.
  • * Freely distribuable under the terms of an MIT-style license.
  • * Visit www.hypik.fr
  • */
  • package org.hypik.webcamlib.test.server;
  • import java.awt.image.BufferedImage;
  • import java.awt.image.ColorModel;
  • import java.awt.image.DirectColorModel;
  • import java.awt.image.WritableRaster;
  • import java.io.ByteArrayOutputStream;
  • import org.apache.log4j.Logger;
  • import org.hypik.webcamlib.codecs.Codec;
  • import org.hypik.webcamlib.codecs.Codecs;
  • import org.hypik.webcamlib.compressor.CompressionException;
  • import org.hypik.webcamlib.compressor.DecompressVideo;
  • import org.hypik.webcamlib.compressor.jna.ICM;
  • import org.hypik.webcamlib.device.Device;
  • import org.hypik.webcamlib.device.listener.DeviceErrorListener;
  • import org.hypik.webcamlib.device.listener.DeviceFrameListener;
  • import org.hypik.webcamlib.device.listener.DeviceStatusListener;
  • import org.hypik.webcamlib.jna.User32.BitmapInfoHeader;
  • import org.hypik.webcamlib.jna.User32.VideoHDR;
  • import com.sun.image.codec.jpeg.JPEGCodec;
  • import com.sun.image.codec.jpeg.JPEGEncodeParam;
  • import com.sun.image.codec.jpeg.JPEGImageEncoder;
  • import com.sun.jna.Memory;
  • /**
  • * This class manage the webcam capture in a thread.
  • * After configure decompression video driver and webcam device.
  • * Instance can grab frame every rate seconds and decompress it.
  • * Frame data can be get back as RGB or Jpeg formats.
  • * @author Pierrick Hymbert <a href="mailto:pierrick.hymbert@gmail.com">Contact</a>
  • *
  • */
  • public class WebcamCapture extends Thread {
  • /**
  • * The class logger.
  • */
  • private Logger logger = Logger.getLogger(WebcamCapture.class);
  • /**
  • * The webcam device.
  • */
  • private Device device;
  • /**
  • * Time between each frame.
  • */
  • private int rate;
  • /**
  • * Indicates if we must continue capturing frame.
  • */
  • private boolean capture = false;
  • /**
  • * Indicate that all is configured.
  • */
  • private boolean available = false;
  • /**
  • * The video driver decompression.
  • */
  • private DecompressVideo decompressVideo;
  • /**
  • * The decompressed data.
  • */
  • private Memory decompressedData;
  • /**
  • * The output frame format.
  • */
  • private BitmapInfoHeader bitmapInfoOutput;
  • /**
  • * Build a webcam capture.
  • * @param device The webcam
  • * @param rate The refresh rate.
  • */
  • public WebcamCapture(Device device, int rate){
  • super("WCCapture #" + device.getIndex());
  • this.device = device;
  • this.rate = rate;
  • }
  • /**
  • * Ask the thread to stop the capture.
  • */
  • public void stopCapture() {
  • this.capture = false;
  • }
  • /**
  • * Start the thread.
  • */
  • public void startCapture() {
  • this.capture = true;
  • this.start();
  • }
  • /**
  • * Run webcam capture until stopCapture is called.
  • */
  • public void run() {
  • try{
  • // Configure device and decompressor
  • logger.debug("Configuring webcam device...");
  • configureDevice();
  • logger.debug("Configuring frame decompressor...");
  • configureDecompressor();
  • logger.info("Webcam capture started.");
  • }catch( Exception e ){
  • logger.error(e);
  • capture = false;
  • }
  • available = true;
  • // Caputre loop
  • while( capture ){
  • // Sometimes call back functions are disabled.
  • device.forceCallBacks();
  • device.grabFrame();
  • try{
  • Thread.sleep(rate);
  • }catch (Exception e) {
  • logger.error(e);
  • capture = false;
  • }
  • }
  • logger.debug("Disconnecting webcam device...");
  • // Destroy window and disconnect
  • device.stop();
  • if( decompressVideo != null ){
  • try{
  • if( decompressVideo.isOpened() ){
  • logger.debug("Free decompression resources...");
  • decompressVideo.freeResources();
  • }
  • }catch (CompressionException e) {
  • logger.error(e);
  • }finally{
  • try{
  • if( decompressVideo.isOpened() ){
  • logger.debug("Closing decompression driver...");
  • decompressVideo.close();
  • }
  • }catch (CompressionException e) {
  • logger.error(e);
  • }
  • }
  • }
  • logger.info("Webcam capture stopped.");
  • }
  • /**
  • * Configure the device.
  • * @throws Exception
  • */
  • private void configureDevice() throws Exception {
  • //Create the capture window
  • device.createCaptureWindow("Webcam device", 640, 480, 0, 0);
  • if( !device.isCaptureWindowCreated() )
  • throw new Exception("Unable to create webcam capture window!");
  • // Add listeners
  • device.addDeviceErrorListener( errorListener );
  • device.addDeviceStatusListener( statusListener );
  • device.addDeviceFrameListener( frameListener );
  • // Connect the window to device driver
  • device.connect();
  • if( !device.isConnected() )
  • throw new Exception("Unable to connect webcam capture window to the webcam driver!");
  • logger.debug("Webcam device is now connected to the webcam window. Do not close this program before calling stopCapture. Otherwise you can cause damage to your video device.");
  • device.setScale(false);
  • device.setPreview(false);
  • device.setPreviewRate(rate);
  • }
  • /**
  • * Configure the decompressor
  • * @throws CompressionException If no compressor found.
  • */
  • private void configureDecompressor() throws CompressionException {
  • // Get back device bit map info input
  • BitmapInfoHeader bitmapInfoInput = device.getBitMapInfo().bmiHeader;
  • // Build the output format
  • bitmapInfoOutput = new BitmapInfoHeader();
  • bitmapInfoOutput.biBitCount = 24;
  • bitmapInfoOutput.biCompression = BitmapInfoHeader.BI_RGB;
  • bitmapInfoOutput.biHeight = bitmapInfoInput.biHeight;
  • bitmapInfoOutput.biWidth = bitmapInfoInput.biWidth;
  • bitmapInfoOutput.biSizeImage = bitmapInfoInput.biSizeImage = 0;
  • bitmapInfoOutput.biSize = bitmapInfoInput.biSize = bitmapInfoInput.size();
  • bitmapInfoOutput.biPlanes = bitmapInfoInput.biPlanes = 1;
  • bitmapInfoOutput.biXPelsPerMeter = bitmapInfoOutput.biYPelsPerMeter = bitmapInfoInput.biXPelsPerMeter = bitmapInfoInput.biYPelsPerMeter = 0;
  • bitmapInfoOutput.biClrUsed = bitmapInfoOutput.biClrImportant = bitmapInfoInput.biClrUsed = bitmapInfoInput.biClrImportant = 256;
  • Codec codecInput = Codecs.getCodec(bitmapInfoInput.biCompression);
  • if (codecInput != null){
  • logger.info("Device input codec is " + codecInput.getFourCCString() + ": " + codecInput.getLongName());
  • }
  • Codec codecOutput = Codecs.getCodec(bitmapInfoOutput.biCompression);
  • if (codecOutput != null){
  • logger.info("Device output codec is " + codecOutput.getFourCCString() + ": " + codecOutput.getLongName());
  • }
  • // Find a decompressor from the input format to the output
  • decompressVideo = DecompressVideo.findDecompressorVideo(bitmapInfoInput, bitmapInfoOutput);
  • //Check if a decompressor was found
  • if( decompressVideo == null ){
  • throw new CompressionException("No decompressor found from this input codec to this output.", ICM.ICERR_BADFORMAT);
  • }
  • // Allocate decompressed data buffer
  • decompressedData = new Memory(3
  • * bitmapInfoOutput.biHeight * bitmapInfoOutput.biWidth);
  • // Opening decompression driver
  • decompressVideo.open();
  • // Begin decompression
  • decompressVideo.begin(bitmapInfoInput, bitmapInfoOutput);
  • }
  • /**
  • * Read decompressed datas in memory.
  • * Warning NO Thread safe.
  • * @return The decompressed data.
  • */
  • private byte[] getDatas(){
  • return decompressedData.getByteArray(0, (int) decompressedData.getSize());
  • }
  • /**
  • * A buffered image of the decompressed data.
  • * @return The decompressed image.
  • */
  • public BufferedImage getBufferedImage(){
  • BufferedImage image = null;
  • synchronized (decompressedData) {
  • byte[] data = getDatas();
  • image = convertToAWT(data, bitmapInfoOutput.biWidth, bitmapInfoOutput.biHeight );
  • }
  • return image;
  • }
  • /**
  • * Get a JPG image of the decompressed datas as byte array.
  • * @param imageQuality The image quality.
  • * @return Byte array of the JPG image data.
  • */
  • public byte[] getJpgBuffer( float imageQuality ){
  • BufferedImage bufferImage = getBufferedImage();
  • ByteArrayOutputStream outputArray = new ByteArrayOutputStream();
  • JPEGImageEncoder jpegEncoder = JPEGCodec.createJPEGEncoder(outputArray);
  • JPEGEncodeParam jpegParam = jpegEncoder.getDefaultJPEGEncodeParam(bufferImage);
  • jpegParam.setQuality(imageQuality, false);
  • jpegEncoder.setJPEGEncodeParam(jpegParam);
  • try
  • {
  • jpegEncoder.encode(bufferImage);
  • outputArray.close();
  • } catch (java.io.IOException IOEx) {IOEx.printStackTrace();}
  • return outputArray.toByteArray();
  • }
  • /**
  • * Converts a byte data image to a AWT
  • * <code>BufferedImage</code>.
  • * @param data The byte data array to be converted.
  • * @return The AWT image version.
  • */
  • private BufferedImage convertToAWT(byte[] data, int width, int height) {
  • ColorModel colorModel = null;
  • colorModel = new DirectColorModel(24, 0xFF, 0xFF00, 0xFF0000);
  • BufferedImage bufferedImage = new BufferedImage(colorModel,
  • colorModel.createCompatibleWritableRaster(width,height), false, null);
  • WritableRaster raster = bufferedImage.getRaster();
  • int[] pixelArray = new int[3];
  • for (int y = 0; y < height; y++) {
  • for (int x = 0; x < width * 3; x+=3) {
  • pixelArray[0] = data[ ( height - y - 1) * width * 3 + x + 2 ];
  • pixelArray[1] = data[ ( height - y - 1) * width * 3 + x + 1 ];
  • pixelArray[2] = data[ ( height - y - 1) * width * 3 + x];
  • raster.setPixel(x / 3, y, pixelArray);
  • }
  • }
  • return bufferedImage;
  • }
  • private DeviceErrorListener errorListener = new DeviceErrorListener(){
  • /**
  • * Fire the listener that the device throws an error message.
  • *
  • * @param device
  • * The device in error state.
  • * @param errorId
  • * The error id is one of the constants below.
  • * @param errorMessage
  • * The error message.
  • */
  • public void deviceError(Device device, int errorId, String errorMessage){
  • logger.error(device + "=>" + errorId + ":" + errorMessage);
  • }
  • };
  • private DeviceStatusListener statusListener = new DeviceStatusListener(){
  • /**
  • * Fire the listener that the device fire a status message.
  • *
  • * @param device
  • * The device.
  • * @param statusId
  • * The status id is one of the constants below.
  • * @param statusMessage
  • * The status message.
  • */
  • public void deviceStatus(Device device, int statusId, String statusMessage){
  • logger.info(device + "=>" + statusId + ":" + statusMessage);
  • }
  • };
  • private DeviceFrameListener frameListener = new DeviceFrameListener(){
  • /**
  • *
  • * @param device The device
  • * @param videoHDR The video header
  • * @param data The frame data.
  • */
  • public void frame(Device device, VideoHDR videoHDR, Memory data){
  • try{
  • synchronized (decompressedData) {
  • //Decompress data
  • decompressVideo.decompress(ICM.ICDECOMPRESS_HURRYUP,
  • data, decompressedData);
  • }
  • }catch (CompressionException e) {
  • logger.error(e);
  • // Stop the capture
  • capture = false;
  • }
  • }
  • };
  • /**
  • * Check if the webcam capture continue.
  • * @return True if capture frame processing, false otherwise.
  • */
  • public boolean isCapture() {
  • return capture;
  • }
  • /**
  • * Check if all is ok.
  • * @return True if both device and decompressor are set.
  • */
  • public boolean isAvailable() {
  • return available;
  • }
  • }
/**
 * HTTP Webcam Server Version 1.0
 * (c) 2008 Pierrick HYMBERT <pierrick.hymbert@gmail.com>	
 * This library is "PROVIDED AS IS" without guaranty of any kinds.
 * Freely distribuable under the terms of an MIT-style license.
 * Visit www.hypik.fr
 */
package org.hypik.webcamlib.test.server;

import java.awt.image.BufferedImage;
import java.awt.image.ColorModel;
import java.awt.image.DirectColorModel;
import java.awt.image.WritableRaster;
import java.io.ByteArrayOutputStream;

import org.apache.log4j.Logger;
import org.hypik.webcamlib.codecs.Codec;
import org.hypik.webcamlib.codecs.Codecs;
import org.hypik.webcamlib.compressor.CompressionException;
import org.hypik.webcamlib.compressor.DecompressVideo;
import org.hypik.webcamlib.compressor.jna.ICM;
import org.hypik.webcamlib.device.Device;
import org.hypik.webcamlib.device.listener.DeviceErrorListener;
import org.hypik.webcamlib.device.listener.DeviceFrameListener;
import org.hypik.webcamlib.device.listener.DeviceStatusListener;
import org.hypik.webcamlib.jna.User32.BitmapInfoHeader;
import org.hypik.webcamlib.jna.User32.VideoHDR;

import com.sun.image.codec.jpeg.JPEGCodec;
import com.sun.image.codec.jpeg.JPEGEncodeParam;
import com.sun.image.codec.jpeg.JPEGImageEncoder;
import com.sun.jna.Memory;
/**
 * This class manage the webcam capture in a thread.
 * After configure decompression video driver and webcam device.
 * Instance can grab frame every rate seconds and decompress it.
 * Frame data can be get back as RGB or Jpeg formats.
 * @author Pierrick Hymbert <a href="mailto:pierrick.hymbert@gmail.com">Contact</a>
 *
 */
public class WebcamCapture extends Thread {
	/**
	 * The class logger.
	 */
	private Logger logger = Logger.getLogger(WebcamCapture.class);
	/**
	 * The webcam device.
	 */
	private Device device;
	/**
	 * Time between each frame.
	 */
	private int rate;
	/**
	 * Indicates if we must continue capturing frame.
	 */
	private boolean capture = false;
	/**
	 * Indicate that all is configured.
	 */
	private boolean available = false;
	/**
	 * The video driver decompression.
	 */
	private DecompressVideo decompressVideo;
	/**
	 * The decompressed data.
	 */
	private Memory decompressedData;
	/**
	 * The output frame format.
	 */
	private BitmapInfoHeader bitmapInfoOutput;
	/**
	 * Build a webcam capture.
	 * @param device The webcam
	 * @param rate The refresh rate.
	 */
	public WebcamCapture(Device device, int rate){
		super("WCCapture #" + device.getIndex());
		this.device = device;
		this.rate = rate;
	}
	/**
	 * Ask the thread to stop the capture.
	 */
	public void stopCapture() {
		this.capture = false;
	}
	/**
	 * Start the thread.
	 */
	public void startCapture() {
		this.capture = true;
		this.start();
	}
	/**
	 * Run webcam capture until stopCapture is called.
	 */
	public void run() {
		try{
			// Configure device and decompressor
			logger.debug("Configuring webcam device...");
			configureDevice();
			logger.debug("Configuring frame decompressor...");
			configureDecompressor();
			logger.info("Webcam capture started.");
		}catch( Exception e ){
			logger.error(e);
			capture = false;
		}
		available = true;
		// Caputre loop
		while( capture ){
			// Sometimes call back functions are disabled.
			device.forceCallBacks();
			device.grabFrame();
			try{
				Thread.sleep(rate);
			}catch (Exception e) {
				logger.error(e);
				capture = false;
			}
		}
		logger.debug("Disconnecting webcam device...");
		// Destroy window and disconnect
		device.stop();
		if( decompressVideo != null ){
			try{
				if( decompressVideo.isOpened() ){
					logger.debug("Free decompression resources...");
					decompressVideo.freeResources();
				}
			}catch (CompressionException e) {
				logger.error(e);
			}finally{
				try{
					if( decompressVideo.isOpened() ){
						logger.debug("Closing decompression driver...");
						decompressVideo.close();
					}
				}catch (CompressionException e) {
					logger.error(e);
				}
			}
		}
		logger.info("Webcam capture stopped.");
	}
	/**
	 * Configure the device.
	 * @throws Exception 
	 */
	private void configureDevice() throws Exception {
		//Create the capture window
		device.createCaptureWindow("Webcam device", 640, 480, 0, 0);
		if( !device.isCaptureWindowCreated() )
			throw new Exception("Unable to create webcam capture window!");
		
		// Add listeners
		device.addDeviceErrorListener( errorListener );
		device.addDeviceStatusListener( statusListener );
		device.addDeviceFrameListener( frameListener );
		
		// Connect the window to device driver
		device.connect();
		if( !device.isConnected() )
			throw new Exception("Unable to connect webcam capture window to the webcam driver!");
		logger.debug("Webcam device is now connected to the webcam window. Do not close this program before calling stopCapture. Otherwise you can cause damage to your video device.");
		
		device.setScale(false);
		device.setPreview(false);
		device.setPreviewRate(rate);
	}
	/**
	 * Configure the decompressor
	 * @throws CompressionException If no compressor found.
	 */
	private void configureDecompressor() throws CompressionException {
		// Get back device bit map info input
		BitmapInfoHeader bitmapInfoInput = device.getBitMapInfo().bmiHeader;
		
		// Build the output format
		bitmapInfoOutput = new BitmapInfoHeader();
		bitmapInfoOutput.biBitCount = 24;
		bitmapInfoOutput.biCompression = BitmapInfoHeader.BI_RGB;
		bitmapInfoOutput.biHeight = bitmapInfoInput.biHeight;
		bitmapInfoOutput.biWidth = bitmapInfoInput.biWidth;
		bitmapInfoOutput.biSizeImage = bitmapInfoInput.biSizeImage = 0;
		bitmapInfoOutput.biSize = bitmapInfoInput.biSize = bitmapInfoInput.size();
		bitmapInfoOutput.biPlanes = bitmapInfoInput.biPlanes = 1;
		bitmapInfoOutput.biXPelsPerMeter = bitmapInfoOutput.biYPelsPerMeter = bitmapInfoInput.biXPelsPerMeter = bitmapInfoInput.biYPelsPerMeter = 0;
		bitmapInfoOutput.biClrUsed = bitmapInfoOutput.biClrImportant = bitmapInfoInput.biClrUsed = bitmapInfoInput.biClrImportant = 256;

		Codec codecInput = Codecs.getCodec(bitmapInfoInput.biCompression);
		if (codecInput != null){
			logger.info("Device input codec is " + codecInput.getFourCCString() + ": " + codecInput.getLongName());
		}
		Codec codecOutput = Codecs.getCodec(bitmapInfoOutput.biCompression);
		if (codecOutput != null){
			logger.info("Device output codec is " + codecOutput.getFourCCString() + ": " + codecOutput.getLongName());
		}
		// Find a decompressor from the input format to the output
		decompressVideo = DecompressVideo.findDecompressorVideo(bitmapInfoInput, bitmapInfoOutput);
		
		//Check if a decompressor was found
		if( decompressVideo == null ){
			throw new CompressionException("No decompressor found from this input codec to this output.", ICM.ICERR_BADFORMAT);
		}
		
		// Allocate decompressed data buffer
		decompressedData = new Memory(3
				* bitmapInfoOutput.biHeight * bitmapInfoOutput.biWidth);
		
		// Opening decompression driver
		decompressVideo.open();
		
		// Begin decompression
		decompressVideo.begin(bitmapInfoInput, bitmapInfoOutput);
	}
	/**
	 * Read decompressed datas in memory.
	 * Warning NO Thread safe.
	 * @return The decompressed data.
	 */
	private byte[] getDatas(){
		return decompressedData.getByteArray(0, (int) decompressedData.getSize());
	}
	/**
	 * A buffered image of the decompressed data.
	 * @return The decompressed image.
	 */
	public BufferedImage getBufferedImage(){
		BufferedImage image = null;
		synchronized (decompressedData) {
			byte[] data = getDatas();
			image = convertToAWT(data, bitmapInfoOutput.biWidth, bitmapInfoOutput.biHeight );
		}		
		return image;
	}

	/**
	 * Get a JPG image of the decompressed datas as byte array.
	 * @param imageQuality The image quality.
	 * @return Byte array of the JPG image data.
	 */
	public byte[] getJpgBuffer( float imageQuality ){
		BufferedImage bufferImage = getBufferedImage();
		ByteArrayOutputStream outputArray = new ByteArrayOutputStream();

        JPEGImageEncoder jpegEncoder = JPEGCodec.createJPEGEncoder(outputArray);
        JPEGEncodeParam jpegParam = jpegEncoder.getDefaultJPEGEncodeParam(bufferImage);
        jpegParam.setQuality(imageQuality, false);
        jpegEncoder.setJPEGEncodeParam(jpegParam);
        try
        {
            jpegEncoder.encode(bufferImage);
            outputArray.close();
        } catch (java.io.IOException IOEx) {IOEx.printStackTrace();}

        return outputArray.toByteArray();
	}
	
	/**
	 * Converts a byte data image to a AWT 
	 * <code>BufferedImage</code>.
	 * @param data The byte data array to be converted.
	 * @return The AWT image version.
	 */
	 private BufferedImage convertToAWT(byte[] data, int width, int height) {
	    ColorModel colorModel = null;
	      colorModel = new DirectColorModel(24, 0xFF, 0xFF00, 0xFF0000);
	      BufferedImage bufferedImage = new BufferedImage(colorModel,
	          colorModel.createCompatibleWritableRaster(width,height), false, null);
	      WritableRaster raster = bufferedImage.getRaster();
	      int[] pixelArray = new int[3];
	      for (int y = 0; y < height; y++) {
	        for (int x = 0; x < width * 3; x+=3) {
	          pixelArray[0] = data[ ( height - y - 1) * width * 3 + x + 2 ];
	          pixelArray[1] = data[ ( height - y - 1) * width * 3 + x + 1 ];
	          pixelArray[2] = data[ ( height - y - 1) * width * 3 + x];
	          raster.setPixel(x / 3, y, pixelArray);
	        }
	      }
	      return bufferedImage;
	  }
	private DeviceErrorListener errorListener = new DeviceErrorListener(){
		/**
		 * Fire the listener that the device throws an error message.
		 * 
		 * @param device
		 *            The device in error state.
		 * @param errorId
		 *            The error id is one of the constants below.
		 * @param errorMessage
		 *            The error message.
		 */
		public void deviceError(Device device, int errorId, String errorMessage){
			logger.error(device + "=>" + errorId + ":" + errorMessage);
		}
	};
	private DeviceStatusListener statusListener = new DeviceStatusListener(){
		/**
		 * Fire the listener that the device fire a status message.
		 * 
		 * @param device
		 *            The device.
		 * @param statusId
		 *            The status id is one of the constants below.
		 * @param statusMessage
		 *            The status message.
		 */
		public void deviceStatus(Device device, int statusId, String statusMessage){
			logger.info(device + "=>" + statusId + ":" + statusMessage);
		}
			
	};
	private DeviceFrameListener frameListener = new DeviceFrameListener(){
		/**
		 * 
		 * @param device The device
		 * @param videoHDR The video header
		 * @param data The frame data.
		 */
		public void frame(Device device, VideoHDR videoHDR, Memory data){
			try{
				synchronized (decompressedData) {
					//Decompress data
					decompressVideo.decompress(ICM.ICDECOMPRESS_HURRYUP,
							data, decompressedData);
				}
			}catch (CompressionException e) {
				logger.error(e);
				// Stop the capture
				capture = false;
			}
		}
	};
	/**
	 * Check if the webcam capture continue.
	 * @return True if capture frame processing, false otherwise.
	 */
	public boolean isCapture() {
		return capture;
	}
	/**
	 * Check if all is ok.
	 * @return True if both device and decompressor are set.
	 */
	public boolean isAvailable() {
		return available;
	}
}

Conclusion

Si cette source s'avère utilisée je me pencherai sur une manière de sécuriser l'accès à la webcam par mot de passe.
 

Fichier Zip

Pour les "Membres Club", vous pouvez télécharger directement un fichier contenu dans le zip sans télécharger le zip en entier !

Télécharger le zip

Commentaires et avis

signaler à un administrateur
Commentaire de souabni_yassine le 01/04/2008 15:05:10

Bonjour, dois-je comprendre que le client
n'est pas obligé d'avoir la JVM installée?

signaler à un administrateur
Commentaire de the_wwt le 01/04/2008 15:23:23

Bonjour,
non tu as mal compris. Sans JMF pas sans JVM... Sans JVM pas de java!
Cordialement,
Pierrick HYMBERT

signaler à un administrateur
Commentaire de Benewende le 21/06/2009 14:54:35

salut WWT j' ai pa bien compri le code,je voudrai savoir comment tu upload les images sur le serveur?

Ajouter un commentaire

Discussions en rapport avec ce code source dans le forum

serveur http webcam " clé en main"... [ par eric35 ] Salut à tous Bon je suis un petit nouveau et pas très bon en programmation .... d 'où mes questions un poil simplettes sur ce site !j 'ai développé un Affichage d'une webcam IP [ par stage3 ] bonjour, j'ai un probleme avec un projet, je m'explique, je dois afficher le flux d'une camera trendnet ip100 dans mon application (et non dans une pa http et udp?? [ par Disizme ] Slt,j'ai un sérieux doute. Je suis en train d'implémenter un serveur qui traite des requêtes http qu'il reçoit par des sockets et je me demandais si j J2ME - serveur HTTP [ par bsophia ] Bonjour tout le monde, J'ai un expos&#233; sur comment rendre une application j2me telechargeable, sur un vrai mobile? Comment l'installer sur un serv Proxy HTTP [ par junior31490 ] Bonjour,Je vous écris parce que j'ai vraiment besopin d'aide.Voilà, je dois développer un petit proxy tout simple, permettant de récupérer une requête creation d'un client php et serveur http en java [ par minamak ] slt tous le monde, bein moi je suis débutante en progrmmation sockets et application reseau en general , et mon problème est que je veux réaliser une serveur virtuel avec oracle http server [ par krikete ] slt a tous;je suis entrain de faire une application web avec jdevloper 10g et comme serveur d'application OC4j je souhaterais créé un serveur virtuel JAR et Serveur Web [ par GRenard ] Bonjour,Je voudrais savoir s'il y avait un moyen de d&#233;sactiver l'option que lorsqu'une classe n'existe pas dans le .jar (charg&#233;e par exemple Sécuriser http sans https [ par pon93220 ] salutje suis en gal&#232;re. je suis en stage et mon boss veut que jes&#233;curise une connexion http sans utilis&#233; https.comment peut on faire ?a


Nos sponsors

Sondage...

CalendriCode

Juillet 2009
LMMJVSD
  12345
6789101112
13141516171819
20212223242526
2728293031  

Consulter la suite du CalendriCode

Comparez les prix Nouvelle version

Photothèque Nouveau !



Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés
Temps d'éxécution de la page : 0,406 sec

Google Coop CodeS-SourceS Google Coop CodeS-SourceS


Certaines images présentes sur le site (notament certains avatars) sont issues des collections IconShock, donc si vous souhaitez utiliser ces icons vous devez les acheter, ne les copiez pas et ne utilisez pas dans vos sites et applications sans les avoir commandé.