Package javax.media

Examples of javax.media.MediaLocator


  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


  super();
  }


  public DataSource(URL url)
  {  setLocator(new MediaLocator(url));
   
  }
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

//          // Exit if we can't find a device that does linear,
//            // 44100Hz, 16 bit,
//          // stereo audio.
//          System.exit(-1);
      try {
          p = Manager.createProcessor(new MediaLocator(srcUrl));
          System.out.println("Processor: " + p);
          sh = new StateHelper(p);
      } catch (IOException e) {
        e.printStackTrace();
          System.exit(-1);
      } catch (NoProcessorException e) {
        e.printStackTrace();
          System.exit(-1);
      }
      // Configure the processor
      if (!sh.configure(100000))
      {   System.err.println("Failed to configure within 100 secs");
        System.exit(-1);
      }
      // Set the output content type and realize the processor
      p.setContentDescriptor(new
                    FileTypeDescriptor(outputType));
      if (!sh.realize(100000))
      {  
       System.err.println("Failed to realize within 100 secs");
        System.exit(-1);
      }
      // get the output of the processor
      DataSource source = p.getDataOutput();
      System.out.println("p.getDataOutput()=" + source);
     System.out.println("source.getContentType()=" + source.getContentType());
      // create a File protocol MediaLocator with the location of the
      // file to which the data is to be written
      MediaLocator dest = new MediaLocator(destUrl);
      // create a datasink to do the file writing & open the sink to
      // make sure we can write to it.
      DataSink filewriter = null;
      try {
          filewriter = Manager.createDataSink(source, dest);
View Full Code Here

      d.connect();
      assertEquals(d.getContentType(), "text.html");
     
     
      com.sun.media.protocol.file.DataSource d2 = new com.sun.media.protocol.file.DataSource();
      d2.setLocator(new MediaLocator("file://" + file.getAbsolutePath()));
      d2.connect();
      assertEquals(d2.getContentType(), "text.html");
     
     
     
View Full Code Here

  public void testMediaLocator() throws MalformedURLException
  {
    File f = new File("test.txt");
    System.out.println(f.toURI());
    System.out.println(f.toURI().toURL());
    MediaLocator l = new MediaLocator(f.toURI().toURL());
   
  }
View Full Code Here

    synchronized(PackageManager.class// to avoid conflicts with other tests
    {
   
      String test = "file://" + new File("samplemedia/safexmas.mov").getAbsolutePath();
 
      final Player p = Manager.createPlayer(new MediaLocator(test));
      //System.out.println(p);
     
    }
  }
View Full Code Here

        p.setSource(null);
        p.setStopTime(new Time(0));
        p.setTimeBase(null);
       
       
        p.setMediaLocator(new MediaLocator("file:samplemedia/betterway.wav2"));
       
       
        assertTrue(p.getPlayer() == null);
        assertEquals(p.getState(), MediaPlayer.Unrealized);
        assertEquals(p.getMediaTime().getNanoseconds(), Long.MAX_VALUE);
View Full Code Here

  {
    // init FMJ/JMF logging/classpath
    FmjStartup.init();
   
    // create both data sources:
    final DataSource dsAudio = Manager.createDataSource(new MediaLocator("javasound://"));
    final DataSource dsVideo = Manager.createDataSource(new MediaLocator("civil:/0"));
   
    // merge them:
    final DataSource ds = Manager.createMergingDataSource(new DataSource[] {dsAudio, dsVideo});
   
    // create a player:
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);
      }
     
    }
View Full Code Here

TOP

Related Classes of javax.media.MediaLocator

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.