Package javax.media

Examples of javax.media.CaptureDeviceInfo


    // jmf is a little buggy, if we use the same naming for audio as we use in video capture devices
    // we can access all targetdatalines, but we still support javasound:// or javsound://44100, this will
    // be the default capturing device, as specified by os system settings
    int mixerIndex = getMixerIndex();
    Mixer.Info[] mixerInfo = AudioSystem.getMixerInfo();
    return new CaptureDeviceInfo(mixerInfo[mixerIndex].getName(), getLocator(), getSupportedFormats());
  }
View Full Code Here


  public static synchronized CaptureDeviceInfo getDevice(String deviceName)
  { 
    final Vector v = getDeviceList();
    for (int i = 0; i < v.size(); ++i)
    {
      final CaptureDeviceInfo captureDeviceInfo = (CaptureDeviceInfo) v.get(i);
      if (captureDeviceInfo.getName().equals(deviceName))
        return captureDeviceInfo;
    }
    return null;
  }
View Full Code Here

 
    final Vector v = getDeviceList();
    final Vector result = new Vector();
    for (int i = 0; i < v.size(); ++i)
    {
      final CaptureDeviceInfo captureDeviceInfo = (CaptureDeviceInfo) v.get(i);
      if (format == null)
      {  result.add(captureDeviceInfo);
      }
      else
      {
        final Format[] formats = captureDeviceInfo.getFormats();
       
        for (int j = 0; j < formats.length; ++j)
        {
          if (format.matches(formats[j]))
          {
View Full Code Here

            // remove all capture devices
            Vector deviceList = (Vector)CaptureDeviceManager.getDeviceList(null).clone();
            for (int i=0; i<deviceList.size(); i++)
            {
                CaptureDeviceInfo cdi = (CaptureDeviceInfo)deviceList.elementAt(i);
                CaptureDeviceManager.removeDevice(cdi);
            }

            // update capture device list
            new net.sf.fmj.media.cdp.javasound.CaptureDevicePlugger().addCaptureDevices();
            PlugInManager.commit();

            deviceList = (Vector)CaptureDeviceManager.getDeviceList(null).clone();
            if ( (null == deviceList) || (deviceList.size() == 0) )
            {
                System.out.println("### ERROR found no audio capture device");
                System.exit(0);
            }

            // enumerate all codec
            Vector codecList = PlugInManager.getPlugInList(null, null, PlugInManager.CODEC);
            System.out.println("found " + codecList.size() + " codec");
            for (int i=0; i<codecList.size(); i++)
            {
                String aCodecClass = (String)codecList.elementAt(i);
                System.out.println("# " + (i + 1) + " " + aCodecClass);
            }

            // fetch first available audio capture device
            deviceList = (Vector)CaptureDeviceManager.getDeviceList(null).clone();
            CaptureDeviceInfo captureDeviceInfo = (CaptureDeviceInfo)deviceList.elementAt(0);
            System.out.println("### using " + captureDeviceInfo.getName());
            System.out.println("### locator " + captureDeviceInfo.getLocator());

            javax.media.protocol.DataSource dataSource = javax.media.Manager.createDataSource(new javax.media.MediaLocator(captureDeviceInfo.getLocator().toString()));
            //javax.media.protocol.DataSource dataSource = javax.media.Manager.createDataSource(new javax.media.MediaLocator("javasound://"));
            System.out.println("### created datasource " + dataSource.getClass().getName());

            javax.media.control.FormatControl[] formatControls = ((javax.media.protocol.CaptureDevice)dataSource).getFormatControls();
            System.out.println("got format control " + formatControls[0].getClass().getName());
View Full Code Here

            // remove all capture devices
            Vector deviceList = (Vector)CaptureDeviceManager.getDeviceList(null).clone();
            for (int i=0; i<deviceList.size(); i++)
            {
                CaptureDeviceInfo cdi = (CaptureDeviceInfo)deviceList.elementAt(i);
                CaptureDeviceManager.removeDevice(cdi);
            }

            // update capture device list
            new net.sf.fmj.media.cdp.civil.CaptureDevicePlugger().addCaptureDevices();
            PlugInManager.commit();

            deviceList = (Vector)CaptureDeviceManager.getDeviceList(null).clone();
            if ( (null == deviceList) || (deviceList.size() == 0) )
            {
                System.out.println("### ERROR found no video capture device");
                System.exit(0);
            }
           
            CaptureDeviceInfo captureDeviceInfo = (CaptureDeviceInfo)deviceList.elementAt(0);
            System.out.println("### using " + captureDeviceInfo.getName());
            System.out.println("### locator " + captureDeviceInfo.getLocator());

            javax.media.protocol.DataSource dataSource = javax.media.Manager.createDataSource(new javax.media.MediaLocator(captureDeviceInfo.getLocator().toString()));
            System.out.println("### created datasource " + dataSource.getClass().getName());

            // set the video capture format
            javax.media.control.FormatControl[] formatControls = ((javax.media.protocol.CaptureDevice)dataSource).getFormatControls();
            System.out.println("got format control " + formatControls[0].getClass().getName());
View Full Code Here

          PackageManager.setProtocolPrefixList(protocolList);
          getEntryListModel().removeElement(entry);
        }
        break;
      case TYPE_CAPTURE_DEVICE:
        CaptureDeviceInfo cdi = CaptureDeviceManager.getDevice(entry);
        getEntryListModel().removeElement(entry);
        CaptureDeviceManager.removeDevice(cdi);
        break;
      case TYPE_MIME_TYPES:
        // TODO: warn if attempt to remove "default" extensions.
View Full Code Here

       
      case TYPE_CAPTURE_DEVICE:
        list = new Vector();
        Vector captureDeviceList = CaptureDeviceManager.getDeviceList(null);
        for (int i = 0; i < captureDeviceList.size(); ++i)
        {  final CaptureDeviceInfo info = (CaptureDeviceInfo) captureDeviceList.get(i);
          list.add(info.getName());
        }
        setTitle("Capture Devices");
        break;
       
      case TYPE_MIME_TYPES:
View Full Code Here

       
      case TYPE_CAPTURE_DEVICE:
     
        try
        {
          CaptureDeviceInfo cdi = CaptureDeviceManager.getDevice((String)selectedValue);
         
          javax.media.protocol.DataSource dataSource = javax.media.Manager.createDataSource(cdi.getLocator());
          dataSource.connect();
         
          b.append("Name = " + cdi.getName());
         
          b.append("\n\n");
          b.append("Locator = " + cdi.getLocator());

          b.append("\n\n");
          b.append("Output Formats ---->\n\n");
         
          final Format[] outputFormats = cdi.getFormats();
          if ( null != outputFormats )
          {
            for (int i=0; i<outputFormats.length; i++)
            {
              b.append(i + ". " + outputFormats[i].getClass().getName() + "\n " + outputFormats[i] + "\n");
View Full Code Here

      // if we add only a small subset, we miss some, building the graph is faster with leaving it as it is
      Format[] formats = net.sf.fmj.media.protocol.javasound.DataSource.querySupportedFormats(i);
     
      if ( (null != formats) && (formats.length > 0) )
      {
        CaptureDeviceInfo jmfInfo = new CaptureDeviceInfo("javasound:" + mixerInfo[i].getName() + ":" + index, new MediaLocator("javasound:#" + i), formats);
        index++;
       
        if (CaptureDeviceManager.getDevice(jmfInfo.getName()) == null)
        {
          CaptureDeviceManager.addDevice(jmfInfo);
          logger.fine("CaptureDevicePlugger: Added " + jmfInfo.getLocator());
        }
        else
        {
          logger.fine("CaptureDevicePlugger: Already present, skipping " + jmfInfo.getLocator());
        }
      }
    }
  }
View Full Code Here

          // thats how jmf does it
          // the name is constructed <library name>:<capture device name>:<index>
          // we will have unique names ( important for getDevice ) and we can fetch a human readable name easily
          // simply split the String from getName, use the second substring, you can display this name on screen
         
          final CaptureDeviceInfo jmfInfo;
          if (QUERY_EXACT_FORMATS)
          {
            final Format[] formats = getFormats(system, civilInfo.getDeviceID());
            jmfInfo = new CaptureDeviceInfo("civil:" + civilInfo.getDescription() + ":" + i, new MediaLocator("civil:" + civilInfo.getDeviceID()), formats);
          }
          else
          {
            jmfInfo = new CaptureDeviceInfo("civil:" + civilInfo.getDescription() + ":" + i, new MediaLocator("civil:" + civilInfo.getDeviceID()), new Format[] {new RGBFormat()});
          }
         
          if (CaptureDeviceManager.getDevice(jmfInfo.getName()) == null)
          {
            CaptureDeviceManager.addDevice(jmfInfo);
            logger.fine("CaptureDevicePlugger: Added " + jmfInfo.getLocator());
          }
          else
          {
            logger.fine("CaptureDevicePlugger: Already present, skipping " + jmfInfo.getLocator());
          }
        }
       
      }
    }
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.