Package javax.media

Examples of javax.media.CaptureDeviceInfo


//    deviceComboBox.addItem("[None]");
//    deviceComboBoxMap.put(0, null);
   
    for ( int i = 0;  i < vectorDevices.size();  i++ )
    {
      CaptureDeviceInfo infoCaptureDevice = (CaptureDeviceInfo) vectorDevices.get(i);
      logger.fine("CaptureDeviceInfo: ");
      logger.fine(infoCaptureDevice.getName());
      logger.fine("" + infoCaptureDevice.getLocator());
      logger.fine("" + infoCaptureDevice.getFormats()[0]);

      deviceComboBox.addItem(infoCaptureDevice.getName());
      deviceComboBoxMap.put(new Integer(i), infoCaptureDevice.getLocator());
     
    }
  }
View Full Code Here


      {
        deviceId = getLocator().getRemainder();
      }
     
      // mgodehardt: fetch the human readable name of the video capture device
      CaptureDeviceInfo cdi = null;
     
      Vector deviceList = (Vector)CaptureDeviceManager.getDeviceList(null).clone();
      for (int i=0; i<deviceList.size(); i++)
      {
        cdi = (CaptureDeviceInfo)deviceList.elementAt(i);
        if ( cdi.getLocator().getRemainder().equalsIgnoreCase(deviceId) )
        {
          break;
        }
      }
     
      deviceName = "";
      if ( null != cdi )
      {
        deviceName = cdi.getName();
      }
     
      captureStream = system.openCaptureDeviceStream(deviceId);
      outputVideoFormat = convertCivilFormat(captureStream.getVideoFormat());
     
View Full Code Here

  // 1) I am using JMF to perform processing, and using the civil library for the capture devices.  If I set the video resolution too high (say 640x480 or more), sometimes it looks like the capturing is taking place, but nothing happens.  When I try to stop the sending, I get an error (Error: Unable to prefetch com.sun.media.ProcessEngine@1ea0252).  This does not happen if I use a vfw device at any resolution, so I think it is something to do with civil, possibly to do with an assumption about the maximum video size?  I will look into this myself to make sure that it is not something in JMF, but it would be good to know that there is not something going wrong in civil too.
  // It turns out that if you make the civil DataSource (net.sf.fmj.media.protocol.civil.DataSource) implement javax.media.protocol.CaptureDevice, then the problem goes away as JMF does not then do prefetching 
 
  public CaptureDeviceInfo getCaptureDeviceInfo()
  {
    return new CaptureDeviceInfo(deviceName, getLocator(), getFormatControls()[0].getSupportedFormats());
  }
View Full Code Here

    final Vector vTest = new Vector();

    assertCaptureDeviceInfoVectorEquals(vTest, CaptureDeviceManager.getDeviceList(null));
   
    final Format[] f1s = new Format[]{new RGBFormat()};
    assertNotEquals(new CaptureDeviceInfo("abc", null, new Format[]{}),
        new CaptureDeviceInfo("abc", null, new Format[]{}));
    assertNotEquals(new CaptureDeviceInfo("abc", null, f1s),
        new CaptureDeviceInfo("abc", null, f1s))// strange
   
    CaptureDeviceInfo i1 = new CaptureDeviceInfo("abc", null, f1s);
    assertNotEquals(i1, i1)// strange
   
   
   
    CaptureDeviceManager.addDevice(i1);
View Full Code Here

  {
    final Vector v = CaptureDeviceManager.getDeviceList(null);
    for (int i = 0; i < v.size(); ++i)
    {
      final Object o = v.get(i);
      final CaptureDeviceInfo captureDeviceInfo = (CaptureDeviceInfo) o;
      System.out.println("captureDeviceInfo: " + captureDeviceInfo.getName());
    }
  }
View Full Code Here

      return;
   
    assertEquals(v1.size(), v2.size());
    for (int j = 0; j < v1.size(); ++j)
    {
      final CaptureDeviceInfo s1 = (CaptureDeviceInfo) v1.get(j);
      final CaptureDeviceInfo s2 = (CaptureDeviceInfo) v2.get(j);
      assertTrue(s1 == s2);
      //assertEquals(s1, s2);
    }
  }
View Full Code Here

    assertEquals(new MediaLocator(":").toExternalForm(), ":");
     
  }
  public void testCaptureDeviceInfo()
  {
    assertFalse(new CaptureDeviceInfo().equals(new CaptureDeviceInfo()));
    assertFalse(new CaptureDeviceInfo("xyz", null, null).equals(
          new CaptureDeviceInfo("xyz", null, null)));
    assertFalse(new CaptureDeviceInfo("xyz", new MediaLocator("abc"), null).equals(
          new CaptureDeviceInfo("xyz", new MediaLocator("abc"), null)));
    assertFalse(new CaptureDeviceInfo("xyz", new MediaLocator("abc"), new Format[] {new RGBFormat()}).equals(
        new CaptureDeviceInfo("xyz", new MediaLocator("abc"), new Format[] {new RGBFormat()})));
   
    {
      MediaLocator m = new MediaLocator("abc");
      Format[] f = new Format[] {new RGBFormat()};
      assertTrue(new CaptureDeviceInfo("xyz", m, f).equals(
          new CaptureDeviceInfo("xyz", m, f)));
    }
   
    {
      MediaLocator m = new MediaLocator("abc");
      Format[] f1 = new Format[] {new RGBFormat()};
      Format[] f2 = new Format[] {new RGBFormat()};
      assertFalse(new CaptureDeviceInfo("xyz", m, f1).equals(
          new CaptureDeviceInfo("xyz", m, f2)));
    }
   
    {
      MediaLocator m = new MediaLocator("abc");
      RGBFormat r = new RGBFormat();
      Format[] f1 = new Format[] {r};
      Format[] f2 = new Format[] {r};
      assertFalse(new CaptureDeviceInfo("xyz", m, f1).equals(
          new CaptureDeviceInfo("xyz", m, f2)));
    }
    {
      MediaLocator m1 = new MediaLocator("abc");
      MediaLocator m2 = new MediaLocator("abc");
      Format[] f = new Format[] {new RGBFormat()};
      assertFalse(new CaptureDeviceInfo("xyz", m1, f).equals(
          new CaptureDeviceInfo("xyz", m2, f)));
    }
   
    {
      MediaLocator m = null;
      Format[] f = new Format[] {new RGBFormat()};
      assertFalse(new CaptureDeviceInfo("xyz", m, f).equals(
          new CaptureDeviceInfo("xyz", m, f)));
    }
   
    {
      MediaLocator m = new MediaLocator("abc");
      Format[] f = new Format[] {};
      assertTrue(new CaptureDeviceInfo("xyz", m, f).equals(
          new CaptureDeviceInfo("xyz", m, f)));
    }
    {
      MediaLocator m = new MediaLocator("abc");
      Format[] f = null;
      assertFalse(new CaptureDeviceInfo("xyz", m, f).equals(
          new CaptureDeviceInfo("xyz", m, f)));
    }
   
    {
      MediaLocator m = new MediaLocator("abc");
      Format[] f = new Format[] {new RGBFormat()};
      assertFalse(new CaptureDeviceInfo(null, m, f).equals(
          new CaptureDeviceInfo(null, m, f)));
    }
   
    {
      MediaLocator m = new MediaLocator("abc");
      Format[] f = new Format[] {new RGBFormat()};
      assertTrue(new CaptureDeviceInfo("", m, f).equals(
          new CaptureDeviceInfo("", m, f)));
    }
   
    {
      MediaLocator m = new MediaLocator("abc");
      Format[] f = new Format[] {new RGBFormat()};
      assertFalse(new CaptureDeviceInfo("", m, f).equals(
          "test"));
    }
   
    assertTrue(new CaptureDeviceInfo().getFormats() == null);
    assertEquals(new CaptureDeviceInfo().toString(), "null : null\n");
    if (false)
    {
      System.out.println(new CaptureDeviceInfo().toString())// null : null
      System.out.println(new CaptureDeviceInfo("xyz", null, null).toString())// xyz : null
      System.out.println(new CaptureDeviceInfo("xyz", new MediaLocator("abc"), null).toString())// xyz : abc
      System.out.println(new CaptureDeviceInfo("xyz", new MediaLocator("abc"), new Format[] {}).toString())// xyz : abc
      System.out.println(new CaptureDeviceInfo("xyz", new MediaLocator("abc"), new Format[] {new RGBFormat()}).toString())
      // xyz : abc
      //RGB, -1-bit, Masks=-1:-1:-1, PixelStride=-1, LineStride=-1
    }
   
  }
View Full Code Here

        final Element formatElement = (Element) formatElementsList.get(j);
        final Element serializedElement = formatElement.getChild(ELEMENT_DEVICE_FORMAT_SERIALIZED);
        formats[j] = SerializationUtils.deserialize(serializedElement.getTextTrim());
      }
     
      final CaptureDeviceInfo info = new CaptureDeviceInfo(deviceNameElement.getTextTrim(), new MediaLocator(deviceLocatorElement.getTextTrim()), formats);
      registryContents.captureDeviceInfoList.add(info);
     
    }
  }
View Full Code Here

  private Element getCaptureDeviceElement() throws IOException {
    final Element captureDeviceElement = new Element(ELEMENT_CAPTURE_DEVICES);
    final Iterator<CaptureDeviceInfo> iter = registryContents.captureDeviceInfoList.iterator();
    while (iter.hasNext()) {
      final CaptureDeviceInfo info = iter.next();
     
      if (info.getLocator() == null
        continue; // should never be null, only seems to be null due to some unit tests.
     
      final Element deviceElement = new Element(ELEMENT_DEVICE);
      {
        final Element deviceNameElement = new Element(ELEMENT_DEVICE_NAME);
        deviceNameElement.setText(info.getName());
        deviceElement.addContent(deviceNameElement);
      }
     
      {
        final Element e = new Element(ELEMENT_DEVICE_LOCATOR);
        e.setText(info.getLocator().toExternalForm());
        deviceElement.addContent(e);
      }
      {
        final javax.media.Format[] formats = info.getFormats();
        for (int i = 0; i < formats.length; ++i)
        {
          final Element formatElement = new Element(ELEMENT_DEVICE_FORMAT);
         
          {
View Full Code Here

      com.lti.civil.CaptureDeviceInfo civilInfo = (com.lti.civil.CaptureDeviceInfo) list.get(i);
     
      {
       
        //String name, MediaLocator locator, Format[] formats
        CaptureDeviceInfo jmfInfo = new CaptureDeviceInfo(civilInfo.getDescription(), new MediaLocator("civil:" + civilInfo.getDeviceID()), new Format[] {new RGBFormat()});
        CaptureDeviceManager.addDevice(jmfInfo);
      }
     
    }


    final java.util.Vector vectorDevices = CaptureDeviceManager.getDeviceList(null);
    if (vectorDevices == null)
    {
      System.out.println("CaptureDeviceManager.getDeviceList returned null");
      return;
    }
    if (vectorDevices.size() == 0)
    {
      System.out.println("CaptureDeviceManager.getDeviceList returned empty list");
      return;
    }

   
    for ( int i = 0;  i < vectorDevices.size();  i++ )
    {
      CaptureDeviceInfo infoCaptureDevice = (CaptureDeviceInfo) vectorDevices.elementAt ( i );
      System.out.println("CaptureDeviceInfo: ");
      System.out.println(infoCaptureDevice.getName());
      System.out.println(infoCaptureDevice.getLocator());
      System.out.println(infoCaptureDevice.getFormats()[0]);
     
      Player player;
      try
      {
       
        player = Manager.createRealizedPlayer(infoCaptureDevice.getLocator());
      } catch (Exception e)
      {  throw new CaptureException(e);
      }
          player.start();
     
View Full Code Here

TOP

Related Classes of javax.media.CaptureDeviceInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.